@nextclaw/ui 0.20.3 → 0.21.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/CHANGELOG.md +23 -0
- package/dist/assets/{api-iMkU_o5P.js → api-DNLQPHfQ.js} +5 -5
- package/dist/assets/{appearance-settings-page-CU5k4b-M.js → appearance-settings-page-BlAFMOGV.js} +1 -1
- package/dist/assets/{book-open-nD8gdMhA.js → book-open-BryfPTTa.js} +1 -1
- package/dist/assets/{channels-list-page-Drlt62kY.js → channels-list-page-Cfbgubyv.js} +2 -2
- package/dist/assets/{config-split-page-BtJZp1E5.js → config-split-page-Dd8xG0Jk.js} +1 -1
- package/dist/assets/{confirm-dialog-k2-Jq_x3.js → confirm-dialog-CZIWjnJ6.js} +2 -2
- package/dist/assets/{createLucideIcon-DxlwKLr-.js → createLucideIcon-BxwVe8ZD.js} +1 -1
- package/dist/assets/desktop-capabilities-page-C6YxsHeV.js +1 -0
- package/dist/assets/desktop-update-config-BVN4QPJn.js +1 -0
- package/dist/assets/{dist-m08DUswB.js → dist-BRloKr3S.js} +1 -1
- package/dist/assets/{dist-Cy_e4kNb.js → dist-Cd8Nm3BW.js} +1 -1
- package/dist/assets/{doc-browser-npOvWtgf.js → doc-browser-Bzgqmmiu.js} +1 -1
- package/dist/assets/doc-browser-D0qI0Z_R.js +1 -0
- package/dist/assets/{doc-browser-context-jiy-O4F8.js → doc-browser-context-3JGufiMA.js} +1 -1
- package/dist/assets/{extensions-CIb17__o.js → extensions-Dedd2oDI.js} +1 -1
- package/dist/assets/{form-actions-DGf5zUg_.js → form-actions-FWCEof3V.js} +1 -1
- package/dist/assets/index-CXkHcESm.css +1 -0
- package/dist/assets/index-D25tRg1p.js +109 -0
- package/dist/assets/loader-circle-BoyCoFps.js +1 -0
- package/dist/assets/mcp-marketplace-page-Cn-9CDh3.js +1 -0
- package/dist/assets/mcp-marketplace-page-e9Rmfz-d.js +10 -0
- package/dist/assets/model-config-page-C173Ssil.js +1 -0
- package/dist/assets/{navigation-link-DAfwFCj4.js → navigation-link-DTPOvGGL.js} +1 -1
- package/dist/assets/plus-D1R4Vipq.js +1 -0
- package/dist/assets/privacy-settings-page-CRserBVF.js +1 -0
- package/dist/assets/providers-config-page-C8jUtnZb.js +1 -0
- package/dist/assets/react-BAzO6LZS.js +8 -0
- package/dist/assets/{refresh-cw-D_Eibznw.js → refresh-cw-BCj-yjde.js} +1 -1
- package/dist/assets/remote-6BHWP5zi.js +1 -0
- package/dist/assets/{rotate-cw-QQjmoWuq.js → rotate-cw-BPnW4qUl.js} +1 -1
- package/dist/assets/runtime-config-page-aeQ1Dryz.js +1 -0
- package/dist/assets/{save-W2xthJJ2.js → save-KT0MumfJ.js} +1 -1
- package/dist/assets/{search-Vih1R2BD.js → search-Cv1Hx_nx.js} +1 -1
- package/dist/assets/{search-config-page-CtBcL2uc.js → search-config-page-b283V-fo.js} +1 -1
- package/dist/assets/{secrets-config-page-Q6XfIj0h.js → secrets-config-page-ss7x3BOo.js} +2 -2
- package/dist/assets/security-config-HHz62oxH.js +1 -0
- package/dist/assets/{select-lNdozU4o.js → select-BVgD4EpG.js} +1 -1
- package/dist/assets/skeleton-ChUmcyys.js +1 -0
- package/dist/assets/{tag-chip-gdaU9bE7.js → tag-chip-DZ4ircUB.js} +1 -1
- package/dist/assets/x-BWDRfVWL.js +1 -0
- package/dist/index.html +21 -21
- package/package.json +7 -7
- package/src/app/components/layout/sidebar.tsx +5 -1
- package/src/app/configs/app-navigation.config.ts +17 -2
- package/src/app/hooks/use-feature-controls.ts +11 -0
- package/src/app/index.tsx +10 -0
- package/src/features/chat/components/layout/chat-sidebar.tsx +1 -0
- package/src/features/chat/features/session/components/__tests__/chat-sidebar-session-item.test.tsx +12 -0
- package/src/features/chat/features/session/components/chat-sidebar-session-entry.tsx +3 -0
- package/src/features/chat/features/session/components/chat-sidebar-session-item.tsx +14 -1
- package/src/features/chat/features/session/utils/chat-session-deletion.utils.ts +25 -0
- package/src/features/chat/managers/__tests__/chat-thread-deletion.manager.test.ts +125 -0
- package/src/features/chat/managers/__tests__/chat-thread.manager.test.ts +0 -37
- package/src/features/chat/managers/chat-thread.manager.ts +17 -28
- package/src/features/desktop-capabilities/components/desktop-authorization-dialog.test.tsx +58 -0
- package/src/features/desktop-capabilities/components/desktop-authorization-dialog.tsx +161 -0
- package/src/features/desktop-capabilities/hooks/use-desktop-capabilities.test.ts +10 -0
- package/src/features/desktop-capabilities/hooks/use-desktop-capabilities.ts +55 -0
- package/src/features/desktop-capabilities/index.ts +1 -0
- package/src/features/desktop-capabilities/managers/desktop-capability.manager.ts +25 -0
- package/src/features/desktop-capabilities/pages/desktop-capabilities-page.test.tsx +44 -0
- package/src/features/desktop-capabilities/pages/desktop-capabilities-page.tsx +171 -0
- package/src/features/desktop-capabilities/stores/desktop-authorization.store.ts +21 -0
- package/src/features/marketplace/components/mcp/__tests__/mcp-connection-dialog.test.tsx +23 -0
- package/src/features/marketplace/components/mcp/mcp-connection-dialog.tsx +35 -0
- package/src/features/marketplace/components/mcp/mcp-marketplace-page.tsx +20 -2
- package/src/platforms/mobile/components/mobile-settings-shell.tsx +5 -1
- package/src/shared/components/ui/__tests__/confirm-dialog.test.tsx +31 -0
- package/src/shared/components/ui/confirm-dialog.tsx +11 -1
- package/src/shared/lib/api/index.ts +1 -0
- package/src/shared/lib/api/utils/mcp-connection.utils.ts +10 -0
- package/src/shared/lib/i18n/locales/en-US/chat.json +2 -0
- package/src/shared/lib/i18n/locales/en-US/core.json +43 -0
- package/src/shared/lib/i18n/locales/en-US/marketplace.json +29 -1
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +2 -0
- package/src/shared/lib/i18n/locales/zh-CN/core.json +43 -0
- package/src/shared/lib/i18n/locales/zh-CN/marketplace.json +29 -1
- package/dist/assets/desktop-update-config-BiZmy7FC.js +0 -1
- package/dist/assets/doc-browser-CPsPHh12.js +0 -1
- package/dist/assets/index-C86hxgv5.css +0 -1
- package/dist/assets/index-CYBXR7zN.js +0 -109
- package/dist/assets/loader-circle-BlLuRFVW.js +0 -1
- package/dist/assets/mcp-marketplace-page-B12JNh7Q.js +0 -1
- package/dist/assets/mcp-marketplace-page-kLWW6kzt.js +0 -9
- package/dist/assets/model-config-page-DSeAjVT_.js +0 -1
- package/dist/assets/plus-D4LtWtTk.js +0 -1
- package/dist/assets/privacy-settings-page-tN0Mt15x.js +0 -1
- package/dist/assets/providers-config-page-CgPrXR1u.js +0 -1
- package/dist/assets/react-8iBFECZE.js +0 -8
- package/dist/assets/remote-Derr_AQp.js +0 -1
- package/dist/assets/runtime-config-page-Crq96Jjq.js +0 -1
- package/dist/assets/security-config-CE9rkQvq.js +0 -1
- package/dist/assets/skeleton-B__aTcly.js +0 -1
- package/dist/assets/x-CWdWBu_U.js +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-ySrvolIe.js","assets/preload-helper-D4M6sveU.js","assets/chunk-HOUHSVGY-DPkq8FCm.js","assets/src-Bw-mzbQb.js","assets/chunk-DseTPa7n.js","assets/chunk-Y2CYZVJY-D1mAU_Po.js","assets/chunk-WYO6CB5R-Dn9To_OI.js","assets/chunk-ICXQ74PX-FAatv5fC.js","assets/dist--ta5rX12.js","assets/chunk-Q4XR5HBZ-DQFeUPxZ.js","assets/chunk-52WLFC77-viIcqj9q.js","assets/line-Cos7PIOj.js","assets/path-10BjdyLh.js","assets/array-BQVzeGRt.js","assets/chunk-7BUUIJ7U-BvydOcm3.js","assets/chunk-C7G6YPKG-DAizzYwr.js","assets/chunk-OGEWGWER-C3jdH3Ty.js","assets/chunk-ZGVPDNZ5-C6YtZDU0.js","assets/rough.esm-DxgC_14r.js","assets/chunk-FWX5IMBZ-D0ksHZZ9.js","assets/chunk-VAUOI2AC-BGvh3yIx.js","assets/chunk-ZIRB5QZD-DMuYtnHF.js","assets/docx-preview-BqwAjrj3.js","assets/jszip.min-8hyJpgpx.js","assets/aiden0z-pptx-renderer.es-Dp2ezlQn.js","assets/doc-browser-D0qI0Z_R.js","assets/doc-browser-Bzgqmmiu.js","assets/dist-Cd8Nm3BW.js","assets/react-BAzO6LZS.js","assets/dist-BRloKr3S.js","assets/createLucideIcon-BxwVe8ZD.js","assets/search-Cv1Hx_nx.js","assets/book-open-BryfPTTa.js","assets/navigation-link-DTPOvGGL.js","assets/host-capabilities-Tk038i04.js","assets/plus-D1R4Vipq.js","assets/refresh-cw-BCj-yjde.js","assets/x-BWDRfVWL.js","assets/doc-browser-context-3JGufiMA.js","assets/middleware-DXsbf9xI.js","assets/model-config-page-C173Ssil.js","assets/api-DNLQPHfQ.js","assets/loader-circle-BoyCoFps.js","assets/form-actions-FWCEof3V.js","assets/skeleton-ChUmcyys.js","assets/config-hints-nV5HPOvq.js","assets/appearance-settings-page-BlAFMOGV.js","assets/select-BVgD4EpG.js","assets/mcp-marketplace-page-e9Rmfz-d.js","assets/confirm-dialog-CZIWjnJ6.js","assets/tag-chip-DZ4ircUB.js","assets/search-config-page-b283V-fo.js","assets/config-split-page-Dd8xG0Jk.js","assets/providers-config-page-C8jUtnZb.js","assets/extensions-Dedd2oDI.js","assets/channels-list-page-Cfbgubyv.js","assets/runtime-config-page-aeQ1Dryz.js","assets/rotate-cw-BPnW4qUl.js","assets/save-KT0MumfJ.js","assets/desktop-update-config-BVN4QPJn.js","assets/security-config-HHz62oxH.js","assets/secrets-config-page-ss7x3BOo.js","assets/privacy-settings-page-CRserBVF.js","assets/desktop-capabilities-page-C6YxsHeV.js","assets/mcp-marketplace-page-Cn-9CDh3.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,t as n}from"./chunk-DseTPa7n.js";import{A as r,B as i,C as a,D as o,E as s,F as c,H as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,V as v,_ as y,a as b,b as x,c as S,f as C,g as w,h as T,i as E,j as D,k as O,n as k,o as A,p as j,r as M,s as N,t as P,v as ee,w as te,x as ne,y as re,z as ie}from"./react-BAzO6LZS.js";import{t as ae}from"./preload-helper-D4M6sveU.js";import{a as oe,c as se,d as ce,f as le,i as ue,l as de,n as fe,o as pe,r as me,s as he,t as ge,u as _e}from"./navigation-link-DTPOvGGL.js";import{$ as ve,$t as ye,A as be,An as xe,B as Se,Bt as Ce,C as we,Cn as Te,Ct as Ee,D as De,Dn as Oe,Dt as ke,E as Ae,En as je,Et as Me,F as Ne,Fn as Pe,Ft as Fe,Ht as Ie,I as Le,In as Re,It as F,Jt as ze,L as Be,Ln as Ve,Lt as He,M as Ue,N as We,Nt as Ge,O as Ke,On as eee,Ot as qe,P as Je,Pn as Ye,Pt as Xe,Q as Ze,Qt as Qe,R as $e,Rn as et,S as tt,Sn as nt,St as rt,T as it,Tn as at,Tt as ot,Ut as st,V as ct,Vt as lt,X as ut,Yt as dt,Z as ft,Zt as pt,_ as mt,_n as I,_t as ht,a as gt,an as _t,at as vt,b as yt,bt,c as xt,cn as St,ct as tee,d as nee,dn as Ct,dt as wt,en as Tt,et as Et,fn as L,ft as Dt,g as Ot,gn as kt,gt as At,h as jt,hn as Mt,ht as Nt,i as Pt,it as Ft,j as It,k as Lt,kn as Rt,kt as zt,l as Bt,ln as Vt,lt as Ht,m as Ut,mn as Wt,mt as Gt,n as Kt,nn as qt,nt as Jt,o as Yt,on as Xt,ot as Zt,p as Qt,pn as $t,pt as en,qt as tn,r as nn,rn,rt as an,s as on,sn,st as cn,t as ln,tt as un,u as dn,un as fn,ut as pn,v as mn,vn as R,vt as hn,w as gn,wn as _n,wt as vn,x as yn,xn as bn,xt as xn,y as Sn,yn as z,yt as Cn,z as wn,zn as Tn,zt as En}from"./api-DNLQPHfQ.js";import{C as Dn,S as On,T as kn,_ as An,a as jn,b as Mn,c as Nn,d as Pn,f as Fn,g as In,h as Ln,i as Rn,l as zn,m as Bn,n as Vn,o as Hn,p as ree,r as iee,s as aee,u as oee,v as Un,w as Wn,x as Gn,y as see}from"./mcp-marketplace-page-e9Rmfz-d.js";import{a as Kn,b as qn,c as Jn,d as Yn,f as Xn,h as Zn,i as Qn,l as $n,m as er,o as tr,r as nr,s as rr,v as ir,y as ar}from"./dist-Cd8Nm3BW.js";import{C as or,D as sr,E as cr,O as lr,S as ur,T as dr,_ as fr,a as pr,b as mr,c as hr,d as gr,f as _r,g as vr,h as yr,i as br,l as xr,m as Sr,n as Cr,o as wr,p as Tr,r as Er,s as Dr,t as Or,u as kr,v as Ar,w as jr,x as Mr,y as Nr}from"./select-BVgD4EpG.js";import{t as Pr}from"./dist-BRloKr3S.js";import{a as Fr,c as Ir,d as Lr,f as Rr,g as zr,h as Br,i as Vr,l as Hr,m as Ur,n as Wr,o as Gr,p as Kr,r as qr,s as Jr,t as Yr,u as Xr}from"./confirm-dialog-CZIWjnJ6.js";import{t as B}from"./createLucideIcon-BxwVe8ZD.js";import{C as Zr,D as Qr,E as $r,O as ei,S as ti,T as ni,_ as ri,a as ii,b as ai,c as oi,d as si,f as ci,g as li,h as ui,i as di,k as fi,l as pi,m as mi,n as hi,o as gi,p as V,r as _i,s as vi,u as yi,v as bi,w as xi,x as Si,y as Ci}from"./doc-browser-Bzgqmmiu.js";import{n as wi,t as Ti}from"./search-Cv1Hx_nx.js";import{t as Ei}from"./book-open-BryfPTTa.js";import{t as Di}from"./loader-circle-BoyCoFps.js";import{t as Oi}from"./plus-D1R4Vipq.js";import{t as ki}from"./refresh-cw-BCj-yjde.js";import{t as Ai}from"./x-BWDRfVWL.js";import{t as ji}from"./host-capabilities-Tk038i04.js";import{n as Mi,t as Ni}from"./middleware-DXsbf9xI.js";import{t as Pi}from"./skeleton-ChUmcyys.js";import{_ as Fi,a as Ii,c as Li,d as Ri,g as zi,h as Bi,i as Vi,l as Hi,n as Ui,o as Wi,p as Gi,r as Ki,s as qi,t as Ji,u as Yi,v as Xi}from"./doc-browser-context-3JGufiMA.js";import{t as Zi}from"./tag-chip-DZ4ircUB.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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Qi=n((e=>{var t=v();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}));function $i(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ea(e,t,n){let r=e.slice(0);return r[t]=n,r}var ta=class extends Tn{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Pe.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!et(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&($i(e,n).forEach(e=>{e.destroy()}),$i(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=Ve(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new Ye(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ea(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&Pe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(l(),1);function na({queries:e,...t},n){let r=xe(n),i=eee(),a=Oe(),o=H.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{bn(e),_n(e,a,r.getQueryCache().get(e.queryHash))}),je(a);let[s]=H.useState(()=>new ta(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;H.useSyncExternalStore(H.useCallback(e=>d?s.subscribe(Pe.batchCalls(e)):Re,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),H.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Te(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Te(n,e)?nt(n,new Ye(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&at({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}var ra=B(`Activity`,[[`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`}]]),ia=B(`AlarmClock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),aa=B(`Archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),oa=B(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),sa=B(`ArrowUpRight`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),ca=B(`ArrowUp`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),cee=B(`Blocks`,[[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`path`,{d:`M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3`,key:`1fpvtg`}]]),lee=B(`BookOpenText`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),uee=B(`Bookmark`,[[`path`,{d:`m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z`,key:`1fy3hk`}]]),la=B(`Bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),dee=B(`Braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),ua=B(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),da=B(`Brain`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`,key:`ep3f8r`}],[`path`,{d:`M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4`,key:`1p4c4q`}],[`path`,{d:`M17.599 6.5a3 3 0 0 0 .399-1.375`,key:`tmeiqw`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M19.938 10.5a4 4 0 0 1 .585.396`,key:`1qfode`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M19.967 17.484A4 4 0 0 1 18 18`,key:`159ez6`}]]),fee=B(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),fa=B(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),pa=B(`CalendarDays`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),pee=B(`ChartNoAxesColumnIncreasing`,[[`line`,{x1:`12`,x2:`12`,y1:`20`,y2:`10`,key:`1vz5eb`}],[`line`,{x1:`18`,x2:`18`,y1:`20`,y2:`4`,key:`cun8e5`}],[`line`,{x1:`6`,x2:`6`,y1:`20`,y2:`16`,key:`hq0ia6`}]]),mee=B(`ChartNoAxesColumn`,[[`line`,{x1:`18`,x2:`18`,y1:`20`,y2:`10`,key:`1xfpm4`}],[`line`,{x1:`12`,x2:`12`,y1:`20`,y2:`4`,key:`be30l9`}],[`line`,{x1:`6`,x2:`6`,y1:`20`,y2:`14`,key:`1r4le6`}]]),ma=B(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ha=B(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),hee=B(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ga=B(`ChevronsUp`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),_a=B(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),va=B(`CircleDashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),ya=B(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ba=B(`CirclePause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),xa=B(`CirclePlay`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polygon`,{points:`10 8 16 12 10 16 10 8`,key:`1cimsy`}]]),Sa=B(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),Ca=B(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),wa=B(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ta=B(`CodeXml`,[[`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`}]]),Ea=B(`Command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Da=B(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Oa=B(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ka=B(`CornerDownRight`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),Aa=B(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),ja=B(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Ma=B(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Na=B(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Pa=B(`Expand`,[[`path`,{d:`m21 21-6-6m6 6v-4.8m0 4.8h-4.8`,key:`1c15vz`}],[`path`,{d:`M3 16.2V21m0 0h4.8M3 21l6-6`,key:`1fsnz2`}],[`path`,{d:`M21 7.8V3m0 0h-4.8M21 3l-6 6`,key:`hawz9i`}],[`path`,{d:`M3 7.8V3m0 0h4.8M3 3l6 6`,key:`u9ee12`}]]),Fa=B(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ia=B(`FileArchive`,[[`path`,{d:`M10 12v-1`,key:`v7bkov`}],[`path`,{d:`M10 18v-2`,key:`1cjy8d`}],[`path`,{d:`M10 7V6`,key:`dljcrl`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01`,key:`gkbcor`}],[`circle`,{cx:`10`,cy:`20`,r:`2`,key:`1xzdoj`}]]),La=B(`FileAudio2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2`,key:`17k7jt`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`3`,cy:`17`,r:`1`,key:`vo6nti`}],[`path`,{d:`M2 17v-3a4 4 0 0 1 8 0v3`,key:`1ggdre`}],[`circle`,{cx:`9`,cy:`17`,r:`1`,key:`bc1fq4`}]]),Ra=B(`FileCode2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m5 12-3 3 3 3`,key:`oke12k`}],[`path`,{d:`m9 18 3-3-3-3`,key:`112psh`}]]),za=B(`FileImage`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Ba=B(`FileJson2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`fq0c9t`}],[`path`,{d:`M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`4gibmv`}]]),Va=B(`FilePlus2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M3 15h6`,key:`4e2qda`}],[`path`,{d:`M6 12v6`,key:`1u72j0`}]]),Ha=B(`FileSpreadsheet`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),Ua=B(`FileVideo2`,[[`path`,{d:`M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4`,key:`1pf5j1`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`rect`,{width:`8`,height:`6`,x:`2`,y:`12`,rx:`1`,key:`1a6c1e`}],[`path`,{d:`m10 15.5 4 2.5v-6l-4 2.5`,key:`t7cp39`}]]),Wa=B(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),Ga=B(`Files`,[[`path`,{d:`M20 7h-3a2 2 0 0 1-2-2V2`,key:`x099mo`}],[`path`,{d:`M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z`,key:`18t6ie`}],[`path`,{d:`M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8`,key:`1nja0z`}]]),Ka=B(`FolderKanban`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]),qa=B(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),Ja=B(`FolderPlus`,[[`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`}]]),Ya=B(`FolderTree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Xa=B(`FolderUp`,[[`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`}],[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`m9 13 3-3 3 3`,key:`1pxg3c`}]]),Za=B(`FolderX`,[[`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`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]),Qa=B(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),$a=B(`Forward`,[[`polyline`,{points:`15 17 20 12 15 7`,key:`1w3sku`}],[`path`,{d:`M4 18v-2a4 4 0 0 1 4-4h12`,key:`jmiej9`}]]),eo=B(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),to=B(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),no=B(`Globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),ro=B(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),io=B(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),ao=B(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),oo=B(`House`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),so=B(`Image`,[[`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`}]]),co=B(`Inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),lo=B(`KeyRound`,[[`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`}]]),uo=B(`Languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),fo=B(`Laptop`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),po=B(`LayoutDashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),mo=B(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ho=B(`Lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),go=B(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),_o=B(`ListCollapse`,[[`path`,{d:`m3 10 2.5-2.5L3 5`,key:`i6eama`}],[`path`,{d:`m3 19 2.5-2.5L3 14`,key:`w2gmor`}],[`path`,{d:`M10 6h11`,key:`c7qv1k`}],[`path`,{d:`M10 12h11`,key:`6m4ad9`}],[`path`,{d:`M10 18h11`,key:`11hvi2`}]]),vo=B(`ListTodo`,[[`rect`,{x:`3`,y:`5`,width:`6`,height:`6`,rx:`1`,key:`1defrl`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),yo=B(`ListTree`,[[`path`,{d:`M21 12h-8`,key:`1bmf0i`}],[`path`,{d:`M21 6H8`,key:`1pqkrb`}],[`path`,{d:`M21 18h-8`,key:`1tm79t`}],[`path`,{d:`M3 6v4c0 1.1.9 2 2 2h3`,key:`1ywdgy`}],[`path`,{d:`M3 10v6c0 1.1.9 2 2 2h3`,key:`2wc746`}]]),bo=B(`LocateFixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),xo=B(`LogOut`,[[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}],[`polyline`,{points:`16 17 21 12 16 7`,key:`1gabdz`}],[`line`,{x1:`21`,x2:`9`,y1:`12`,y2:`12`,key:`1uyos4`}]]),So=B(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Co=B(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),wo=B(`MessageSquarePlus`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M12 7v6`,key:`lw1j43`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}]]),To=B(`MessageSquareQuote`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M8 12a2 2 0 0 0 2-2V8H8`,key:`1jfesj`}],[`path`,{d:`M14 12a2 2 0 0 0 2-2V8h-2`,key:`1dq9mh`}]]),Eo=B(`MessageSquareText`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}],[`path`,{d:`M13 8H7`,key:`14i4kc`}],[`path`,{d:`M17 12H7`,key:`16if0g`}]]),Do=B(`MessageSquare`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Oo=B(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),ko=B(`Minimize2`,[[`polyline`,{points:`4 14 10 14 10 20`,key:`11kfnr`}],[`polyline`,{points:`20 10 14 10 14 4`,key:`rlmsce`}],[`line`,{x1:`14`,x2:`21`,y1:`10`,y2:`3`,key:`o5lafz`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Ao=B(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),jo=B(`MonitorCog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m15.2 4.9-.9-.4`,key:`12wd2u`}],[`path`,{d:`m15.2 7.1-.9.4`,key:`1r2vl7`}],[`path`,{d:`m16.9 3.2-.4-.9`,key:`3zbo91`}],[`path`,{d:`m16.9 8.8-.4.9`,key:`1qr2dn`}],[`path`,{d:`m19.5 2.3-.4.9`,key:`1rjrkq`}],[`path`,{d:`m19.5 9.7-.4-.9`,key:`heryx5`}],[`path`,{d:`m21.7 4.5-.9.4`,key:`17fqt1`}],[`path`,{d:`m21.7 7.5-.9-.4`,key:`14zyni`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Mo=B(`Monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),No=B(`Newspaper`,[[`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`,key:`7pis2x`}],[`path`,{d:`M18 14h-8`,key:`sponae`}],[`path`,{d:`M15 18h-5`,key:`95g1m2`}],[`path`,{d:`M10 6h8v4h-8V6Z`,key:`smlsk5`}]]),Po=B(`NotebookText`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),Fo=B(`PackagePlus`,[[`path`,{d:`M16 16h6`,key:`100bgy`}],[`path`,{d:`M19 13v6`,key:`85cyf1`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),Io=B(`Palette`,[[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z`,key:`12rzf8`}]]),Lo=B(`PanelLeftClose`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Ro=B(`PanelLeftDashed`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 14v1`,key:`askpd8`}],[`path`,{d:`M9 19v2`,key:`16tejx`}],[`path`,{d:`M9 3v2`,key:`1noubl`}],[`path`,{d:`M9 9v1`,key:`19ebxg`}]]),zo=B(`PanelLeftOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Bo=B(`PanelLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Vo=B(`PanelRightClose`,[[`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`}]]),Ho=B(`Paperclip`,[[`path`,{d:`m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48`,key:`1u3ebp`}]]),Uo=B(`Pause`,[[`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`zuxfzm`}],[`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`,key:`1okwgv`}]]),Wo=B(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),Go=B(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ko=B(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),qo=B(`Puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Jo=B(`Radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),Yo=B(`RefreshCcw`,[[`path`,{d:`M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`14sxne`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16`,key:`1hlbsb`}],[`path`,{d:`M16 16h5v5`,key:`ccwih5`}]]),Xo=B(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Zo=B(`Send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Qo=B(`Server`,[[`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`}]]),$o=B(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),es=B(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ts=B(`ShieldAlert`,[[`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`}]]),ns=B(`ShieldCheck`,[[`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`}]]),rs=B(`Shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),is=B(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),as=B(`SquareArrowOutUpRight`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),os=B(`SquareCheck`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ss=B(`SquarePen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.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`}]]),cs=B(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),ls=B(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),us=B(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),ds=B(`Store`,[[`path`,{d:`m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7`,key:`ztvudi`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}],[`path`,{d:`M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4`,key:`2ebpfo`}],[`path`,{d:`M2 7h20`,key:`1fcdvo`}],[`path`,{d:`M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7`,key:`6c3vgh`}]]),fs=B(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ps=B(`TextQuote`,[[`path`,{d:`M17 6H3`,key:`16j9eg`}],[`path`,{d:`M21 12H8`,key:`scolzb`}],[`path`,{d:`M21 18H8`,key:`1wfozv`}],[`path`,{d:`M3 12v6`,key:`fv4c87`}]]),ms=B(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),hs=B(`TriangleAlert`,[[`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`}]]),gs=B(`Unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),_s=B(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),vs=B(`User`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),ys=B(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),bs=B(`Workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),xs=B(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),Ss=Qi(),U=i(),Cs={active:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},ready:{dot:`bg-emerald-500`,text:`text-emerald-600`,bg:`bg-emerald-50`},inactive:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},setup:{dot:`bg-gray-300`,text:`text-gray-400`,bg:`bg-gray-100/80`},warning:{dot:`bg-amber-400`,text:`text-amber-600`,bg:`bg-amber-50`}};function ws({status:e,label:t,className:n}){let r=Cs[e];return(0,U.jsxs)(`div`,{className:u(`inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2 py-0.5`,r.bg,n),children:[(0,U.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,U.jsx)(`span`,{className:u(`text-[11px] font-medium`,r.text),children:t})]})}function Ts(){return z({queryKey:Os,queryFn:jt,staleTime:5e3,refetchOnWindowFocus:!0})}function Es(e){let{label:t,muted:n,value:r}=e;return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:t}),(0,U.jsx)(`span`,{className:n?`text-right text-muted-foreground`:`text-right text-foreground`,children:r==null||r===``?`-`:String(r)})]})}function Ds(){let e=N9(),t=Ts(),n=t.data,r=Is(e=>e.actionLabel),i=(0,H.useMemo)(()=>Hs(n),[n]),a=!!r,o=n?.runtime?.deviceName?.trim()||n?.settings.deviceName?.trim()||b(`remoteDeviceNameAuto`),s=!!(n?.account.loggedIn&&Fs(n)),{hero:c,issueHint:l}=i;return(0,H.useEffect)(()=>{e.remoteAccessManager.syncStatus(n)},[e,n]),t.isLoading&&!n?(0,U.jsx)(sn,{title:b(`remotePageTitle`),description:b(`remotePageDescription`),children:(0,U.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:b(`remoteLoading`)})}):(0,U.jsx)(sn,{title:b(`remotePageTitle`),description:b(`remotePageDescription`),children:(0,U.jsxs)(`div`,{className:`grid gap-7 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,U.jsx)(Xt,{title:c.title,description:c.description,actions:(0,U.jsx)(ws,{status:c.badgeStatus,label:c.badgeLabel}),children:(0,U.jsx)(_t,{children:(0,U.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(Es,{label:b(`remoteSignedInAccount`),value:n?.account.email}),(0,U.jsx)(Es,{label:b(`remoteDeviceName`),value:o}),(0,U.jsx)(Es,{label:b(`remoteConnectionStatus`),value:c.badgeLabel}),(0,U.jsx)(Es,{label:b(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?M(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[i.primaryAction?(0,U.jsxs)(L,{onClick:()=>{if(i.primaryAction?.kind===`reauthorize`){e.remoteAccessManager.reauthorizeRemoteAccess(n);return}if(i.primaryAction?.kind===`repair`){e.remoteAccessManager.repairRemoteAccess(n);return}e.remoteAccessManager.enableRemoteAccess(n)},disabled:a,children:[i.primaryAction.showRefreshIcon?(0,U.jsx)(Yo,{className:`mr-2 h-4 w-4`}):null,r||i.primaryAction.label]}):null,(0,U.jsxs)(L,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:a||!s,children:[(0,U.jsx)(as,{className:`mr-2 h-4 w-4`}),b(`remoteOpenDeviceList`)]}),n?.settings.enabled?(0,U.jsx)(L,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(n),disabled:a,children:b(`remoteDisable`)}):null]}),i.shouldShowIssueHint&&l?(0,U.jsx)(Dn,{tone:`warning`,title:l.title,description:l.body}):null,(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`remoteOpenWebHint`)})]})})}),(0,U.jsx)(Xt,{title:(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(fo,{className:`h-4 w-4 text-primary`}),b(`remoteDeviceSectionTitle`)]}),description:b(`remoteDeviceSectionDescription`),children:(0,U.jsx)(_t,{children:(0,U.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(ws,{status:n?.account.loggedIn?`ready`:`inactive`,label:n?.account.loggedIn?b(`remoteAccountConnected`):b(`remoteAccountNotConnected`)}),(0,U.jsx)(ws,{status:n?.settings.enabled?`active`:`inactive`,label:n?.settings.enabled?b(`remoteEnabled`):b(`remoteStateDisabled`)}),(0,U.jsx)(ws,{status:n?.service.running?`active`:`inactive`,label:n?.service.running?b(`remoteServiceRunning`):b(`remoteServiceStopped`)})]}),(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(Es,{label:b(`remoteDeviceName`),value:o}),(0,U.jsx)(Es,{label:b(`remoteConnectionStatus`),value:c.badgeLabel}),(0,U.jsx)(Es,{label:b(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?M(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,U.jsx)(Dn,{tone:`neutral`,borderStyle:`dashed`,description:n?.account.loggedIn?b(`remoteOpenWebHint`):b(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})})})]})})}var Os=[`remote-status`],ks=`https://platform.nextclaw.io`,As=`https://nextclaw-platform-console.pages.dev`,js=async()=>await Mt.fetchQuery({queryKey:Os,queryFn:jt,staleTime:5e3}),Ms=async()=>(await Mt.invalidateQueries({queryKey:Os}),await js()),Ns=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function Ps(e){let t=e?.trim();if(!t)return;let n;try{n=new URL(t)}catch{return}if(n.hostname===`platform.nextclaw.io`||n.hostname===`nextclaw-platform-console.pages.dev`)return n.origin;if(n.hostname===`ai-gateway-api.nextclaw.io`)return ks;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return As}var Fs=e=>Ps(e?.account.apiBase)||Ps(e?.settings.platformApiBase)||Ps(e?.platformBase)||Ps(e?.account.platformBase)||void 0,Is=P(e=>({enabled:!1,deviceName:``,platformApiBase:``,advancedOpen:!1,draftTouched:!1,actionLabel:null,doctor:null,setEnabled:t=>e({enabled:t,draftTouched:!0}),setDeviceName:t=>e({deviceName:t,draftTouched:!0}),setPlatformApiBase:t=>e({platformApiBase:t,draftTouched:!0}),setAdvancedOpen:t=>e({advancedOpen:t}),hydrateDraft:({enabled:t,deviceName:n,platformApiBase:r})=>e({enabled:t,deviceName:n,platformApiBase:r,draftTouched:!1}),beginAction:t=>e({actionLabel:t}),finishAction:()=>e({actionLabel:null}),setDoctor:t=>e({doctor:t})})),Ls=class{constructor(e){this.params=e,this.syncStatus=e=>{if(!e)return;let t=Is.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{Is.getState().setEnabled(e)},this.setDeviceName=e=>{Is.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{Is.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{Is.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await Ms(),n=Is.getState(),r=await this.ensureRemoteAccount(t,n.platformApiBase);await this.applyEnabledState(!0,r)},this.disableRemoteAccess=async e=>{let t=e??await Ms();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await Ms(),n=(await this.ensureRemoteAccount(t)).service.running?`restart`:`start`;await this.runManagedAction({actionLabel:b(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await Qt(n);let e=await Ms();this.hydrateDraftFromStatus(e)},successMessage:b(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await Ms(),n=await this.params.accountManager.startBrowserSignInAndWait({status:t,apiBase:Is.getState().platformApiBase});await this.repairRemoteAccess(n)},this.saveAdvancedSettings=async e=>{let t=e??await Ms(),n=Is.getState();await this.runManagedAction({actionLabel:b(`remoteActionSavingAdvanced`),job:async()=>{await yt({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await Ms();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?b(`remoteSettingsSaved`):b(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:b(`remoteDoctorRunning`),job:async()=>{let e=await Ut();Is.getState().setDoctor(e)},successMessage:b(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,b(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,b(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,b(`remoteActionStopping`))},this.applyEnabledState=async(e,t)=>{let n=Is.getState();await this.runManagedAction({actionLabel:b(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await yt({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await Ms();this.hydrateDraftFromStatus(r),e?await Qt(r.service.running?`restart`:`start`):t.service.running&&await Qt(`restart`);let i=await Ms();this.hydrateDraftFromStatus(i)},successMessage:b(e?`remoteEnabledReady`:`remoteDisabledDone`)})},this.ensureRemoteAccount=async(e,t)=>e.account.loggedIn?e:await this.params.accountManager.ensureSignedIn({apiBase:t,status:e}),this.runServiceAction=async(e,t)=>{await this.runManagedAction({actionLabel:t,job:async()=>{let t=await Qt(e),n=await Ms();this.hydrateDraftFromStatus(n),I.success(t.message)}})},this.hydrateDraftFromStatus=e=>{Is.getState().hydrateDraft({enabled:e.settings.enabled,deviceName:e.settings.deviceName,platformApiBase:e.settings.platformApiBase})},this.runManagedAction=async e=>{let{actionLabel:t,job:n,successMessage:r}=e;Is.getState().beginAction(t);try{await n(),r&&I.success(r)}catch(e){let t=e instanceof Error?e.message:b(`error`);throw I.error(t),e}finally{Is.getState().finishAction()}}}},Rs=[/invalid or expired token/i,/missing bearer token/i,/token expired/i,/token is invalid/i,/run "nextclaw login"/i,/browser sign-in again/i];function zs(e){return e?.runtime?.lastError?.trim()||``}function Bs(e){let t=b(`remoteStatusIssueDetailGeneric`),n=zs(e);return n?`${t} (${n})`:t}function Vs(e){if(!e?.settings.enabled)return!1;let t=zs(e);return Rs.some(e=>e.test(t))}function Hs(e){return Vs(e)?{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteStateReauthorizationRequired`),title:b(`remoteStatusReauthorizationTitle`),description:b(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:b(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:b(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:b(`statusReady`),title:b(`remoteStatusReadyTitle`),description:b(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:b(`connecting`),title:b(`remoteStatusConnectingTitle`),description:b(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteStateDisconnected`),title:b(`remoteStatusIssueTitle`),description:b(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:Bs(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:b(`remoteServiceStopped`),title:b(`remoteStatusNeedsServiceTitle`),description:b(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:b(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:b(`remoteStatusRecoveryTitle`),body:b(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:b(`statusInactive`),title:b(`remoteStatusNeedsEnable`),description:b(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:b(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:b(`statusSetup`),title:b(`remoteStatusNeedsSignIn`),description:b(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:b(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var Us=P(e=>({panelOpen:!1,authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500,openPanel:()=>e({panelOpen:!0}),closePanel:()=>e({panelOpen:!1}),beginBrowserAuth:({sessionId:t,verificationUri:n,expiresAt:r,intervalMs:i,statusMessage:a})=>e({panelOpen:!0,authSessionId:t,authVerificationUri:n,authExpiresAt:r,authPollIntervalMs:i,authStatusMessage:a}),updateBrowserAuth:({statusMessage:t,intervalMs:n})=>e(e=>({authStatusMessage:t??e.authStatusMessage,authPollIntervalMs:n??e.authPollIntervalMs})),clearBrowserAuth:()=>e({authSessionId:null,authVerificationUri:null,authExpiresAt:null,authStatusMessage:``,authPollIntervalMs:1500}),setAuthStatusMessage:t=>e({authStatusMessage:t})}));function Ws({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,U.jsx)(`span`,{className:`text-gray-500`,children:e}),(0,U.jsx)(`span`,{className:`text-right text-gray-900`,children:t?.trim()||`-`})]})}function Gs(e){let{email:t,username:n,role:r,canSubmitUsername:i,savingUsername:a,usernameDraft:o,onUsernameDraftChange:s,onSubmitUsername:c,onOpenDeviceList:l,onLogout:u}=e;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`success`,title:b(`accountPanelSignedInTitle`),description:b(`accountPanelSignedInDescription`)}),(0,U.jsxs)(Dn,{tone:`neutral`,children:[(0,U.jsx)(Ws,{label:b(`remoteAccountEmail`),value:t}),(0,U.jsx)(Ws,{label:b(`remoteAccountUsername`),value:n}),(0,U.jsx)(Ws,{label:b(`remoteAccountRole`),value:r})]}),n?(0,U.jsx)(`p`,{className:`text-xs text-gray-500`,children:b(`remoteAccountUsernameLockedHelp`)}):(0,U.jsxs)(Dn,{tone:`warning`,title:b(`remoteAccountUsernameRequiredTitle`),description:b(`remoteAccountUsernameRequiredDescription`),children:[(0,U.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,U.jsx)(fn,{htmlFor:`account-panel-username`,children:b(`remoteAccountUsername`)}),(0,U.jsx)(Ct,{id:`account-panel-username`,value:o,onChange:e=>s(e.target.value),placeholder:b(`remoteAccountUsernamePlaceholder`),autoCapitalize:`none`,autoCorrect:`off`,spellCheck:!1})]}),(0,U.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-3`,children:(0,U.jsx)(L,{disabled:!i,onClick:()=>void c(),children:b(a?`remoteAccountUsernameSaving`:`remoteAccountUsernameSave`)})})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,U.jsxs)(L,{onClick:()=>void l(),children:[(0,U.jsx)(as,{className:`mr-2 h-4 w-4`}),b(`remoteOpenDeviceList`)]}),(0,U.jsxs)(L,{variant:`outline`,onClick:()=>void u(),children:[(0,U.jsx)(xo,{className:`mr-2 h-4 w-4`}),b(`remoteLogout`)]})]})]})}function Ks(e){let{authSessionId:t,authExpiresAt:n,authStatusMessage:r,authVerificationUri:i,onStartBrowserSignIn:a,onResumeBrowserSignIn:o}=e;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`neutral`,title:b(`accountPanelSignedOutTitle`),description:b(`accountPanelSignedOutDescription`),children:t?(0,U.jsxs)(`div`,{className:`mt-3 border-t border-white/80 pt-3`,children:[(0,U.jsx)(Ws,{label:b(`remoteBrowserAuthSession`),value:t}),(0,U.jsx)(Ws,{label:b(`remoteBrowserAuthExpiresAt`),value:n?M(n):`-`})]}):null}),r?(0,U.jsx)(`p`,{className:`text-sm text-gray-600`,children:r}):null,(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,U.jsx)(L,{onClick:()=>void a(),children:b(t?`remoteBrowserAuthActionRetry`:`remoteBrowserAuthAction`)}),i?(0,U.jsx)(L,{variant:`outline`,onClick:()=>void o(),children:b(`remoteBrowserAuthResume`)}):null]})]})}function qs(){let e=k9(),t=Ts(),n=Us(e=>e.panelOpen),r=Us(e=>e.authSessionId),i=Us(e=>e.authVerificationUri),a=Us(e=>e.authExpiresAt),o=Us(e=>e.authStatusMessage),s=t.data,[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(!1);(0,H.useEffect)(()=>{e.accountManager.syncRemoteStatus(s)},[e,s]);let f=!u&&c.trim().length>0&&!s?.account.username;return(0,U.jsx)(Wr,{open:n,onOpenChange:t=>t?e.accountManager.openAccountPanel():e.accountManager.closeAccountPanel(),children:(0,U.jsxs)(qr,{className:`max-w-xl`,children:[(0,U.jsxs)(Gr,{children:[(0,U.jsxs)(Jr,{className:`flex items-center gap-2`,children:[(0,U.jsx)(lo,{className:`h-5 w-5 text-primary`}),b(`accountPanelTitle`)]}),(0,U.jsx)(Vr,{children:b(`accountPanelDescription`)})]}),s?.account.loggedIn?(0,U.jsx)(Gs,{email:s.account.email,username:s.account.username,role:s.account.role,canSubmitUsername:f,savingUsername:u,usernameDraft:c,onUsernameDraftChange:l,onSubmitUsername:async()=>{d(!0);try{await e.accountManager.updateUsername(c)}finally{d(!1)}},onOpenDeviceList:()=>e.accountManager.openNextClawWeb(`/account`),onLogout:()=>e.accountManager.logout()}):(0,U.jsx)(Ks,{authSessionId:r,authExpiresAt:a,authStatusMessage:o,authVerificationUri:i,onStartBrowserSignIn:()=>e.accountManager.startBrowserSignIn(),onResumeBrowserSignIn:()=>e.accountManager.resumeBrowserSignIn()})]})})}var Js=H.forwardRef(({className:e,hover:t=!0,surface:n=`raised`,...r},i)=>(0,U.jsx)(`div`,{ref:i,className:u(`rounded-2xl border bg-card text-card-foreground transition-colors duration-base`,n===`raised`?`border-border shadow-card`:`border-border/75 shadow-none`,t&&n===`raised`&&`hover:border-primary/25 hover:shadow-card-hover`,t&&n===`flat`&&`hover:bg-muted/40`,e),...r}));Js.displayName=`Card`;var Ys=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`flex flex-col space-y-1.5 p-6`,e),...t}));Ys.displayName=`CardHeader`;var Xs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`h3`,{ref:n,className:u(`text-[15px] font-semibold leading-tight tracking-tight text-foreground`,e),...t}));Xs.displayName=`CardTitle`;var Zs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`p`,{ref:n,className:u(`text-[13px] text-muted-foreground leading-relaxed`,e),...t}));Zs.displayName=`CardDescription`;var Qs=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`p-6 pt-0`,e),...t}));Qs.displayName=`CardContent`;var $s=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(`div`,{ref:n,className:u(`flex items-center justify-between p-6 pt-0`,e),...t}));$s.displayName=`CardFooter`;function ec({username:e}){let t=lt(),[n,r]=(0,H.useState)(e??``),[i,a]=(0,H.useState)(``),o=n.trim().length>0&&i.length>0&&!t.isPending;return(0,U.jsx)(`main`,{className:`flex min-h-screen items-center justify-center bg-secondary px-6 py-10`,children:(0,U.jsxs)(Js,{hover:!1,className:`w-full max-w-md shadow-card-hover`,children:[(0,U.jsxs)(Ys,{children:[(0,U.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.24em] text-gray-500`,children:b(`authBrand`)}),(0,U.jsx)(Xs,{className:`text-2xl`,children:b(`authLoginTitle`)}),(0,U.jsx)(Zs,{children:b(`authLoginDescription`)})]}),(0,U.jsx)(Qs,{children:(0,U.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e?.preventDefault(),o&&t.mutate({username:n.trim(),password:i})},children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:b(`authUsername`)}),(0,U.jsx)(Ct,{value:n,onChange:e=>r(e.target.value),placeholder:b(`authUsernamePlaceholder`),autoFocus:!0})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`label`,{className:`text-sm font-medium text-gray-800`,children:b(`authPassword`)}),(0,U.jsx)(Ct,{type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:b(`authPasswordPlaceholder`)})]}),(0,U.jsx)(L,{type:`submit`,className:`w-full`,disabled:!o,children:t.isPending?b(`authLoggingIn`):b(`authLoginAction`)})]})})]})})}var tc=class{constructor(){this.authPollTimerId=null,this.browserSignInCompletion=null,this.openAccountPanel=()=>{Us.getState().openPanel()},this.closeAccountPanel=()=>{Us.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),this.resolveBrowserSignIn(e),Us.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=e?.status??await js();return t.account.loggedIn?t:(this.openAccountPanel(),await this.startBrowserSignInAndWait({apiBase:e?.apiBase,status:t}))},this.startBrowserSignInAndWait=async e=>{let t=this.createBrowserSignInCompletion();return await this.startBrowserSignIn(e),await t},this.startBrowserSignIn=async e=>{try{let t=e?.apiBase,n=await mn({apiBase:Ns(e?.status??await js(),t)});Us.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:b(`remoteBrowserAuthWaiting`)}),(await ji.openExternalUrl(n.verificationUri)).opened||Us.getState().setAuthStatusMessage(b(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:b(`remoteBrowserAuthStartFailed`);this.rejectBrowserSignIn(e),I.error(`${b(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=async()=>{let e=Us.getState().authVerificationUri;e&&await ji.openExternalUrl(e)},this.logout=async()=>{try{await Ot(),this.rejectBrowserSignIn(Error(`Signed out before browser sign-in completed.`)),Us.getState().clearBrowserAuth(),await Ms(),I.success(b(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:b(`remoteLogoutFailed`);I.error(`${b(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await Sn({username:e.trim()}),await Ms(),I.success(b(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:b(`remoteAccountUsernameSetFailed`);I.error(`${b(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=Fs(await js());if(!t){I.error(b(`remoteOpenWebUnavailable`));return}let n=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();await ji.openExternalUrl(n)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=Us.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=Us.getState();if(e.authSessionId)try{let t=await js(),n=await mt({sessionId:e.authSessionId,apiBase:Ns(t)});if(n.status===`pending`){Us.getState().updateBrowserAuth({statusMessage:b(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),this.rejectBrowserSignIn(Error(n.message||b(`remoteBrowserAuthExpired`))),Us.getState().clearBrowserAuth(),I.error(n.message||b(`remoteBrowserAuthExpired`));return}Us.getState().setAuthStatusMessage(b(`remoteBrowserAuthCompleted`));let r=await Ms();this.clearPollTimer(),this.resolveBrowserSignIn(r),Us.getState().clearBrowserAuth(),I.success(b(`remoteLoginSuccess`))}catch(e){this.clearPollTimer(),this.rejectBrowserSignIn(e),Us.getState().clearBrowserAuth();let t=e instanceof Error?e.message:b(`remoteBrowserAuthPollFailed`);I.error(`${b(`remoteBrowserAuthPollFailed`)}: ${t}`)}},this.clearPollTimer=()=>{this.authPollTimerId!==null&&(window.clearTimeout(this.authPollTimerId),this.authPollTimerId=null)},this.createBrowserSignInCompletion=()=>(this.rejectBrowserSignIn(Error(`Browser sign-in was replaced by a newer request.`)),new Promise((e,t)=>{this.browserSignInCompletion={resolve:e,reject:t}})),this.resolveBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.resolve(e))},this.rejectBrowserSignIn=e=>{let t=this.browserSignInCompletion;t&&(this.browserSignInCompletion=null,t.reject(e instanceof Error?e:Error(String(e))))},this.getBrowserAuthSummary=()=>{let e=Us.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?M(e.authExpiresAt):`-`}}}},nc=`nextclaw.app.viewport-layout`,rc=1;function ic(e){return typeof e!=`number`||!Number.isFinite(e)?`desktop`:e<=767?`mobile`:`desktop`}function ac(){let e=typeof window>`u`?null:window.innerWidth??null;return{mode:ic(e),width:e,isSidebarCollapsed:!1,isMainSidebarAppGroupCollapsed:!1}}function oc(e,t){if(!e||typeof e!=`object`)return null;let n=e[t];return typeof n==`boolean`?n:null}var sc=P()(Mi(()=>ac(),{name:nc,version:rc,storage:Ni(()=>window.localStorage),partialize:e=>({isSidebarCollapsed:e.isSidebarCollapsed,isMainSidebarAppGroupCollapsed:e.isMainSidebarAppGroupCollapsed}),merge:(e,t)=>{let n=oc(e,`isSidebarCollapsed`),r=oc(e,`isMainSidebarAppGroupCollapsed`);return{...t,...n===null?{}:{isSidebarCollapsed:n},...r===null?{}:{isMainSidebarAppGroupCollapsed:r}}}})),cc=new class{constructor(){this.consumerCount=0,this.started=!1,this.attach=()=>(this.consumerCount+=1,this.consumerCount===1&&this.start(),()=>{this.consumerCount=Math.max(0,this.consumerCount-1),this.consumerCount===0&&this.stop()}),this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`resize`,this.handleViewportChange),window.addEventListener(`orientationchange`,this.handleViewportChange),this.syncFromWindow())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`resize`,this.handleViewportChange),window.removeEventListener(`orientationchange`,this.handleViewportChange),this.started=!1)},this.getSnapshot=()=>sc.getState(),this.setSidebarCollapsed=e=>{sc.setState({isSidebarCollapsed:e})},this.setMainSidebarAppGroupCollapsed=e=>{sc.setState({isMainSidebarAppGroupCollapsed:e})},this.collapseSidebarForDenseRightPanels=e=>{if(!e.isDocBrowserOpen||!e.isDocBrowserDocked||!e.isWorkspacePanelOpen)return;let t=this.getSnapshot();if(t.mode!==`desktop`||t.isSidebarCollapsed)return;let n=typeof t.width==`number`?t.width:typeof window>`u`?null:window.innerWidth;typeof n!=`number`||!Number.isFinite(n)||n>1800||this.setSidebarCollapsed(!0)},this.toggleSidebarCollapsed=()=>{sc.setState(e=>({isSidebarCollapsed:!e.isSidebarCollapsed}))},this.toggleMainSidebarAppGroupCollapsed=()=>{sc.setState(e=>({isMainSidebarAppGroupCollapsed:!e.isMainSidebarAppGroupCollapsed}))},this.resetForTests=()=>{this.consumerCount=0,this.stop(),sc.setState(ac())},this.handleViewportChange=()=>{this.syncFromWindow()},this.syncFromWindow=()=>{if(typeof window>`u`)return;let e=window.innerWidth??null;sc.setState({width:e,mode:ic(e)})}}};function lc({parentSessionLabel:e,onGoToParentSession:t}){if(!e)return null;let n=e.trim();return(0,U.jsx)(`div`,{className:`bg-background/75 px-4 py-2 backdrop-blur-sm sm:px-5`,children:(0,U.jsxs)(`button`,{type:`button`,onClick:t,className:`inline-flex items-center gap-2 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:[(0,U.jsx)(wi,{className:`h-3.5 w-3.5`}),(0,U.jsxs)(`span`,{children:[b(`chatBackToParent`),n?` · ${n}`:``]})]})})}function uc({layoutMode:e,actions:t,leading:n,onBackToList:r,projectBadge:i,sessionTypeBadge:a,shouldShow:o,title:s,titleContent:c}){let l=e===`mobile`;return(0,U.jsxs)(`div`,{"data-testid":`chat-conversation-header`,className:u(`bg-background/80 backdrop-blur-sm flex items-center justify-between shrink-0 overflow-hidden transition-colors duration-200`,l?`px-3 sm:px-3`:`px-4 sm:px-5`,o?`opacity-100`:`h-0 py-0 opacity-0`,o&&(l?`min-h-12 pb-2 pt-2`:`h-[52px]`)),style:l&&o?{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.5rem)`}:void 0,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-center gap-2`,children:[l&&r?(0,U.jsx)(V,{icon:(0,U.jsx)(wi,{className:`h-4 w-4`}),label:b(`chat`),onClick:r,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`}):null,n,c??(0,U.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:s}),a,i]}),t]})}function dc(){let e=xe();return(0,H.useCallback)(async t=>{let{invalidateSessionSkills:n=!0,sessionKey:r,patch:i,successMessage:a}=t;try{we(e,await $e(r,i)),n&&await e.invalidateQueries({queryKey:[`ncp-session-skills`,r]}),a!==null&&I.success(a??b(`configSavedApplied`))}catch(e){throw I.error(b(`configSaveFailed`)+`: `+(e instanceof Error?e.message:String(e))),e}},[e])}function fc(){let e=dc();return async t=>{await e({sessionKey:t.sessionKey,patch:{label:t.label},successMessage:b(`configSavedApplied`)})}}function pc(){let e=dc();return async t=>{let{persistToServer:n,projectRoot:r,sessionKey:i}=t,a=b(r?`chatSessionProjectUpdated`:`chatSessionProjectCleared`);if(!n){I.success(a);return}await e({sessionKey:i,patch:{projectRoot:r},successMessage:a})}}function mc({icon:e,label:t,onClick:n,disabled:r=!1,destructive:i=!1}){return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),onClick:n,disabled:r,children:[(0,U.jsx)(e,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:t})]})}var hc={key:`slash`,marker:`/`};function gc(){return`composer-${Math.random().toString(36).slice(2,10)}`}function _c(e=``){return{id:gc(),type:`text`,text:e}}function vc(e){let{data:t,label:n,previewUrl:r,tokenKey:i,tokenKind:a}=e;return{id:gc(),type:`token`,tokenKind:a,tokenKey:i,label:n,previewUrl:r,data:t}}function yc(e){return e.type===`text`?e.text.length:1}function bc(){return[_c(``)]}function xc(e){return[_c(e)]}function Sc(e){let t=[];for(let n of e){if(n.type===`text`){if(n.text.length===0)continue;let e=t[t.length-1];if(e?.type===`text`){t[t.length-1]={...e,text:e.text+n.text};continue}}t.push(n)}return t.length===0?bc():t}function Cc(e){return e.map(e=>e.type===`text`?e.text:``).join(``)}function wc(e){return e.filter(e=>e.type===`text`).map(e=>e.text).join(``)}function Tc(e,t){let n=[],r=new Set;for(let i of e)i.type!==`token`||i.tokenKind!==t||r.has(i.tokenKey)||(r.add(i.tokenKey),n.push(i.tokenKey));return n}function Ec(e,t,n,r){let i=Math.max(0,n-t),a=Math.max(0,t+e.text.length-r),o=[];return i>0&&o.push({...e,text:e.text.slice(0,i)}),a>0&&o.push({...e,text:e.text.slice(e.text.length-a)}),o}function Dc(e,t,n,r){return t<=n||e>=r}function Oc(e,t,n,r,i){return!n&&r>=i?(e.push(...t),!0):n}function kc(e,t,n,r,i,a,o){let s=Ec(t,n,r,i);s[0]&&e.push(s[0]);let c=o;return c||=(e.push(...a),!0),s[1]&&e.push(s[1]),c}function Ac(e,t,n,r,i,a){return!r&&i<=a?(e.push(...n),!0):(e.push(t),r)}function jc(e,t,n,r){let i=Math.max(0,t),a=Math.max(i,n),o=[],s=0,c=!1;for(let t of e){let e=yc(t),n=s,l=s+e;if(Dc(n,l,i,a)){c=Oc(o,r,c,n,a),o.push(t),s=l;continue}c=t.type===`text`?kc(o,t,n,i,a,r,c):Ac(o,t,r,c,i,n),s=l}return c||o.push(...r),Sc(o)}function Mc(e,t){return Sc(e.filter(e=>e.type!==`token`||!t(e)))}function Nc(e,t){return t===0||/\s/.test(e[t-1]??``)}function Pc(e,t,n){if(!t||t.start!==t.end)return null;let r=Cc(e),i=t.end,a=r.slice(0,i),o=a.lastIndexOf(n.marker);if(o<0||!Nc(a,o))return null;let s=a.slice(o+n.marker.length);return/[\s\uFFFC]/.test(s)?null:{key:n.key,marker:n.marker,query:s.trim().toLowerCase(),start:o,end:i}}function Fc(e,t,n=[hc]){let r=null;for(let i of n){let n=Pc(e,t,i);n&&(!r||n.start>r.start)&&(r=n)}return r}function Ic(e,t){let n=Pc(e,t,hc);return n?{query:n.query,start:n.start,end:n.end}:null}var Lc=e=>`[data-item-index="${e}"]`;function Rc(e){let{activeIndex:t,containerRef:n,getItemSelector:r,isEnabled:i,itemCount:a}=e,o=r??Lc;(0,H.useEffect)(()=>{if(!i||a===0)return;let e=n.current;if(!e)return;let r=e.querySelector(o(t));typeof r?.scrollIntoView==`function`&&r.scrollIntoView({block:`nearest`,inline:`nearest`})},[t,n,o,i,a])}function zc(){let e=(0,H.useRef)(null),[t,n]=(0,H.useState)(null);return(0,H.useEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=()=>{n(t.getBoundingClientRect().width)};r();let i=new ResizeObserver(()=>r());return i.observe(t),()=>i.disconnect()},[]),{elementRef:e,width:t}}function W(...e){return h(ie(e))}var Bc=H.forwardRef(({className:e,type:t,...n},r)=>(0,U.jsx)(`input`,{type:t,className:W(`flex h-9 w-full rounded-xl border border-border bg-card px-3.5 py-2 text-sm text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/55 placeholder:font-normal focus:outline-none focus:ring-0 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e),ref:r,...n}));Bc.displayName=`ChatInput`;var Vc=Br,Hc=zr,Uc=Rr,Wc=H.forwardRef(({className:e,children:t,closeLabel:n,...r},i)=>(0,U.jsxs)(Ur,{children:[(0,U.jsx)(Kr,{className:`fixed inset-0 z-[var(--z-modal-backdrop,10000)] bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`}),(0,U.jsxs)(Lr,{ref:i,className:W(`fixed left-[50%] top-[50%] z-[var(--z-modal,10050)] grid max-h-[min(42rem,calc(100vh-2rem))] w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto rounded-2xl border border-border bg-background p-6 text-foreground shadow-xl outline-none duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...r,children:[t,(0,U.jsxs)(Xr,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none`,children:[(0,U.jsx)(Ai,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:n})]})]})]}));Wc.displayName=Lr.displayName;var Gc=({className:e,...t})=>(0,U.jsx)(`div`,{className:W(`flex flex-col gap-2 text-center sm:text-left`,e),...t}),Kc=`Popover`,[qc,gee]=ir(Kc,[rr]),Jc=rr(),[Yc,Xc]=qc(Kc),Zc=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Jc(t),c=H.useRef(null),[l,u]=H.useState(!1),[d,f]=er({prop:r,defaultProp:i??!1,onChange:a,caller:Kc});return(0,U.jsx)(tr,{...s,children:(0,U.jsx)(Yc,{scope:t,contentId:Zn(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:H.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:n})})};Zc.displayName=Kc;var Qc=`PopoverAnchor`,$c=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Xc(Qc,n),a=Jc(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return H.useEffect(()=>(o(),()=>s()),[o,s]),(0,U.jsx)(nr,{...a,...r,ref:t})});$c.displayName=Qc;var el=`PopoverTrigger`,tl=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Xc(el,n),a=Jc(n),o=ar(t,i.triggerRef),s=(0,U.jsx)(Yn.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":gl(i.open),...r,ref:o,onClick:qn(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,U.jsx)(nr,{asChild:!0,...a,children:s})});tl.displayName=el;var nl=`PopoverPortal`,[rl,il]=qc(nl,{forceMount:void 0}),al=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Xc(nl,t);return(0,U.jsx)(rl,{scope:t,forceMount:n,children:(0,U.jsx)(Pr,{present:n||a.open,children:(0,U.jsx)(Jn,{asChild:!0,container:i,children:r})})})};al.displayName=nl;var ol=`PopoverContent`,sl=H.forwardRef((e,t)=>{let n=il(ol,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Xc(ol,e.__scopePopover);return(0,U.jsx)(Pr,{present:r||a.open,children:a.modal?(0,U.jsx)(ll,{...i,ref:t}):(0,U.jsx)(ul,{...i,ref:t})})});sl.displayName=ol;var cl=Xn(`PopoverContent.RemoveScroll`),ll=H.forwardRef((e,t)=>{let n=Xc(ol,e.__scopePopover),r=H.useRef(null),i=ar(t,r),a=H.useRef(!1);return H.useEffect(()=>{let e=r.current;if(e)return dr(e)},[]),(0,U.jsx)(cr,{as:cl,allowPinchZoom:!0,children:(0,U.jsx)(dl,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:qn(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:qn(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:qn(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),ul=H.forwardRef((e,t)=>{let n=Xc(ol,e.__scopePopover),r=H.useRef(!1),i=H.useRef(!1);return(0,U.jsx)(dl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),dl=H.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Xc(ol,n),p=Jc(n);return sr(),(0,U.jsx)(lr,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,U.jsx)($n,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,U.jsx)(Kn,{"data-state":gl(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),fl=`PopoverClose`,pl=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Xc(fl,n);return(0,U.jsx)(Yn.button,{type:`button`,...r,ref:t,onClick:qn(e.onClick,()=>i.onOpenChange(!1))})});pl.displayName=fl;var ml=`PopoverArrow`,hl=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=Jc(n);return(0,U.jsx)(Qn,{...i,...r,ref:t})});hl.displayName=ml;function gl(e){return e?`open`:`closed`}var _l=Zc,vl=$c,yl=tl,bl=al,xl=sl,_ee=`2rem`;function Sl(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${_ee})))`}var vee=Sl(`24rem`),yee=_l,bee=yl,xee=vl,Cl=H.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:r=12,style:i,...a},o)=>(0,U.jsx)(bl,{children:(0,U.jsx)(xl,{ref:o,sideOffset:t,align:n,collisionPadding:r,className:W(`z-[var(--z-popover,50)] w-72 overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-popover p-4 text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=top]:slide-in-from-bottom-2 data-[side=right]:slide-in-from-left-2`,e),style:{maxHeight:vee,...i},...a})}));Cl.displayName=xl.displayName;var See=yr,Cee=hr,wee=mr,Tee=`2rem`;function wl(e){return`min(${e}, max(0px, calc(var(--radix-select-content-available-height, 100vh) - ${Tee})))`}var Eee=wl(`24rem`),Tl=H.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(Nr,{ref:r,className:W(`flex h-9 w-full items-center justify-between whitespace-nowrap rounded-xl border border-border bg-card px-3 py-2 text-sm text-foreground shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-0 focus:border-border disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,U.jsx)(xr,{asChild:!0,children:(0,U.jsx)(or,{className:`h-4 w-4 opacity-50`})})]}));Tl.displayName=Nr.displayName;var El=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(fr,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(ur,{className:`h-4 w-4`})}));El.displayName=fr.displayName;var Dl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(vr,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,U.jsx)(or,{className:`h-4 w-4`})}));Dl.displayName=vr.displayName;var Ol=H.forwardRef(({className:e,children:t,collisionPadding:n=12,position:r=`popper`,style:i,viewportClassName:a,...o},s)=>(0,U.jsx)(Sr,{children:(0,U.jsxs)(Dr,{ref:s,className:W(`relative z-50 flex max-h-96 min-w-[8rem] flex-col overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,r===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),collisionPadding:n,position:r,style:{maxHeight:Eee,...i},...o,children:[(0,U.jsx)(El,{}),(0,U.jsx)(Mr,{className:W(`min-h-0 flex-1 overflow-y-auto overscroll-contain p-1`,r===`popper`&&`w-full min-w-[var(--radix-select-trigger-width)]`,a),children:t}),(0,U.jsx)(Dl,{})]})}));Ol.displayName=Dr.displayName;var kl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(Tr,{ref:n,className:W(`px-2 py-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,e),...t}));kl.displayName=Tr.displayName;var Al=H.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsxs)(kr,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,e),...n,children:[(0,U.jsx)(`span`,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(gr,{children:(0,U.jsx)(jr,{className:`h-4 w-4`})})}),(0,U.jsx)(_r,{children:t})]}));Al.displayName=kr.displayName;var jl=H.forwardRef(({className:e,...t},n)=>(0,U.jsx)(Ar,{ref:n,className:W(`-mx-1 my-1 h-px bg-border`,e),...t}));jl.displayName=Ar.displayName;var Dee=ai,Oee=Si,kee=ti,Ml=H.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,U.jsx)(Ci,{children:(0,U.jsx)(bi,{ref:r,sideOffset:t,className:W(`z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));Ml.displayName=bi.displayName;var Nl={Dialog:Vc,DialogContent:Wc,DialogDescription:Uc,DialogHeader:Gc,DialogTitle:Hc,Popover:yee,PopoverAnchor:xee,PopoverContent:Cl,PopoverTrigger:bee,Input:Bc,Select:See,SelectContent:Ol,SelectGroup:Cee,SelectItem:Al,SelectLabel:kl,SelectSeparator:jl,SelectTrigger:Tl,SelectValue:wee,Tooltip:Oee,TooltipContent:Ml,TooltipProvider:Dee,TooltipTrigger:kee};function Aee({pathPreview:e}){return(0,U.jsxs)(`div`,{className:`rounded-lg border border-gray-200 bg-gray-50/70 px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-gray-600`,children:[(0,U.jsx)(Qa,{"aria-hidden":`true`,className:`h-4 w-4 text-gray-400`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.rootLabel})]}),(0,U.jsx)(`div`,{className:`mt-2`,children:e.segments.map((e,t)=>{let n=e.kind===`directory`?Qa:Wa;return(0,U.jsxs)(`div`,{className:`relative flex min-w-0 items-center gap-2 py-1 text-xs text-gray-700`,style:{paddingLeft:`${(t+1)*18}px`},children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute bottom-1/2 top-[-0.25rem] w-px bg-gray-200`,style:{left:`${t*18+7}px`}}),(0,U.jsx)(n,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-gray-400`}),(0,U.jsx)(`span`,{className:`truncate font-medium`,children:e.label})]},`${t}:${e.label}`)})})]})}var jee=680,Mee=.82,Nee=560,Pl=Sl(`24rem`),Pee={back:wi,"calendar-clock":fa,command:Ea,file:Wa,files:Ga,folder:Qa,inbox:co,"list-collapse":_o,"message-square-plus":wo,"panel-app":fi,project:Ka,skill:Ir};function Fl(e,t){return!t.sectionKeys||t.sectionKeys.length===0?!0:!!(e.sectionKey&&t.sectionKeys.includes(e.sectionKey))}function Fee(e,t){return e?.length?e.some(e=>e.key===t)?t:e[0].key:null}function Iee({icon:e}){let t=Pee[e];return(0,U.jsx)(`span`,{"aria-hidden":`true`,"data-input-surface-icon":e,className:`inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-gray-100 text-gray-500`,children:(0,U.jsx)(t,{className:`h-3.5 w-3.5`})})}function Lee({item:e,texts:t}){return e?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.subtitle?(0,U.jsx)(`span`,{className:`inline-flex rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-semibold text-primary`,children:e.subtitle}):null,(0,U.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:e.title})]}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-gray-600`,children:e.description}),e.pathPreview?(0,U.jsx)(Aee,{pathPreview:e.pathPreview}):null,(0,U.jsx)(`div`,{className:`space-y-1`,children:e.detailLines.map(e=>(0,U.jsx)(`div`,{className:`min-w-0 break-all rounded-md bg-gray-50 px-2 py-1 text-[11px] leading-5 text-gray-600`,children:e},e))}),(0,U.jsx)(`div`,{className:`pt-1 text-[11px] text-gray-500`,children:e.hintLabel??t.itemHintLabel})]}):(0,U.jsx)(`div`,{className:`text-xs text-gray-500`,children:t.hintLabel})}function Ree(e){let{activeIndex:t,event:n,isOpen:r,items:i,onOpenChange:a,onSelectItem:o,setActiveIndex:s}=e;return r?n.key===`Escape`?(n.preventDefault(),a(!1),!0):i.length===0?!1:n.key===`ArrowDown`?(n.preventDefault(),s(e=>(e+1)%i.length),!0):n.key===`ArrowUp`?(n.preventDefault(),s(e=>(e-1+i.length)%i.length),!0):n.key===`Enter`&&!n.shiftKey||n.key===`Tab`?(n.preventDefault(),o(i[t]),!0):!1:!1}var zee=(0,H.forwardRef)(function(e,t){let{Popover:n,PopoverAnchor:r,PopoverContent:i}=Nl,{elementRef:a,width:o}=zc(),s=(0,H.useRef)(null),[c,l]=(0,H.useState)({index:0,itemsSignature:``}),{isOpen:u,isLoading:d,filterOptions:f,items:p,notice:m,texts:h,onSelectItem:g,onOpenChange:_,onDetailsPointerDown:v}=e,[y,b]=(0,H.useState)(f?.[0]?.key??null),x=(0,H.useMemo)(()=>Fee(f,y),[y,f]),S=(0,H.useMemo)(()=>f?.find(e=>e.key===x)??null,[f,x]),C=(0,H.useMemo)(()=>f?.map(e=>({...e,count:p.filter(t=>Fl(t,e)).length}))??[],[f,p]),w=(0,H.useMemo)(()=>S?p.filter(e=>Fl(e,S)):p,[S,p]),T=(0,H.useMemo)(()=>w.map(e=>e.key).join(``),[w]),E=(0,H.useMemo)(()=>w.some(e=>!!e.sectionLabel?.trim()),[w]),D=c.itemsSignature===T?c.index:0,O=w.length===0?0:Math.min(D,w.length-1),k=w[O]??null,A=(0,H.useCallback)(e=>{b(e),l({index:0,itemsSignature:``})},[]),j=(0,H.useCallback)(e=>{l(t=>{let n=t.itemsSignature===T?t.index:0;return{index:typeof e==`function`?e(n):e,itemsSignature:T}})},[T]),M=(0,H.useCallback)(e=>{e.selectionBehavior===`navigate`&&l({index:0,itemsSignature:``}),g(e)},[g]),N=(0,H.useMemo)(()=>{if(o)return Math.min(o>Nee?o*Mee:o,jee)},[o]);return(0,H.useImperativeHandle)(t,()=>({handleKeyDown:e=>Ree({activeIndex:O,event:e,isOpen:u,items:w,onOpenChange:_,onSelectItem:M,setActiveIndex:j})}),[O,u,_,M,j,w]),Rc({containerRef:s,activeIndex:O,itemCount:w.length,isEnabled:u&&!d,getItemSelector:e=>`[data-input-surface-index="${e}"]`}),(0,U.jsxs)(n,{open:u,onOpenChange:_,children:[(0,U.jsx)(r,{asChild:!0,children:(0,U.jsx)(`div`,{ref:a,className:`pointer-events-none absolute bottom-0 left-3 right-3 top-0`})}),(0,U.jsx)(i,{side:`top`,align:`start`,sideOffset:10,className:`z-[70] flex max-w-[calc(100vw-1.5rem)] flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white/95 p-0 shadow-2xl backdrop-blur-md`,onOpenAutoFocus:e=>e.preventDefault(),style:{height:Pl,maxHeight:Pl,width:N?`${N}px`:void 0},children:(0,U.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-[minmax(220px,300px)_minmax(0,1fr)]`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-col border-r border-gray-200`,children:[!d&&C.length>0?(0,U.jsx)(`div`,{className:`flex shrink-0 gap-0.5 overflow-x-auto px-2 pb-1.5 pt-2`,children:C.map(({count:e,key:t,label:n})=>{let r=t===x;return(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":r,onPointerDown:e=>e.preventDefault(),onClick:()=>A(t),className:`inline-flex h-7 shrink-0 items-center gap-1 rounded-md px-2 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 ${r?`bg-gray-100 text-gray-900`:`text-gray-600 hover:bg-gray-100 hover:text-gray-900`}`,children:[(0,U.jsx)(`span`,{children:n}),(0,U.jsx)(`span`,{className:r?`text-gray-500`:`text-gray-400`,children:e})]},t)})}):null,!d&&m?(0,U.jsxs)(`div`,{className:`mx-2 mb-1.5 flex items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-2.5 py-2 text-xs leading-4 text-red-700`,children:[(0,U.jsx)(Hr,{"aria-hidden":`true`,className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:m.message})]}):null,(0,U.jsx)(`div`,{ref:s,role:`listbox`,"aria-label":h.sectionLabel,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain ${!d&&C.length>0?`px-2 pb-2`:`p-2`}`,children:d?(0,U.jsx)(`div`,{className:`p-2 text-xs text-gray-500`,children:h.loadingLabel}):(0,U.jsxs)(U.Fragment,{children:[E?null:(0,U.jsx)(`div`,{className:`mb-1 px-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:h.sectionLabel}),w.length===0?(0,U.jsx)(`div`,{className:`px-1.5 text-xs text-gray-400`,children:h.emptyLabel}):(0,U.jsx)(`div`,{children:w.map((e,t)=>{let{icon:n,key:r,sectionKey:i,sectionLabel:a,title:o,subtitle:s}=e,c=t===O,l=w[t-1];return(0,U.jsxs)(`div`,{children:[E&&a?.trim()&&l?.sectionKey!==i?(0,U.jsx)(`div`,{className:`px-1.5 pb-1 pt-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500`,children:a}):null,(0,U.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":c,"data-input-surface-index":t,onPointerMove:e=>{e.pointerType!==`touch`&&j(t)},onPointerDown:t=>{t.button>0||(t.preventDefault(),M(e))},onClick:t=>{t.detail===0&&M(e)},className:`flex w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left leading-4 transition-colors ${c?`bg-gray-100 text-gray-900`:`text-gray-700 hover:bg-gray-100`}`,children:[n?(0,U.jsx)(Iee,{icon:n}):null,(0,U.jsx)(`span`,{className:`truncate text-xs font-medium`,children:o}),(0,U.jsx)(`span`,{className:`truncate text-xs text-gray-500`,children:s})]})]},r)})})]})})]}),(0,U.jsx)(`div`,{className:`custom-scrollbar min-h-0 min-w-0 select-text overflow-y-auto overscroll-contain p-2.5`,onPointerDown:v,children:(0,U.jsx)(Lee,{item:k,texts:h})})]})})]})});function Il(e){return`${e.key}:${e.marker}:${e.start}`}function Ll(e,t){return t.type===`insert-text`&&e.query===``&&e.end===e.start+e.marker.length}function Rl(e,t,n){if(!t)return null;let r=Il(t);return e===r?e:Ll(t,n)?r:null}function zl(e){let{children:t,inputSurface:n,onInputSurfaceTriggerChange:r,onSelectItem:i,triggerSpecs:a=[hc]}=e,o=(0,H.useRef)(null),s=(0,H.useRef)(!1),c=(0,H.useRef)(null),[l,u]=(0,H.useState)(null),d=!!n&&l!==null,f=(0,H.useCallback)((e,t)=>{c.current=e,u(e),r?.(e?t:null)},[r]),p=(0,H.useCallback)((e,t,n)=>{let r=Fc(e,t,a),i=Rl(c.current,r,n);f(i,i?r:null)},[f,a]),m=(0,H.useCallback)(e=>o.current?.handleKeyDown(e)??!1,[]),h=(0,H.useCallback)(e=>{!e&&!s.current&&f(null,null)},[f]);return(0,U.jsxs)(U.Fragment,{children:[t((0,H.useMemo)(()=>({onInputSurfaceKeyDown:m,onInputSurfaceOpenChange:h,onInputSurfaceSnapshotChange:p}),[m,h,p])),n&&d?(0,U.jsx)(zee,{ref:o,isOpen:d,isLoading:n.isLoading,filterOptions:n.filterOptions,items:n.items,notice:n.notice,texts:n.texts,onSelectItem:e=>{e.selectionBehavior!==`navigate`&&f(null,null),i(e)},onOpenChange:h,onDetailsPointerDown:()=>{s.current=!0,requestAnimationFrame(()=>{s.current=!1})}},l):null]})}var Bl=Wt(`inline-flex items-center justify-center whitespace-nowrap rounded-full text-sm font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none disabled:opacity-50`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-border bg-card text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,secondary:`bg-muted text-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,ghost:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`,primary:`bg-primary text-primary-foreground hover:bg-primary-600 active:bg-primary-700 shadow-sm`,subtle:`bg-muted text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"primary-outline":`border border-primary/30 text-primary hover:bg-primary hover:text-primary-foreground`},size:{default:`h-9 px-4 py-2`,sm:`h-8 px-3 text-xs`,lg:`h-11 px-5 text-[14px]`,xl:`h-12 px-6 text-[15px]`,icon:`h-9 w-9`}},defaultVariants:{variant:`default`,size:`default`}}),Vl=H.forwardRef(({className:e,variant:t,size:n,...r},i)=>(0,U.jsx)(`button`,{className:W(Bl({variant:t,size:n,className:e})),ref:i,...r}));Vl.displayName=`ChatButton`;function Hl(){return(0,U.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`chat-stop-icon`,className:`block h-3 w-3 rounded-[2px] bg-foreground shadow-[inset_0_0_0_1px_hsl(var(--border))]`})}function Ul({contextWindow:e}){let{Tooltip:t,TooltipContent:n,TooltipProvider:r,TooltipTrigger:i}=Nl,a=Math.max(0,Math.min(1,e.ratio)),o=Math.round(a*360);return(0,U.jsx)(r,{delayDuration:0,children:(0,U.jsxs)(t,{children:[(0,U.jsx)(i,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"aria-label":e.label,title:e.label,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[7px] rounded-full`,style:{background:`conic-gradient(hsl(var(--muted-foreground)) ${o}deg, hsl(var(--border)) 0deg)`}}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-[10px] rounded-full bg-card`})]})}),(0,U.jsx)(n,{side:`top`,className:`max-w-[18rem]`,children:(0,U.jsxs)(`div`,{className:`space-y-1.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-5 font-semibold text-foreground`,children:[(0,U.jsx)(`span`,{children:e.label}),(0,U.jsx)(`span`,{children:e.percentLabel})]}),e.details.map(e=>(0,U.jsxs)(H.Fragment,{children:[e.dividerBefore?(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`my-2 border-t border-border/70`,"data-testid":`context-window-detail-divider`}):null,(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-5 text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:e.label}),(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:e.value})]})]},e.label))]})})]})})}function Wl({children:e,label:t}){let{Tooltip:n,TooltipContent:r,TooltipProvider:i,TooltipTrigger:a}=Nl;return(0,U.jsx)(i,{delayDuration:250,children:(0,U.jsxs)(n,{children:[(0,U.jsx)(a,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:e})}),(0,U.jsx)(r,{side:`top`,className:`text-xs`,children:t})]})})}function Gl({isSending:e,canStopGeneration:t,sendDisabled:n,stopDisabled:r,stopHint:i,sendButtonLabel:a,sendIcon:o=`send`,stopButtonLabel:s,contextWindow:c,onSend:l,onStop:u}){return(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[c?(0,U.jsx)(Ul,{contextWindow:c}):null,!e||!n?(0,U.jsx)(Wl,{label:a,children:(0,U.jsx)(Vl,{size:`icon`,className:`h-8 w-8 rounded-full`,"aria-label":a,onClick:()=>void l(),disabled:n,children:o===`continue`?(0,U.jsx)(Ko,{"data-testid":`chat-continue-input-icon`,className:`h-4 w-4`}):(0,U.jsx)(ca,{className:`h-5 w-5`})})}):t?(0,U.jsx)(Wl,{label:s,children:(0,U.jsx)(Vl,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,onClick:()=>void u(),disabled:r,children:(0,U.jsx)(Hl,{})})}):(0,U.jsx)(Wl,{label:i,children:(0,U.jsx)(Vl,{size:`icon`,variant:`outline`,className:`h-8 w-8 rounded-full`,"aria-label":s,disabled:!0,children:(0,U.jsx)(Hl,{})})})]})}function Kl(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.label,e.key,e.description].filter(e=>typeof e==`string`&&e.trim().length>0).join(` `).toLowerCase().includes(n)):e}var ql=Sl(`20rem`),Jl=`flex w-full items-center gap-3 rounded-lg px-2.5 py-2 text-left text-sm text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:cursor-not-allowed disabled:opacity-50`;function Yl(e){let{Input:t}=Nl,{onBack:n,picker:r}=e,i=(0,H.useRef)(null),a=(0,H.useId)(),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(0),u=(0,H.useMemo)(()=>new Set(r.selectedKeys),[r.selectedKeys]),d=(0,H.useMemo)(()=>r.groups?.filter(e=>e.options.length>0)??[],[r.groups]),f=(0,H.useMemo)(()=>d.length===0?null:d.map(e=>({...e,options:Kl(e.options,o)})).filter(e=>e.options.length>0),[d,o]),p=(0,H.useMemo)(()=>f===null?Kl(r.options,o):f.flatMap(e=>e.options),[f,r.options,o]),m=p.length===0?0:Math.min(c,p.length-1);Rc({containerRef:i,activeIndex:m,itemCount:p.length,isEnabled:p.length>0,getItemSelector:e=>`[data-skill-index="${e}"]`});let h=e=>{if(u.has(e)){r.onSelectedKeysChange(r.selectedKeys.filter(t=>t!==e));return}r.onSelectedKeysChange([...r.selectedKeys,e])};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`shrink-0 space-y-1.5 p-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:n,className:`inline-flex h-7 items-center gap-1 rounded-md pr-2 text-sm font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,children:[(0,U.jsx)(ma,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{children:r.title})]}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground/60`}),(0,U.jsx)(t,{value:o,onChange:e=>{s(e.target.value),l(0)},onKeyDown:e=>{if(p.length!==0){if(e.key===`ArrowDown`){e.preventDefault(),l(Math.min(m+1,p.length-1));return}if(e.key===`ArrowUp`){e.preventDefault(),l(Math.max(m-1,0));return}if(e.key===`Enter`){e.preventDefault();let t=p[m];t&&h(t.key)}}},placeholder:r.searchPlaceholder,role:`combobox`,"aria-controls":a,"aria-expanded":`true`,"aria-autocomplete":`list`,"aria-activedescendant":p[m]?`${a}-option-${m}`:void 0,className:`h-8 rounded-lg border-0 bg-muted/45 pl-7 text-xs shadow-none`})]})]}),(0,U.jsx)(`div`,{ref:i,id:a,role:`listbox`,"aria-multiselectable":`true`,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain px-1.5 pb-1`,children:r.isLoading?(0,U.jsx)(`div`,{className:`p-4 text-xs text-muted-foreground`,children:r.loadingLabel}):p.length===0?(0,U.jsx)(`div`,{className:`p-4 text-center text-xs text-muted-foreground`,children:r.emptyLabel}):(0,U.jsx)(`div`,{children:(()=>{let e=f??[{key:`all-skills`,options:p}],t=0;return e.map(e=>(0,U.jsxs)(`div`,{children:[e.label?(0,U.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-medium text-muted-foreground/80`,children:e.label}):null,e.options.map(e=>{let n=t;t+=1;let r=u.has(e.key),i=n===m;return(0,U.jsxs)(`button`,{type:`button`,id:`${a}-option-${n}`,role:`option`,"aria-selected":r,"aria-label":e.label,"data-skill-index":n,onMouseEnter:()=>l(n),onClick:()=>h(e.key),className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors ${i?`bg-[var(--interaction-hover)]`:`hover:bg-[var(--interaction-hover)]`}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm text-foreground`,children:e.label}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-xs text-muted-foreground`,children:e.description||e.key})]}),r?(0,U.jsx)(jr,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]},e.key)})]},e.key))})()})}),r.manageHref&&r.manageLabel?(0,U.jsx)(`div`,{className:`shrink-0 px-2 pb-2 pt-1`,children:(0,U.jsxs)(`a`,{href:r.manageHref,className:`inline-flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,children:[r.manageLabel,(0,U.jsx)(fe,{className:`h-3 w-3`})]})}):null]})}function Xl(e){let{Popover:t,PopoverContent:n,PopoverTrigger:r,Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=Nl,{accessories:c,label:l,picker:u}=e,[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(`actions`);return(0,U.jsxs)(t,{open:d,onOpenChange:e=>{f(e),e||m(`actions`)},children:[(0,U.jsx)(o,{children:(0,U.jsxs)(i,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:(0,U.jsx)(r,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":l,className:`relative inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40`,children:(0,U.jsx)(Oi,{className:`h-4 w-4`})})})})}),(0,U.jsx)(a,{side:`top`,children:(0,U.jsx)(`p`,{className:`text-xs`,children:l})})]})}),(0,U.jsx)(n,{side:`top`,align:`start`,className:p===`skills`?`flex w-[min(340px,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border-border/80 p-0 shadow-md`:`w-[min(220px,calc(100vw-1rem))] rounded-xl border-border/80 p-1.5 shadow-md`,style:{maxHeight:ql},children:p===`actions`?(0,U.jsxs)(U.Fragment,{children:[c.map(e=>(0,U.jsxs)(`button`,{type:`button`,"aria-label":e.label,disabled:e.disabled,onClick:()=>{e.onClick?.(),f(!1)},className:Jl,children:[e.icon===`paperclip`?(0,U.jsx)(Ho,{className:`h-4 w-4`}):null,(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label})]},e.key)),u?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>m(`skills`),className:Jl,children:[(0,U.jsx)(Ir,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:u.title}),(0,U.jsx)(ha,{className:`h-4 w-4 shrink-0 text-muted-foreground/60`})]}):null]}):u?(0,U.jsx)(Yl,{picker:u,onBack:()=>m(`actions`)}):null})]})}function Zl(e,t){let n=0;for(let r of t)if(r===e[n]&&(n+=1,n===e.length))return!0;return e.length===0}function Ql(e,t){let n=e.filter(Boolean).join(` `).toLowerCase(),r=n.replace(/[\s/_.-]+/g,``);return t.split(/\s+/).filter(Boolean).every(e=>{let t=e.replace(/[\s/_.-]+/g,``);return n.includes(e)||Zl(t,r)})}function $l(e,t,n){let r=n.trim().toLowerCase();return e.groups.filter(e=>e.options.length>0).filter(e=>t===`all`||e.key===t).map(e=>({...e,options:r?e.options.filter(e=>Ql([e.label,e.value,e.description],r)):e.options})).filter(e=>e.options.length>0)}function eu({discovery:e,onOpen:t}){return(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border/60 px-1.5 py-1`,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:t,children:[(0,U.jsx)(Ir,{className:`h-3.5 w-3.5 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.summaryLabel}),(0,U.jsx)(`span`,{className:`shrink-0 font-medium text-primary`,children:e.viewLabel})]})})}function tu({discovery:e,open:t,onOpenChange:n,renderOption:r,restoreFocusRef:i}){let{Dialog:a,DialogContent:o,DialogDescription:s,DialogHeader:c,DialogTitle:l,Input:u}=Nl,[d,f]=(0,H.useState)(``),[p,m]=(0,H.useState)(`all`),[h,g]=(0,H.useState)(null),[_,v]=(0,H.useState)(()=>new Set),y=(0,H.useMemo)(()=>e.groups.filter(e=>e.options.length>0),[e.groups]),b=p===`all`||y.some(e=>e.key===p)?p:`all`,x=(0,H.useMemo)(()=>$l(e,b,d),[e,d,b]),S=e=>{n(e),e||(f(``),m(`all`),g(null),v(new Set))},C=async t=>{if(!(h||_.has(t))){g(t);try{await e.onSelect(t),v(e=>new Set(e).add(t))}catch{return}finally{g(null)}}};return(0,U.jsx)(a,{open:t,onOpenChange:S,children:(0,U.jsxs)(o,{closeLabel:e.closeLabel,className:`flex h-[calc(100vh-1rem)] max-h-[42rem] w-[calc(100%-1rem)] max-w-2xl flex-col gap-0 overflow-hidden p-0 sm:h-[min(42rem,calc(100vh-2rem))]`,onCloseAutoFocus:e=>{e.preventDefault(),i.current?.focus()},children:[(0,U.jsxs)(c,{className:`shrink-0 gap-1 border-b border-border/70 px-5 pb-4 pt-5 text-left`,children:[(0,U.jsx)(l,{className:`pr-8 text-lg font-semibold text-foreground`,children:e.groupLabel}),(0,U.jsx)(s,{className:`text-sm text-muted-foreground`,children:e.summaryLabel}),(0,U.jsxs)(`div`,{className:`relative pt-3`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-3 top-[1.375rem] h-4 w-4 text-muted-foreground/60`}),(0,U.jsx)(u,{autoFocus:!0,value:d,onChange:e=>f(e.currentTarget.value),placeholder:e.searchPlaceholder,className:`h-9 rounded-xl border-0 bg-muted/45 pl-9 text-sm shadow-none`})]}),(0,U.jsxs)(`div`,{role:`tablist`,"aria-label":e.groupLabel,className:`custom-scrollbar flex gap-1 overflow-x-auto overscroll-contain pt-2`,children:[(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":b===`all`,className:`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors ${b===`all`?`bg-foreground text-background`:`bg-muted/55 text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>m(`all`),children:e.allGroupLabel}),y.map(e=>(0,U.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":b===e.key,className:`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors ${b===e.key?`bg-foreground text-background`:`bg-muted/55 text-muted-foreground hover:bg-muted hover:text-foreground`}`,onClick:()=>m(e.key),children:e.label},e.key))]})]}),(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain px-3 py-2`,children:[x.length===0?(0,U.jsx)(`p`,{className:`px-3 py-10 text-center text-sm text-muted-foreground`,children:e.searchEmptyLabel}):null,x.map(t=>(0,U.jsxs)(`div`,{children:[b===`all`?(0,U.jsx)(`div`,{className:`px-3 pb-1 pt-3 text-xs font-medium text-muted-foreground`,children:t.label}):null,t.options.map(t=>{let n=_.has(t.value);return(0,U.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-xl px-3 py-2 hover:bg-[var(--interaction-hover)]`,children:[(0,U.jsx)(`div`,{className:`min-w-0 overflow-hidden`,title:t.label,children:r(t)}),(0,U.jsxs)(`button`,{type:`button`,disabled:h!==null||n,className:`inline-flex h-8 min-w-16 shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-lg bg-primary/10 px-3 text-xs font-medium text-primary transition-colors hover:bg-primary/15 disabled:cursor-default disabled:bg-muted disabled:text-muted-foreground`,onClick:()=>void C(t.value),children:[h===t.value?(0,U.jsx)(Di,{className:`h-3.5 w-3.5 animate-spin`}):null,n?e.addedLabel:e.actionLabel]})]},t.value)})]},t.key))]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-border/70 px-5 py-3`,children:[(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-xs text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,onClick:()=>{e.onDismiss(),S(!1)},children:e.dismissLabel}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg bg-foreground px-4 py-2 text-xs font-medium text-background transition-opacity hover:opacity-85`,onClick:()=>S(!1),children:e.doneLabel})]})]})})}function nu({icon:e,className:t=``}){return e===`sparkles`?(0,U.jsx)(Ir,{className:`h-3.5 w-3.5 shrink-0 text-primary ${t}`}):e===`brain`?(0,U.jsx)(da,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground ${t}`}):null}var ru={model:`min-w-0 max-w-[18rem]`,"session-type":`shrink-0`,thinking:`shrink-0`},iu={model:`w-[min(340px,calc(100vw-1rem))]`,"session-type":`w-[220px]`,thinking:`w-[180px]`},au=Sl(`18rem`),ou=wl(`18rem`);function su(e){return e.key===`model`&&e.selectedLabel&&e.selectedLabel.split(`/`).slice(1).join(`/`).trim()||e.selectedLabel}function cu(e){return e.groups?.filter(e=>e.options.length>0)??(e.options.length>0?[{key:`${e.key}-default`,options:e.options}]:[])}function lu({item:e}){let t=su(e);return e.selectedLabel?(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-left`,children:[(0,U.jsx)(nu,{icon:e.icon,className:e.key===`model`?`hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:block`:void 0}),(0,U.jsx)(`span`,{className:`nextclaw-chat-toolbar-mobile-label truncate sm:hidden [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`,children:t}),(0,U.jsx)(`span`,{className:`nextclaw-chat-toolbar-label hidden truncate sm:inline [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`,children:t})]}):e.loading?(0,U.jsx)(`div`,{className:`h-3 w-24 animate-pulse rounded bg-muted`}):(0,U.jsx)(`span`,{className:`truncate`,children:e.placeholder})}function uu({option:e}){return e.description?(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label}),(0,U.jsx)(`span`,{className:`block truncate text-[11px] text-muted-foreground`,children:e.description})]}):(0,U.jsx)(`span`,{className:`block truncate text-sm font-normal text-foreground`,children:e.label})}function du({item:e}){let{Input:t,Popover:n,PopoverContent:r,PopoverTrigger:i,Tooltip:a,TooltipContent:o,TooltipProvider:s,TooltipTrigger:c}=Nl,[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(``),h=(0,H.useRef)(null),g=cu(e),_=(0,H.useMemo)(()=>{let e=p.trim().toLowerCase();return e?g.map(t=>({...t,options:t.options.filter(t=>Ql([t.label,t.value,t.description],e))})).filter(e=>e.options.length>0):g},[g,p]),v=g.some(e=>e.options.length>0),y=_.some(e=>e.options.length>0),{discovery:b,optionAction:x}=e,S=new Set(x?.activeValues??[]),C=t=>{if(u(t),t){e.onOpen?.();return}m(``)};return(0,U.jsxs)(n,{open:l,onOpenChange:C,children:[(0,U.jsx)(i,{asChild:!0,children:(0,U.jsxs)(`button`,{ref:h,type:`button`,"aria-label":e.selectedLabel?`${e.placeholder}: ${e.selectedLabel}`:e.placeholder,disabled:e.disabled,className:`nextclaw-chat-toolbar-select-trigger inline-flex h-8 w-auto items-center justify-between rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50 sm:px-3 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!basis-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!justify-center [@container_nextclaw-chat-input-bar_(max-width:440px)]:!max-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!min-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!px-0 ${ru[e.key]??``}`,children:[(0,U.jsx)(lu,{item:e}),(0,U.jsx)(or,{className:`ml-1 h-3.5 w-3.5 shrink-0 text-muted-foreground/70 [@container_nextclaw-chat-input-bar_(max-width:440px)]:hidden`})]})}),(0,U.jsxs)(r,{className:`flex flex-col overflow-hidden rounded-2xl border-border/80 p-0 shadow-md ${iu[e.key]??``}`,style:{maxHeight:au},children:[(0,U.jsxs)(`div`,{className:`relative shrink-0 px-2 pb-1 pt-1.5`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-[18px] top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,U.jsx)(t,{value:p,onChange:e=>m(e.currentTarget.value),placeholder:e.search?.placeholder??e.placeholder,className:`h-7 rounded-lg border-0 bg-muted/45 pl-7 text-xs shadow-none`})]}),(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:[v?null:e.loading?(0,U.jsxs)(`div`,{className:`space-y-2 px-2 py-1`,children:[(0,U.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,U.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.emptyLabel}):null,v&&!y?(0,U.jsx)(`div`,{className:`px-2 py-1 text-xs text-muted-foreground`,children:e.search?.emptyLabel??e.emptyLabel}):null,(0,U.jsx)(`div`,{className:`px-1.5 pb-0.5`,children:_.map(t=>(0,U.jsxs)(`div`,{children:[t.label?(0,U.jsx)(`div`,{className:`px-2 pb-0.5 pt-1.5 text-[11px] font-medium text-muted-foreground/80`,children:t.label}):null,t.options.map(t=>{let n=e.value===t.value,r=S.has(t.value),i=r?x?.activeLabel:x?.inactiveLabel;return(0,U.jsxs)(`div`,{className:`group flex items-center gap-1 rounded-lg hover:bg-[var(--interaction-hover)]`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-1 text-left leading-4`,onClick:()=>{e.onValueChange(t.value),C(!1)},children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(uu,{option:t})}),n?(0,U.jsx)(jr,{className:`h-4 w-4 shrink-0 text-foreground/70`}):null]}),x&&i?(0,U.jsx)(s,{children:(0,U.jsxs)(a,{children:[(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":i,"aria-pressed":r,className:`mr-1 inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-[background-color,color,opacity] hover:bg-card hover:text-foreground focus:outline-none focus:ring-1 focus:ring-primary/40 ${r?``:`opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`}`,onClick:e=>{e.stopPropagation(),x.onToggle(t.value,!r)},children:(0,U.jsx)(us,{className:`h-3.5 w-3.5 ${r?`fill-current text-foreground`:``}`})})}),(0,U.jsx)(o,{side:`left`,children:(0,U.jsx)(`p`,{className:`text-xs`,children:i})})]})}):null]},t.value)})]},t.key))})]}),b?(0,U.jsx)(eu,{discovery:b,onOpen:()=>{C(!1),f(!0)}}):null,e.manageHref&&e.manageLabel?(0,U.jsx)(`div`,{className:`shrink-0 px-1.5 pb-1.5 pt-0.5`,children:(0,U.jsxs)(`a`,{href:e.manageHref,className:`inline-flex w-full items-center gap-1.5 rounded-lg px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,children:[e.manageLabel,(0,U.jsx)(fe,{className:`h-3 w-3`})]})}):null]}),b?(0,U.jsx)(tu,{discovery:b,open:d,onOpenChange:f,restoreFocusRef:h,renderOption:e=>(0,U.jsx)(uu,{option:e})}):null]})}function fu({item:e}){if(e.search)return(0,U.jsx)(du,{item:e});let{Select:t,SelectContent:n,SelectGroup:r,SelectItem:i,SelectLabel:a,SelectSeparator:o,SelectTrigger:s,SelectValue:c}=Nl,l=cu(e),u=l.some(e=>e.options.length>0);return(0,U.jsxs)(t,{value:e.value,onValueChange:e.onValueChange,disabled:e.disabled,children:[(0,U.jsx)(s,{"aria-label":e.selectedLabel?`${e.placeholder}: ${e.selectedLabel}`:e.placeholder,title:e.selectedLabel,className:`nextclaw-chat-toolbar-select-trigger h-8 w-auto rounded-lg border-0 bg-transparent px-2 text-xs font-medium text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:ring-0 sm:px-3 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!basis-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!justify-center [@container_nextclaw-chat-input-bar_(max-width:440px)]:!max-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!min-w-8 [@container_nextclaw-chat-input-bar_(max-width:440px)]:!px-0 ${ru[e.key]??``}`,children:e.selectedLabel||e.loading?(0,U.jsx)(lu,{item:e}):(0,U.jsx)(c,{placeholder:e.placeholder})}),(0,U.jsxs)(n,{className:iu[e.key]??``,style:{maxHeight:ou},children:[u?null:e.loading?(0,U.jsxs)(`div`,{className:`space-y-2 px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`h-3 w-36 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-28 animate-pulse rounded bg-muted`}),(0,U.jsx)(`div`,{className:`h-3 w-32 animate-pulse rounded bg-muted`})]}):e.emptyLabel?(0,U.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:e.emptyLabel}):null,l.map((e,t)=>(0,U.jsxs)(`div`,{children:[t>0?(0,U.jsx)(o,{}):null,(0,U.jsxs)(r,{children:[e.label?(0,U.jsx)(a,{children:e.label}):null,e.options.map(e=>(0,U.jsx)(i,{value:e.value,className:`py-1.5`,children:(0,U.jsx)(uu,{option:e})},e.value))]})]},e.key))]})]})}function pu({actions:e,accessories:t=[],addMenuLabel:n,selects:r,skillPicker:i,trailingSelects:a=[]}){let o=n??i?.title??t[0]?.label;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-2 px-3 pb-3`,children:[(0,U.jsxs)(`div`,{className:`nextclaw-chat-toolbar-leading-controls flex min-w-0 flex-1 flex-wrap items-center gap-1 overflow-hidden`,children:[o?(0,U.jsx)(Xl,{label:o,accessories:t,picker:i}):null,r.map(e=>(0,U.jsx)(fu,{item:e},e.key))]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-end gap-1`,children:[a.length>0?(0,U.jsx)(`div`,{className:`nextclaw-chat-toolbar-trailing-selects flex min-w-0 items-center gap-1`,children:a.map(e=>(0,U.jsx)(fu,{item:e},e.key))}):null,(0,U.jsx)(Gl,{...e})]})]})}var mu=(0,H.createContext)(null);function hu(e,t){let n=null;return e!=null&&(n=e[1]),{getTheme:function(){return t??(n==null?null:n.getTheme())}}}function gu(){let e=(0,H.useContext)(mu);return e??function(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}function G(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function _u(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);n.search=r.toString(),console.warn(`Minified Lexical warning #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var vu=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,yu=vu&&`documentMode`in document?document.documentMode:null,bu=vu&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xu=vu&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Su=!(!vu||!(`InputEvent`in window)||yu)&&`getTargetRanges`in new window.InputEvent(`input`),Cu=vu&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,wu=vu&&/Android/.test(navigator.userAgent),Tu=vu&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!wu,Eu=vu&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Du=vu&&wu&&Eu,Ou=vu&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&bu&&!Eu,ku=0,Au=1,ju=2,Mu=1,Nu=2,Pu=3,Fu=4,Iu=5,Lu=6,Ru=Tu||Cu||Ou?`\xA0`:``,zu=`
|
|
3
|
+
|
|
4
|
+
`,Bu=xu?`\xA0`:Ru,Vu={bold:1,capitalize:1024,code:16,highlight:128,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},Hu={directionless:1,unmergeable:2},Uu={center:2,end:6,justify:4,left:1,right:3,start:5},Wu={[Nu]:`center`,[Lu]:`end`,[Fu]:`justify`,[Mu]:`left`,[Pu]:`right`,[Iu]:`start`},Gu={normal:0,segmented:2,token:1},Ku={[ku]:`normal`,[ju]:`segmented`,[Au]:`token`},qu=`$config`;function Ju(e,t,n,r,i,a){let o=e.getFirstChild();for(;o!==null;){let e=o.__key;o.__parent===t&&(Y(o)&&Ju(o,e,n,r,i,a),n.has(e)||a.delete(e),i.push(e)),o=o.getNextSibling()}}var Yu=!1,Xu=0;function Zu(e){Xu=e.timeStamp}function Qu(e,t,n){let r=e.nodeName===`BR`,i=t.__lexicalLineBreak;return i&&(e===i||r&&e.previousSibling===i)||r&&Uh(e,n)!==void 0}function $u(e,t,n){let r=Mg(wg(n)),i=null,a=null;r!==null&&r.anchorNode===e&&(i=r.anchorOffset,a=r.focusOffset);let o=e.nodeValue;o!==null&&ng(t,o,i,a,!1)}function ed(e,t,n){if(q(e)){let t=e.anchor.getNode();if(t.is(n)&&e.format!==t.getFormat())return!1}return Ph(t)&&n.isAttached()}function td(e,t,n,r){for(let i=e;i&&!qg(i);i=vg(i)){let e=Uh(i,t);if(e!==void 0){let t=Vh(e,n);if(t)return ch(t)||!Pg(i)?void 0:[i,t]}else if(i===r)return[r,Jh(n)]}}function nd(e,t,n){Yu=!0;let r=performance.now()-Xu>100;try{nh(e,()=>{let i=J()||function(e){return e.getEditorState().read(()=>{let e=J();return e===null?null:e.clone()})}(e),a=new Map,o=e.getRootElement(),s=e._editorState,c=e._blockCursorElement,l=!1,u=``;for(let n=0;n<t.length;n++){let d=t[n],f=d.type,p=d.target,m=td(p,e,s,o);if(!m)continue;let[h,g]=m;if(f===`characterData`)r&&K(g)&&Ph(p)&&ed(i,p,g)&&$u(p,g,e);else if(f===`childList`){l=!0;let t=d.addedNodes;for(let n=0;n<t.length;n++){let r=t[n],i=Hh(r),a=r.parentNode;if(a!=null&&r!==c&&i===null&&!Qu(r,a,e)){if(xu){let e=(Pg(r)?r.innerText:null)||r.nodeValue;e&&(u+=e)}a.removeChild(r)}}let n=d.removedNodes,r=n.length;if(r>0){let t=0;for(let i=0;i<r;i++){let r=n[i];(Qu(r,p,e)||c===r)&&(p.appendChild(r),t++)}r!==t&&a.set(h,g)}}}if(a.size>0)for(let[t,n]of a)n.reconcileObservedMutation(t,e);let d=n.takeRecords();if(d.length>0){for(let t=0;t<d.length;t++){let n=d[t],r=n.addedNodes,i=n.target;for(let t=0;t<r.length;t++){let n=r[t],a=n.parentNode;a==null||n.nodeName!==`BR`||Qu(n,i,e)||a.removeChild(n)}}n.takeRecords()}i!==null&&(l&&Yh(i),xu&&gg(e)&&i.insertRawText(u))})}finally{Yu=!1}}function rd(e){let t=e._observer;t!==null&&nd(e,t.takeRecords(),t)}function id(e){(function(e){Xu===0&&wg(e).addEventListener(`textInput`,Zu,!0)})(e),e._observer=new MutationObserver((t,n)=>{nd(e,t,n)})}var ad=class{key;parse;unparse;isEqual;defaultValue;resetOnCopyNode;constructor(e,t){this.key=e,this.parse=t.parse.bind(t),this.unparse=(t.unparse||fd).bind(t),this.isEqual=(t.isEqual||Object.is).bind(t),this.defaultValue=this.parse(void 0),this.resetOnCopyNode=t.resetOnCopyNode||!1}};function od(e,t){return new ad(e,t)}function sd(e){let t=new Map,n=new Set;for(let r=typeof e==`function`?e:e.replace;r.prototype&&r.prototype.getType!==void 0;r=Object.getPrototypeOf(r)){let{ownNodeConfig:e}=Yg(r);if(e&&e.stateConfigs)for(let r of e.stateConfigs){let e;`stateConfig`in r?(e=r.stateConfig,r.flat&&n.add(e.key)):e=r,t.set(e.key,e)}}return{flatKeys:n,sharedConfigMap:t}}var cd=class e{node;knownState;unknownState;sharedNodeState;size;constructor(e,t,n=void 0,r=new Map,i=void 0){this.node=e,this.sharedNodeState=t,this.unknownState=n,this.knownState=r;let{sharedConfigMap:a}=this.sharedNodeState;this.size=i===void 0?function(e,t,n){let r=n.size;if(t)for(let i in t){let t=e.get(i);t&&n.has(t)||r++}return r}(a,n,r):i}getValue(e){let t=this.knownState.get(e);if(t!==void 0)return t;this.sharedNodeState.sharedConfigMap.set(e.key,e);let n=e.defaultValue;if(this.unknownState&&e.key in this.unknownState){let t=this.unknownState[e.key];t!==void 0&&(n=e.parse(t)),this.updateFromKnown(e,n)}return n}getInternalState(){return[this.unknownState,this.knownState]}toJSON(){let e={...this.unknownState},t={};for(let[t,n]of this.knownState)t.isEqual(n,t.defaultValue)?delete e[t.key]:e[t.key]=t.unparse(n);for(let n of this.sharedNodeState.flatKeys)n in e&&(t[n]=e[n],delete e[n]);return dd(e)&&(t.$=e),t}getWritable(t){if(this.node===t)return this;let{sharedNodeState:n,unknownState:r}=this,i=new Map(this.knownState);return new e(t,n,function(e,t,n){let r;if(n)for(let[i,a]of Object.entries(n)){let n=e.get(i);n?t.has(n)||t.set(n,n.parse(a)):(r||={},r[i]=a)}return r}(n.sharedConfigMap,i,r),i,this.size)}resetOnCopyNode(){for(let e of this.knownState.keys())e.resetOnCopyNode&&this.knownState.set(e,e.defaultValue);return this}updateFromKnown(e,t){let n=e.key;this.sharedNodeState.sharedConfigMap.set(n,e);let{knownState:r,unknownState:i}=this;r.has(e)||i&&n in i||(i&&(delete i[n],this.unknownState=dd(i)),this.size++),r.set(e,t)}updateFromUnknown(e,t){let n=this.sharedNodeState.sharedConfigMap.get(e);n?this.updateFromKnown(n,n.parse(t)):(this.unknownState=this.unknownState||{},e in this.unknownState||this.size++,this.unknownState[e]=t)}updateFromJSON(e){let{knownState:t}=this;for(let e of t.keys())t.set(e,e.defaultValue);if(this.size=t.size,this.unknownState=void 0,e)for(let[t,n]of Object.entries(e))this.updateFromUnknown(t,n)}};function ld(e){let t=e.getWritable(),n=t.__state?t.__state.getWritable(t):new cd(t,ud(t));return t.__state=n,n}function ud(e){return e.__state?e.__state.sharedNodeState:wh(Bg(),e.getType()).sharedNodeState}function dd(e){if(e)for(let t in e)return e}function fd(e){return e}function pd(e,t,n){for(let[r,i]of t.knownState){if(e.has(r.key))continue;e.add(r.key);let t=n?n.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return!0}return!1}function md(e,t,n){let{unknownState:r}=t,i=n?n.unknownState:void 0;if(r){for(let[t,n]of Object.entries(r))if(!e.has(t)&&(e.add(t),n!==(i?i[t]:void 0)))return!0}return!1}function hd(e,t){let n=e.__state;return n&&n.node===e?n.getWritable(t):n}function gd(e,t){let n=e.__mode,r=e.__format,i=e.__style,a=t.__mode,o=t.__format,s=t.__style,c=e.__state,l=t.__state;return(n===null||n===a)&&(r===null||r===o)&&(i===null||i===s)&&(e.__state===null||c===l||function(e,t){if(e===t)return!0;let n=new Set;return!(e&&pd(n,e,t)||t&&pd(n,t,e)||e&&md(n,e,t)||t&&md(n,t,e))}(c,l))}function _d(e,t){let n=e.mergeWithSibling(t),r=Um()._normalizedNodes;return r.add(e.__key),r.add(t.__key),n}function vd(e){let t,n,r=e;if(r.__text!==``||!r.isSimpleText()||r.isUnmergeable()){for(;(t=r.getPreviousSibling())!==null&&K(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==``){if(gd(t,r)){r=_d(t,r);break}break}t.remove()}for(;(n=r.getNextSibling())!==null&&K(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(n.__text!==``){if(gd(r,n)){r=_d(r,n);break}break}n.remove()}}else r.remove()}function yd(e){return bd(e.anchor),bd(e.focus),e}function bd(e){for(;e.type===`element`;){let t=e.getNode(),n=e.offset,r,i;if(n===t.getChildrenSize()?(r=t.getChildAtIndex(n-1),i=!0):(r=t.getChildAtIndex(n),i=!1),K(r)){e.set(r.__key,i?r.getTextContentSize():0,`text`,!0);break}if(!Y(r))break;e.set(r.__key,i?r.getChildrenSize():0,`element`,!0)}}var xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd=``,Md=null,Nd=null,Pd=!1,Fd=!1;function Id(e,t){let n=Dd.get(e);if(t!==null){let n=ef(e);n.parentNode===t&&t.removeChild(n)}if(Od.has(e)||Sd._keyToDOMMap.delete(e),Y(n)){let e=Jd(n,Dd);Ld(e,0,e.length-1,null)}n!==void 0&&pg(Ad,Cd,wd,n,`destroyed`)}function Ld(e,t,n,r){for(let i=t;i<=n;++i){let t=e[i];t!==void 0&&Id(t,r)}}function Rd(e,t){e.setProperty(`text-align`,t)}var zd=`40px`;function Bd(e,t){let n=xd.theme.indent;if(typeof n==`string`){let r=e.classList.contains(n);t>0&&!r?e.classList.add(n):t<1&&r&&e.classList.remove(n)}if(t===0)return void e.style.setProperty(`padding-inline-start`,``);let r=getComputedStyle(Sd._rootElement||e).getPropertyValue(`--lexical-indent-base-value`)||zd;e.style.setProperty(`padding-inline-start`,`calc(${t} * ${r})`)}function Vd(e,t){let n=e.style;t===0?Rd(n,``):t===1?Rd(n,`left`):t===2?Rd(n,`center`):t===3?Rd(n,`right`):t===4?Rd(n,`justify`):t===5?Rd(n,`start`):t===6&&Rd(n,`end`)}function Hd(e,t){let n=function(e){let t=e.__dir;if(t!==null)return t;if(uh(e))return null;let n=e.getParentOrThrow();return uh(n)&&n.__dir===null?`auto`:null}(t);n===null?e.removeAttribute(`dir`):e.dir=n}function Ud(e,t){let n=Od.get(e);n===void 0&&G(60);let r=n.createDOM(xd,Sd);if(function(e,t,n){let r=n._keyToDOMMap;(function(e,t,n){let r=`__lexicalKey_${t._key}`;e[r]=n})(t,n,e),r.set(e,t)}(e,r,Sd),K(n)?r.setAttribute(`data-lexical-text`,`true`):ch(n)&&r.setAttribute(`data-lexical-decorator`,`true`),Y(n)){let e=n.__indent,t=n.__size;if(Hd(r,n),e!==0&&Bd(r,e),t!==0){let e=t-1;Wd(Jd(n,Od),n,0,e,n.getDOMSlot(r))}let i=n.__format;i!==0&&Vd(r,i),n.isInline()||Kd(null,n,r)}else{let t=n.getTextContent();if(ch(n)){let t=n.decorate(Sd,xd);t!==null&&Xd(e,t),r.contentEditable=`false`}jd+=t}return t!==null&&t.insertChild(r),pg(Ad,Cd,wd,n,`created`),r}function Wd(e,t,n,r,i){let a=jd;jd=``;let o=n;for(;o<=r;++o){Ud(e[o],i);let t=Od.get(e[o]);t!==null&&K(t)?Md===null&&(Md=t.getFormat(),Nd=t.getStyle()):Y(t)&&o<r&&!t.isInline()&&(jd+=zu)}i.element.__lexicalTextContent=jd,jd=a+jd}function Gd(e,t){if(e){let n=e.__last;if(n){let e=t.get(n);if(e)return Pp(e)?`line-break`:ch(e)&&e.isInline()?`decorator`:null}return`empty`}return null}function Kd(e,t,n){let r=Gd(e,Dd),i=Gd(t,Od);r!==i&&t.getDOMSlot(n).setManagedLineBreak(i)}function qd(e,t,n){var r;Md=null,Nd=null,function(e,t,n){let r=jd,i=e.__size,a=t.__size;jd=``;let o=n.element;if(i===1&&a===1){let n=e.__first,r=t.__first;if(n===r)Yd(n,o);else{let e=ef(n),t=Ud(r,null);try{o.replaceChild(t,e)}catch(i){if(typeof i==`object`&&i){let a=`${i.toString()} Parent: ${o.tagName}, new child: {tag: ${t.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${n}}.`;throw Error(a)}throw i}Id(n,null)}let i=Od.get(r);K(i)&&Md===null&&(Md=i.getFormat(),Nd=i.getStyle())}else{let r=Jd(e,Dd),s=Jd(t,Od);if(r.length!==i&&G(227),s.length!==a&&G(228),i===0)a!==0&&Wd(s,0,0,a-1,n);else if(a===0){if(i!==0){let e=n.after==null&&n.before==null&&n.element.__lexicalLineBreak==null;Ld(r,0,i-1,e?null:o),e&&(o.textContent=``)}}else (function(e,t,n,r,i,a){let o=r-1,s=i-1,c,l,u=a.getFirstChild(),d=0,f=0;for(;d<=o&&f<=s;){let e=t[d],r=n[f];if(e===r)u=Zd(Yd(r,a.element)),d++,f++;else{if(l===void 0&&(l=Qd(n,f)),c===void 0)c=Qd(t,d);else if(!c.has(e)){d++;continue}if(!l.has(e)){u=Zd(ef(e)),Id(e,a.element),d++,c.delete(e);continue}if(c.has(r)){let e=_g(Sd,r);e!==u&&a.withBefore(u).insertChild(e),u=Zd(Yd(r,a.element)),d++,f++}else Ud(r,a.withBefore(u)),f++}let i=Od.get(r);i!==null&&K(i)?Md===null&&(Md=i.getFormat(),Nd=i.getStyle()):Y(i)&&f<=s&&!i.isInline()&&(jd+=zu)}let p=d>o,m=f>s;if(p&&!m){let e=n[s+1],t=e===void 0?null:Sd.getElementByKey(e);Wd(n,0,f,s,a.withBefore(t))}else m&&!p&&Ld(t,d,o,a.element)})(0,r,s,i,a,n)}o.__lexicalTextContent=jd,jd=r+jd}(e,t,t.getDOMSlot(n)),r=t,Md==null||Md===r.__textFormat||Fd||r.setTextFormat(Md),function(e){Nd==null||Nd===e.__textStyle||Fd||e.setTextStyle(Nd)}(t)}function Jd(e,t){let n=[],r=e.__first;for(;r!==null;){let e=t.get(r);e===void 0&&G(101),n.push(r),r=e.__next}return n}function Yd(e,t){let n=Dd.get(e),r=Od.get(e);n!==void 0&&r!==void 0||G(61);let i=Pd||Ed.has(e)||Td.has(e),a=_g(Sd,e);if(n===r&&!i){let e;if(Y(n)){let t=a.__lexicalTextContent;typeof t==`string`?e=t:(e=n.getTextContent(),a.__lexicalTextContent=e)}else e=n.getTextContent();return jd+=e,a}if(n!==r&&i&&pg(Ad,Cd,wd,r,`updated`),r.updateDOM(n,a,xd)){let n=Ud(e,null);return t===null&&G(62),t.replaceChild(n,a),Id(e,null),n}if(Y(n)){Y(r)||G(334,e);let t=r.__indent;(Pd||t!==n.__indent)&&Bd(a,t);let o=r.__format;if((Pd||o!==n.__format)&&Vd(a,o),i)qd(n,r,a),uh(r)||r.isInline()||Kd(n,r,a);else{let e=a.__lexicalTextContent,t;typeof e==`string`?t=e:(t=n.getTextContent(),a.__lexicalTextContent=t),jd+=t}if((Pd||r.__dir!==n.__dir)&&(Hd(a,r),uh(r)&&!Pd))for(let e of r.getChildren())Y(e)&&Hd(_g(Sd,e.getKey()),e)}else{let t=r.getTextContent();if(ch(r)){let t=r.decorate(Sd,xd);t!==null&&Xd(e,t)}jd+=t}if(!Fd&&uh(r)&&r.__cachedText!==jd){let e=r.getWritable();e.__cachedText=jd,r=e}return a}function Xd(e,t){let n=Sd._pendingDecorators,r=Sd._decorators;if(n===null){if(r[e]===t)return;n=Gh(Sd)}n[e]=t}function Zd(e){let t=e.nextSibling;return t!==null&&t===Sd._blockCursorElement&&(t=t.nextSibling),t}function Qd(e,t){let n=new Set;for(let r=t;r<e.length;r++)n.add(e[r]);return n}function $d(e,t,n,r,i,a){jd=``,Pd=r===2,Sd=n,xd=n._config,Cd=n._nodes,wd=Sd._listeners.mutation,Td=i,Ed=a,Dd=e._nodeMap,Od=t._nodeMap,Fd=t._readOnly,kd=new Map(n._keyToDOMMap);let o=new Map;return Ad=o,Yd(`root`,null),Sd=void 0,Cd=void 0,Td=void 0,Ed=void 0,Dd=void 0,Od=void 0,xd=void 0,kd=void 0,Ad=void 0,o}function ef(e){let t=kd.get(e);return t===void 0&&G(75,e),t}function tf(e){return{type:e}}var nf=tf(`SELECTION_CHANGE_COMMAND`),rf=tf(`CLICK_COMMAND`),af=tf(`BEFORE_INPUT_COMMAND`),of=tf(`INPUT_COMMAND`),sf=tf(`COMPOSITION_START_COMMAND`),cf=tf(`COMPOSITION_END_COMMAND`),lf=tf(`DELETE_CHARACTER_COMMAND`),uf=tf(`INSERT_LINE_BREAK_COMMAND`),df=tf(`INSERT_PARAGRAPH_COMMAND`),ff=tf(`CONTROLLED_TEXT_INSERTION_COMMAND`),pf=tf(`PASTE_COMMAND`),mf=tf(`REMOVE_TEXT_COMMAND`),hf=tf(`DELETE_WORD_COMMAND`),gf=tf(`DELETE_LINE_COMMAND`),_f=tf(`FORMAT_TEXT_COMMAND`),vf=tf(`UNDO_COMMAND`),yf=tf(`REDO_COMMAND`),bf=tf(`KEYDOWN_COMMAND`),xf=tf(`KEY_ARROW_RIGHT_COMMAND`),Sf=tf(`MOVE_TO_END`),Cf=tf(`KEY_ARROW_LEFT_COMMAND`),wf=tf(`MOVE_TO_START`),Tf=tf(`KEY_ARROW_UP_COMMAND`),Ef=tf(`KEY_ARROW_DOWN_COMMAND`),Df=tf(`KEY_ENTER_COMMAND`),Of=tf(`KEY_SPACE_COMMAND`),kf=tf(`KEY_BACKSPACE_COMMAND`),Af=tf(`KEY_ESCAPE_COMMAND`),jf=tf(`KEY_DELETE_COMMAND`),Mf=tf(`KEY_TAB_COMMAND`),Nf=tf(`DROP_COMMAND`),Pf=tf(`DRAGSTART_COMMAND`),Ff=tf(`DRAGOVER_COMMAND`),If=tf(`DRAGEND_COMMAND`),Lf=tf(`COPY_COMMAND`),Rf=tf(`CUT_COMMAND`),zf=tf(`SELECT_ALL_COMMAND`),Bf=tf(`FOCUS_COMMAND`),Vf=tf(`BLUR_COMMAND`),Hf=tf(`KEY_MODIFIER_COMMAND`),Uf=Object.freeze({}),Wf=[[`keydown`,function(e,t){Gf=e.timeStamp,Kf=e.key,!t.isComposing()&&X(t,bf,e)}],[`pointerdown`,function(e,t){let n=e.target,r=e.pointerType;Fg(n)&&r!==`touch`&&r!==`pen`&&e.button===0&&nh(t,()=>{Eh(n)||(Qf=!0)})}],[`compositionstart`,function(e,t){X(t,sf,e)}],[`compositionend`,function(e,t){xu?ep=!0:Cu||!Tu&&!Ou?X(t,cf,e):(tp=!0,np=e.data)}],[`input`,function(e,t){e.stopPropagation(),nh(t,()=>{t.dispatchCommand(of,e)},{event:e}),Jf=null}],[`click`,function(e,t){nh(t,()=>{let n=J(),r=Mg(wg(t)),i=Sm();if(r){if(q(n)){let t=n.anchor,a=t.getNode();if(t.type===`element`&&t.offset===0&&n.isCollapsed()&&!uh(a)&&qh().getChildrenSize()===1&&a.getTopLevelElementOrThrow().isEmpty()&&i!==null&&n.is(i))r.removeAllRanges(),n.dirty=!0;else if(e.detail===3&&!n.isCollapsed()&&a!==n.focus.getNode()){let e=Zg(a,e=>Y(e)&&!e.isInline());Y(e)&&e.select(0)}}else if(e.pointerType===`touch`||e.pointerType===`pen`){let n=r.anchorNode;(Pg(n)||Ph(n))&&Yh(xm(i,r,t,e))}}X(t,rf,e)})}],[`cut`,Uf],[`copy`,Uf],[`dragstart`,Uf],[`dragover`,Uf],[`dragend`,Uf],[`paste`,Uf],[`focus`,Uf],[`blur`,Uf],[`drop`,Uf]];Su&&Wf.push([`beforeinput`,(e,t)=>function(e,t){let n=e.inputType;n===`deleteCompositionText`||xu&&gg(t)||n!==`insertCompositionText`&&X(t,af,e)}(e,t)]);var Gf=0,Kf=null,qf=0,Jf=null,Yf=new WeakMap,Xf=new WeakMap,Zf=!1,Qf=!1,$f=!1,ep=!1,tp=!1,np=``,rp=null,ip=[0,``,0,`root`,0];function ap(e,t,n,r,i){let a=e.anchor,o=e.focus,s=a.getNode(),c=Um(),l=Mg(wg(c)),u=l===null?null:l.anchorNode,d=a.key,f=c.getElementByKey(d),p=n.length;return d!==o.key||!K(s)||(!i&&(!Su||qf<r+50)||s.isDirty()&&p<2||Zh(n))&&a.offset!==o.offset&&!s.isComposing()||Nh(s)||s.isDirty()&&p>1||(i||!Su)&&f!==null&&!s.isComposing()&&u!==Fh(f)||l!==null&&t!==null&&(!t.collapsed||t.startContainer!==l.anchorNode||t.startOffset!==l.anchorOffset)||!s.isComposing()&&(s.getFormat()!==e.format||s.getStyle()!==e.style)||function(e,t){if(t.isSegmented())return!0;if(!e.isCollapsed())return!1;let n=e.anchor.offset,r=t.getParentOrThrow(),i=Mh(t);return n===0?!t.canInsertTextBefore()||!r.canInsertTextBefore()&&!t.isComposing()||i||function(e){let t=e.getPreviousSibling();return(K(t)||Y(t)&&t.isInline())&&!t.canInsertTextAfter()}(t):n===t.getTextContentSize()&&(!t.canInsertTextAfter()||!r.canInsertTextAfter()&&!t.isComposing()||i)}(e,s)}function op(e,t){return Ph(e)&&e.nodeValue!==null&&t!==0&&t!==e.nodeValue.length}function sp(e,t,n){let{anchorNode:r,anchorOffset:i,focusNode:a,focusOffset:o}=e;Zf&&(Zf=!1,op(r,i)&&op(a,o)&&!rp)||nh(t,()=>{if(!n)return void Yh(null);if(!Oh(t,r,a))return;let s=J();if(rp&&q(s)&&s.isCollapsed()){let e=s.anchor,t=rp.anchor;(e.key===t.key&&e.offset===t.offset+1||e.offset===1&&t.getNode().is(e.getNode().getPreviousSibling()))&&(s=rp.clone(),Yh(s))}if(rp=null,q(s)){let n=s.anchor,r=n.getNode();if(s.isCollapsed()){e.type===`Range`&&e.anchorNode===e.focusNode&&(s.dirty=!0);let i=wg(t).event,a=i?i.timeStamp:performance.now(),[o,c,l,u,d]=ip,f=qh(),p=!1===t.isComposing()&&f.getTextContent()===``;if(a<d+200&&n.offset===l&&n.key===u)cp(s,o,c);else if(n.type===`text`)K(r)||G(141),lp(s,r);else if(n.type===`element`&&!p){Y(r)||G(259);let e=n.getNode();e.isEmpty()?function(e,t){cp(e,t.getTextFormat(),t.getTextStyle())}(s,e):cp(s,s.format,``)}}else{let e=n.key,t=s.focus.key,r=s.getNodes(),a=r.length,c=s.isBackward(),l=c?o:i,u=c?i:o,d=c?t:e,f=c?e:t,p=2047,m=!1;for(let e=0;e<a;e++){let t=r[e],n=t.getTextContentSize();if(K(t)&&n!==0&&!(e===0&&t.__key===d&&l===n||e===a-1&&t.__key===f&&u===0)&&(m=!0,p&=t.getFormat(),p===0))break}s.format=m?p:0}}X(t,nf,void 0)})}function cp(e,t,n){e.format===t&&e.style===n||(e.format=t,e.style=n,e.dirty=!0)}function lp(e,t){cp(e,t.getFormat(),t.getStyle())}function up(e){if(!e.getTargetRanges)return null;let t=e.getTargetRanges();return t.length===0?null:t[0]}function dp(e){let t=e.inputType,n=up(e),r=Um(),i=J();if(t===`deleteContentBackward`){if(i===null){let e=Sm();if(!q(e))return!0;Yh(e.clone())}if(q(i)){let t=i.anchor.key===i.focus.key;if(a=e.timeStamp,Kf===`MediaLast`&&a<Gf+30&&r.isComposing()&&t){if(zh(null),Gf=0,setTimeout(()=>{nh(r,()=>{zh(null)})},30),q(i)){let e=i.anchor.getNode();e.markDirty(),K(e)||G(142),lp(i,e)}}else{zh(null),e.preventDefault();let n=i.anchor.getNode(),a=n.getTextContent(),o=n.canInsertTextAfter(),s=i.anchor.offset===0&&i.focus.offset===a.length,c=Du&&t&&!s&&o;if(c&&i.isCollapsed()&&(c=!ch(hg(i.anchor,!0))),!c){X(r,lf,!0);let e=J();Du&&q(e)&&e.isCollapsed()&&(rp=e,setTimeout(()=>rp=null))}}return!0}}var a;if(!q(i))return!0;let o=e.data;Jf!==null&&tg(!1,r,Jf),i.dirty&&Jf===null||!i.isCollapsed()||uh(i.anchor.getNode())||n===null||i.applyDOMRange(n),Jf=null;let s=i.anchor,c=i.focus,l=s.getNode(),u=c.getNode();if(t===`insertText`||t===`insertTranspose`){if(o===`
|
|
5
|
+
`)e.preventDefault(),X(r,uf,!1);else if(o===zu)e.preventDefault(),X(r,df,void 0);else if(o==null&&e.dataTransfer){let t=e.dataTransfer.getData(`text/plain`);e.preventDefault(),i.insertRawText(t)}else o!=null&&ap(i,n,o,e.timeStamp,!0)?(e.preventDefault(),X(r,ff,o)):Jf=o;return qf=e.timeStamp,!0}switch(e.preventDefault(),t){case`insertFromYank`:case`insertFromDrop`:case`insertReplacementText`:X(r,ff,e);break;case`insertFromComposition`:zh(null),X(r,ff,e);break;case`insertLineBreak`:zh(null),X(r,uf,!1);break;case`insertParagraph`:zh(null),$f&&!Cu?($f=!1,X(r,uf,!1)):X(r,df,void 0);break;case`insertFromPaste`:case`insertFromPasteAsQuotation`:X(r,pf,e);break;case`deleteByComposition`:(function(e,t){return e!==t||Y(e)||Y(t)||!Mh(e)||!Mh(t)})(l,u)&&X(r,mf,e);break;case`deleteByDrag`:case`deleteByCut`:X(r,mf,e);break;case`deleteContent`:X(r,lf,!1);break;case`deleteWordBackward`:X(r,hf,!0);break;case`deleteWordForward`:X(r,hf,!1);break;case`deleteHardLineBackward`:case`deleteSoftLineBackward`:X(r,gf,!0);break;case`deleteContentForward`:case`deleteHardLineForward`:case`deleteSoftLineForward`:X(r,gf,!1);break;case`formatStrikeThrough`:X(r,_f,`strikethrough`);break;case`formatBold`:X(r,_f,`bold`);break;case`formatItalic`:X(r,_f,`italic`);break;case`formatUnderline`:X(r,_f,`underline`);break;case`historyUndo`:X(r,vf,void 0);break;case`historyRedo`:X(r,yf,void 0)}return!0}function fp(e){if(Pg(e.target)&&Eh(e.target))return!0;let t=Um(),n=J(),r=e.data,i=up(e);if(r!=null&&q(n)&&ap(n,i,r,e.timeStamp,!1)){ep&&=(hp(t,r),!1);let i=n.anchor.getNode(),a=Mg(wg(t));if(a===null)return!0;let o=n.isBackward(),s=o?n.anchor.offset:n.focus.offset,c=o?n.focus.offset:n.anchor.offset;Su&&!n.isCollapsed()&&K(i)&&a.anchorNode!==null&&i.getTextContent().slice(0,s)+r+i.getTextContent().slice(s+c)===eg(a.anchorNode)||X(t,ff,r);let l=r.length;xu&&l>1&&e.inputType===`insertCompositionText`&&!t.isComposing()&&(n.anchor.offset-=l),Du&&t.isComposing()&&(Gf=0,zh(null))}else tg(!1,t,r===null?void 0:r),ep&&=(hp(t,r||void 0),!1);return function(){Bm(),rd(Um())}(),!0}function pp(e){let t=Um(),n=J();if(q(n)&&!t.isComposing()){let r=n.anchor,i=n.anchor.getNode();zh(r.key),bg(kp),(e.timeStamp<Gf+30||r.type===`element`||!n.isCollapsed()||i.getFormat()!==n.format||K(i)&&i.getStyle()!==n.style)&&X(t,ff,Bu)}return!0}function mp(e){return hp(Um(),e.data),bg(Ap),!0}function hp(e,t){let n=e._compositionKey;if(zh(null),n!==null&&t!=null){if(t===``){let t=Vh(n),r=Fh(e.getElementByKey(n));if(r!==null&&r.nodeValue!==null&&K(t)){let n=Mg(wg(e)),i=null,a=null;n!==null&&n.anchorNode===r&&(i=n.anchorOffset,a=n.focusOffset),ng(t,r.nodeValue,i,a,!0)}return}if(t[t.length-1]===`
|
|
6
|
+
`){let t=J();if(q(t)||cm(t)){if(q(t)){let e=t.focus;t.anchor.set(e.key,e.offset,e.type)}X(e,Df,null);return}}}tg(!0,e,t)}function gp(e){let t=Um();if(e.key==null)return!0;if(tp){if(lg(e))return nh(t,()=>{hp(t,np)}),tp=!1,np=``,!0;tp=!1,np=``}if(function(e){return og(e,`ArrowRight`,{shiftKey:`any`})}(e))X(t,xf,e);else if(function(e){return og(e,`ArrowRight`,sg)}(e))X(t,Sf,e);else if(function(e){return og(e,`ArrowLeft`,{shiftKey:`any`})}(e))X(t,Cf,e);else if(function(e){return og(e,`ArrowLeft`,sg)}(e))X(t,wf,e);else if(function(e){return og(e,`ArrowUp`,{altKey:`any`,shiftKey:`any`})}(e))X(t,Tf,e);else if(function(e){return og(e,`ArrowDown`,{altKey:`any`,shiftKey:`any`})}(e))X(t,Ef,e);else if(function(e){return og(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`,shiftKey:!0})}(e))$f=!0,X(t,Df,e);else if(function(e){return e.key===` `}(e))X(t,Of,e);else if(function(e){return bu&&og(e,`o`,{ctrlKey:!0})}(e))e.preventDefault(),$f=!0,X(t,uf,!0);else if(function(e){return og(e,`Enter`,{altKey:`any`,ctrlKey:`any`,metaKey:`any`})}(e))$f=!1,X(t,Df,e);else if(function(e){return og(e,`Backspace`,{shiftKey:`any`})||bu&&og(e,`h`,{ctrlKey:!0})}(e))lg(e)?X(t,kf,e):(e.preventDefault(),X(t,lf,!0));else if(function(e){return e.key===`Escape`}(e))X(t,Af,e);else if(function(e){return og(e,`Delete`,{})||bu&&og(e,`d`,{ctrlKey:!0})}(e))(function(e){return e.key===`Delete`})(e)?X(t,jf,e):(e.preventDefault(),X(t,lf,!1));else if(function(e){return og(e,`Backspace`,cg)}(e))e.preventDefault(),X(t,hf,!0);else if(function(e){return og(e,`Delete`,cg)}(e))e.preventDefault(),X(t,hf,!1);else if(function(e){return bu&&og(e,`Backspace`,{metaKey:!0})}(e))e.preventDefault(),X(t,gf,!0);else if(function(e){return bu&&(og(e,`Delete`,{metaKey:!0})||og(e,`k`,{ctrlKey:!0}))}(e))e.preventDefault(),X(t,gf,!1);else if(function(e){return og(e,`b`,sg)}(e))e.preventDefault(),X(t,_f,`bold`);else if(function(e){return og(e,`u`,sg)}(e))e.preventDefault(),X(t,_f,`underline`);else if(function(e){return og(e,`i`,sg)}(e))e.preventDefault(),X(t,_f,`italic`);else if(function(e){return og(e,`Tab`,{shiftKey:`any`})}(e))X(t,Mf,e);else if(function(e){return og(e,`z`,sg)}(e))e.preventDefault(),X(t,vf,void 0);else if(function(e){return bu?og(e,`z`,{metaKey:!0,shiftKey:!0}):og(e,`y`,{ctrlKey:!0})||og(e,`z`,{ctrlKey:!0,shiftKey:!0})}(e))e.preventDefault(),X(t,yf,void 0);else{let n=t._editorState._selection;n===null||q(n)?ug(e)&&(e.preventDefault(),X(t,zf,e)):function(e){return og(e,`c`,sg)}(e)?(e.preventDefault(),X(t,Lf,e)):function(e){return og(e,`x`,sg)}(e)?(e.preventDefault(),X(t,Rf,e)):ug(e)&&(e.preventDefault(),X(t,zf,e))}return function(e){return e.ctrlKey||e.shiftKey||e.altKey||e.metaKey}(e)&&t.dispatchCommand(Hf,e),!0}function _p(e){let t=e.__lexicalEventHandles;return t===void 0&&(t=[],e.__lexicalEventHandles=t),t}var vp=new Map;function yp(e){let t=Ng(e.target);if(t===null)return;let n=Ah(t.anchorNode);if(n===null)return;Qf&&(Qf=!1,nh(n,()=>{let r=Sm(),i=t.anchorNode;(Pg(i)||Ph(i))&&Yh(xm(r,t,n,e))}));let r=Qh(n),i=r[r.length-1],a=i._key,o=vp.get(a),s=o||i;s!==n&&sp(t,s,!1),sp(t,n,!0),n===i?o&&vp.delete(a):vp.set(a,n)}function bp(e){e._lexicalHandled=!0}function xp(e){return!0===e._lexicalHandled}function Sp(e){let t=Yf.get(e);if(t===void 0)return;let n=Xf.get(t);if(n===void 0)return;let r=n-1;r>=0||G(164),Yf.delete(e),Xf.set(t,r),r===0&&t.removeEventListener(`selectionchange`,yp);let i=jh(e);kh(i)?(function(e){if(e._parentEditor!==null){let t=Qh(e),n=t[t.length-1]._key;vp.get(n)===e&&vp.delete(n)}else vp.delete(e._key)}(i),e.__lexicalEditor=null):i&&G(198);let a=_p(e);for(let e=0;e<a.length;e++)a[e]();e.__lexicalEventHandles=[]}function Cp(e,t,n){Bm();let r=e.__key,i=e.getParent();if(i===null)return;let a=function(e){let t=J();if(!q(t)||!Y(e))return t;let{anchor:n,focus:r}=t,i=n.getNode(),a=r.getNode();return Sg(i,e)&&n.set(e.__key,0,`element`),Sg(a,e)&&r.set(e.__key,0,`element`),t}(e),o=!1;if(q(a)&&t){let t=a.anchor,n=a.focus;t.key===r&&(Tm(t,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0),n.key===r&&(Tm(n,e,i,e.getPreviousSibling(),e.getNextSibling()),o=!0)}else cm(a)&&t&&e.isSelected()&&e.selectPrevious();if(q(a)&&t&&!o){let t=e.getIndexWithinParent();Lh(e),Cm(a,i,t,-1)}else Lh(e);n||Eg(i)||i.canBeEmpty()||!i.isEmpty()||Cp(i,t),t&&a&&uh(i)&&i.isEmpty()&&i.selectEnd()}var wp=Symbol.for(`ephemeral`);function Tp(e){return e[wp]||!1}var Ep=class{__type;__key;__parent;__prev;__next;__state;static getType(){let{ownNodeType:e}=Yg(this);return e===void 0&&G(64,this.name),e}static clone(e){G(65,this.name)}$config(){return{}}config(e,t){let n=t.extends||Object.getPrototypeOf(this.constructor);return Object.assign(t,{extends:n,type:e}),{[e]:t}}afterCloneFrom(e){this.__key===e.__key?(this.__parent=e.__parent,this.__next=e.__next,this.__prev=e.__prev,this.__state=e.__state):e.__state&&(this.__state=e.__state.getWritable(this))}resetOnCopyNodeFrom(e){this.__state&&=this.__state.getWritable(this).resetOnCopyNode()}static importDOM;constructor(e){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,`__state`,{configurable:!0,enumerable:!1,value:void 0,writable:!0}),Jee(this,e)}getType(){return this.__type}isInline(){G(137,this.constructor.name)}isAttached(){let e=this.__key;for(;e!==null;){if(e===`root`)return!0;let t=Vh(e);if(t===null)break;e=t.__parent}return!1}isSelected(e){let t=e||J();if(t==null)return!1;let n=t.getNodes().some(e=>e.__key===this.__key);if(K(this))return n;if(q(t)&&t.anchor.type===`element`&&t.focus.type===`element`){if(t.isCollapsed())return!1;let e=this.getParent();if(ch(this)&&this.isInline()&&e){let n=t.isBackward()?t.focus:t.anchor;if(e.is(n.getNode())&&n.offset===e.getChildrenSize()&&this.is(e.getLastChild()))return!1}}return n}getKey(){return this.__key}getIndexWithinParent(){let e=this.getParent();if(e===null)return-1;let t=e.getFirstChild(),n=0;for(;t!==null;){if(this.is(t))return n;n++,t=t.getNextSibling()}return-1}getParent(){let e=this.getLatest().__parent;return e===null?null:Vh(e)}getParentOrThrow(){let e=this.getParent();return e===null&&G(66,this.__key),e}getTopLevelElement(){let e=this;for(;e!==null;){let t=e.getParent();if(Eg(t))return Y(e)||e===this&&ch(e)||G(194),e;e=t}return null}getTopLevelElementOrThrow(){let e=this.getTopLevelElement();return e===null&&G(67,this.__key),e}getParents(){let e=[],t=this.getParent();for(;t!==null;)e.push(t),t=t.getParent();return e}getParentKeys(){let e=[],t=this.getParent();for(;t!==null;)e.push(t.__key),t=t.getParent();return e}getPreviousSibling(){let e=this.getLatest().__prev;return e===null?null:Vh(e)}getPreviousSiblings(){let e=[],t=this.getParent();if(t===null)return e;let n=t.getFirstChild();for(;n!==null&&!n.is(this);)e.push(n),n=n.getNextSibling();return e}getNextSibling(){let e=this.getLatest().__next;return e===null?null:Vh(e)}getNextSiblings(){let e=[],t=this.getNextSibling();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getCommonAncestor(e){let t=Y(this)?this:this.getParent(),n=Y(e)?e:e.getParent(),r=t&&n?k_(t,n):null;return r?r.commonAncestor:null}is(e){return e!=null&&this.__key===e.__key}isBefore(e){let t=k_(this,e);return t!==null&&(t.type===`descendant`||(t.type===`branch`?E_(t)===-1:(t.type!==`same`&&t.type!==`ancestor`&&G(279),!1)))}isParentOf(e){let t=k_(this,e);return t!==null&&t.type===`ancestor`}getNodesBetween(e){let t=this.isBefore(e),n=[],r=new Set,i=this;for(;i!==null;){let a=i.__key;if(r.has(a)||(r.add(a),n.push(i)),i===e)break;let o=Y(i)?t?i.getFirstChild():i.getLastChild():null;if(o!==null){i=o;continue}let s=t?i.getNextSibling():i.getPreviousSibling();if(s!==null){i=s;continue}let c=i.getParentOrThrow();if(r.has(c.__key)||n.push(c),c===e)break;let l=null,u=c;do{if(u===null&&G(68),l=t?u.getNextSibling():u.getPreviousSibling(),u=u.getParent(),u===null)break;l!==null||r.has(u.__key)||n.push(u)}while(l===null);i=l}return t||n.reverse(),n}isDirty(){let e=Um()._dirtyLeaves;return e!==null&&e.has(this.__key)}getLatest(){if(Tp(this))return this;let e=Vh(this.__key);return e===null&&G(113),e}getWritable(){if(Tp(this))return this;Bm();let e=Hm(),t=Um(),n=e._nodeMap,r=this.__key,i=this.getLatest(),a=t._cloneNotNeeded,o=J();if(o!==null&&o.setCachedNodes(null),a.has(r))return Rh(i),i;let s=Wg(i);return a.add(r),Rh(s),n.set(r,s),s}getTextContent(){return``}getTextContentSize(){return this.getTextContent().length}createDOM(e,t){G(70)}updateDOM(e,t,n){G(71)}exportDOM(e){return{element:this.createDOM(e._config,e)}}exportJSON(){let e=this.__state?this.__state.toJSON():void 0;return{type:this.__type,version:1,...e}}static importJSON(e){G(18,this.name)}updateFromJSON(e){return function(e,t){let n=e.getWritable(),r=t.$,i=r;for(let e of ud(n).flatKeys)e in t&&(i!==void 0&&i!==r||(i={...r}),i[e]=t[e]);return(n.__state||i)&&ld(e).updateFromJSON(i),n}(this,e)}static transform(){return null}remove(e){Cp(this,!0,e)}replace(e,t){Bm();let n=J();n!==null&&(n=n.clone()),Og(this,e);let r=this.getLatest(),i=this.__key,a=e.__key,o=e.getWritable(),s=this.getParentOrThrow().getWritable(),c=s.__size;Lh(o);let l=r.getPreviousSibling(),u=r.getNextSibling(),d=r.__prev,f=r.__next,p=r.__parent;if(Cp(r,!1,!0),l===null?s.__first=a:l.getWritable().__next=a,o.__prev=d,u===null?s.__last=a:u.getWritable().__prev=a,o.__next=f,o.__parent=p,s.__size=c,t&&(Y(this)&&Y(o)||G(139),this.getChildren().forEach(e=>{o.append(e)})),q(n)){Yh(n);let e=n.anchor,t=n.focus;e.key===i&&am(e,o),t.key===i&&am(t,o)}return Bh()===i&&zh(a),o}insertAfter(e,t=!0){Bm(),Og(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.getParent(),a=J(),o=!1,s=!1;if(i!==null){let t=e.getIndexWithinParent();if(Lh(r),q(a)){let e=i.__key,n=a.anchor,r=a.focus;o=n.type===`element`&&n.key===e&&n.offset===t+1,s=r.type===`element`&&r.key===e&&r.offset===t+1}}let c=this.getNextSibling(),l=this.getParentOrThrow().getWritable(),u=r.__key,d=n.__next;if(c===null?l.__last=u:c.getWritable().__prev=u,l.__size++,n.__next=u,r.__next=d,r.__prev=n.__key,r.__parent=n.__parent,t&&q(a)){let e=this.getIndexWithinParent();Cm(a,l,e+1);let t=l.__key;o&&a.anchor.set(t,e+2,`element`),s&&a.focus.set(t,e+2,`element`)}return e}insertBefore(e,t=!0){Bm(),Og(this,e);let n=this.getWritable(),r=e.getWritable(),i=r.__key;Lh(r);let a=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),s=n.__prev,c=this.getIndexWithinParent();a===null?o.__first=i:a.getWritable().__next=i,o.__size++,n.__prev=i,r.__prev=s,r.__next=n.__key,r.__parent=n.__parent;let l=J();return t&&q(l)&&Cm(l,this.getParentOrThrow(),c),e}isParentRequired(){return!1}createParentElementNode(){return gh()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(e,t){Bm();let n=this.getPreviousSibling(),r=this.getParentOrThrow();if(n===null)return r.select(0,0);if(Y(n))return n.select();if(!K(n)){let e=n.getIndexWithinParent()+1;return r.select(e,e)}return n.select(e,t)}selectNext(e,t){Bm();let n=this.getNextSibling(),r=this.getParentOrThrow();if(n===null)return r.select();if(Y(n))return n.select(0,0);if(!K(n)){let e=n.getIndexWithinParent();return r.select(e,e)}return n.select(e,t)}markDirty(){this.getWritable()}reconcileObservedMutation(e,t){this.markDirty()}},Dp=`history-merge`,Op=`skip-dom-selection`,kp=`composition-start`,Ap=`composition-end`,jp=class e extends Ep{static getType(){return`linebreak`}static clone(t){return new e(t.__key)}constructor(e){super(e)}getTextContent(){return`
|
|
7
|
+
`}createDOM(){return document.createElement(`br`)}updateDOM(){return!1}isInline(){return!0}static importDOM(){return{br:e=>function(e){let t=e.parentElement;if(t!==null&&Rg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Fp(n)){let n=t.lastChild;if(n===e||n.previousSibling===e&&Fp(n))return!0}}return!1}(e)||function(e){let t=e.parentElement;if(t!==null&&Rg(t)){let n=t.firstChild;if(n===e||n.nextSibling===e&&Fp(n))return!1;let r=t.lastChild;if(r===e||r.previousSibling===e&&Fp(r))return!0}return!1}(e)?null:{conversion:Mp,priority:0}}}static importJSON(e){return Np().updateFromJSON(e)}};function Mp(e){return{node:Np()}}function Np(){return Dg(new jp)}function Pp(e){return e instanceof jp}function Fp(e){return Ph(e)&&/^( |\t|\r?\n)+$/.test(e.textContent||``)}function Ip(e,t){return 16&t?`code`:t&128?`mark`:32&t?`sub`:64&t?`sup`:null}function Lp(e,t){return 1&t?`strong`:2&t?`em`:`span`}function Rp(e,t,n,r,i){let a=r.classList,o=fg(i,`base`);o!==void 0&&a.add(...o),o=fg(i,`underlineStrikethrough`);let s=!1,c=8&t&&4&t;o!==void 0&&(8&n&&4&n?(s=!0,c||a.add(...o)):c&&a.remove(...o));for(let e in Vu){let r=Vu[e];if(o=fg(i,e),o!==void 0)if(n&r){if(s&&(e===`underline`||e===`strikethrough`)){t&r&&a.remove(...o);continue}((t&r)===0||c&&e===`underline`||e===`strikethrough`)&&a.add(...o)}else t&r&&a.remove(...o)}}function zp(e,t,n){let r=t.firstChild,i=n.isComposing(),a=e+(i?Ru:``);if(r==null)t.textContent=a;else{let e=r.nodeValue;if(e!==a)if(i||xu){let[t,n,i]=function(e,t){let n=e.length,r=t.length,i=0,a=0;for(;i<n&&i<r&&e[i]===t[i];)i++;for(;a+i<n&&a+i<r&&e[n-a-1]===t[r-a-1];)a++;return[i,n-i-a,t.slice(i,r-a)]}(e,a);n!==0&&r.deleteData(t,n),r.insertData(t,i)}else r.nodeValue=a}}function Bp(e,t,n,r,i,a){zp(i,e,t);let o=a.theme.text;o!==void 0&&Rp(0,0,r,e,o)}function Vp(e,t){let n=document.createElement(t);return n.appendChild(e),n}var Hp=class e extends Ep{__text;__format;__style;__mode;__detail;static getType(){return`text`}static clone(t){return new e(t.__text,t.__key)}afterCloneFrom(e){super.afterCloneFrom(e),this.__text=e.__text,this.__format=e.__format,this.__style=e.__style,this.__mode=e.__mode,this.__detail=e.__detail}constructor(e=``,t){super(t),this.__text=e,this.__format=0,this.__style=``,this.__mode=0,this.__detail=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){return Ku[this.getLatest().__mode]}getStyle(){return this.getLatest().__style}isToken(){return this.getLatest().__mode===1}isComposing(){return this.__key===Bh()}isSegmented(){return this.getLatest().__mode===2}isDirectionless(){return!!(1&this.getLatest().__detail)}isUnmergeable(){return!!(2&this.getLatest().__detail)}hasFormat(e){let t=Vu[e];return(this.getFormat()&t)!==0}isSimpleText(){return this.__type===`text`&&this.__mode===0}getTextContent(){return this.getLatest().__text}getFormatFlags(e,t){return Ih(this.getLatest().__format,e,t)}canHaveFormat(){return!0}isInline(){return!0}createDOM(e,t){let n=this.__format,r=Ip(0,n),i=Lp(0,n),a=r===null?i:r,o=document.createElement(a),s=o;this.hasFormat(`code`)&&o.setAttribute(`spellcheck`,`false`),r!==null&&(s=document.createElement(i),o.appendChild(s)),Bp(s,this,0,n,this.__text,e);let c=this.__style;return c!==``&&(o.style.cssText=c),o}updateDOM(e,t,n){let r=this.__text,i=e.__format,a=this.__format,o=Ip(0,i),s=Ip(0,a),c=Lp(0,i),l=Lp(0,a);if((o===null?c:o)!==(s===null?l:s))return!0;if(o===s&&c!==l){let e=t.firstChild;e??G(48);let i=document.createElement(l);return Bp(i,this,0,a,r,n),t.replaceChild(i,e),!1}let u=t;s!==null&&o!==null&&(u=t.firstChild,u??G(49)),zp(r,u,this);let d=n.theme.text;d!==void 0&&i!==a&&Rp(0,i,a,u,d);let f=e.__style,p=this.__style;return f!==p&&(t.style.cssText=p),!1}static importDOM(){return{"#text":()=>({conversion:qp,priority:0}),b:()=>({conversion:Wp,priority:0}),code:()=>({conversion:Xp,priority:0}),em:()=>({conversion:Xp,priority:0}),i:()=>({conversion:Xp,priority:0}),mark:()=>({conversion:Xp,priority:0}),s:()=>({conversion:Xp,priority:0}),span:()=>({conversion:Up,priority:0}),strong:()=>({conversion:Xp,priority:0}),sub:()=>({conversion:Xp,priority:0}),sup:()=>({conversion:Xp,priority:0}),u:()=>({conversion:Xp,priority:0})}}static importJSON(e){return Zp().updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTextContent(e.text).setFormat(e.format).setDetail(e.detail).setMode(e.mode).setStyle(e.style)}exportDOM(e){let{element:t}=super.exportDOM(e);return Pg(t)||G(132),t.style.whiteSpace=`pre-wrap`,this.hasFormat(`lowercase`)?t.style.textTransform=`lowercase`:this.hasFormat(`uppercase`)?t.style.textTransform=`uppercase`:this.hasFormat(`capitalize`)&&(t.style.textTransform=`capitalize`),this.hasFormat(`bold`)&&(t=Vp(t,`b`)),this.hasFormat(`italic`)&&(t=Vp(t,`i`)),this.hasFormat(`strikethrough`)&&(t=Vp(t,`s`)),this.hasFormat(`underline`)&&(t=Vp(t,`u`)),{element:t}}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(e,t){}setFormat(e){let t=this.getWritable();return t.__format=typeof e==`string`?Vu[e]:e,t}setDetail(e){let t=this.getWritable();return t.__detail=typeof e==`string`?Hu[e]:e,t}setStyle(e){let t=this.getWritable();return t.__style=e,t}toggleFormat(e){let t=Ih(this.getFormat(),e,null);return this.setFormat(t)}toggleDirectionless(){let e=this.getWritable();return e.__detail^=1,e}toggleUnmergeable(){let e=this.getWritable();return e.__detail^=2,e}setMode(e){let t=Gu[e];if(this.__mode===t)return this;let n=this.getWritable();return n.__mode=t,n}setTextContent(e){if(this.__text===e)return this;let t=this.getWritable();return t.__text=e,t}select(e,t){Bm();let n=e,r=t,i=J(),a=this.getTextContent(),o=this.__key;if(typeof a==`string`){let e=a.length;n===void 0&&(n=e),r===void 0&&(r=e)}else n=0,r=0;if(!q(i))return vm(o,n,o,r,`text`,`text`);{let e=Bh();e!==i.anchor.key&&e!==i.focus.key||zh(o),i.setTextNodeRange(this,n,this,r)}return i}selectStart(){return this.select(0,0)}selectEnd(){let e=this.getTextContentSize();return this.select(e,e)}spliceText(e,t,n,r){let i=this.getWritable(),a=i.__text,o=n.length,s=e;s<0&&(s=o+s,s<0&&(s=0));let c=J();if(r&&q(c)){let t=e+o;c.setTextNodeRange(i,t,i,t)}return i.__text=a.slice(0,s)+n+a.slice(s+t),i}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...e){Bm();let t=this.getLatest(),n=t.getTextContent();if(n===``)return[];let r=t.__key,i=Bh(),a=n.length;e.sort((e,t)=>e-t),e.push(a);let o=[],s=e.length;for(let t=0,r=0;t<a&&r<=s;r++){let i=e[r];i>t&&(o.push(n.slice(t,i)),t=i)}let c=o.length;if(c===1)return[t];let l=o[0],u=t.getParent(),d,f=t.getFormat(),p=t.getStyle(),m=t.__detail,h=!1,g=null,_=null,v=J();if(q(v)){let[e,t]=v.isBackward()?[v.focus,v.anchor]:[v.anchor,v.focus];e.type===`text`&&e.key===r&&(g=e),t.type===`text`&&t.key===r&&(_=t)}t.isSegmented()?(d=Zp(l),d.__format=f,d.__style=p,d.__detail=m,d.__state=hd(t,d),h=!0):d=t.setTextContent(l);let y=[d];for(let e=1;e<c;e++){let n=Zp(o[e]);n.__format=f,n.__style=p,n.__detail=m,n.__state=hd(t,n);let a=n.__key;i===r&&zh(a),y.push(n)}let b=g?g.offset:null,x=_?_.offset:null,S=0;for(let e of y){if(!g&&!_)break;let t=S+e.getTextContentSize();if(g!==null&&b!==null&&b<=t&&b>=S&&(g.set(e.getKey(),b-S,`text`),b<t&&(g=null)),_!==null&&x!==null&&x<=t&&x>=S){_.set(e.getKey(),x-S,`text`);break}S=t}if(u!==null){(function(e){let t=e.getPreviousSibling(),n=e.getNextSibling();t!==null&&Rh(t),n!==null&&Rh(n)})(this);let e=u.getWritable(),t=this.getIndexWithinParent();h?(e.splice(t,0,y),this.remove()):e.splice(t,1,y),q(v)&&Cm(v,u,t,c-1)}return y}mergeWithSibling(e){let t=e===this.getPreviousSibling();t||e===this.getNextSibling()||G(50);let n=this.__key,r=e.__key,i=this.__text,a=i.length;Bh()===r&&zh(n);let o=J();if(q(o)){let i=o.anchor,s=o.focus;i!==null&&i.key===r&&Em(i,t,n,e,a),s!==null&&s.key===r&&Em(s,t,n,e,a)}let s=e.__text,c=t?s+i:i+s;this.setTextContent(c);let l=this.getWritable();return e.remove(),l}isTextEntity(){return!1}};function Up(e){return{forChild:Qp(e.style),node:null}}function Wp(e){let t=e,n=t.style.fontWeight===`normal`;return{forChild:Qp(t.style,n?void 0:`bold`),node:null}}var Gp=new WeakMap;function Kp(e){if(!Pg(e))return!1;if(e.nodeName===`PRE`)return!0;let t=e.style.whiteSpace;return typeof t==`string`&&t.startsWith(`pre`)}function qp(e){let t=e;e.parentElement===null&&G(129);let n=t.textContent||``;if(function(e){let t,n=e.parentNode,r=[e];for(;n!==null&&(t=Gp.get(n))===void 0&&!Kp(n);)r.push(n),n=n.parentNode;let i=t===void 0?n:t;for(let e=0;e<r.length;e++)Gp.set(r[e],i);return i}(t)!==null){let e=n.split(/(\r?\n|\t)/),t=[],r=e.length;for(let n=0;n<r;n++){let r=e[n];r===`
|
|
8
|
+
`||r===`\r
|
|
9
|
+
`?t.push(Np()):r===` `?t.push(em()):r!==``&&t.push(Zp(r))}return{node:t}}if(n=n.replace(/\r/g,``).replace(/[ \t\n]+/g,` `),n===``)return{node:null};if(n[0]===` `){let e=t,r=!0;for(;e!==null&&(e=Jp(e,!1))!==null;){let t=e.textContent||``;if(t.length>0){/[ \t\n]$/.test(t)&&(n=n.slice(1)),r=!1;break}}r&&(n=n.slice(1))}if(n[n.length-1]===` `){let e=t,r=!0;for(;e!==null&&(e=Jp(e,!0))!==null;)if((e.textContent||``).replace(/^( |\t|\r?\n)+/,``).length>0){r=!1;break}r&&(n=n.slice(0,n.length-1))}return n===``?{node:null}:{node:Zp(n)}}function Jp(e,t){let n=e;for(;;){let e;for(;(e=t?n.nextSibling:n.previousSibling)===null;){let e=n.parentElement;if(e===null)return null;n=e}if(n=e,Pg(n)){let e=n.style.display;if(e===``&&!Lg(n)||e!==``&&!e.startsWith(`inline`))return null}let r=n;for(;(r=t?n.firstChild:n.lastChild)!==null;)n=r;if(Ph(n))return n;if(n.nodeName===`BR`)return null}}var Yp={code:`code`,em:`italic`,i:`italic`,mark:`highlight`,s:`strikethrough`,strong:`bold`,sub:`subscript`,sup:`superscript`,u:`underline`};function Xp(e){let t=Yp[e.nodeName.toLowerCase()];return t===void 0?{node:null}:{forChild:Qp(e.style,t),node:null}}function Zp(e=``){return Dg(new Hp(e))}function K(e){return e instanceof Hp}function Qp(e,t){let n=e.fontWeight,r=e.textDecoration.split(` `),i=n===`700`||n===`bold`,a=r.includes(`line-through`),o=e.fontStyle===`italic`,s=r.includes(`underline`),c=e.verticalAlign;return e=>K(e)?(i&&!e.hasFormat(`bold`)&&e.toggleFormat(`bold`),a&&!e.hasFormat(`strikethrough`)&&e.toggleFormat(`strikethrough`),o&&!e.hasFormat(`italic`)&&e.toggleFormat(`italic`),s&&!e.hasFormat(`underline`)&&e.toggleFormat(`underline`),c!==`sub`||e.hasFormat(`subscript`)||e.toggleFormat(`subscript`),c!==`super`||e.hasFormat(`superscript`)||e.toggleFormat(`superscript`),t&&!e.hasFormat(t)&&e.toggleFormat(t),e):e}var $p=class e extends Hp{static getType(){return`tab`}static clone(t){return new e(t.__key)}constructor(e){super(` `,e),this.__detail=2}static importDOM(){return null}createDOM(e){let t=super.createDOM(e),n=fg(e.theme,`tab`);return n!==void 0&&t.classList.add(...n),t}static importJSON(e){return em().updateFromJSON(e)}setTextContent(e){return e!==` `&&e!==``&&_u(126),super.setTextContent(` `)}spliceText(e,t,n,r){return n===``&&t===0||n===` `&&t===1||G(286),this}setDetail(e){return e!==2&&G(127),this}setMode(e){return e!==`normal`&&G(128),this}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}};function em(){return Dg(new $p)}function tm(e){return e instanceof $p}var nm=class{key;offset;type;_selection;constructor(e,t,n){this._selection=null,this.key=e,this.offset=t,this.type=n}is(e){return this.key===e.key&&this.offset===e.offset&&this.type===e.type}isBefore(e){return this.key===e.key?this.offset<e.offset:T_(z_(A_(this,`next`)),z_(A_(e,`next`)))<0}getNode(){let e=Vh(this.key);return e===null&&G(20),e}set(e,t,n,r){let i=this._selection,a=this.key;r&&this.key===e&&this.offset===t&&this.type===n||(this.key=e,this.offset=t,this.type=n,zm()||(Bh()===a&&zh(e),i!==null&&(i.setCachedNodes(null),i.dirty=!0)))}};function rm(e,t,n){return new nm(e,t,n)}function im(e,t){let n=t.__key,r=e.offset,i=`element`;if(K(t)){i=`text`;let e=t.getTextContentSize();r>e&&(r=e)}else if(!Y(t)){let e=t.getNextSibling();if(K(e))n=e.__key,r=0,i=`text`;else{let e=t.getParent();e&&(n=e.__key,r=t.getIndexWithinParent()+1)}}e.set(n,r,i)}function am(e,t){if(Y(t)){let n=t.getLastDescendant();Y(n)||K(n)?im(e,n):im(e,t)}else im(e,t)}var om=class e{_nodes;_cachedNodes;dirty;constructor(e){this._cachedNodes=null,this._nodes=e,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){if(!cm(e))return!1;let t=this._nodes,n=e._nodes;return t.size===n.size&&Array.from(t).every(e=>n.has(e))}isCollapsed(){return!1}isBackward(){return!1}getStartEndPoints(){return null}add(e){this.dirty=!0,this._nodes.add(e),this._cachedNodes=null}delete(e){this.dirty=!0,this._nodes.delete(e),this._cachedNodes=null}clear(){this.dirty=!0,this._nodes.clear(),this._cachedNodes=null}has(e){return this._nodes.has(e)}clone(){return new e(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(e){}insertText(){}insertNodes(e){let t=this.getNodes(),n=t.length,r=t[n-1],i;if(K(r))i=r.select();else{let e=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(e,e)}i.insertNodes(e);for(let e=0;e<n;e++)t[e].remove()}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=this._nodes,n=[];for(let e of t){let t=Vh(e);t!==null&&n.push(t)}return zm()||(this._cachedNodes=n),n}getTextContent(){let e=this.getNodes(),t=``;for(let n=0;n<e.length;n++)t+=e[n].getTextContent();return t}deleteNodes(){let e=this.getNodes();if((J()||Sm())===this&&e[0]){let t=f_(e[0],`next`);M_(C_(t,t))}for(let t of e)t.remove()}};function q(e){return e instanceof sm}var sm=class e{format;style;anchor;focus;_cachedNodes;dirty;constructor(e,t,n,r){this.anchor=e,this.focus=t,e._selection=this,t._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=!1}getCachedNodes(){return this._cachedNodes}setCachedNodes(e){this._cachedNodes=e}is(e){return!!q(e)&&this.anchor.is(e.anchor)&&this.focus.is(e.focus)&&this.format===e.format&&this.style===e.style}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){let e=this._cachedNodes;if(e!==null)return e;let t=function(e){let t=[],[n,r]=e.getTextSlices();n&&t.push(n.caret.origin);let i=new Set,a=new Set;for(let n of e)if(c_(n)){let{origin:e}=n;t.length===0?i.add(e):(a.add(e),t.push(e))}else{let{origin:e}=n;Y(e)&&a.has(e)||t.push(e)}if(r&&t.push(r.caret.origin),s_(e.focus)&&Y(e.focus.origin)&&e.focus.getNodeAtCaret()===null)for(let n=g_(e.focus.origin,`previous`);c_(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(t[t.length-1]);n=v_(n))i.delete(n.origin),t.pop();for(;t.length>1;){let e=t[t.length-1];if(!Y(e)||a.has(e)||e.isEmpty()||i.has(e))break;t.pop()}if(t.length===0&&e.isCollapsed()){let n=z_(e.anchor),r=z_(e.anchor.getFlipped()),i=e=>o_(e)?e.origin:e.getNodeAtCaret(),a=i(n)||i(r)||(e.anchor.getNodeAtCaret()?n.origin:r.origin);t.push(a)}return t}(H_(P_(this),`next`));return zm()||(this._cachedNodes=t),t}setTextNodeRange(e,t,n,r){this.anchor.set(e.__key,t,`text`),this.focus.set(n.__key,r,`text`)}getTextContent(){let e=this.getNodes();if(e.length===0)return``;let t=e[0],n=e[e.length-1],r=this.anchor,i=this.focus,a=r.isBefore(i),[o,s]=um(this),c=``,l=!0;for(let u=0;u<e.length;u++){let d=e[u];if(Y(d)&&!d.isInline())l||(c+=`
|
|
10
|
+
`),l=!d.isEmpty();else if(l=!1,K(d)){let e=d.getTextContent();d===t?d===n?r.type===`element`&&i.type===`element`&&i.offset!==r.offset||(e=o<s?e.slice(o,s):e.slice(s,o)):e=a?e.slice(o):e.slice(s):d===n&&(e=a?e.slice(0,s):e.slice(0,o)),c+=e}else !ch(d)&&!Pp(d)||d===n&&this.isCollapsed()||(c+=d.getTextContent())}return c}applyDOMRange(e){let t=Um(),n=t.getEditorState()._selection,r=_m(e.startContainer,e.startOffset,e.endContainer,e.endOffset,t,n);if(r===null)return;let[i,a]=r;this.anchor.set(i.key,i.offset,i.type,!0),this.focus.set(a.key,a.offset,a.type,!0),yd(this)}clone(){let t=this.anchor,n=this.focus;return new e(rm(t.key,t.offset,t.type),rm(n.key,n.offset,n.type),this.format,this.style)}toggleFormat(e){this.format=Ih(this.format,e,null),this.dirty=!0}setFormat(e){this.format=e,this.dirty=!0}setStyle(e){this.style=e,this.dirty=!0}hasFormat(e){let t=Vu[e];return(this.format&t)!==0}insertRawText(e){let t=e.split(/(\r?\n|\t)/),n=[],r=t.length;for(let e=0;e<r;e++){let r=t[e];r===`
|
|
11
|
+
`||r===`\r
|
|
12
|
+
`?n.push(Np()):r===` `?n.push(em()):n.push(Zp(r))}this.insertNodes(n)}insertText(e){let t=this.anchor,n=this.focus,r=this.format,i=this.style,a=t,o=n;!this.isCollapsed()&&n.isBefore(t)&&(a=n,o=t),a.type===`element`&&function(e,t,n,r){let i=e.getNode(),a=i.getChildAtIndex(e.offset),o=Zp();if(o.setFormat(n),o.setStyle(r),_h(a))a.splice(0,0,[o]);else{let e=uh(i)?gh().append(o):o;a===null?i.append(e):a.insertBefore(e)}e.is(t)&&t.set(o.__key,0,`text`),e.set(o.__key,0,`text`)}(a,o,r,i),o.type===`element`&&j_(o,z_(A_(o,`next`)));let s=a.offset,c=o.offset,l=this.getNodes(),u=l.length,d=l[0];K(d)||G(26);let f=d.getTextContent().length,p=d.getParentOrThrow(),m=l[u-1];if(u===1&&o.type===`element`&&(c=f,o.set(a.key,c,`text`)),this.isCollapsed()&&s===f&&(Nh(d)||!d.canInsertTextAfter()||!p.canInsertTextAfter()&&d.getNextSibling()===null)){let t=d.getNextSibling();if(K(t)&&t.canInsertTextBefore()&&!Nh(t)||(t=Zp(),t.setFormat(r),t.setStyle(i),p.canInsertTextAfter()?d.insertAfter(t):p.insertAfter(t)),t.select(0,0),d=t,e!==``)return void this.insertText(e)}else if(this.isCollapsed()&&s===0&&(Nh(d)||!d.canInsertTextBefore()||!p.canInsertTextBefore()&&d.getPreviousSibling()===null)){let t=d.getPreviousSibling();if(K(t)&&!Nh(t)||(t=Zp(),t.setFormat(r),p.canInsertTextBefore()?d.insertBefore(t):p.insertBefore(t)),t.select(),d=t,e!==``)return void this.insertText(e)}else if(d.isSegmented()&&s!==f){let e=Zp(d.getTextContent());e.setFormat(r),d.replace(e),d=e}else if(!this.isCollapsed()&&e!==``){let t=m.getParent();if(!p.canInsertTextBefore()||!p.canInsertTextAfter()||Y(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(``),gm(this.anchor,this.focus),void this.insertText(e)}if(u===1){if(Mh(d)){let t=Zp(e);t.select(),d.replace(t);return}let t=d.getFormat(),n=d.getStyle();if(s!==c||t===r&&n===i){if(tm(d)){let t=Zp(e);t.setFormat(r),t.setStyle(i),t.select(),d.replace(t);return}}else{if(d.getTextContent()!==``){let t=Zp(e);if(t.setFormat(r),t.setStyle(i),t.select(),s===0)d.insertBefore(t,!1);else{let[e]=d.splitText(s);e.insertAfter(t,!1)}t.isComposing()&&this.anchor.type===`text`&&(this.anchor.offset-=e.length);return}d.setFormat(r),d.setStyle(i)}let a=c-s;d=d.spliceText(s,a,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=t,this.style=n,d.isComposing()&&(this.anchor.offset-=e.length))}else{let t=new Set([...d.getParentKeys(),...m.getParentKeys()]),n=Y(d)?d:d.getParentOrThrow(),r=Y(m)?m:m.getParentOrThrow(),i=m;if(!n.is(r)&&r.isInline())do i=r,r=r.getParentOrThrow();while(r.isInline());if(o.type===`text`&&(c!==0||m.getTextContent()===``)||o.type===`element`&&m.getIndexWithinParent()<c)if(K(m)&&!Mh(m)&&c!==m.getTextContentSize()){if(m.isSegmented()){let e=Zp(m.getTextContent());m.replace(e),m=e}uh(o.getNode())||o.type!==`text`||(m=m.spliceText(0,c,``)),t.add(m.__key)}else{let e=m.getParentOrThrow();e.canBeEmpty()||e.getChildrenSize()!==1?m.remove():e.remove()}else t.add(m.__key);let a=r.getChildren(),p=new Set(l),h=n.is(r),g=n.isInline()&&d.getNextSibling()===null?n:d;for(let e=a.length-1;e>=0;e--){let t=a[e];if(t.is(d)||Y(t)&&t.isParentOf(d))break;t.isAttached()&&(!p.has(t)||t.is(i)?h||g.insertAfter(t,!1):t.remove())}if(!h){let e=r,n=null;for(;e!==null;){let r=e.getChildren(),i=r.length;(i===0||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent()}}if(Mh(d))if(s===f)d.select();else{let t=Zp(e);t.select(),d.replace(t)}else d=d.spliceText(s,f-s,e,!0),d.getTextContent()===``?d.remove():this.anchor.type===`text`&&(this.format=d.getFormat(),this.style=d.getStyle(),d.isComposing()&&(this.anchor.offset-=e.length));for(let e=1;e<u;e++){let n=l[e],r=n.__key;t.has(r)||n.remove()}}}removeText(){let e=J()===this;N_(this,R_(P_(this))),e&&J()!==this&&Yh(this)}formatText(e,t=null){if(this.isCollapsed())return this.toggleFormat(e),void zh(null);let n=this.getNodes(),r=[];for(let e of n)K(e)&&r.push(e);let i=t=>{n.forEach(n=>{if(Y(n)){let r=n.getFormatFlags(e,t);n.setTextFormat(r)}})},a=r.length;if(a===0)return this.toggleFormat(e),zh(null),void i(t);let o=this.anchor,s=this.focus,c=this.isBackward(),l=c?s:o,u=c?o:s,d=0,f=r[0],p=l.type===`element`?0:l.offset;if(l.type===`text`&&p===f.getTextContentSize()&&(d=1,f=r[1],p=0),f==null)return;let m=f.getFormatFlags(e,t);i(m);let h=a-1,g=r[h],_=u.type===`text`?u.offset:g.getTextContentSize();if(f.is(g)){if(p===_)return;if(Nh(f)||p===0&&_===f.getTextContentSize())f.setFormat(m);else{let e=f.splitText(p,_),t=p===0?e[0]:e[1];t.setFormat(m),l.type===`text`&&l.set(t.__key,0,`text`),u.type===`text`&&u.set(t.__key,_-p,`text`)}this.format=m;return}p===0||Nh(f)||([,f]=f.splitText(p),p=0),f.setFormat(m);let v=g.getFormatFlags(e,m);_>0&&(_===g.getTextContentSize()||Nh(g)||([g]=g.splitText(_)),g.setFormat(v));for(let t=d+1;t<h;t++){let n=r[t],i=n.getFormatFlags(e,v);n.setFormat(i)}l.type===`text`&&l.set(f.__key,p,`text`),u.type===`text`&&u.set(g.__key,_,`text`),this.format=m|v}insertNodes(e){if(e.length===0)return;if(this.isCollapsed()||this.removeText(),this.anchor.key===`root`){this.insertParagraph();let t=J();return q(t)||G(134),t.insertNodes(e)}let t=(this.isBackward()?this.focus:this.anchor).getNode(),n=Zg(t,zg),r=e[e.length-1];if(Y(n)&&`__language`in n){if(`__language`in e[0])this.insertText(e[0].getTextContent());else{let t=Am(this);n.splice(t,0,e),r.selectEnd()}return}if(!e.some(e=>(Y(e)||ch(e))&&!e.isInline())){Y(n)||G(211,t.constructor.name,t.getType());let i=Am(this);n.splice(i,0,e),r.selectEnd();return}let i=function(e){let t=gh(),n=null;for(let r=0;r<e.length;r++){let i=e[r],a=Pp(i);if(a||ch(i)&&i.isInline()||Y(i)&&i.isInline()||K(i)||i.isParentRequired()){if(n===null&&(n=i.createParentElementNode(),t.append(n),a))continue;n!==null&&n.append(i)}else t.append(i),n=null}return t}(e),a=i.getLastDescendant(),o=i.getChildren(),s=!Y(n)||!n.isEmpty()?this.insertParagraph():null,c=o[o.length-1],l=o[0];var u;Y(u=l)&&zg(u)&&!u.isEmpty()&&Y(n)&&(!n.isEmpty()||n.canMergeWhenEmpty())&&(Y(n)||G(211,t.constructor.name,t.getType()),n.append(...l.getChildren()),l=o[1]),l&&(n===null&&G(212,t.constructor.name,t.getType()),function(e,t){let n=t.getParentOrThrow().getLastChild(),r=t,i=[t];for(;r!==n;)r.getNextSibling()||G(140),r=r.getNextSibling(),i.push(r);let a=e;for(let e of i)a=a.insertAfter(e)}(n,l));let d=Zg(a,zg);s&&Y(d)&&(s.canMergeWhenEmpty()||zg(c))&&(d.append(...s.getChildren()),s.remove()),Y(n)&&n.isEmpty()&&n.remove(),a.selectEnd();let f=Y(n)?n.getLastChild():null;Pp(f)&&d!==n&&f.remove()}insertParagraph(){if(this.anchor.key===`root`){let e=gh();return qh().splice(this.anchor.offset,0,[e]),e.select(),e}let e=Am(this),t=Zg(this.anchor.getNode(),zg);Y(t)||G(213);let n=t.getChildAtIndex(e),r=n?[n,...n.getNextSiblings()]:[],i=t.insertNewAfter(this,!1);return i?(i.append(...r),i.selectStart(),i):null}insertLineBreak(e){let t=Np();if(this.insertNodes([t]),e){let e=t.getParentOrThrow(),n=t.getIndexWithinParent();e.select(n,n)}}extract(){let e=[...this.getNodes()],t=e.length,n=e[0],r=e[t-1],[i,a]=um(this),o=this.isBackward(),[s,c]=o?[this.focus,this.anchor]:[this.anchor,this.focus],[l,u]=o?[a,i]:[i,a];if(t===0)return[];if(t===1){if(K(n)&&!this.isCollapsed()){let e=n.splitText(l,u),t=l===0?e[0]:e[1];return t?(s.set(t.getKey(),0,`text`),c.set(t.getKey(),t.getTextContentSize(),`text`),[t]):[]}return[n]}if(K(n)&&(l===n.getTextContentSize()?e.shift():l!==0&&([,n]=n.splitText(l),e[0]=n,s.set(n.getKey(),0,`text`))),K(r)){let t=r.getTextContent().length;u===0?e.pop():u!==t&&([r]=r.splitText(u),e[e.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),`text`))}return e}modify(e,t,n){if(Mm(this,e,t,n))return;let r=e===`move`,i=Um(),a=Mg(wg(i));if(!a)return;let o=i._blockCursorElement,s=i._rootElement,c=this.focus.getNode();if(s===null||o===null||!Y(c)||c.isInline()||c.canBeEmpty()||jg(o,i,s),this.dirty){let e=_g(i,this.anchor.key),t=_g(i,this.focus.key);this.anchor.type===`text`&&(e=Fh(e)),this.focus.type===`text`&&(t=Fh(t)),e&&t&&Dm(a,e,this.anchor.offset,t,this.focus.offset)}if(function(e,t,n,r){e.modify(t,n,r)}(a,e,t?`backward`:`forward`,n),a.rangeCount>0){let e=a.getRangeAt(0),n=this.anchor.getNode(),i=uh(n)?n:Tg(n);if(this.applyDOMRange(e),this.dirty=!0,!r){let n=this.getNodes(),r=[],o=!1;for(let e=0;e<n.length;e++){let t=n[e];Sg(t,i)?r.push(t):o=!0}if(o&&r.length>0)if(t){let e=r[0];Y(e)?e.selectStart():e.getParentOrThrow().selectStart()}else{let e=r[r.length-1];Y(e)?e.selectEnd():e.getParentOrThrow().selectEnd()}a.anchorNode===e.startContainer&&a.anchorOffset===e.startOffset||function(e){let t=e.focus,n=e.anchor,r=n.key,i=n.offset,a=n.type;n.set(t.key,t.offset,t.type,!0),t.set(r,i,a,!0)}(this)}}n===`lineboundary`&&Mm(this,e,t,n,`decorators`)}forwardDeletion(e,t,n){if(!n&&(e.type===`element`&&Y(t)&&e.offset===t.getChildrenSize()||e.type===`text`&&e.offset===t.getTextContentSize())){let e=t.getParent(),n=t.getNextSibling()||(e===null?null:e.getNextSibling());if(Y(n)&&n.isShadowRoot())return!0}return!1}deleteCharacter(e){let t=this.isCollapsed();if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;let r=x_(A_(t,e?`previous`:`next`));if(r.getTextSlices().every(e=>e===null||e.distance===0)){let e={type:`initial`};for(let t of r.iterNodeCarets(`shadowRoot`))if(c_(t)){if(!t.origin.isInline()){if(t.origin.isShadowRoot()){if(e.type===`merge-block`)break;if(Y(r.anchor.origin)&&r.anchor.origin.isEmpty()){let e=z_(t);N_(this,C_(e,e)),r.anchor.origin.remove()}return}e.type!==`merge-next-block`&&e.type!==`merge-block`||(e={block:e.block,caret:t,type:`merge-block`})}}else{if(e.type===`merge-block`)break;if(s_(t)){if(Y(t.origin)){if(t.origin.isInline()){if(!t.origin.isParentOf(r.anchor.origin))break}else e={block:t.origin,type:`merge-next-block`};continue}if(ch(t.origin)){if(!t.origin.isIsolated())if(e.type===`merge-next-block`&&(t.origin.isKeyboardSelectable()||!t.origin.isInline())&&Y(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();let e=bm();e.add(t.origin.getKey()),Yh(e)}else t.origin.remove();return}break}}if(e.type===`merge-block`){let{caret:t,block:n}=e;return N_(this,C_(!t.origin.isEmpty()&&n.isEmpty()?F_(f_(n,t.direction)):r.anchor,t)),this.removeText()}}let i=this.focus;if(this.modify(`extend`,e,`character`),this.isCollapsed()){if(e&&t.offset===0&&dm(this,t.getNode()))return}else{let r=i.type===`text`?i.getNode():null;if(n=t.type===`text`?t.getNode():null,r!==null&&r.isSegmented()){let t=i.offset,a=r.getTextContentSize();if(r.is(n)||e&&t!==a||!e&&t!==0)return void pm(r,e,t)}else if(n!==null&&n.isSegmented()){let i=t.offset,a=n.getTextContentSize();if(n.is(r)||e&&i!==0||!e&&i!==a)return void pm(n,e,i)}(function(e,t){let n=e.anchor,r=e.focus,i=n.getNode();if(i===r.getNode()&&n.type===`text`&&r.type===`text`){let e=n.offset,a=r.offset,o=e<a,s=o?e:a,c=o?a:e,l=c-1;s!==l&&(function(e){return!(Zh(e)||fm(e))})(i.getTextContent().slice(s,c))&&(t?r.set(r.key,l,r.type):n.set(n.key,l,n.type))}})(this,e)}}if(this.removeText(),e&&!t&&this.isCollapsed()&&this.anchor.type===`element`&&this.anchor.offset===0){let e=this.anchor.getNode();e.isEmpty()&&uh(e.getParent())&&e.getPreviousSibling()===null&&dm(this,e)}}deleteLine(e){this.isCollapsed()&&this.modify(`extend`,e,`lineboundary`),this.isCollapsed()?this.deleteCharacter(e):this.removeText()}deleteWord(e){if(this.isCollapsed()){let t=this.anchor,n=t.getNode();if(this.forwardDeletion(t,n,e))return;this.modify(`extend`,e,`word`)}this.isCollapsed()?this.deleteCharacter(e):this.removeText()}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return[this.anchor,this.focus]}};function cm(e){return e instanceof om}function lm(e){let t=e.offset;if(e.type===`text`)return t;let n=e.getNode();return t===n.getChildrenSize()?n.getTextContent().length:0}function um(e){let t=e.getStartEndPoints();if(t===null)return[0,0];let[n,r]=t;return n.type===`element`&&r.type===`element`&&n.key===r.key&&n.offset===r.offset?[0,0]:[lm(n),lm(r)]}function dm(e,t){for(let n=t;n;n=n.getParent()){if(Y(n)){if(n.collapseAtStart(e))return!0;if(Eg(n))break}if(n.getPreviousSibling())break}return!1}var fm=(()=>{try{let e=RegExp(`\\p{Emoji}`,`u`),t=e.test.bind(e);if(t(`❤️`)&&t(`#️⃣`)&&t(`👍`))return t}catch{}return()=>!1})();function pm(e,t,n){let r=e,i=r.getTextContent().split(/(?=\s)/g),a=i.length,o=0,s=0;for(let e=0;e<a;e++){let r=e===a-1;if(s=o,o+=i[e].length,t&&o===n||o>n||r){i.splice(e,1),r&&(s=void 0);break}}let c=i.join(``).trim();c===``?r.remove():(r.setTextContent(c),r.select(s,s))}function mm(e,t,n,r){let i,a=t;if(Pg(e)){let o=!1,s=e.childNodes,c=s.length,l=r._blockCursorElement;a===c&&(o=!0,a=c-1);let u=s[a],d=!1;if(u===l)u=s[a+1],d=!0;else if(l!==null){let n=l.parentNode;e===n&&t>Array.prototype.indexOf.call(n.children,l)&&a--}if(i=Xh(u),K(i))a=m_(i,o?`next`:`previous`);else{let s=Xh(e);if(s===null)return null;if(Y(s)){let c=r.getElementByKey(s.getKey());c===null&&G(214);let l=s.getDOMSlot(c);[s,a]=l.resolveChildIndex(s,c,e,t),Y(s)||G(215),o&&a>=s.getChildrenSize()&&(a=Math.max(0,s.getChildrenSize()-1));let u=s.getChildAtIndex(a);if(Y(u)&&function(e,t,n){let r=e.getParent();return n===null||r===null||!r.canBeEmpty()||r!==n.getNode()}(u,0,n)){let e=o?u.getLastDescendant():u.getFirstDescendant();e===null?s=u:(u=e,s=Y(u)?u:u.getParentOrThrow()),a=0}K(u)?(i=u,s=null,a=m_(u,o?`next`:`previous`)):u!==s&&o&&!d&&(Y(s)||G(216),a=Math.min(s.getChildrenSize(),a+1))}else{let n=s.getIndexWithinParent();a=t===0&&ch(s)&&Xh(e)===s?n:n+1,s=s.getParentOrThrow()}if(Y(s))return rm(s.__key,a,`element`)}}else i=Xh(e);return K(i)?rm(i.__key,m_(i,a,`clamp`),`text`):null}function hm(e,t,n){let r=e.offset,i=e.getNode();if(r===0){let r=i.getPreviousSibling(),a=i.getParent();if(t){if((n||!t)&&r===null&&Y(a)&&a.isInline()){let t=a.getPreviousSibling();K(t)&&e.set(t.__key,t.getTextContent().length,`text`)}}else Y(r)&&!n&&r.isInline()?e.set(r.__key,r.getChildrenSize(),`element`):K(r)&&e.set(r.__key,r.getTextContent().length,`text`)}else if(r===i.getTextContent().length){let r=i.getNextSibling(),a=i.getParent();if(t&&Y(r)&&r.isInline())e.set(r.__key,0,`element`);else if((n||t)&&r===null&&Y(a)&&a.isInline()&&!a.canInsertTextAfter()){let t=a.getNextSibling();K(t)&&e.set(t.__key,0,`text`)}}}function gm(e,t,n){if(e.type===`text`&&t.type===`text`){let n=e.isBefore(t),r=e.is(t);hm(e,n,r),hm(t,!n,r),r&&t.set(e.key,e.offset,e.type)}}function _m(e,t,n,r,i,a){if(e===null||n===null||!Oh(i,e,n))return null;let o=mm(e,t,q(a)?a.anchor:null,i);if(o===null)return null;let s=mm(n,r,q(a)?a.focus:null,i);if(s===null)return null;if(o.type===`element`&&s.type===`element`){let t=Xh(e),r=Xh(n);if(ch(t)&&ch(r))return null}return gm(o,s),[o,s]}function vm(e,t,n,r,i,a){let o=Hm(),s=new sm(rm(e,t,i),rm(n,r,a),0,``);return s.dirty=!0,o._selection=s,s}function ym(){return new sm(rm(`root`,0,`element`),rm(`root`,0,`element`),0,``)}function bm(){return new om(new Set)}function xm(e,t,n,r){let i=n._window;if(i===null)return null;let a=r||i.event,o=a?a.type:void 0,s=o===`selectionchange`,c=!Yu&&(s||o===`beforeinput`||o===`compositionstart`||o===`compositionend`||o===`click`&&a&&a.detail===3||o===`drop`||o===void 0),l,u,d,f;if(q(e)&&!c)return e.clone();if(t===null)return null;if(l=t.anchorNode,u=t.focusNode,d=t.anchorOffset,f=t.focusOffset,(s||o===void 0)&&q(e)&&!Oh(n,l,u))return e.clone();let p=_m(l,d,u,f,n,e);if(p===null)return null;let[m,h]=p,g=0,_=``;if(q(e)){let t=e.anchor;if(m.key===t.key)g=e.format,_=e.style;else{let e=m.getNode();K(e)?(g=e.getFormat(),_=e.getStyle()):Y(e)&&(g=e.getTextFormat(),_=e.getTextStyle())}}return new sm(m,h,g,_)}function J(){return Hm()._selection}function Sm(){return Um()._editorState._selection}function Cm(e,t,n,r=1){let i=e.anchor,a=e.focus,o=i.getNode(),s=a.getNode();if(!t.is(o)&&!t.is(s))return;let c=t.__key;if(e.isCollapsed()){let t=i.offset;if(n<=t&&r>0||n<t&&r<0){let n=Math.max(0,t+r);i.set(c,n,`element`),a.set(c,n,`element`),wm(e)}}else{let o=e.isBackward(),s=o?a:i,l=s.getNode(),u=o?i:a,d=u.getNode();if(t.is(l)){let e=s.offset;(n<=e&&r>0||n<e&&r<0)&&s.set(c,Math.max(0,e+r),`element`)}if(t.is(d)){let e=u.offset;(n<=e&&r>0||n<e&&r<0)&&u.set(c,Math.max(0,e+r),`element`)}}wm(e)}function wm(e){let t=e.anchor,n=t.offset,r=e.focus,i=r.offset,a=t.getNode(),o=r.getNode();if(e.isCollapsed()){if(!Y(a))return;let e=a.getChildrenSize(),i=n>=e,o=i?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(K(o)){let e=0;i&&(e=o.getTextContentSize()),t.set(o.__key,e,`text`),r.set(o.__key,e,`text`)}return}if(Y(a)){let e=a.getChildrenSize(),r=n>=e,i=r?a.getChildAtIndex(e-1):a.getChildAtIndex(n);if(K(i)){let e=0;r&&(e=i.getTextContentSize()),t.set(i.__key,e,`text`)}}if(Y(o)){let e=o.getChildrenSize(),t=i>=e,n=t?o.getChildAtIndex(e-1):o.getChildAtIndex(i);if(K(n)){let e=0;t&&(e=n.getTextContentSize()),r.set(n.__key,e,`text`)}}}function Tm(e,t,n,r,i){let a=null,o=0,s=null;r===null?i!==null&&(a=i.__key,K(i)?s=`text`:Y(i)&&(s=`element`)):(a=r.__key,K(r)?(o=r.getTextContentSize(),s=`text`):Y(r)&&(o=r.getChildrenSize(),s=`element`)),a!==null&&s!==null?e.set(a,o,s):(o=t.getIndexWithinParent(),o===-1&&(o=n.getChildrenSize()),e.set(n.__key,o,`element`))}function Em(e,t,n,r,i){e.type===`text`?e.set(n,e.offset+(t?0:i),`text`):e.offset>r.getIndexWithinParent()&&e.set(e.key,e.offset-1,`element`)}function Dm(e,t,n,r,i){try{e.setBaseAndExtent(t,n,r,i)}catch{}}function Om(e,t,n){let r=_g(e,t.getKey());if(Y(t)){let e=t.getDOMSlot(r);return[e.element,n+e.getFirstChildOffset()]}return[r,n]}function km(e,t,n,r,i,a,o){let s=r.anchorNode,c=r.focusNode,l=r.anchorOffset,u=r.focusOffset,d=document.activeElement;if(i.has(`collaboration`)&&d!==a||d!==null&&Dh(d))return;if(!q(t))return void(e!==null&&Oh(n,s,c)&&r.removeAllRanges());let f=t.anchor,p=t.focus,m=f.getNode(),h=p.getNode(),[g,_]=Om(n,m,f.offset),[v,y]=Om(n,h,p.offset),b=t.format,x=t.style,S=t.isCollapsed(),C=g,w=v,T=!1;var E,D,O,k,A;if((f.type===`text`?(C=Fh(g),T=m.getFormat()!==b||m.getStyle()!==x):q(e)&&e.anchor.type===`text`&&(T=!0),p.type===`text`&&(w=Fh(v)),C!==null&&w!==null)&&(S&&(e===null||T||q(e)&&(e.format!==b||e.style!==x))&&(E=b,D=x,O=_,k=f.key,A=performance.now(),ip=[E,D,O,k,A]),l!==_||u!==y||s!==C||c!==w||r.type===`Range`&&S||(d!==null&&a.contains(d)||i.has(`skip-selection-focus`)||a.focus({preventScroll:!0}),f.type===`element`))){if(Dm(r,C,_,w,y),!xu||!t.isCollapsed()||a===null||i.has(`skip-selection-focus`)||document.activeElement!==null&&a.contains(document.activeElement)||a.focus({preventScroll:!0}),!i.has(`skip-scroll-into-view`)&&t.isCollapsed()&&a!==null&&a===document.activeElement){let e=q(t)&&t.anchor.type===`element`?C.childNodes[_]||null:r.rangeCount>0?r.getRangeAt(0):null;if(e!==null){let t;if(e instanceof Text){let n=document.createRange();n.selectNode(e),t=n.getBoundingClientRect()}else t=e.getBoundingClientRect();(function(e,t,n){let r=yg(n),i=Cg(r);if(r===null||i===null)return;let{top:a,bottom:o}=t,s=0,c=0,l=n;for(;l!==null;){let t=l===r.body;if(t){s=0,c=wg(e).innerHeight;let t=i.getComputedStyle(r.documentElement),n=parseFloat(t.scrollPaddingTop),a=parseFloat(t.scrollPaddingBottom);isFinite(n)&&(s+=n),isFinite(a)&&(c-=a)}else{let e=l.getBoundingClientRect();s=e.top,c=e.bottom}let n=0;if(a<s?n=-(s-a):o>c&&(n=o-c),n!==0)if(t)i.scrollBy(0,n);else{let e=l.scrollTop;l.scrollTop+=n;let t=l.scrollTop-e;a-=t,o-=t}if(t)break;l=vg(l)}})(n,t,a)}}Zf=!0}}function Am(e){let t=e;e.isCollapsed()||t.removeText();let n=J();q(n)&&(t=n),q(t)||G(161);let r=t.anchor,i=r.getNode(),a=r.offset;for(;!zg(i);){let e=i;if([i,a]=jm(i,a),e.is(i))break}return a}function jm(e,t){let n=e.getParent();if(!n){let e=gh();return qh().append(e),e.select(),[qh(),0]}if(K(e)){let r=e.splitText(t);if(r.length===0)return[n,e.getIndexWithinParent()];let i=t===0?0:1;return[n,r[0].getIndexWithinParent()+i]}if(!Y(e)||t===0)return[n,e.getIndexWithinParent()];let r=e.getChildAtIndex(t);if(r){let n=new sm(rm(e.__key,t,`element`),rm(e.__key,t,`element`),0,``),i=e.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings())}return[n,e.getIndexWithinParent()+1]}function Mm(e,t,n,r,i=`decorators-and-blocks`){if(t===`move`&&r===`character`&&!e.isCollapsed()){let[t,r]=n===e.isBackward()?[e.focus,e.anchor]:[e.anchor,e.focus];return r.set(t.key,t.offset,t.type),!0}let a=A_(e.focus,n?`previous`:`next`),o=r===`lineboundary`,s=t===`move`,c=a,l=i===`decorators-and-blocks`;if(!B_(c)){for(let e of c){l=!1;let{origin:t}=e;if(!ch(t)||t.isIsolated()||(c=e,!o||!t.isInline()))break}if(l)for(let e of x_(a).iterNodeCarets(t===`extend`?`shadowRoot`:`root`)){if(c_(e))e.origin.isInline()||(c=e);else{if(Y(e.origin))continue;ch(e.origin)&&!e.origin.isInline()&&(c=e)}break}}if(c===a)return!1;if(s&&!o&&ch(c.origin)&&c.origin.isKeyboardSelectable()){let e=bm();return e.add(c.origin.getKey()),Yh(e),!0}return c=z_(c),s&&j_(e.anchor,c),j_(e.focus,c),l||!o}var Nm=null,Pm=null,Fm=!1,Im=!1,Lm=0,Rm={characterData:!0,childList:!0,subtree:!0};function zm(){return Fm||Nm!==null&&Nm._readOnly}function Bm(){Fm&&G(13)}function Vm(){Lm>99&&G(14)}function Hm(){return Nm===null&&G(195,Wm()),Nm}function Um(){return Pm===null&&G(196,Wm()),Pm}function Wm(){let e=0,t=new Set,n=xh.version;if(typeof window<`u`)for(let r of document.querySelectorAll(`[contenteditable]`)){let i=jh(r);if(kh(i))e++;else if(i){let e=String(i.constructor.version||`<0.17.1`);e===n&&(e+=` (separately built, likely a bundler configuration issue)`),t.add(e)}}let r=` Detected on the page: ${e} compatible editor(s) with version ${n}`;return t.size&&(r+=` and incompatible editors with versions ${Array.from(t).join(`, `)}`),r}function Gm(){return Pm}function Km(e,t,n){let r=t.__type,i=wh(e,r),a=n.get(r);a===void 0&&(a=Array.from(i.transforms),n.set(r,a));let o=a.length;for(let e=0;e<o&&(a[e](t),t.isAttached());e++);}function qm(e,t){return e!==void 0&&e.__key!==t&&e.isAttached()}function Jm(e,t){if(!t)return;let n=e._updateTags,r=t;Array.isArray(t)||(r=[t]);for(let e of r)n.add(e)}function Ym(e,t){let n=e.type,r=t.get(n);r===void 0&&G(17,n);let i=r.klass;e.type!==i.getType()&&G(18,i.name);let a=i.importJSON(e),o=e.children;if(Y(a)&&Array.isArray(o))for(let e=0;e<o.length;e++){let n=Ym(o[e],t);a.append(n)}return a}function Xm(e,t,n){let r=Nm,i=Fm,a=Pm;Nm=t,Fm=!0,Pm=e;try{return n()}finally{Nm=r,Fm=i,Pm=a}}function Zm(e,t){let n=e._pendingEditorState,r=e._rootElement,i=e._headless||r===null;if(n===null)return;let a=e._editorState,o=a._selection,s=n._selection,c=e._dirtyType!==0,l=Nm,u=Fm,d=Pm,f=e._updating,p=e._observer,m=null;if(e._pendingEditorState=null,e._editorState=n,!i&&c&&p!==null){Pm=e,Nm=n,Fm=!1,e._updating=!0;try{let t=e._dirtyType,r=e._dirtyElements,i=e._dirtyLeaves;p.disconnect(),m=$d(a,n,e,t,r,i)}catch(t){if(t instanceof Error&&e._onError(t),Im)throw t;vh(e,null,r,n),id(e),e._dirtyType=2,Im=!0,Zm(e,a),Im=!1;return}finally{p.observe(r,Rm),e._updating=f,Nm=l,Fm=u,Pm=d}}n._readOnly||=!0;let h=e._dirtyLeaves,g=e._dirtyElements,_=e._normalizedNodes,v=e._updateTags,y=e._deferred;c&&(e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements=new Map,e._normalizedNodes=new Set,e._updateTags=new Set),function(e,t){let n=e._decorators,r=e._pendingDecorators||n,i=t._nodeMap,a;for(a in r)i.has(a)||(r===n&&(r=Gh(e)),delete r[a])}(e,n);let b=i?null:Mg(wg(e));if(e._editable&&b!==null&&(c||s===null||s.dirty||!s.is(o))&&r!==null&&!v.has(`skip-dom-selection`)){Pm=e,Nm=n;try{if(p!==null&&p.disconnect(),c||s===null||s.dirty){let t=e._blockCursorElement;t!==null&&jg(t,e,r),km(o,s,e,b,v,r)}(function(e,t,n){let r=e._blockCursorElement;if(q(n)&&n.isCollapsed()&&n.anchor.type===`element`&&t.contains(document.activeElement)){let i=n.anchor,a=i.getNode(),o=i.offset,s=!1,c=null;if(o===a.getChildrenSize())Ag(a.getChildAtIndex(o-1))&&(s=!0);else{let t=a.getChildAtIndex(o);if(t!==null&&Ag(t)){let n=t.getPreviousSibling();(n===null||Ag(n))&&(s=!0,c=e.getElementByKey(t.__key))}}if(s){let n=e.getElementByKey(a.__key);r===null&&(e._blockCursorElement=r=function(e){let t=e.theme,n=document.createElement(`div`);n.contentEditable=`false`,n.setAttribute(`data-lexical-cursor`,`true`);let r=t.blockCursor;return r!==void 0&&(typeof r==`string`&&(r=t.blockCursor=q_(r)),r!==void 0&&n.classList.add(...r)),n}(e._config)),t.style.caretColor=`transparent`,c===null?n.appendChild(r):n.insertBefore(r,c);return}}r!==null&&jg(r,e,t)})(e,r,s)}finally{p!==null&&p.observe(r,Rm),Pm=d,Nm=l}}m!==null&&function(e,t,n,r,i){let a=Array.from(e._listeners.mutation),o=a.length;for(let e=0;e<o;e++){let[o,s]=a[e];for(let e of s){let a=t.get(e);a!==void 0&&o(a,{dirtyLeaves:r,prevEditorState:i,updateTags:n})}}}(e,m,v,h,a),q(s)||s===null||o!==null&&o.is(s)||e.dispatchCommand(nf,void 0);let x=e._pendingDecorators;x!==null&&(e._decorators=x,e._pendingDecorators=null,Qm(`decorator`,e,!0,x)),function(e,t,n){let r=Kh(t),i=Kh(n);r!==i&&Qm(`textcontent`,e,!0,i)}(e,t||a,n),Qm(`update`,e,!0,{dirtyElements:g,dirtyLeaves:h,editorState:n,mutatedNodes:m,normalizedNodes:_,prevEditorState:t||a,tags:v}),function(e,t){if(e._deferred=[],t.length!==0){let n=e._updating;e._updating=!0;try{for(let e=0;e<t.length;e++)t[e]()}finally{e._updating=n}}}(e,y),function(e){let t=e._updates;if(t.length!==0){let n=t.shift();if(n){let[t,r]=n;th(e,t,r)}}}(e)}function Qm(e,t,n,...r){let i=t._updating;t._updating=n;try{let n=t._listeners[e],i=Array.from(n);for(let[e,t]of i){t&&t();let i=e(...r);n.has(e)?n.set(e,i):i&&i()}}finally{t._updating=i}}function $m(e,t,n,r){let i=Qh(e),a;for(let e=4;e>=0;e--)for(let o=0;o<i.length;o++){let s=i[o];if(o>0&&s._updating){a=s;break}let c=s._commands.get(t);if(c!==void 0){let t=c[e];if(t!==void 0){let e=Array.from(t),i=e.length,a=!1;if(nh(s,()=>{for(let t=0;t<i;t++)if(e[t](n,r))return void(a=!0)}),a)return a}}}return a&&a.update(()=>{$m(a,t,n,r)}),!1}function eh(e,t){let n=e._updates,r=t||!1;for(;n.length!==0;){let t=n.shift();if(t){let[n,i]=t,a=e._pendingEditorState,o;i!==void 0&&(o=i.onUpdate,i.skipTransforms&&(r=!0),i.discrete&&(a===null&&G(191),a._flushSync=!0),o&&e._deferred.push(o),Jm(e,i.tag)),a==null?th(e,n,i):n()}}return r}function th(e,t,n){let r=e._updateTags,i,a=!1,o=!1;n!==void 0&&(i=n.onUpdate,Jm(e,n.tag),a=n.skipTransforms||!1,o=n.discrete||!1),i&&e._deferred.push(i);let s=e._editorState,c=e._pendingEditorState,l=!1;(c===null||c._readOnly)&&(c=e._pendingEditorState=dh(c||s),l=!0),c._flushSync=o;let u=Nm,d=Fm,f=Pm,p=e._updating;Nm=c,Fm=!1,e._updating=!0,Pm=e;let m=e._headless||e.getRootElement()===null;Ch(null);try{l&&(m?s._selection!==null&&(c._selection=s._selection.clone()):c._selection=function(e,t){let n=e.getEditorState()._selection,r=Mg(wg(e));return q(n)||n==null?xm(n,r,e,t):n.clone()}(e,n&&n.event||null));let r=e._compositionKey;t(),a=eh(e,a),function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(q(r)){let e=r.anchor,t=r.focus,i;if(e.type===`text`&&(i=e.getNode(),i.selectionTransform(n,r)),t.type===`text`){let e=t.getNode();i!==e&&e.selectionTransform(n,r)}}}(c,e),e._dirtyType!==0&&(a?function(e,t){let n=t._dirtyLeaves,r=e._nodeMap;for(let e of n){let t=r.get(e);K(t)&&t.isAttached()&&t.isSimpleText()&&!t.isUnmergeable()&&vd(t)}}(c,e):function(e,t){let n=t._dirtyLeaves,r=t._dirtyElements,i=e._nodeMap,a=Bh(),o=new Map,s=n,c=s.size,l=r,u=l.size;for(;c>0||u>0;){if(c>0){t._dirtyLeaves=new Set;for(let e of s){let r=i.get(e);K(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&vd(r),r!==void 0&&qm(r,a)&&Km(t,r,o),n.add(e)}if(s=t._dirtyLeaves,c=s.size,c>0){Lm++;continue}}t._dirtyLeaves=new Set,t._dirtyElements=new Map,l.delete(`root`)&&l.set(`root`,!0);for(let e of l){let n=e[0],s=e[1];if(r.set(n,s),!s)continue;let c=i.get(n);c!==void 0&&qm(c,a)&&Km(t,c,o)}s=t._dirtyLeaves,c=s.size,l=t._dirtyElements,u=l.size,Lm++}t._dirtyLeaves=n,t._dirtyElements=r}(c,e),eh(e),function(e,t,n,r){let i=e._nodeMap,a=t._nodeMap,o=[];for(let[e]of r){let t=a.get(e);t!==void 0&&(t.isAttached()||(Y(t)&&Ju(t,e,i,a,o,r),i.has(e)||r.delete(e),o.push(e)))}for(let e of o)a.delete(e);for(let e of n){let t=a.get(e);t===void 0||t.isAttached()||(i.has(e)||n.delete(e),a.delete(e))}}(s,c,e._dirtyLeaves,e._dirtyElements)),r!==e._compositionKey&&(c._flushSync=!0);let i=c._selection;if(q(i)){let e=c._nodeMap,t=i.anchor.key,n=i.focus.key;e.get(t)!==void 0&&e.get(n)!==void 0||G(19)}else cm(i)&&i._nodes.size===0&&(c._selection=null)}catch(t){t instanceof Error&&e._onError(t),e._pendingEditorState=s,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),Zm(e);return}finally{Nm=u,Fm=d,Pm=f,e._updating=p,Lm=0}e._dirtyType!==0||e._deferred.length>0||function(e,t){let n=t.getEditorState()._selection,r=e._selection;if(r!==null){if(r.dirty||!r.is(n))return!0}else if(n!==null)return!0;return!1}(c,e)?c._flushSync?(c._flushSync=!1,Zm(e)):l&&Kee(()=>{Zm(e)}):(c._flushSync=!1,l&&(r.clear(),e._deferred=[],e._pendingEditorState=null))}function nh(e,t,n){Pm===e&&n===void 0?t():th(e,t,n)}var rh=class e{element;before;after;constructor(e,t,n){this.element=e,this.before=t||null,this.after=n||null}withBefore(t){return new e(this.element,t,this.after)}withAfter(t){return new e(this.element,this.before,t)}withElement(t){return this.element===t?this:new e(t,this.before,this.after)}insertChild(e){let t=this.before||this.getManagedLineBreak();return t!==null&&t.parentElement!==this.element&&G(222),this.element.insertBefore(e,t),this}removeChild(e){return e.parentElement!==this.element&&G(223),this.element.removeChild(e),this}replaceChild(e,t){return t.parentElement!==this.element&&G(224),this.element.replaceChild(e,t),this}getFirstChild(){let e=this.after?this.after.nextSibling:this.element.firstChild;return e===this.before||e===this.getManagedLineBreak()?null:e}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(e){if(e===null)this.removeManagedLineBreak();else{let t=e===`decorator`&&(Ou||Cu||Tu);this.insertManagedLineBreak(t)}}removeManagedLineBreak(){let e=this.getManagedLineBreak();if(e){let t=this.element,n=e.nodeName===`IMG`?e.nextSibling:null;n&&t.removeChild(n),t.removeChild(e),t.__lexicalLineBreak=void 0}}insertManagedLineBreak(e){let t=this.getManagedLineBreak();if(t){if(e===(t.nodeName===`IMG`))return;this.removeManagedLineBreak()}let n=this.element,r=this.before,i=document.createElement(`br`);if(n.insertBefore(i,r),e){let e=document.createElement(`img`);e.setAttribute(`data-lexical-linebreak`,`true`),e.style.cssText=`display: inline !important; border: 0px !important; margin: 0px !important;`,e.alt=``,n.insertBefore(e,i),n.__lexicalLineBreak=e}else n.__lexicalLineBreak=i}getFirstChildOffset(){let e=0;for(let t=this.after;t!==null;t=t.previousSibling)e++;return e}resolveChildIndex(e,t,n,r){if(n===this.element){let t=this.getFirstChildOffset();return[e,Math.min(t+e.getChildrenSize(),Math.max(t,r))]}let i=ih(t,n);i.push(r);let a=ih(t,this.element),o=e.getIndexWithinParent();for(let e=0;e<a.length;e++){let t=i[e],n=a[e];if(t===void 0||t<n)break;if(t>n){o+=1;break}}return[e.getParentOrThrow(),o]}};function ih(e,t){let n=[],r=t;for(;r!==e&&r!==null;r=r.parentNode){let e=0;for(let t=r.previousSibling;t!==null;t=t.previousSibling)e++;n.push(e)}return r!==e&&G(225),n.reverse()}var ah=class extends Ep{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(e){super(e),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style=``,this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle=``}afterCloneFrom(e){super.afterCloneFrom(e),this.__key===e.__key&&(this.__first=e.__first,this.__last=e.__last,this.__size=e.__size),this.__indent=e.__indent,this.__format=e.__format,this.__style=e.__style,this.__dir=e.__dir,this.__textFormat=e.__textFormat,this.__textStyle=e.__textStyle}getFormat(){return this.getLatest().__format}getFormatType(){return Wu[this.getFormat()]||``}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t),t=t.getNextSibling();return e}getChildrenKeys(){let e=[],t=this.getFirstChild();for(;t!==null;)e.push(t.__key),t=t.getNextSibling();return e}getChildrenSize(){return this.getLatest().__size}isEmpty(){return this.getChildrenSize()===0}isDirty(){let e=Um()._dirtyElements;return e!==null&&e.has(this.__key)}isLastChild(){let e=this.getLatest(),t=this.getParentOrThrow().getLastChild();return t!==null&&t.is(e)}getAllTextNodes(){let e=[],t=this.getFirstChild();for(;t!==null;){if(K(t)&&e.push(t),Y(t)){let n=t.getAllTextNodes();e.push(...n)}t=t.getNextSibling()}return e}getFirstDescendant(){let e=this.getFirstChild();for(;Y(e);){let t=e.getFirstChild();if(t===null)break;e=t}return e}getLastDescendant(){let e=this.getLastChild();for(;Y(e);){let t=e.getLastChild();if(t===null)break;e=t}return e}getDescendantByIndex(e){let t=this.getChildren(),n=t.length;if(e>=n){let e=t[n-1];return Y(e)&&e.getLastDescendant()||e||null}let r=t[e];return Y(r)&&r.getFirstDescendant()||r||null}getFirstChild(){let e=this.getLatest().__first;return e===null?null:Vh(e)}getFirstChildOrThrow(){let e=this.getFirstChild();return e===null&&G(45,this.__key),e}getLastChild(){let e=this.getLatest().__last;return e===null?null:Vh(e)}getLastChildOrThrow(){let e=this.getLastChild();return e===null&&G(96,this.__key),e}getChildAtIndex(e){let t=this.getChildrenSize(),n,r;if(e<t/2){for(n=this.getFirstChild(),r=0;n!==null&&r<=e;){if(r===e)return n;n=n.getNextSibling(),r++}return null}for(n=this.getLastChild(),r=t-1;n!==null&&r>=e;){if(r===e)return n;n=n.getPreviousSibling(),r--}return null}getTextContent(){let e=``,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContent(),Y(i)&&r!==n-1&&!i.isInline()&&(e+=zu)}return e}getTextContentSize(){let e=0,t=this.getChildren(),n=t.length;for(let r=0;r<n;r++){let i=t[r];e+=i.getTextContentSize(),Y(i)&&r!==n-1&&!i.isInline()&&(e+=2)}return e}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(e){if(e!==``){let t=Uu[e];return(this.getFormat()&t)!==0}return!1}hasTextFormat(e){let t=Vu[e];return(this.getTextFormat()&t)!==0}getFormatFlags(e,t){return Ih(this.getLatest().__textFormat,e,t)}getTextStyle(){return this.getLatest().__textStyle}select(e,t){Bm();let n=J(),r=e,i=t,a=this.getChildrenSize();if(!this.canBeEmpty()){if(e===0&&t===0){let e=this.getFirstChild();if(K(e)||Y(e))return e.select(0,0)}else if(!(e!==void 0&&e!==a||t!==void 0&&t!==a)){let e=this.getLastChild();if(K(e)||Y(e))return e.select()}}r===void 0&&(r=a),i===void 0&&(i=a);let o=this.__key;return q(n)?(n.anchor.set(o,r,`element`),n.focus.set(o,i,`element`),n.dirty=!0,n):vm(o,r,o,i,`element`,`element`)}selectStart(){let e=this.getFirstDescendant();return e?e.selectStart():this.select()}selectEnd(){let e=this.getLastDescendant();return e?e.selectEnd():this.select()}clear(){let e=this.getWritable();return this.getChildren().forEach(e=>e.remove()),e}append(...e){return this.splice(this.getChildrenSize(),0,e)}setDirection(e){let t=this.getWritable();return t.__dir=e,t}setFormat(e){return this.getWritable().__format=e===``?0:Uu[e],this}setStyle(e){return this.getWritable().__style=e||``,this}setTextFormat(e){let t=this.getWritable();return t.__textFormat=e,t}setTextStyle(e){let t=this.getWritable();return t.__textStyle=e,t}setIndent(e){return this.getWritable().__indent=e,this}splice(e,t,n){Tp(this)&&G(324,this.__key,this.__type);let r=this.getChildrenSize(),i=this.getWritable();e+t<=r||G(226,String(e),String(t),String(r));let a=i.__key,o=[],s=[],c=this.getChildAtIndex(e+t),l=null,u=r-t+n.length;if(e!==0)if(e===r)l=this.getLastChild();else{let t=this.getChildAtIndex(e);t!==null&&(l=t.getPreviousSibling())}if(t>0){let e=l===null?this.getFirstChild():l.getNextSibling();for(let n=0;n<t;n++){e===null&&G(100);let t=e.getNextSibling(),n=e.__key;Lh(e.getWritable()),s.push(n),e=t}}let d=l;for(let e of n){d!==null&&e.is(d)&&(l=d=d.getPreviousSibling());let t=e.getWritable();t.__parent===a&&u--,Lh(t);let n=e.__key;if(d===null)i.__first=n,t.__prev=null;else{let e=d.getWritable();e.__next=n,t.__prev=e.__key}e.__key===a&&G(76),t.__parent=a,o.push(n),d=e}if(e+t===r)d!==null&&(d.getWritable().__next=null,i.__last=d.__key);else if(c!==null){let e=c.getWritable();if(d!==null){let t=d.getWritable();e.__prev=d.__key,t.__next=c.__key}else e.__prev=null}if(i.__size=u,s.length){let e=J();if(q(e)){let t=new Set(s),n=new Set(o),{anchor:r,focus:i}=e;oh(r,t,n)&&Tm(r,r.getNode(),this,l,c),oh(i,t,n)&&Tm(i,i.getNode(),this,l,c),u!==0||this.canBeEmpty()||Eg(this)||this.remove()}}return i}getDOMSlot(e){return new rh(e)}exportDOM(e){let{element:t}=super.exportDOM(e);if(Pg(t)){let e=this.getIndent();e>0&&(t.style.paddingInlineStart=40*e+`px`);let n=this.getDirection();n&&(t.dir=n)}return{element:t}}exportJSON(){let e={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},t=this.getTextFormat(),n=this.getTextStyle();return t===0&&n===``||Eg(this)||this.getChildren().some(K)||(t!==0&&(e.textFormat=t),n!==``&&(e.textStyle=n)),e}updateFromJSON(e){return super.updateFromJSON(e).setFormat(e.format).setIndent(e.indent).setDirection(e.direction).setTextFormat(e.textFormat||0).setTextStyle(e.textStyle||``)}insertNewAfter(e,t){return null}canIndent(){return!0}collapseAtStart(e){return!1}excludeFromCopy(e){return!1}canReplaceWith(e){return!0}canInsertAfter(e){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}isShadowRoot(){return!1}canMergeWith(e){return!1}extractWithChild(e,t,n){return!1}canMergeWhenEmpty(){return!1}reconcileObservedMutation(e,t){let n=this.getDOMSlot(e),r=n.getFirstChild();for(let e=this.getFirstChild();e;e=e.getNextSibling()){let i=t.getElementByKey(e.getKey());i!==null&&(r==null?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling)}}};function Y(e){return e instanceof ah}function oh(e,t,n){let r=e.getNode();for(;r;){let e=r.__key;if(t.has(e)&&!n.has(e))return!0;r=r.getParent()}return!1}var sh=class extends Ep{decorate(e,t){return null}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}};function ch(e){return e instanceof sh}var lh=class e extends ah{__cachedText;static getType(){return`root`}static clone(){return new e}constructor(){super(`root`),this.__cachedText=null}getTopLevelElementOrThrow(){G(51)}getTextContent(){let e=this.__cachedText;return!zm()&&Um()._dirtyType!==0||e===null?super.getTextContent():e}remove(){G(52)}replace(e){G(53)}insertBefore(e){G(54)}insertAfter(e){G(55)}updateDOM(e,t){return!1}splice(e,t,n){for(let e of n)Y(e)||ch(e)||G(282);return super.splice(e,t,n)}static importJSON(e){return qh().updateFromJSON(e)}collapseAtStart(){return!0}};function uh(e){return e instanceof lh}function dh(e){return new mh(new Map(e._nodeMap))}function fh(){return new mh(new Map([[`root`,new lh]]))}function ph(e){let t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&G(130,n.name),Y(e)){let r=t.children;Array.isArray(r)||G(59,n.name);let i=e.getChildren();for(let e=0;e<i.length;e++){let t=ph(i[e]);r.push(t)}}return t}function Bee(e){return e instanceof mh}var mh=class e{_nodeMap;_selection;_flushSync;_readOnly;constructor(e,t){this._nodeMap=e,this._selection=t||null,this._flushSync=!1,this._readOnly=!1}isEmpty(){return this._nodeMap.size===1&&this._selection===null}read(e,t){return Xm(t&&t.editor||null,this,e)}clone(t){let n=new e(this._nodeMap,t===void 0?this._selection:t);return n._readOnly=!0,n}toJSON(){return Xm(null,this,()=>({root:ph(qh())}))}},Vee=class extends ah{static getType(){return`artificial`}createDOM(e){return document.createElement(`div`)}},hh=class e extends ah{static getType(){return`paragraph`}static clone(t){return new e(t.__key)}createDOM(e){let t=document.createElement(`p`),n=fg(e.theme,`paragraph`);return n!==void 0&&t.classList.add(...n),t}updateDOM(e,t,n){return!1}static importDOM(){return{p:e=>({conversion:Hee,priority:0})}}exportDOM(e){let{element:t}=super.exportDOM(e);if(Pg(t)){this.isEmpty()&&t.append(document.createElement(`br`));let e=this.getFormatType();e&&(t.style.textAlign=e)}return{element:t}}static importJSON(e){return gh().updateFromJSON(e)}exportJSON(){let e=super.exportJSON();if(e.textFormat===void 0||e.textStyle===void 0){let t=this.getChildren().find(K);t?(e.textFormat=t.getFormat(),e.textStyle=t.getStyle()):(e.textFormat=this.getTextFormat(),e.textStyle=this.getTextStyle())}return e}insertNewAfter(e,t){let n=gh();n.setTextFormat(e.format),n.setTextStyle(e.style);let r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,t),n}collapseAtStart(){let e=this.getChildren();if(e.length===0||K(e[0])&&e[0].getTextContent().trim()===``){if(this.getNextSibling()!==null)return this.selectNext(),this.remove(),!0;if(this.getPreviousSibling()!==null)return this.selectPrevious(),this.remove(),!0}return!1}};function Hee(e){let t=gh();if(e.style&&(t.setFormat(e.style.textAlign),Kg(e,t)),t.getFormatType()===``){let n=e.getAttribute(`align`);n&&n&&n in Uu&&t.setFormat(n)}return{node:t}}function gh(){return Dg(new hh)}function _h(e){return e instanceof hh}function vh(e,t,n,r){let i=e._keyToDOMMap;i.clear(),e._editorState=fh(),e._pendingEditorState=r,e._compositionKey=null,e._dirtyType=0,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),e._normalizedNodes=new Set,e._updateTags=new Set,e._updates=[],e._blockCursorElement=null;let a=e._observer;a!==null&&(a.disconnect(),e._observer=null),t!==null&&(t.textContent=``),n!==null&&(n.textContent=``,i.set(`root`,n))}function Uee(e){let t=new Set,n=new Set,r=e;for(;r;){let{ownNodeConfig:e}=Yg(r),i=r.transform;if(!n.has(i)){n.add(i);let e=r.transform();e&&t.add(e)}if(e){let n=e.$transform;n&&t.add(n),r=e.extends}else{let e=Object.getPrototypeOf(r);r=e.prototype instanceof Ep&&e!==Ep?e:void 0}}return t}function yh(e){let t=e||{},n=Gm(),r=t.theme||{},i=e===void 0?n:t.parentEditor||null,a=t.disableEvents||!1,o=fh(),s=t.namespace||(i===null?$h():i._config.namespace),c=t.editorState,l=[lh,Hp,jp,$p,hh,Vee,...t.nodes||[]],{onError:u,html:d}=t,f=t.editable===void 0||t.editable,p;if(e===void 0&&n!==null)p=n._nodes;else{p=new Map;for(let e=0;e<l.length;e++){let t=l[e],n=null,r=null;if(typeof t!=`function`){let e=t;t=e.replace,n=e.with,r=e.withKlass||null}Yg(t);let i=t.getType(),a=Uee(t);p.set(i,{exportDOM:d&&d.export?d.export.get(t):void 0,klass:t,replace:n,replaceWithKlass:r,sharedNodeState:sd(l[e]),transforms:a})}}let m=new xh(o,i,p,{disableEvents:a,namespace:s,theme:r},u||console.error,function(e,t){let n=new Map,r=new Set,i=e=>{Object.keys(e).forEach(t=>{let r=n.get(t);r===void 0&&(r=[],n.set(t,r)),r.push(e[t])})};return e.forEach(e=>{let t=e.klass.importDOM;if(t==null||r.has(t))return;r.add(t);let n=t.call(e.klass);n!==null&&i(n)}),t&&i(t),n}(p,d?d.import:void 0),f,e);return c!==void 0&&(m._pendingEditorState=c,m._dirtyType=2),function(e){e.registerCommand(af,dp,0),e.registerCommand(of,fp,0),e.registerCommand(sf,pp,0),e.registerCommand(cf,mp,0),e.registerCommand(bf,gp,0)}(m),m}function Wee(e,t){let n=e.get(t);e.delete(t),n&&n()}function bh(e,t,n){return e.set(t,n),Wee.bind(null,e,t)}var xh=class{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(e,t,n,r,i,a,o,s){this._createEditorArgs=s,this._parentEditor=t,this._rootElement=null,this._editorState=e,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=!1,this._listeners={decorator:new Map,editable:new Map,mutation:new Map,root:new Map,textcontent:new Map,update:new Map},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=$h(),this._onError=i,this._htmlConversions=a,this._editable=o,this._headless=t!==null&&t._headless,this._window=null,this._blockCursorElement=null}isComposing(){return this._compositionKey!=null}registerUpdateListener(e){return bh(this._listeners.update,e)}registerEditableListener(e){return bh(this._listeners.editable,e)}registerDecoratorListener(e){return bh(this._listeners.decorator,e)}registerTextContentListener(e){return bh(this._listeners.textcontent,e)}registerRootListener(e){let t=this._listeners.root;return Y_(bh(t,e,e(this._rootElement,null)||void 0),()=>function(e,t,n){let r=e.get(t);r&&r(),e.set(t,t(...n)||void 0)}(t,e,[null,this._rootElement]))}registerCommand(e,t,n){n===void 0&&G(35);let r=this._commands;r.has(e)||r.set(e,[new Set,new Set,new Set,new Set,new Set]);let i=r.get(e);i===void 0&&G(36,String(e));let a=i[n];return a.add(t),()=>{a.delete(t),i.every(e=>e.size===0)&&r.delete(e)}}registerMutationListener(e,t,n){let r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(e)).klass,i=this._listeners.mutation,a=i.get(t);a===void 0&&(a=new Set,i.set(t,a)),a.add(r);let o=n&&n.skipInitialization;return o!==void 0&&o||this.initializeMutationListener(t,r),()=>{a.delete(r),a.size===0&&i.delete(t)}}getRegisteredNode(e){let t=this._nodes.get(e.getType());return t===void 0&&G(37,e.name),t}resolveRegisteredNodeAfterReplacements(e){for(;e.replaceWithKlass;)e=this.getRegisteredNode(e.replaceWithKlass);return e}initializeMutationListener(e,t){let n=this._editorState,r=Ug(n).get(t.getType());if(!r)return;let i=new Map;for(let e of r.keys())i.set(e,`created`);i.size>0&&e(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set([`registerMutationListener`])})}registerNodeTransformToKlass(e,t){let n=this.getRegisteredNode(e);return n.transforms.add(t),n}registerNodeTransform(e,t){let n=this.registerNodeTransformToKlass(e,t),r=[n],i=n.replaceWithKlass;if(i!=null){let e=this.registerNodeTransformToKlass(i,t);r.push(e)}return function(e,t){let n=Ug(e.getEditorState()),r=[];for(let e of t){let t=n.get(e);t&&r.push(t)}r.length!==0&&e.update(()=>{for(let e of r)for(let t of e.keys()){let e=Vh(t);e&&e.markDirty()}},e._pendingEditorState===null?{tag:Dp}:void 0)}(this,r.map(e=>e.klass.getType())),()=>{r.forEach(e=>e.transforms.delete(t))}}hasNode(e){return this._nodes.has(e.getType())}hasNodes(e){return e.every(this.hasNode.bind(this))}dispatchCommand(e,t){return X(this,e,t)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(e){let t=this._rootElement;if(e!==t){let n=fg(this._config.theme,`root`),r=this._pendingEditorState||this._editorState;if(this._rootElement=e,vh(this,t,e,r),t!==null&&(this._config.disableEvents||Sp(t),n!=null&&t.classList.remove(...n)),e!==null){let t=Cg(e),r=e.style;r.userSelect=`text`,r.whiteSpace=`pre-wrap`,r.wordBreak=`break-word`,e.setAttribute(`data-lexical-editor`,`true`),this._window=t,this._dirtyType=2,id(this),this._updateTags.add(Dp),Zm(this),this._config.disableEvents||function(e,t){let n=e.ownerDocument;Yf.set(e,n);let r=Xf.get(n)??0;r<1&&n.addEventListener(`selectionchange`,yp),Xf.set(n,r+1),e.__lexicalEditor=t;let i=_p(e);for(let n=0;n<Wf.length;n++){let[r,a]=Wf[n],o=typeof a==`function`?e=>{xp(e)||(bp(e),(t.isEditable()||r===`click`)&&a(e,t))}:e=>{if(xp(e))return;bp(e);let n=t.isEditable();switch(r){case`cut`:return n&&X(t,Rf,e);case`copy`:return X(t,Lf,e);case`paste`:return n&&X(t,pf,e);case`dragstart`:return n&&X(t,Pf,e);case`dragover`:return n&&X(t,Ff,e);case`dragend`:return n&&X(t,If,e);case`focus`:return n&&X(t,Bf,e);case`blur`:return n&&X(t,Vf,e);case`drop`:return n&&X(t,Nf,e)}};e.addEventListener(r,o),i.push(()=>{e.removeEventListener(r,o)})}}(e,this),n!=null&&e.classList.add(...n)}else this._window=null,this._updateTags.add(Dp),Zm(this);Qm(`root`,this,!1,e,t)}}getElementByKey(e){return this._keyToDOMMap.get(e)||null}getEditorState(){return this._editorState}setEditorState(e,t){e.isEmpty()&&G(38);let n=e;n._readOnly&&(n=dh(e),n._selection=e._selection?e._selection.clone():null),rd(this);let r=this._pendingEditorState,i=this._updateTags,a=t===void 0?null:t.tag;r===null||r.isEmpty()||(a!=null&&i.add(a),Zm(this)),this._pendingEditorState=n,this._dirtyType=2,this._dirtyElements.set(`root`,!1),this._compositionKey=null,a!=null&&i.add(a),this._updating||Zm(this)}parseEditorState(e,t){return function(e,t,n){let r=fh(),i=Nm,a=Fm,o=Pm,s=t._dirtyElements,c=t._dirtyLeaves,l=t._cloneNotNeeded,u=t._dirtyType;t._dirtyElements=new Map,t._dirtyLeaves=new Set,t._cloneNotNeeded=new Set,t._dirtyType=0,Nm=r,Fm=!1,Pm=t,Ch(null);try{let i=t._nodes;Ym(e.root,i),n&&n(),r._readOnly=!0}catch(e){e instanceof Error&&t._onError(e)}finally{t._dirtyElements=s,t._dirtyLeaves=c,t._cloneNotNeeded=l,t._dirtyType=u,Nm=i,Fm=a,Pm=o}return r}(typeof e==`string`?JSON.parse(e):e,this,t)}read(e){return Zm(this),this.getEditorState().read(e,{editor:this})}update(e,t){(function(e,t,n){e._updating?e._updates.push([t,n]):th(e,t,n)})(this,e,t)}focus(e,t={}){let n=this._rootElement;n!==null&&(n.setAttribute(`autocapitalize`,`off`),nh(this,()=>{let r=J(),i=qh();r===null?i.getChildrenSize()!==0&&(t.defaultSelection===`rootStart`?i.selectStart():i.selectEnd()):r.dirty||Yh(r.clone()),bg(`focus`),xg(()=>{n.removeAttribute(`autocapitalize`),e&&e()})}),this._pendingEditorState===null&&n.removeAttribute(`autocapitalize`))}blur(){let e=this._rootElement;e!==null&&e.blur();let t=Mg(this._window);t!==null&&t.removeAllRanges()}isEditable(){return this._editable}setEditable(e){this._editable!==e&&(this._editable=e,Qm(`editable`,this,!0,e))}toJSON(){return{editorState:this._editorState.toJSON()}}};xh.version=`0.43.0+prod.esm`;var Sh=null;function Ch(e){Sh=e}var Gee=1;function wh(e,t){let n=Th(e,t);return n===void 0&&G(30,t),n}function Th(e,t){return e._nodes.get(t)}var Kee=typeof queueMicrotask==`function`?queueMicrotask:e=>{Promise.resolve().then(e)};function Eh(e){return ch(Wh(e))}function Dh(e){let t=document.activeElement;if(!Pg(t))return!1;let n=t.nodeName;return ch(Wh(e))&&(n===`INPUT`||n===`TEXTAREA`||t.contentEditable===`true`&&jh(t)==null)}function Oh(e,t,n){let r=e.getRootElement();try{return r!==null&&r.contains(t)&&r.contains(n)&&t!==null&&!Dh(t)&&Ah(t)===e}catch{return!1}}function kh(e){return e instanceof xh}function Ah(e){let t=e;for(;t!=null;){let e=jh(t);if(kh(e))return e;t=vg(t)}return null}function jh(e){return e?e.__lexicalEditor:null}function Mh(e){return tm(e)||e.isToken()}function Nh(e){return Mh(e)||e.isSegmented()}function Ph(e){return Fg(e)&&e.nodeType===3}function qee(e){return Fg(e)&&e.nodeType===9}function Fh(e){let t=e;for(;t!=null;){if(Ph(t))return t;t=t.firstChild}return null}function Ih(e,t,n){let r=Vu[t];if(n!==null&&(e&r)===(n&r))return e;let i=e^r;return t===`subscript`?i&=~Vu.superscript:t===`superscript`?i&=~Vu.subscript:t===`lowercase`?(i&=~Vu.uppercase,i&=~Vu.capitalize):t===`uppercase`?(i&=~Vu.lowercase,i&=~Vu.capitalize):t===`capitalize`&&(i&=~Vu.lowercase,i&=~Vu.uppercase),i}function Jee(e,t){let n=function(){let e=Sh;return Sh=null,e}();if((t||=n&&n.__key)!=null)return void(e.__key=t);Bm(),Vm();let r=Um(),i=Hm(),a=``+ Gee++;i._nodeMap.set(a,e),Y(e)?r._dirtyElements.set(a,!0):r._dirtyLeaves.add(a),r._cloneNotNeeded.add(a),r._dirtyType=1,e.__key=a}function Lh(e){let t=e.getParent();if(t!==null){let n=e.getWritable(),r=t.getWritable(),i=e.getPreviousSibling(),a=e.getNextSibling(),o=a===null?null:a.__key,s=i===null?null:i.__key,c=i===null?null:i.getWritable(),l=a===null?null:a.getWritable();i===null&&(r.__first=o),a===null&&(r.__last=s),c!==null&&(c.__next=o),l!==null&&(l.__prev=s),n.__prev=null,n.__next=null,n.__parent=null,r.__size--}}function Rh(e){Vm(),Tp(e)&&G(323,e.__key,e.__type);let t=e.getLatest(),n=t.__parent,r=Hm(),i=Um(),a=r._nodeMap,o=i._dirtyElements;n!==null&&function(e,t,n){let r=e;for(;r!==null;){if(n.has(r))return;let e=t.get(r);if(e===void 0)break;n.set(r,!1),r=e.__parent}}(n,a,o);let s=t.__key;i._dirtyType=1,Y(e)?o.set(s,!0):i._dirtyLeaves.add(s)}function zh(e){Bm();let t=Um(),n=t._compositionKey;if(e!==n){if(t._compositionKey=e,n!==null){let e=Vh(n);e!==null&&e.getWritable()}if(e!==null){let t=Vh(e);t!==null&&t.getWritable()}}}function Bh(){return zm()?null:Um()._compositionKey}function Vh(e,t){let n=(t||Hm())._nodeMap.get(e);return n===void 0?null:n}function Hh(e,t){let n=Uh(e,Um());return n===void 0?null:Vh(n,t)}function Uh(e,t){return e[`__lexicalKey_${t._key}`]}function Wh(e,t){let n=e;for(;n!=null;){let e=Hh(n,t);if(e!==null)return e;n=vg(n)}return null}function Gh(e){let t=e._decorators,n=Object.assign({},t);return e._pendingDecorators=n,n}function Kh(e){return e.read(()=>qh().getTextContent())}function qh(){return Jh(Hm())}function Jh(e){return e._nodeMap.get(`root`)}function Yh(e){Bm();let t=Hm();e!==null&&(e.dirty=!0,e.setCachedNodes(null)),t._selection=e}function Xh(e){let t=Um(),n=function(e,t){let n=e;for(;n!=null;){let e=Uh(n,t);if(e!==void 0)return e;n=vg(n)}return null}(e,t);return n===null?e===t.getRootElement()?Vh(`root`):null:Vh(n)}function Zh(e){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(e)}function Qh(e){let t=[];for(let n=e;n!==null;n=n._parentEditor)t.push(n);return t}function $h(){return Math.random().toString(36).replace(/[^a-z]+/g,``).substring(0,5)}function eg(e){return Ph(e)?e.nodeValue:null}function tg(e,t,n){let r=Mg(wg(t));if(r===null)return;let i=r.anchorNode,{anchorOffset:a,focusOffset:o}=r;if(i!==null){let t=eg(i),r=Wh(i);if(t!==null&&K(r)){if((t===Ru||t===Bu)&&n){let e=n.length;t=n,a=e,o=e}t!==null&&ng(r,t,a,o,e)}}}function ng(e,t,n,r,i){let a=e;if(a.isAttached()&&(i||!a.isDirty())){let o=a.isComposing(),s=t;if((o||i)&&(t.endsWith(Ru)&&(s=t.slice(0,-Ru.length)),i)){let e=Bu,t;for(;(t=s.indexOf(e))!==-1;)s=s.slice(0,t)+s.slice(t+e.length),n!==null&&n>t&&(n=Math.max(t,n-e.length)),r!==null&&r>t&&(r=Math.max(t,r-e.length))}let c=a.getTextContent();if(i||s!==c){if(s===``){if(zh(null),Tu||Cu||Ou)a.remove();else{let e=Um();setTimeout(()=>{e.update(()=>{a.isAttached()&&a.remove()})},20)}return}let t=a.getParent(),i=Sm(),c=a.getTextContentSize(),l=Bh(),u=a.getKey();if(a.isToken()||l!==null&&u===l&&!o||q(i)&&(t!==null&&!t.canInsertTextBefore()&&i.anchor.offset===0||i.anchor.key===e.__key&&i.anchor.offset===0&&!a.canInsertTextBefore()&&!o||i.focus.key===e.__key&&i.focus.offset===c&&!a.canInsertTextAfter()&&!o))return void a.markDirty();let d=J();if(!q(d)||n===null||r===null)return void rg(a,s,d);if(d.setTextNodeRange(a,n,a,r),a.isSegmented()){let e=Zp(a.getTextContent());a.replace(e),a=e}rg(a,s,d)}}}function rg(e,t,n){if(e.setTextContent(t),q(n)){let t=e.getKey();for(let r of[`anchor`,`focus`]){let i=n[r];i.type===`text`&&i.key===t&&(i.offset=m_(e,i.offset,`clamp`))}}}function ig(e,t,n){let r=t[n]||!1;return r===`any`||r===e[n]}function ag(e,t){return ig(e,t,`altKey`)&&ig(e,t,`ctrlKey`)&&ig(e,t,`shiftKey`)&&ig(e,t,`metaKey`)}function og(e,t,n){if(!ag(e,n))return!1;if(e.key.toLowerCase()===t.toLowerCase())return!0;if(t.length>1||e.key.length===1&&e.key.charCodeAt(0)<=127)return!1;let r=`Key`+t.toUpperCase();return e.code===r}var sg={ctrlKey:!bu,metaKey:bu},cg={altKey:bu,ctrlKey:!bu};function lg(e){return e.key===`Backspace`}function ug(e){return og(e,`a`,sg)}function dg(e){let t=qh();if(q(e)){let t=e.anchor,n=e.focus,r=t.getNode().getTopLevelElementOrThrow().getParentOrThrow();return t.set(r.getKey(),0,`element`),n.set(r.getKey(),r.getChildrenSize(),`element`),yd(e),e}{let e=t.select(0,t.getChildrenSize());return Yh(yd(e)),e}}function fg(e,t){e.__lexicalClassNameCache===void 0&&(e.__lexicalClassNameCache={});let n=e.__lexicalClassNameCache,r=n[t];if(r!==void 0)return r;let i=e[t];if(typeof i==`string`){let e=q_(i);return n[t]=e,e}return i}function pg(e,t,n,r,i){if(n.size===0)return;let a=r.__type,o=r.__key,s=t.get(a);s===void 0&&G(33,a);let c=s.klass,l=e.get(c);l===void 0&&(l=new Map,e.set(c,l));let u=l.get(o),d=u===`destroyed`&&i===`created`;(u===void 0||d)&&l.set(o,d?`updated`:i)}function mg(e,t,n){let r=e.getParent(),i=n,a=e;return r!==null&&(t&&n===0?(i=a.getIndexWithinParent(),a=r):t||n!==a.getChildrenSize()||(i=a.getIndexWithinParent()+1,a=r)),a.getChildAtIndex(t?i-1:i)}function hg(e,t){let n=e.offset;if(e.type===`element`)return mg(e.getNode(),t,n);{let r=e.getNode();if(t&&n===0||!t&&n===r.getTextContentSize()){let e=t?r.getPreviousSibling():r.getNextSibling();return e===null?mg(r.getParentOrThrow(),t,r.getIndexWithinParent()+(t?0:1)):e}}return null}function gg(e){let t=wg(e).event,n=t&&t.inputType;return n===`insertFromPaste`||n===`insertFromPasteAsQuotation`}function X(e,t,n){return $m(e,t,n,e)}function _g(e,t){let n=e._keyToDOMMap.get(t);return n===void 0&&G(75,t),n}function vg(e){let t=e.assignedSlot||e.parentElement;return Ig(t)?t.host:t}function yg(e){return qee(e)?e:Pg(e)?e.ownerDocument:null}function bg(e){Bm(),Um()._updateTags.add(e)}function xg(e){Bm(),Um()._deferred.push(e)}function Sg(e,t){let n=e.getParent();for(;n!==null;){if(n.is(t))return!0;n=n.getParent()}return!1}function Cg(e){let t=yg(e);return t?t.defaultView:null}function wg(e){let t=e._window;return t===null&&G(78),t}function Tg(e){let t=e.getParentOrThrow();for(;t!==null;){if(Eg(t))return t;t=t.getParentOrThrow()}return t}function Eg(e){return uh(e)||Y(e)&&e.isShadowRoot()}function Dg(e){let t=Um(),n=e.getType(),r=Th(t,n);r===void 0&&G(200,e.constructor.name,n);let{replace:i,replaceWithKlass:a}=r;if(i!==null){let t=i(e),r=t.constructor;return a===null?t instanceof e.constructor&&r!==e.constructor||G(202,r.name,r.getType(),e.constructor.name,n):t instanceof a||G(201,a.name,a.getType(),r.name,r.getType(),e.constructor.name,n),t.__key===e.__key&&G(203,e.constructor.name,n,r.name,r.getType()),t}return e}function Og(e,t){!uh(e.getParent())||Y(t)||ch(t)||G(99)}function kg(e){let t=Vh(e);return t===null&&G(63,e),t}function Ag(e){return(ch(e)||Y(e)&&!e.canBeEmpty())&&!e.isInline()}function jg(e,t,n){n.style.removeProperty(`caret-color`),t._blockCursorElement=null;let r=e.parentElement;r!==null&&r.removeChild(e)}function Mg(e){return vu?(e||window).getSelection():null}function Ng(e){let t=Cg(e);return t?t.getSelection():null}function Pg(e){return Fg(e)&&e.nodeType===1}function Fg(e){return typeof e==`object`&&!!e&&`nodeType`in e&&typeof e.nodeType==`number`}function Ig(e){return Fg(e)&&e.nodeType===11}function Lg(e){let t=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,`i`);return e.nodeName.match(t)!==null}function Rg(e){let t=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,`i`);return e.nodeName.match(t)!==null}function zg(e){if(ch(e)&&!e.isInline())return!0;if(!Y(e)||Eg(e))return!1;let t=e.getFirstChild(),n=t===null||Pp(t)||K(t)||t.isInline();return!e.isInline()&&!1!==e.canBeEmpty()&&n}function Bg(){return Um()}var Vg=new WeakMap,Hg=new Map;function Ug(e){if(!e._readOnly&&e.isEmpty())return Hg;e._readOnly||G(192);let t=Vg.get(e);return t||(t=function(e){let t=new Map;for(let[n,r]of e._nodeMap){let e=r.__type,i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,r)}return t}(e),Vg.set(e,t)),t}function Wg(e){let t=e.constructor.clone(e);return t.afterCloneFrom(e),t}function Gg(e){return(t=Wg(e))[wp]=!0,t;var t}function Kg(e,t){let n=parseInt(e.style.paddingInlineStart,10)||0,r=Math.round(n/40);t.setIndent(r)}function qg(e){return!0===e.__lexicalUnmanaged}function Jg(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)&&e[t]!==Ep[t]}function Yg(e){let t=qu in e.prototype?e.prototype[qu]():void 0,n=function(e){if(!(e===Ep||e.prototype instanceof Ep)){let t=`<unknown>`,n=`<unknown>`;try{t=e.getType()}catch{}try{xh.version&&(n=JSON.parse(xh.version))}catch{}G(290,e.name,t,n)}return e===sh||e===ah||e===Ep}(e),r=!n&&Jg(e,`getType`)?e.getType():void 0,i,a=r;if(t)if(r)i=t[r];else for(let[e,n]of Object.entries(t))a=e,i=n;if(!n&&a&&(Jg(e,`getType`)||(e.getType=()=>a),Jg(e,`clone`)||(e.clone=t=>(Ch(t),new e)),Jg(e,`importJSON`)||(e.importJSON=i&&i.$importJSON||(t=>new e().updateFromJSON(t))),!Jg(e,`importDOM`)&&i)){let{importDOM:t}=i;t&&(e.importDOM=()=>t)}return{ownNodeConfig:i,ownNodeType:a}}function Xg(e){let t=Bg();return Bm(),new(t.resolveRegisteredNodeAfterReplacements(t.getRegisteredNode(e))).klass}var Zg=(e,t)=>{let n=e;for(;n!=null&&!uh(n);){if(t(n))return n;n=n.getParent()}return null},Qg={next:`previous`,previous:`next`},$g=class{origin;constructor(e){this.origin=e}[Symbol.iterator](){return w_({hasNext:s_,initial:this.getAdjacentCaret(),map:e=>e,step:e=>e.getAdjacentCaret()})}getAdjacentCaret(){return f_(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return f_(this.origin,this.direction)}remove(){let e=this.getNodeAtCaret();return e&&e.remove(),this}replaceOrInsert(e,t){let n=this.getNodeAtCaret();return e.is(this.origin)||e.is(n)||(n===null?this.insert(e):n.replace(e,t)),this}splice(e,t,n=`next`){let r=n===this.direction?t:Array.from(t).reverse(),i=this,a=this.getParentAtCaret(),o=new Map;for(let t=i.getAdjacentCaret();t!==null&&o.size<e;t=t.getAdjacentCaret()){let e=t.origin.getWritable();o.set(e.getKey(),e)}for(let e of r){if(o.size>0){let t=i.getNodeAtCaret();if(t){if(o.delete(t.getKey()),o.delete(e.getKey()),!(t.is(e)||i.origin.is(e))){let n=e.getParent();n&&n.is(a)&&e.remove(),t.replace(e)}}else t===null&&G(263,Array.from(o).join(` `))}else i.insert(e);i=f_(e,this.direction)}for(let e of o.values())e.remove();return this}},e_=class e extends $g{type=`child`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:g_(e,this.direction)}getParentCaret(e=`root`){return f_(r_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=n_(this.direction);return f_(this.getNodeAtCaret(),e)||g_(this.origin,e)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(e){return this.isSameNodeCaret(e)}},t_={root:uh,shadowRoot:Eg};function n_(e){return Qg[e]}function r_(e,t=`root`){return t_[t](e)?null:e}var i_=class e extends $g{type=`sibling`;getLatest(){let e=this.origin.getLatest();return e===this.origin?this:f_(e,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Y(this.origin)?g_(this.origin,this.direction):null}getParentCaret(e=`root`){return f_(r_(this.getParentAtCaret(),e),this.direction)}getFlipped(){let e=n_(this.direction);return f_(this.getNodeAtCaret(),e)||g_(this.origin.getParentOrThrow(),e)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return(t instanceof e||t instanceof a_)&&this.direction===t.direction&&this.origin.is(t.origin)}},a_=class e extends $g{type=`text`;offset;constructor(e,t){super(e),this.offset=t}getLatest(){let e=this.origin.getLatest();return e===this.origin?this:p_(e,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(e=`root`){return f_(r_(this.getParentAtCaret(),e),this.direction)}getFlipped(){return p_(this.origin,n_(this.direction),this.offset)}isSamePointCaret(t){return t instanceof e&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return(t instanceof i_||t instanceof e)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return f_(this.origin,this.direction)}};function o_(e){return e instanceof a_}function s_(e){return e instanceof i_}function c_(e){return e instanceof e_}var l_={next:class extends a_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends a_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},u_={next:class extends i_{direction=`next`;getNodeAtCaret(){return this.origin.getNextSibling()}insert(e){return this.origin.insertAfter(e),this}},previous:class extends i_{direction=`previous`;getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(e){return this.origin.insertBefore(e),this}}},d_={next:class extends e_{direction=`next`;getNodeAtCaret(){return this.origin.getFirstChild()}insert(e){return this.origin.splice(0,0,[e]),this}},previous:class extends e_{direction=`previous`;getNodeAtCaret(){return this.origin.getLastChild()}insert(e){return this.origin.splice(this.origin.getChildrenSize(),0,[e]),this}}};function f_(e,t){return e?new u_[t](e):null}function p_(e,t,n){return e?new l_[t](e,m_(e,n)):null}function m_(e,t,n=`error`){let r=e.getTextContentSize(),i=t===`next`?r:t===`previous`?0:t;return(i<0||i>r)&&(n!==`clamp`&&_u(284,String(t),String(r),e.getKey()),i=i<0?0:r),i}function h_(e,t){return new b_(e,t)}function g_(e,t){return Y(e)?new d_[t](e):null}function __(e){return e&&e.getChildCaret()||e}function v_(e){return e&&__(e.getAdjacentCaret())}var y_=class e{type=`node-caret-range`;direction;anchor;focus;constructor(e,t,n){this.anchor=e,this.focus=t,this.direction=n}getLatest(){let t=this.anchor.getLatest(),n=this.focus.getLatest();return t===this.anchor&&n===this.focus?this:new e(t,n,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){let e=e=>{let t=this[e].getLatest();return o_(t)?function(e,t){let{direction:n,origin:r}=e;return h_(e,m_(r,t===`focus`?n_(n):n)-e.offset)}(t,e):null},t=e(`anchor`),n=e(`focus`);if(t&&n){let{caret:e}=t,{caret:r}=n;if(e.isSameNodeCaret(r))return[h_(e,r.offset-e.offset),null]}return[t,n]}iterNodeCarets(e=`root`){let t=o_(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=o_(n),i=t=>t.isSameNodeCaret(n)?null:v_(t)||t.getParentCaret(e);return w_({hasNext:e=>e!==null&&!(r&&n.isSameNodeCaret(e)),initial:t.isSameNodeCaret(n)?null:i(t),map:e=>e,step:i})}[Symbol.iterator](){return this.iterNodeCarets(`root`)}},b_=class{type=`slice`;caret;distance;constructor(e,t){this.caret=e,this.distance=t}getSliceIndices(){let{distance:e,caret:{offset:t}}=this,n=t+e;return n<t?[n,t]:[t,n]}getTextContent(){let[e,t]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(e,t)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){let{caret:{origin:e,direction:t}}=this,[n,r]=this.getSliceIndices(),i=e.getTextContent();return p_(e.setTextContent(i.slice(0,n)+i.slice(r)),t,n)}};function x_(e){return C_(e,f_(qh(),e.direction))}function S_(e){return C_(e,e)}function C_(e,t){return e.direction!==t.direction&&G(265),new y_(e,t,e.direction)}function w_(e){let{initial:t,hasNext:n,step:r,map:i}=e,a=t;return{[Symbol.iterator](){return this},next(){if(!n(a))return{done:!0,value:void 0};let e={done:!1,value:i(a)};return a=r(a),e}}}function T_(e,t){let n=k_(e.origin,t.origin);switch(n===null&&G(275,e.origin.getKey(),t.origin.getKey()),n.type){case`same`:{let n=e.type===`text`,r=t.type===`text`;return n&&r?function(e,t){return Math.sign(e-t)}(e.offset,t.offset):e.type===t.type?0:n?-1:r?1:e.type===`child`?-1:1}case`ancestor`:return e.type===`child`?-1:1;case`descendant`:return t.type===`child`?1:-1;case`branch`:return E_(n)}}function E_(e){let{a:t,b:n}=e,r=t.__key,i=n.__key,a=t,o=n;for(;a&&o;a=a.getNextSibling(),o=o.getNextSibling()){if(a.__key===i)return-1;if(o.__key===r)return 1}return a===null?1:-1}function D_(e,t){return t.is(e)}function O_(e){return Y(e)?[e.getLatest(),null]:[e.getParent(),e.getLatest()]}function k_(e,t){if(e.is(t))return{commonAncestor:e,type:`same`};let n=new Map;for(let[t,r]=O_(e);t;r=t,t=t.getParent())n.set(t,r);for(let[r,i]=O_(t);r;i=r,r=r.getParent()){let a=n.get(r);if(a!==void 0)return a===null?(D_(e,r)||G(276),{commonAncestor:r,type:`ancestor`}):i===null?(D_(t,r)||G(277),{commonAncestor:r,type:`descendant`}):((Y(a)||D_(e,a))&&(Y(i)||D_(t,i))&&r.is(a.getParent())&&r.is(i.getParent())||G(278),{a,b:i,commonAncestor:r,type:`branch`})}return null}function A_(e,t){let{type:n,key:r,offset:i}=e,a=kg(e.key);return n===`text`?(K(a)||G(266,a.getType(),r),p_(a,t,i)):(Y(a)||G(267,a.getType(),r),U_(a,e.offset,t))}function j_(e,t){let{origin:n,direction:r}=t,i=r===`next`;o_(t)?e.set(n.getKey(),t.offset,`text`):s_(t)?K(n)?e.set(n.getKey(),m_(n,r),`text`):e.set(n.getParentOrThrow().getKey(),n.getIndexWithinParent()+(i?1:0),`element`):(c_(t)&&Y(n)||G(268),e.set(n.getKey(),i?0:n.getChildrenSize(),`element`))}function M_(e){let t=J(),n=q(t)?t:ym();return N_(n,e),Yh(n),n}function N_(e,t){j_(e.anchor,t.anchor),j_(e.focus,t.focus)}function P_(e){let{anchor:t,focus:n}=e,r=A_(t,`next`),i=A_(n,`next`),a=T_(r,i)<=0?`next`:`previous`;return C_(V_(r,a),V_(i,a))}function F_(e){let{direction:t,origin:n}=e,r=f_(n,n_(t)).getNodeAtCaret();return r?f_(r,t):g_(n.getParentOrThrow(),t)}function I_(e,t=`root`){let n=[e];for(let r=c_(e)?e.getParentCaret(t):e.getSiblingCaret();r!==null;r=r.getParentCaret(t))n.push(F_(r));return n}function L_(e){return!!e&&e.origin.isAttached()}function R_(e,t=`removeEmptySlices`){if(e.isCollapsed())return e;let n=`root`,r=`next`,i=t,a=H_(e,r),o=I_(a.anchor,n),s=I_(a.focus.getFlipped(),n),c=new Set,l=[];for(let e of a.iterNodeCarets(n))if(c_(e))c.add(e.origin.getKey());else if(s_(e)){let{origin:t}=e;Y(t)&&!c.has(t.getKey())||l.push(t)}for(let e of l)e.remove();for(let e of a.getTextSlices()){if(!e)continue;let{origin:t}=e.caret,n=t.getTextContentSize(),a=F_(f_(t,r)),c=t.getMode();if(Math.abs(e.distance)===n&&i===`removeEmptySlices`||c===`token`&&e.distance!==0)a.remove();else if(e.distance!==0){i=`removeEmptySlices`;let t=e.removeTextSlice(),n=e.caret.origin;if(c===`segmented`){let e=t.origin,n=Zp(e.getTextContent()).setStyle(e.getStyle()).setFormat(e.getFormat());a.replaceOrInsert(n),t=p_(n,r,t.offset)}n.is(o[0].origin)&&(o[0]=t),n.is(s[0].origin)&&(s[0]=t.getFlipped())}}let u,d;for(let e of o)if(L_(e)){u=z_(e);break}for(let e of s)if(L_(e)){d=z_(e);break}let f=function(e,t,n){if(!e||!t)return null;let r=e.getParentAtCaret(),i=t.getParentAtCaret();if(!r||!i)return null;let a=r.getParents().reverse();a.push(r);let o=i.getParents().reverse();o.push(i);let s=Math.min(a.length,o.length),c;for(c=0;c<s&&a[c]===o[c];c++);let l=(e,t)=>{let n;for(let r=c;r<e.length;r++){let i=e[r];if(Eg(i))return;!n&&t(i)&&(n=i)}return n},u=l(a,zg),d=u&&l(o,e=>n.has(e.getKey())&&zg(e));return u&&d?[u,d]:null}(u,d,c);if(f){let[e,t]=f;g_(e,`previous`).splice(0,t.getChildren());let n=t.getParent();for(t.remove(!0);n&&n.isEmpty();){let e=n;n=n.getParent(),e.remove(!0)}}let p=[u,d,...o,...s].find(L_);if(p)return S_(V_(z_(p),e.direction));G(269,JSON.stringify(o.map(e=>e.origin.__key)))}function z_(e){let t=function(e){let t=e;for(;c_(t);){let e=v_(t);if(!c_(e))break;t=e}return t}(e.getLatest()),{direction:n}=t;if(K(t.origin))return o_(t)?t:p_(t.origin,n,n);let r=t.getAdjacentCaret();return s_(r)&&K(r.origin)?p_(r.origin,n,n_(n)):t}function B_(e){return o_(e)&&e.offset!==m_(e.origin,e.direction)}function V_(e,t){return e.direction===t?e:e.getFlipped()}function H_(e,t){return e.direction===t?e:C_(V_(e.focus,t),V_(e.anchor,t))}function U_(e,t,n){let r=g_(e,`next`);for(let e=0;e<t;e++){let e=r.getAdjacentCaret();if(e===null)break;r=e}return V_(r,n)}function W_(e){return e}function G_(e){return e}function K_(e,t){if(!t||e===t)return e;for(let n in t)if(e[n]!==t[n])return{...e,...t};return e}function q_(...e){let t=[];for(let n of e)if(n&&typeof n==`string`)for(let[e]of n.matchAll(/\S+/g))t.push(e);return t}function J_(e,...t){let n=q_(...t);n.length>0&&e.classList.add(...n)}function Y_(...e){return()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}function X_(){return qh().getTextContent()}function Z_(e,t=!0){if(e)return!1;let n=X_();return t&&(n=n.trim()),n===``}function Q_(e){if(!Z_(e,!1))return!1;let t=qh().getChildren(),n=t.length;if(n>1)return!1;for(let e=0;e<n;e++){let n=t[e];if(ch(n))return!1;if(Y(n)){if(!_h(n)||n.__indent!==0)return!1;let t=n.getChildren(),r=t.length;for(let n=0;n<r;n++){let n=t[e];if(!K(n))return!1}}}return!0}function $_(e){return()=>Q_(e)}function ev(e){let t=Bg().getElementByKey(e.getKey());if(t===null)return null;let n=t.ownerDocument.defaultView;return n===null?null:n.getComputedStyle(t)}function tv(e){return ev(uh(e)?e:e.getParentOrThrow())}function nv(e,t,n=`self`){let r=e.getStartEndPoints();if(t.isSelected(e)&&!Nh(t)&&r!==null){let[i,a]=r,o=e.isBackward(),s=i.getNode(),c=a.getNode(),l=t.is(s),u=t.is(c);if(l||u){let[r,i]=um(e),a=s.is(c),l=t.is(o?c:s),u=t.is(o?s:c),d,f=0;a?(f=r>i?i:r,d=r>i?r:i):l?(f=o?i:r,d=void 0):u&&(f=0,d=o?r:i);let p=t.__text.slice(f,d);p!==t.__text&&(n===`clone`&&(t=Gg(t)),t.__text=p)}}return t}function rv(e){let t=iv(e);return t!==null&&t.writingMode===`vertical-rl`}function iv(e){let t=e.anchor.getNode();return Y(t)?ev(t):tv(t)}function av(e,t){let n=rv(e)?!t:t;sv(e)&&(n=!n);let r=A_(e.focus,n?`previous`:`next`);if(B_(r))return!1;for(let e of x_(r)){if(c_(e))return!e.origin.isInline();if(!Y(e.origin)){if(ch(e.origin))return!0;break}}return!1}function ov(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function sv(e){let t=iv(e);return t!==null&&t.direction===`rtl`}function cv(e,t,n){let r=sv(e),i;i=rv(e)||r?!n:n,ov(e,t,i,`character`)}var lv=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,uv=lv&&`documentMode`in document?document.documentMode:null;lv&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),lv&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),!(!lv||!(`InputEvent`in window)||uv)&&`getTargetRanges`in new window.InputEvent(`input`),lv&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&window.MSStream,lv&&/Android/.test(navigator.userAgent),lv&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),lv&&/^(?=.*Chrome).*/i.test(navigator.userAgent),lv&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent);function dv(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}var fv=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?H.useLayoutEffect:H.useEffect;function pv({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:r,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:o,ariaInvalid:s,ariaLabel:c,ariaLabelledBy:l,ariaMultiline:u,ariaOwns:d,ariaRequired:f,autoCapitalize:p,className:m,id:h,role:g=`textbox`,spellCheck:_=!0,style:v,tabIndex:y,"data-testid":b,...x},S){let[C,w]=(0,H.useState)(e.isEditable()),T=(0,H.useCallback)(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),E=(0,H.useMemo)(()=>function(...e){return t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)}}(S,T),[T,S]);return fv(()=>(w(e.isEditable()),e.registerEditableListener(e=>{w(e)})),[e]),(0,U.jsx)(`div`,{"aria-activedescendant":C?t:void 0,"aria-autocomplete":C?n:`none`,"aria-controls":C?r:void 0,"aria-describedby":i,...a==null?{}:{"aria-errormessage":a},"aria-expanded":C&&g===`combobox`?!!o:void 0,...s==null?{}:{"aria-invalid":s},"aria-label":c,"aria-labelledby":l,"aria-multiline":u,"aria-owns":C?d:void 0,"aria-readonly":!C||void 0,"aria-required":f,autoCapitalize:p,className:m,contentEditable:C,"data-testid":b,id:h,ref:E,role:g,spellCheck:_,style:v,tabIndex:y,...x})}var mv=(0,H.forwardRef)(pv);function hv(e){return e.getEditorState().read($_(e.isComposing()))}var gv=(0,H.forwardRef)(_v);function _v(e,t){let{placeholder:n,...r}=e,[i]=gu();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(mv,{editor:i,...r,ref:t}),n!=null&&(0,U.jsx)(vv,{editor:i,content:n})]})}function vv({content:e,editor:t}){let n=function(e){let[t,n]=(0,H.useState)(()=>hv(e));return fv(()=>{function t(){n(hv(e))}return t(),Y_(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[r,i]=(0,H.useState)(t.isEditable());if((0,H.useLayoutEffect)(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!n)return null;let a=null;return typeof e==`function`?a=e(r):e!==null&&(a=e),a===null?null:(0,U.jsx)(`div`,{"aria-hidden":!0,children:a})}var yv=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,bv=yv?H.useLayoutEffect:H.useEffect,xv={tag:Dp};function Sv({initialConfig:e,children:t}){let n=(0,H.useMemo)(()=>{let{theme:t,namespace:n,nodes:r,onError:i,editorState:a,html:o}=e,s=hu(null,t),c=yh({editable:e.editable,html:o,namespace:n,nodes:r,onError:e=>i(e,c),theme:t});return function(e,t){if(t!==null){if(t===void 0)e.update(()=>{let t=qh();if(t.isEmpty()){let n=gh();t.append(n);let r=yv?document.activeElement:null;(J()!==null||r!==null&&r===e.getRootElement())&&n.select()}},xv);else if(t!==null)switch(typeof t){case`string`:{let n=e.parseEditorState(t);e.setEditorState(n,xv);break}case`object`:e.setEditorState(t,xv);break;case`function`:e.update(()=>{qh().isEmpty()&&t(e)},xv)}}}(c,a),[c,s]},[]);return bv(()=>{let t=e.editable,[r]=n;r.setEditable(t===void 0||t)},[]),(0,U.jsx)(mu.Provider,{value:n,children:t})}var Cv=(0,H.createContext)(null),wv={didCatch:!1,error:null},Tv=class extends H.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=wv}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){let{error:t}=this.state;t!==null&&(this.props.onReset?.({args:e,reason:`imperative-api`}),this.setState(wv))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){let{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&t.error!==null&&Ev(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:`keys`}),this.setState(wv))}render(){let{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:i,error:a}=this.state,o=e;if(i){let e={error:a,resetErrorBoundary:this.resetErrorBoundary};if(typeof t==`function`)o=t(e);else if(n)o=(0,H.createElement)(n,e);else if(r!==void 0)o=r;else throw a}return(0,H.createElement)(Cv.Provider,{value:{didCatch:i,error:a,resetErrorBoundary:this.resetErrorBoundary}},o)}};function Ev(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}function Dv({children:e,onError:t}){return(0,U.jsx)(Tv,{fallback:(0,U.jsx)(`div`,{style:{border:`1px solid #f00`,color:`#f00`,padding:`8px`},children:`An error was thrown.`}),onError:t,children:e})}var Ov=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?H.useLayoutEffect:H.useEffect;function kv(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}function Av(){return function(e){let[t]=gu(),n=(0,H.useMemo)(()=>e(t),[t,e]),[r,i]=(0,H.useState)(()=>n.initialValueFn()),a=(0,H.useRef)(r);return Ov(()=>{let{initialValueFn:e,subscribe:t}=n,r=e();return a.current!==r&&(a.current=r,i(r)),t(e=>{a.current=e,i(e)})},[n,e]),r}(kv)}var jv=Symbol.for(`preact-signals`);function Mv(){if(Lv>1)return void Lv--;let e,t=!1;for(function(){let e=Iv;for(Iv=void 0;e!==void 0;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();Pv!==void 0;){let n=Pv;for(Pv=void 0,Rv++;n!==void 0;){let r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Uv(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Rv=0,Lv--,t)throw e}var Nv,Pv;function Fv(e){let t=Nv;Nv=void 0;try{return e()}finally{Nv=t}}var Iv,Lv=0,Rv=0,zv=0,Bv=0;function Vv(e){if(Nv===void 0)return;let t=e.n;return t===void 0||t.t!==Nv?(t={i:0,S:e,p:Nv.s,n:void 0,t:Nv,e:void 0,x:void 0,r:t},Nv.s!==void 0&&(Nv.s.n=t),Nv.s=t,e.n=t,32&Nv.f&&e.S(t),t):t.i===-1?(t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=Nv.s,t.n=void 0,Nv.s.n=t,Nv.s=t),t):void 0}function Hv(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function Uv(e){for(let t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Wv(e){for(let t=e.s;t!==void 0;t=t.n){let n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Gv(e){let t,n=e.s;for(;n!==void 0;){let e=n.p;n.i===-1?(n.S.U(n),e!==void 0&&(e.n=n.n),n.n!==void 0&&(n.n.p=e)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=e}e.s=t}function Kv(e,t){Hv.call(this,void 0),this.x=e,this.s=void 0,this.g=Bv-1,this.f=4,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}function qv(e){let t=e.m;if(e.m=void 0,typeof t==`function`){Lv++;let n=Nv;Nv=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Jv(e),t}finally{Nv=n,Mv()}}}function Jv(e){for(let t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,qv(e)}function Yv(e){if(Nv!==this)throw Error(`Out-of-order effect`);Gv(this),Nv=e,this.f&=-2,8&this.f&&Jv(this),Mv()}function Xv(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name}function Zv(e,t){let n=new Xv(e,t);try{n.c()}catch(e){throw n.d(),e}let r=n.d.bind(n);return r[Symbol.dispose]=r,r}Hv.prototype.brand=jv,Hv.prototype.h=function(){return!0},Hv.prototype.S=function(e){let t=this.t;t!==e&&e.e===void 0&&(e.x=t,this.t=e,t===void 0?Fv(()=>{var e;(e=this.W)==null||e.call(this)}):t.e=e)},Hv.prototype.U=function(e){if(this.t!==void 0){let t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,n===void 0&&Fv(()=>{var e;(e=this.Z)==null||e.call(this)}))}},Hv.prototype.subscribe=function(e){return Zv(()=>{let t=this.value,n=Nv;Nv=void 0;try{e(t)}finally{Nv=n}},{name:`sub`})},Hv.prototype.valueOf=function(){return this.value},Hv.prototype.toString=function(){return this.value+``},Hv.prototype.toJSON=function(){return this.value},Hv.prototype.peek=function(){let e=Nv;Nv=void 0;try{return this.value}finally{Nv=e}},Object.defineProperty(Hv.prototype,`value`,{get(){let e=Vv(this);return e!==void 0&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(Rv>100)throw Error(`Cycle detected`);(function(e){Lv!==0&&Rv===0&&e.l!==zv&&(e.l=zv,Iv={S:e,v:e.v,i:e.i,o:Iv})})(this),this.v=e,this.i++,Bv++,Lv++;try{for(let e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Mv()}}}}),Kv.prototype=new Hv,Kv.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Bv))return!0;if(this.g=Bv,this.f|=1,this.i>0&&!Uv(this))return this.f&=-2,!0;let e=Nv;try{Wv(this),Nv=this;let e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Nv=e,Gv(this),this.f&=-2,!0},Kv.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(let e=this.s;e!==void 0;e=e.n)e.S.S(e)}Hv.prototype.S.call(this,e)},Kv.prototype.U=function(e){if(this.t!==void 0&&(Hv.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(let e=this.s;e!==void 0;e=e.n)e.S.U(e)}},Kv.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Kv.prototype,`value`,{get(){if(1&this.f)throw Error(`Cycle detected`);let e=Vv(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Xv.prototype.c=function(){let e=this.S();try{if(8&this.f||this.x===void 0)return;let e=this.x();typeof e==`function`&&(this.m=e)}finally{e()}},Xv.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,qv(this),Wv(this),Lv++;let e=Nv;return Nv=this,Yv.bind(this,e)},Xv.prototype.N=function(){2&this.f||(this.f|=2,this.u=Pv,Pv=this)},Xv.prototype.d=function(){this.f|=8,1&this.f||Jv(this)},Xv.prototype.dispose=function(){this.d()};function Qv(e){return(typeof e.nodes==`function`?e.nodes():e.nodes)||[]}od(`format`,{parse:e=>typeof e==`number`?e:0});function $v(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ey(e,t){if(e&&t&&!Array.isArray(t)&&typeof e==`object`&&typeof t==`object`){let n=e,r=t;for(let e in r)n[e]=ey(n[e],r[e]);return e}return t}var ty=0,ny=1,ry=2,iy=3,ay=4,oy=5,sy=6,cy=7;function ly(e){return e.id===ty}function uy(e){return e.id===ry}function dy(e){return function(e){return e.id===ny}(e)||$v(305,String(e.id),String(ny)),Object.assign(e,{id:ry})}var fy=new Set,py=class{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:ty}}mergeConfigs(){let e=this.extension.config||{},t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):K_;for(let n of this.configs)e=t(e,n);return e}init(e){let t=this.state;uy(t)||$v(306,String(t.id));let n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:iy,registerState:n})}(t,this.mergeConfigs(),n),a;this.state=i,this.extension.init&&(a=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:ay,initResult:t,registerState:n})}(i,a,r)}build(e){let t=this.state,n;t.id!==ay&&$v(307,String(t.id),String(oy)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));let r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:oy,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;let n=this.state;n.id!==oy&&$v(308,String(n.id),String(oy));let r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:sy})}(n),()=>{let e=this.state;e.id!==cy&&$v(309,String(n.id),String(cy)),this.state=function(e){return Object.assign(e,{id:oy})}(e),r&&r()}}afterRegistration(e){let t=this.state,n;return t.id!==sy&&$v(310,String(t.id),String(sy)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:cy})}(t),n}getSignal(){return this._signal===void 0&&$v(311),this._signal}getInitResult(){this.extension.init===void 0&&$v(312,this.extension.name);let e=this.state;return function(e){return e.id>=ay}(e)||$v(313,String(e.id),String(ay)),e.initResult}getInitPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){let e=this.state;return function(e){return e.id>=iy}(e)||$v(314,String(e.id),String(iy)),{config:e.config}}getPeer(e){let t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&$v(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){let t=this.builder.getExtensionRep(e);return t===void 0&&$v(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){let e=this.state;return function(e){return e.id>=cy}(e)||$v(316,String(e.id),String(cy)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||fy}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){let e=this.state;(function(e){return e.id>=oy})(e)||$v(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}},my={tag:Dp};function hy(){let e=qh();e.isEmpty()&&e.append(gh())}var gy=W_({config:G_({setOptions:my,updateOptions:my}),init:({$initialEditorState:e=hy})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){let i=r.getInitResult();if(!i.initialized){i.initialized=!0;let{$initialEditorState:r}=i;if(Bee(r))e.setEditorState(r,n);else if(typeof r==`function`)e.update(()=>{r(e)},t);else if(r&&(typeof r==`string`||typeof r==`object`)){let t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:`@lexical/extension/InitialState`,nodes:[lh,Hp,jp,$p,hh]}),_y=Symbol.for(`@lexical/extension/LexicalBuilder`);function vy(){}function yy(e){throw e}function by(e){return Array.isArray(e)?e:[e]}var xy=`0.43.0+prod.esm`,Sy=class e{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=xy,this.roots=e;for(let t of e)this.addExtension(t)}static fromExtensions(t){let n=[by(gy)];for(let e of t)n.push(by(e));return new e(n)}static maybeFromEditor(t){let n=t[_y];return n&&(n.PACKAGE_VERSION!==xy&&$v(292,n.PACKAGE_VERSION,xy),n instanceof e||$v(293)),n}static fromEditor(t){let n=e.maybeFromEditor(t);return n===void 0&&$v(294),n}constructEditor(){let{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(yh({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[_y]:this});for(let e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let e=vy;function t(){try{e()}finally{e=vy}}let n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=Y_(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){let t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&$v(295,e.name),t}addEdge(e,t,n){let r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));let i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){this._sortedExtensionReps!==void 0&&$v(296);let[t]=by(e);typeof t.name!=`string`&&$v(297,typeof t.name);let n=this.extensionNameMap.get(t.name);if(n!==void 0&&n.extension!==t&&$v(298,t.name),!n){n=new py(this,t),this.extensionNameMap.set(t.name,n);let e=this.conflicts.get(t.name);typeof e==`string`&&$v(299,t.name,e);for(let e of t.conflictsWith||[])this.extensionNameMap.has(e)&&$v(299,t.name,e),this.conflicts.set(e,t.name);for(let e of t.dependencies||[]){let n=by(e);this.addEdge(t.name,n[0].name,n.slice(1)),this.addExtension(n)}for(let[e,n]of t.peerDependencies||[])this.addEdge(t.name,e,n?[n]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;let e=[],t=(n,r)=>{let i=n.state;if(uy(i))return;let a=n.extension.name;var o;ly(i)||$v(300,a,r||`[unknown]`),ly(o=i)||$v(304,String(o.id),String(ty)),i=Object.assign(o,{id:ny}),n.state=i;let s=this.outgoingConfigEdges.get(a);if(s)for(let e of s.keys()){let n=this.extensionNameMap.get(e);n&&t(n,a)}i=dy(i),n.state=i,e.push(n)};for(let e of this.extensionNameMap.values())ly(e.state)&&t(e);for(let t of e)for(let[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){let t=this.extensionNameMap.get(e);if(t)for(let e of n)t.configs.add(e)}for(let[e,...t]of this.roots)if(t.length>0){let n=this.extensionNameMap.get(e.name);n===void 0&&$v(301,e.name);for(let e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){let t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],i=n.signal;for(let n of t){let t=n.register(e,i);t&&r.push(t)}for(let n of t){let t=n.afterRegistration(e);t&&r.push(t)}return Y_(...r)}buildCreateEditorArgs(){let e={},t=new Set,n=new Map,r=new Map,i={},a={},o=this.sortedExtensionReps();for(let s of o){let{extension:o}=s;if(o.onError!==void 0&&(e.onError=o.onError),o.disableEvents!==void 0&&(e.disableEvents=o.disableEvents),o.parentEditor!==void 0&&(e.parentEditor=o.parentEditor),o.editable!==void 0&&(e.editable=o.editable),o.namespace!==void 0&&(e.namespace=o.namespace),o.$initialEditorState!==void 0&&(e.$initialEditorState=o.$initialEditorState),o.nodes)for(let e of Qv(o)){if(typeof e!=`function`){let t=n.get(e.replace);t&&$v(302,o.name,e.replace.name,t.extension.name),n.set(e.replace,s)}t.add(e)}if(o.html){if(o.html.export)for(let[e,t]of o.html.export.entries())r.set(e,t);o.html.import&&Object.assign(i,o.html.import)}o.theme&&ey(a,o.theme)}Object.keys(a).length>0&&(e.theme=a),t.size&&(e.nodes=[...t]);let s=Object.keys(i).length>0,c=r.size>0;(s||c)&&(e.html={},s&&(e.html.import=i),c&&(e.html.export=r));for(let t of o)t.init(e);return e.onError||=yy,e}},Cy=class e extends sh{static getType(){return`horizontalrule`}static clone(t){return new e(t.__key)}static importJSON(e){return Ty().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:wy,priority:0})}}exportDOM(){return{element:document.createElement(`hr`)}}createDOM(e){let t=document.createElement(`hr`);return J_(t,e.theme.hr),t}getTextContent(){return`
|
|
13
|
+
`}isInline(){return!1}updateDOM(){return!1}};function wy(){return{node:Ty()}}function Ty(){return Xg(Cy)}var Ey=W_({name:`@lexical/react/ReactProvider`}),Dy=e(v(),1);function Oy(e){let t=window.location.origin,n=n=>{if(n.origin!==t)return;let r=e.getRootElement();if(document.activeElement!==r)return;let i=n.data;if(typeof i==`string`){let t;try{t=JSON.parse(i)}catch{return}if(t&&t.protocol===`nuanria_messaging`&&t.type===`request`){let r=t.payload;if(r&&r.functionId===`makeChanges`){let t=r.args;if(t){let[r,i,a,o,s]=t;e.update(()=>{let e=J();if(q(e)){let t=e.anchor,c=t.getNode(),l=0,u=0;if(K(c)&&r>=0&&i>=0&&(l=r,u=r+i,e.setTextNodeRange(c,l,c,u)),l===u&&a===``||(e.insertRawText(a),c=t.getNode()),K(c)){l=o,u=o+s;let t=c.getTextContentSize();l=l>t?t:l,u=u>t?t:u,e.setTextNodeRange(c,l,c,u)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener(`message`,n,!0),()=>{window.removeEventListener(`message`,n,!0)}}function ky(e,t){if(typeof document>`u`||typeof window>`u`&&global.window===void 0)throw Error(`To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.`);let n=document.createElement(`div`),r=qh().getChildren();for(let i=0;i<r.length;i++)Ay(e,r[i],n,t);return n.innerHTML}function Ay(e,t,n,r=null){let i=r===null||t.isSelected(r),a=Y(t)&&t.excludeFromCopy(`html`),o=t;r!==null&&K(t)&&(o=nv(r,t,`clone`));let s=Y(o)?o.getChildren():[],c=Th(e,o.getType()),l;l=c&&c.exportDOM!==void 0?c.exportDOM(e,o):o.exportDOM(e);let{element:u,after:d}=l;if(!u)return!1;let f=document.createDocumentFragment();for(let n=0;n<s.length;n++){let a=s[n],o=Ay(e,a,f,r);!i&&Y(t)&&o&&t.extractWithChild(a,r,`html`)&&(i=!0)}if(i&&!a){if((Pg(u)||Ig(u))&&u.append(f),n.append(u),d){let e=d.call(o,u);e&&(Ig(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(f);return i}function jy(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function My(e,t=J()){return t??jy(166),q(t)&&t.isCollapsed()||t.getNodes().length===0?``:ky(e,t)}function Ny(e,t){let n=e.getData(`text/plain`)||e.getData(`text/uri-list`);n!=null&&t.insertRawText(n)}var Py=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Fy=Py&&`documentMode`in document?document.documentMode:null,Iy=Py&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ly=!(!Py||!(`InputEvent`in window)||Fy)&&`getTargetRanges`in new window.InputEvent(`input`),Ry=Py&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,zy=Py&&/Android/.test(navigator.userAgent),By=Py&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!zy,Vy=Py&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Hy=Py&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&Iy&&!Vy;function Uy(e,t){t.update(()=>{if(e!==null){let n=dv(e,KeyboardEvent)?null:e.clipboardData,r=J();if(r!==null&&!r.isCollapsed()&&n!=null){e.preventDefault();let i=My(t);i!==null&&n.setData(`text/html`,i),n.setData(`text/plain`,r.getTextContent())}}})}function Wy(e){return Y_(e.registerCommand(lf,e=>{let t=J();return!!q(t)&&(t.deleteCharacter(e),!0)},0),e.registerCommand(hf,e=>{let t=J();return!!q(t)&&(t.deleteWord(e),!0)},0),e.registerCommand(gf,e=>{let t=J();return!!q(t)&&(t.deleteLine(e),!0)},0),e.registerCommand(ff,e=>{let t=J();if(!q(t))return!1;if(typeof e==`string`)t.insertText(e);else{let n=e.dataTransfer;if(n!=null)Ny(n,t);else{let n=e.data;n&&t.insertText(n)}}return!0},0),e.registerCommand(mf,()=>{let e=J();return!!q(e)&&(e.removeText(),!0)},0),e.registerCommand(uf,e=>{let t=J();return!!q(t)&&(t.insertLineBreak(e),!0)},0),e.registerCommand(df,()=>{let e=J();return!!q(e)&&(e.insertLineBreak(),!0)},0),e.registerCommand(Cf,e=>{let t=J();if(!q(t))return!1;let n=e,r=n.shiftKey;return!!av(t,!0)&&(n.preventDefault(),cv(t,r,!0),!0)},0),e.registerCommand(xf,e=>{let t=J();if(!q(t))return!1;let n=e,r=n.shiftKey;return!!av(t,!1)&&(n.preventDefault(),cv(t,r,!1),!0)},0),e.registerCommand(kf,t=>!!q(J())&&(!Ry||navigator.language!==`ko-KR`)&&(t.preventDefault(),e.dispatchCommand(lf,!0)),0),e.registerCommand(jf,t=>!!q(J())&&(t.preventDefault(),e.dispatchCommand(lf,!1)),0),e.registerCommand(Df,t=>{if(!q(J()))return!1;if(t!==null){if((Ry||By||Hy)&&Ly)return!1;t.preventDefault()}return e.dispatchCommand(uf,!1)},0),e.registerCommand(zf,()=>(dg(),!0),0),e.registerCommand(Lf,t=>!!q(J())&&(Uy(t,e),!0),0),e.registerCommand(Rf,t=>!!q(J())&&(function(e,t){Uy(e,t),t.update(()=>{let e=J();q(e)&&e.removeText()})}(t,e),!0),0),e.registerCommand(pf,t=>!!q(J())&&(function(e,t){e.preventDefault(),t.update(()=>{let t=J(),n=dv(e,ClipboardEvent)?e.clipboardData:null;n!=null&&q(t)&&Ny(n,t)},{tag:`paste`})}(t,e),!0),0),e.registerCommand(Nf,e=>!!q(J())&&(e.preventDefault(),!0),0),e.registerCommand(Pf,e=>!!q(J())&&(e.preventDefault(),!0),0))}function Gy(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}var Ky=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0?H.useLayoutEffect:H.useEffect;function qy({editor:e,ErrorBoundary:t}){return function(e,t){let[n,r]=(0,H.useState)(()=>e.getDecorators());return Ky(()=>e.registerDecoratorListener(e=>{(0,Dy.flushSync)(()=>{r(e)})}),[e]),(0,H.useEffect)(()=>{r(e.getDecorators())},[e]),(0,H.useMemo)(()=>{let r=[],i=Object.keys(n);for(let a=0;a<i.length;a++){let o=i[a],s=(0,U.jsx)(t,{onError:t=>e._onError(t),children:(0,U.jsx)(H.Suspense,{fallback:null,children:n[o]})}),c=e.getElementByKey(o);c!==null&&r.push((0,Dy.createPortal)(s,c,o))}return r},[t,n,e])}(e,t)}function Jy({editor:e,ErrorBoundary:t}){return function(e){let t=Sy.maybeFromEditor(e);if(t&&t.hasExtensionByName(Ey.name)){for(let e of[`@lexical/plain-text`,`@lexical/rich-text`])t.hasExtensionByName(e)&&Gy(320,e);return!0}return!1}(e)?null:(0,U.jsx)(qy,{editor:e,ErrorBoundary:t})}function Yy(e){return e.getEditorState().read($_(e.isComposing()))}function Xy({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){let[r]=gu();return function(e){Ky(()=>Y_(Wy(e),Oy(e)),[e])}(r),(0,U.jsxs)(U.Fragment,{children:[e,(0,U.jsx)(Zy,{content:t}),(0,U.jsx)(Jy,{editor:r,ErrorBoundary:n})]})}function Zy({content:e}){let[t]=gu(),n=function(e){let[t,n]=(0,H.useState)(()=>Yy(e));return Ky(()=>{function t(){n(Yy(e))}return t(),Y_(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),r=Av();return n?typeof e==`function`?e(r):e:null}var Qy=[`mx-[2px]`,`inline-flex`,`h-6`,`max-w-full`,`items-center`,`gap-1.5`,`rounded-[7px]`,`border`,`border-border/70`,`bg-background/80`,`px-1.5`,`align-middle`,`text-[11px]`,`font-medium`,`leading-none`,`text-foreground`].join(` `),$y=new Set([`c`,`cpp`,`css`,`go`,`html`,`java`,`js`,`jsx`,`md`,`php`,`py`,`rb`,`rs`,`sh`,`sql`,`svelte`,`swift`,`ts`,`tsx`,`vue`]),eb=new Set([`graphql`,`json`,`toml`,`xml`,`yaml`,`yml`]),tb=new Set([`avif`,`bmp`,`gif`,`heic`,`heif`,`ico`,`jpeg`,`jpg`,`png`,`svg`,`tif`,`tiff`,`webp`]),nb=new Set([`aac`,`flac`,`m4a`,`mp3`,`ogg`,`opus`,`wav`,`weba`]),rb=new Set([`avi`,`m4v`,`mkv`,`mov`,`mp4`,`webm`,`wmv`]),ib=new Set([`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]),ab=new Set([`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`zip`]),ob=new Set([`doc`,`docx`,`odt`,`pages`,`pdf`,`rtf`,`txt`]);function sb(e){return/\.([a-z0-9]{1,16})$/i.exec(e.trim())?.[1]?.toLowerCase()??``}function cb(e){let t=sb(e);return eb.has(t)?{icon:Ba,name:`data-file`}:tb.has(t)?{icon:za,name:`image-file`}:nb.has(t)?{icon:La,name:`audio-file`}:rb.has(t)?{icon:Ua,name:`video-file`}:ib.has(t)?{icon:Ha,name:`sheet-file`}:ab.has(t)?{icon:Ia,name:`archive-file`}:$y.has(t)?{icon:Ra,name:`code-file`}:ob.has(t)?{icon:Wn,name:`document-file`}:{icon:Wa,name:`file`}}function lb(e,t){return e===`skill`?{icon:Ir,name:`skill`}:e===`panel_app`?{icon:fi,name:`panel-app`}:e===`ui_resource`?t.startsWith(`nextclaw://panel-app`)?{icon:fi,name:`panel-app`}:t.startsWith(`nextclaw://docs`)?{icon:lee,name:`docs`}:t.startsWith(`nextclaw://apps`)?{icon:cee,name:`apps`}:{icon:Ma,name:`web-resource`}:e===`project`?{icon:Ka,name:`project`}:e===`workspace_directory`?{icon:Qa,name:`directory`}:e===`workspace_excerpt`?{icon:ps,name:`excerpt`}:e===`conversation_excerpt`?{icon:To,name:`conversation-excerpt`}:e===`workspace_file`||e===`file`?cb(t):{icon:go,name:`reference`}}function ub({className:e,kind:t,source:n}){let r=lb(t,n??``),i=r.icon;return(0,U.jsx)(i,{"aria-hidden":`true`,className:W(`h-3 w-3`,e),"data-reference-icon":r.name})}function db(e){return Array.from(e).length}function fb(e){let{characterCountTemplate:t,endLine:n,excerpt:r,startLine:i}=e,a=i?i===n||!n?`L${i}`:`L${i}–${n}`:null,o=t?.replace(`{count}`,String(db(r)));return{characterCountLabel:o,location:a,metricLabel:a??o}}function pb({excerpt:e,kind:t,label:n,metricLabel:r,source:i}){let a=e?.replace(/\s+/g,` `).trim()??``,o=Array.from(a),s=o.length>64?`${o.slice(0,64).join(``).trimEnd()}…`:a;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-muted-foreground`,"data-reference-kind":t,children:(0,U.jsx)(ub,{kind:t,source:i??n})}),(0,U.jsx)(`span`,{className:e?`max-w-[10rem] shrink truncate`:`max-w-[16rem] truncate`,children:n}),r?(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] font-normal text-muted-foreground`,children:r}):null,s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-muted-foreground/60`,children:`·`}),(0,U.jsx)(`span`,{className:`min-w-[3rem] max-w-[14rem] truncate font-normal text-foreground/70`,children:s})]}):null]})}function mb({children:e,characterCountLabel:t,excerpt:n,kind:r=`workspace_file`,label:i,location:a,path:o}){let{Tooltip:s,TooltipContent:c,TooltipProvider:l,TooltipTrigger:u}=Nl;return(0,U.jsx)(l,{delayDuration:300,children:(0,U.jsxs)(s,{children:[(0,U.jsx)(u,{asChild:!0,children:e}),(0,U.jsxs)(c,{side:`top`,align:`start`,collisionPadding:12,className:`w-fit min-w-[min(14rem,calc(100vw-1.5rem))] max-w-[min(28rem,calc(100vw-1.5rem))] p-0 text-left`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 border-b border-border/70 px-3 py-2`,children:[(0,U.jsx)(ub,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`,kind:r,source:o??i}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:o||i}),a?(0,U.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:a}):null,t?(0,U.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:t}):null]}),(0,U.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words px-3 py-2.5 font-mono text-[11px] font-normal leading-5 text-popover-foreground`,children:n})]})]})})}var hb=(0,H.createContext)({});function gb({children:e,excerptCharacterCountTemplate:t,removeTokenLabel:n}){return(0,U.jsx)(hb.Provider,{value:{excerptCharacterCountTemplate:t,removeTokenLabel:n},children:e})}function _b(e){let t=[`selection:bg-transparent`,`selection:text-current`,`group/composer-token`,`data-[composer-selected=true]:shadow-[0_0_0_2px_var(--interaction-selection,Highlight)]`];return e===`file`?[`mx-[2px] inline-flex h-6 items-center gap-1.5 rounded-[7px] border px-1.5 align-middle leading-none`,...t,`max-w-[min(100%,17rem)]`,`border-border`,`bg-muted`,`text-foreground`].join(` `):[Qy,...t].join(` `)}function vb({data:e,label:t}){let{excerptCharacterCountTemplate:n}=(0,H.useContext)(hb),r=typeof e?.excerpt==`string`?e.excerpt:``,i=typeof e?.path==`string`?e.path:null,a=typeof e?.startLine==`number`?e.startLine:null,{characterCountLabel:o,location:s,metricLabel:c}=fb({characterCountTemplate:n,endLine:typeof e?.endLine==`number`?e.endLine:null,excerpt:r,startLine:a}),l=(0,U.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:(0,U.jsx)(pb,{excerpt:r,kind:`workspace_excerpt`,label:t,metricLabel:c,source:i})});return r?(0,U.jsx)(mb,{excerpt:r,characterCountLabel:o,label:t,location:s,path:i,children:l}):l}function yb({data:e,label:t}){let n=typeof e?.excerpt==`string`?e.excerpt:``,r=(0,U.jsx)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5`,children:(0,U.jsx)(pb,{excerpt:n,kind:`conversation_excerpt`,label:t})});return n?(0,U.jsx)(mb,{excerpt:n,kind:`conversation_excerpt`,label:t,children:r}):r}function bb({children:e,onRemove:t}){let{removeTokenLabel:n}=(0,H.useContext)(hb),[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1);if(!n)return e;let s=r||a,{Tooltip:c,TooltipContent:l,TooltipProvider:u,TooltipTrigger:d}=Nl;return(0,U.jsxs)(`span`,{className:`relative -mx-1.5 inline-flex h-full min-w-0 items-center px-1.5`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||i(!1)},onFocus:()=>i(!0),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,U.jsx)(`span`,{className:`inline-flex h-full min-w-0 items-center gap-1.5 ${s?`[mask-image:linear-gradient(to_right,black_calc(100%_-_2.5rem),transparent_calc(100%_-_1.25rem))] [-webkit-mask-image:linear-gradient(to_right,black_calc(100%_-_2.5rem),transparent_calc(100%_-_1.25rem))]`:``}`,"data-composer-token-content":`true`,children:e}),(0,U.jsx)(u,{delayDuration:300,children:(0,U.jsxs)(c,{children:[(0,U.jsx)(d,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":n,className:`${s?`pointer-events-auto opacity-100`:`pointer-events-none opacity-0`} absolute right-0.5 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-full border border-border/70 bg-transparent text-muted-foreground transition-[background-color,border-color,color,opacity] hover:border-border hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},children:(0,U.jsx)(Ai,{"aria-hidden":`true`,className:`h-3 w-3`})})}),(0,U.jsx)(l,{side:`top`,className:`text-xs`,children:n})]})})]})}function xb({data:e,label:t,onRemove:n,previewUrl:r,tokenKey:i,tokenKind:a}){let[o,s]=(0,H.useState)(!1),c;if(a===`workspace_excerpt`)c=(0,U.jsx)(vb,{data:e,label:t});else if(a===`conversation_excerpt`)c=(0,U.jsx)(yb,{data:e,label:t});else if(a!==`file`){let n=e?.reference&&typeof e.reference==`object`?e.reference:null;c=(0,U.jsx)(pb,{kind:a,label:t,source:typeof e?.path==`string`?e.path:a===`ui_resource`&&typeof n?.uri==`string`?n.uri:i})}else c=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`relative inline-flex h-4 w-4 shrink-0 items-center justify-center overflow-hidden rounded-[4px] bg-card text-muted-foreground ring-1 ring-border`,children:[(0,U.jsx)(ub,{className:`h-3 w-3`,kind:`file`,source:t}),r&&!o?(0,U.jsx)(`img`,{alt:``,className:`absolute inset-0 h-full w-full object-cover`,onError:()=>s(!0),src:r}):null]}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium text-foreground`,children:t})]});return(0,U.jsx)(bb,{onRemove:n,children:c})}var Sb=class e extends sh{static getType(){return`chat-composer-token`}static clone(t){return new e(t.__composerId,t.__tokenKind,t.__tokenKey,t.__label,t.__previewUrl,t.__data,t.__key)}static importJSON(e){return Cb({composerId:e.composerId,data:e.data,label:e.label,previewUrl:e.previewUrl,tokenKey:e.tokenKey,tokenKind:e.tokenKind})}constructor(e,t,n,r,i,a,o){super(o),this.applyTokenDom=e=>{e.contentEditable=`false`,e.dataset.composerNodeId=this.__composerId,e.dataset.composerNodeType=`token`,e.dataset.composerTokenKind=this.__tokenKind,e.dataset.composerTokenKey=this.__tokenKey,e.dataset.composerLabel=this.__label,this.__tokenKind===`workspace_excerpt`||this.__tokenKind===`conversation_excerpt`?e.removeAttribute(`title`):e.title=this.__label,e.className=_b(this.__tokenKind)},this.createDOM=(e,t)=>{let n=document.createElement(`span`);return this.applyTokenDom(n),n},this.updateDOM=(e,t)=>(this.applyTokenDom(t),!1),this.decorate=e=>{let t=this.getKey();return(0,U.jsx)(xb,{data:this.__data,label:this.__label,onRemove:()=>{e.update(()=>{let e=Vh(t);wb(e)&&(e.selectNext(),e.remove())}),e.focus()},previewUrl:this.__previewUrl,tokenKey:this.__tokenKey,tokenKind:this.__tokenKind})},this.exportJSON=()=>({composerId:this.__composerId,data:this.__data,label:this.__label,previewUrl:this.__previewUrl,tokenKey:this.__tokenKey,tokenKind:this.__tokenKind,type:`chat-composer-token`,version:1}),this.getComposerId=()=>this.getLatest().__composerId,this.getTokenKind=()=>this.getLatest().__tokenKind,this.getTokenKey=()=>this.getLatest().__tokenKey,this.getLabel=()=>this.getLatest().__label,this.getPreviewUrl=()=>this.getLatest().__previewUrl,this.getData=()=>this.getLatest().__data,this.getTextContent=()=>``,this.isInline=()=>!0,this.isIsolated=()=>!0,this.isKeyboardSelectable=()=>!1,this.__composerId=e,this.__tokenKind=t,this.__tokenKey=n,this.__label=r,this.__previewUrl=i,this.__data=a}};function Cb(e){let{composerId:t,data:n,label:r,previewUrl:i,tokenKey:a,tokenKind:o}=e;return Dg(new Sb(t,o,a,r,i,n))}function wb(e){return e instanceof Sb}function Tb(e,t){let n=t.selection?.start??0,r=t.selection?.end??0,i=new Set,a=0;for(let e of t.nodes){let t=e.type===`text`?e.text.length:1;e.type===`token`&&n<a+t&&r>a&&i.add(e.id),a+=t}e.querySelectorAll(`[data-composer-node-type="token"]`).forEach(e=>{let t=i.has(e.dataset.composerNodeId??``);if(e.dataset.composerSelected!==String(t)){if(e.dataset.composerSelected=String(t),t){e.style.setProperty(`background-color`,`var(--interaction-selection)`,`important`),e.style.setProperty(`border-color`,`var(--interaction-selection-border)`,`important`);return}e.style.removeProperty(`background-color`),e.style.removeProperty(`border-color`)}})}var Eb=`nextclaw-chat-composer-external-update`;function Db(){let e=qh(),t=e.getFirstChild();if(!Y(t))return{descriptors:[],paragraphKey:e.getKey(),paragraphSize:0,totalLength:0};let n=t.getChildren(),r=[],i=0;for(let[e,t]of n.entries()){if(K(t)){let n=t.getTextContent();r.push({index:e,key:t.getKey(),length:n.length,node:t,start:i,text:n,type:`text`}),i+=n.length;continue}if(wb(t)){r.push({index:e,key:t.getKey(),length:1,node:t,start:i,type:`token`}),i+=1;continue}r.push({index:e,key:t.getKey(),length:t.getTextContent().length,node:t,start:i,type:`linebreak`}),i+=t.getTextContent().length}return{descriptors:r,paragraphKey:t.getKey(),paragraphSize:n.length,totalLength:i}}function Ob(e){let{descriptors:t,paragraphKey:n,paragraphSize:r,totalLength:i}=Db(),a=Math.max(0,Math.min(e,i));if(t.length===0)return{key:n,offset:0,type:`element`};for(let e of t){let r=e.start+e.length;if(e.type===`text`&&a>=e.start&&a<=r)return{key:e.key,offset:a-e.start,type:`text`};if(e.type!==`text`){if(a===e.start)return{key:n,offset:e.index,type:`element`};if(a===r){let r=t[e.index+1];return r?.type===`text`&&r.length===0?{key:r.key,offset:0,type:`text`}:{key:n,offset:e.index+1,type:`element`}}}}return{key:n,offset:r,type:`element`}}function kb(e){let{descriptors:t,paragraphKey:n,totalLength:r}=Db();if(e.key===n){let n=t[e.offset-1];return n?n.start+n.length:0}let i=t.find(t=>t.key===e.key);return i?i.start+Math.min(e.offset,i.length):r}function Ab(e){if(e.type===`element`)return kb(e);let{descriptors:t,totalLength:n}=Db(),r=t.find(t=>t.key===e.key);return r?r.start+Math.min(e.offset,r.length):n}function jb(){let{descriptors:e}=Db(),t=[],n=``,r=``,i=()=>{n.length!==0&&(t.push({id:r,type:`text`,text:n}),n=``,r=``)};for(let a of e){if(a.type===`text`){n.length===0&&(r=a.key),n+=a.text;continue}if(a.type===`linebreak`){n.length===0&&(r=a.key),n+=`
|
|
14
|
+
`;continue}i();let e=a.node;t.push({id:e.getComposerId(),data:e.getData(),label:e.getLabel(),previewUrl:e.getPreviewUrl(),tokenKey:e.getTokenKey(),tokenKind:e.getTokenKind(),type:`token`})}return i(),Sc(t)}function Mb(e){return e.read(()=>{let e=J(),t=jb();return q(e)?{nodes:t,selection:{start:Math.min(Ab(e.anchor),Ab(e.focus)),end:Math.max(Ab(e.anchor),Ab(e.focus))}}:{nodes:t,selection:null}})}function Nb(e){let t=J();if(!q(t))return!1;let n=[];for(let t of e){if(t.type===`token`){n.push(Cb({composerId:t.id,data:t.data,label:t.label,previewUrl:t.previewUrl,tokenKey:t.tokenKey,tokenKind:t.tokenKind}));continue}let e=t.text.split(`
|
|
15
|
+
`);for(let[t,r]of e.entries())r&&n.push(Zp(r)),t<e.length-1&&n.push(Np())}return n.length===0?!1:(t.insertNodes(n),!0)}function Pb(e,t){let n=qh();n.clear();let r=gh();n.append(r);for(let t of Sc(e)){if(t.type===`token`){r.append(Cb({composerId:t.id,data:t.data,label:t.label,previewUrl:t.previewUrl,tokenKey:t.tokenKey,tokenKind:t.tokenKind}));continue}let e=t.text.split(`
|
|
16
|
+
`);for(let[t,n]of e.entries())n.length>0&&r.append(Zp(n)),t<e.length-1&&r.append(Np())}if(wb(r.getLastChild())&&r.append(Zp(``)),!t)return;let i=ym(),a=Ob(t.start),o=Ob(t.end);i.anchor.set(a.key,a.offset,a.type),i.focus.set(o.key,o.offset,o.type),Yh(i)}function Fb(e,t,n,r=!1){e.update(()=>{Pb(t,n)},{tag:r?[Eb,Op]:Eb})}function Ib(e,t,n=!1){e.update(()=>{let e=ym(),n=Ob(t.start),r=Ob(t.end);e.anchor.set(n.key,n.offset,n.type),e.focus.set(r.key,r.offset,r.type),Yh(e)},{tag:n?[Eb,Op]:Eb})}function Lb(e){return e.reduce((e,t)=>e+yc(t),0)}function Rb(e){let{data:t,label:n,nodes:r,previewUrl:i,selection:a,tokenKey:o,tokenKind:s,trigger:c}=e,l=Lb(r),[u,d]=a?[Math.min(a.start,a.end),Math.max(a.start,a.end)]:[l,l],f=c?.start??u;return{nodes:jc(r,f,c?.end??d,[vc({label:n,data:t,previewUrl:i,tokenKey:o,tokenKind:s})]),selection:{start:f+1,end:f+1}}}function zb(e){let{data:t,label:n,nodes:r,selection:i,tokenKey:a,tokenKind:o,triggerSpecs:s}=e;return Tc(r,o).includes(a)?{nodes:Sc(r),selection:i}:Rb({label:n,data:t,nodes:r,selection:i,tokenKey:a,tokenKind:o,trigger:Fc(r,i,s??[hc])})}function Bb(e){let{item:t,nodes:n,selection:r,triggerSpecs:i}=e,a=t.tokenKind??(t.value?`skill`:void 0),o=t.tokenKey??t.value;if(!a||!o){let e=Fc(n,r,i??[hc]);return e?{nodes:Sc(jc(n,e.start,e.end,[])),selection:{start:e.start,end:e.start}}:{nodes:Sc(n),selection:r}}return zb({data:t.data,label:t.title,nodes:n,selection:r,tokenKey:o,tokenKind:a,triggerSpecs:i})}function Vb(e){return e.map(e=>e.type===`text`?`text:${e.text}`:`token:${e.tokenKind}:${e.tokenKey}:${e.label}:${e.previewUrl??``}:${JSON.stringify(e.data??null)}`).join(``)}function Hb(e){let{label:t,nodes:n,previewUrl:r,selection:i,tokenKey:a}=e;return Rb({label:t,nodes:n,previewUrl:r,selection:i,tokenKey:a,tokenKind:`file`})}function Ub(e){let{label:t,nodes:n,selection:r,tokenKey:i}=e;return Tc(n,`skill`).includes(i)?{nodes:Sc(n),selection:r}:Rb({label:t,nodes:n,selection:r,tokenKey:i,tokenKind:`skill`,trigger:Ic(n,r)})}function Wb(e){let{nextKeys:t,nodes:n,options:r,selection:i}=e,a=Tc(n,`skill`),o=new Map(r.map(e=>[e.key,e])),s=t.find(e=>!a.includes(e));if(s)return Ub({label:o.get(s)?.label??s,nodes:n,selection:i,tokenKey:s});let c=a.find(e=>!t.includes(e));return c?{nodes:Mc(n,e=>e.tokenKind===`skill`&&e.tokenKey===c),selection:i}:{nodes:Sc(n),selection:i}}function Gb(e){if(e.key!==`Backspace`&&e.key!==`Delete`)return!1;let t=J();if(q(t)&&!t.isCollapsed())return!1;let n=null;if(q(t)){let{anchor:r}=t,i=r.getNode();if(r.type===`element`&&Y(i)){let t=e.key===`Backspace`?r.offset-1:r.offset;n=i.getChildAtIndex(t)}else e.key===`Backspace`&&r.offset===0?n=i.getPreviousSibling():e.key===`Delete`&&r.offset===i.getTextContentSize()&&(n=i.getNextSibling())}else if(e.key===`Backspace`){let e=qh().getFirstChild();n=Y(e)?e.getLastChild():null}return K(n)&&n.getTextContentSize()===0&&(n=e.key===`Backspace`?n.getPreviousSibling():n.getNextSibling()),wb(n)?(e.preventDefault(),n.remove(),!0):!1}function Kb(e){let{canStopGeneration:t,isComposing:n,isSending:r,key:i,metaKey:a=!1,ctrlKey:o=!1,shiftKey:s}=e;return n?{type:`noop`}:i===`Escape`?r&&t?{type:`stop-generation`}:{type:`noop`}:i===`Enter`&&!s?a||o?{type:`send-alternate`}:{type:`send-message`}:{type:`noop`}}function qb(e){let{actions:t,isComposing:n,nativeEvent:r}=e,i=Kb({canStopGeneration:t.canStopGeneration,isComposing:n,isSending:t.isSending,key:r.key,metaKey:r.metaKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey});switch(i.type!==`noop`&&r.preventDefault(),i.type){case`stop-generation`:return t.onStop(),!0;case`send-message`:return t.onSend(),!0;case`send-alternate`:return(t.onAlternateSend??t.onSend)(),!0;case`noop`:return!1}}var Jb=`application/x-nextclaw-chat-composer+json`,Yb=1,Xb=1e6,Zb=1e3,Qb=1e5;function $b(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function ex(e){return typeof e==`string`&&e.length>0&&e.length<=Qb?e:null}function tx(e){return e===void 0?void 0:typeof e==`string`&&e.length<=Qb?e:null}function nx(e){return vc({data:e.data,label:e.label,previewUrl:e.previewUrl,tokenKey:e.tokenKey,tokenKind:e.tokenKind})}function rx(e,t,n){let r=Math.max(0,Math.min(t,n)),i=Math.max(r,Math.max(t,n)),a=[],o=0;for(let t of e){let e=o,n=e+yc(t);if(o=n,n<=r||e>=i)continue;if(t.type===`token`){a.push(nx(t));continue}let s=Math.max(0,r-e),c=Math.min(t.text.length,i-e);c>s&&a.push(_c(t.text.slice(s,c)))}return a.length>0?Sc(a):[]}function ix(e){return e.type===`text`?{type:`text`,text:e.text}:{type:`token`,tokenKind:e.tokenKind,tokenKey:e.tokenKey,label:e.label,previewUrl:e.previewUrl,data:e.data}}function ax(e){let t={version:Yb,nodes:e.map(ix)};return JSON.stringify(t)}function ox(e){if(!$b(e))return null;if(e.type===`text`){let t=tx(e.text);return typeof t==`string`?_c(t):null}if(e.type!==`token`)return null;let t=ex(e.tokenKind),n=ex(e.tokenKey),r=ex(e.label),i=tx(e.previewUrl),a=e.data===void 0?void 0:$b(e.data)?e.data:null;return!t||!n||!r||i===null||a===null?null:vc({data:a,label:r,previewUrl:i,tokenKey:n,tokenKind:t})}function sx(e){if(!e||e.length>Xb)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!$b(t)||t.version!==Yb||!Array.isArray(t.nodes)||t.nodes.length===0||t.nodes.length>Zb)return null;let n=[];for(let e of t.nodes){let t=ox(e);if(!t)return null;n.push(t)}return Sc(n)}function cx(e){if(e.tokenKind!==`workspace_excerpt`||typeof e.data?.excerpt!=`string`)return null;let t=typeof e.data.startLine==`number`?e.data.startLine:null,n=typeof e.data.endLine==`number`?e.data.endLine:null,r=t?t===n||!n?` L${t}`:` L${t}–${n}`:``;return`[${e.label}${r}]\n${e.data.excerpt}`}function lx(e){return e.tokenKind===`conversation_excerpt`&&typeof e.data?.excerpt==`string`?`[${e.label}]\n${e.data.excerpt}`:null}function ux(e){return e.map(e=>e.type===`text`?e.text:cx(e)??lx(e)??`@${e.label}`).join(``)}function dx(e){return!!(e&&`clipboardData`in e)}var fx=class{constructor(e){this.editor=e,this.register=()=>Y_(this.editor.registerCommand(Lf,e=>this.handleCopy(e,!1),3),this.editor.registerCommand(Rf,e=>this.handleCopy(e,!0),3),this.editor.registerCommand(pf,this.handlePaste,3)),this.handleCopy=(e,t)=>{if(!dx(e)||!e.clipboardData)return!1;let n=Mb(this.editor.getEditorState());if(!n.selection||n.selection.start===n.selection.end)return!1;let r=rx(n.nodes,n.selection.start,n.selection.end);if(!r.some(e=>e.type===`token`))return!1;try{e.clipboardData.setData(`text/plain`,ux(r)),e.clipboardData.setData(Jb,ax(r))}catch{return e.preventDefault(),!0}if(e.preventDefault(),t){let e=J();q(e)&&e.removeText()}return!0},this.handlePaste=e=>{if(!dx(e))return!1;let t=e.clipboardData?.getData(Jb);if(!t)return!1;let n=sx(t);return!n||!Nb(n)?!1:(e.preventDefault(),!0)}}};function px(e){return{current:e}}function mx(e){return e.reduce((e,t)=>e+(t.type===`text`?t.text.length:1),0)}var hx=class{constructor(){this.pendingOwnerSignatureRef=px(null),this.pendingSelectionRef=px(null),this.selectionRef=px(null),this.shouldFocusAfterSyncRef=px(!1),this.editorSignatureRef=px(``),this.lastPublishedSignatureRef=px(``),this.pendingInputSurfaceReasonRef=px(null),this.editor=null,this.runtime=null,this.configureRuntime=e=>{this.runtime=e},this.bindEditor=e=>{this.editor=e;let t=Vb(Mb(e.getEditorState()).nodes);return this.editorSignatureRef.current=t,this.lastPublishedSignatureRef.current=t,()=>{this.editor===e&&(this.editor=null)}},this.registerEditorListeners=e=>Y_(e.registerUpdateListener(({editorState:e,tags:t})=>{let n=this.getRuntime();this.handleEditorUpdate(e,n.callbacks,t)}),e.registerCommand(nf,()=>{let t=this.getRuntime();return this.handleSelectionChange(e,t.callbacks),!1},0),e.registerCommand(Vf,()=>(this.getRuntime().callbacks.onInputSurfaceOpenChange?.(!1),!1),0),e.registerCommand(bf,e=>{let t=this.getRuntime();return this.handleKeyDown({actions:t.actions,callbacks:t.callbacks,event:e})},3),new fx(e).register()),this.syncExternalState=(e,t)=>{if(e.isComposing())return;let n=Vb(t),r=this.pendingSelectionRef.current,i=this.pendingOwnerSignatureRef.current;if(i){if(n===i)this.pendingOwnerSignatureRef.current=null;else if(n!==this.editorSignatureRef.current)return}let a=n!==this.editorSignatureRef.current;if(!a&&!r)return;let o=e.getRootElement()!==document.activeElement;if(a?(this.editorSignatureRef.current=n,this.lastPublishedSignatureRef.current=n,Fb(e,t,r,o)):r&&Ib(e,r,o),r&&(this.selectionRef.current=r,this.pendingSelectionRef.current=null),this.shouldFocusAfterSyncRef.current){this.shouldFocusAfterSyncRef.current=!1;let t=this.selectionRef.current;e.focus(()=>{t&&Ib(e,t)})}},this.publishSnapshot=(e,t,n)=>{this.selectionRef.current=e.selection,this.pendingSelectionRef.current=e.selection,n?.focusAfterSync&&(this.shouldFocusAfterSyncRef.current=!0);let r=Vb(e.nodes),{editor:i}=this;if(this.pendingOwnerSignatureRef.current=r,i){this.editorSignatureRef.current=r;let t=i.getRootElement()!==document.activeElement;Fb(i,e.nodes,e.selection,t)}t.onInputSurfaceSnapshotChange?.(e.nodes,e.selection,n?.inputSurfaceReason??{type:`programmatic`}),r!==this.lastPublishedSignatureRef.current&&(this.lastPublishedSignatureRef.current=r,t.onNodesChange(e.nodes))},this.focusComposer=()=>{let{editor:e}=this;if(!e)return;e.getRootElement()?.focus({preventScroll:!0});let t=this.selectionRef.current;t&&Ib(e,t),e.focus()},this.focusComposerAtEnd=e=>{let{editor:t}=this;if(!t)return;let n=e??Mb(t.getEditorState()).nodes,r=mx(n),i={start:r,end:r};if(this.selectionRef.current=i,t.getRootElement()?.focus({preventScroll:!0}),e){let n=Vb(e);this.editorSignatureRef.current=n,this.lastPublishedSignatureRef.current=n,Fb(t,e,i)}else Ib(t,i);t.focus(()=>{let e=this.selectionRef.current;Vb(Mb(t.getEditorState()).nodes)!==Vb(n)||e?.start!==i.start||e?.end!==i.end||Ib(t,i)})},this.readComposerSnapshot=e=>{let{editor:t}=this;if(!t)return{nodes:e,selection:this.selectionRef.current};let n=Mb(t.getEditorState());return this.selectionRef.current=n.selection,n},this.createHandle=()=>{let e=(e,t=[hc])=>{let{callbacks:n}=this.getRuntime();n.onInputSurfaceItemSelect?.(e),this.publishRuntimeSnapshot(n=>Bb({item:e,nodes:n.nodes,selection:n.selection,triggerSpecs:t}),{focusAfterSync:!0})};return{insertToken:e=>{this.publishRuntimeSnapshot(t=>zb({data:e.data,label:e.label,nodes:t.nodes,selection:t.selection,tokenKey:e.tokenKey,tokenKind:e.tokenKind,triggerSpecs:[]}),{focusAfterSync:!0})},insertInputSurfaceItem:e,insertSlashItem:t=>{e(t)},insertFileToken:(e,t,n)=>{this.publishRuntimeSnapshot(r=>Hb({label:t,nodes:r.nodes,previewUrl:n,selection:r.selection,tokenKey:e}),{focusAfterSync:!0})},insertFileTokens:e=>{this.publishRuntimeSnapshot(t=>e.reduce((e,t)=>Hb({label:t.label,nodes:e.nodes,previewUrl:t.previewUrl,selection:e.selection,tokenKey:t.tokenKey}),t),{focusAfterSync:!0})},focusComposer:this.focusComposer,focusComposerAtEnd:this.focusComposerAtEnd,syncSelectedSkills:(e,t)=>{this.publishRuntimeSnapshot(n=>Wb({nextKeys:e,nodes:n.nodes,options:t,selection:n.selection}),{})}}},this.handleKeyDown=e=>{let{actions:t,callbacks:n,event:r}=e,i=r.isComposing||(this.editor?.isComposing()??!1);return r.key.length===1&&!i&&!r.altKey&&!r.ctrlKey&&!r.metaKey?this.pendingInputSurfaceReasonRef.current={type:`insert-text`,text:r.key}:!i&&(r.key===`Backspace`||r.key===`Delete`)?this.pendingInputSurfaceReasonRef.current={type:`delete-content`}:!i&&r.key===`Enter`&&r.shiftKey&&(this.pendingInputSurfaceReasonRef.current={type:`insert-text`,text:`
|
|
17
|
+
`}),n.onInputSurfaceKeyDown?.(r)?(this.pendingInputSurfaceReasonRef.current=null,!0):!i&&Gb(r)?!0:qb({actions:t,isComposing:i,nativeEvent:r})},this.handleEditorUpdate=(e,t,n)=>{let r=Mb(e),i=this.editor?.getRootElement();i&&Tb(i,r);let a=Vb(r.nodes),o=this.editorSignatureRef.current;this.editorSignatureRef.current=a,!(n.has(`nextclaw-chat-composer-external-update`)&&a===o||this.editor?.isComposing()&&!n.has(`composition-end`))&&(this.selectionRef.current=r.selection,t.onInputSurfaceSnapshotChange?.(r.nodes,r.selection,this.consumeInputSurfaceReason()??{type:`sync`}),a!==this.lastPublishedSignatureRef.current&&(this.lastPublishedSignatureRef.current=a,t.onNodesChange(r.nodes)))},this.handleSelectionChange=(e,t)=>{let n=Mb(e.getEditorState()),r=e.getRootElement();r&&Tb(r,n),!e.isComposing()&&(this.selectionRef.current=n.selection,t.onInputSurfaceSnapshotChange?.(n.nodes,n.selection,{type:`selection`}))},this.consumeInputSurfaceReason=()=>{let e=this.pendingInputSurfaceReasonRef.current;return this.pendingInputSurfaceReasonRef.current=null,e},this.publishRuntimeSnapshot=(e,t)=>{let{callbacks:n,fallbackNodes:r}=this.getRuntime();this.publishSnapshot(e(this.readComposerSnapshot(r)),n,t)},this.getRuntime=()=>{if(!this.runtime)throw Error(`ChatComposerLexicalOwner runtime has not been configured.`);return this.runtime}}};function gx({disabled:e,nodes:t,owner:n}){let[r]=gu();return(0,H.useLayoutEffect)(()=>n.bindEditor(r),[r,n]),(0,H.useLayoutEffect)(()=>{r.setEditable(!e),n.syncExternalState(r,t)},[e,r,t,n]),(0,H.useEffect)(()=>n.registerEditorListeners(r),[r,n]),null}var _x=(0,H.forwardRef)(function({actions:e,disabled:t,nodes:n,excerptCharacterCountTemplate:r,onFilesAdd:i,onInputSurfaceItemSelect:a,onInputSurfaceKeyDown:o,onInputSurfaceOpenChange:s,onInputSurfaceSnapshotChange:c,onNodesChange:l,placeholder:u,removeTokenLabel:d},f){let[p]=(0,H.useState)(()=>new hx),m=(0,H.useMemo)(()=>({onInputSurfaceItemSelect:a,onInputSurfaceKeyDown:o,onInputSurfaceOpenChange:s,onInputSurfaceSnapshotChange:c,onNodesChange:l}),[a,o,s,c,l]);return p.configureRuntime({actions:e,callbacks:m,fallbackNodes:n}),(0,H.useImperativeHandle)(f,()=>p.createHandle(),[p]),(0,U.jsx)(Sv,{initialConfig:(0,H.useMemo)(()=>({editable:!t,editorState:()=>{Pb(n,null)},namespace:`NextClawChatComposerLexical`,nodes:[Sb],onError:e=>{throw e},theme:{}}),[t,n]),children:(0,U.jsxs)(gb,{excerptCharacterCountTemplate:r,removeTokenLabel:d,children:[(0,U.jsx)(`div`,{className:`px-3 py-2 sm:px-4 sm:py-2.5`,children:(0,U.jsx)(`div`,{className:`min-h-11 sm:min-h-[60px]`,children:(0,U.jsx)(Xy,{contentEditable:(0,U.jsx)(gv,{className:`nextclaw-chat-composer min-h-7 max-h-[188px] w-full overflow-y-auto whitespace-pre-wrap break-words bg-transparent py-0.5 text-sm leading-6 text-foreground outline-none selection:bg-[var(--interaction-selection,Highlight)] selection:text-current`,onPaste:e=>{let t=Array.from(e.clipboardData.files??[]);t.length>0&&i&&(e.preventDefault(),i(t))}}),placeholder:(0,U.jsx)(`div`,{className:`pointer-events-none absolute left-3 top-2 select-none text-sm leading-6 text-muted-foreground/60 sm:left-4 sm:top-2.5`,children:u}),ErrorBoundary:Dv})})}),(0,U.jsx)(gx,{disabled:t,nodes:n,owner:p})]})})});_x.displayName=`LexicalChatInputBarTokenizedComposer`;var vx=120;function yx(e){let t=e.replace(/\s+/g,` `).trim();return t.length<=vx?t:`${t.slice(0,vx-1)}…`}function bx({hint:e}){return e?e.loading?(0,U.jsx)(`div`,{className:`px-4 pb-2`,children:(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-lg border border-border bg-muted px-3 py-2`,children:[(0,U.jsx)(`span`,{className:`h-3 w-28 animate-pulse rounded bg-muted-foreground/20`}),(0,U.jsx)(`span`,{className:`h-3 w-16 animate-pulse rounded bg-muted-foreground/20`})]})}):(0,U.jsx)(`div`,{className:`px-4 pb-2`,children:(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-lg px-3 py-1.5 text-xs ${e.tone===`warning`?`border-amber-200 bg-amber-50 text-amber-800`:`border-border bg-muted text-muted-foreground`}`,children:[e.text?(0,U.jsx)(`span`,{children:e.text}):null,e.actionLabel&&e.onAction?(0,U.jsx)(`button`,{type:`button`,onClick:e.onAction,className:`font-semibold underline-offset-2 hover:underline`,children:e.actionLabel}):null]})}):null}function xx({sendError:e,sendErrorDetailsLabel:t}){let n=e?.trim()??``;if(!n)return null;let{Popover:r,PopoverContent:i,PopoverTrigger:a}=Nl,o=yx(n),s=t?.trim()||`Details`;return(0,U.jsx)(`div`,{className:`px-3 pb-2 sm:px-4`,children:(0,U.jsxs)(`div`,{"aria-live":`polite`,className:`flex min-w-0 items-start justify-between gap-3 rounded-lg border border-red-200/80 bg-red-50/80 px-3 py-2 text-xs text-red-700`,role:`status`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate leading-5`,title:n,children:o}),(0,U.jsxs)(r,{children:[(0,U.jsx)(a,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`inline-flex h-7 shrink-0 items-center rounded-md border border-red-200/80 bg-background px-2 text-xs font-medium text-red-700 transition-colors hover:bg-red-100`,children:s})}),(0,U.jsxs)(i,{align:`end`,className:`w-[min(32rem,calc(100vw-1.5rem))] border-red-100/80 p-0`,children:[(0,U.jsx)(`div`,{className:`border-b border-red-100 bg-red-50/80 px-4 py-2 text-xs font-semibold text-red-700`,children:s}),(0,U.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words px-4 py-3 text-xs leading-relaxed text-red-700`,children:n})]})]})]})})}var Sx=(0,H.forwardRef)(function({composer:e,hint:t,inputSurface:n,sendError:r,sendErrorDetailsLabel:i,slashMenu:a,surface:o,toolbar:s,topSlot:c},l){let u=(0,H.useRef)(null),d=n??(a?{isLoading:a.isLoading,filterOptions:a.filterOptions,items:a.items,onSelectItem:a.onSelectItem,texts:{loadingLabel:a.texts.slashLoadingLabel,sectionLabel:a.texts.slashSectionLabel,emptyLabel:a.texts.slashEmptyLabel,hintLabel:a.texts.slashHintLabel,itemHintLabel:a.texts.slashSkillHintLabel}}:null),f=(0,H.useMemo)(()=>s.skillPicker?{...s,skillPicker:{...s.skillPicker,onSelectedKeysChange:e=>{u.current?.syncSelectedSkills(e,s.skillPicker?.options??[]),s.skillPicker?.onSelectedKeysChange(e)}}}:s,[s]);return(0,H.useImperativeHandle)(l,()=>({insertInputSurfaceToken:t=>u.current?.insertInputSurfaceItem({key:`resolved-token:${t.tokenKind}:${t.tokenKey}`,title:t.label,subtitle:``,description:``,detailLines:[],tokenKind:t.tokenKind,tokenKey:t.tokenKey,data:t.data},e.inputSurfaceTriggerSpecs),insertToken:e=>u.current?.insertToken(e),insertFileToken:(e,t,n)=>u.current?.insertFileToken(e,t,n),insertFileTokens:e=>u.current?.insertFileTokens(e),focusComposer:()=>u.current?.focusComposer(),focusComposerAtEnd:e=>u.current?.focusComposerAtEnd(e)}),[e.inputSurfaceTriggerSpecs]),(0,U.jsx)(`div`,{className:o===`embedded`?`bg-transparent px-0 py-0`:`bg-background px-3 pb-3 pt-2 sm:px-4 sm:pb-4 sm:pt-2`,children:(0,U.jsx)(`div`,{className:`nextclaw-chat-input-bar-shell mx-auto w-full max-w-[min(1120px,100%)] [container:nextclaw-chat-input-bar/inline-size]`,children:(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-border bg-card shadow-card`,children:[c?(0,U.jsx)(`div`,{className:`px-3 pb-0 pt-2 sm:px-4 sm:pt-2.5`,children:c}):null,(0,U.jsx)(`div`,{className:`relative`,children:(0,U.jsx)(zl,{inputSurface:d,onInputSurfaceTriggerChange:e.onInputSurfaceTriggerChange,onSelectItem:t=>{if(t.selectionBehavior===`navigate`||t.selectionBehavior===`action`){d?.onSelectItem?.(t);return}u.current?.insertInputSurfaceItem(t,e.inputSurfaceTriggerSpecs)},triggerSpecs:e.inputSurfaceTriggerSpecs,children:({onInputSurfaceKeyDown:t,onInputSurfaceOpenChange:n,onInputSurfaceSnapshotChange:r})=>(0,U.jsx)(_x,{ref:u,nodes:e.nodes,placeholder:e.placeholder,excerptCharacterCountTemplate:e.excerptCharacterCountTemplate,removeTokenLabel:e.removeTokenLabel,disabled:e.disabled,onInputSurfaceItemSelect:d?.onSelectItem,actions:s.actions,onNodesChange:e.onNodesChange,onFilesAdd:e.onFilesAdd,onInputSurfaceSnapshotChange:r,onInputSurfaceOpenChange:n,onInputSurfaceKeyDown:t})})}),(0,U.jsx)(bx,{hint:t}),(0,U.jsx)(xx,{sendError:r,sendErrorDetailsLabel:i}),(0,U.jsx)(pu,{...f})]})})})});Sx.displayName=`ChatInputBar`;function Cx({assistantIcon:e,role:t,size:n=`default`}){let r=n===`compact`,i=r?`h-7 w-7`:`h-8 w-8`,a=r?`h-3.5 w-3.5`:`h-4 w-4`;return t===`user`?(0,U.jsx)(`div`,{"data-testid":`chat-message-avatar-user`,className:W(`nextclaw-chat-message-avatar-user flex shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm`,i),children:(0,U.jsx)(vs,{className:a})}):t===`tool`?(0,U.jsx)(`div`,{"data-testid":`chat-message-avatar-tool`,className:W(`flex shrink-0 items-center justify-center rounded-full bg-accent text-accent-foreground shadow-sm ring-1 ring-border`,i),children:(0,U.jsx)(xs,{className:a})}):(0,U.jsx)(`div`,{"data-testid":`chat-message-avatar-assistant`,className:W(`flex shrink-0 items-center justify-center rounded-full bg-muted text-foreground shadow-sm ring-1 ring-border`,i),children:e??(0,U.jsx)(la,{className:W(r?`h-4 w-4`:`h-[18px] w-[18px]`,`text-current`),strokeWidth:2.5})})}function wx(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Tx=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ex=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Dx={};function Ox(e,t){return((t||Dx).jsx?Ex:Tx).test(e)}var kx=/[ \t\n\f\r]/g;function Ax(e){return typeof e==`object`?e.type===`text`?jx(e.value):!1:jx(e)}function jx(e){return e.replace(kx,``)===``}var Mx=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Mx.prototype.normal={},Mx.prototype.property={},Mx.prototype.space=void 0;function Nx(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Mx(n,r,t)}function Px(e){return e.toLowerCase()}var Fx=class{constructor(e,t){this.attribute=t,this.property=e}};Fx.prototype.attribute=``,Fx.prototype.booleanish=!1,Fx.prototype.boolean=!1,Fx.prototype.commaOrSpaceSeparated=!1,Fx.prototype.commaSeparated=!1,Fx.prototype.defined=!1,Fx.prototype.mustUseProperty=!1,Fx.prototype.number=!1,Fx.prototype.overloadedBoolean=!1,Fx.prototype.property=``,Fx.prototype.spaceSeparated=!1,Fx.prototype.space=void 0;var Ix=t({boolean:()=>Rx,booleanish:()=>zx,commaOrSpaceSeparated:()=>Ux,commaSeparated:()=>Hx,number:()=>Z,overloadedBoolean:()=>Bx,spaceSeparated:()=>Vx}),Lx=0,Rx=Wx(),zx=Wx(),Bx=Wx(),Z=Wx(),Vx=Wx(),Hx=Wx(),Ux=Wx();function Wx(){return 2**++Lx}var Gx=Object.keys(Ix),Kx=class extends Fx{constructor(e,t,n,r){let i=-1;if(super(e,t),qx(this,`space`,r),typeof n==`number`)for(;++i<Gx.length;){let e=Gx[i];qx(this,Gx[i],(n&Ix[e])===Ix[e])}}};Kx.prototype.defined=!0;function qx(e,t,n){n&&(e[t]=n)}function Jx(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Kx(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Px(r)]=r,n[Px(a.attribute)]=r}return new Mx(t,n,e.space)}var Yx=Jx({properties:{ariaActiveDescendant:null,ariaAtomic:zx,ariaAutoComplete:null,ariaBusy:zx,ariaChecked:zx,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:Vx,ariaCurrent:null,ariaDescribedBy:Vx,ariaDetails:null,ariaDisabled:zx,ariaDropEffect:Vx,ariaErrorMessage:null,ariaExpanded:zx,ariaFlowTo:Vx,ariaGrabbed:zx,ariaHasPopup:null,ariaHidden:zx,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Vx,ariaLevel:Z,ariaLive:null,ariaModal:zx,ariaMultiLine:zx,ariaMultiSelectable:zx,ariaOrientation:null,ariaOwns:Vx,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:zx,ariaReadOnly:zx,ariaRelevant:null,ariaRequired:zx,ariaRoleDescription:Vx,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:zx,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Xx(e,t){return t in e?e[t]:t}function Zx(e,t){return Xx(e,t.toLowerCase())}var Qx=Jx({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Hx,acceptCharset:Vx,accessKey:Vx,action:null,allow:null,allowFullScreen:Rx,allowPaymentRequest:Rx,allowUserMedia:Rx,alt:null,as:null,async:Rx,autoCapitalize:null,autoComplete:Vx,autoFocus:Rx,autoPlay:Rx,blocking:Vx,capture:null,charSet:null,checked:Rx,cite:null,className:Vx,cols:Z,colSpan:null,content:null,contentEditable:zx,controls:Rx,controlsList:Vx,coords:Z|Hx,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Rx,defer:Rx,dir:null,dirName:null,disabled:Rx,download:Bx,draggable:zx,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Rx,formTarget:null,headers:Vx,height:Z,hidden:Bx,high:Z,href:null,hrefLang:null,htmlFor:Vx,httpEquiv:Vx,id:null,imageSizes:null,imageSrcSet:null,inert:Rx,inputMode:null,integrity:null,is:null,isMap:Rx,itemId:null,itemProp:Vx,itemRef:Vx,itemScope:Rx,itemType:Vx,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Rx,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:Rx,muted:Rx,name:null,nonce:null,noModule:Rx,noValidate:Rx,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:Rx,optimum:Z,pattern:null,ping:Vx,placeholder:null,playsInline:Rx,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Rx,referrerPolicy:null,rel:Vx,required:Rx,reversed:Rx,rows:Z,rowSpan:Z,sandbox:Vx,scope:null,scoped:Rx,seamless:Rx,selected:Rx,shadowRootClonable:Rx,shadowRootDelegatesFocus:Rx,shadowRootMode:null,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:zx,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:Rx,useMap:null,value:zx,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Vx,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Rx,declare:Rx,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:Rx,noHref:Rx,noShade:Rx,noWrap:Rx,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:zx,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Rx,disableRemotePlayback:Rx,prefix:null,property:null,results:Z,security:null,unselectable:null},space:`html`,transform:Zx}),$x=Jx({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:Ux,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:Vx,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:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:Rx,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,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:Hx,g2:Hx,glyphName:Hx,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:Ux,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,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:Z,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:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Vx,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ux,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ux,rev:Ux,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ux,requiredFeatures:Ux,requiredFonts:Ux,requiredFormats:Ux,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:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:Ux,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ux,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ux,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Xx}),eS=Jx({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()}}),tS=Jx({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Zx}),nS=Jx({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),rS={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`},iS=/[A-Z]/g,aS=/-[a-z]/g,oS=/^data[-\w.:]+$/i;function sS(e,t){let n=Px(t),r=t,i=Fx;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&oS.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(aS,lS);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!aS.test(e)){let n=e.replace(iS,cS);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Kx}return new i(r,t)}function cS(e){return`-`+e.toLowerCase()}function lS(e){return e.charAt(1).toUpperCase()}var uS=Nx([Yx,Qx,eS,tS,nS],`html`),dS=Nx([Yx,$x,eS,tS,nS],`svg`);function fS(e){return e.join(` `).trim()}var pS=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,u=`
|
|
18
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),mS=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(pS());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),hS=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))}})),gS=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(mS()),r=hS();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_S=yS(`end`),vS=yS(`start`);function yS(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 bS(e){let t=vS(e),n=_S(e);if(t&&n)return{start:t,end:n}}function xS(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?CS(e.position):`start`in e||`end`in e?CS(e):`line`in e||`column`in e?SS(e):``}function SS(e){return wS(e&&e.line)+`:`+wS(e&&e.column)}function CS(e){return SS(e&&e.start)+`-`+SS(e&&e.end)}function wS(e){return e&&typeof e==`number`?e:1}var TS=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=xS(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}};TS.prototype.file=``,TS.prototype.name=``,TS.prototype.reason=``,TS.prototype.message=``,TS.prototype.stack=``,TS.prototype.column=void 0,TS.prototype.line=void 0,TS.prototype.ancestors=void 0,TS.prototype.cause=void 0,TS.prototype.fatal=void 0,TS.prototype.place=void 0,TS.prototype.ruleId=void 0,TS.prototype.source=void 0;var ES=e(gS(),1),DS={}.hasOwnProperty,OS=new Map,kS=/[A-Z]/g,AS=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),jS=new Set([`td`,`th`]),MS=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function NS(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=WS(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=US(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`?dS:uS,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=PS(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function PS(e,t,n){if(t.type===`element`)return FS(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return IS(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return RS(e,t,n);if(t.type===`mdxjsEsm`)return LS(e,t);if(t.type===`root`)return zS(e,t,n);if(t.type===`text`)return BS(e,t)}function FS(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dS,e.schema=i),e.ancestors.push(t);let a=XS(e,t.tagName,!1),o=GS(e,t),s=qS(e,t);return AS.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Ax(e):!0})),VS(e,o,a,t),HS(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function IS(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)}ZS(e,t.position)}function LS(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ZS(e,t.position)}function RS(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dS,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:XS(e,t.name,!0),o=KS(e,t),s=qS(e,t);return VS(e,o,a,t),HS(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zS(e,t,n){let r={};return HS(r,qS(e,t)),e.create(t,e.Fragment,r,n)}function BS(e,t){return t.value}function VS(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function HS(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function US(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 WS(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vS(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 GS(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&DS.call(t.properties,i)){let a=JS(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&jS.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 KS(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 ZS(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 ZS(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function qS(e,t){let n=[],r=-1,i=e.passKeys?new Map:OS;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=PS(e,a,o);s!==void 0&&n.push(s)}return n}function JS(e,t,n){let r=sS(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?wx(n):fS(n)),r.property===`style`){let t=typeof n==`object`?n:YS(e,String(n));return e.stylePropertyNameCase===`css`&&(t=QS(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?rS[r.property]||r.property:r.attribute,n]}}function YS(e,t){try{return(0,ES.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new TS("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=MS+`#cannot-parse-style-attribute`,r}}function XS(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=Ox(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=Ox(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return DS.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);ZS(e)}function ZS(e,t){let n=new TS("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=MS+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function QS(e){let t={},n;for(n in e)DS.call(e,n)&&(t[$S(n)]=e[n]);return t}function $S(e){let t=e.replace(kS,eC);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function eC(e){return`-`+e.toLowerCase()}var tC={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`]},nC={};function rC(e,t){let n=t||nC;return iC(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function iC(e,t,n){if(oC(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 aC(e.children,t,n)}return Array.isArray(e)?aC(e,t,n):``}function aC(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=iC(e[i],t,n);return r.join(``)}function oC(e){return!!(e&&typeof e==`object`)}var sC=document.createElement(`i`);function cC(e){let t=`&`+e+`;`;sC.innerHTML=t;let n=sC.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function lC(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 uC(e,t){return e.length>0?(lC(e,e.length,0,t),e):t}var dC={}.hasOwnProperty;function fC(e){let t={},n=-1;for(;++n<e.length;)pC(t,e[n]);return t}function pC(e,t){let n;for(n in t){let r=(dC.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){dC.call(r,a)||(r[a]=[]);let e=i[a];mC(r[a],Array.isArray(e)?e:e?[e]:[])}}}function mC(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);lC(e,0,0,r)}function hC(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 gC(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var _C=OC(/[A-Za-z]/),vC=OC(/[\dA-Za-z]/),yC=OC(/[#-'*+\--9=?A-Z^-~]/);function bC(e){return e!==null&&(e<32||e===127)}var xC=OC(/\d/),SC=OC(/[\dA-Fa-f]/),CC=OC(/[!-/:-@[-`{-~]/);function Q(e){return e!==null&&e<-2}function wC(e){return e!==null&&(e<0||e===32)}function TC(e){return e===-2||e===-1||e===32}var EC=OC(/\p{P}|\p{S}/u),DC=OC(/\s/);function OC(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function kC(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&vC(e.charCodeAt(n+1))&&vC(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 AC(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return TC(r)?(e.enter(n),s(r)):t(r)}function s(r){return TC(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var jC={tokenize:MC};function MC(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),AC(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return Q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var NC={tokenize:FC},PC={tokenize:IC};function FC(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 lC(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(PC,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(PC,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return Q(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;lC(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 IC(e,t,n){return AC(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function LC(e){if(e===null||wC(e)||DC(e))return 1;if(EC(e))return 2}function RC(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 zC={name:`attention`,resolveAll:BC,tokenize:VC};function BC(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};HC(d,-c),HC(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=uC(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=uC(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=uC(l,RC(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=uC(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=uC(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,lC(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 VC(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=LC(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=LC(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 HC(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var UC={name:`autolink`,tokenize:WC};function WC(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 _C(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||vC(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||vC(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||bC(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):yC(t)?(e.consume(t),l):n(t)}function u(e){return vC(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||vC(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var GC={partial:!0,tokenize:KC};function KC(e,t,n){return r;function r(t){return TC(t)?AC(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Q(e)?t(e):n(e)}}var qC={continuation:{tokenize:YC},exit:XC,name:`blockQuote`,tokenize:JC};function JC(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 TC(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function YC(e,t,n){let r=this;return i;function i(t){return TC(t)?AC(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(qC,t,n)(r)}}function XC(e){e.exit(`blockQuote`)}var ZC={name:`characterEscape`,tokenize:QC};function QC(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 CC(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var $C={name:`characterReference`,tokenize:ew};function ew(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=vC,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=SC,u):(e.enter(`characterReferenceValue`),a=7,o=xC,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===vC&&!cC(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 tw={partial:!0,tokenize:iw},nw={concrete:!0,name:`codeFenced`,tokenize:rw};function rw(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`),TC(t)?AC(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(tw,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):TC(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),AC(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&TC(t)?AC(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Q(t)?e.check(tw,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),TC(t)?AC(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`),TC(t)?AC(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function iw(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 aw={name:`codeIndented`,tokenize:sw},ow={partial:!0,tokenize:cw};function sw(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),AC(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Q(t)?e.attempt(ow,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function cw(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):AC(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Q(e)?i(e):n(e)}}var lw={name:`codeText`,previous:dw,resolve:uw,tokenize:fw};function uw(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 dw(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function fw(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||Q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var pw=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&&mw(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),mw(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),mw(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);mw(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);mw(this.left,t.reverse())}}};function mw(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 hw(e){let t={},n=-1,r,i,a,o,s,c,l,u=new pw(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,gw(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 lC(e,0,1/0,u.slice(0)),!l}function gw(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 _w={resolve:yw,tokenize:bw},vw={partial:!0,tokenize:xw};function yw(e){return hw(e),e}function bw(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):Q(t)?e.check(vw,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 xw(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),AC(e,a,`linePrefix`)}function a(i){if(i===null||Q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Sw(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||bC(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||wC(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||bC(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 Cw(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!TC(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function ww(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),AC(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Tw(e,t){let n;return r;function r(i){return Q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):TC(i)?AC(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ew={name:`definition`,tokenize:Dw},Yee={partial:!0,tokenize:Ow};function Dw(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Cw.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=gC(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 wC(t)?Tw(e,l)(t):l(t)}function l(t){return Sw(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Yee,d,d)(t)}function d(t){return TC(t)?AC(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Ow(e,t,n){return r;function r(t){return wC(t)?Tw(e,i)(t):n(t)}function i(t){return ww(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return TC(t)?AC(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Q(e)?t(e):n(e)}}var kw={name:`hardBreakEscape`,tokenize:Aw};function Aw(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var jw={name:`headingAtx`,resolve:Mw,tokenize:Nw};function Mw(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`},lC(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Nw(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||wC(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Q(n)?(e.exit(`atxHeading`),t(n)):TC(n)?AC(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||wC(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Pw=`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(`.`),Fw=[`pre`,`script`,`style`,`textarea`],Iw={concrete:!0,name:`htmlFlow`,resolveTo:zw,tokenize:Bw},Lw={partial:!0,tokenize:Hw},Rw={partial:!0,tokenize:Vw};function zw(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 Bw(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:te):_C(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):_C(a)?(e.consume(a),i=4,r.interrupt?t:te):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:te):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 _C(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||wC(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Fw.includes(l)?(i=1,r.interrupt?t(s):O(s)):Pw.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||vC(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 TC(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||_C(t)?(e.consume(t),b):TC(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||vC(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):TC(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):TC(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||wC(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||TC(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Q(t)?O(t):TC(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),ne):t===63&&i===3?(e.consume(t),te):t===93&&i===5?(e.consume(t),ee):Q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Lw,re,k)(t)):t===null||Q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Rw,A,re)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),te):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Fw.includes(n)?(e.consume(t),ne):O(t)}return _C(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function ee(t){return t===93?(e.consume(t),te):O(t)}function te(t){return t===62?(e.consume(t),ne):t===45&&i===2?(e.consume(t),te):O(t)}function ne(t){return t===null||Q(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),ne)}function re(n){return e.exit(`htmlFlow`),t(n)}}function Vw(e,t,n){let r=this;return i;function i(t){return Q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Hw(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(GC,t,n)}}var Uw={name:`htmlText`,tokenize:Ww};function Ww(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):_C(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):_C(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Q(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Q(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Q(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Q(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return _C(t)?(e.consume(t),S):n(t)}function S(t){return t===45||vC(t)?(e.consume(t),S):C(t)}function C(t){return Q(t)?(o=C,N(t)):TC(t)?(e.consume(t),C):M(t)}function w(t){return t===45||vC(t)?(e.consume(t),w):t===47||t===62||wC(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||_C(t)?(e.consume(t),E):Q(t)?(o=T,N(t)):TC(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||vC(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Q(t)?(o=D,N(t)):TC(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Q(t)?(o=O,N(t)):TC(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Q(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||wC(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||wC(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return TC(t)?AC(e,ee,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ee(t)}function ee(t){return e.enter(`htmlTextData`),o(t)}}var Gw={name:`labelEnd`,resolveAll:Yw,resolveTo:Xw,tokenize:Zw},Kw={tokenize:Qw},qw={tokenize:$w},Jw={tokenize:eT};function Yw(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&&lC(e,0,e.length,n),e}function Xw(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=uC(s,e.slice(a+1,a+r+3)),s=uC(s,[[`enter`,u,t]]),s=uC(s,RC(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=uC(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=uC(s,e.slice(o+1)),s=uC(s,[[`exit`,c,t]]),lC(e,a,e.length,s),e}function Zw(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(gC(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(Kw,u,o?u:d)(t):t===91?e.attempt(qw,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Jw,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Qw(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 wC(t)?Tw(e,a)(t):a(t)}function a(t){return t===41?u(t):Sw(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return wC(t)?Tw(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?ww(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return wC(t)?Tw(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 $w(e,t,n){let r=this;return i;function i(t){return Cw.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(gC(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function eT(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 tT={name:`labelStartImage`,resolveAll:Gw.resolveAll,tokenize:nT};function nT(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 rT={name:`labelStartLink`,resolveAll:Gw.resolveAll,tokenize:iT};function iT(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 aT={name:`lineEnding`,tokenize:oT};function oT(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),AC(e,t,`linePrefix`)}}var sT={name:`thematicBreak`,tokenize:cT};function cT(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||Q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),TC(t)?AC(e,s,`whitespace`)(t):s(t))}}var lT={continuation:{tokenize:pT},exit:hT,name:`list`,tokenize:fT},uT={partial:!0,tokenize:gT},dT={partial:!0,tokenize:mT};function fT(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:xC(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(sT,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 xC(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(GC,r.interrupt?n:u,e.attempt(uT,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return TC(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 pT(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(GC,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,AC(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!TC(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(dT,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,AC(e,e.attempt(lT,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function mT(e,t,n){let r=this;return AC(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 hT(e){e.exit(this.containerState.type)}function gT(e,t,n){let r=this;return AC(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!TC(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var _T={name:`setextUnderline`,resolveTo:vT,tokenize:yT};function vT(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 yT(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`),TC(t)?AC(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var bT={tokenize:xT};function xT(e){let t=this,n=e.attempt(GC,r,e.attempt(this.parser.constructs.flowInitial,i,AC(e,e.attempt(this.parser.constructs.flow,i,e.attempt(_w,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var ST={resolveAll:ET()},CT=TT(`string`),wT=TT(`text`);function TT(e){return{resolveAll:ET(e===`text`?DT:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function ET(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 DT(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 OT=t({attentionMarkers:()=>IT,contentInitial:()=>AT,disable:()=>LT,document:()=>kT,flow:()=>MT,flowInitial:()=>jT,insideSpan:()=>FT,string:()=>NT,text:()=>PT}),kT={42:lT,43:lT,45:lT,48:lT,49:lT,50:lT,51:lT,52:lT,53:lT,54:lT,55:lT,56:lT,57:lT,62:qC},AT={91:Ew},jT={[-2]:aw,[-1]:aw,32:aw},MT={35:jw,42:sT,45:[_T,sT],60:Iw,61:_T,95:sT,96:nw,126:nw},NT={38:$C,92:ZC},PT={[-5]:aT,[-4]:aT,[-3]:aT,33:tT,38:$C,42:zC,60:[UC,Uw],91:rT,92:[kw,ZC],93:Gw,95:zC,96:lw},FT={null:[zC,ST]},IT={null:[42,95]},LT={null:[]};function RT(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=uC(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=RC(a,l.events,l),l.events):[]}function f(e,t){return BT(p(e),t)}function p(e){return zT(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){Q(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&lC(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 zT(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 BT(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=`
|
|
19
|
+
`;break;case-3:o=`\r
|
|
20
|
+
`;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 VT(e){let t={constructs:fC([OT,...(e||{}).extensions||[]]),content:n(jC),defined:[],document:n(NC),flow:n(bT),lazy:{},string:n(CT),text:n(wT)};return t;function n(e){return n;function n(n){return RT(t,e,n)}}}function HT(e){for(;!hw(e););return e}var UT=/[\0\t\n\r]/g;function WT(){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(UT.lastIndex=u,c=UT.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 GT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function KT(e){return e.replace(GT,qT)}function qT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return hC(n.slice(t?2:1),t?16:10)}return cC(n)||e}var JT={}.hasOwnProperty;function YT(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),XT(n)(HT(VT(n).document().write(WT()(e,t,!0))))}function XT(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(be),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ge),blockQuote:a(de),characterEscape:T,characterReference:T,codeFenced:a(fe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(fe,o),codeText:a(pe,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(me),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(he),hardBreakEscape:a(_e),hardBreakTrailing:a(_e),htmlFlow:a(ve,o),htmlFlowData:T,htmlText:a(ve,o),htmlTextData:T,image:a(ye),label:o,link:a(be),listItem:a(Se),listItemValue:f,listOrdered:a(xe,d),listUnordered:a(xe),paragraph:a(Ce),reference:ie,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ge),strong:a(we),thematicBreak:a(Ee)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ue,autolinkProtocol:le,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:se,characterReference:ce,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:ee,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:te,resourceTitleString:ne,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};QT(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]];JT.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]||eE).call(a,void 0,e[0])}for(r.position={start:ZT(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ZT(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:ZT(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]||eE).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+xS({start:e.start,end:e.end})+`): it’s not open`);n.position.end=ZT(e.end)}function u(){return rC(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=gC(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=Te(),n.position={start:ZT(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=ZT(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=ZT(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=KT(t),n.identifier=gC(t).toLowerCase()}function ee(){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 te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function re(){this.data.inReference=void 0}function ie(){this.data.referenceType=`collapsed`}function ae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gC(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function oe(e){this.data.characterReferenceType=e.type}function se(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=hC(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=cC(t);let i=this.stack[this.stack.length-1];i.value+=r}function ce(e){let t=this.stack.pop();t.position.end=ZT(e.end)}function le(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ue(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function de(){return{type:`blockquote`,children:[]}}function fe(){return{type:`code`,lang:null,meta:null,value:``}}function pe(){return{type:`inlineCode`,value:``}}function me(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function he(){return{type:`emphasis`,children:[]}}function ge(){return{type:`heading`,depth:0,children:[]}}function _e(){return{type:`break`}}function ve(){return{type:`html`,value:``}}function ye(){return{type:`image`,title:null,url:``,alt:null}}function be(){return{type:`link`,title:null,url:``,children:[]}}function xe(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Se(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Ce(){return{type:`paragraph`,children:[]}}function we(){return{type:`strong`,children:[]}}function Te(){return{type:`text`,value:``}}function Ee(){return{type:`thematicBreak`}}}function ZT(e){return{line:e.line,column:e.column,offset:e.offset}}function QT(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?QT(e,r):$T(e,r)}}function $T(e,t){let n;for(n in t)if(JT.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 eE(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+xS({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xS({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+xS({start:t.start,end:t.end})+`) is still open`)}function tE(e){let t=this;t.parser=n;function n(n){return YT(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function nE(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 rE(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
21
|
+
`}]}function iE(e,t){let n=t.value?t.value+`
|
|
22
|
+
`:``,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 aE(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oE(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sE(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=kC(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 cE(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 lE(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function uE(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 dE(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uE(e,t);let i={src:kC(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 fE(e,t){let n={src:kC(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 pE(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 mE(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return uE(e,t);let i={href:kC(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 hE(e,t){let n={href:kC(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 gE(e,t,n){let r=e.all(t),i=n?_E(n):vE(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:`
|
|
23
|
+
`}),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:`
|
|
24
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function _E(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=vE(n[r])}return t}function vE(e){return e.spread??e.children.length>1}function yE(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 bE(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xE(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function SE(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CE(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=vS(t.children[1]),o=_S(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 wE(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 TE(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var EE=9,DE=32;function OE(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(kE(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(kE(t.slice(i),i>0,!1)),a.join(``)}function kE(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===EE||t===DE;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===EE||t===DE;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function AE(e,t){let n={type:`text`,value:OE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function jE(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var ME={blockquote:nE,break:rE,code:iE,delete:aE,emphasis:oE,footnoteReference:sE,heading:cE,html:lE,imageReference:dE,image:fE,inlineCode:pE,linkReference:mE,link:hE,listItem:gE,list:yE,paragraph:bE,root:xE,strong:SE,table:CE,tableCell:TE,tableRow:wE,text:AE,thematicBreak:jE,toml:NE,yaml:NE,definition:NE,footnoteDefinition:NE};function NE(){}var PE=typeof self==`object`?self:globalThis,FE=(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 PE[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 PE[a](o),i)};return r},IE=e=>FE(new Map,e)(0),LE=``,{toString:RE}={},{keys:zE}=Object,BE=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=RE.call(e).slice(8,-1);switch(n){case`Array`:return[1,LE];case`Object`:return[2,LE];case`Date`:return[3,LE];case`RegExp`:return[4,LE];case`Map`:return[5,LE];case`Set`:return[6,LE];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},VE=([e,t])=>e===0&&(t===`function`||t===`symbol`),HE=(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]=BE(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 zE(r))(e||!VE(BE(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||!(VE(BE(n))||VE(BE(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!VE(BE(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},UE=(e,{json:t,lossy:n}={})=>{let r=[];return HE(!(t||n),!!t,new Map,r)(e),r},WE=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?IE(UE(e,t)):structuredClone(e):(e,t)=>IE(UE(e,t));function GE(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 KE(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function qE(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||GE,r=e.options.footnoteBackLabel||KE,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=kC(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:{...WE(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
25
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
26
|
+
`}]}}var JE=(function(e){if(e==null)return $E;if(typeof e==`function`)return QE(e);if(typeof e==`object`)return Array.isArray(e)?YE(e):XE(e);if(typeof e==`string`)return ZE(e);throw Error(`Expected function, string, or object as test`)});function YE(e){let t=[],n=-1;for(;++n<e.length;)t[n]=JE(e[n]);return QE(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function XE(e){let t=e;return QE(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function ZE(e){return QE(t);function t(t){return t&&t.type===e}}function QE(e){return t;function t(t,n,r){return!!(eD(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function $E(){return!0}function eD(e){return typeof e==`object`&&!!e&&`type`in e}function tD(e){return e}var nD=[];function rD(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=JE(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 (`+tD(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=nD,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=iD(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 iD(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?nD:[e]}function aD(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),rD(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 oD={}.hasOwnProperty,sD={};function cD(e,t){let n=t||sD,r=new Map,i=new Map,a={all:s,applyData:uD,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...ME,...n.handlers},one:o,options:n,patch:lD,wrap:fD};return aD(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(oD.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=WE(n);return r.children=a.all(e),r}return WE(e)}return(a.options.unknownHandler||dD)(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=pD(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=pD(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function lD(e,t){e.position&&(t.position=bS(e))}function uD(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,WE(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function dD(e,t){let n=t.data||{},r=`value`in t&&!(oD.call(n,`hProperties`)||oD.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 fD(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
27
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
28
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
29
|
+
`}),n}function pD(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function mD(e,t){let n=cD(e,t),r=n.one(e,void 0),i=qE(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
30
|
+
`},i)),a}function hD(e,t){return e&&`run`in e?async function(n,r){let i=mD(n,{file:r,...t});await e.run(i,r)}:function(n,r){return mD(n,{file:r,...e||t})}}function gD(e){if(e)throw e}var _D=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 vD(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 yD(){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);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?bD(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 bD(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 xD={basename:SD,dirname:CD,extname:wD,join:TD,sep:`/`};function SD(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);OD(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 CD(e){if(OD(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 wD(e){OD(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}continue}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 TD(...e){let t=-1,n;for(;++t<e.length;)OD(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:ED(n)}function ED(e){OD(e);let t=e.codePointAt(0)===47,n=DD(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function DD(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 OD(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var kD={cwd:AD};function AD(){return`/`}function jD(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function MD(e){if(typeof e==`string`)e=new URL(e);else if(!jD(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 ND(e)}function ND(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 PD=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],FD=class{constructor(e){let t;t=e?jD(e)?{path:e}:typeof e==`string`||Xee(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:kD.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<PD.length;){let e=PD[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)PD.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?xD.basename(this.path):void 0}set basename(e){LD(e,`basename`),ID(e,`basename`),this.path=xD.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?xD.dirname(this.path):void 0}set dirname(e){RD(this.basename,`dirname`),this.path=xD.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?xD.extname(this.path):void 0}set extname(e){if(ID(e,`extname`),RD(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=xD.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){jD(e)&&(e=MD(e)),LD(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?xD.basename(this.path,this.extname):void 0}set stem(e){LD(e,`stem`),ID(e,`stem`),this.path=xD.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 TS(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 ID(e,t){if(e&&e.includes(xD.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+xD.sep+"`")}function LD(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function RD(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Xee(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Zee=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),zD=e(_D(),1),Qee={}.hasOwnProperty,$ee=new class e extends Zee{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=yD()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,zD.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(HD(`data`,this.frozen),this.namespace[e]=t,this):Qee.call(this.namespace,e)&&this.namespace[e]||void 0:e?(HD(`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=GD(e),n=this.parser||this.Parser;return BD(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),BD(`process`,this.parser||this.Parser),VD(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=GD(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);tte(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(),BD(`processSync`,this.parser||this.Parser),VD(`processSync`,this.compiler||this.Compiler),this.process(e,r),WD(`processSync`,`process`,t),n;function r(e,r){t=!0,gD(e),n=r}}run(e,t,n){UD(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=GD(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),WD(`runSync`,`run`,n),r;function i(e,t){gD(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=GD(t),r=this.compiler||this.Compiler;return VD(`stringify`,r),UD(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(HD(`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,zD.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];vD(o)&&vD(r)&&(r=(0,zD.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function BD(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function VD(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function HD(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 UD(e){if(!vD(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function WD(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function GD(e){return ete(e)?e:new FD(e)}function ete(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function tte(e){return typeof e==`string`||nte(e)}function nte(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var KD=[],qD={allowDangerousHtml:!0},rte=/^(https?|ircs?|mailto|xmpp)$/i,ite=[{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 ate(e){let t=ote(e),n=ste(e);return cte(t.runSync(t.parse(n),n),e)}function ote(e){let t=e.rehypePlugins||KD,n=e.remarkPlugins||KD,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...qD}:qD;return $ee().use(tE).use(n).use(hD,r).use(t)}function ste(e){let t=e.children||``,n=new FD;return typeof t==`string`?n.value=t:``+t,n}function cte(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||lte;for(let e of ite)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return aD(e,l),NS(e,{Fragment:U.Fragment,components:i,ignoreInvalidStyle:!0,jsx:U.jsx,jsxs:U.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 tC)if(Object.hasOwn(tC,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=tC[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 lte(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||rte.test(e.slice(0,t))?e:``}function JD(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 ute(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function dte(e,t,n){let r=JE((n||{}).ignore||[]),i=fte(t),a=-1;for(;++a<i.length;)rD(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 fte(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([pte(e[0]),mte(e[1])])}return t}function pte(e){return typeof e==`string`?new RegExp(ute(e),`g`):e}function mte(e){return typeof e==`function`?e:function(){return e}}var YD=`phrasing`,XD=[`autolink`,`link`,`image`,`label`];function hte(){return{transforms:[Ste],enter:{literalAutolink:_te,literalAutolinkEmail:ZD,literalAutolinkHttp:ZD,literalAutolinkWww:ZD},exit:{literalAutolink:xte,literalAutolinkEmail:bte,literalAutolinkHttp:vte,literalAutolinkWww:yte}}}function gte(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:YD,notInConstruct:XD},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:YD,notInConstruct:XD},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:YD,notInConstruct:XD}]}}function _te(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function ZD(e){this.config.enter.autolinkProtocol.call(this,e)}function vte(e){this.config.exit.autolinkProtocol.call(this,e)}function yte(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 bte(e){this.config.exit.autolinkEmail.call(this,e)}function xte(e){this.exit(e)}function Ste(e){dte(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Cte],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,wte]],{ignore:[`link`,`linkReference`]})}function Cte(e,t,n,r,i){let a=``;if(!QD(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Tte(n)))return!1;let o=Ete(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 wte(e,t,n,r){return!QD(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Tte(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 Ete(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=JD(e,`(`),a=JD(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 QD(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||DC(n)||EC(n))&&(!t||n!==47)}$D.peek=Fte;function Dte(){this.buffer()}function Ote(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function kte(){this.buffer()}function Ate(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function jte(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gC(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Mte(e){this.exit(e)}function Nte(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=gC(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Pte(e){this.exit(e)}function Fte(){return`[`}function $D(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 Ite(){return{enter:{gfmFootnoteCallString:Dte,gfmFootnoteCall:Ote,gfmFootnoteDefinitionLabelString:kte,gfmFootnoteDefinition:Ate},exit:{gfmFootnoteCallString:jte,gfmFootnoteCall:Mte,gfmFootnoteDefinitionLabelString:Nte,gfmFootnoteDefinition:Pte}}}function Lte(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:$D},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?`
|
|
31
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?eO:Rte))),s(),o}}function Rte(e,t,n){return t===0?e:eO(e,t,n)}function eO(e,t,n){return(n?``:` `)+e}var zte=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];tO.peek=Wte;function Bte(){return{canContainEols:[`delete`],enter:{strikethrough:Hte},exit:{strikethrough:Ute}}}function Vte(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:zte}],handlers:{delete:tO}}}function Hte(e){this.enter({type:`delete`,children:[]},e)}function Ute(e){this.exit(e)}function tO(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 Wte(){return`~`}function Gte(e){return e.length}function Kte(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Gte,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=qte(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]=nO(r[d]);else{let e=nO(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(`
|
|
32
|
+
`)}function qte(e){return e==null?``:String(e)}function nO(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 Jte(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()),Yte);return i(),o}function Yte(e,t,n){return`>`+(n?``:` `)+e}function Xte(e,t){return rO(e,t.inConstruct,!0)&&!rO(e,t.notInConstruct,!1)}function rO(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 iO(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
33
|
+
`&&Xte(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
34
|
+
`}function Zte(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 Qte(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 $te(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function ene(e,t,n,r){let i=$te(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Qte(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,tne);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(Zte(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:`
|
|
35
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
36
|
+
`),a&&(u+=s.move(a+`
|
|
37
|
+
`)),u+=s.move(c),l(),u}function tne(e,t,n){return(n?``:` `)+e}function aO(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function nne(e,t,n,r){let i=aO(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?` `:`
|
|
38
|
+
`,...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 rne(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function oO(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function sO(e,t,n){let r=LC(e),i=LC(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}}cO.peek=ine;function cO(e,t,n,r){let i=rne(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=sO(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=oO(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=sO(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+oO(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function ine(e,t,n){return n.options.emphasis||`*`}function ane(e,t){let n=!1;return aD(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)&&rC(e)&&(t.options.setext||n))}function one(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(ane(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
39
|
+
`,after:`
|
|
40
|
+
`});return r(),t(),o+`
|
|
41
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
42
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
43
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=oO(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}lO.peek=sne;function lO(e){return e.value||``}function sne(){return`<`}uO.peek=cne;function uO(e,t,n,r){let i=aO(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 cne(){return`!`}dO.peek=lne;function dO(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 lne(){return`!`}fO.peek=une;function fO(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 une(){return"`"}function pO(e,t){let n=rC(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))}mO.peek=dne;function mO(e,t,n,r){let i=aO(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(pO(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 dne(e,t,n){return pO(e,n)?`<`:`[`}hO.peek=fne;function hO(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 fne(){return`[`}function gO(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 pne(e){let t=gO(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 mne(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function _O(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 hne(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?mne(n):gO(n),s=e.ordered?o===`.`?`)`:`.`:pne(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),_O(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 gne(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 _ne(e,t,n,r){let i=gne(n),a=n.bulletCurrent||gO(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 vne(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var yne=JE([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function bne(e,t,n,r){return(e.children.some(function(e){return yne(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function xne(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}vO.peek=Sne;function vO(e,t,n,r){let i=xne(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=sO(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=oO(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=sO(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+oO(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Sne(e,t,n){return n.options.strong||`*`}function Cne(e,t,n,r){return n.safe(e.value,r)}function wne(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 Tne(e,t,n){let r=(_O(n)+(n.options.ruleSpaces?` `:``)).repeat(wne(n));return n.options.ruleSpaces?r.slice(0,-1):r}var yO={blockquote:Jte,break:iO,code:ene,definition:nne,emphasis:cO,hardBreak:iO,heading:one,html:lO,image:uO,imageReference:dO,inlineCode:fO,link:mO,linkReference:hO,list:hne,listItem:_ne,paragraph:vne,root:bne,strong:vO,text:Cne,thematicBreak:Tne};function Ene(){return{enter:{table:Dne,tableData:xO,tableHeader:xO,tableRow:kne},exit:{codeText:Ane,table:One,tableData:bO,tableHeader:bO,tableRow:bO}}}function Dne(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 One(e){this.exit(e),this.data.inTable=void 0}function kne(e){this.enter({type:`tableRow`,children:[]},e)}function bO(e){this.exit(e)}function xO(e){this.enter({type:`tableCell`,children:[]},e)}function Ane(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,jne));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function jne(e,t){return t===`|`?t:e}function Mne(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
44
|
+
`,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(`
|
|
45
|
+
`))}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 Kte(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=yO.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Nne(){return{exit:{taskListCheckValueChecked:SO,taskListCheckValueUnchecked:SO,paragraph:Fne}}}function Pne(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Ine}}}function SO(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Fne(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 Ine(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=yO.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 Lne(){return[hte(),Ite(),Bte(),Ene(),Nne()]}function Rne(e){return{extensions:[gte(),Lte(e),Vte(),Mne(e),Pne()]}}var zne={tokenize:Gne,partial:!0},CO={tokenize:Kne,partial:!0},wO={tokenize:qne,partial:!0},TO={tokenize:Jne,partial:!0},Bne={tokenize:Yne,partial:!0},EO={name:`wwwAutolink`,tokenize:Une,previous:jO},DO={name:`protocolAutolink`,tokenize:Wne,previous:MO},OO={name:`emailAutolink`,tokenize:Hne,previous:NO},kO={};function Vne(){return{text:kO}}for(var AO=48;AO<123;)kO[AO]=OO,AO++,AO===58?AO=65:AO===91&&(AO=97);kO[43]=OO,kO[45]=OO,kO[46]=OO,kO[95]=OO,kO[72]=[OO,DO],kO[104]=[OO,DO],kO[87]=[OO,EO],kO[119]=[OO,EO];function Hne(e,t,n){let r=this,i,a;return o;function o(t){return!PO(t)||!NO.call(r,r.previous)||FO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return PO(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Bne,u,l)(t):t===45||t===95||vC(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&&_C(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Une(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!jO.call(r,r.previous)||FO(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(zne,e.attempt(CO,e.attempt(wO,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Wne(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&MO.call(r,r.previous)&&!FO(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(_C(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||bC(t)||wC(t)||DC(t)||EC(t)?n(t):e.attempt(CO,e.attempt(wO,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Gne(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 Kne(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(TO,c,s)(t):t===null||wC(t)||DC(t)||t!==45&&EC(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 qne(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(TO,t,a)(o):o===null||wC(o)||DC(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Jne(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||wC(o)||DC(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||wC(e)||DC(e)?t(e):r(e)}function a(e){return _C(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):_C(t)?(e.consume(t),o):n(t)}}function Yne(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return vC(e)?n(e):t(e)}}function jO(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||wC(e)}function MO(e){return!_C(e)}function NO(e){return!(e===47||PO(e))}function PO(e){return e===43||e===45||e===46||e===95||vC(e)}function FO(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 IO={tokenize:WO,partial:!0};function LO(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:VO,continuation:{tokenize:HO},exit:UO}},text:{91:{name:`gfmFootnoteCall`,tokenize:BO},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:RO,resolveTo:zO}}}}function RO(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=gC(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 zO(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 BO(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||wC(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(gC(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return wC(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 VO(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||wC(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=gC(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return wC(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),AC(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function HO(e,t,n){return e.check(GC,t,e.attempt(IO,t,n))}function UO(e){e.exit(`gfmFootnoteDefinition`)}function WO(e,t,n){let r=this;return AC(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 GO(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&&lC(o,o.length,0,RC(s,e.slice(r+1,n),t)),lC(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),lC(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=LC(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=LC(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var KO=class{constructor(){this.map=[]}add(e,t,n){qO(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 qO(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 JO(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 YO(){return{flow:{null:{name:`table`,tokenize:XO,resolveAll:ZO}}}}function XO(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?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Q(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):TC(t)?AC(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||wC(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,TC(t)?AC(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 TC(t)?AC(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Q(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return TC(t)?AC(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Q(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Q(n)?(e.exit(`tableRow`),t(n)):TC(n)?AC(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||wC(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 ZO(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 KO;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&($O(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=QO(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=QO(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=QO(f,t,o,i,n,d)):(o[0]=o[1],d=QO(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&$O(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=JO(t.events,n))}return e}function QO(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},ek(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=ek(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=ek(t.events,n[2]),a=ek(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({},ek(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function $O(e,t,n,r,i){let a=[],o=ek(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 ek(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var tk={name:`tasklistCheck`,tokenize:rk};function nk(){return{text:{91:tk}}}function rk(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 wC(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Q(r)?t(r):TC(r)?e.check({tokenize:ik},t,n)(r):n(r)}}function ik(e,t,n){return AC(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function ak(e){return fC([Vne(),LO(),GO(e),YO(),nk()])}var ok={};function sk(e){let t=this,n=e||ok,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(ak(n)),a.push(Lne()),o.push(Rne(n))}function ck({characterCountLabel:e,excerpt:t,kind:n,label:r,location:i,path:a,tooltip:o,onClick:s}){let{Tooltip:c,TooltipContent:l,TooltipProvider:u,TooltipTrigger:d}=Nl,f=!!s,p=W(Qy,`nextclaw-chat-inline-token mx-[0.08em]`,f?`cursor-pointer transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25`:`cursor-default`),m=a||o,h=(0,U.jsx)(pb,{excerpt:t,kind:n,label:r,metricLabel:i??e,source:m}),g=f?(0,U.jsx)(`button`,{type:`button`,className:p,onClick:e=>{e.preventDefault(),e.stopPropagation(),s?.()},children:h}):(0,U.jsx)(`span`,{className:p,children:h});return(n===`workspace_excerpt`||n===`conversation_excerpt`)&&t?(0,U.jsx)(mb,{characterCountLabel:e,excerpt:t,kind:n===`conversation_excerpt`?n:`workspace_file`,label:r,location:i,path:m,children:g}):(0,U.jsx)(u,{delayDuration:250,children:(0,U.jsxs)(c,{children:[(0,U.jsx)(d,{asChild:!0,children:g}),(0,U.jsx)(l,{side:`top`,className:`max-w-[24rem] break-all text-xs`,children:o})]})})}function lk(){return typeof navigator<`u`&&typeof navigator.clipboard?.writeText==`function`}function uk(e){if(typeof document>`u`)return;let t=document.getSelection();t&&(t.removeAllRanges(),e.forEach(e=>t.addRange(e)))}function dk(){let e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e:null,n=t?{input:t,start:t.selectionStart,end:t.selectionEnd}:null,r=document.getSelection();return{activeElement:e,activeInputSelection:n,ranges:r?Array.from({length:r.rangeCount},(e,t)=>r.getRangeAt(t).cloneRange()):[]}}function fk(e){let t=document.createElement(`textarea`);return t.value=e,t.setAttribute(`readonly`,``),t.setAttribute(`aria-hidden`,`true`),Object.assign(t.style,{fontSize:`12pt`,left:`-9999px`,opacity:`0`,pointerEvents:`none`,position:`fixed`,top:`0`}),t}function pk(e){try{e.focus({preventScroll:!0})}catch{e.focus()}}function mk(e){pk(e),e.select(),e.setSelectionRange(0,e.value.length)}function hk(){try{return typeof document.execCommand==`function`&&document.execCommand(`copy`)}catch{return!1}}function gk(e){if(!e.activeInputSelection)return!1;let{input:t,start:n,end:r}=e.activeInputSelection;return n===null||r===null?!1:(t.setSelectionRange(n,r),!0)}function _k(e){e.activeElement&&pk(e.activeElement),gk(e)||uk(e.ranges)}function vk(e){if(typeof document>`u`||!document.body)return!1;let t=dk(),n=fk(e);document.body.appendChild(n),mk(n);let r=hk();return n.remove(),_k(t),r}async function yk(e){if(!e)return!1;if(lk())try{return await navigator.clipboard.writeText(e),!0}catch{return vk(e)}return vk(e)}var bk=1300;function xk(e){let[t,n]=(0,H.useState)(!1),r=(0,H.useCallback)(async()=>{e.text&&(await yk(e.text)?n(!0):n(!1))},[e.text]);return(0,H.useEffect)(()=>{if(!t||typeof window>`u`)return;let r=window.setTimeout(()=>n(!1),e.resetDelayMs??bk);return()=>window.clearTimeout(r)},[t,e.resetDelayMs]),{copied:t,copy:r}}var Sk=e(n(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},ee={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},te=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},ne=te(`//`,`$`),re=te(`/\\*`,`\\*/`),ie=te(`#`,`$`),ae={scope:`number`,begin:D,relevance:0},oe={scope:`number`,begin:O,relevance:0},se={scope:`number`,begin:k,relevance:0},ce={scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},le={scope:`title`,begin:T,relevance:0},ue={scope:`title`,begin:E,relevance:0},de={begin:`\\.\\s*`+E,relevance:0},fe=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:se,BINARY_NUMBER_RE:k,COMMENT:te,C_BLOCK_COMMENT_MODE:re,C_LINE_COMMENT_MODE:ne,C_NUMBER_MODE:oe,C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:ie,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:de,NUMBER_MODE:ae,NUMBER_RE:D,PHRASAL_WORDS_MODE:ee,QUOTE_STRING_MODE:P,REGEXP_MODE:ce,RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:le,UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:ue});function pe(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function me(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function he(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=pe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function ge(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function _e(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function ve(e,t){e.relevance===void 0&&(e.relevance=1)}var ye=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},be=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],xe=`keyword`;function Se(e,t,n=xe){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,Se(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,Ce(n[0],n[1])]})}}function Ce(e,t){return t?Number(t):we(e)?0:1}function we(e){return be.includes(e.toLowerCase())}var Te={},Ee=e=>{console.error(e)},De=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Oe=(e,t)=>{Te[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Te[`${e}/${t}`]=!0)},ke=Error();function Ae(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function je(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ee(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),ke;if(typeof e.beginScope!=`object`||e.beginScope===null)throw Ee(`beginScope must be object`),ke;Ae(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function Me(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ee(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),ke;if(typeof e.endScope!=`object`||e.endScope===null)throw Ee(`endScope must be object`),ke;Ae(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function Ne(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Pe(e){Ne(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),je(e),Me(e)}function Fe(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null),this.matcherRe=t(C(this.regexes.map(e=>e[1]),{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[me,_e,Pe,ye].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[he,ge,ve].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=Se(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Le(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function Ie(e){return e?e.endsWithParent||Ie(e.starts):!1}function Le(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Ie(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Re=`11.11.1`,F=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},ze=i,Be=a,Ve=Symbol(`nomatch`),He=7,Ue=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(De(s.replace(`{}`,n[1])),De(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(Oe(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),Oe(`10.7.0`,`Please use highlight(code, options) instead.
|
|
46
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};ie(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,ie(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=He&&(ee+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(ee+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(re=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Ve;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(ee+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Ve)return e}if(r.type===`illegal`&&a===``)return P+=`
|
|
47
|
+
`,1;if(ne>1e5&&ne>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw Ee(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=Fe(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,ee=0,te=0,ne=0,re=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){ne++,re?re=!1:A.matcher.considerAll(),A.matcher.lastIndex=te;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(te,e.index),e);te=e.index+t}E(n.substring(te))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:ee,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:ze(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:te,context:n.slice(te-100,te+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:ze(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:ze(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(ee).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(ie(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new F(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),ie(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=Be(l,e)}let E=()=>{k(),Oe(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),Oe(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(Ee(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)Ee(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function ee(e){let t=N(e);return t&&!t.disableAutodetect}function te(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function ne(e){te(e),a.push(e)}function re(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function ie(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function ae(e){return Oe(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),Oe(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:ae,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:ee,inherit:Be,addPlugin:ne,removePlugin:re}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Re,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in fe)typeof fe[e]==`object`&&n(fe[e]);return Object.assign(e,fe),e},We=Ue({});We.newInstance=()=>Ue({}),t.exports=We,We.HighlightJS=We,We.default=We}))()).default;function Ck(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:[`self`,{begin:/:-/,contains:[n]}]};Object.assign(n,{className:`variable`,variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,`(?![\\w\\d])(?![$])`)},r]});let i={className:`subst`,begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:`comment`}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:`string`})]}},s={className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let c={match:/\\"/},l={className:`string`,begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:`number`},e.NUMBER_MODE,n]},f=e.SHEBANG({binary:`(${[`fish`,`bash`,`zsh`,`sh`,`csh`,`ksh`,`tcsh`,`dash`,`scsh`].join(`|`)})`,relevance:10}),p={className:`function`,begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},m=[`if`,`then`,`else`,`elif`,`fi`,`time`,`for`,`while`,`until`,`in`,`do`,`done`,`case`,`esac`,`coproc`,`function`,`select`],h=[`true`,`false`],g={match:/(\/[a-z._-]+)+/},_=[`break`,`cd`,`continue`,`eval`,`exec`,`exit`,`export`,`getopts`,`hash`,`pwd`,`readonly`,`return`,`shift`,`test`,`times`,`trap`,`umask`,`unset`],v=[`alias`,`bind`,`builtin`,`caller`,`command`,`declare`,`echo`,`enable`,`help`,`let`,`local`,`logout`,`mapfile`,`printf`,`read`,`readarray`,`source`,`sudo`,`type`,`typeset`,`ulimit`,`unalias`],y=`autoload.bg.bindkey.bye.cap.chdir.clone.comparguments.compcall.compctl.compdescribe.compfiles.compgroups.compquote.comptags.comptry.compvalues.dirs.disable.disown.echotc.echoti.emulate.fc.fg.float.functions.getcap.getln.history.integer.jobs.kill.limit.log.noglob.popd.print.pushd.pushln.rehash.sched.setcap.setopt.stat.suspend.ttyctl.unfunction.unhash.unlimit.unsetopt.vared.wait.whence.where.which.zcompile.zformat.zftp.zle.zmodload.zparseopts.zprof.zpty.zregexparse.zsocket.zstyle.ztcp`.split(`.`),b=`chcon.chgrp.chown.chmod.cp.dd.df.dir.dircolors.ln.ls.mkdir.mkfifo.mknod.mktemp.mv.realpath.rm.rmdir.shred.sync.touch.truncate.vdir.b2sum.base32.base64.cat.cksum.comm.csplit.cut.expand.fmt.fold.head.join.md5sum.nl.numfmt.od.paste.ptx.pr.sha1sum.sha224sum.sha256sum.sha384sum.sha512sum.shuf.sort.split.sum.tac.tail.tr.tsort.unexpand.uniq.wc.arch.basename.chroot.date.dirname.du.echo.env.expr.factor.groups.hostid.id.link.logname.nice.nohup.nproc.pathchk.pinky.printenv.printf.pwd.readlink.runcon.seq.sleep.stat.stdbuf.stty.tee.test.timeout.tty.uname.unlink.uptime.users.who.whoami.yes`.split(`.`);return{name:`Bash`,aliases:[`sh`,`zsh`],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:m,literal:h,built_in:[..._,...v,`set`,`shopt`,...y,...b]},contains:[f,e.SHEBANG(),p,d,a,o,g,s,c,l,u,n]}}var wk=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Tk=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),Ek=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),Dk=[...Tk,...Ek],Ok=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),kk=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),Ak=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),jk=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function Mk(e){let t=e.regex,n=wk(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i=/@-?\w[\w]*(-\w+)*/,a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:`CSS`,case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:`from to`},classNameAliases:{keyframePosition:`selector-tag`},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:`selector-id`,begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:`selector-class`,begin:`\\.[a-zA-Z-][a-zA-Z0-9_-]*`,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:`selector-pseudo`,variants:[{begin:`:(`+kk.join(`|`)+`)`},{begin:`:(:)?(`+Ak.join(`|`)+`)`}]},n.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+jk.join(`|`)+`)\\b`},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:`url data-uri`},contains:[...a,{className:`string`,begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:`[{;]`,relevance:0,illegal:/:/,contains:[{className:`keyword`,begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:Ok.join(` `)},contains:[{begin:/[a-z-]+(?=:)/,className:`attribute`},...a,n.CSS_NUMBER_MODE]}]},{className:`selector-tag`,begin:`\\b(`+Dk.join(`|`)+`)\\b`}]}}function Nk(e){let t=e.regex;return{name:`Diff`,aliases:[`patch`],contains:[{className:`meta`,relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:`comment`,variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:`addition`,begin:/^\+/,end:/$/},{className:`deletion`,begin:/^-/,end:/$/},{className:`addition`,begin:/^!/,end:/$/}]}}var Pk=`[A-Za-z$_][0-9A-Za-z$_]*`,Fk=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Ik=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Lk=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Rk=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],zk=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],Bk=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],Vk=[].concat(zk,Lk,Rk);function Hk(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=Pk,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:Pk,keyword:Fk,literal:Ik,built_in:Vk,"variable.language":Bk},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Lk,...Rk]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...zk,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function Uk(e){let t={className:`attr`,begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:`punctuation`,relevance:0},r=[`true`,`false`,`null`],i={scope:`literal`,beginKeywords:r.join(` `)};return{name:`JSON`,aliases:[`jsonc`],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:`\\S`}}function Wk(e){let t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:`>`,subLanguage:`xml`,relevance:0},r={begin:`^[-\\*]{3,}`,end:`$`},i={className:`code`,variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:`(~{3,})[^~](.|\\n)*?\\1~*[ ]*`},{begin:"```",end:"```+[ ]*$"},{begin:`~~~`,end:`~~~+[ ]*$`},{begin:"`.+?`"},{begin:`(?=^( {4}|\\t))`,contains:[{begin:`^( {4}|\\t)`,end:`(\\n)$`}],relevance:0}]},a={className:`bullet`,begin:`^[ ]*([*+-]|(\\d+\\.))(?=\\s+)`,end:`\\s+`,excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:`symbol`,begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:`link`,begin:/:\s*/,end:/$/,excludeBegin:!0}]},s={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:`string`,relevance:0,begin:`\\[`,end:`\\]`,excludeBegin:!0,returnEnd:!0},{className:`link`,relevance:0,begin:`\\]\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0},{className:`symbol`,relevance:0,begin:`\\]\\[`,end:`\\]`,excludeBegin:!0,excludeEnd:!0}]},c={className:`strong`,contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},l={className:`emphasis`,contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},u=e.inherit(c,{contains:[]}),d=e.inherit(l,{contains:[]});c.contains.push(d),l.contains.push(u);let f=[n,s];return[c,l,u,d].forEach(e=>{e.contains=e.contains.concat(f)}),f=f.concat(c,l),{name:`Markdown`,aliases:[`md`,`mkdown`,`mkd`],contains:[{className:`section`,variants:[{begin:`^#{1,6}`,end:`$`,contains:f},{begin:`(?=^.+?\\n[=-]{2,}$)`,contains:[{begin:`^[=-]*$`},{begin:`^`,end:`\\n`,contains:f}]}]},n,a,c,l,{className:`quote`,begin:`^>\\s+`,contains:f,end:`$`},i,r,s,o,{scope:`literal`,match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Gk(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function Kk(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function qk(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}var Jk=`[A-Za-z$_][0-9A-Za-z$_]*`,Yk=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),Xk=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],Zk=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),Qk=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],$k=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],eA=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],tA=[].concat($k,Zk,Qk);function nA(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=Jk,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:Jk,keyword:Yk,literal:Xk,built_in:tA,"variable.language":eA},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:r+`(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...Zk,...Qk]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...$k,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$`+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function rA(e){let t=e.regex,n=nA(e),r=Jk,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:Jk,keyword:Yk.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:Xk,built_in:tA.concat(i),"variable.language":eA},l={className:`meta`,begin:`@`+r},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function iA(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function aA(e){let t=`true false yes no null`,n=`[\\w#;/?:@&=+$,.~*'()[\\]]+`,r={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},o={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),c={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},l={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},u={begin:/\{/,end:/\}/,contains:[l],illegal:`\\n`,relevance:0},d={begin:`\\[`,end:`\\]`,contains:[l],illegal:`\\n`,relevance:0},f=[r,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+!`+n},{className:`type`,begin:`!<`+n+`>`},{className:`type`,begin:`!`+n},{className:`type`,begin:`!!`+n},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},c,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},u,d,a,o],p=[...f];return p.pop(),p.push(s),l.contains=p,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:f}}var oA=new Set([`text`,`txt`,`plain`,`plaintext`,`none`,`output`]),sA=[`typescript`,`javascript`,`json`,`bash`,`shell`,`python`,`css`,`xml`,`markdown`,`yaml`,`sql`,`diff`],cA=4,lA=[{name:`typescript`,language:rA,aliases:[`ts`,`tsx`]},{name:`javascript`,language:Hk,aliases:[`js`,`jsx`,`mjs`,`cjs`]},{name:`json`,language:Uk,aliases:[`jsonc`]},{name:`bash`,language:Ck,aliases:[`sh`,`zsh`]},{name:`shell`,language:Kk,aliases:[`console`,`terminal`]},{name:`python`,language:Gk,aliases:[`py`]},{name:`css`,language:Mk},{name:`xml`,language:iA,aliases:[`html`,`svg`]},{name:`markdown`,language:Wk,aliases:[`md`,`mdx`]},{name:`yaml`,language:aA,aliases:[`yml`]},{name:`sql`,language:qk},{name:`diff`,language:Nk,aliases:[`patch`]}];function uA(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function dA(e){return e.trim().toLowerCase()}var fA=new class{constructor(){this.highlight=(e,t)=>{let n=dA(t);if(!e||oA.has(n))return this.createPlainTextResult(e,n||`text`);if(this.engine.getLanguage(n)){let t=this.engine.highlight(e,{language:n,ignoreIllegals:!0});return{html:t.value,language:t.language??n,highlighted:!0}}let r=this.engine.highlightAuto(e,sA);return r.language&&r.relevance>=cA?{html:r.value,language:r.language,highlighted:!0}:this.createPlainTextResult(e,n||`text`)},this.createPlainTextResult=(e,t)=>({html:uA(e),language:t,highlighted:!1}),this.engine=Sk.newInstance(),lA.forEach(e=>{this.engine.registerLanguage(e.name,e.language),e.aliases&&this.engine.registerAliases(e.aliases,{languageName:e.name})})}},pA=/language-([a-z0-9-]+)/i;function mA(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(mA).join(``):``}function hA(e){let t=mA(e);return t.endsWith(`
|
|
48
|
+
`)?t.slice(0,-1):t}function gA(e){return(e?pA.exec(e):null)?.[1]?.toLowerCase()||`text`}function _A({className:e,children:t,texts:n}){let r=(0,H.useMemo)(()=>gA(e),[e]),i=(0,H.useMemo)(()=>hA(t),[t]),a=(0,H.useMemo)(()=>fA.highlight(i,r),[i,r]),o=(0,H.useMemo)(()=>{let t=`language-${a.language}`;return W(`hljs`,e,e?.includes(`language-`)?void 0:t)},[e,a.language]),{copied:s,copy:c}=xk({text:i});return(0,U.jsxs)(`div`,{className:`chat-codeblock`,children:[(0,U.jsxs)(`div`,{className:`chat-codeblock-toolbar`,children:[(0,U.jsx)(`span`,{className:`chat-codeblock-language`,children:r}),(0,U.jsxs)(`button`,{type:`button`,className:`chat-codeblock-copy`,onClick:()=>void c(),"aria-label":s?n.copiedCodeLabel:n.copyCodeLabel,children:[s?(0,U.jsx)(jr,{className:`h-3.5 w-3.5`}):(0,U.jsx)(Oa,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:s?n.copiedCodeLabel:n.copyCodeLabel})]})]}),(0,U.jsx)(`pre`,{children:(0,U.jsx)(`code`,{className:o,"data-highlighted":a.highlighted?`true`:`false`,dangerouslySetInnerHTML:{__html:a.html}})})]})}var vA=`nextclaw-inline`,yA=/language-([a-z0-9-]+)/i,bA=new Set([`auto`,`source`,`rendered`]),xA=32,SA=64*1024;function CA(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wA(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function TA(e){return Number.isInteger(e)&&Number(e)>0?Number(e):void 0}function EA(e){let t=wA(e);return t&&bA.has(t)?t:void 0}function DA(e){let{payload:t}=e;return CA(t)?t:null}function OA(e,t){return e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?Number.isFinite(e):t>=xA||typeof e!=`object`?!1:(Array.isArray(e)?e:Object.values(e)).every(e=>OA(e,t+1))}function kA(e){if(e!==void 0)return!CA(e)||!OA(e,0)?null:new TextEncoder().encode(JSON.stringify(e)).byteLength<=SA?e:null}function AA(e){let t=DA(e);if(!t)return null;let n=wA(t.path);if(!n)return null;let r=EA(t.viewer),i=kA(t.params);return i===null||i&&(r===`source`||!/\.html?$/i.test(n))?null:{type:`file`,payload:{path:n,line:TA(t.line),column:TA(t.column),viewer:r,params:i??void 0}}}function jA(e){let t=DA(e);if(!t)return null;let n=wA(t.url);return n?{type:`url`,payload:{url:n}}:null}function MA(e){let t=DA(e);if(!t)return null;let n=wA(t.appId);if(!n)return null;let r=kA(t.params);return r===null?null:{type:`panel_app`,payload:{appId:n,path:wA(t.path),params:r??void 0}}}function NA(e){let t=DA(e);return!t||!(`value`in t)?null:{type:`json`,payload:{value:t.value}}}function PA(e){if(!CA(e))return null;let t=wA(e.type);return t===`file`?AA(e):t===`url`?jA(e):t===`panel_app`?MA(e):t===`json`?NA(e):null}function FA(e){return(e?yA.exec(e):null)?.[1]?.toLowerCase()===vA}function IA(e){let t=e.endsWith(`
|
|
49
|
+
`)?e.slice(0,-1):e,n;try{n=JSON.parse(t)}catch{return null}if(!CA(n))return null;let r=PA(n.target);return r?{target:r,title:wA(n.title),description:wA(n.description)}:null}function LA(e){if(e.title)return e.title;if(e.target.type===`file`){let t=e.target.payload.path.split(`/`).filter(Boolean);return t[t.length-1]??e.target.payload.path}return e.target.type===`url`?e.target.payload.url:e.target.type===`panel_app`?e.target.payload.appId:`JSON`}function RA(e){return e.target.type===`file`?e.target.payload.path:e.target.type===`url`?e.target.payload.url:e.target.type===`panel_app`?e.target.payload.appId:JSON.stringify(e.target.payload.value,null,2)}function zA({display:e}){let t=`h-3.5 w-3.5 shrink-0 text-muted-foreground`;return e.target.type===`file`?(0,U.jsx)(Wn,{className:t,"aria-hidden":!0}):e.target.type===`url`?(0,U.jsx)(no,{className:t,"aria-hidden":!0}):e.target.type===`panel_app`?(0,U.jsx)(fi,{className:t,"aria-hidden":!0}):(0,U.jsx)(Ta,{className:t,"aria-hidden":!0})}function BA(e){return e.length>1200?`${e.slice(0,1200)}\n...`:e}function VA({display:e}){let t=LA(e),n=RA(e),r=e.target.type===`json`?BA(n):n;return(0,U.jsxs)(`section`,{className:W(`my-2 max-w-full border-l-2 border-border bg-muted/30 px-3 py-2`,`text-xs leading-relaxed text-foreground`),"data-nextclaw-inline-display":`true`,"data-nextclaw-inline-display-type":e.target.type,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(zA,{display:e}),(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:t})]}),e.description?(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[12px] text-muted-foreground`,children:e.description}):null,(0,U.jsx)(`pre`,{className:W(`mt-1 max-h-40 overflow-auto whitespace-pre-wrap break-words`,`font-mono text-[11px] leading-relaxed text-muted-foreground`),children:r})]})}function HA({display:e,renderInlineDisplay:t}){let n=t?.(e);return n==null?(0,U.jsx)(VA,{display:e}):(0,U.jsx)(U.Fragment,{children:n})}var UA=.5,WA=4,GA=.25;function KA({actions:e,className:t}){return(0,U.jsx)(`div`,{"data-chat-message-preview-toolbar":`true`,className:W(`absolute right-2 top-2 z-10 flex items-center gap-0.5 rounded-lg bg-black/55 p-1 text-white opacity-80 shadow-lg backdrop-blur-md transition-opacity duration-150 hover:opacity-100 focus-within:opacity-100`,t),children:e.map(e=>(0,U.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,disabled:e.disabled,className:`inline-flex h-8 w-8 items-center justify-center rounded-md transition-colors hover:bg-white/15 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/80 disabled:cursor-not-allowed disabled:opacity-40`,onClick:t=>{t.preventDefault(),t.stopPropagation(),e.onSelect()},children:e.icon},e.id))})}function qA({actions:e=[],children:t,closeLabel:n,label:r,onClose:i,resetZoomLabel:a=`Reset zoom`,zoomInLabel:o=`Zoom in`,zoomOutLabel:s=`Zoom out`}){let c=(0,H.useRef)(null),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)({scale:1,x:0,y:0}),p=(0,H.useCallback)(()=>{f({scale:1,x:0,y:0})},[]),m=(0,H.useCallback)((e,t={x:0,y:0})=>{f(n=>{let r=typeof e==`function`?e(n.scale):e,i=Math.min(WA,Math.max(UA,r));if(i<=1)return{scale:i,x:0,y:0};let a=i/n.scale;return{scale:i,x:t.x-(t.x-n.x)*a,y:t.y-(t.y-n.y)*a}})},[]);(0,H.useEffect)(()=>{let e=document.body.style.overflow;document.body.style.overflow=`hidden`;let t=e=>{if(e.key===`Escape`){e.preventDefault(),i();return}e.key===`+`||e.key===`=`?(e.preventDefault(),m(e=>e+GA)):e.key===`-`?(e.preventDefault(),m(e=>e-GA)):e.key===`0`&&(e.preventDefault(),p())};return window.addEventListener(`keydown`,t),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,t)}},[m,i,p]);let h=e=>{d.scale<=1||e.button!==0||(e.currentTarget.setPointerCapture(e.pointerId),c.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,x:d.x,y:d.y},u(!0))},g=e=>{let t=c.current;!t||t.pointerId!==e.pointerId||f(n=>({...n,x:t.x+e.clientX-t.startX,y:t.y+e.clientY-t.startY}))},_=e=>{c.current?.pointerId===e.pointerId&&(e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),c.current=null,u(!1))},v=e=>{e.preventDefault();let t=e.currentTarget.getBoundingClientRect();m(t=>t+(e.deltaY<0?GA:-GA),{x:e.clientX-t.left-t.width/2,y:e.clientY-t.top-t.height/2})},y=`${Math.round(d.scale*100)}%`,b=[...e,{id:`close`,label:n,icon:(0,U.jsx)(Ai,{className:`h-4 w-4`,strokeWidth:2}),onSelect:i}];return(0,Dy.createPortal)((0,U.jsxs)(`div`,{role:`dialog`,"aria-label":r,"aria-modal":`true`,className:`fixed inset-0 z-[var(--z-modal,10050)] overflow-hidden bg-black/90 backdrop-blur-[2px]`,onClick:i,children:[(0,U.jsx)(KA,{actions:b,className:`right-4 top-4 opacity-100`}),(0,U.jsx)(`div`,{"data-chat-message-lightbox-viewport":`true`,className:W(`absolute inset-0 flex touch-none select-none items-center justify-center overflow-hidden p-6 sm:p-12`,d.scale>1&&(l?`cursor-grabbing`:`cursor-grab`)),onClick:e=>e.stopPropagation(),onDoubleClick:()=>{d.scale===1?m(2):p()},onPointerDown:h,onPointerMove:g,onPointerUp:_,onPointerCancel:_,onWheel:v,children:(0,U.jsx)(`div`,{"data-chat-message-lightbox-content":`true`,className:W(`flex h-full w-full items-center justify-center will-change-transform`,!l&&`transition-transform duration-150 ease-out`),style:{transform:`translate3d(${d.x}px, ${d.y}px, 0) scale(${d.scale})`},children:t})}),(0,U.jsxs)(`div`,{className:`absolute bottom-5 left-1/2 z-10 flex -translate-x-1/2 items-center gap-0.5 rounded-xl bg-black/60 p-1 text-white shadow-xl backdrop-blur-md`,children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":s,title:s,disabled:d.scale<=UA,className:`inline-flex h-9 w-9 items-center justify-center rounded-lg transition-colors hover:bg-white/15 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/80 disabled:cursor-not-allowed disabled:opacity-40`,onClick:e=>{e.stopPropagation(),m(e=>e-GA)},children:(0,U.jsx)(Ao,{className:`h-4 w-4`,strokeWidth:2})}),(0,U.jsx)(`output`,{"aria-label":y,className:`inline-flex h-9 min-w-16 items-center justify-center px-2 text-xs font-medium tabular-nums`,children:y}),(0,U.jsx)(`button`,{type:`button`,"aria-label":o,title:o,disabled:d.scale>=WA,className:`inline-flex h-9 w-9 items-center justify-center rounded-lg transition-colors hover:bg-white/15 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/80 disabled:cursor-not-allowed disabled:opacity-40`,onClick:e=>{e.stopPropagation(),m(e=>e+GA)},children:(0,U.jsx)(Oi,{className:`h-4 w-4`,strokeWidth:2})}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-5 w-px bg-white/20`}),(0,U.jsx)(`button`,{type:`button`,"aria-label":a,title:a,disabled:d.scale===1&&d.x===0&&d.y===0,className:`inline-flex h-9 w-9 items-center justify-center rounded-lg transition-colors hover:bg-white/15 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-white/80 disabled:cursor-not-allowed disabled:opacity-40`,onClick:e=>{e.stopPropagation(),p()},children:(0,U.jsx)(Xo,{className:`h-4 w-4`,strokeWidth:2})})]})]}),document.body)}var JA=200,YA=null;function XA(){return YA??=ae(()=>import(`./mermaid.core-ySrvolIe.js`).then(e=>e.default),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])),YA}function ZA(){if(typeof document>`u`)return`default`;let e=document.documentElement;return e.getAttribute(`data-theme-appearance`)===`dark`||e.classList.contains(`dark`)?`dark`:`default`}function QA(){let[e,t]=(0,H.useState)(ZA);return(0,H.useEffect)(()=>{let e=document.documentElement,n=new MutationObserver(()=>t(ZA()));return n.observe(e,{attributes:!0,attributeFilter:[`class`,`data-theme-appearance`]}),()=>n.disconnect()},[]),e}function $A({isStreaming:e,source:t,texts:n}){let r=(0,H.useId)().replace(/[^a-zA-Z0-9_-]/g,``),i=(0,H.useRef)(0),a=QA(),o=t.trim(),s=`${a}:${o}`,c=(0,H.useRef)({isFinal:!e,key:s,source:o,theme:a}),l=(0,H.useRef)(null),u=(0,H.useRef)(!1),d=(0,H.useRef)(Date.now()),f=(0,H.useRef)(!0),[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),y=n.mermaidDiagramLabel??`Mermaid diagram`,b=n.mermaidExpandLabel??`Expand diagram`,x=n.attachmentCloseLabel??`Close preview`,S=n.mermaidLoadingLabel??`Rendering diagram…`,C=n.mermaidRenderErrorLabel??`Diagram could not be rendered`,{copied:w,copy:T}=xk({text:o}),E=w?n.copiedCodeLabel:n.copyCodeLabel,D=(0,H.useCallback)(e=>{if(!f.current||u.current)return;if(l.current!==null){if(!e)return;window.clearTimeout(l.current),l.current=null}let t=Date.now()-d.current,n=e?0:Math.max(0,JA-t);l.current=window.setTimeout(()=>{l.current=null,g(c.current)},n)},[]);(0,H.useEffect)(()=>(f.current=!0,()=>{f.current=!1,l.current!==null&&(window.clearTimeout(l.current),l.current=null)}),[]),(0,H.useEffect)(()=>{c.current={isFinal:!e,key:s,source:o,theme:a},D(!e)},[e,o,s,D,a]),(0,H.useEffect)(()=>{if(!h)return;let e=!0;return(async()=>{u.current=!0,d.current=Date.now();try{let t=await XA();if(!e||!f.current)return;i.current+=1;let n=`nextclaw-mermaid-${r}-${i.current}`;t.initialize({securityLevel:`strict`,startOnLoad:!1,suppressErrorRendering:!0,theme:h.theme});let a=await t.parse(h.source,{suppressErrors:!0});if(!e||!f.current)return;if(!a)throw Error(`Invalid Mermaid diagram`);let{svg:o}=await t.render(n,h.source);e&&f.current&&c.current.theme===h.theme&&v({key:h.key,status:`rendered`,svg:o})}catch{e&&f.current&&h.isFinal&&c.current.key===h.key&&v({key:h.key,status:`error`})}finally{u.current=!1;let t=c.current;e&&f.current&&(t.key!==h.key||t.isFinal!==h.isFinal)&&D(t.isFinal)}})(),()=>{e=!1}},[r,h,D]);let O=_?.key===s?_:null;if(O?.status===`error`)return(0,U.jsxs)(`div`,{"data-chat-mermaid-error":`true`,className:`my-3 overflow-hidden rounded-xl border border-border bg-muted/25`,children:[(0,U.jsx)(`div`,{className:`border-b border-border px-3 py-2 text-xs text-muted-foreground`,children:C}),(0,U.jsx)(_A,{className:`language-mermaid`,texts:n,children:o})]});let k=_?.status===`rendered`?_:null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`figure`,{"aria-label":y,"aria-busy":!O,"data-chat-mermaid-diagram":`true`,"data-chat-mermaid-pending":!k||void 0,"data-chat-mermaid-updating":!O||void 0,className:k?`group/mermaid relative my-3 min-h-24 overflow-auto py-2`:`my-3 flex min-h-14 items-center justify-center rounded-xl bg-muted/20 px-3 py-2`,children:k?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,"aria-label":b,title:b,className:`relative block min-w-full cursor-zoom-in border-0 bg-transparent p-0 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>m(!0),children:(0,U.jsx)(`span`,{className:`block min-w-fit [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:{__html:k.svg}})}),(0,U.jsx)(KA,{actions:[{id:`copy-source`,label:E,icon:w?(0,U.jsx)(jr,{className:`h-4 w-4`,strokeWidth:2}):(0,U.jsx)(Oa,{className:`h-4 w-4`,strokeWidth:2}),onSelect:()=>void T()},{id:`expand`,label:b,icon:(0,U.jsx)(Pa,{className:`h-4 w-4`,strokeWidth:2}),onSelect:()=>m(!0)}]})]}):(0,U.jsxs)(`div`,{role:`status`,className:`inline-flex items-center gap-2 text-xs font-medium text-muted-foreground/80`,children:[(0,U.jsx)(Di,{"aria-hidden":`true`,className:`h-3.5 w-3.5 animate-spin motion-reduce:animate-none`}),(0,U.jsx)(`span`,{children:S})]})}),p&&k?(0,U.jsx)(qA,{closeLabel:x,label:y,onClose:()=>m(!1),zoomInLabel:n.previewZoomInLabel,zoomOutLabel:n.previewZoomOutLabel,resetZoomLabel:n.previewResetZoomLabel,actions:[{id:`copy-source`,label:E,icon:w?(0,U.jsx)(jr,{className:`h-4 w-4`,strokeWidth:2}):(0,U.jsx)(Oa,{className:`h-4 w-4`,strokeWidth:2}),onSelect:()=>void T()}],children:(0,U.jsx)(`div`,{"data-chat-mermaid-expanded-canvas":`true`,className:`h-full w-full overflow-hidden rounded-xl bg-background p-4 shadow-2xl [&_svg]:mx-auto [&_svg]:!h-full [&_svg]:!w-full [&_svg]:!max-w-none`,dangerouslySetInnerHTML:{__html:k.svg}})}):null]})}function ej({alt:e,expandLabel:t,closeLabel:n,resetZoomLabel:r,sizeLabel:i,src:a,zoomInLabel:o,zoomOutLabel:s}){let[c,l]=(0,H.useState)(!1),u=()=>l(!0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{"data-chat-message-image-preview":!0,className:`group/image relative block w-fit max-w-[min(100%,32rem)] overflow-hidden rounded-lg`,children:[(0,U.jsx)(`button`,{type:`button`,className:`block w-fit max-w-[min(100%,32rem)] text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:u,onDoubleClick:e=>{e.preventDefault(),u()},"aria-label":t,children:(0,U.jsx)(`img`,{src:a,alt:e,className:`block h-auto w-auto max-h-[26rem] max-w-full rounded-lg bg-transparent object-contain`})}),(0,U.jsx)(KA,{actions:[{id:`expand`,label:t,icon:(0,U.jsx)(Pa,{className:`h-4 w-4`,strokeWidth:2}),onSelect:u}]}),i?(0,U.jsx)(`span`,{className:`pointer-events-none absolute inset-x-0 bottom-0 flex items-end justify-start bg-gradient-to-t from-black/50 via-black/15 to-transparent px-2.5 pb-2 pt-8 opacity-0 transition-opacity duration-150 group-hover/image:opacity-100 group-focus-within/image:opacity-100`,children:(0,U.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-black/40 px-1.5 py-0.5 text-[10px] font-medium text-white/95 backdrop-blur-sm`,children:i})}):null]}),c?(0,U.jsx)(qA,{closeLabel:n,label:e,onClose:()=>l(!1),resetZoomLabel:r,zoomInLabel:o,zoomOutLabel:s,children:(0,U.jsx)(`img`,{src:a,alt:e,className:`max-h-full max-w-full object-contain shadow-2xl`})}):null]})}var tj=new Set([`http:`,`https:`,`mailto:`,`tel:`]),nj=/^[a-zA-Z][a-zA-Z\d+.-]*:/,rj=/^[a-z]:[\\/]/i,ij=/^\/[a-z]:[\\/]/i,aj=`file:`;function oj(e){return!e.startsWith(`//`)&&!nj.test(e)}function sj(e){let t=Number(e);return Number.isSafeInteger(t)&&t>0?t:void 0}function cj(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==aj||t.hostname&&t.hostname.toLowerCase()!==`localhost`)return null;let n;try{n=decodeURIComponent(t.pathname)}catch{return null}return ij.test(n)&&(n=n.slice(1)),n?{path:n,query:t.searchParams,fragment:t.hash.slice(1)}:null}function lj(e){let t=e.indexOf(`#`),n=t>=0?e.slice(0,t):e,r=t>=0?e.slice(t+1):``,i=n.indexOf(`?`),a=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1):``,s;try{s=decodeURIComponent(a)}catch{return null}return s?{path:s,query:new URLSearchParams(o),fragment:r}:null}function uj(e){let t=/^L(\d+)(?:C(\d+))?(?:-L\d+(?:C\d+)?)?$/i.exec(e),n=sj(t?.[1]);return{line:n,column:n?sj(t?.[2]):void 0}}function dj(e){if(rj.test(e)||oj(e))return e;try{let t=new URL(e);return tj.has(t.protocol)||t.protocol===aj&&cj(e)?e:``}catch{return``}}function fj(e){return e&&dj(e)||null}function pj(e){return/^https?:\/\//i.test(e)}function mj(e){let t=e.toLowerCase().startsWith(aj)?cj(e):lj(e),n=t?.path;if(!n||n.startsWith(`#`)||n.startsWith(`//`)||!rj.test(n)&&nj.test(n))return null;let r=t.query.get(`viewer`),i=uj(t.fragment),a=/^(.*?)(?::(\d+)(?::(\d+))?)$/.exec(n),o=a?.[1]??n,s=i.line??sj(a?.[2]),c=i.column??(s?sj(a?.[3]):void 0);return{path:o,label:o.split(/[\\/]/).filter(Boolean).pop()??o,viewMode:`preview`,...r===`source`||r===`rendered`?{previewViewer:r}:{},...typeof s==`number`?{line:s}:{},...typeof c==`number`?{column:c}:{}}}var hj=`data-chat-inline-token-kind`,gj=`data-chat-inline-token-key`,_j=`data-chat-inline-token-ref`,vj=`data-chat-inline-token-name`,yj=`data-chat-inline-token-source`,bj=`data-chat-inline-token-path`,xj=`data-chat-inline-token-label`,Sj=`data-chat-inline-token-raw-text`,Cj=`data-chat-inline-token-excerpt`,wj=`data-chat-inline-token-message-id`,Tj=`data-chat-inline-token-role`,Ej=`data-chat-inline-token-start-line`,Dj=`data-chat-inline-token-end-line`;function Oj(e){return e.filter(e=>e.rawText).sort((e,t)=>t.rawText.length-e.rawText.length)}function kj(e){let t={[hj]:e.kind,[xj]:e.label,[Sj]:e.rawText};return`ref`in e?(t[_j]=e.ref,t[vj]=e.name,e.source&&(t[yj]=e.source),e.path&&(t[bj]=e.path)):(t[gj]=e.key,e.kind===`workspace_excerpt`&&`path`in e?(t[bj]=e.path,t[Cj]=e.excerpt,e.startLine!==null&&(t[Ej]=String(e.startLine)),e.endLine!==null&&(t[Dj]=String(e.endLine))):e.kind===`conversation_excerpt`&&`messageId`in e&&(t[Cj]=e.excerpt,t[wj]=e.messageId,t[Tj]=e.role)),{type:`chatInlineToken`,data:{hName:`span`,hProperties:t,hChildren:[{type:`text`,value:e.label}]}}}function Aj(e,t,n){let r=null;for(let i of n){let n=e.indexOf(i.rawText,t);n<0||(!r||n<r.index||n===r.index&&i.rawText.length>r.token.rawText.length)&&(r={index:n,token:i})}return r}var jj=class{constructor(e){this.tokens=e,this.occurrenceCounts=new Map,this.transform=e=>e.type===`code`||e.type===`inlineCode`||!e.children?e:{...e,children:e.children.flatMap(e=>e.type===`text`&&typeof e.value==`string`?this.splitTextNode(e.value):[this.transform(e)])},this.splitTextNode=e=>{let t=[],n=0;for(;n<e.length;){let r=Aj(e,n,this.tokens);if(!r){t.push({type:`text`,value:e.slice(n)});break}r.index>n&&t.push({type:`text`,value:e.slice(n,r.index)});let i=this.tokens.filter(e=>e.rawText===r.token.rawText),a=this.occurrenceCounts.get(r.token.rawText)??0,o=i[Math.min(a,i.length-1)]??r.token;this.occurrenceCounts.set(r.token.rawText,a+1),t.push(kj(o)),n=r.index+r.token.rawText.length}return t.length>0?t:[{type:`text`,value:e}]}}};function Mj(e){let t=Oj(e);return()=>e=>t.length>0?new jj(t).transform(e):e}function Nj(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function Pj(e){let t=Nj(e,yj);return t===`builtin`||t===`global`||t===`project`||t===`workspace`?t:null}function Fj(e,t){let n=Number(Nj(e,t));return Number.isInteger(n)&&n>0?n:null}function Ij(e){let t=Nj(e,hj),n=Nj(e,xj),r=Nj(e,Sj);if(t===`skill`&&n&&r){let i=Nj(e,_j),a=Nj(e,vj);return i&&a?{kind:t,ref:i,name:a,source:Pj(e),path:Nj(e,bj),label:n,rawText:r}:null}let i=Nj(e,gj);if(t===`workspace_excerpt`&&i&&n&&r){let a=Nj(e,bj),o=Nj(e,Cj);return a&&o?{kind:t,key:i,path:a,label:n,excerpt:o,startLine:Fj(e,Ej),endLine:Fj(e,Dj),rawText:r}:null}if(t===`conversation_excerpt`&&i&&n&&r){let a=Nj(e,Cj),o=Nj(e,wj),s=Nj(e,Tj);return a&&o&&(s===`assistant`||s===`user`)?{kind:t,key:i,messageId:o,role:s,label:n,excerpt:a,rawText:r}:null}return t&&i&&n&&r?{kind:t,key:i,label:n,rawText:r}:null}var Lj=14e4;function Rj(e){return e.length<=Lj?e:`${e.slice(0,Lj)}\n\n...`}function zj(e){let t=0;for(let n of e?.children??[]){if(n.type===`text`){let e=n.value??``;if(e.trim().length>0||e.includes(`
|
|
50
|
+
`)||e.includes(`\r`))return!1;continue}if(n.tagName!==`img`)return!1;t+=1}return t>=3}var Bj=(0,H.createContext)(null);function Vj(){let e=(0,H.useContext)(Bj);if(!e)throw Error(`Chat message Markdown renderer requires its runtime context`);return e}var Hj={p:function({node:e,children:t}){let{inline:n}=Vj();return n?(0,U.jsx)(U.Fragment,{children:t}):(0,U.jsx)(`p`,{"data-chat-image-row":zj(e)?`three-column`:void 0,children:t})},span:function({node:e,children:t,...n}){let{onInlineTokenClick:r,texts:i}=Vj(),a=Ij(n);if(a){let e=`excerpt`in a?a:null,t=a.kind===`workspace_excerpt`&&`path`in a?a:null;return(0,U.jsx)(ck,{characterCountLabel:t?i.excerptCharacterCountTemplate?.replace(`{count}`,String(db(t.excerpt))):void 0,excerpt:e?.excerpt,kind:a.kind,label:a.label,location:t?.startLine?t.startLine===t.endLine||!t.endLine?`L${t.startLine}`:`L${t.startLine}–${t.endLine}`:void 0,path:t?.path,tooltip:`ref`in a?a.name:a.key,onClick:r&&a.kind!==`conversation_excerpt`?()=>r(a):void 0})}return(0,U.jsx)(`span`,{...n,children:t})},a:function({node:e,href:t,children:n,...r}){let{onFileOpen:i}=Vj(),a=fj(t),o=a?pj(a):!1,s=o?null:a?mj(a):null,c=e=>{if(!a){e.preventDefault();return}!i||!s||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),i(s))};return(0,U.jsx)(`a`,{...r,className:W(r.className,!a&&`chat-link-invalid`),href:a??`#`,"aria-disabled":!a||void 0,onClick:c,target:o?`_blank`:void 0,rel:o?`noreferrer noopener`:void 0,children:n})},table:function({node:e,children:t,...n}){return(0,U.jsx)(`div`,{className:`chat-table-wrap`,children:(0,U.jsx)(`table`,{...n,children:t})})},input:function({node:e,type:t,checked:n,...r}){return t===`checkbox`?(0,U.jsx)(`input`,{...r,type:`checkbox`,checked:n,readOnly:!0,disabled:!0,className:`chat-task-checkbox`}):(0,U.jsx)(`input`,{...r,type:t})},img:function({node:e,src:t,alt:n}){let{resolveFileContentUrl:r,texts:i}=Vj(),a=fj(t);if(!a)return null;let o=mj(a),s=o&&r?r(o):a;return s?(0,U.jsx)(ej,{alt:n||``,closeLabel:i.attachmentCloseLabel??`Close preview`,expandLabel:i.attachmentExpandLabel??`Expand image`,resetZoomLabel:i.previewResetZoomLabel,sizeLabel:null,src:s,zoomInLabel:i.previewZoomInLabel,zoomOutLabel:i.previewZoomOutLabel}):null},code:function({node:e,className:t,children:n,...r}){let{isStreaming:i,renderInlineDisplay:a,texts:o}=Vj(),s=String(n??``);if(!t&&!s.includes(`
|
|
51
|
+
`))return(0,U.jsx)(`code`,{...r,className:W(`chat-inline-code`,t),children:n});let c=FA(t)?IA(s):null;return c?(0,U.jsx)(HA,{display:c,renderInlineDisplay:a}):t?.split(` `).includes(`language-mermaid`)?(0,U.jsx)($A,{isStreaming:i,source:s,texts:o}):(0,U.jsx)(_A,{className:t,texts:o,children:n})}};function Uj({text:e,role:t,texts:n,inline:r=!1,isStreaming:i=!1,inlineTokens:a,onFileOpen:o,onInlineTokenClick:s,resolveFileContentUrl:c,renderInlineDisplay:l}){let u=t===`user`,d=a?.length?[sk,Mj(a)]:[sk],f=r?`span`:`div`;return(0,U.jsx)(Bj.Provider,{value:{inline:r,isStreaming:i,isUser:u,onFileOpen:o,onInlineTokenClick:s,renderInlineDisplay:l,resolveFileContentUrl:c,texts:n},children:(0,U.jsx)(f,{className:W(`chat-markdown`,u?`chat-markdown-user`:`chat-markdown-assistant`),children:(0,U.jsx)(ate,{skipHtml:!0,remarkPlugins:d,components:Hj,urlTransform:dj,children:Rj(e)})})})}var Wj={archive:`bg-muted text-muted-foreground`,audio:`bg-muted text-muted-foreground`,code:`bg-muted text-muted-foreground`,data:`bg-muted text-muted-foreground`,document:`bg-muted text-muted-foreground`,generic:`bg-muted text-muted-foreground`,image:`bg-muted text-muted-foreground`,pdf:`bg-muted text-muted-foreground`,sheet:`bg-muted text-muted-foreground`,video:`bg-muted text-muted-foreground`},Gj=new Set([`c`,`cpp`,`css`,`go`,`html`,`java`,`js`,`jsx`,`md`,`php`,`py`,`rb`,`rs`,`sh`,`sql`,`svg`,`ts`,`tsx`]),Kj=new Set([`graphql`,`json`,`toml`,`xml`,`yaml`,`yml`]),qj=new Set([`avif`,`bmp`,`gif`,`heic`,`heif`,`ico`,`jpeg`,`jpg`,`png`,`svg`,`tif`,`tiff`,`webp`]),Jj=new Set([`aac`,`flac`,`m4a`,`mp3`,`ogg`,`opus`,`wav`,`weba`]),Yj=new Set([`avi`,`m4v`,`mov`,`mp4`,`mkv`,`webm`,`wmv`]),Xj=new Set([`doc`,`docx`,`odt`,`pages`,`rtf`,`txt`]),Zj=new Set([`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]),Qj=new Set([`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`zip`]);function $j(e){if(!Number.isFinite(e)||e==null||e<0)return null;if(e===0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;let i=n>=10||r===0?0:1;return`${n.toFixed(i).replace(/\.0$/,``)} ${t[r]}`}function eM(e,t){let n=tM(e);if(n)return n.toUpperCase();let r=(t.split(`/`)[1]??``).split(/[+.;-]/)[0]?.trim();return r?r.slice(0,6).toUpperCase():`FILE`}function tM(e){return/\.([a-z0-9]{1,12})$/i.exec(e.trim())?.[1]?.toLowerCase()??``}function nM(e){return typeof e==`string`&&/^data:image\//i.test(e.trim())}function rM(e){return qj.has(e)?e===`jpg`||e===`jpeg`?`image/jpeg`:e===`svg`?`image/svg+xml`:`image/${e}`:Jj.has(e)?e===`mp3`?`audio/mpeg`:e===`m4a`?`audio/mp4`:e===`weba`?`audio/webm`:`audio/${e}`:Yj.has(e)?e===`mov`?`video/quicktime`:e===`m4v`?`video/mp4`:`video/${e}`:e===`pdf`?`application/pdf`:null}function iM(e){let t=tM(e);return t?rM(t):null}function aM(e){let t=e.mimeType.trim().toLowerCase();return t.length>0&&t!==`application/octet-stream`?t:iM(e.label)}function oM(e){let t=e.mimeType.trim().toLowerCase(),n=tM(e.label);return e.isImage||t.startsWith(`image/`)||qj.has(n)||nM(e.dataUrl)}function sM(e,t){let n=tM(e),r=t.toLowerCase();return r.startsWith(`image/`)||qj.has(n)?`image`:r.startsWith(`audio/`)||Jj.has(n)?`audio`:r.startsWith(`video/`)||Yj.has(n)?`video`:r.includes(`pdf`)||n===`pdf`?`pdf`:Qj.has(n)||/(zip|tar|gzip|rar|compressed|archive)/.test(r)?`archive`:Zj.has(n)||/(spreadsheet|sheet|excel|csv)/.test(r)?`sheet`:Kj.has(n)||/(json|xml|yaml|toml)/.test(r)?`data`:Gj.has(n)||/(javascript|typescript|jsx|tsx|css|html)/.test(r)?`code`:Xj.has(n)||/(msword|document|opendocument|rtf|text\/)/.test(r)?`document`:`generic`}function cM(e){let t=sM(e.label,e.mimeType),n=$j(e.sizeBytes);return{category:t,extension:eM(e.label,e.mimeType),sizeLabel:n}}var lM={archive:`Archive`,audio:`Audio`,code:`Code file`,data:`Data file`,document:`Document`,generic:`File`,image:`Image`,pdf:`PDF document`,sheet:`Spreadsheet`,video:`Video`},uM={archive:Ia,audio:La,code:Ra,data:Ba,document:Wn,generic:Wa,image:za,pdf:Wn,sheet:Ha,video:Ua};function dM(e,t){return t?.attachmentCategoryLabels?.[e]??lM[e]}function fM(e,t,n){return(0,U.jsx)(`div`,{className:W(`mt-0.5 text-[11px] leading-4`,n?`text-foreground/55`:`text-muted-foreground`),children:t?`${e} · ${t}`:e})}function pM(e,t,n){return(0,U.jsx)(`span`,{className:W(`inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-medium`,n?t?`bg-black/5 text-foreground/75`:`bg-muted text-muted-foreground`:t?`bg-black/[0.03] text-foreground/45`:`bg-muted/70 text-muted-foreground/70`),children:e})}function mM(e){let{label:t,href:n,isUser:r,onOpen:i}=e,a=W(`inline-flex items-center rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors`,r?`bg-black/5 text-foreground/75 hover:bg-black/10 hover:text-foreground`:`bg-muted text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`);return i?(0,U.jsx)(`button`,{type:`button`,className:a,onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},children:t}):n?(0,U.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:a,children:t}):pM(t,r,!1)}function hM({category:e,isUser:t}){let n=uM[e];return(0,U.jsx)(`div`,{className:W(`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg`,t?`bg-black/5 text-foreground/70`:Wj[e]),children:(0,U.jsx)(n,{className:W(`h-4 w-4`,t?`text-foreground/70`:`text-current`),strokeWidth:2})})}function gM(e){let{category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,action:o}=e;return(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5 px-2.5 py-2`,children:[(0,U.jsx)(hM,{category:t,isUser:a}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-[13px] font-medium leading-5`,children:n.label}),fM(r,i,a)]}),o]})})]})}function _M(e){let{category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,shellClasses:o,actionLabel:s,onOpen:c}=e;if(!n.dataUrl||t!==`audio`&&t!==`video`)return null;let l=aM(n);return(0,U.jsxs)(`div`,{className:o,children:[gM({category:t,file:n,categoryLabel:r,sizeLabel:i,isUser:a,action:mM({label:s,href:n.dataUrl,isUser:a,onOpen:c?()=>c(n):void 0})}),(0,U.jsx)(`div`,{className:`px-2.5 pb-2.5`,children:t===`audio`?(0,U.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":n.label,className:`block w-full`,children:(0,U.jsx)(`source`,{src:n.dataUrl,...l?{type:l}:{}})}):(0,U.jsx)(`div`,{className:W(`overflow-hidden rounded-lg`,a?`bg-black/10`:`bg-muted ring-1 ring-border/70`),children:(0,U.jsx)(`video`,{controls:!0,preload:`metadata`,playsInline:!0,"aria-label":n.label,className:`block max-h-[28rem] w-full bg-black`,children:(0,U.jsx)(`source`,{src:n.dataUrl,...l?{type:l}:{}})})})})]})}function vM({file:e,isUser:t=!1,texts:n,onOpen:r}){let{category:i,sizeLabel:a}=cM(e),o=oM(e)&&!!e.dataUrl,s=i===`audio`&&!!e.dataUrl,c=i===`video`&&!!e.dataUrl,l=!!e.dataUrl,u=l?n?.attachmentOpenLabel??`Open`:n?.attachmentAttachedLabel??`Attached`,d=n?.attachmentExpandLabel??`Expand image`,f=n?.attachmentCloseLabel??`Close preview`,p=dM(i,n),m=W(`block overflow-hidden rounded-xl border transition-colors`,t?`border-black/8 bg-black/[0.03] text-foreground`:`border-border/70 bg-card text-card-foreground`,l&&(t?`hover:bg-black/[0.05]`:`hover:bg-muted/50`));if(o&&e.dataUrl)return(0,U.jsx)(ej,{alt:e.label,expandLabel:d,closeLabel:f,resetZoomLabel:n?.previewResetZoomLabel,sizeLabel:a,src:e.dataUrl,zoomInLabel:n?.previewZoomInLabel,zoomOutLabel:n?.previewZoomOutLabel});if(s||c)return _M({category:i,file:e,categoryLabel:p,sizeLabel:a,isUser:t,shellClasses:m,actionLabel:u,onOpen:r});let h=gM({category:i,file:e,categoryLabel:p,sizeLabel:a,isUser:t,action:pM(u,t,l)});return!l||!e.dataUrl?(0,U.jsx)(`div`,{className:m,children:h}):r?(0,U.jsx)(`button`,{type:`button`,className:W(m,`group w-full text-left`),onClick:()=>r(e),children:h}):(0,U.jsx)(`a`,{href:e.dataUrl,target:`_blank`,rel:`noreferrer`,className:W(m,`group`),children:h})}function yM({group:e,indexOffset:t,isUser:n,texts:r,onOpen:i}){return(0,U.jsx)(`div`,{"data-chat-message-image-row":`three-column`,"data-chat-message-wide-content":`true`,className:`grid w-full grid-cols-3 items-start gap-3`,children:e.items.map(({index:e,part:a})=>(0,U.jsx)(vM,{file:a.file,isUser:n,texts:r,onOpen:i},`file-${t+e}`))})}function bM(e){return!!(e?.kind===`part`&&e.part.type===`file`&&e.part.file.isImage&&e.part.file.dataUrl)}function xM(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(!bM(r)){r&&t.push(r),n+=1;continue}let i=n,a=[];for(;bM(e[n]);)a.push(e[n]),n+=1;if(a.length<3){t.push(...a);continue}t.push({kind:`image-group`,key:`image-group-${i}`,items:a})}return t}function SM(e){let{isInProgress:t}=e,[n,r]=(0,H.useState)(t),[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(t);(0,H.useEffect)(()=>{let e=o.current;!e&&t?(r(!0),a(!1)):e&&!t&&!i&&r(!1),o.current=t},[t,i]);function s(e){e.preventDefault();let i=!n;if(r(i),!i){a(!1);return}t&&a(!0)}return{isOpen:n,onSummaryClick:s}}var CM=10;function wM({contentRef:e,contentVersion:t,hasContent:n,isLoading:r,resetKey:i,scrollRef:a,stickyThresholdPx:o}){let[s,c]=(0,H.useState)(!0),l=(0,H.useRef)(!0),u=(0,H.useRef)(null),d=(0,H.useRef)(!1),f=(0,H.useRef)(null),p=(0,H.useCallback)(e=>{l.current=e,c(e)},[]),m=(0,H.useCallback)(e=>e.scrollHeight-e.scrollTop-e.clientHeight<=(o??CM),[o]),h=(0,H.useCallback)(()=>{let e=f.current;e!==null&&(cancelAnimationFrame(e),f.current=null)},[]),g=(0,H.useCallback)((e=`auto`)=>{a.current&&(h(),f.current=requestAnimationFrame(()=>{f.current=null;let t=a.current;t&&(typeof t.scrollTo==`function`?t.scrollTo({top:t.scrollHeight,behavior:e}):t.scrollTop=t.scrollHeight)}))},[h,a]),_=(0,H.useCallback)(()=>{p(!0),g()},[g,p]),v=(0,H.useCallback)(()=>{let e=a.current;if(!e)return;let t=m(e);t||h(),p(t)},[h,m,a,p]);return(0,H.useEffect)(()=>{u.current!==i&&(u.current=i,p(!0),d.current=!0)},[i,p]),(0,H.useEffect)(()=>h,[h]),(0,H.useEffect)(()=>{let t=e?.current;if(!t||!n||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(()=>{l.current&&g()});return r.observe(t),()=>r.disconnect()},[e,n,g,i]),(0,H.useLayoutEffect)(()=>{!d.current||r||!n||(d.current=!1,g())},[n,r,g]),(0,H.useLayoutEffect)(()=>{!l.current||!n||g()},[t,n,g]),{isAtBottom:s,onScroll:v,scrollToBottom:_}}var TM=`inline-flex h-[1.15em] w-[1.15em] shrink-0 items-center justify-center text-current`,EM=`group/process-row flex w-full min-w-0 items-center gap-1.5 py-0 text-[0.925rem] font-normal leading-[1.72] text-muted-foreground/80`;function DM({children:e,className:t}){return(0,U.jsx)(`span`,{className:W(TM,t),children:e})}function OM({position:e}){return(0,U.jsx)(`span`,{"aria-hidden":`true`,"data-tool-workflow-rail":`true`,className:W(`pointer-events-none absolute left-[0.575em] w-px -translate-x-1/2 bg-border/70`,e===`first`?`bottom-0 top-[0.86em]`:e===`last`?`top-0 h-[0.86em]`:`inset-y-0`)})}function kM({children:e,className:t,interactive:n=!1,onClick:r,role:i,tabIndex:a,onKeyDown:o}){return(0,U.jsx)(`div`,{"data-chat-process-meta-row":`true`,className:W(EM,n?`cursor-pointer transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35`:null,t),onClick:r,role:i,tabIndex:a,onKeyDown:o,children:e})}function AM({label:e,openGroup:t,open:n=!1,icon:r,className:i,leadingIconClassName:a,labelClassName:o,onClick:s}){return(0,U.jsxs)(`button`,{type:`button`,"data-chat-process-meta-row":`true`,className:W(EM,`m-0 w-full border-0 bg-transparent p-0 text-left shadow-none transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35`,i),"aria-expanded":n,onClick:s,children:[r?(0,U.jsx)(DM,{className:W(`relative z-[1] rounded-sm`,a),children:(0,U.jsx)(r,{className:`h-[1.05em] w-[1.05em]`,strokeWidth:2.25})}):null,(0,U.jsx)(`span`,{className:W(`min-w-0 shrink truncate`,o),children:e}),(0,U.jsx)(`span`,{className:W(`inline-flex h-[1.15em] w-[1.15em] shrink-0 items-center justify-center text-muted-foreground/80 transition-opacity`,n?`opacity-100`:`opacity-0 group-hover/process-row:opacity-100 focus-visible:opacity-100`),children:(0,U.jsx)(ha,{className:W(`h-[1.05em] w-[1.05em] transition-transform`,n&&`rotate-90`),strokeWidth:2.25})})]})}function jM(e,t,n){let r=Array.from(t).length;return(n??`${e} · {count}`).split(`{count}`).join(String(r))}function MM({label:e,text:t,characterCountTemplates:n,isUser:r,isInProgress:i}){let{isOpen:a,onSummaryClick:o}=SM({isInProgress:i}),s=(0,H.useRef)(null),c=jM(e,t,i?n?.inProgress:n?.completed),{onScroll:l}=wM({scrollRef:s,resetKey:`reasoning`,isLoading:!1,hasContent:t.length>0,contentVersion:t,stickyThresholdPx:20});return(0,U.jsxs)(`div`,{className:`group/reasoning`,children:[(0,U.jsx)(AM,{openGroup:`reasoning`,open:a,icon:da,leadingIconClassName:r?`bg-primary`:`bg-card`,label:c,labelClassName:r?`text-primary-100`:void 0,onClick:o}),a?(0,U.jsx)(`div`,{ref:s,onScroll:l,"data-reasoning-scroll":`true`,className:W(`mt-1 w-fit max-w-[500px] max-h-56 overflow-y-auto rounded-lg custom-scrollbar`,r?`bg-primary/70`:`bg-muted`),children:(0,U.jsx)(`pre`,{className:`min-w-0 whitespace-pre-wrap break-all p-2 text-[11px]`,children:t})}):null]})}function NM({children:e,className:t}){return(0,U.jsx)(`div`,{className:W(`relative my-0 flex w-full min-w-0 max-w-full flex-col text-[0.925rem] leading-[1.72] text-muted-foreground`,t),children:e})}function PM({children:e,className:t}){return(0,U.jsx)(`div`,{className:W(`mt-0.5 w-full max-w-full min-w-0 overflow-hidden pl-[calc(1.15em+0.375rem)] text-[0.925rem] leading-[1.72] text-muted-foreground`,t),children:e})}function FM({label:e,tone:t,children:n}){let r={input:{dot:`bg-muted-foreground/60`,body:`text-foreground`},output:{dot:`bg-primary/70`,body:`text-foreground`},error:{dot:`bg-rose-500/80`,body:`text-rose-950/85`}}[t];return(0,U.jsxs)(`section`,{className:`overflow-hidden rounded-md border border-border/70 bg-muted/20`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/60 px-2.5 py-1.5 text-[10px] font-medium tracking-wide text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:W(`h-1.5 w-1.5 rounded-full`,r.dot)}),(0,U.jsx)(`span`,{className:`normal-case tracking-normal`,children:e})]}),(0,U.jsx)(`div`,{className:`w-full overflow-hidden`,children:(0,U.jsx)(`pre`,{className:W(`w-full max-w-full min-w-0 max-h-64 overflow-x-auto overflow-y-auto px-2.5 py-2 font-mono text-[12px] leading-relaxed whitespace-pre custom-scrollbar`,r.body),children:n})})]})}var IM={running:{text:`text-muted-foreground`,icon:Di,spin:!0},success:{text:`text-muted-foreground/75`,icon:jr,spin:!1},error:{text:`text-destructive`,icon:hs,spin:!1},cancelled:{text:`text-muted-foreground/70`,icon:Ao,spin:!1}};function LM({card:e,iconOnly:t=!1}){let n=IM[e.statusTone]||IM.cancelled,r=n.icon,i=!t&&(e.statusTone===`running`||e.statusTone===`error`);return(0,U.jsxs)(`span`,{className:W(`inline-flex shrink-0 items-center gap-1 text-[0.925rem] font-normal leading-[1.72]`,n.text),"aria-label":t?e.statusLabel:void 0,children:[(0,U.jsx)(r,{"aria-hidden":`true`,className:W(`h-[1.05em] w-[1.05em]`,n.spin&&`animate-spin`),strokeWidth:2.25}),i?e.statusLabel:null]})}function RM(e){return e.kind===`show-content`?{icon:Fa,label:e.label,toneClassName:`border-border/70 bg-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground focus-visible:ring-primary/35`}:{icon:sa,label:e.label??(e.sessionKind===`child`?`Open child session`:`Open session`),toneClassName:`border-border/70 bg-transparent text-muted-foreground hover:bg-muted/60 hover:text-foreground focus-visible:ring-primary/35`}}function zM({action:e,onAction:t}){let{Tooltip:n,TooltipContent:r,TooltipProvider:i,TooltipTrigger:a}=Nl,o=RM(e),s=o.icon;return(0,U.jsx)(i,{delayDuration:250,children:(0,U.jsxs)(n,{children:[(0,U.jsx)(a,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,onClick:n=>{n.stopPropagation(),t(e)},className:W(`inline-flex h-6 w-6 items-center justify-center rounded-md border transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1`,o.toneClassName),"aria-label":o.label,title:o.label,children:(0,U.jsx)(s,{className:`h-3.5 w-3.5`,strokeWidth:2.25})})}),(0,U.jsx)(r,{side:`top`,className:`text-xs`,children:o.label})]})})}function BM(e){return e.replace(/[_-]+/g,` `).replace(/\s+/g,` `).trim()}function VM(e,t){e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),t())}function HM({label:e,summary:t}){return(0,U.jsxs)(`span`,{className:`min-w-0 shrink truncate`,children:[e,t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`mx-1.5 select-none text-muted-foreground/45`,children:`·`}),(0,U.jsx)(`span`,{title:t,children:t})]}):null]})}function UM({expanded:e}){return(0,U.jsx)(`span`,{className:W(`inline-flex h-[1.15em] w-[1.15em] shrink-0 items-center justify-center text-muted-foreground/80 transition-opacity`,e?`opacity-100`:`opacity-0 group-hover/process-row:opacity-100 group-focus-within/process-row:opacity-100`),children:(0,U.jsx)(ha,{className:W(`h-[1.05em] w-[1.05em] transition-transform`,e&&`rotate-90`),strokeWidth:2.25})})}function WM({additions:e,deletions:t}){if(e===0&&t===0)return null;let n=[e>0?`+${e}`:null,t>0?`-${t}`:null].filter(Boolean).join(` `);return(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 tabular-nums text-muted-foreground/75`,"aria-label":n,children:[e>0?(0,U.jsxs)(`span`,{className:`transition-colors group-hover/process-row:text-emerald-600`,children:[`+`,e]}):null,t>0?(0,U.jsxs)(`span`,{className:`transition-colors group-hover/process-row:text-rose-600`,children:[`-`,t]}):null]})}function GM({card:e,toolLabel:t,changeSummary:n,icon:r,expanded:i,canExpand:a,hideSummary:o=!1,trailingMeta:s,actionSlot:c,onToggle:l}){let u=o?``:e.summary?.replace(/^(command|path|args|query|input):\s*/i,``)??``,d=t??BM(e.toolName);return(0,U.jsxs)(kM,{interactive:a,onClick:a?()=>l():void 0,role:a?`button`:void 0,tabIndex:a?0:void 0,onKeyDown:a?e=>VM(e,l):void 0,children:[(0,U.jsx)(DM,{className:`relative z-[1] rounded-sm bg-card`,children:(0,U.jsx)(r,{className:`h-[1.05em] w-[1.05em]`,strokeWidth:2.25})}),(0,U.jsx)(HM,{label:d,summary:u}),n?(0,U.jsx)(WM,{...n}):null,(0,U.jsx)(LM,{card:e,iconOnly:!!t}),s,a?(0,U.jsx)(UM,{expanded:i}):null,c?(0,U.jsx)(`span`,{className:`inline-flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover/process-row:opacity-100 group-focus-within/process-row:opacity-100`,children:c}):null]})}function KM({action:e,onAction:t}){return(0,U.jsx)(zM,{action:e,onAction:t})}var qM=`font-mono text-[11px] leading-5`,JM=`flex h-5 w-full ${qM}`,YM=`flex h-5 items-center justify-center px-2.5 tabular-nums select-none`;function XM(e){return String(e.newLineNumber??e.oldLineNumber??``)}function ZM(e,t){return typeof t==`number`&&(e.newLineNumber??e.oldLineNumber)===t}function QM(e,t,n){return`${e}-${n}-${t.oldLineNumber??`x`}-${t.newLineNumber??`x`}`}function $M(e){return typeof e.newLineNumber==`number`||typeof e.oldLineNumber==`number`}function eN(e){return e.lines.some($M)}function tN(e){let t=e.lines.reduce((e,t)=>$M(t)?Math.max(e,XM(t).length):e,0);return`${Math.max(6,Math.min(7.5,t+3))}ch`}function nN(e){return`calc(${e.lines.reduce((e,t)=>Math.max(e,Math.max(1,t.text.length)),1)}ch + 1.25rem)`}function rN(e){let t=e.split(/[\\/]/).filter(Boolean).pop()??e,n=t.split(/[?#]/)[0]??t,r=n.lastIndexOf(`.`);return r<=0||r===n.length-1?null:n.slice(r+1).toLowerCase()}function iN(e){return e.languageHint?.trim()||rN(e.path)||`text`}function aN(e){let t=e.toLowerCase().replace(/[^a-z0-9-]/g,`-`);return t?`language-${t}`:`language-text`}function oN(e){return e.kind===`remove`?`border-r border-rose-200 bg-rose-50 text-rose-700`:e.kind===`add`?`border-r border-emerald-200 bg-emerald-50 text-emerald-700`:`border-r border-border bg-muted text-muted-foreground`}function sN(e){return e.kind===`remove`?`bg-rose-50 text-rose-950`:e.kind===`add`?`bg-emerald-50 text-emerald-950`:`bg-card text-foreground`}function cN({layout:e,line:t,lineNumberColumnWidth:n,target:r,targetRef:i}){return(0,U.jsx)(`span`,{ref:i,"data-file-line-number-cell":`true`,style:e===`compact`?{width:n,minWidth:n}:void 0,className:W(YM,e===`compact`?`sticky left-0 z-[1]`:`w-full shrink-0`,oN(t),r?`bg-gray-200 font-medium text-gray-950`:null),children:XM(t)})}function lN({language:e,line:t,target:n,targetColumn:r,targetRef:i}){let a=(0,H.useMemo)(()=>fA.highlight(t.text||` `,e),[e,t.text]),o=typeof r==`number`&&Number.isSafeInteger(r)&&r>0?Math.min(r,t.text.length+1):null;return(0,U.jsxs)(`span`,{ref:o?void 0:i,"data-file-code-row":`true`,"data-file-code-language":a.language,"data-highlighted":a.highlighted?`true`:`false`,"data-file-target-column":o??void 0,className:W(`chat-file-code-syntax hljs relative block min-w-0 flex-1 whitespace-pre px-2.5`,aN(a.language),sN(t),n?`bg-gray-100/90`:null),children:[(0,U.jsx)(`span`,{dangerouslySetInnerHTML:{__html:a.html}}),o?(0,U.jsx)(`span`,{ref:i,"aria-hidden":`true`,"data-file-target-caret":`true`,className:`pointer-events-none absolute inset-y-0 w-px bg-primary`,style:{left:`calc(0.625rem + ${o-1}ch)`}}):null]})}function uN({language:e,line:t,showLineNumbers:n,lineNumberColumnWidth:r}){return(0,U.jsxs)(`div`,{"data-file-line-row":`true`,className:JM,children:[n?(0,U.jsx)(cN,{layout:`compact`,line:t,lineNumberColumnWidth:r}):null,(0,U.jsx)(lN,{language:e,line:t})]})}function dN({block:e,targetColumn:t,targetLine:n}){let r=eN(e),i=tN(e),a=nN(e),o=iN(e),s=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{s.current?.scrollIntoView({block:`center`,inline:t?`center`:`nearest`})},[e,t,n]),(0,U.jsxs)(`div`,{"data-file-code-surface":`true`,"data-file-code-surface-layout":`workspace`,className:`flex h-full min-h-full min-w-full bg-card`,children:[r?(0,U.jsxs)(`div`,{"data-file-code-gutter":`true`,style:{width:i,minWidth:i},className:W(`flex h-full min-h-full shrink-0 flex-col`,qM),children:[e.lines.map((e,r)=>(0,U.jsx)(cN,{layout:`workspace`,line:e,lineNumberColumnWidth:i,target:ZM(e,n),targetRef:!t&&ZM(e,n)?s:void 0},QM(`gutter`,e,r))),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 border-r border-border bg-muted`})]}):null,(0,U.jsxs)(`div`,{"data-file-code-canvas":`true`,className:`flex h-full min-h-full min-w-0 flex-1 flex-col bg-card`,children:[(0,U.jsx)(`div`,{"data-file-code-stack":`true`,className:`min-w-full`,style:{minWidth:a},children:e.lines.map((e,i)=>{let a=ZM(e,n);return(0,U.jsx)(`div`,{"data-file-code-canvas-row":`true`,"data-file-target-line":a?`true`:void 0,"aria-current":a?`location`:void 0,className:JM,children:(0,U.jsx)(lN,{language:o,line:e,target:a,targetColumn:a?t:null,targetRef:a&&(t||!r)?s:void 0})},QM(`code`,e,i))})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 bg-card`})]})]})}function fN({block:e,layout:t=`compact`,targetColumn:n,targetLine:r}){if(t===`workspace`)return(0,U.jsx)(dN,{block:e,targetColumn:n,targetLine:r});let i=eN(e),a=tN(e),o=nN(e),s=i?`calc(${a} + ${o})`:o,c=iN(e);return(0,U.jsx)(`div`,{"data-file-code-surface":`true`,"data-file-code-surface-layout":`compact`,className:`overflow-x-auto custom-scrollbar bg-card`,children:(0,U.jsx)(`div`,{"data-file-code-stack":`true`,className:`min-w-full`,style:{minWidth:s},children:e.lines.map((e,t)=>(0,U.jsx)(uN,{language:c,line:e,showLineNumbers:i,lineNumberColumnWidth:a},QM(`row`,e,t)))})})}function pN({block:e}){return(0,U.jsx)(fN,{block:e,layout:`compact`})}function mN(e){return e.display===`preview`}function hN(e){return e.rawText?e.rawText:e.lines.map(e=>[e.kind,e.oldLineNumber??``,e.newLineNumber??``,e.text].join(`:`)).join(`
|
|
52
|
+
`)}function gN(e){return/^\+\d+$/.test(e)?`text-emerald-700`:/^-\d+$/.test(e)?`text-rose-700`:`text-muted-foreground`}function _N(e){let t=e.split(`·`).map(e=>e.trim()).filter(e=>/^\+\d+$/.test(e)||/^-\d+$/.test(e));return t.length===0?null:(0,U.jsx)(`div`,{className:`flex shrink-0 items-center gap-x-1 whitespace-nowrap text-[10px] font-medium uppercase tracking-[0.08em]`,children:t.map((e,t)=>(0,U.jsxs)(H.Fragment,{children:[t>0?(0,U.jsx)(`span`,{className:`text-muted-foreground/45`,children:`·`}):null,(0,U.jsx)(`span`,{className:W(gN(e)),children:e})]},`${e}-${t}`))})}function vN(e){return{path:e.path,label:e.path.split(`/`).filter(Boolean).pop()??e.path,viewMode:e.display===`diff`?`diff`:`preview`,...e.rawText?{rawText:e.rawText}:{},...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...e.patchText?{patchText:e.patchText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{},fullLines:e.fullLines??e.lines}}function yN({children:e,contentVersion:t,resetKey:n,className:r,scrollKind:i}){let a=(0,H.useRef)(null),{onScroll:o}=wM({scrollRef:a,resetKey:n,isLoading:!1,hasContent:!0,contentVersion:t,stickyThresholdPx:20});return(0,U.jsx)(`div`,{ref:a,onScroll:o,"data-file-scroll-kind":i,className:W(`overflow-y-auto bg-card custom-scrollbar`,r),children:e})}function bN({block:e,showPathRow:t,isFirst:n,onFileOpen:r}){let{Tooltip:i,TooltipContent:a,TooltipProvider:o,TooltipTrigger:s}=Nl,c=mN(e),l=t||!!e.caption;return(0,U.jsxs)(`section`,{className:W(`overflow-hidden bg-card`,!n&&`border-t border-border`),children:[l?(0,U.jsxs)(`div`,{className:W(`flex min-h-9 items-center justify-between gap-4 border-b border-border px-3 text-muted-foreground`,t?`py-2`:`py-1.5`),children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:t?(0,U.jsx)(o,{delayDuration:250,children:(0,U.jsxs)(i,{children:[(0,U.jsx)(s,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,onClick:()=>{r&&r(vN(e))},className:W(`w-full truncate whitespace-nowrap text-left font-mono text-[12px] font-medium leading-5 text-foreground`,r&&`transition-colors hover:text-primary hover:underline`),title:e.path,children:e.path})}),(0,U.jsx)(a,{side:`top`,className:`max-w-[420px] text-xs font-mono break-all`,children:e.path})]})}):null}),e.caption?_N(e.caption):null]}):null,e.lines.length>0?(0,U.jsx)(yN,{resetKey:`block:${e.key}`,contentVersion:hN(e),className:`max-h-72`,scrollKind:`block`,children:(0,U.jsx)(pN,{block:e})}):e.rawText?(0,U.jsx)(yN,{resetKey:`raw:${e.key}`,contentVersion:e.rawText,className:`max-h-72`,scrollKind:`raw`,children:(0,U.jsx)(`div`,{className:`overflow-x-auto custom-scrollbar`,children:(0,U.jsx)(`pre`,{className:`min-w-max whitespace-pre bg-card px-3 py-2 font-mono text-[11px] leading-5 text-foreground`,children:e.rawText})})}):null,e.truncated&&!c?(0,U.jsx)(`div`,{className:`border-t border-border bg-muted px-3 py-2 text-[10px] text-muted-foreground`,children:`Showing a shortened diff preview.`}):null]})}function xN({card:e,className:t,onFileOpen:n,showPathRow:r=!0}){let i=e.fileOperation?.blocks??[],a=e.output?.trim()??``;return i.length===0&&!a?null:(0,U.jsxs)(`div`,{className:W(`overflow-hidden rounded-md border border-border/70 bg-card`,t),children:[i.map((e,t)=>(0,U.jsx)(bN,{block:e,showPathRow:r,isFirst:t===0,onFileOpen:n},e.key)),a?(0,U.jsx)(yN,{resetKey:`output:${e.toolName}:${e.summary??`none`}`,contentVersion:a,className:W(`max-h-56`,i.length>0&&`border-t border-border`),scrollKind:`output`,children:(0,U.jsx)(`div`,{className:`overflow-x-auto custom-scrollbar`,children:(0,U.jsx)(`pre`,{className:`min-w-max whitespace-pre bg-card px-3 py-2 font-mono text-[11px] leading-5 text-foreground`,children:a})})}):null]})}function SN(e){if(!e)return null;let t=Date.parse(e);return Number.isFinite(t)?t:null}function CN(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:null}function wN(e){let t=CN(e?.durationMs);if(t!=null)return t;let n=SN(e?.startedAt),r=SN(e?.endedAt);return n!=null&&r!=null&&r>=n?r-n:null}function TN(e){let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${String(r).padStart(2,`0`)}m ${String(i).padStart(2,`0`)}s`:r>0?`${r}m ${String(i).padStart(2,`0`)}s`:`${i}s`}function EN(e){return!Number.isFinite(e)||e<0?null:TN(e)}function DN(e){return!Number.isFinite(e)||e<0?null:e<1e3?`${Math.round(e)}ms`:e<6e4?`${Number((e/1e3).toFixed(2))}s`:TN(e)}function ON(){return globalThis.performance?.now()??Date.now()}function kN(e){return Math.max(0,e.baselineMs+ON()-e.monotonicStartedAt)}function AN(e,t){let n=SN(e?.startedAt),r=CN(e?.durationMs)!=null||e?.endedAt!=null,i=t&&n!=null&&!r,[a,o]=(0,H.useState)(null);return(0,H.useEffect)(()=>{if(!i||n==null||!e?.startedAt){o(null);return}let t={key:e.startedAt,baselineMs:Math.max(0,Date.now()-n),monotonicStartedAt:ON()};o({key:t.key,elapsedMs:kN(t)});let r,a=()=>{if(document.visibilityState===`hidden`)return;let e=kN(t),n=Math.max(50,1e3-e%1e3);r=setTimeout(()=>{o({key:t.key,elapsedMs:kN(t)}),a()},n)},s=()=>{r&&clearTimeout(r),r=void 0,document.visibilityState!==`hidden`&&(o({key:t.key,elapsedMs:kN(t)}),a())};return document.addEventListener(`visibilitychange`,s),a(),()=>{r&&clearTimeout(r),document.removeEventListener(`visibilitychange`,s)}},[i,e?.startedAt,n]),!i||!e?.startedAt?null:a?.key===e.startedAt?a.elapsedMs:null}function jN({execution:e,statusTone:t}){let n=wN(e),r=AN(e,t===`running`&&n==null),i=n==null?r==null?null:EN(r):DN(n);return i?(0,U.jsx)(`span`,{className:`inline-flex shrink-0 tabular-nums text-muted-foreground/75`,children:i}):null}var MN=`\x1B`,NN=RegExp(`${MN}\\[(.*?)([ -/]*[@-~])`,`g`);function PN(e){return e.includes(`${MN}[`)}function FN(e){return e.replace(RegExp(`${MN}\\[[0-?]*[ -/]*[@-~]`,`g`),``)}function IN(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var LN={bold:!1,dim:!1,italic:!1,underline:!1,inverse:!1},RN={1:{bold:!0},2:{dim:!0},3:{italic:!0},4:{underline:!0},7:{inverse:!0},22:{bold:!1,dim:!1},23:{italic:!1},24:{underline:!1},27:{inverse:!1},39:{fg:void 0},49:{bg:void 0}},zN={30:`black`,31:`red`,32:`green`,33:`yellow`,34:`blue`,35:`magenta`,36:`cyan`,37:`white`,90:`bright-black`,91:`bright-red`,92:`bright-green`,93:`bright-yellow`,94:`bright-blue`,95:`bright-magenta`,96:`bright-cyan`,97:`bright-white`},BN={40:`black`,41:`red`,42:`green`,43:`yellow`,44:`blue`,45:`magenta`,46:`cyan`,47:`white`,100:`bright-black`,101:`bright-red`,102:`bright-green`,103:`bright-yellow`,104:`bright-blue`,105:`bright-magenta`,106:`bright-cyan`,107:`bright-white`};function VN(e,t){let n=e[t+1];return n===5&&typeof e[t+2]==`number`?{color:`ansi-256-${e[t+2]}`,consumed:2}:n===2&&typeof e[t+2]==`number`&&typeof e[t+3]==`number`&&typeof e[t+4]==`number`?{color:`rgb(${e[t+2]},${e[t+3]},${e[t+4]})`,consumed:4}:null}function HN(e,t){let n={...e};for(let e=0;e<t.length;e+=1){let r=t[e];if(r===0)return{...LN};let i=RN[r];if(i){n={...n,...i};continue}if(r===38||r===48){let i=VN(t,e);i&&(n=r===38?{...n,fg:i.color}:{...n,bg:i.color},e+=i.consumed);continue}if(zN[r]){n={...n,fg:zN[r]};continue}BN[r]&&(n={...n,bg:BN[r]})}return n}function UN(e){let t=[`ansi`];return e.bold&&t.push(`ansi-bold`),e.dim&&t.push(`ansi-dim`),e.italic&&t.push(`ansi-italic`),e.underline&&t.push(`ansi-underline`),e.inverse&&t.push(`ansi-inverse`),e.fg&&(e.fg.startsWith(`rgb(`)?t.push(`ansi-fg-custom`):e.fg.startsWith(`ansi-256-`)?(t.push(`ansi-fg-256`),t.push(e.fg)):t.push(`ansi-fg-${e.fg}`)),e.bg&&(e.bg.startsWith(`rgb(`)?t.push(`ansi-bg-custom`):e.bg.startsWith(`ansi-256-`)?(t.push(`ansi-bg-256`),t.push(e.bg)):t.push(`ansi-bg-${e.bg}`)),t.join(` `)}function WN(e){let t=[];return e.fg?.startsWith(`rgb(`)&&t.push(`color:${e.fg}`),e.bg?.startsWith(`rgb(`)&&t.push(`background-color:${e.bg}`),t.length>0?t.join(`;`):void 0}function GN(e){let t=UN(e),n=WN(e);return n?`<span class="${t}" style="${n}">`:`<span class="${t}">`}function KN(e){if(!e)return``;if(!PN(e))return IN(e);let t=``,n=0,r={...LN},i=!1,a=e=>{e&&(i||=(t+=GN(r),!0),t+=IN(e))},o=()=>{i&&=(t+=`</span>`,!1)};return e.replace(NN,(t,i,s,c)=>{if(a(e.slice(n,c)),n=c+t.length,s!==`m`)return t;let l=i.trim().length===0?[0]:i.split(`;`).map(e=>Number.parseInt(e,10)).filter(e=>Number.isFinite(e));return o(),r=HN(r,l.length>0?l:[0]),t}),a(e.slice(n)),o(),t}var qN=12e4;function JN(e){return e.length<=qN?e:`${e.slice(0,qN)}\n…`}function YN({code:e,language:t,preferAnsi:n=!1,className:r}){let i=JN(e),a=(0,H.useMemo)(()=>{if(n&&PN(i))return{html:KN(i),language:`ansi`,highlighted:!0};let e=FN(i);return fA.highlight(e,t)},[t,n,i]);return(0,U.jsx)(`code`,{className:W(`hljs chat-terminal-code`,`language-${a.language}`,r),"data-highlighted":a.highlighted?`true`:`false`,dangerouslySetInnerHTML:{__html:a.html}})}function XN({command:e,output:t,emptyLabel:n,isRunning:r,hasOutput:i,isError:a=!1}){return(0,U.jsx)(`div`,{className:W(`chat-terminal-surface`,a?`chat-terminal-surface-error`:void 0),"data-testid":`chat-terminal-surface`,children:(0,U.jsxs)(`div`,{className:`chat-terminal-body custom-scrollbar`,children:[(0,U.jsxs)(`div`,{className:`chat-terminal-line chat-terminal-line-command`,children:[(0,U.jsx)(`span`,{className:`chat-terminal-gutter`,"aria-hidden":`true`,children:`$`}),(0,U.jsx)(`div`,{className:`chat-terminal-line-content`,children:e?(0,U.jsxs)(`pre`,{className:`chat-terminal-pre`,children:[(0,U.jsx)(YN,{code:e,language:`bash`}),r&&!i?(0,U.jsx)(`span`,{className:`chat-terminal-caret`,"aria-hidden":`true`}):null]}):(0,U.jsx)(`div`,{className:`chat-terminal-skeleton`})})]}),(i||!r)&&(0,U.jsx)(`div`,{className:`chat-terminal-output-block`,children:i?(0,U.jsxs)(`pre`,{className:W(`chat-terminal-pre chat-terminal-output`,a?`chat-terminal-pre-error`:void 0),children:[(0,U.jsx)(YN,{code:t,language:a?`text`:`shell`,preferAnsi:!0,className:a?`chat-terminal-code-error`:void 0}),r?(0,U.jsx)(`span`,{className:`chat-terminal-caret`,"aria-hidden":`true`}):null]}):(0,U.jsx)(`div`,{className:`chat-terminal-empty`,children:n})})]})})}var ZN=200;function QN(e){return typeof e==`string`&&e.length>0?e:null}function $N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eP(e,t){if(e?.trim())return e.trim();if(t==null)return``;if(typeof t==`string`)return t.trim();if(typeof t==`number`||typeof t==`boolean`)return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function tP(e){return`command`in e||`workingDir`in e||`exitCode`in e||`durationMs`in e||`stdout`in e||`stderr`in e||`aggregated_output`in e||`combinedOutput`in e}function nP(e){let t=QN(e.aggregated_output)??QN(e.combinedOutput)??QN(e.output);if(t)return t;let n=QN(e.stdout),r=QN(e.stderr);return!n&&!r?null:[n,r].filter(e=>!!e).join(`
|
|
53
|
+
`)}function rP(e,t){if($N(t)){let e=nP(t);if(e)return e;if(tP(t))return``}if(!e)return``;let n=e.trim();if(!n.startsWith(`{`))return e;try{let t=JSON.parse(n);return $N(t)?nP(t)||(tP(t)?``:e):e}catch{return e}}function iP(e){return e===`write_file`||e===`edit_file`}function aP(e){return e.reduce((e,t)=>({additions:e.additions+t.lines.filter(e=>e.kind===`add`).length,deletions:e.deletions+t.lines.filter(e=>e.kind===`remove`).length}),{additions:0,deletions:0})}function oP({canExpand:e,isRunning:t,autoExpandWhileRunning:n=!0,expandOnError:r=!1,statusTone:i}){let[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),l=(0,H.useRef)(null),u=(0,H.useRef)(t),d=(0,H.useRef)(!0);return(0,H.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]),(0,H.useEffect)(()=>{if(r&&i===`error`&&e&&!s){l.current!==null&&(window.clearTimeout(l.current),l.current=null),o(!0),u.current=t,d.current=!1;return}n&&t&&e&&!s&&!a&&(d.current||!u.current)&&(l.current=window.setTimeout(()=>{o(!0),l.current=null},ZN)),t||(l.current!==null&&(window.clearTimeout(l.current),l.current=null),u.current&&!s&&o(!1)),u.current=t,d.current=!1},[n,e,r,a,s,t,i]),{expanded:a,onToggle:()=>{e&&(l.current!==null&&(window.clearTimeout(l.current),l.current=null),o(e=>!e),c(!0))}}}function sP(e){return $N(e)?{exitCode:typeof e.exitCode==`number`?e.exitCode:typeof e.exit_code==`number`?e.exit_code:null,workingDir:QN(e.workingDir)??QN(e.cwd)??QN(e.working_directory)}:{}}function cP({card:e,toolLabel:t}){let n=e.statusTone===`running`,r=e.summary?.replace(/^(command|path|args|query|input):\s*/i,``),i=!!e.output?.trim()||e.outputData!==null&&e.outputData!==void 0,a=n||i||!!r?.trim(),o=sP(e.outputData),{expanded:s,onToggle:c}=oP({canExpand:a,isRunning:n,autoExpandWhileRunning:!1,expandOnError:a,statusTone:e.statusTone}),l=s?rP(e.output,e.outputData)||eP(void 0,e.outputData):``;return(0,U.jsxs)(NM,{children:[(0,U.jsx)(GM,{card:e,toolLabel:t,icon:fs,expanded:s,canExpand:a,trailingMeta:(0,U.jsx)(jN,{execution:e.execution,statusTone:e.statusTone}),onToggle:c}),s&&(0,U.jsx)(PM,{className:`bg-transparent py-0`,children:(0,U.jsx)(XN,{command:r,output:l,emptyLabel:e.emptyLabel,isRunning:n,hasOutput:i,isError:e.statusTone===`error`,exitCode:o.exitCode,workingDir:o.workingDir})})]})}function lP(e,t){return!!e?.trim()||t!=null}function uP(e){return{previewLineCount:e.reduce((e,t)=>e+t.lines.length,0),previewCharCount:e.reduce((e,t)=>e+(t.rawText?.length??t.lines.reduce((e,t)=>e+t.text.length+1,0)),0)}}function dP(e){return[`edit_file`,`write_file`,`apply_patch`,`file_change`].includes(e)}function fP(e){let{card:t,previewCharCount:n,previewLineCount:r}=e;return iP(t.toolName)?!(t.statusTone===`running`&&t.toolName===`write_file`&&(r>24||n>1200)):!1}function pP({card:e,toolLabel:t,onFileOpen:n}){let r=e.statusTone===`running`,i=!!e.fileOperation?.blocks.length,a=lP(e.input,e.inputData),o=lP(e.output,e.outputData),s=a&&!i,c=i||a||o,l=e.fileOperation?.blocks??[],{previewCharCount:u,previewLineCount:d}=uP(l),f=fP({card:e,previewCharCount:u,previewLineCount:d}),{expanded:p,onToggle:m}=oP({canExpand:c||r,isRunning:r,autoExpandWhileRunning:f,expandOnError:c,statusTone:e.statusTone}),h=p?eP(e.input,e.inputData):``,g=p?eP(e.output,e.outputData):``,_=dP(e.toolName);return(0,U.jsxs)(NM,{children:[(0,U.jsx)(GM,{card:e,toolLabel:t,changeSummary:_?aP(l):void 0,icon:_?Ta:Wn,expanded:p,canExpand:c||r,hideSummary:!1,onToggle:m}),p&&c?(0,U.jsxs)(PM,{className:`bg-transparent py-0`,children:[s?(0,U.jsx)(FM,{label:e.inputLabel?.trim()||`Input`,tone:`input`,children:h}):null,s&&g?(0,U.jsx)(`div`,{className:`h-2`}):null,i||g?(0,U.jsx)(xN,{card:g&&!e.output?{...e,output:g}:e,onFileOpen:n,showPathRow:!0}):null]}):null]})}function mP({card:e,toolLabel:t,icon:n=Ti}){let r=e.statusTone===`running`,i=!!e.output?.trim()||e.outputData!==null&&e.outputData!==void 0,{expanded:a,onToggle:o}=oP({canExpand:i||r,isRunning:r,autoExpandWhileRunning:!1,statusTone:e.statusTone}),s=a?eP(e.output,e.outputData):``;return(0,U.jsxs)(NM,{children:[(0,U.jsx)(GM,{card:e,toolLabel:t,icon:n,expanded:a,canExpand:i||r,onToggle:o}),a&&s&&(0,U.jsx)(PM,{className:`py-0`,children:(0,U.jsx)(`pre`,{className:`font-mono text-[12px] text-muted-foreground whitespace-pre-wrap break-all w-full max-w-full max-h-64 overflow-y-auto overflow-x-hidden min-w-0 custom-scrollbar leading-relaxed`,children:s})})]})}function hP(e,t,n){let r=e.agentId&&n?n(e.agentId):null,i=e.action&&t?(0,U.jsx)(KM,{action:e.action,onAction:t}):null;return r||i?(0,U.jsxs)(U.Fragment,{children:[r,i]}):void 0}function gP({card:e,toolLabel:t,icon:n=xs,onToolAction:r,renderToolAgent:i}){let a=e.statusTone===`running`,o=!!e.input?.trim()||e.inputData!==null&&e.inputData!==void 0,s=!!e.output?.trim()||e.outputData!==null&&e.outputData!==void 0,c=o||s,l=hP(e,r,i),{expanded:u,onToggle:d}=oP({canExpand:c||a,isRunning:a,autoExpandWhileRunning:!1,statusTone:e.statusTone}),f=u?eP(e.input,e.inputData):``,p=u?eP(e.output,e.outputData):``;return(0,U.jsxs)(NM,{children:[(0,U.jsx)(GM,{card:e,toolLabel:t,icon:n,expanded:u,canExpand:c||a,actionSlot:l,onToggle:d}),u&&c?(0,U.jsxs)(PM,{className:`bg-transparent py-0`,children:[o?(0,U.jsx)(FM,{label:e.inputLabel?.trim()||`Input`,tone:`input`,children:f}):null,o&&s?(0,U.jsx)(`div`,{className:`h-2`}):null,s?(0,U.jsx)(FM,{label:e.outputLabel?.trim()||`Output`,tone:e.statusTone===`error`?`error`:`output`,children:p}):null]}):null]})}function _P({card:e,onToolAction:t,renderPanelAppCard:n}){let{panelApp:r}=e;return r&&n?n(r):(0,U.jsx)(gP,{card:e,onToolAction:t})}function vP(e){let t=e.toLowerCase();return t===`exec`||t===`exec_command`||t===`execute_command`||t===`command_execution`||t===`bash`||t===`shell`||t.includes(`run_`)}function yP(e){let t=e.toLowerCase();return t===`read_file`||t===`write_file`||t===`edit_file`||t===`apply_patch`||t===`file_change`}function bP(e){let t=e.toLowerCase();return t===`write_file`||t===`edit_file`||t===`apply_patch`||t===`file_change`}function xP(e){let t=e.toLowerCase();return t===`grep_search`||t===`find_files`||t.includes(`search`)}var SP={list_dir:{statusKind:`directory`,icon:Ya},web_fetch:{statusKind:`web`,icon:Ma},message:{statusKind:`message`,icon:Zo},sessions_list:{statusKind:`session`,icon:Do},sessions_history:{statusKind:`session`,icon:Do},sessions_request:{statusKind:`session`,icon:Do},spawn:{statusKind:`agent`,icon:la},sessions_spawn:{statusKind:`agent`,icon:la},subagents:{statusKind:`agent`,icon:la},memory_search:{statusKind:`memory`,icon:da},memory_get:{statusKind:`memory`,icon:da},cron:{statusKind:`schedule`,icon:fa},gateway:{statusKind:`system`,icon:es},view_image:{statusKind:`image`,icon:so},show_file:{statusKind:`display`,icon:Fa},show_url:{statusKind:`display`,icon:Fa},show_panel_app:{statusKind:`display`,icon:Fa},show_content:{statusKind:`display`,icon:Fa}};function CP(e){return SP[e.toLowerCase()]??null}function wP({card:e,toolStatusLabels:t,onToolAction:n,onFileOpen:r,renderToolAgent:i,renderPanelAppCard:a}){if(e.panelApp)return(0,U.jsx)(_P,{card:e,onToolAction:n,renderPanelAppCard:a});let o=CP(e.toolName),s=o?t?.builtIn?.[o.statusKind]?.[e.statusTone]:void 0;return vP(e.toolName)?(0,U.jsx)(cP,{card:e,toolLabel:t?.terminal[e.statusTone]}):yP(e.toolName)?(0,U.jsx)(pP,{card:e,toolLabel:bP(e.toolName)?t?.fileEdit[e.statusTone]:t?.fileRead[e.statusTone],onFileOpen:r}):xP(e.toolName)?(0,U.jsx)(mP,{card:e,toolLabel:s??t?.search[e.statusTone],icon:o?.icon}):(0,U.jsx)(gP,{card:e,toolLabel:s,icon:o?.icon,onToolAction:n,renderToolAgent:i})}var TP=40;function EP({group:e,open:t,isUser:n,reasoningCharacterCountTemplates:r,toolStatusLabels:i,showMoreTemplate:a,onToolAction:o,onFileOpen:s,renderToolAgent:c,renderPanelAppCard:l,onOpenChange:u}){let[d,f]=(0,H.useState)(TP);(0,H.useEffect)(()=>{f(TP)},[e.key]);let p=e.parts.filter(e=>e.type===`tool-card`).length,m=t&&p>1,h=e.parts.slice(0,d),g=Math.max(0,e.parts.length-h.length),_=Math.min(TP,g),v=(a??`Show next {count} ({remaining} remaining)`).replace(`{count}`,String(_)).replace(`{remaining}`,String(g));return(0,U.jsxs)(`div`,{className:`group/tool-activity`,children:[(0,U.jsx)(AM,{openGroup:`tool-activity`,open:t,icon:bs,leadingIconClassName:`bg-card`,label:e.label,onClick:()=>u(!t)}),t?(0,U.jsxs)(`div`,{className:`text-[0.925rem] leading-[1.72]`,children:[h.map((t,a)=>{let u=a===h.length-1;return(0,U.jsxs)(`div`,{className:`relative min-w-0`,children:[m?(0,U.jsx)(OM,{position:a===0?`first`:u?`last`:`middle`}):null,t.type===`tool-card`?(0,U.jsx)(wP,{card:t.card,toolStatusLabels:i,onToolAction:o,onFileOpen:s,renderToolAgent:c,renderPanelAppCard:l}):(0,U.jsx)(MM,{label:t.label,text:t.text,characterCountTemplates:r,isUser:n,isInProgress:!1})]},t.type===`tool-card`&&t.card.toolCallId?`tool-group-call-${t.card.toolCallId}`:`tool-group-item-${e.startIndex+a}`)}),g>0?(0,U.jsx)(`button`,{type:`button`,className:`ml-6 mt-1 rounded-md px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>f(e=>e+TP),children:v}):null]}):null]})}var DP=3;function OP(e){return e.type===`tool-card`}function kP(e){return e?.type===`reasoning`||e?.type===`tool-card`&&!e.card.panelApp}function AP(e){let t=e.toLowerCase();return t===`list_dir`?`directory`:t.includes(`show_content`)||t.includes(`panel_app`)||t.includes(`panel`)?`panel`:t===`spawn`||t.includes(`subagent`)||t.includes(`session_request`)||t.includes(`agent`)&&!t.includes(`read`)?`agent`:t.includes(`web_`)||t.includes(`_web`)||t.includes(`url`)||t.includes(`fetch`)||t.includes(`http`)?`web`:t===`grep_search`||t===`find_files`||t===`search_files`||t.includes(`search`)||t.includes(`grep`)?`search`:t===`exec`||t===`exec_command`||t===`execute_command`||t===`command_execution`||t===`bash`||t===`shell`||t===`terminal`||t.includes(`run_`)?`bash`:t===`write_file`||t===`edit_file`||t===`apply_patch`||t===`file_change`||t===`multi_replace`||t.includes(`write_file`)||t.includes(`edit_file`)||t.includes(`apply_patch`)?`edit`:t===`read_file`||t===`read`||t===`view_file`||t.includes(`read_file`)||t.startsWith(`read_`)?`read`:`other`}function jP(e){return e===`error`?0:e===`cancelled`?1:e===`running`?2:3}function MP(e,t,n){if(t!==`read`&&t!==`edit`&&t!==`directory`)return[`call:${n}`];let r=e.fileOperation?.blocks.map(({path:e})=>e.trim()).filter(Boolean),i=e.summary?.replace(/^(path|file):\s*/i,``).trim();return r?.length?r:[i||`call:${n}`]}function NP(e,t){let n=t.segmentTemplates[e.family],r=e.count===1?n.one:n.other.split(`{count}`).join(String(e.count)),i=e.exceptionCounts?.error??(e.tone===`error`?e.count:0),a=e.exceptionCounts?.cancelled??(e.tone===`cancelled`?e.count:0);return i===e.count?`${r} ${t.failedLabel}`:a===e.count?`${r} ${t.cancelledLabel}`:[r,i>0?`${i}/${e.count} ${t.failedLabel}`:null,a>0?`${a}/${e.count} ${t.cancelledLabel}`:null].filter(Boolean).join(` · `)}function PP(e){let t=[],n=new Map;for(let[r,i]of e.entries()){let e=AP(i.toolName),a=MP(i,e,r),o=n.get(e);if(!o){t.push(e),n.set(e,{unitTones:new Map(a.map(e=>[e,i.statusTone]))});continue}a.forEach(e=>o.unitTones.set(e,i.statusTone))}let r=t.map(e=>{let t=n.get(e),r=[...t.unitTones.values()],i=r.reduce((e,t)=>jP(t)<jP(e)?t:e,`success`);return{family:e,count:t.unitTones.size,tone:i,exceptionCounts:{error:r.filter(e=>e===`error`).length,cancelled:r.filter(e=>e===`cancelled`).length}}});return r.sort((e,n)=>{let r=jP(e.tone)-jP(n.tone);return r===0?t.indexOf(e.family)-t.indexOf(n.family):r}),r}function FP(e){let{labels:t,segments:n}=e;if(n.length===0)return``;let r=n.slice(0,DP),i=n.length-r.length,a=r.map(e=>NP(e,t));return i>0&&a.push(`+${i}`),a.join(` · `)}function IP(e,t){let n=[],r=t,i=-1;for(;;){let t=e[r];if(!kP(t))break;n.push(t),t.type===`tool-card`&&(i=n.length-1),r+=1}return{candidateParts:n,lastToolOffset:i}}function LP(e,t){let n=[],r=0;for(;r<e.length;){let i=e[r];if(i.type!==`tool-card`||i.card.panelApp){n.push({kind:`part`,key:`part-${r}`,index:r,part:i}),r+=1;continue}let a=r,{candidateParts:o,lastToolOffset:s}=IP(e,a),c=o.filter(OP);if(c.length===1){n.push({kind:`part`,key:`part-${a}`,index:a,part:i}),r=a+1;continue}let l=o.slice(0,s+1);r=a+l.length;let u=PP(c.map(e=>e.card)),d=FP({segments:u,labels:t});n.push({kind:`tool-group`,key:`tool-group-${a}`,group:{key:`tool-group-${a}`,startIndex:a,endIndex:r-1,parts:l,segments:u,label:d}})}return n}function RP(e){let{messageId:t,onRequest:n,state:r}=e,[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(()=>new Set),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=r===void 0||r===`ready`;(0,H.useEffect)(()=>{f&&(c&&(a(!0),l(!1)),u&&(s(e=>new Set(e).add(u)),a(!0),d(null)))},[f,c,u]);let p=()=>{(r===`summary`||r===`error`)&&n?.(t)};return{handleProcessToggle:()=>{if(i)return a(!1);if(f)return a(!0);l(!0),p()},handleToolActivityOpenChange:(e,t)=>{if(t&&!f){d(e),p();return}s(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),t&&a(!0)},openToolGroupKeys:o,processOpen:i}}var zP={segmentTemplates:{read:{one:`Read 1 file`,other:`Read {count} files`},edit:{one:`Edit 1 file`,other:`Edit {count} files`},directory:{one:`View 1 directory`,other:`View {count} directories`},search:{one:`Search 1 time`,other:`Search {count} times`},bash:{one:`Run 1 command`,other:`Run {count} commands`},web:{one:`Open 1 page`,other:`Open {count} pages`},agent:{one:`Start 1 subtask`,other:`Start {count} subtasks`},panel:{one:`Show 1 result`,other:`Show {count} results`},other:{one:`Use 1 tool`,other:`Use {count} tools`}},failedLabel:`failed`,cancelledLabel:`cancelled`};function BP(e){return{segmentTemplates:{...zP.segmentTemplates,...e.toolActivitySegmentTemplates??{}},failedLabel:e.toolActivityFailedLabel??zP.failedLabel,cancelledLabel:e.toolActivityCancelledLabel??zP.cancelledLabel}}function VP(e){return e===`pending`||e===`streaming`}function HP(e){return e.type===`reasoning`||e.type===`tool-card`||e.type===`custom`&&e.process===!0}function UP(e){if(e.role!==`assistant`||!e.processSummary||VP(e.status))return null;let t=-1;for(let n=e.parts.length-1;n>=0;--n)if(HP(e.parts[n])){t=n;break}return t<0||t>=e.parts.length-1?null:{processParts:e.parts.slice(0,t+1),finalParts:e.parts.slice(t+1)}}function WP({index:e,isInProgress:t,isLastPart:n,isUser:r,onAttachmentOpen:i,onFileOpen:a,onInlineTokenClick:o,onToolAction:s,part:c,renderCustomPart:l,renderInlineDisplay:u,renderPanelAppCard:d,renderToolAgent:f,resolveFileContentUrl:p,role:m,texts:h}){let{type:g}=c;if(g===`custom`){let e=l?.(c);return e===void 0?null:(0,U.jsx)(`div`,{className:`min-w-0`,children:e},`custom-${c.customType}-${c.id}`)}if(g===`markdown`){let{inlineTokens:r,text:i}=c;return(0,U.jsx)(Uj,{text:i,role:m,texts:h,isStreaming:t&&n,inlineTokens:r,onFileOpen:a,onInlineTokenClick:o,resolveFileContentUrl:p,renderInlineDisplay:u},`markdown-${e}`)}if(g===`reasoning`){let{label:i,text:a}=c;return(0,U.jsx)(MM,{label:i,text:a,characterCountTemplates:h.reasoningCharacterCountTemplates,isUser:r,isInProgress:t&&n},`reasoning-${e}`)}if(g===`tool-card`){let{card:t}=c;return(0,U.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,U.jsx)(OM,{position:`single`}),(0,U.jsx)(wP,{card:t,toolStatusLabels:h.toolStatusLabels,onToolAction:s,onFileOpen:a,renderToolAgent:f,renderPanelAppCard:d})]},`tool-${e}`)}if(g===`file`){let{file:t}=c;return(0,U.jsx)(vM,{file:t,isUser:r,texts:h,onOpen:i},`file-${e}`)}if(g===`unknown`){let{label:t,rawType:n,text:r}=c;return(0,U.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/60 px-2.5 py-2 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`div`,{className:`font-semibold text-foreground`,children:[t,`: `,n]}),r?(0,U.jsx)(`pre`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-muted-foreground`,children:r}):null]},`unknown-${e}`)}return null}function GP(e){let{isInProgress:t,isUser:n,onAttachmentOpen:r,onFileOpen:i,onInlineTokenClick:a,onToolActivityOpenChange:o,onToolAction:s,openToolGroupKeys:c,parts:l,renderCustomPart:u,renderInlineDisplay:d,renderPanelAppCard:f,renderToolAgent:p,resolveFileContentUrl:m,role:h,texts:g,indexOffset:_=0}=e;return xM(LP(l,BP(g))).map(e=>e.kind===`image-group`?(0,U.jsx)(yM,{group:e,indexOffset:_,isUser:n,texts:g,onOpen:r},`${e.key}-${_}`):e.kind===`tool-group`?(0,U.jsx)(EP,{group:e.group,open:c.has(e.group.key),isUser:n,reasoningCharacterCountTemplates:g.reasoningCharacterCountTemplates,toolStatusLabels:g.toolStatusLabels,showMoreTemplate:g.toolActivityShowMoreTemplate,onToolAction:s,onFileOpen:i,renderToolAgent:p,renderPanelAppCard:f,onOpenChange:t=>o(e.group.key,t)},e.key):WP({part:e.part,index:_+e.index,role:h,isUser:n,isInProgress:t,isLastPart:_+e.index===_+l.length-1,texts:g,onToolAction:s,onFileOpen:i,onAttachmentOpen:r,onInlineTokenClick:a,resolveFileContentUrl:m,renderCustomPart:u,renderInlineDisplay:d,renderToolAgent:p,renderPanelAppCard:f}))}var KP=(0,H.memo)(function({layout:e,message:t,texts:n,onToolAction:r,toolPayloadState:i,onToolPayloadRequest:a,onFileOpen:o,onAttachmentOpen:s,onInlineTokenClick:c,renderInlineDisplay:l,renderCustomPart:u,renderToolAgent:d,renderPanelAppCard:f,resolveFileContentUrl:p}){let{role:m}=t,h=m===`user`,g=e===`flat`&&!h,_=VP(t.status),v=UP(t),{handleProcessToggle:y,handleToolActivityOpenChange:b,openToolGroupKeys:x,processOpen:S}=RP({messageId:t.id,state:i,onRequest:a}),C=i===`loading`?`${t.processSummary?.label??``} · ${n.toolPayloadLoadingLabel??`Loading details`}`:i===`error`?`${t.processSummary?.label??``} · ${n.toolPayloadLoadFailedLabel??`Couldn’t load details. Try again`}`:t.processSummary?.label;return(0,U.jsx)(`div`,{"data-chat-message-surface":g?`flat`:`card`,className:W(`max-w-full has-[[data-chat-message-wide-content=true]]:w-full`,g?`block w-full text-foreground`:`inline-block w-fit rounded-2xl border px-4 shadow-sm`,!g&&(h?`nextclaw-chat-message-user rounded-[1.45rem] border-primary bg-primary py-2.5 text-primary-foreground shadow-none`:m===`assistant`?`border-border bg-card pb-3 pt-4 text-card-foreground`:`border-border bg-muted/45 py-3 text-foreground`)),children:(0,U.jsx)(`div`,{className:`space-y-0`,children:v?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`group/process`,children:[(0,U.jsx)(`div`,{className:`mb-2 border-b border-border/60 pb-2`,children:(0,U.jsx)(AM,{openGroup:`process`,open:S,label:C,onClick:y})}),S?(0,U.jsx)(`div`,{className:`space-y-0`,children:GP({parts:v.processParts,role:m,isUser:h,isInProgress:_,texts:n,onToolAction:r,onFileOpen:o,onAttachmentOpen:s,onInlineTokenClick:c,resolveFileContentUrl:p,openToolGroupKeys:x,onToolActivityOpenChange:b,renderCustomPart:u,renderInlineDisplay:l,renderToolAgent:d,renderPanelAppCard:f})}):null]}),GP({parts:v.finalParts,role:m,isUser:h,isInProgress:_,texts:n,onToolAction:r,onFileOpen:o,onAttachmentOpen:s,onInlineTokenClick:c,resolveFileContentUrl:p,openToolGroupKeys:x,onToolActivityOpenChange:b,renderCustomPart:u,renderInlineDisplay:l,renderToolAgent:d,renderPanelAppCard:f,indexOffset:v.processParts.length})]}):GP({parts:t.parts,role:m,isUser:h,isInProgress:_,texts:n,onToolAction:r,onFileOpen:o,onAttachmentOpen:s,onInlineTokenClick:c,resolveFileContentUrl:p,openToolGroupKeys:x,onToolActivityOpenChange:b,renderCustomPart:u,renderInlineDisplay:l,renderToolAgent:d,renderPanelAppCard:f})})})});function qP({messageText:e,texts:t}){let{copied:n,copy:r}=xk({text:e}),i=n?t.copiedMessageLabel:t.copyMessageLabel,{Tooltip:a,TooltipContent:o,TooltipProvider:s,TooltipTrigger:c}=Nl;return e?(0,U.jsx)(s,{delayDuration:250,children:(0,U.jsxs)(a,{children:[(0,U.jsx)(c,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,onClick:()=>void r(),className:`flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35`,"aria-label":i,children:n?(0,U.jsx)(jr,{className:`h-3.5 w-3.5`}):(0,U.jsx)(Oa,{className:`h-3.5 w-3.5`})})}),(0,U.jsx)(o,{side:`top`,className:`text-xs`,children:i})]})}):null}function JP({action:e,onAction:t}){let{Tooltip:n,TooltipContent:r,TooltipProvider:i,TooltipTrigger:a}=Nl;return(0,U.jsx)(i,{delayDuration:250,children:(0,U.jsxs)(n,{children:[(0,U.jsx)(a,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":e.label,className:`flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-muted-foreground`,disabled:e.disabled,onClick:()=>t(e),children:e.icon===`edit`?(0,U.jsx)(Go,{className:`h-3.5 w-3.5`}):(0,U.jsx)(xa,{"data-testid":`chat-continue-message-icon`,className:`h-3.5 w-3.5`})})}),(0,U.jsx)(r,{side:`top`,className:`text-xs`,children:e.label})]})})}function YP({action:e,open:t,onOpenChange:n,restoreFocusRef:r}){let{Dialog:i,DialogContent:a,DialogDescription:o,DialogHeader:s,DialogTitle:c}=Nl;return(0,U.jsx)(i,{open:t,onOpenChange:n,children:(0,U.jsxs)(a,{className:`sm:max-w-xl`,closeLabel:e.dialog.closeLabel,onCloseAutoFocus:e=>{e.preventDefault(),r.current?.focus()},children:[(0,U.jsxs)(s,{className:`space-y-1 pr-8 text-left`,children:[(0,U.jsx)(c,{className:`text-lg font-semibold leading-tight text-foreground`,children:e.dialog.title}),e.dialog.description?(0,U.jsx)(o,{className:`text-sm leading-relaxed text-muted-foreground`,children:e.dialog.description}):null]}),(0,U.jsx)(`dl`,{className:`divide-y divide-border/70 rounded-xl border border-border/80 bg-muted/20 px-4`,children:e.dialog.rows.map(e=>(0,U.jsxs)(`div`,{className:`grid gap-1 py-3 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-4`,children:[(0,U.jsx)(`dt`,{className:`text-xs font-medium text-muted-foreground`,children:e.label}),(0,U.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-xs leading-5 text-foreground`,children:e.value})]},e.label))})]})})}function XP({message:e}){let[t,n]=(0,H.useState)(!1),[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(null),s=(0,H.useRef)(null),{moreActions:c}=e,{Popover:l,PopoverContent:u,PopoverTrigger:d,Tooltip:f,TooltipContent:p,TooltipProvider:m,TooltipTrigger:h}=Nl;return c?.items.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(l,{open:t,onOpenChange:n,children:[(0,U.jsx)(m,{delayDuration:250,children:(0,U.jsxs)(f,{children:[(0,U.jsx)(h,{asChild:!0,children:(0,U.jsx)(d,{asChild:!0,children:(0,U.jsx)(`button`,{ref:s,type:`button`,"aria-label":c.triggerLabel,className:`flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/35`,children:(0,U.jsx)(Na,{className:`h-3.5 w-3.5`})})})}),(0,U.jsx)(p,{side:`top`,className:`text-xs`,children:c.triggerLabel})]})}),(0,U.jsx)(u,{align:`end`,className:`w-52 p-1`,role:`menu`,children:c.items.map(e=>(0,U.jsx)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center rounded-lg px-3 py-2 text-left text-sm text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:bg-accent focus-visible:outline-none`,onClick:()=>{n(!1),o(e),i(!0)},children:e.label},e.key))})]}),a?(0,U.jsx)(YP,{action:a,open:r,onOpenChange:i,restoreFocusRef:s}):null]}):null}function ZP({message:e,onAction:t,texts:n}){let r=(0,H.useMemo)(()=>e.parts.map(e=>e.type===`markdown`||e.type===`unknown`?e.text:``).filter(e=>!!e?.trim()).join(`
|
|
54
|
+
|
|
55
|
+
`),[e.parts]);return(0,U.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[t?e.actions?.map(e=>(0,U.jsx)(JP,{action:e,onAction:t},e.key)):null,(0,U.jsx)(qP,{messageText:r,texts:n}),(0,U.jsx)(XP,{message:e})]})}var QP=/\u200B|\u200C|\u200D|\u2060|\uFEFF/g,$P=`
|
|
56
|
+
@keyframes nextclaw-chat-typing-text-sheen {
|
|
57
|
+
0% {
|
|
58
|
+
background-position: 160% 0;
|
|
59
|
+
}
|
|
60
|
+
100% {
|
|
61
|
+
background-position: -60% 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
.nextclaw-chat-typing-indicator__text {
|
|
65
|
+
background-image: linear-gradient(
|
|
66
|
+
100deg,
|
|
67
|
+
hsl(var(--muted-foreground)) 0%,
|
|
68
|
+
hsl(var(--muted-foreground)) 34%,
|
|
69
|
+
hsl(var(--foreground-tertiary)) 43%,
|
|
70
|
+
hsl(var(--foreground-muted)) 50%,
|
|
71
|
+
hsl(var(--foreground-tertiary)) 57%,
|
|
72
|
+
hsl(var(--muted-foreground)) 66%,
|
|
73
|
+
hsl(var(--muted-foreground)) 100%
|
|
74
|
+
);
|
|
75
|
+
background-size: 240% 100%;
|
|
76
|
+
background-position: 160% 0;
|
|
77
|
+
-webkit-background-clip: text;
|
|
78
|
+
background-clip: text;
|
|
79
|
+
color: transparent;
|
|
80
|
+
-webkit-text-fill-color: transparent;
|
|
81
|
+
animation: nextclaw-chat-typing-text-sheen 2.5s linear infinite;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@media (prefers-reduced-motion: reduce) {
|
|
85
|
+
.nextclaw-chat-typing-indicator__text {
|
|
86
|
+
animation: none;
|
|
87
|
+
background-image: none;
|
|
88
|
+
color: hsl(var(--muted-foreground));
|
|
89
|
+
-webkit-text-fill-color: currentColor;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`;function eF(e){let t=e.trim();return t?t.replace(QP,``).trim().length>0:!1}function tF(e){return(e.role===`assistant`||e.role===`user`)&&e.status!==`streaming`&&e.status!==`pending`}function nF(e){return e.role!==`user`&&(e.status===`streaming`||e.status===`pending`)}function rF(e,t){return e.role===`user`&&e.status===`pending`?{label:t.pendingInputLabel??`Waiting for the next step`,role:`status`}:{label:`${e.roleLabel} · ${e.timestampLabel}`}}function iF(e){return e.some(e=>e.role===`assistant`&&(e.status===`streaming`||e.status===`pending`))}function aF(e){return e.parts.some(e=>e.type===`markdown`||e.type===`reasoning`?eF(e.text):!0)}function oF(e,t){return e===`flat`&&!t}function sF(){return(0,U.jsx)(`div`,{className:`flex items-center gap-2 px-1 py-0.5 text-[11px] text-muted-foreground`,children:(0,U.jsxs)(`div`,{className:`flex space-x-1 items-center h-full`,children:[(0,U.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground animate-pulse`}),(0,U.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground animate-pulse [animation-delay:200ms]`}),(0,U.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground animate-pulse [animation-delay:400ms]`})]})})}function cF({label:e,layout:t}){return(0,U.jsxs)(`div`,{"data-chat-message-surface":t===`flat`?`flat`:`card`,className:W(`text-sm text-muted-foreground`,t===`flat`?`py-1`:`rounded-2xl border border-border bg-card px-4 py-3 shadow-sm`),children:[(0,U.jsx)(`style`,{children:$P}),(0,U.jsx)(`span`,{className:`nextclaw-chat-typing-indicator__text`,children:e})]})}function lF({assistantAvatarIcon:e,showAssistantHeader:t=!0,className:n,isSending:r,layout:i=`card`,messages:a,onAttachmentOpen:o,onFileOpen:s,onInlineTokenClick:c,onMessageAction:l,onToolAction:u,resolveMessageToolPayloadState:d,onMessageToolPayloadRequest:f,renderCustomPart:p,renderInlineDisplay:m,renderMessageContent:h,renderPanelAppCard:g,renderToolAgent:_,resolveFileContentUrl:v,texts:y}){let b=oF(i,t),x=a.filter(aF),S=iF(x);return(0,U.jsxs)(`div`,{className:W(`space-y-5`,n),children:[x.map(t=>{let n=t.role===`user`,r=nF(t),a=rF(t,y),x=tF(t),S=(0,U.jsx)(KP,{layout:i,message:t,texts:y,onToolAction:u,toolPayloadState:d?.(t.id),onToolPayloadRequest:f,onFileOpen:s,onAttachmentOpen:o,onInlineTokenClick:c,resolveFileContentUrl:v,renderCustomPart:p,renderInlineDisplay:m,renderToolAgent:_,renderPanelAppCard:g}),C=h?.(t)??S;return i===`flat`&&!n?(0,U.jsxs)(`article`,{"data-chat-message-id":t.id,"data-chat-message-layout":`flat`,"data-chat-message-role":t.role,"data-chat-message-role-label":t.roleLabel,"data-chat-message-selectable":String(x),className:`w-full min-w-0 space-y-2`,children:[(0,U.jsxs)(`div`,{"data-chat-message-header":`flat`,hidden:b,className:W(`flex min-w-0 items-center gap-2.5`,{hidden:b}),children:[(0,U.jsx)(Cx,{assistantIcon:e,role:t.role,size:`compact`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:t.roleLabel})]}),(0,U.jsx)(`div`,{"data-chat-message-body":`flat`,className:`min-w-0 w-full`,children:C}),r?(0,U.jsx)(`div`,{className:`w-full`,children:(0,U.jsx)(sF,{})}):(0,U.jsxs)(`div`,{"data-chat-message-footer":`flat`,className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`span`,{className:`px-1 text-[11px] leading-4 text-muted-foreground`,children:[t.timestampLabel,t.executionSummaryLabel?` · ${t.executionSummaryLabel}`:null]}),(0,U.jsx)(ZP,{message:t,onAction:e=>l?.(t,e),texts:y})]})]},t.id):(0,U.jsxs)(`div`,{"data-chat-message-id":t.id,"data-chat-message-layout":`card`,"data-chat-message-role":t.role,"data-chat-message-role-label":t.roleLabel,"data-chat-message-selectable":String(x),className:W(`flex gap-3`,n?`justify-end`:`justify-start`),children:[n?null:(0,U.jsx)(Cx,{assistantIcon:e,role:t.role}),(0,U.jsxs)(`div`,{className:W(`w-fit max-w-[92%] space-y-2 has-[[data-chat-message-wide-content=true]]:w-full`,n&&`flex flex-col items-end`),children:[C,(0,U.jsx)(`div`,{className:W(`flex flex-wrap items-center gap-2`,n&&`justify-end`),children:r?(0,U.jsx)(sF,{}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{role:a.role,className:W(`px-1 text-[11px] leading-4 text-muted-foreground`,n?`text-right`:`text-left`),children:[a.label,t.executionSummaryLabel?` · ${t.executionSummaryLabel}`:null]}),(0,U.jsx)(ZP,{message:t,onAction:e=>l?.(t,e),texts:y})]})})]}),n?(0,U.jsx)(Cx,{role:t.role}):null]},t.id)}),r&&!S?(0,U.jsxs)(`div`,{"data-chat-message-layout":i,className:`flex justify-start gap-3`,children:[(0,U.jsx)(`div`,{hidden:b,className:W({hidden:b}),children:(0,U.jsx)(Cx,{assistantIcon:e,role:`assistant`,size:i===`flat`?`compact`:`default`})}),(0,U.jsx)(cF,{label:y.typingLabel,layout:i})]}):null]})}var uF=12,dF=10;function fF(e,t){return t.rangeCount>0&&!t.isCollapsed&&e.contains(t.getRangeAt(0).commonAncestorContainer)}function pF(e){return typeof e.getClientRects==`function`?Array.from(e.getClientRects()).filter(e=>e.width>0||e.height>0):[]}function mF(e){if(e.commonAncestorContainer.nodeType===Node.TEXT_NODE)return pF(e);let t=document.createTreeWalker(e.commonAncestorContainer,NodeFilter.SHOW_TEXT),n=[];for(let r=t.nextNode();r;r=t.nextNode()){if(!(r instanceof Text)||!r.data||!e.intersectsNode(r))continue;let t=document.createRange();t.selectNodeContents(r),r===e.startContainer&&t.setStart(r,e.startOffset),r===e.endContainer&&t.setEnd(r,e.endOffset),n.push(...pF(t))}return n}function hF(e){let t=mF(e),n=t.length>0?t:pF(e),r=n.length>0?n:[e.getBoundingClientRect()],i=r.map(e=>({bottom:Math.min(e.bottom,window.innerHeight),left:Math.max(e.left,0),right:Math.min(e.right,window.innerWidth),top:Math.max(e.top,0)})).filter(e=>e.right>e.left&&e.bottom>e.top),a=i.length>0?i:r,o=Math.min(...a.map(e=>e.left)),s=Math.max(...a.map(e=>e.right));return{bottom:Math.max(...a.map(e=>e.bottom)),center:o+(s-o)/2,top:Math.min(...a.map(e=>e.top))}}function gF(e,t,n){return Math.min(Math.max(e,t),Math.max(t,n))}function _F({actionLabel:e,children:t,className:n=`contents`,isSelectionAllowed:r,maxCharacters:i,onAddToChat:a,selectionTooLongLabel:o}){let s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=(0,H.useRef)(!1),u=(0,H.useRef)(null),[d,f]=(0,H.useState)(null),[p,m]=(0,H.useState)(null),h=(0,H.useCallback)(()=>{let e=s.current,t=window.getSelection();if(!e||!t||!fF(e,t)){f(null);return}let n=t.toString().trim();if(!n){f(null);return}let a=t.getRangeAt(0),o=hF(a),c={range:a.cloneRange(),text:n};if(r&&!r(c)){f(null);return}m(null),f({anchorBottom:o.bottom,anchorCenter:o.center,anchorTop:o.top,selection:c,tooLong:n.length>i})},[r,i]),g=(0,H.useCallback)(()=>{u.current!==null&&window.cancelAnimationFrame(u.current),u.current=window.requestAnimationFrame(()=>{u.current=null,h()})},[h]),_=(0,H.useCallback)(e=>{if(c.current=e,!d||!e)return;let t=e.getBoundingClientRect(),n=gF(d.anchorCenter-t.width/2,uF,window.innerWidth-uF-t.width),r=d.anchorBottom+dF,i=d.anchorTop-dF-t.height;m({left:n,top:gF(i>=uF?i:r,uF,window.innerHeight-uF-t.height)})},[d]);return(0,H.useEffect)(()=>{let e=()=>{let e=window.getSelection();if(!e||e.isCollapsed){f(null);return}l.current||g()},t=e=>{let t=s.current;l.current=!!(t&&e.target instanceof Node&&t.contains(e.target)),l.current&&f(null)},n=e=>{if(c.current?.contains(e.target))return;let t=l.current;l.current=!1,t&&g()},r=e=>{e.key===`Escape`&&f(null)},i=()=>f(null);return document.addEventListener(`selectionchange`,e),document.addEventListener(`pointerdown`,t,!0),document.addEventListener(`pointerup`,n,!0),document.addEventListener(`keydown`,r),document.addEventListener(`scroll`,i,!0),window.addEventListener(`resize`,i),()=>{document.removeEventListener(`selectionchange`,e),document.removeEventListener(`pointerdown`,t,!0),document.removeEventListener(`pointerup`,n,!0),document.removeEventListener(`keydown`,r),document.removeEventListener(`scroll`,i,!0),window.removeEventListener(`resize`,i),u.current!==null&&window.cancelAnimationFrame(u.current)}},[g]),(0,U.jsxs)(`div`,{ref:s,className:n,children:[t,d&&a?(0,Dy.createPortal)((0,U.jsxs)(`button`,{ref:_,type:`button`,className:`fixed z-[var(--z-popover,10100)] inline-flex max-w-[calc(100vw-24px)] items-center gap-1.5 overflow-hidden whitespace-nowrap rounded-xl border border-border bg-popover px-3 py-2 text-xs font-medium text-popover-foreground shadow-lg transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 disabled:cursor-not-allowed disabled:text-muted-foreground`,style:{left:p?.left??0,top:p?.top??0,visibility:p?`visible`:`hidden`},disabled:d.tooLong,onMouseDown:e=>e.preventDefault(),onClick:()=>{d.tooLong||(a(d.selection),window.getSelection()?.removeAllRanges(),f(null))},children:[(0,U.jsx)(wo,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:d.tooLong?o:e})]}),document.body):null]})}function vF(e){return{key:e.key,triggerSpecs:[e.trigger],resolvePanel:t=>t.trigger.key===e.trigger.key?e.resolvePanel(t):null}}function yF(e){let{data:t,plugins:n,trigger:r}=e,i=n.flatMap(e=>[...e.triggerSpecs]);if(!r)return{triggerSpecs:i,panel:null};for(let e of n){let n=e.resolvePanel({data:t,trigger:r});if(n)return{triggerSpecs:i,panel:n}}return{triggerSpecs:i,panel:null}}var bF=`2rem`;function xF(e){return`min(${e}, max(0px, calc(var(--radix-popover-content-available-height, 100vh) - ${bF})))`}var SF=xF(`24rem`),CF=_l,wF=yl,TF=vl,EF=H.forwardRef(({className:e,sideOffset:t=8,align:n=`start`,collisionPadding:r=12,style:i,...a},o)=>(0,U.jsx)(bl,{children:(0,U.jsx)(xl,{ref:o,sideOffset:t,align:n,collisionPadding:r,className:u(`z-[var(--z-popover,10100)] w-72 overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-popover p-4 text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),style:{maxHeight:SF,...i},...a})}));EF.displayName=xl.displayName;async function DF(e){let t=await yk(e);I[t?`success`:`error`](b(t?`chatSessionCopyIdSuccess`:`chatSessionCopyIdFailed`))}function OF({sessionKey:e,children:t,disabled:n=!1,triggerSize:r=`md`,triggerTone:i=`default`,className:a}){let[o,s]=(0,H.useState)(!1);return(0,U.jsxs)(CF,{open:o,onOpenChange:s,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)($r,{className:`h-4 w-4`}),label:b(`chatSessionMoreActions`),tooltip:!1,size:r,tone:i,className:a,disabled:n,onClick:e=>e.stopPropagation()})}),(0,U.jsx)(EF,{align:`end`,className:`w-56 p-2`,children:(0,U.jsxs)(`div`,{className:`space-y-1`,onClick:()=>s(!1),children:[(0,U.jsx)(mc,{icon:Oa,label:b(`chatSessionCopyId`),onClick:()=>{s(!1),DF(e)},disabled:n}),t]})})]})}function kF(e){try{return JSON.stringify(e??{},null,2)}catch{return`{}`}}function AF({open:e,metadata:t,onOpenChange:n}){return(0,U.jsx)(Wr,{open:e,onOpenChange:n,children:(0,U.jsxs)(qr,{className:`max-w-2xl gap-0 overflow-hidden p-0`,children:[(0,U.jsxs)(Gr,{className:`border-b border-border px-5 py-4 pr-12`,children:[(0,U.jsx)(Jr,{className:`text-base`,children:b(`chatSessionMetadataDialogTitle`)}),(0,U.jsx)(Vr,{className:`sr-only`,children:b(`chatSessionMetadataDialogDescription`)})]}),(0,U.jsx)(`div`,{className:`px-5 pb-5 pt-4`,children:(0,U.jsx)(`pre`,{className:`max-h-[60vh] overflow-auto rounded-lg border border-border bg-muted/60 p-4 font-mono text-xs leading-6 text-foreground shadow-inner custom-scrollbar`,children:kF(t)})})]})})}function jF(e){return[`server-path-browse`,e.path?.trim()??``,e.basePath?.trim()??``,e.includeFiles??!1]}function MF(e){let{basePath:t,enabled:n,includeFiles:r,path:i}=e,a=i?.trim()??``,o=t?.trim()??``;return z({queryKey:jF({path:a,basePath:o,includeFiles:r}),queryFn:()=>gt({path:a,basePath:o,includeFiles:r}),enabled:n??!0,staleTime:0})}function NF(){return R({mutationFn:Kt})}var PF=`[mask-image:linear-gradient(to_bottom,black_calc(100%_-_28px),transparent)] [-webkit-mask-image:linear-gradient(to_bottom,black_calc(100%_-_28px),transparent)]`,FF=H.forwardRef(({className:e,children:t,...n},r)=>(0,U.jsx)(`div`,{ref:r,className:u(`overflow-auto`,e),...n,children:t}));FF.displayName=`ScrollArea`;function IF({entries:e,emptyMessage:t,disabled:n,onOpen:r,onSelect:i,selectedPath:a}){let o=(e,t)=>{e.preventDefault();let n=Array.from(e.currentTarget.parentElement?.querySelectorAll(`[data-server-path-row]`)??[]),r=n[n.indexOf(e.currentTarget)+t];r&&(r.focus(),r.click())};return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_8rem] border-b border-border bg-muted/20 px-3 py-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:b(`pathPickerNameColumn`)}),(0,U.jsx)(`span`,{children:b(`pathPickerTypeColumn`)})]}),(0,U.jsx)(FF,{className:`min-h-0 flex-1`,children:e.length>0?(0,U.jsx)(`div`,{role:`listbox`,"aria-label":b(`pathPickerDirectoryList`),className:`p-1.5`,children:e.map(e=>{let t=a===e.path;return(0,U.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,"data-server-path-row":!0,className:u(`grid w-full grid-cols-[minmax(0,1fr)_8rem] items-center rounded-sm border border-transparent px-2 py-1.5 text-left text-sm text-foreground outline-none transition-colors`,t?`border-primary/25 bg-primary/15`:`hover:bg-[var(--interaction-hover)] focus-visible:border-primary/35 focus-visible:bg-accent/70`),onClick:()=>i(e.path),onDoubleClick:()=>r(e.path),onKeyDown:t=>{t.key===`Enter`&&(t.preventDefault(),r(e.path)),t.key===`ArrowDown`&&o(t,1),t.key===`ArrowUp`&&o(t,-1)},disabled:n,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(Qa,{className:`h-4 w-4 shrink-0 fill-amber-300 text-amber-500`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,U.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:b(`pathPickerDirectoryType`)})]},e.path)})}):(0,U.jsx)(`div`,{className:`grid h-full min-h-48 place-items-center px-6 text-center text-sm text-muted-foreground`,children:t})})]})}function LF({confirmLabel:e,disabled:t,hint:n,isSaving:r,onCancel:i,onSelectedPathChange:a,pathLabel:o,pathPlaceholder:s,selectedPath:c}){return(0,U.jsxs)(`div`,{className:`min-w-0 border-t border-border bg-muted/20 px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(fn,{htmlFor:`server-path-picker-selection`,className:`shrink-0 text-sm`,children:o}),(0,U.jsx)(Ct,{id:`server-path-picker-selection`,value:c,onChange:e=>a(e.target.value),placeholder:s,disabled:r,className:`h-9 min-w-0 flex-1 bg-background`}),(0,U.jsxs)(Fr,{className:`shrink-0 flex-row gap-2`,children:[(0,U.jsx)(L,{type:`button`,variant:`outline`,onClick:i,disabled:r,children:b(`cancel`)}),(0,U.jsx)(L,{type:`submit`,disabled:t,children:r?b(`saving`):e})]})]}),n?(0,U.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:n}):null]})}var RF={applications:fi,desktop:Mo,documents:Wn,downloads:ja,home:oo,"icloud-drive":wa,workspace:Ka,root:io,volumes:io},zF={applications:`pathPickerApplications`,desktop:`pathPickerDesktop`,documents:`pathPickerDocuments`,downloads:`pathPickerDownloads`,"icloud-drive":`pathPickerICloudDrive`,volumes:`pathPickerVolumes`};function BF({currentPath:e,defaultWorkspacePath:t,disabled:n,homePath:r,locations:i,rootPath:a,onNavigate:o}){let s=[],c=[],l=new Set,d=(e,t)=>{let n=t.path.trim();!n||l.has(n)||(l.add(n),e.push({...t,path:n}))};t&&d(s,{icon:`workspace`,label:b(`pathPickerDefaultWorkspace`),path:t}),r&&d(s,{icon:`home`,label:b(`homeDirectory`),path:r});for(let e of i)d(e.kind===`volumes`?c:s,{icon:e.kind,label:b(zF[e.kind]),path:e.path});a&&d(c,{icon:`root`,label:b(`pathPickerFileSystem`),path:a});let f=t=>t.map(t=>{let r=RF[t.icon],i=e===t.path;return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,i?`bg-primary/12 text-primary`:`text-foreground hover:bg-[var(--interaction-hover)]`),"aria-current":i?`location`:void 0,onClick:()=>o(t.path),disabled:n,children:[(0,U.jsx)(r,{className:u(`h-4 w-4 shrink-0`,i?`text-primary`:`text-amber-500`)}),(0,U.jsx)(`span`,{className:`truncate`,children:t.label})]},t.path)});return(0,U.jsxs)(`aside`,{className:`hidden min-h-0 w-48 shrink-0 overflow-y-auto border-r border-border bg-muted/20 p-2 sm:block`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:[(0,U.jsx)(us,{className:`h-3.5 w-3.5`}),b(`pathPickerQuickAccess`)]}),(0,U.jsx)(`nav`,{"aria-label":b(`pathPickerQuickAccess`),className:`space-y-0.5`,children:f(s)}),c.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mb-1 mt-3 px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:b(`pathPickerLocations`)}),(0,U.jsx)(`nav`,{"aria-label":b(`pathPickerLocations`),className:`space-y-0.5`,children:f(c)})]}):null]})}function VF({addressPath:e,breadcrumbs:t,canGoBack:n,canGoForward:r,canGoUp:i,disabled:a,onBack:o,onForward:s,onNavigate:c,onRefresh:l,onSearchChange:u,onUp:d,searchText:f}){let[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(``),_=t.length>5?[t[0],...t.slice(-4)]:t,v=_.length<t.length,y=()=>{a||(g(e),m(!0))},x=()=>{g(``),m(!1)},S=()=>{let e=h.trim();e&&(m(!1),c(e))};return(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-hidden border-b border-border bg-muted/25 px-3 py-2`,children:[(0,U.jsx)(V,{icon:(0,U.jsx)(wi,{className:`h-4 w-4`}),label:b(`pathPickerBack`),size:`lg`,onClick:o,disabled:!n||a}),(0,U.jsx)(V,{icon:(0,U.jsx)(ei,{className:`h-4 w-4`}),label:b(`pathPickerForward`),size:`lg`,onClick:s,disabled:!r||a}),(0,U.jsx)(V,{icon:(0,U.jsx)(Xa,{className:`h-4 w-4`}),label:b(`parentDirectory`),size:`lg`,onClick:d,disabled:!i||a}),(0,U.jsx)(`div`,{className:`ml-1 flex h-9 min-w-0 flex-1 items-center overflow-hidden rounded-md border border-border bg-background shadow-sm`,children:p?(0,U.jsx)(Ct,{value:h,onChange:e=>g(e.target.value),onBlur:x,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S()),e.key===`Escape`&&(e.preventDefault(),x())},"aria-label":b(`pathPickerAddressLabel`),className:`h-full rounded-none border-0 bg-transparent px-3 shadow-none focus-visible:ring-0`,autoFocus:!0}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Qa,{className:`ml-3 h-4 w-4 shrink-0 text-amber-500`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center overflow-hidden pl-2`,onDoubleClick:y,children:[_.length>0?_.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[t>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ha,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),v&&t===1?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-1 text-sm text-muted-foreground hover:bg-[var(--interaction-hover)]`,"aria-label":b(`pathPickerShowFullAddress`),onClick:y,children:`…`}),(0,U.jsx)(ha,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):null]}):null,(0,U.jsx)(`button`,{type:`button`,className:`max-w-40 truncate rounded px-1.5 py-1 text-sm text-foreground hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>c(e.path),disabled:a,children:e.label})]},e.path)):(0,U.jsx)(`span`,{className:`truncate text-sm text-foreground`,children:e}),(0,U.jsx)(`span`,{className:`h-full min-w-2 flex-1 cursor-text`,"aria-hidden":`true`}),(0,U.jsx)(V,{icon:(0,U.jsx)(Go,{className:`h-3.5 w-3.5`}),label:b(`pathPickerEditAddress`),size:`md`,tooltipSide:`bottom`,onClick:y,disabled:a,className:`mr-1`})]})]})}),(0,U.jsx)(V,{icon:(0,U.jsx)(Yo,{className:`h-4 w-4`}),label:b(`chatRefresh`),size:`lg`,onClick:l,disabled:a}),(0,U.jsxs)(`div`,{className:`relative hidden w-56 shrink-0 sm:block`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,U.jsx)(Ct,{value:f,onChange:e=>u(e.target.value),placeholder:b(`pathPickerSearchPlaceholder`),disabled:a,className:`h-9 rounded-md bg-background pl-9`})]})]})}function HF({errorMessage:e,isCreating:t,name:n,onCancel:r,onCreate:i,onNameChange:a}){return(0,U.jsxs)(`div`,{className:`border-b border-gray-200 bg-white px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Ct,{value:n,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i()),e.key===`Escape`&&r()},placeholder:b(`pathPickerNewFolderPlaceholder`),"aria-label":b(`pathPickerNewFolderName`),autoFocus:!0,disabled:t}),(0,U.jsx)(L,{type:`button`,onClick:i,disabled:!n.trim()||t,children:b(t?`saving`:`pathPickerCreateFolder`)}),(0,U.jsx)(L,{type:`button`,variant:`outline`,onClick:r,disabled:t,children:b(`cancel`)})]}),e?(0,U.jsxs)(`p`,{role:`alert`,className:`mt-2 text-sm text-destructive`,children:[b(`pathPickerCreateFolderFailed`),`: `,e]}):null]})}function UF({allowCreateDirectory:e,disabled:t,onNewFolder:n}){return(0,U.jsxs)(`div`,{className:`flex items-center border-b border-border bg-background px-3 py-1.5`,children:[e?(0,U.jsxs)(L,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,disabled:t,children:[(0,U.jsx)(Ja,{className:`mr-1 h-4 w-4`}),b(`pathPickerNewFolder`)]}):null,(0,U.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:b(`pathPickerDoubleClickHint`)})]})}function WF(e,t){if(!t)return e;if(e===`~`)return t;let n=t.includes(`\\`);if(e.startsWith(`~/`)||n&&e.startsWith(`~\\`)){let r=n?`\\`:`/`,i=e.slice(2).replaceAll(r===`\\`?`/`:`\\`,r);return`${t.replace(/[\\/]+$/,``)}${r}${i}`}return e}function GF({open:e,allowCreateDirectory:t=!0,currentPath:n,defaultWorkspacePath:r,isSaving:i,onOpenChange:a,onConfirm:o,title:s,description:c,pathLabel:l,pathPlaceholder:u,confirmLabel:d,hint:f}){let p=n?.trim()??``,m=r?.trim()??``,h=`${p}\u0000${m}`;return(0,U.jsx)(Wr,{open:e,onOpenChange:e=>{i||a(e)},children:(0,U.jsxs)(qr,{className:`max-h-[92vh] overflow-hidden p-0 sm:h-[44rem] sm:max-w-5xl sm:grid-rows-[auto_minmax(0,1fr)]`,children:[(0,U.jsxs)(Gr,{className:`border-b border-border px-5 py-4 pr-12`,children:[(0,U.jsx)(Jr,{children:s}),(0,U.jsx)(Vr,{className:c?void 0:`sr-only`,children:c??s})]}),e?(0,U.jsx)(KF,{allowCreateDirectory:t,currentPath:p,defaultWorkspacePath:m,isSaving:i,onCancel:()=>a(!1),onConfirm:o,pathLabel:l,pathPlaceholder:u,confirmLabel:d,hint:f},h):null]})})}function KF({allowCreateDirectory:e,currentPath:t,defaultWorkspacePath:n,isSaving:r,onCancel:i,onConfirm:a,pathLabel:o,pathPlaceholder:s,confirmLabel:c,hint:l}){let u=t||n,[d,f]=(0,H.useState)(u||null),[p,m]=(0,H.useState)(u||null),[h,g]=(0,H.useState)([]),[_,v]=(0,H.useState)([]),[y,x]=(0,H.useState)(``),[S,C]=(0,H.useState)(!1),[w,T]=(0,H.useState)(``),E=MF({path:p,enabled:!0}),D=NF(),O=WF(p?.trim()??``,E.data?.homePath),k=d===null?E.data?.currentPath??``:d===p&&E.data?.currentPath===O?E.data.currentPath:d,A=k.trim(),j=A.length===0||r,M=O||E.data?.currentPath||``,N=!p||E.data?.currentPath===M?E.data?.breadcrumbs??[]:[],P=(0,H.useMemo)(()=>E.error?E.error instanceof Error?E.error.message:String(E.error):null,[E.error]),ee=(0,H.useMemo)(()=>D.error?D.error instanceof Error?D.error.message:String(D.error):null,[D.error]),te=w.trim().toLowerCase(),ne=(0,H.useMemo)(()=>(E.data?.entries??[]).filter(e=>e.kind===`directory`),[E.data?.entries]),re=(0,H.useMemo)(()=>te.length===0?ne:ne.filter(e=>{let t=e.name.toLowerCase(),n=e.path.toLowerCase();return t.includes(te)||n.includes(te)}),[ne,te]),ie=e=>{m(e),f(e),T(``),C(!1),x(``),D.reset()},ae=e=>{let t=e.trim();if(!t)return;let n=M;n&&n!==t&&g(e=>[...e,n].slice(-50)),v([]),ie(t)},oe=()=>{let e=h.at(-1);if(!e)return;let t=M;g(e=>e.slice(0,-1)),t&&v(e=>[t,...e].slice(0,50)),ie(e)},se=()=>{let e=_[0];if(!e)return;let t=M;v(e=>e.slice(1)),t&&g(e=>[...e,t].slice(-50)),ie(e)},ce=async()=>{let t=E.data?.currentPath,n=y.trim();if(!(!e||!t||!n||D.isPending))try{let e=await D.mutateAsync({parentPath:t,name:n});await E.refetch(),f(e.path),x(``),C(!1)}catch{}},le=E.isLoading?b(`loading`):P?`${b(`pathBrowseFailed`)}: ${P}`:ne.length>0?b(`pathPickerSearchEmpty`):b(`emptyDirectory`),ue=r||E.isLoading;return(0,U.jsxs)(`form`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden`,onSubmit:e=>{e.preventDefault(),!j&&a(A)},children:[(0,U.jsx)(VF,{addressPath:M,breadcrumbs:N,canGoBack:h.length>0,canGoForward:_.length>0,canGoUp:!!E.data?.parentPath,disabled:ue,onBack:oe,onForward:se,onNavigate:ae,onRefresh:()=>void E.refetch(),onSearchChange:T,onUp:()=>{let e=E.data?.parentPath;e&&ae(e)},searchText:w}),(0,U.jsx)(UF,{allowCreateDirectory:e,disabled:ue||!E.data?.currentPath,onNewFolder:()=>{C(!0),x(``),D.reset()}}),(0,U.jsxs)(`div`,{className:`relative border-b border-border p-2 sm:hidden`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,U.jsx)(Ct,{value:w,onChange:e=>T(e.target.value),placeholder:b(`pathPickerSearchPlaceholder`),disabled:ue,className:`h-9 pl-9`})]}),e&&S?(0,U.jsx)(HF,{errorMessage:ee,isCreating:D.isPending,name:y,onCancel:()=>C(!1),onCreate:()=>void ce(),onNameChange:e=>{x(e),D.reset()}}):null,(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,U.jsx)(BF,{currentPath:M,defaultWorkspacePath:WF(n,E.data?.homePath)||null,disabled:ue,homePath:E.data?.homePath,locations:E.data?.locations??[],rootPath:E.data?.breadcrumbs[0]?.path,onNavigate:ae}),(0,U.jsx)(IF,{entries:re,emptyMessage:le,disabled:r,onOpen:ae,onSelect:f,selectedPath:A})]}),(0,U.jsx)(LF,{confirmLabel:c,disabled:j,hint:l,isSaving:r,onCancel:i,onSelectedPathChange:f,pathLabel:o,pathPlaceholder:s,selectedPath:k})]})}function qF({open:e,currentProjectRoot:t,defaultWorkspacePath:n,isSaving:r,onOpenChange:i,onSave:a}){return(0,U.jsx)(GF,{open:e,currentPath:t,defaultWorkspacePath:n,isSaving:r,onOpenChange:i,onConfirm:a,title:b(`chatSessionProjectDialogTitle`),description:b(`chatSessionProjectDialogDescription`),pathLabel:b(`chatSessionProjectPathLabel`),pathPlaceholder:b(`chatSessionProjectPathPlaceholder`),confirmLabel:b(`chatSessionSetProject`),hint:b(`chatSessionProjectUpdateHint`)})}var JF=`flex shrink-0 items-center gap-1.5`;function YF({sessionKey:e,canDeleteSession:t,isDeletePending:n,currentPath:r,defaultWorkspacePath:i,metadata:a,isWorkspaceOpen:o,onToggleWorkspace:s,onDeleteSession:c}){let l=pc(),[u,d]=(0,H.useState)(!1),[f,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(!1),g=n||m,_=async n=>{if(!e)return;let r=t;h(!0);try{await l({sessionKey:e,projectRoot:n,persistToServer:r}),d(!1)}finally{h(!1)}};return(0,U.jsxs)(`div`,{className:JF,children:[e?(0,U.jsxs)(OF,{sessionKey:e,disabled:g,children:[(0,U.jsx)(mc,{icon:qa,label:b(`chatSessionSetProject`),onClick:()=>d(!0),disabled:g}),(0,U.jsx)(mc,{icon:dee,label:b(`chatSessionViewMetadata`),onClick:()=>p(!0),disabled:g}),(0,U.jsx)(mc,{icon:ms,label:b(`chatDeleteSession`),onClick:c,disabled:!t||g,destructive:!0})]}):null,(0,U.jsx)(V,{icon:o?(0,U.jsx)(Vo,{className:`h-4 w-4`}):(0,U.jsx)(xi,{className:`h-4 w-4`}),label:b(o?`chatSessionCloseWorkspace`:`chatSessionOpenWorkspace`),"aria-pressed":o,onClick:s,disabled:g}),e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(qF,{open:u,currentProjectRoot:r,defaultWorkspacePath:i,isSaving:m,onOpenChange:d,onSave:_}),(0,U.jsx)(AF,{open:f,metadata:a,onOpenChange:p})]}):null]})}var XF={maxHeight:xF(`18rem`)};function ZF({sessionKey:e,projectName:t,projectRoot:n,defaultWorkspacePath:r,persistToServer:i}){let a=pc(),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(!1),f=async t=>{d(!0);try{await a({sessionKey:e,projectRoot:t,persistToServer:i}),l(!1),s(!1)}finally{d(!1)}};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(CF,{open:o,onOpenChange:s,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,title:n??void 0,className:`min-w-0 max-w-[320px] shrink rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:border-primary/35 hover:bg-[var(--interaction-hover)] hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-60`,"aria-label":b(`chatSessionSetProject`),disabled:u,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(qa,{className:`h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:t}),(0,U.jsx)(or,{className:`h-3 w-3 shrink-0 opacity-70`})]})})}),(0,U.jsxs)(EF,{align:`start`,className:`w-72 p-2`,style:XF,children:[(0,U.jsxs)(`div`,{className:`px-3 pb-2 pt-1`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground`,children:t}),n?(0,U.jsx)(`div`,{className:`mt-1 break-all text-xs text-muted-foreground`,children:n}):null]}),(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(mc,{icon:Go,label:b(`chatSessionSetProject`),onClick:()=>{s(!1),l(!0)},disabled:u}),(0,U.jsx)(mc,{icon:Za,label:b(`chatSessionClearProject`),onClick:()=>{f(null)},disabled:u})]})]})]}),(0,U.jsx)(qF,{open:c,currentProjectRoot:n,defaultWorkspacePath:r,isSaving:u,onOpenChange:l,onSave:f})]})}var QF=(0,H.createContext)(null);function $F({presenter:e,children:t}){return(0,U.jsx)(QF.Provider,{value:e,children:t})}function eI(){let e=(0,H.useContext)(QF);if(!e)throw Error(`usePresenter must be used inside ChatPresenterProvider`);return e}var tI=[[`Thinking`,`thinking`],[`Calling tool`,`tool-running`],[`Tool call completed`,`tool-completed`],[`Run failed`,`run-failed`],[`Run interrupted`,`run-interrupted`]];function nI(e){let t=e.label?.trim();if(t)return t;let n=e.key.split(`:`);return n[n.length-1]||e.key}function rI(e,t){let n=e.statusText?.trim(),r=e.statusKind||!n?void 0:tI.find(([e])=>n===e||n.startsWith(`${e}: `)),i=e.statusKind??r?.[1],a=r?n?.slice(r[0].length).replace(/^:\s*/,``)||void 0:n;switch(i){case`thinking`:return b(`chatTyping`,t);case`tool-running`:return[b(`chatToolCall`,t),b(`chatToolStatusRunning`,t),a].filter(Boolean).join(` · `);case`tool-completed`:return[b(`chatToolCall`,t),b(`chatToolStatusCompleted`,t),a].filter(Boolean).join(` · `);case`run-failed`:return[b(`chatToolStatusFailed`,t),a].filter(Boolean).join(` · `);case`run-interrupted`:return b(`chatSessionActivityInterrupted`,t);default:return a??null}}function iI(e,t=N()){let n=e.activityPreview;return!n||n.state===`cancelled`?null:n.state===`completed`&&n.replyText?n.replyText:rI(n,t)??n.replyText??null}function aI(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function oI(e,t){return e.getFullYear()===t.getFullYear()}function sI(e,t){let n=`${e.getMonth()+1}月${e.getDate()}日`;return oI(e,t)?n:`${e.getFullYear()}年${n}`}function cI(e,t=N(),n=new Date){if(!e)return`-`;let r=e instanceof Date?e:new Date(e);if(Number.isNaN(r.getTime()))return typeof e==`string`?e:`-`;let i=S(t),a=aI(r),o=aI(n),s=Math.floor((o-a)/864e5);if(s===0)return new Intl.DateTimeFormat(i,{hour:`2-digit`,minute:`2-digit`,hour12:!1}).format(r);if(s===1)return b(`chatSidebarYesterday`,t);if(s>1&&s<7)return new Intl.DateTimeFormat(i,{weekday:`long`}).format(r);if(t===`zh`)return sI(r,n);let c=oI(r,n)?{month:`numeric`,day:`numeric`}:{year:`numeric`,month:`numeric`,day:`numeric`};return new Intl.DateTimeFormat(i,c).format(r)}function lI(e){return e.trim().toLowerCase()}function uI(e,t){let n=lI(t);return n?[e.key,nI(e),e.projectRoot??``,e.projectName??``].map(lI).some(e=>e.includes(n)):!0}var dI=function(e){return e.CALL=`call`,e.RESULT=`result`,e.PARTIAL_CALL=`partial-call`,e.ERROR=`error`,e.CANCELLED=`cancelled`,e}({});function fI(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function pI(e){return fI(e)}function mI(e){let t=fI(e);if(!t)return null;let n=t.replace(/[\\/]+$/,``);if(!n)return t;let r=n.split(/[\\/]/).filter(Boolean);return r[r.length-1]??n}function hI(e){return/^[A-Za-z]:[\\/]?$/.test(e)||e===`/`?e:e.replace(/[\\/]+$/,``)}function gI(e){let t=hI(e.trim().replace(/\\/g,`/`));return/^[A-Za-z]:/.test(t)?`${t.slice(0,1).toLowerCase()}${t.slice(1)}`:t}function _I(e,t){if(!e)return t.join(`/`);let n=hI(e.trim().replace(/\\/g,`/`));return t.length===0?n:n===`/`?`/${t.join(`/`)}`:`${n}/${t.join(`/`)}`}function vI(e){let t=hI(e.trim().replace(/\\/g,`/`));if(!t||t===`/`||/^[A-Za-z]:[\\/]?$/.test(t))return null;let n=t.lastIndexOf(`/`);if(n<0)return null;if(n===0)return`/`;let r=t.slice(0,n);return/^[A-Za-z]:$/.test(r)?`${r}/`:r}function yI(e){let t=e.trim().replace(/\\/g,`/`);return t?/^[A-Za-z]:\//.test(t)?{prefix:t.slice(0,2),segments:t.slice(3).split(`/`).filter(Boolean)}:t.startsWith(`/`)?{prefix:`/`,segments:t.slice(1).split(`/`).filter(Boolean)}:{prefix:null,segments:t.split(`/`).filter(Boolean)}:{prefix:null,segments:[]}}function bI(e){let t=gI(e.path),n=gI(e.sessionProjectRoot);if(!t||!n)return null;if(!t.startsWith(`/`)&&!/^[A-Za-z]:\//.test(t))return t.split(`/`).filter(Boolean);if(t===n)return[];let r=n.endsWith(`/`)?n:`${n}/`;return t.startsWith(r)?t.slice(r.length).split(`/`).filter(Boolean):null}function xI(e){let t=e.sessionProjectRoot?.trim();if(!t)return null;let n=bI({path:e.path,sessionProjectRoot:t});return!n?.length||n.some(e=>e===`.`||e===`..`)?null:n.join(`/`)}function SI(e){let{basePath:t=null,currentKind:n=`file`,labels:r,leading:i=null}=e,a=r.map((e,i)=>{let a=i===r.length-1?n:`directory`,o=_I(t,r.slice(0,i+1));return{key:`${i}:${e}`,label:e,kind:a,path:o,browsePath:a===`file`?vI(o):o,isCurrent:i===r.length-1}});return i?[i,...a]:a}function CI(e){let{kind:t=`file`,path:n,sessionProjectRoot:r,truncated:i}=e,a=n.trim(),o=r?.trim()&&a?bI({path:a,sessionProjectRoot:r}):null,s;if(r?.trim()&&o){let e=r.trim(),n=mI(e)??e;s=SI({labels:o,basePath:e,currentKind:t,leading:{key:`workspace:${n}`,label:n,kind:`workspace`,path:e,browsePath:e,isCurrent:o.length===0}})}else{let{prefix:e,segments:n}=yI(a),r=e===`/`?`/`:e?`${e}/`:null;s=SI({labels:n,basePath:r,currentKind:t,leading:e?{key:`root:${e}`,label:e,kind:`root`,path:r??e,browsePath:r??e,isCurrent:n.length===0}:null})}return s.length===0&&(s=[{key:`file:unknown`,label:a||`file`,kind:t,path:a,browsePath:t===`directory`?a:vI(a),isCurrent:!0}]),{fullPath:a,truncated:i,segments:s}}var wI=new Set([`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`]),TI=new Set([`running`,`completed`,`failed`,`cancelled`,`idle`]),EI=new Set([`thinking`,`tool-running`,`tool-completed`,`run-failed`,`run-interrupted`]);function DI(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function OI(e){let{metadata:t}=e;return!t||typeof t!=`object`||Array.isArray(t)?null:t}function kI(e){let t=OI(e)?.last_activity_preview;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,{state:r}=n,i=DI(n.timestamp);if(!TI.has(r)||!i)return null;let a=DI(n.statusKind);return{state:r,timestamp:i,statusKind:EI.has(a)?a:void 0,statusText:DI(n.statusText)??void 0,replyText:DI(n.replyText)??void 0}}function AI(e){let t=OI(e);return t?DI(t.preferred_model)??DI(t.preferredModel)??DI(t.model):null}function jI(e){let t=OI(e);if(!t)return null;let n=DI(t.preferred_thinking)??DI(t.thinking)??DI(t.thinking_level)??DI(t.thinkingLevel);if(!n)return null;let r=n.toLowerCase();return wI.has(r)?r:null}function MI(e){let t=OI(e);return t?DI(t.label):null}function NI(e){let t=OI(e);return t?pI(t.project_root??t.projectRoot):null}function PI(e){return DI(e.workingDir)}function FI(e){let t=OI(e);return t?DI(t.ui_last_read_at):null}function II(e){let t=OI(e);return t?DI(t.runtime)??DI(t.session_type)??DI(t.sessionType)??`native`:`native`}function LI(e){let t=OI(e);return t?DI(t.parent_session_id)??DI(t.parentSessionId):null}function RI(e){let t=OI(e);return t?DI(t.spawned_by_request_id)??DI(t.spawnedByRequestId):null}function zI(e){let t=OI(e);return t?t.child_session_promoted===!0:!1}function BI(e){if(e.startsWith(`cron:`))return{type:`cron`};if(e.startsWith(`agent:`)){let t=e.split(`:`);if(t.length>=3){let e=t[2];if(e&&e!==`main`&&e!==`direct`)return{channel:e}}}return{}}function VI(e){return e.state===`cancelled`?dI.CANCELLED:e.state===`result`?dI.RESULT:e.state===`partial-call`?dI.PARTIAL_CALL:dI.CALL}function HI(e){let t=[];for(let n of e.filter(e=>e.type!==`tool-invocation`||!e.payloadDeferred)){if(n.type===`text`){t.push({type:`text`,text:n.text});continue}if(n.type===`rich-text`){t.push({type:`text`,text:n.text});continue}if(n.type===`reasoning`){t.push({type:`reasoning`,reasoning:n.text,details:[]});continue}if(n.type===`source`){t.push({type:`source`,source:{sourceType:`url`,id:n.url??n.title??Math.random().toString(36).slice(2,8),url:n.url??``,...n.title?{title:n.title}:{}}});continue}if(n.type===`file`&&n.contentBase64){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:n.contentBase64,...n.url?{url:n.url}:{},...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`file`&&n.url){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:``,url:n.url,...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`file`&&n.assetUri){t.push({type:`file`,...n.name?{name:n.name}:{},mimeType:n.mimeType??`application/octet-stream`,data:``,url:Se(n.assetUri),...typeof n.sizeBytes==`number`?{sizeBytes:n.sizeBytes}:{}});continue}if(n.type===`step-start`){t.push({type:`step-start`});continue}n.type===`tool-invocation`&&t.push({type:`tool-invocation`,toolInvocation:{status:VI(n),toolCallId:n.toolCallId??`${n.toolName}-${Math.random().toString(36).slice(2,8)}`,toolName:n.toolName,args:typeof n.args==`string`?n.args:``,parsedArgs:n.args,result:n.result,...n.execution?{execution:{...n.execution}}:{}}})}return t}function UI(e){return e.flatMap(e=>e.type===`extension`?[e]:HI([e]))}function WI(e){return e===`service`?`system`:e===`tool`?`assistant`:e}function GI(e){return{id:e.id,role:WI(e.role),parts:HI(e.parts),meta:{source:`stream`,status:e.status,sessionKey:e.sessionId,timestamp:e.timestamp}}}function KI(e){let t=OI(e),n=MI(e),r=AI(e),i=jI(e),a=NI(e),o=PI(e)??a,s=FI(e),c=DI(e.lastMessageAt),l=mI(a),u=BI(e.sessionId),d=LI(e),f=RI(e),p=zI(e),m=kI(e);return{key:e.sessionId,createdAt:e.createdAt??e.updatedAt,updatedAt:e.updatedAt,...c?{lastMessageAt:c}:{},...s?{readAt:s}:{},...typeof e.agentId==`string`&&e.agentId.trim().length>0?{agentId:e.agentId.trim()}:{},...n?{label:n}:{},...u,...r?{preferredModel:r}:{},...i?{preferredThinking:i}:{},...a?{projectRoot:a}:{},...o?{workingDir:o}:{},...l?{projectName:l}:{},...t?{metadata:t}:{},sessionType:II(e),sessionTypeMutable:!1,status:e.status??`idle`,isChildSession:!!d,...p?{isPromotedChildSession:p}:{},...d?{parentSessionId:d}:{},...f?{spawnedByRequestId:f}:{},...m?{activityPreview:m}:{},messageCount:e.messageCount}}function qI(e){return e.map(KI)}function JI(){return`ncp-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var YI=`nextclaw.chat.session-list.mode`,XI=`time-first`;function ZI(e){return e===`time-first`||e===`project-first`}function QI(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))]:[]}function $I(e){if(!e||typeof e!=`object`)return null;let{snapshot:t}=e;return!t||typeof t!=`object`?null:ZI(t.listMode)?t.listMode:null}function eL(e,t){let n=e?.trim();if(!n)return!1;let r=t?.trim();return r?n.localeCompare(r)>0:!1}function tL(e){let{active:t,readAt:n,runStatus:r,lastMessageAt:i}=e;return t||r===`running`?!1:eL(i,n)}var nL={selectedSessionKey:null,selectedAgentId:`main`,query:``,listMode:XI,pinnedSessionKeys:[],pinnedProjectRoots:[],collapsedProjectRoots:[]};function rL(e){return t=>e(e=>({snapshot:{...e.snapshot,...t}}))}function iL(e){return(t,n)=>e(e=>{let r=t.trim(),i=n?.trim();if(!r||!i)return e;let a=e.optimisticReadAtBySessionKey[r];return a&&a.localeCompare(i)>=0?e:{...e,optimisticReadAtBySessionKey:{...e.optimisticReadAtBySessionKey,[r]:i}}})}var aL=P()(Mi(e=>({snapshot:nL,optimisticReadAtBySessionKey:{},setSnapshot:rL(e),markSessionRead:iL(e)}),{name:YI,storage:Ni(()=>window.localStorage),partialize:e=>({snapshot:{listMode:e.snapshot.listMode,pinnedSessionKeys:e.snapshot.pinnedSessionKeys,pinnedProjectRoots:e.snapshot.pinnedProjectRoots,collapsedProjectRoots:e.snapshot.collapsedProjectRoots}}),merge:(e,t)=>{if(!e||typeof e!=`object`)return t;let{snapshot:n}=e,r=$I(e);return{...t,snapshot:{...t.snapshot,...r?{listMode:r}:{},pinnedSessionKeys:QI(n?.pinnedSessionKeys),pinnedProjectRoots:QI(n?.pinnedProjectRoots),collapsedProjectRoots:QI(n?.collapsedProjectRoots)}}}})),oL={staleTime:5e3,retry:!1};function sL(e){return z({queryKey:[`ncp-sessions`,e?.limit??null,e?.peerId?.trim()||null],queryFn:()=>Be(e),...oL})}function cL(e){return kn({queryKey:[`ncp-session-pages`,e.pageSize,e.query?.trim()||null],initialPageParam:1,queryFn:({pageParam:t})=>Be({page:t,pageSize:e.pageSize,...e.query?.trim()?{query:e.query.trim()}:{}}),getNextPageParam:e=>e.hasMore?(e.page??1)+1:void 0,...oL})}function lL(e){return z({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>Ne(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,...oL})}function uL(e){return z({queryKey:[`ncp-session-token-usage`,e],queryFn:()=>Le(e),enabled:!!e,...oL})}var dL=e=>[`ncp-session-observations`,e];function fL(e){return z({queryKey:dL(e),queryFn:()=>Je(e),enabled:!!e,...oL})}function pL(e){let t=xe();return R({mutationFn:t=>wn(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:dL(e)})}})}function mL(e,t){return e.filter(e=>uI(e,t))}function hL(e){return e.isChildSession?e.isPromotedChildSession===!0:!0}function gL(e={}){let t=aL(e=>e.snapshot.query),n=e.query??t,r=(0,H.useDeferredValue)(n),i=cL({pageSize:e.limit??100,query:r}),a=(0,H.useMemo)(()=>qI(i.data?.pages.flatMap(e=>e.sessions)??[]).map(e=>({session:e,runStatus:e.status===`running`?`running`:void 0})),[i.data?.pages]),o=(0,H.useMemo)(()=>{let e=a.filter(({session:e})=>hL(e)),t=new Set(mL(e.map(({session:e})=>e),n).map(e=>e.key));return e.filter(({session:e})=>t.has(e.key))},[a,n]);return{allItems:a,isLoading:i.isLoading,items:o,hasMore:i.hasNextPage,isLoadingMore:i.isFetchingNextPage,loadMore:i.fetchNextPage}}function _L(e){return new Date(e.session.lastMessageAt??e.session.createdAt).getTime()}function vL(e){return[...e].sort((e,t)=>_L(t)-_L(e))}function yL(e,t){return[...e].sort((e,n)=>Number(t.has(n.session.key))-Number(t.has(e.session.key))||_L(n)-_L(e))}function bL(e,t=new Set){let n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),i=r-864e5,a=r-7*864e5,o=[],s=[],c=[],l=[],u=e.filter(e=>!t.has(e.session.key)),d=yL(e.filter(e=>t.has(e.session.key)),t);for(let e of u){let t=_L(e);t>=r?o.push(e):t>=i?s.push(e):t>=a?c.push(e):l.push(e)}let f=[];return d.length>0&&f.push({label:b(`chatSidebarPinned`),items:d}),o.length>0&&f.push({label:b(`chatSidebarToday`),items:o}),s.length>0&&f.push({label:b(`chatSidebarYesterday`),items:s}),c.length>0&&f.push({label:b(`chatSidebarPrevious7Days`),items:c}),l.length>0&&f.push({label:b(`chatSidebarOlder`),items:l}),f}function xL(e,t=new Set,n=new Set,r=[]){let i=new Map;for(let e of r)i.set(e.rootPath,{projectRoot:e.rootPath,projectName:e.name,items:[],latestUpdatedAt:new Date(e.updatedAt).getTime(),isPinned:n.has(e.rootPath)});for(let t of e){let e=t.session.projectRoot?.trim();if(!e)continue;let r=i.get(e),a=_L(t);if(r){r.items.push(t),r.latestUpdatedAt=Math.max(r.latestUpdatedAt,a);continue}i.set(e,{projectRoot:e,projectName:t.session.projectName?.trim()||mI(e)||e,items:[t],latestUpdatedAt:a,isPinned:n.has(e)})}return[...i.values()].map(e=>({...e,items:yL(e.items,t)})).sort((e,t)=>Number(t.isPinned)-Number(e.isPinned)||t.latestUpdatedAt-e.latestUpdatedAt)}function SL(e){let t=new Map;for(let n of e){let e=n.session.parentSessionId?.trim();if(!e)continue;let r=t.get(e)??[];r.push(n),t.set(e,r)}for(let e of t.values())e.sort((e,t)=>_L(t)-_L(e));return t}function CL(e){if(e.label&&e.label.trim())return e.label.trim();let t=e.key.split(`:`);return t[t.length-1]||e.key}function wL({isProjectFirstView:e,onSelectMode:t}){return(0,U.jsxs)(`div`,{role:`group`,"aria-label":b(`chatSidebarViewMode`),className:`relative grid h-7 grid-cols-2 rounded-full bg-foreground/[0.04] p-0.5 text-[11px]`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:u(`pointer-events-none absolute bottom-0.5 left-0.5 top-0.5 w-[calc(50%-2px)] rounded-full bg-gray-200/70 transition-transform duration-200 ease-out motion-reduce:transition-none`,e&&`translate-x-full`)}),(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:u(`relative z-10 inline-flex h-6 items-center justify-center gap-1 rounded-full px-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1`,e?`text-muted-foreground hover:text-foreground`:`font-medium text-foreground`),children:[(0,U.jsx)(Sa,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),b(`chatSidebarViewTime`)]}),(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:u(`relative z-10 inline-flex h-6 items-center justify-center gap-1 rounded-full px-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1`,e?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(Qa,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),b(`chatSidebarViewProject`)]})]})}var TL=`native`;function EL(e){return typeof e==`string`?e.trim().toLowerCase()||`native`:TL}function DL(e,t=TL){return EL(e?.runtime?.trim()||e?.engine?.trim()||t)}function OL(e,t){return e===`native`?b(`chatSessionTypeNative`):t?.trim()||e.trim().split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||e}function kL(e){let t=new Map;for(let n of e){let e=EL(n.value);t.set(e,{value:e,label:n.label?.trim()||OL(e),icon:n.icon??null,ready:n.ready??!0,reason:n.reason??null,reasonMessage:n.reasonMessage??null,supportedModels:n.supportedModels,recommendedModel:n.recommendedModel??null,modelSelectionMode:n.modelSelectionMode??`nextclaw`,runtimeDefaultThinking:n.runtimeDefaultThinking??null,cta:n.cta??null})}return t.has(`native`)||t.set(TL,{value:TL,label:OL(TL),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,modelSelectionMode:`nextclaw`,runtimeDefaultThinking:null,cta:null}),Array.from(t.values()).sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}var AL={telegram:`telegram.svg`,slack:`slack.svg`,discord:`discord.svg`,whatsapp:`whatsapp.svg`,qq:`qq.svg`,feishu:`feishu.svg`,dingtalk:`dingtalk.svg`,wecom:`wecom.svg`,weixin:`weixin.svg`,email:`email.svg`};function jL(e,t){let n=e[t.toLowerCase()];return n?`/logos/${n}`:null}function ML(e){return jL(AL,e)}var NL={wx:`weixin`,lark:`feishu`},PL={cron:{icon:`cron`}},FL={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function IL(e){return e?.trim().toLowerCase()??``}function LL(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function RL(e,t){let n=IL(e);if(!n||n===`native`)return null;let r=t.find(e=>IL(e.value)===n);return r?.label.trim()?r.label.trim():LL(n)}function zL(e,t){let n=IL(e);return!n||n===`native`?null:t.find(e=>IL(e.value)===n)??null}function BL(e){let t=IL(e);if(!t)return null;let n=NL[t]??t;return ML(n)?n:null}function VL(e,t){let n=BL(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=PL[IL(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=IL(e.sessionType),a=zL(i,t);if(a?.icon?.src?.trim())return{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},label:null};let o=FL[i];return o?{icon:null,label:b(o)}:{icon:null,label:a?.label?.trim()||RL(e.sessionType,t)}}var HL=`app://`;function UL(e){let t=e.trim().replace(/^\/+/,``);if(!t)return null;let n=t.split(`/`);return n.some(e=>e.trim().length===0||e===`.`||e===`..`)?null:n.join(`/`)}function WL(e){let t=e.trim();if(!t)return null;if(!t.startsWith(HL))return t;let n=UL(t.slice(6));return n?`/${n}`:null}function GL({name:e,src:t,className:n,imgClassName:r,fallback:i}){let[a,o]=(0,H.useState)(!1),s=!!t&&!a;return(0,U.jsx)(`div`,{className:u(`inline-flex shrink-0 items-center justify-center overflow-hidden`,n),children:s?(0,U.jsx)(`img`,{src:t,alt:`${e} logo`,className:u(`block h-6 w-6 object-contain`,r),onError:()=>o(!0),draggable:!1}):i??(0,U.jsx)(`span`,{className:`text-lg font-bold uppercase`,children:e.slice(0,1)})})}function KL({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,U.jsx)(qL,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=WL(e.src);return(0,U.jsx)(GL,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,U.jsx)(la,{className:u(`h-3 w-3 text-current`,t),strokeWidth:2.4})})}return(0,U.jsx)(ia,{className:u(`h-3.5 w-3.5`,t)})}function qL({channel:e,className:t}){return(0,U.jsx)(GL,{name:e,src:ML(e),className:u(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,U.jsx)(la,{className:`h-3 w-3 text-muted-foreground`})})}function JL({status:e,className:t}){let n=b(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,U.jsxs)(`span`,{className:u(`inline-flex h-3.5 w-3.5 items-center justify-center text-muted-foreground/70`,t),title:n,"aria-label":n,children:[(0,U.jsx)(Di,{className:`h-3 w-3 animate-spin`}),(0,U.jsx)(`span`,{className:`sr-only`,children:n})]})}function YL({item:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i}){let{session:a,runStatus:o}=e,s=t===a.key,c=n[a.key],l=c&&a.readAt?c.localeCompare(a.readAt)>0?c:a.readAt:c??a.readAt,d=tL({active:s,lastMessageAt:a.lastMessageAt,readAt:l,runStatus:o}),f=iI(a)??a.projectName??a.projectRoot??`${a.messageCount}`,p=cI(a.lastMessageAt??a.createdAt),m=VL(a,r);return(0,U.jsxs)(`button`,{type:`button`,"aria-current":s?`page`:void 0,className:u(`flex w-full min-w-0 items-start gap-2 rounded-lg px-2.5 py-2 text-left transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,s?`bg-accent text-accent-foreground`:`text-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),onClick:()=>i(a.key),children:[(0,U.jsx)(`span`,{className:`relative mt-1 flex h-2.5 w-2.5 shrink-0 items-center justify-center`,children:d?(0,U.jsx)(`span`,{"aria-label":b(`chatSidebarUnread`),className:`h-1.5 w-1.5 rounded-full bg-primary`}):s?(0,U.jsx)(jr,{className:`h-3 w-3 text-primary`}):(0,U.jsx)(`span`,{className:`h-1 w-1 rounded-full bg-muted-foreground/45`})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:nI(a)}),m.label?(0,U.jsx)(`span`,{className:`shrink-0 rounded-full border border-border/70 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-muted-foreground`,children:m.label}):null,m.icon?(0,U.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center text-muted-foreground`,children:(0,U.jsx)(KL,{icon:m.icon})}):null]}),(0,U.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:f}),(0,U.jsx)(`span`,{className:`shrink-0`,children:p})]})]}),o?(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,U.jsx)(JL,{status:o})}):null]})}function XL({items:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i,className:a}){return(0,U.jsx)(`div`,{className:u(`space-y-1`,a),children:e.map(e=>(0,U.jsx)(YL,{item:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i},e.session.key))})}function ZL({group:e,...t}){return(0,U.jsxs)(`section`,{"aria-label":e.label,children:[(0,U.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground/70`,children:e.label}),(0,U.jsx)(XL,{items:e.items,...t})]})}function QL({group:e,isCollapsed:t,onToggleCollapsed:n,...r}){let i=(0,H.useId)(),a=`${b(t?`chatSidebarExpandProject`:`chatSidebarCollapseProject`)} · ${e.projectName}`;return(0,U.jsxs)(`section`,{"aria-label":e.projectName,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-controls":i,"aria-expanded":!t,"aria-label":a,className:`group flex h-10 w-full min-w-0 items-center gap-1.5 rounded-lg px-2 text-left text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>n(e.projectRoot),children:[(0,U.jsx)(Qa,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-medium uppercase tracking-wider`,title:e.projectRoot,children:e.projectName}),(0,U.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:e.items.length}),t?(0,U.jsx)(ha,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):(0,U.jsx)(or,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`})]}),t?null:(0,U.jsx)(XL,{items:e.items,className:`mt-0.5`,...r})]})}function $L({collapsedProjectRoots:e,dateGroups:t,isProjectFirstView:n,onToggleProjectCollapsed:r,projectGroups:i,...a}){return(0,U.jsx)(`div`,{className:`space-y-3`,children:n?i.map(t=>(0,U.jsx)(QL,{group:t,isCollapsed:e.includes(t.projectRoot),onToggleCollapsed:r,...a},t.projectRoot)):t.map(e=>(0,U.jsx)(ZL,{group:e,...a},e.label))})}var eR=P(e=>({snapshot:{},setSnapshot:t=>e(({snapshot:e})=>({snapshot:{...e,...t}}))})),tR=[`projects`];function nR(e={}){return z({queryKey:tR,queryFn:Lt,enabled:e.enabled??!0,staleTime:3e4})}function rR(){let e=xe();return R({mutationFn:Ke,onSuccess:async()=>{await e.invalidateQueries({queryKey:tR}),I.success(b(`chatProjectCreated`))},onError:e=>{I.error(`${b(`chatProjectCreateFailed`)}: ${e.message}`)}})}function iR(){let e=xe();return R({mutationFn:De,onSuccess:async()=>{await e.invalidateQueries({queryKey:tR}),I.success(b(`chatProjectExistingAdded`))},onError:e=>{I.error(`${b(`chatProjectExistingFailed`)}: ${e.message}`)}})}var aR=`group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-sm font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`;function oR({title:e}){return(0,U.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:e})}function sR({label:e}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-xs text-muted-foreground`,children:[(0,U.jsx)(Eo,{className:`h-4 w-4 shrink-0 text-muted-foreground/55`}),(0,U.jsx)(`span`,{children:e})]})}function cR(){return(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-xs text-muted-foreground`,children:[(0,U.jsx)(Di,{className:`h-4 w-4 shrink-0 animate-spin`}),(0,U.jsx)(`span`,{children:b(`sessionsLoading`)})]})}function lR({selectedSessionKey:e,title:t}){let n=eI(),[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(``),s=aL(e=>e.optimisticReadAtBySessionKey),c=aL(e=>e.snapshot.pinnedSessionKeys),l=aL(e=>e.snapshot.pinnedProjectRoots),d=aL(e=>e.snapshot.collapsedProjectRoots),f=aL(e=>e.snapshot.listMode),p=eR(e=>e.snapshot.sessionTypesQuery?.data??null),{isLoading:m,items:h}=gL({query:a}),g=nR(),_=(0,H.useMemo)(()=>{let e=a.trim().toLowerCase(),t=g.data?.projects??[];return e?t.filter(t=>t.name.toLowerCase().includes(e)||t.rootPath.toLowerCase().includes(e)):t},[g.data?.projects,a]),v=(0,H.useMemo)(()=>vL(h),[h]),y=(0,H.useMemo)(()=>bL(v,new Set(c)),[c,v]),x=(0,H.useMemo)(()=>xL(v,new Set(c),new Set(l),_),[l,c,v,_]),S=(0,H.useMemo)(()=>kL(p?.options??[]),[p?.options]),C=t=>{i(!1),o(``),t!==e&&n.chatSessionListManager.selectSession(t)},w=e=>{i(e),e||o(``)},T={selectedSessionKey:e,optimisticReadAtBySessionKey:s,sessionTypeOptions:S,onSelect:C},E=f===`project-first`,D=E?x.length>0:y.length>0;return(0,U.jsxs)(CF,{open:r,onOpenChange:w,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-label":`${b(`chatSessionSwitch`)}: ${t}`,"aria-expanded":r,className:aR,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,U.jsx)(or,{className:u(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:text-accent-foreground`,r?`rotate-180`:null)})]})}),(0,U.jsxs)(EF,{align:`start`,className:`w-[22rem] max-w-[calc(100vw-2rem)] p-0`,children:[(0,U.jsxs)(`div`,{className:`space-y-2 border-b border-border px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/75`,children:b(`chatSessionSwitcherTitle`)}),(0,U.jsx)(wL,{isProjectFirstView:E,onSelectMode:n.chatSessionListManager.setListMode})]}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/65`}),(0,U.jsx)(Ct,{value:a,onChange:e=>o(e.target.value),placeholder:b(`chatSearchSessionPlaceholder`),"aria-label":b(`chatSearchSessionPlaceholder`),className:`h-8 rounded-lg bg-background pl-8 pr-2 text-xs`,autoFocus:!0})]})]}),(0,U.jsx)(`div`,{className:`max-h-80 overflow-y-auto p-1.5`,children:m?(0,U.jsx)(cR,{}):D?(0,U.jsx)($L,{collapsedProjectRoots:d,dateGroups:y,isProjectFirstView:E,onToggleProjectCollapsed:n.chatSessionListManager.toggleProjectCollapsed,projectGroups:x,...T}):(0,U.jsx)(sR,{label:a.trim()?b(`chatSessionSwitcherNoResults`):b(E?`chatSidebarProjectViewEmpty`:`sessionsEmpty`)})})]})]})}function uR({layoutMode:e,selectedSessionKey:t,title:n}){let r=sc(e=>e.isSidebarCollapsed);return e===`desktop`&&!r?(0,U.jsx)(oR,{title:n}):(0,U.jsx)(lR,{selectedSessionKey:t,title:n})}var dR=gn.chat.newSessionType,fR=[`preference`,dR];function pR(e,t){let n=EL(e);return t.find(e=>e.value===n&&e.ready!==!1)??null}function mR(e){let{defaultSessionType:t,preferredSessionType:n,sessionTypeOptions:r}=e,i=n?pR(n,r):null,a=pR(t,r);return i??a??r.find(e=>e.ready!==!1)??r[0]??{value:EL(t),label:EL(t),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,modelSelectionMode:`nextclaw`,runtimeDefaultThinking:null,cta:null}}function hR(e){return typeof e?.value==`string`?EL(e.value):null}function gR({defaultSessionType:e,sessionTypeOptions:t}){let n=xe(),r=z({queryKey:fR,queryFn:()=>it(dR),staleTime:3e4,retry:!1}),i=(0,H.useMemo)(()=>hR(r.data),[r.data]),a=(0,H.useMemo)(()=>mR({preferredSessionType:i,defaultSessionType:e,sessionTypeOptions:t}),[e,i,t]),o=R({mutationFn:async e=>await Ae(dR,EL(e)),onMutate:async e=>{let t=EL(e);await n.cancelQueries({queryKey:fR});let r=n.getQueryData(fR);return n.setQueryData(fR,{key:dR,value:t,updatedAt:new Date().toISOString()}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(fR,r.previous)},onSuccess:e=>{n.setQueryData(fR,e)}}),s=(0,H.useCallback)(e=>{let n=pR(e,t);n&&o.mutate(n.value)},[t,o]);return{selectedSessionType:a.value,selectedSessionTypeOption:a,isLoading:r.isLoading,setSelectedSessionType:s}}var _R=[];function vR(){let e=eR(e=>!!(e.snapshot.configQuery?.isFetched||e.snapshot.configQuery?.isSuccess)),t=eR(e=>!!(e.snapshot.providersQuery?.isFetched||e.snapshot.providersQuery?.isSuccess)),n=eR(e=>!!(e.snapshot.providerTemplatesQuery?.isFetched||e.snapshot.providerTemplatesQuery?.isSuccess));return e&&t&&n}function yR(e){let t=eR(e=>e.snapshot.sessionsQuery?.data?.sessions??_R),n=(0,H.useMemo)(()=>qI(t),[t]);return(0,H.useMemo)(()=>n.find(t=>t.key===e)??null,[n,e])}function bR(e){return!!e&&typeof e==`object`}function xR(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function SR(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function CR(e){return typeof e==`string`?e:null}function wR(e){return e===`auto`||e===`source`||e===`rendered`?e:null}function TR(e){try{return a(e)??null}catch{return null}}function ER(e){if(!bR(e)||typeof e.key!=`string`||typeof e.path!=`string`||e.viewMode!==`preview`&&e.viewMode!==`diff`)return null;let t=e.key.trim(),n=e.path.trim();return!t||!n?null:{key:t,parentSessionKey:xR(e.parentSessionKey),path:n,label:xR(e.label),viewMode:e.viewMode,previewViewer:wR(e.previewViewer),line:SR(e.line),column:SR(e.column),params:TR(e.params),rawText:CR(e.rawText),contentUrl:xR(e.contentUrl),mimeType:xR(e.mimeType),beforeText:CR(e.beforeText),afterText:CR(e.afterText),patchText:CR(e.patchText),oldStartLine:SR(e.oldStartLine),newStartLine:SR(e.newStartLine)}}function DR(e){return{key:e.key,parentSessionKey:e.parentSessionKey,path:e.path,label:e.label,viewMode:e.viewMode,previewViewer:e.previewViewer,line:e.line,column:e.column,params:e.params,rawText:e.rawText,contentUrl:e.contentUrl,mimeType:e.mimeType,beforeText:e.beforeText,afterText:e.afterText,patchText:e.patchText,oldStartLine:e.oldStartLine,newStartLine:e.newStartLine}}function OR(e,t,n){let r=e.slice(0,n),i=t?e.find(e=>e.key===t):null;return!i||r.some(e=>e.key===i.key)?r:r.length<n?[...r,i]:[...r.slice(0,-1),i]}function kR(e){return typeof e!=`number`||!Number.isFinite(e)?480:Math.max(360,Math.min(860,e))}function AR(e){return typeof e!=`number`||!Number.isFinite(e)?224:Math.max(192,Math.min(400,e))}function jR(e){return/\.html?$/i.test(e)?`html`:/\.mdx?$/i.test(e)?`markdown`:null}function MR(e,t){let n=jR(e);return n===`html`?t===`rendered`?`rendered`:`source`:n===`markdown`?t===`source`?`source`:`rendered`:t===`source`||t===`rendered`?t:null}function NR(e,t){return MR(e,t)??t??null}function PR(e,t){return jR(e)?MR(e,t)===`source`?`rendered`:`source`:null}function FR(e,t){let n=e.path.trim();if(!n)return null;let r=t?.trim()||null,i=e.viewMode===`preview`?NR(n,e.previewViewer??(e.line?`source`:void 0)):e.previewViewer??null,a=e.viewMode===`preview`&&i===`rendered`?`preview:rendered`:e.viewMode;return{key:`${r??`draft`}::${a}::${n}`,parentSessionKey:r,path:n,label:e.label?.trim()||null,viewMode:e.viewMode,previewViewer:i,line:e.line??null,column:e.column??null,params:e.params??null,rawText:e.rawText??null,contentUrl:e.contentUrl?.trim()||null,mimeType:e.mimeType?.trim()||null,beforeText:e.beforeText??null,afterText:e.afterText??null,patchText:e.patchText??null,oldStartLine:e.oldStartLine??null,newStartLine:e.newStartLine??null,fullLines:e.fullLines}}function IR(e,t,n){let r=e.findIndex(e=>e.key===t.key);if(r!==-1){let n=[...e];return n[r]={...e[r],...t},n}let i=n?e.findIndex(e=>e.key===n):-1;return i===-1?[t,...e]:[...e.slice(0,i+1),t,...e.slice(i+1)]}function LR(e,t,n){let r=e.viewMode===`preview`&&e.previewViewer===`rendered`?`preview:rendered`:e.viewMode;return{...e,key:`${e.parentSessionKey??`draft`}::${r}::${t}`,path:t,label:n?.trim()||e.label}}function RR(e,t){let n=t.trim(),r=e.key.indexOf(`::`),i=r>=0?e.key.slice(r):`::${e.key}`;return{...e,key:`${n}${i}`,parentSessionKey:n}}function zR(e,t){return e.kind===t.kind?e.kind===`overview`||e.kind===`child-sessions`||e.kind===`project-files`||e.kind===`cron`||e.kind===`continuous-attention`?!0:t.kind!==`overview`&&t.kind!==`child-sessions`&&t.kind!==`project-files`&&t.kind!==`cron`&&t.kind!==`continuous-attention`&&e.key===t.key:!1}function BR(e){let{activeChildSessionKey:t,activeSideChatDraft:n,activeWorkspaceFileKey:r,activeWorkspacePanelKind:i}=e;return i===`overview`||i===`child-sessions`||i===`project-files`||i===`cron`||i===`continuous-attention`?{kind:i}:i===`child-session`&&t?{kind:`child-session`,key:t}:i===`side-chat-draft`&&n?{kind:`side-chat-draft`,key:n.draftKey}:i===`file`&&r?{kind:`file`,key:r}:null}function VR(e,t){if(e.kind===`overview`||e.kind===`child-sessions`||e.kind===`project-files`||e.kind===`continuous-attention`)return{activeWorkspacePanelKind:e.kind,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null};if(e.kind===`cron`)return{activeWorkspacePanelKind:`cron`,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null};if(e.kind===`file`)return t.workspaceFileTabs.some(t=>t.key===e.key)?{activeWorkspacePanelKind:`file`,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:e.key}:null;if(e.kind===`side-chat-draft`){let{activeSideChatDraft:n}=t;return n?.draftKey===e.key?{activeWorkspacePanelKind:`side-chat-draft`,activeChildSessionKey:null,activeSideChatDraft:n,activeWorkspaceFileKey:null}:null}return{activeWorkspacePanelKind:`child-session`,activeChildSessionKey:e.key,activeSideChatDraft:null,activeWorkspaceFileKey:null}}function HR(e,t){if(t.kind===`overview`||t.kind===`child-sessions`||t.kind===`cron`||t.kind===`project-files`||t.kind===`continuous-attention`)return null;let n=yi({entries:e.workspaceNavigationHistory,index:e.workspaceNavigationHistoryIndex},e=>!zR(e,t),{kind:`overview`}),r={closedWorkspaceTabEntries:t.kind!==`file`&&t.kind!==`side-chat-draft`?[...e.closedWorkspaceTabEntries.filter(e=>!zR(e,t)),t]:e.closedWorkspaceTabEntries,childSessionTabs:t.kind===`child-session`?e.childSessionTabs.filter(e=>e.sessionKey!==t.key):e.childSessionTabs,activeSideChatDraft:t.kind===`side-chat-draft`?null:e.activeSideChatDraft,workspaceFileTabs:t.kind===`file`?e.workspaceFileTabs.filter(e=>e.key!==t.key):e.workspaceFileTabs,workspaceNavigationHistory:[...n.entries],workspaceNavigationHistoryIndex:n.index},i=BR(e);if(!i||!zR(i,t))return r;let a=VR(n.entries[n.index]??{kind:`overview`},{...e,...r});return{...r,...a??VR({kind:`overview`},e)}}function UR(e){return{draftKey:`side-chat-draft:${e}:${typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`,parentSessionKey:e}}function WR(e,t){let n=e.findIndex(e=>e.sessionKey===t.sessionKey);if(n===-1)return[t,...e];let r=e[n],i=[...e];return i[n]={...r,parentSessionKey:r.parentSessionKey??t.parentSessionKey,label:r.label?.trim()?r.label:t.label,agentId:r.agentId?.trim()?r.agentId:t.agentId},i}function GR(e,t){let n=t.trim();if(!n)return null;let r=new Map,i=e.workspaceFileTabs.map(e=>{if(e.parentSessionKey!==null)return e;let t=RR(e,n);return r.set(e.key,t.key),t}),a=e=>{if(e.kind!==`file`)return e;let t=r.get(e.key);return t?{...e,key:t}:e};return{draftProjectRoot:null,workspaceFileTabs:i,activeWorkspaceFileKey:e.activeWorkspaceFileKey?r.get(e.activeWorkspaceFileKey)??e.activeWorkspaceFileKey:null,closedWorkspaceTabEntries:e.closedWorkspaceTabEntries.map(a),workspaceNavigationHistory:e.workspaceNavigationHistory.map(a),workspacePanelParentKey:e.workspacePanelParentKey===null&&e.activeWorkspacePanelKind?n:e.workspacePanelParentKey}}function KR(e){let{agentId:t,draftKey:n,label:r,sessionKey:i,snapshot:a}=e,o=i.trim(),s=n.trim(),{activeSideChatDraft:c}=a;if(!o||!s||c?.draftKey!==s)return null;let{parentSessionKey:l}=c,u=si(yi({entries:a.workspaceNavigationHistory,index:a.workspaceNavigationHistoryIndex},e=>e.kind!==`side-chat-draft`||e.key!==s),{kind:`child-session`,key:o},zR);return{parentSessionKey:l,patch:{workspacePanelParentKey:l,activeWorkspacePanelKind:`child-session`,activeChildSessionKey:o,activeSideChatDraft:null,activeWorkspaceFileKey:null,childSessionTabs:WR(a.childSessionTabs,{sessionKey:o,parentSessionKey:l,label:r?.trim()||null,agentId:t?.trim()||null}),workspaceNavigationHistory:[...u.entries],workspaceNavigationHistoryIndex:u.index}}}var qR=`nextclaw.chat.workspace-panel.state`,JR=3,YR=8,XR={sessionTypeLabel:null,sessionTypeIcon:null,sessionKey:null,agentId:null,sessionDisplayName:void 0,draftProjectRoot:null,sessionProjectName:null,canDeleteSession:!1,isDeletePending:!1,isHistoryLoading:!1,messages:[],isSending:!1,isAwaitingAssistantOutput:!1,hasSubmittedDraftMessage:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,workspaceFileTabs:[],activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0,workspaceExplorerOpen:!1,workspaceExplorerWidth:224,workspacePanelWidth:480,contextWindow:null};function ZR(e){return!!e&&typeof e==`object`}function QR(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function $R(e,t){return typeof e==`number`&&Number.isInteger(e)?Math.min(Math.max(0,e),t):t}function ez(e){return e===`overview`||e===`child-sessions`||e===`child-session`||e===`project-files`||e===`file`||e===`cron`}function tz(e){if(!ZR(e))return null;if(e.kind===`overview`||e.kind===`child-sessions`||e.kind===`project-files`||e.kind===`cron`||e.kind===`continuous-attention`)return{kind:e.kind};let t=QR(e.key);return!t||e.kind!==`child-session`&&e.kind!==`file`?null:{kind:e.kind,key:t}}function nz(e){if(!ZR(e))return null;let t=QR(e.workspacePanelParentKey),n=QR(e.activeWorkspaceFileKey),r=OR(Array.isArray(e.workspaceFileTabs)?e.workspaceFileTabs.map(ER).filter(e=>e!==null):[],n,YR),i=r.filter(e=>e.parentSessionKey===t),a=n&&i.some(e=>e.key===n)?n:i[0]?.key??null,o=ez(e.activeWorkspacePanelKind)?e.activeWorkspacePanelKind:null,s=o===`file`&&!a?null:o,c=QR(e.activeChildSessionKey),l=Array.isArray(e.closedWorkspaceTabEntries)?e.closedWorkspaceTabEntries.map(tz).filter(e=>e!==null&&e.kind!==`overview`):[],u=BR({activeWorkspacePanelKind:s,activeChildSessionKey:c,activeSideChatDraft:null,activeWorkspaceFileKey:a}),d=Array.isArray(e.workspaceNavigationHistory)?e.workspaceNavigationHistory.map(tz).filter(e=>e!==null).filter(e=>e.kind!==`file`||r.some(t=>t.key===e.key)):[],f=d.length>0?d:u?[u]:[];return{workspacePanelParentKey:t,activeWorkspacePanelKind:s,activeChildSessionKey:c,workspaceFileTabs:r,activeWorkspaceFileKey:a,closedWorkspaceTabEntries:l,workspaceNavigationHistory:f,workspaceNavigationHistoryIndex:f.length>0?$R(e.workspaceNavigationHistoryIndex,f.length-1):0,workspaceExplorerOpen:e.workspaceExplorerOpen===!0,workspaceExplorerWidth:AR(e.workspaceExplorerWidth),workspacePanelWidth:kR(e.workspacePanelWidth)}}var $=P()(Mi(e=>({snapshot:XR,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))}),{name:qR,version:JR,storage:Ni(()=>window.localStorage),partialize:e=>{let t=e.snapshot.workspaceNavigationHistory.filter(e=>e.kind!==`side-chat-draft`),n=t.length>0?Math.min(e.snapshot.workspaceNavigationHistoryIndex,t.length-1):0;return{snapshot:{workspacePanelParentKey:e.snapshot.workspacePanelParentKey,activeWorkspacePanelKind:e.snapshot.activeWorkspacePanelKind===`side-chat-draft`?null:e.snapshot.activeWorkspacePanelKind,activeChildSessionKey:e.snapshot.activeChildSessionKey,workspaceFileTabs:OR(e.snapshot.workspaceFileTabs,e.snapshot.activeWorkspaceFileKey,YR).map(DR),activeWorkspaceFileKey:e.snapshot.activeWorkspaceFileKey,closedWorkspaceTabEntries:e.snapshot.closedWorkspaceTabEntries.filter(e=>e.kind!==`overview`&&e.kind!==`side-chat-draft`),workspaceNavigationHistory:t,workspaceNavigationHistoryIndex:n,workspaceExplorerOpen:e.snapshot.workspaceExplorerOpen,workspaceExplorerWidth:e.snapshot.workspaceExplorerWidth,workspacePanelWidth:e.snapshot.workspacePanelWidth}}},merge:(e,t)=>{let n=nz(ZR(e)?e.snapshot:null);return n?{...t,snapshot:{...t.snapshot,...n}}:t}})),rz=[[`bg-amber-100`,`text-amber-700`],[`bg-emerald-100`,`text-emerald-700`],[`bg-blue-100`,`text-blue-700`],[`bg-rose-100`,`text-rose-700`],[`bg-cyan-100`,`text-cyan-700`],[`bg-violet-100`,`text-violet-700`]];function iz(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function az({agentId:e,displayName:t,avatarUrl:n,className:r}){let i=t?.trim()||e,a=e.trim().toLowerCase()===`main`,[o,s]=a?[`bg-[#ede7dc] [html[data-theme-appearance=dark]_&]:bg-[#373229]`,`text-[#57534e] [html[data-theme-appearance=dark]_&]:text-[#e2ded7]`]:rz[iz(e)%rz.length]??rz[0];return n?.trim()?(0,U.jsx)(`img`,{src:n,alt:t?.trim()||e,className:u(`rounded-full object-cover`,r)}):(0,U.jsx)(`div`,{className:u(`rounded-full flex items-center justify-center font-semibold`,o,s,r),"aria-label":t?.trim()||e,children:a?(0,U.jsx)(la,{className:`h-[55%] w-[55%]`,strokeWidth:2.4}):(i.trim()||`A`).slice(0,1).toUpperCase()})}function oz(){return z({queryKey:[`agents`],queryFn:Xe,staleTime:3e4})}function sz(){let e=xe();return R({mutationFn:({agentId:e,data:t})=>Fe(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),I.success(b(`configSavedApplied`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function cz(){let e=xe();return R({mutationFn:({agentId:e})=>Ge(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),I.success(b(`configSavedApplied`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function lz(e){return new Map(e.filter(e=>typeof e.id==`string`&&e.id.trim().length>0).map(e=>[e.id,e]))}function uz(e){let t=e?.trim()??``,n=oz(),r=(0,H.useMemo)(()=>lz(n.data?.agents??[]),[n.data?.agents]);return(0,H.useMemo)(()=>{if(!t)return null;let e=r.get(t)??null;return{agentId:t,profile:e,displayName:e?.displayName?.trim()||t,avatarUrl:e?.avatarUrl?.trim()||null}},[r,t])}function dz({agentId:e,className:t}){let n=uz(e);return n?(0,U.jsx)(az,{agentId:n.agentId,displayName:n.displayName,avatarUrl:n.avatarUrl,className:t}):null}function fz({layoutMode:e,onBackToList:t}){let n=eI(),r=$(e=>e.snapshot),i=aL(e=>e.snapshot.selectedSessionKey),a=aL(e=>e.snapshot.selectedAgentId),o=eR(e=>e.snapshot.sessionTypesQuery?.data??null),s=eR(e=>e.snapshot.configQuery?.data??null),c=yR(i),l=(0,H.useMemo)(()=>kL(o?.options??[]),[o?.options]),u=EL(o?.defaultType??`native`),d=gR({defaultSessionType:u,sessionTypeOptions:l}),f=EL(c?.sessionType??u),p=l.find(e=>e.value===f)??null,m=p?.label??OL(f),h=f!==`native`&&!!m,g=c?.projectRoot??null,_=pI(s?.agents.defaults.workspace),v=c?.projectName??mI(g),y=!!c,x=!!(i||m),S=(c?nI(c):void 0)||(y&&i?i:null)||b(`chatSidebarNewTask`),C=c?.agentId?.trim()??a?.trim()??``,w=C.length>0&&C.toLowerCase()!==`main`,T=!!(r.workspacePanelParentKey===i&&r.activeWorkspacePanelKind);return(0,U.jsx)(uc,{layoutMode:e,title:S,titleContent:(0,U.jsx)(uR,{layoutMode:e,selectedSessionKey:i,title:S}),shouldShow:x,onBackToList:t,leading:w?(0,U.jsx)(`div`,{className:`inline-flex shrink-0 items-center`,children:(0,U.jsx)(dz,{agentId:C,className:`h-5 w-5`})}):null,sessionTypeBadge:h?(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground`,children:[p?.icon?.src?(0,U.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] items-center justify-center`,children:(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:p.icon.src,alt:p.icon.alt??null,name:m}})}):null,m]}):null,projectBadge:v?(0,U.jsx)(ZF,{sessionKey:i??`draft`,projectName:v,projectRoot:g,defaultWorkspacePath:_,persistToServer:y}):null,actions:(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[e===`mobile`&&i?(0,U.jsx)(V,{icon:(0,U.jsx)(ss,{className:`h-4 w-4`}),label:b(`chatSidebarNewTask`),tooltip:!1,onClick:()=>n.chatSessionListManager.createSession({sessionType:d.selectedSessionType})}):null,(0,U.jsx)(YF,{sessionKey:i,canDeleteSession:y,isDeletePending:r.isDeletePending,currentPath:g??c?.workingDir??r.draftProjectRoot??_,defaultWorkspacePath:_,metadata:c?.metadata??null,isWorkspaceOpen:T,onToggleWorkspace:()=>{n.chatThreadManager.toggleWorkspacePanel(i)},onDeleteSession:n.chatThreadManager.deleteSession})]})})}function pz(){let e=eI(),t=$(e=>e.snapshot);return(0,U.jsx)(lc,{parentSessionLabel:t.parentSessionKey?t.parentSessionLabel??null:null,onGoToParentSession:e.chatThreadManager.goToParentSession})}function mz(e,t){return e.label?.trim()?e.label.trim():t?nI(t):e.sessionKey}function hz(e){let t=sL({limit:200}),n=(0,H.useMemo)(()=>t.data?.sessions??[],[t.data?.sessions]),r=(0,H.useMemo)(()=>{let e=qI(n);return new Map(e.map(e=>[e.key,e]))},[n]);return(0,H.useMemo)(()=>e.map(e=>{let t=r.get(e.sessionKey)??null,n=e.agentId?.trim()||t?.agentId||null;return{sessionKey:e.sessionKey,parentSessionKey:e.parentSessionKey,title:mz(e,t),agentId:n,updatedAt:t?.updatedAt??null,lastMessageAt:t?.lastMessageAt??null,readAt:t?.readAt??null,runStatus:t?.status===`running`?`running`:void 0,sessionTypeLabel:t?.sessionType?OL(t.sessionType):null,preferredModel:t?.preferredModel?.trim()||null,projectName:t?.projectName?.trim()||null,projectRoot:t?.projectRoot?.trim()||null}}),[r,e])}function gz(e){let t=e.path.split(`/`).filter(Boolean).pop();return e.label?.trim()||t||e.path}function _z(e){let{activePanelKind:t,activeChildSessionKey:n,activeSideChatDraft:r,activeWorkspaceFileKey:i,childSessionTabs:a,workspaceFileTabs:o}=e;if(t===`overview`)return{kind:`overview`};if(t===`child-sessions`)return{kind:`child-sessions`};if(t===`project-files`)return{kind:`project-files`};if(t===`cron`)return{kind:`cron`};if(t===`continuous-attention`)return{kind:`continuous-attention`};if(t===`side-chat-draft`&&r)return{kind:`side-chat-draft`,draft:r};if(t!==`child-session`&&i){let e=o.find(e=>e.key===i);if(e)return{kind:`file`,file:e}}if(t!==`file`&&n){let e=a.find(e=>e.sessionKey===n);if(e)return{kind:`child-session`,tab:e}}return a[0]?{kind:`child-session`,tab:a[0]}:r?{kind:`side-chat-draft`,draft:r}:o[0]?{kind:`file`,file:o[0]}:null}function vz({activeSelection:e,hasSession:t,onSelectChildSessions:n,onSelectCronJobs:r,onSelectOverview:i,onSelectProjectFiles:a,onSelectContinuousAttention:o}){let s=[{key:`overview`,kind:`overview`,title:b(`chatWorkspaceOverview`),tooltip:b(`chatWorkspaceOverview`),active:e?.kind===`overview`,onSelect:i},{key:`child-sessions`,kind:`child-sessions`,title:b(`chatWorkspaceChildSessions`),tooltip:b(`chatWorkspaceChildSessions`),active:e?.kind===`child-sessions`,onSelect:n},{key:`cron:session`,kind:`cron`,title:b(`chatWorkspaceSessionCronJobs`),tooltip:b(`chatWorkspaceSessionCronJobs`),active:e?.kind===`cron`,onSelect:r},{key:`continuous-attention`,kind:`continuous-attention`,title:b(`chatWorkspaceContinuousAttention`),tooltip:b(`chatWorkspaceContinuousAttention`),active:e?.kind===`continuous-attention`,onSelect:o??(()=>void 0)},{key:`project-files`,kind:`project-files`,title:b(`chatWorkspaceProjectFiles`),tooltip:b(`chatWorkspaceProjectFiles`),active:e?.kind===`project-files`,onSelect:a}];return t?s:s.filter(e=>e.kind===`project-files`)}function yz(e){let{hasSession:t,activeSideChatDraft:n,closedWorkspaceTabEntries:r,resolvedChildTabs:i,workspaceFileTabs:a,activeSelection:o,optimisticReadAtBySessionKey:s,sessionProjectRoot:c,onAddFileToChat:l,onSelectSession:u,onSelectFile:d,onOpenFileViewer:f,onCloseTab:p,onSelectOverview:m,onSelectChildSessions:h,onSelectProjectFiles:g,onSelectCronJobs:_,onSelectContinuousAttention:v=()=>void 0}=e,y=vz({activeSelection:o,hasSession:t,onSelectChildSessions:h,onSelectCronJobs:_,onSelectOverview:m,onSelectProjectFiles:g,onSelectContinuousAttention:v}),x=n?[{key:`side-chat-draft:${n.draftKey}`,kind:`side-chat-draft`,title:b(`chatWorkspaceSideChatDraftTitle`),tooltip:b(`chatWorkspaceSideChatDraftSubtitle`),active:o?.kind===`side-chat-draft`&&o.draft.draftKey===n.draftKey,onSelect:()=>void 0,onClose:()=>p({kind:`side-chat-draft`,key:n.draftKey})}]:[],S=i.filter(e=>!r.some(t=>zR(t,{kind:`child-session`,key:e.sessionKey}))).map(e=>{let t=s[e.sessionKey],n=t&&e.readAt?t.localeCompare(e.readAt)>0?t:e.readAt:t??e.readAt;return{key:`child:${e.sessionKey}`,kind:`child-session`,title:e.title,tooltip:e.title,agentId:e.agentId,sessionKey:e.sessionKey,active:o?.kind===`child-session`&&o.tab.sessionKey===e.sessionKey,showUnreadDot:tL({active:o?.kind===`child-session`&&o.tab.sessionKey===e.sessionKey,lastMessageAt:e.lastMessageAt,readAt:n,runStatus:e.runStatus}),onSelect:()=>u(e.sessionKey),onClose:()=>p({kind:`child-session`,key:e.sessionKey})}}),C=a.map(e=>{let t=e.viewMode===`preview`?MR(e.path,e.previewViewer):null,n=e.viewMode===`preview`?PR(e.path,e.previewViewer):null,r=gz(e),i=xI({path:e.path,sessionProjectRoot:c??null});return{key:`file:${e.key}`,kind:`file`,title:t===`rendered`?`${b(`chatWorkspacePreview`)}: ${r}`:r,tooltip:e.path,fileName:e.path,viewMode:e.viewMode,isRenderedPreview:t===`rendered`,alternateViewerAction:n?{label:b(n===`rendered`?`chatWorkspaceOpenPreview`:`chatWorkspaceOpenSource`),viewer:n,onSelect:()=>f(e.key,n)}:null,onAddToChat:i&&l?()=>l({label:r,tokenKey:i}):void 0,active:o?.kind===`file`&&o.file.key===e.key,onSelect:()=>d(e.key),onClose:()=>p({kind:`file`,key:e.key})}});return[...y,...x,...S,...C]}function bz(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var xz=Object.freeze({left:0,top:0,width:16,height:16}),Sz=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Cz=Object.freeze({...xz,...Sz}),wz=Object.freeze({...Cz,body:``,hidden:!1});function Tz(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function Ez(e,t){let n=Tz(e,t);for(let r in wz)r in Sz?r in e&&!(r in n)&&(n[r]=Sz[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function Dz(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=Ez(r[e]||i[e],a)}return o(t),n.forEach(o),Ez(e,a)}function Oz(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=bz(e);for(let i in r){let a=r[i];a&&(t(i,Dz(e,i,a)),n.push(i))}return n}var kz={provider:``,aliases:{},not_found:{},...xz};function Az(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function jz(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!Az(e,kz))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!Az(t,wz))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!Az(t,wz))return null}return t}var Mz=Object.create(null);function Nz(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Pz(e,t){let n=Mz[e]||(Mz[e]=Object.create(null));return n[t]||(n[t]=Nz(e,t))}function Fz(e,t){return jz(t)?Oz(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function Iz(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var Lz=/^[a-z0-9]+(-[a-z0-9]+)*$/,Rz=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!zz(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!zz(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!zz(e,n)?null:e}return null},zz=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,Bz=!1;function Vz(e){return typeof e==`boolean`&&(Bz=e),Bz}function Hz(e){let t=typeof e==`string`?Rz(e,!0,Bz):e;if(t){let e=Pz(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function Uz(e,t){let n=Rz(e,!0,Bz);if(!n)return!1;let r=Pz(n.provider,n.prefix);return t?Iz(r,n.name,t):(r.missing.add(n.name),!0)}function Wz(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),Bz&&!t&&!e.prefix){let t=!1;return jz(e)&&(e.prefix=``,Oz(e,(e,n)=>{Uz(e,n)&&(t=!0)})),t}let n=e.prefix;return zz({prefix:n,name:`a`})?!!Fz(Pz(t,n),e):!1}var Gz=Object.freeze({width:null,height:null}),Kz=Object.freeze({...Gz,...Sz}),qz=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Jz=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Yz(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(qz);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=Jz.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function Xz(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function Zz(e,t){return e?`<defs>`+e+`</defs>`+t:t}function Qz(e,t,n){let r=Xz(e);return Zz(r.defs,t+r.content+n)}var $z=e=>e===`unset`||e===`undefined`||e===`none`;function eB(e,t){let n={...Cz,...e},r={...Kz,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`);break}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=Qz(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=Yz(d,c/l)):(u=o===`auto`?c:o,d=s===null?Yz(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{$z(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var tB=/\sid="(\S+)"/g,nB=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),rB=0;function iB(e,t=nB){let n=[],r;for(;r=tB.exec(e);)n.push(r[1]);if(!n.length)return e;let i=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(n=>{let r=typeof t==`function`?t(n):t+(rB++).toString(),a=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+a+`)([")]|\\.[a-z])`,`g`),`$1`+r+i+`$3`)}),e=e.replace(new RegExp(i,`g`),``),e}var aB=Object.create(null);function oB(e,t){aB[e]=t}function sB(e){return aB[e]||aB[``]}function cB(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var lB=Object.create(null),uB=[`https://api.simplesvg.com`,`https://api.unisvg.com`],dB=[];uB.length>0;)uB.length===1||Math.random()>.5?dB.push(uB.shift()):dB.push(uB.pop());lB[``]=cB({resources:[`https://api.iconify.design`].concat(dB)});function fB(e,t){let n=cB(t);return n===null?!1:(lB[e]=n,!0)}function pB(e){return lB[e]}var mB=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function hB(e,t){let n=pB(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function gB(e){return e===404}var _B=(e,t,n)=>{let r=[],i=hB(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function vB(e){if(typeof e==`string`){let t=pB(e);if(t)return t.path}return`/`}var yB={prepare:_B,send:(e,t,n)=>{if(!mB){n(`abort`,424);return}let r=vB(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;mB(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(gB(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function bB(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function xB(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||bB([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var SB=0;function CB(e,t,n){let r=SB++,i=bB.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function wB(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=Pz(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function TB(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?Rz(e,t,n):e;i&&r.push(i)}),r}var EB={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function DB(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function y(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function b(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?x():v());return}if(m(),y(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function x(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(y(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{b(i,e,t)}};f.push(i),l++,d=setTimeout(x,e.rotate),n(r,t,i.callback)}return setTimeout(x),_}function OB(e){let t={...EB,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=DB(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function kB(){}var AB=Object.create(null);function jB(e){if(!AB[e]){let t=pB(e);if(!t)return;AB[e]={config:t,redundancy:OB(t)}}return AB[e]}function MB(e,t,n){let r,i;if(typeof e==`string`){let t=sB(e);if(!t)return n(void 0,424),kB;i=t.send;let a=jB(e);a&&(r=a.redundancy)}else{let t=cB(e);if(t){r=OB(t);let n=sB(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),kB):r.query(t,i,n)().abort}function NB(){}function PB(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,xB(e)}))}function FB(e){let t=[],n=[];return e.forEach(e=>{(e.match(Lz)?t:n).push(e)}),{valid:t,invalid:n}}function IB(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!Fz(e,n).length){r();return}}catch(e){console.error(e)}r(),PB(e)}function LB(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function RB(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){LB(e.loadIcons(r,n,t),t=>{IB(e,r,t)});return}if(i){r.forEach(r=>{LB(i(r,n,t),t=>{IB(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=FB(r);if(o.length&&IB(e,o,null),!a.length)return;let s=n.match(Lz)?sB(t):null;if(!s){IB(e,a,null);return}s.prepare(t,n,a).forEach(n=>{MB(t,n,t=>{IB(e,n.icons,t)})})}))}var zB=(e,t)=>{let n=wB(TB(e,!0,Vz()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,NB)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(Pz(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=Pz(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&RB(e,t)}),t?CB(t,n,i):NB};function BB(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in Gz?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var VB=/[\s,]+/;function HB(e,t){t.split(VB).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function UB(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}else if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function WB(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function GB(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function KB(e){return`data:image/svg+xml,`+GB(e)}function qB(e){return`url("`+KB(e)+`")`}var JB;function YB(){try{JB=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{JB=null}}function XB(e){return JB===void 0&&YB(),JB?JB.createHTML(e):e}var ZB={...Kz,inline:!1},QB={xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},$B={display:`inline-block`},eV={backgroundColor:`currentColor`},tV={backgroundColor:`transparent`},nV={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},rV={WebkitMask:eV,mask:eV,background:tV};for(let e in rV){let t=rV[e];for(let n in nV)t[e+n]=nV[n]}var iV={...ZB,inline:!0};function aV(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var oV=(e,t,n)=>{let r=t.inline?iV:ZB,i=BB(r,t),a=t.mode||`svg`,o={},s=t.style||{},c={...a===`svg`?QB:{}};if(n){let e=Rz(n,!1,!0);if(e){let t=[`iconify`];for(let n of[`provider`,`prefix`])e[n]&&t.push(`iconify--`+e[n]);c.className=t.join(` `)}}for(let e in t){let n=t[e];if(n!==void 0)switch(e){case`icon`:case`style`:case`children`:case`onLoad`:case`mode`:case`ssr`:case`fallback`:break;case`_ref`:c.ref=n;break;case`className`:c[e]=(c[e]?c[e]+` `:``)+n;break;case`inline`:case`hFlip`:case`vFlip`:i[e]=n===!0||n===`true`||n===1;break;case`flip`:typeof n==`string`&&HB(i,n);break;case`color`:o.color=n;break;case`rotate`:typeof n==`string`?i[e]=UB(n):typeof n==`number`&&(i[e]=n);break;case`ariaHidden`:case`aria-hidden`:n!==!0&&n!==`true`&&delete c[`aria-hidden`];break;default:r[e]===void 0&&(c[e]=n)}}let l=eB(e,i),u=l.attributes;if(i.inline&&(o.verticalAlign=`-0.125em`),a===`svg`){c.style={...o,...s},Object.assign(c,u);let e=0,n=t.id;return typeof n==`string`&&(n=n.replace(/-/g,`_`)),c.dangerouslySetInnerHTML={__html:XB(iB(l.body,n?()=>n+`ID`+ e++:`iconifyReact`))},(0,H.createElement)(`svg`,c)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=WB(d,{...u,width:f+``,height:p+``});return c.style={...o,"--svg":qB(h),width:aV(u.width),height:aV(u.height),...$B,...m?eV:tV,...s},(0,H.createElement)(`span`,c)};if(Vz(!0),oB(``,yB),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!Wz(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;fB(e,r)||console.error(n)}catch{console.error(n)}}}}function sV(e){let[t,n]=(0,H.useState)(!!e.ssr),[r,i]=(0,H.useState)({});function a(t){if(t){let t=e.icon;if(typeof t==`object`)return{name:``,data:t};let n=Hz(t);if(n)return{name:t,data:n}}return{name:``}}let[o,s]=(0,H.useState)(a(!!e.ssr));function c(){let e=r.callback;e&&(e(),i({}))}function l(e){if(JSON.stringify(o)!==JSON.stringify(e))return c(),s(e),!0}function u(){var t;let n=e.icon;if(typeof n==`object`){l({name:``,data:n});return}let r=Hz(n);l({name:n,data:r})&&(r===void 0?i({callback:zB([n],u)}):r&&((t=e.onLoad)==null||t.call(e,n)))}(0,H.useEffect)(()=>(n(!0),c),[]),(0,H.useEffect)(()=>{t&&u()},[e.icon,t]);let{name:d,data:f}=o;return f?oV({...Cz,...f},e,d):e.children?e.children:e.fallback?e.fallback:(0,H.createElement)(`span`,{})}var cV=(0,H.forwardRef)((e,t)=>sV({...e,_ref:t}));(0,H.forwardRef)((e,t)=>sV({inline:!0,...e,_ref:t}));var lV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#c5c5c5" d="M20.414 2H5v28h22V8.586ZM7 28V4h12v6h6v18Z"/>`}})),uV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#00007f" d="M17.229 4a.9.9 0 0 0-.569.232l-7.6 6.32a1.158 1.158 0 0 1-.955.328H3.208A1.2 1.2 0 0 0 2 12.088v7.826a1.2 1.2 0 0 0 1.208 1.206H8.1a1.158 1.158 0 0 1 .955.328l7.6 6.32c.521.433 1.081.224 1.081-.289V4.522A.494.494 0 0 0 17.229 4ZM27 6.3l-1.791 1.793a14.708 14.708 0 0 1 0 15.844l1.785 1.776A17.19 17.19 0 0 0 27 6.3Zm-4.333 4.323L20.905 12.4a6.035 6.035 0 0 1 0 7.237l1.756 1.756a8.554 8.554 0 0 0 .01-10.769Z"/>`}})),dV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#fbf0df" d="M29 17c0 5.65-5.82 10.23-13 10.23S3 22.61 3 17c0-3.5 2.24-6.6 5.66-8.44S14.21 4.81 16 4.81s3.32 1.54 7.34 3.71C26.76 10.36 29 13.46 29 17Z"/><path fill="none" stroke="#000" d="M16 27.65c7.32 0 13.46-4.65 13.46-10.65c0-3.72-2.37-7-5.89-8.85c-1.39-.75-2.46-1.41-3.37-2l-1.13-.69A6.14 6.14 0 0 0 16 4.35a6.88 6.88 0 0 0-3.3 1.23c-.42.24-.86.51-1.32.8c-.87.54-1.83 1.13-3 1.73C4.91 10 2.54 13.24 2.54 17c0 6 6.14 10.65 13.46 10.65Z"/><ellipse cx="21.65" cy="18.62" fill="#febbd0" rx="2.17" ry="1.28"/><ellipse cx="10.41" cy="18.62" fill="#febbd0" rx="2.17" ry="1.28"/><path fill-rule="evenodd" d="M11.43 18.11a2 2 0 1 0-2-2.05a2.05 2.05 0 0 0 2 2.05Zm9.2 0a2 2 0 1 0-2-2.05a2 2 0 0 0 2 2.05Z"/><path fill="#fff" fill-rule="evenodd" d="M10.79 16.19a.77.77 0 1 0-.76-.77a.76.76 0 0 0 .76.77Zm9.2 0a.77.77 0 1 0 0-1.53a.77.77 0 0 0 0 1.53Z"/><path fill="#b71422" stroke="#000" stroke-width=".75" d="M18.62 19.67a3.3 3.3 0 0 1-1.09 1.75a2.48 2.48 0 0 1-1.5.69a2.53 2.53 0 0 1-1.5-.69a3.28 3.28 0 0 1-1.08-1.75a.26.26 0 0 1 .29-.3h4.58a.27.27 0 0 1 .3.3Z"/><path fill="#ccbea7" fill-rule="evenodd" d="M14.93 5.75a6.09 6.09 0 0 1-2.09 4.62c-.1.09 0 .27.11.22c1.25-.49 2.94-1.94 2.23-4.88c-.03-.15-.25-.11-.25.04Zm.85 0a6 6 0 0 1 .57 5c0 .13.12.24.21.13c.83-1 1.54-3.11-.59-5.31c-.1-.11-.27.04-.19.17Zm1-.06a6.09 6.09 0 0 1 2.53 4.38c0 .14.21.17.24 0c.34-1.3.15-3.51-2.66-4.66c-.12-.02-.21.18-.09.27ZM9.94 9.55a6.27 6.27 0 0 0 3.89-3.33c.07-.13.28-.08.25.07c-.64 3-2.79 3.59-4.13 3.51c-.14-.01-.14-.21-.01-.25Z"/>`}})),fV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#99b8c4" d="m23.265 24.381l.9-.894c4.164.136 4.228-.01 4.411-.438l1.144-2.785l.085-.264l-.093-.231c-.049-.122-.2-.486-2.8-2.965V15.5c3-2.89 2.936-3.038 2.765-3.461l-1.139-2.814c-.171-.422-.236-.587-4.37-.474l-.9-.93a20.166 20.166 0 0 0-.141-4.106l-.116-.263l-2.974-1.3c-.438-.2-.592-.272-3.4 2.786l-1.262-.019c-2.891-3.086-3.028-3.03-3.461-2.855L9.149 3.182c-.433.175-.586.237-.418 4.437l-.893.89c-4.162-.136-4.226.012-4.407.438l-1.146 2.786l-.09.267l.094.232c.049.12.194.48 2.8 2.962v1.3c-3 2.89-2.935 3.038-2.763 3.462l1.138 2.817c.174.431.236.584 4.369.476l.9.935a20.243 20.243 0 0 0 .137 4.1l.116.265l2.993 1.308c.435.182.586.247 3.386-2.8l1.262.016c2.895 3.09 3.043 3.03 3.466 2.859l2.759-1.115c.436-.173.588-.234.413-4.436Zm-11.858-6.524a4.957 4.957 0 1 1 6.488 2.824a5.014 5.014 0 0 1-6.488-2.824Z"/>`}})),pV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#984c93" d="M14.742 24.047a10.242 10.242 0 0 1-4.673.919a7.628 7.628 0 0 1-5.914-2.346A8.876 8.876 0 0 1 2 16.369a9.476 9.476 0 0 1 2.422-6.748a8.216 8.216 0 0 1 6.285-2.588a11.151 11.151 0 0 1 4.035.641v3.761A6.839 6.839 0 0 0 11 10.395a4.813 4.813 0 0 0-3.712 1.535a5.9 5.9 0 0 0-1.413 4.159A5.8 5.8 0 0 0 7.209 20.1a4.57 4.57 0 0 0 3.59 1.493a7.319 7.319 0 0 0 3.943-1.113Zm2.37-9.218v-2.344h2.344v2.344H21.8v2.343h-2.344v2.343h-2.344v-2.343H14.77v-2.344l2.342.001zm8.201 0v-2.344h2.344v2.344H30v2.343h-2.343v2.343h-2.344v-2.343h-2.342v-2.344l2.342.001z"/>`}})),mV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#368832" d="M19.792 7.071h2.553v2.553H24.9V7.071h2.552v2.553H30v2.552h-2.55v2.551H30v2.553h-2.551v2.552H24.9v-2.55h-2.55v2.552h-2.557v-2.55H17.24v-2.559h2.553v-2.546H17.24V9.622h2.554Zm2.553 7.658H24.9v-2.553h-2.555Zm-7.656 9.284a10.2 10.2 0 0 1-4.653.915a7.6 7.6 0 0 1-5.89-2.336A8.839 8.839 0 0 1 2 16.367a9.436 9.436 0 0 1 2.412-6.719a8.181 8.181 0 0 1 6.259-2.577a11.1 11.1 0 0 1 4.018.638v3.745a6.81 6.81 0 0 0-3.723-1.036a4.793 4.793 0 0 0-3.7 1.529a5.879 5.879 0 0 0-1.407 4.142a5.774 5.774 0 0 0 1.328 3.992a4.551 4.551 0 0 0 3.575 1.487a7.288 7.288 0 0 0 3.927-1.108Z"/>`}})),hV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#1572b6" d="M5.902 27.201L3.656 2h24.688l-2.249 25.197L15.985 30L5.902 27.201z"/><path fill="#33a9dc" d="m16 27.858l8.17-2.265l1.922-21.532H16v23.797z"/><path fill="#fff" d="M16 13.191h4.09l.282-3.165H16V6.935h7.75l-.074.829l-.759 8.518H16v-3.091z"/><path fill="#ebebeb" d="m16.019 21.218l-.014.004l-3.442-.93l-.22-2.465H9.24l.433 4.853l6.331 1.758l.015-.004v-3.216z"/><path fill="#fff" d="m19.827 16.151l-.372 4.139l-3.447.93v3.216l6.336-1.756l.047-.522l.537-6.007h-3.101z"/><path fill="#ebebeb" d="M16.011 6.935v3.091H8.545l-.062-.695l-.141-1.567l-.074-.829h7.743zM16 13.191v3.091h-3.399l-.062-.695l-.14-1.567l-.074-.829H16z"/>`}})),gV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#3a4e55" d="M18.191 13.071H20.7v2.566h1.27a5.5 5.5 0 0 0 1.744-.292a4.462 4.462 0 0 0 .848-.383a3.149 3.149 0 0 1-.589-1.623a3.427 3.427 0 0 1 .616-2.416l.264-.305l.314.253a4 4 0 0 1 1.575 2.538a3.837 3.837 0 0 1 2.913.271l.345.2l-.181.354a3.629 3.629 0 0 1-3.648 1.74c-2.173 5.413-6.9 7.976-12.642 7.976A7.958 7.958 0 0 1 6.3 20.211l-.025-.043l-.226-.459a7.28 7.28 0 0 1-.579-3.693l.035-.38h2.143v-2.565h2.51v-2.51h5.02v-2.51h3.012v5.02Z"/><path fill="#00aada" d="M26.324 14.021a3.311 3.311 0 0 0-1.418-2.821a3.072 3.072 0 0 0 .289 3.821a5.279 5.279 0 0 1-3.225 1.037H5.883a6.779 6.779 0 0 0 .667 3.737l.183.335a6.2 6.2 0 0 0 .379.569q.992.064 1.829.045a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.4 8.4 0 0 1-1.845.3c.044 0-.046.007-.046.007l-.082.007a21.455 21.455 0 0 1-2.008-.006l-.01.007a7.882 7.882 0 0 0 6.063 2.41c5.56 0 10.276-2.465 12.365-8c1.482.152 2.906-.226 3.553-1.49a3.5 3.5 0 0 0-3.122-.022"/><path fill="#27b9ec" d="M26.324 14.021a3.311 3.311 0 0 0-1.418-2.821a3.072 3.072 0 0 0 .289 3.821a5.279 5.279 0 0 1-3.225 1.037H6.836a5.223 5.223 0 0 0 2.106 4.686a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.83 8.83 0 0 1-1.894.314l-.019-.022c1.892.971 4.636.967 7.782-.241a21.868 21.868 0 0 0 9.1-6.889l-.1.048"/><path fill="#088cb9" d="M5.913 17.732a6.431 6.431 0 0 0 .637 2.061l.183.335a6.2 6.2 0 0 0 .379.569q.992.064 1.829.045a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.826 8.826 0 0 1-1.891.307h-.1c-.291.016-.6.026-.922.026c-.351 0-.709-.007-1.1-.026a7.913 7.913 0 0 0 6.076 2.413c4.76 0 8.9-1.807 11.3-5.8Z"/><path fill="#039cc7" d="M6.98 17.732a4.832 4.832 0 0 0 1.961 3.01a8.972 8.972 0 0 0 2.669-.389a.193.193 0 1 1 .126.365c-.09.031-.184.061-.281.088a8.959 8.959 0 0 1-1.9.307c1.892.971 4.628.957 7.773-.252a20.545 20.545 0 0 0 5.377-3.13Z"/><path fill="#00acd3" d="M9.889 13.671h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813H9.23v-1.813Zm-.33 0h.179v1.813H8.9v-1.813Zm-.33 0h.179v1.813H8.57v-1.813Zm-.323 0h.172v1.813h-.17v-1.813Zm-.181-.181h2.175v2.176H8.066V13.49Zm4.335-2.329h.172v1.813H12.4v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.178v1.813h-.178v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.175v-2.177Z"/><path fill="#26c2ee" d="M12.4 13.671h.172v1.813H12.4v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.178v1.813h-.178v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.175V13.49Z"/><path fill="#00acd3" d="M14.909 13.671h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.181v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.174V13.49Z"/><path fill="#26c2ee" d="M14.909 11.161h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.179v1.813h-.178v-1.813Zm-.33 0h.181v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.174v-2.177Zm4.335 2.691h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813H16.1v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.177-.181h2.176v2.176H15.6V13.49Z"/><path fill="#00acd3" d="M17.42 11.161h.172v1.813h-.172v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813H16.1v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176H15.6v-2.177Z"/><path fill="#26c2ee" d="M17.42 8.65h.172v1.813h-.172V8.65Zm-.33 0h.179v1.813h-.179V8.65Zm-.33 0h.179v1.813h-.179V8.65Zm-.33 0h.179v1.813h-.179V8.65Zm-.33 0h.179v1.813H16.1V8.65Zm-.323 0h.172v1.813h-.172V8.65Zm-.177-.181h2.176v2.176H15.6V8.469Z"/><path fill="#00acd3" d="M19.93 13.671h.17v1.813h-.17v-1.813Zm-.33 0h.178v1.813H19.6v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.33 0h.179v1.813h-.179v-1.813Zm-.323 0h.172v1.813h-.172v-1.813Zm-.181-.181h2.176v2.176h-2.175V13.49Z"/><path fill="#d5eef2" d="M12.616 19.193a.6.6 0 1 1-.6.6a.6.6 0 0 1 .6-.6"/><path fill="#3a4e55" d="M12.616 19.363a.431.431 0 0 1 .156.029a.175.175 0 1 0 .241.236a.43.43 0 1 1-.4-.265M2 17.949h27.92c-.608-.154-1.923-.362-1.707-1.159c-1.105 1.279-3.771.9-4.444.267c-.749 1.087-5.111.674-5.415-.173c-.939 1.1-3.85 1.1-4.789 0c-.3.847-4.666 1.26-5.415.173c-.673.631-3.338 1.012-4.444-.267c.217.8-1.1 1.005-1.707 1.159"/><path fill="#c0dbe1" d="M14.211 23.518a5.287 5.287 0 0 1-2.756-2.711a9.2 9.2 0 0 1-1.987.3q-.436.024-.917.025q-.554 0-1.168-.033a7.942 7.942 0 0 0 6.145 2.43q.344 0 .683-.013"/><path fill="#d5eef2" d="M12.007 21.773a5.206 5.206 0 0 1-.552-.966a9.2 9.2 0 0 1-1.987.3a6.325 6.325 0 0 0 2.539.664"/>`}})),_V=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<g fill-rule="evenodd"><path d="M3.167 3.167h25.667v25.667H3.167z"/><path fill="#ecd53f" fill-rule="nonzero" d="M30 2v28H2V2zM14.757 20.539H9.98v6.44h4.898v-1.085h-3.597V24.14h3.232v-1.085H11.28v-1.428h3.475v-1.09zm2.503 0h-1.264v6.44h1.207v-4.2l2.597 4.2h1.305v-6.44h-1.21v4.3l-2.635-4.301zm5.97 0h-1.41l2.303 6.44h1.388l2.306-6.44h-1.38l-1.577 4.766l-1.63-4.767zM8.3 24.96H6.34v1.96H8.3z"/></g>`}})),vV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#4b32c3" d="m29.832 16.7l-6.354 10.717A1.256 1.256 0 0 1 22.36 28H9.647a1.262 1.262 0 0 1-1.118-.59l-6.356-10.7a1.256 1.256 0 0 1 0-1.272L8.527 4.676A1.344 1.344 0 0 1 9.647 4h12.709a1.344 1.344 0 0 1 1.118.678l6.354 10.786a1.2 1.2 0 0 1 0 1.238Zm-5.262 4.2v-9.614L16 6.466l-8.56 4.82V20.9L16 25.719Z"/><path fill="#8080f2" d="m21.802 19.188l-5.747 3.235l-5.742-3.235v-6.47l5.742-3.236l5.747 3.236v6.47z"/>`}})),yV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeExcel0" x1="4.494" x2="13.832" y1="-2092.086" y2="-2075.914" gradientTransform="translate(0 2100)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#18884f"/><stop offset=".5" stop-color="#117e43"/><stop offset="1" stop-color="#0b6631"/></linearGradient></defs><path fill="#185c37" d="M19.581 15.35L8.512 13.4v14.409A1.192 1.192 0 0 0 9.705 29h19.1A1.192 1.192 0 0 0 30 27.809V22.5Z"/><path fill="#21a366" d="M19.581 3H9.705a1.192 1.192 0 0 0-1.193 1.191V9.5L19.581 16l5.861 1.95L30 16V9.5Z"/><path fill="#107c41" d="M8.512 9.5h11.069V16H8.512Z"/><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2Z" opacity=".1"/><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path fill="url(#vscodeIconsFileTypeExcel0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"/><path fill="#fff" d="m5.7 19.873l2.511-3.884l-2.3-3.862h1.847L9.013 14.6c.116.234.2.408.238.524h.017c.082-.188.169-.369.26-.546l1.342-2.447h1.7l-2.359 3.84l2.419 3.905h-1.809l-1.45-2.711A2.355 2.355 0 0 1 9.2 16.8h-.024a1.688 1.688 0 0 1-.168.351l-1.493 2.722Z"/><path fill="#33c481" d="M28.806 3h-9.225v6.5H30V4.191A1.192 1.192 0 0 0 28.806 3Z"/><path fill="#107c41" d="M19.581 16H30v6.5H19.581Z"/>`}})),bV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#cfcfcf" d="m12.677 17.781l-2.626-6.256l-2.694 6.256Zm6.723 6.511h-7.069v-1.365l.458-.023a1.847 1.847 0 0 0 .972-.2a.313.313 0 0 0 .145-.263a4.158 4.158 0 0 0-.419-1.4l-.812-1.931H7.322L6.4 21.259a3.319 3.319 0 0 0-.349 1.157c0 .036 0 .119.154.241a2.481 2.481 0 0 0 1.191.247l.448.033v1.354H2v-1.31l.4-.07a2.188 2.188 0 0 0 1-.318a6.318 6.318 0 0 0 1.18-2.066l5.575-13.036H11.2l5.512 13.174a5.255 5.255 0 0 0 1.049 1.835a1.959 1.959 0 0 0 1.19.4l.454.027Zm6.441-2.732v-3.985a22.542 22.542 0 0 0-2.226.97a3.845 3.845 0 0 0-1.29 1.05a2.03 2.03 0 0 0-.388 1.2a1.951 1.951 0 0 0 .491 1.362a1.49 1.49 0 0 0 1.13.544a4.142 4.142 0 0 0 2.283-1.141Zm-3.333 2.949a2.833 2.833 0 0 1-2.139-.893a3.206 3.206 0 0 1-.833-2.285a2.959 2.959 0 0 1 .415-1.577a5 5 0 0 1 1.791-1.625a23.876 23.876 0 0 1 3.617-1.588v-.074a2.905 2.905 0 0 0-.383-1.833a1.325 1.325 0 0 0-1.075-.412a1.155 1.155 0 0 0-.816.26a.687.687 0 0 0-.277.536l.023.646a1.62 1.62 0 0 1-.4 1.158a1.481 1.481 0 0 1-2.1-.019a1.634 1.634 0 0 1-.391-1.134a2.8 2.8 0 0 1 1.182-2.177a4.813 4.813 0 0 1 3.125-.932a5.381 5.381 0 0 1 2.508.524a2.628 2.628 0 0 1 1.213 1.346a6.391 6.391 0 0 1 .244 2.2v3.55a14.665 14.665 0 0 0 .051 1.749a.661.661 0 0 0 .054.2c.085-.078.284-.225.864-.806l.819-.828v1.967l-.1.128c-.958 1.283-1.883 1.907-2.83 1.907a1.6 1.6 0 0 1-1.257-.557a1.788 1.788 0 0 1-.358-.74a9.688 9.688 0 0 1-1.433.977a3.579 3.579 0 0 1-1.514.332Z"/>`}})),xV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#dd4c35" d="M29.472 14.753L17.247 2.528a1.8 1.8 0 0 0-2.55 0l-2.539 2.539l3.22 3.22a2.141 2.141 0 0 1 2.712 2.73l3.1 3.1a2.143 2.143 0 1 1-1.285 1.21l-2.895-2.895v7.617a2.141 2.141 0 1 1-1.764-.062V12.3a2.146 2.146 0 0 1-1.165-2.814l-3.17-3.172L2.528 14.7a1.8 1.8 0 0 0 0 2.551l12.225 12.221a1.8 1.8 0 0 0 2.55 0L29.472 17.3a1.8 1.8 0 0 0 0-2.551"/><path fill="#fff" d="m12.158 5.067l3.22 3.22a2.141 2.141 0 0 1 2.712 2.73l3.1 3.1a2.143 2.143 0 1 1-1.285 1.21l-2.895-2.895v7.617a2.141 2.141 0 1 1-1.764-.062V12.3a2.146 2.146 0 0 1-1.165-2.814l-3.17-3.172"/>`}})),SV=n((e=>{e.__esModule=!0,e.default={width:254.5,height:225,body:`<path fill="#00acd7" d="M-46.926 89c-.621 0-.777-.311-.466-.777l3.262-4.194a2.225 2.225 0 0 1 1.708-.777h55.448c.621 0 .777.466.466.932l-2.64 4.038a2.367 2.367 0 0 1-1.553.932Zm-23.453 14.285c-.621 0-.777-.311-.466-.777l3.262-4.194a2.225 2.225 0 0 1 1.708-.777H4.95a.714.714 0 0 1 .777.932L4.484 102.2a1.358 1.358 0 0 1-1.4.932Zm37.587 14.289c-.621 0-.777-.466-.466-.932l2.174-3.883a2.06 2.06 0 0 1 1.553-.932H1.533c.621 0 .932.466.932 1.087l-.311 3.728a1.167 1.167 0 0 1-1.087 1.087ZM128.426 86.2c-9.785 2.485-16.464 4.349-26.093 6.834c-2.33.621-2.485.777-4.5-1.553c-2.33-2.64-4.038-4.349-7.3-5.9c-9.785-4.815-19.259-3.417-28.112 2.33c-10.561 6.834-16 16.929-15.842 29.51c.155 12.425 8.7 22.676 20.968 24.385c10.561 1.4 19.414-2.33 26.4-10.251c1.4-1.708 2.64-3.572 4.194-5.747H68.163c-3.262 0-4.038-2.019-2.951-4.659c2.019-4.815 5.747-12.891 7.921-16.929a4.194 4.194 0 0 1 3.883-2.485h56.535c-.311 4.194-.311 8.387-.932 12.581a66.239 66.239 0 0 1-12.736 30.442c-11.183 14.752-25.783 23.915-44.265 26.4c-15.221 2.019-29.355-.932-41.78-10.251a48.785 48.785 0 0 1-19.725-34.48c-2.019-16.929 2.951-32.15 13.2-45.508C38.342 66.475 52.942 57.312 70.8 54.05c14.6-2.64 28.578-.932 41.159 7.61a48.686 48.686 0 0 1 18.017 21.9c.935 1.398.313 2.175-1.55 2.64Z"/><path fill="#00acd7" d="M179.835 172.09c-14.134-.311-27.025-4.349-37.9-13.668a48.711 48.711 0 0 1-16.774-29.976c-2.8-17.551 2.019-33.082 12.581-46.905c11.338-14.91 25.006-22.676 43.488-25.938c15.842-2.8 30.753-1.243 44.265 7.921c12.27 8.387 19.88 19.725 21.9 34.635c2.64 20.968-3.417 38.052-17.861 52.652a71.17 71.17 0 0 1-37.276 19.88c-4.191.778-8.384.933-12.423 1.399Zm36.965-62.747a44.7 44.7 0 0 0-.466-5.125c-2.8-15.376-16.929-24.074-31.684-20.657c-14.444 3.262-23.763 12.425-27.18 27.025a25.579 25.579 0 0 0 14.289 29.355c8.542 3.728 17.085 3.262 25.317-.932c12.269-6.369 18.948-16.309 19.724-29.666Z"/>`}})),CV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#e10098" d="M4.781 22.746L16.232 2.914l1.028.593L5.81 23.34z"/><path fill="#e10098" d="M4.545 21.162h22.902v1.187H4.545z"/><path fill="#e10098" d="m4.999 21.828l.593-1.028l11.455 6.614l-.594 1.028zM14.95 4.59l.594-1.027l11.455 6.614l-.594 1.028z"/><path fill="#e10098" d="M5.002 10.174L16.456 3.56l.594 1.028l-11.455 6.614z"/><path fill="#e10098" d="m14.743 3.508l1.028-.594l11.45 19.833l-1.027.593zM5.454 9.386h1.187v13.228H5.454z"/><path fill="#e10098" d="M25.36 9.386h1.187v13.228H25.36z"/><path fill="#e10098" d="m15.734 27.042l9.962-5.752l.519.898l-9.963 5.752z"/><path fill="#e10098" d="M28.12 23a2.5 2.5 0 1 1-.915-3.411A2.5 2.5 0 0 1 28.12 23M8.2 11.5a2.5 2.5 0 1 1-.915-3.411A2.5 2.5 0 0 1 8.2 11.5M3.88 23a2.5 2.5 0 1 1 3.411.915A2.5 2.5 0 0 1 3.88 23M23.8 11.5a2.5 2.5 0 1 1 3.411.915A2.5 2.5 0 0 1 23.8 11.5M16 30a2.5 2.5 0 1 1 2.5-2.5A2.493 2.493 0 0 1 16 30m0-23.009a2.5 2.5 0 1 1 2.5-2.5a2.493 2.493 0 0 1-2.5 2.5"/>`}})),wV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#e44f26" d="M5.902 27.201L3.655 2h24.69l-2.25 25.197L15.985 30L5.902 27.201z"/><path fill="#f1662a" d="m16 27.858l8.17-2.265l1.922-21.532H16v23.797z"/><path fill="#ebebeb" d="M16 13.407h-4.09l-.282-3.165H16V7.151H8.25l.074.83l.759 8.517H16v-3.091zm0 8.027l-.014.004l-3.442-.929l-.22-2.465H9.221l.433 4.852l6.332 1.758l.014-.004v-3.216z"/><path fill="#fff" d="M15.989 13.407v3.091h3.806l-.358 4.009l-3.448.93v3.216l6.337-1.757l.046-.522l.726-8.137l.076-.83h-7.185zm0-6.256v3.091h7.466l.062-.694l.141-1.567l.074-.83h-7.743z"/>`}})),TV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#2dcc9f" d="M30 5.851v20.298H2V5.851h28"/><path fill="#fff" d="M24.232 8.541a2.2 2.2 0 1 0 1.127.623a2.212 2.212 0 0 0-1.127-.623M18.111 20.1q-2.724-3.788-5.45-7.575L4.579 23.766h10.9q1.316-1.832 2.634-3.663M22.057 16q-2.793 3.882-5.584 7.765h11.169Q24.851 19.882 22.057 16Z"/>`}})),EV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#5382a1" d="M12.325 23.654s-1.07.622.761.833a16.023 16.023 0 0 0 5.8-.246a10.088 10.088 0 0 0 1.541.752c-5.481 2.349-12.405-.136-8.1-1.339m-.671-3.066s-1.2.888.633 1.078a22.618 22.618 0 0 0 7.481-.359a3.32 3.32 0 0 0 1.152.7c-6.627 1.938-14.009.153-9.266-1.421m5.644-5.198a2.051 2.051 0 0 1-.355 2.954s3.429-1.77 1.854-3.987c-1.471-2.067-2.6-3.095 3.508-6.636c0 0-9.586 2.394-5.007 7.669"/><path fill="#5382a1" d="M24.552 25.921s.792.652-.872 1.157c-3.164.958-13.168 1.248-15.948.038c-1-.435.874-1.038 1.464-1.164a3.8 3.8 0 0 1 .966-.108c-1.111-.783-7.181 1.537-3.083 2.2c11.176 1.812 20.372-.816 17.473-2.124M12.84 17.412s-5.089 1.209-1.8 1.648a38.225 38.225 0 0 0 6.731-.072a53.11 53.11 0 0 0 4.221-.555a8.934 8.934 0 0 0-1.28.685c-5.168 1.359-15.151.727-12.277-.663a9.629 9.629 0 0 1 4.407-1.042m9.127 5.102c5.253-2.73 2.824-5.353 1.129-5a3.932 3.932 0 0 0-.6.161a.957.957 0 0 1 .449-.346c3.354-1.179 5.933 3.478-1.083 5.322a.458.458 0 0 0 .106-.138M18.8 2s2.909 2.91-2.759 7.386c-4.546 3.59-1.037 5.637 0 7.975c-2.653-2.394-4.6-4.5-3.294-6.463C14.664 8.019 19.976 6.623 18.8 2"/><path fill="#5382a1" d="M13.356 29.912c5.042.323 12.786-.179 12.969-2.565c0 0-.353.9-4.167 1.623a41.458 41.458 0 0 1-12.76.2s.645.533 3.959.746"/>`}})),DV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f5de19" d="M18.774 19.7a3.727 3.727 0 0 0 3.376 2.078c1.418 0 2.324-.709 2.324-1.688c0-1.173-.931-1.589-2.491-2.272l-.856-.367c-2.469-1.052-4.11-2.37-4.11-5.156c0-2.567 1.956-4.52 5.012-4.52A5.058 5.058 0 0 1 26.9 10.52l-2.665 1.711a2.327 2.327 0 0 0-2.2-1.467a1.489 1.489 0 0 0-1.638 1.467c0 1.027.636 1.442 2.1 2.078l.856.366c2.908 1.247 4.549 2.518 4.549 5.376c0 3.081-2.42 4.769-5.671 4.769a6.575 6.575 0 0 1-6.236-3.5ZM6.686 20c.538.954 1.027 1.76 2.2 1.76c1.124 0 1.834-.44 1.834-2.15V7.975h3.422v11.683c0 3.543-2.078 5.156-5.11 5.156A5.312 5.312 0 0 1 3.9 21.688Z"/>`}})),OV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f5de19" d="M4.014 14.976a2.51 2.51 0 0 0 1.567-.518a2.377 2.377 0 0 0 .805-1.358a15.261 15.261 0 0 0 .214-2.944q.012-2.085.075-2.747a5.236 5.236 0 0 1 .418-1.686a3.025 3.025 0 0 1 .755-1.018A3.046 3.046 0 0 1 9 4.125A6.762 6.762 0 0 1 10.544 4h.7v1.96h-.387a2.338 2.338 0 0 0-1.723.468a3.4 3.4 0 0 0-.425 2.092a36.054 36.054 0 0 1-.137 4.133a4.734 4.734 0 0 1-.768 2.06A4.567 4.567 0 0 1 6.1 16a3.809 3.809 0 0 1 1.992 1.754a8.861 8.861 0 0 1 .618 3.865q0 2.435.05 2.9a1.755 1.755 0 0 0 .504 1.181a2.639 2.639 0 0 0 1.592.337h.387V28h-.7a5.655 5.655 0 0 1-1.773-.2a2.97 2.97 0 0 1-1.324-.93a3.353 3.353 0 0 1-.681-1.63a24.175 24.175 0 0 1-.165-3.234a16.469 16.469 0 0 0-.214-3.106a2.408 2.408 0 0 0-.805-1.361a2.489 2.489 0 0 0-1.567-.524Zm23.972 2.035a2.489 2.489 0 0 0-1.567.524a2.408 2.408 0 0 0-.805 1.361a16.469 16.469 0 0 0-.212 3.109a24.175 24.175 0 0 1-.169 3.234a3.353 3.353 0 0 1-.681 1.63a2.97 2.97 0 0 1-1.324.93a5.655 5.655 0 0 1-1.773.2h-.7V26.04h.387a2.639 2.639 0 0 0 1.592-.337a1.755 1.755 0 0 0 .506-1.186q.05-.462.05-2.9a8.861 8.861 0 0 1 .618-3.865A3.809 3.809 0 0 1 25.9 16a4.567 4.567 0 0 1-1.7-1.286a4.734 4.734 0 0 1-.768-2.06a36.054 36.054 0 0 1-.137-4.133a3.4 3.4 0 0 0-.425-2.092a2.338 2.338 0 0 0-1.723-.468h-.387V4h.7a6.762 6.762 0 0 1 1.54.125a3.046 3.046 0 0 1 1.149.581a3.025 3.025 0 0 1 .755 1.018a5.236 5.236 0 0 1 .418 1.686q.062.662.075 2.747a15.261 15.261 0 0 0 .212 2.947a2.377 2.377 0 0 0 .805 1.355a2.51 2.51 0 0 0 1.567.518Z"/>`}})),kV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeKotlin0" x1="311.336" x2="283.342" y1="1452.064" y2="1480.058" gradientTransform="translate(-281.4 -1450)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#e44857"/><stop offset=".47" stop-color="#9d4b9d"/><stop offset="1" stop-color="#6d5faa"/></linearGradient></defs><path fill="url(#vscodeIconsFileTypeKotlin0)" d="M30 30H2V2h28L16 16Z"/>`}})),AV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeLicense0" x1="-264.845" x2="-255.586" y1="181.772" y2="182.061" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#bd6316"/><stop offset="1" stop-color="#4e1500"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense1" x1="-263.276" x2="-256.603" y1="170.205" y2="171.772" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense2" x1="-265.068" x2="-256.777" y1="175.732" y2="178.801" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense3" x1="-655.014" x2="-655.555" y1="147.549" y2="146.948" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffd436"/><stop offset="1" stop-color="#8b3f02"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense4" x1="-258.899" x2="-253.843" y1="170.981" y2="171.325" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff8b7"/><stop offset="1" stop-color="#fcbf0e"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense5" x1="-258.884" x2="-253.896" y1="170.975" y2="171.314" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense6" x1="-257.805" x2="-257.726" y1="172.266" y2="168.648" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense7" x1="-258.935" x2="-256.173" y1="181.92" y2="182.108" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicense8" x1="-274.156" x2="-274.512" y1="170.544" y2="173.778" gradientTransform="matrix(-1 0 0 1 -257.657 -155.509)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense9" x1="-645.79" x2="-645.121" y1="-337.938" y2="-334.17" gradientTransform="scale(-1 1) rotate(-52.06 29.075 -802.903)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffef94"/><stop offset="1" stop-color="#ffd200"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicensea" x1="-276.128" x2="-274.754" y1="178.682" y2="178.682" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenseb" x1="-274.314" x2="-271.841" y1="178.887" y2="178.987" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensec" x1="-273.817" x2="-274.213" y1="189.281" y2="174.569" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#d89530"/><stop offset="1" stop-color="#772d00"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicensed" x1="-274.075" x2="-273.917" y1="174.09" y2="181.459" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensee" x1="-272.919" x2="-273.315" y1="189.281" y2="174.57" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensef" x1="-273.177" x2="-273.019" y1="174.071" y2="181.44" gradientTransform="scale(-1 1) rotate(26.18 189.155 648.159)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenseg" x1="-652.29" x2="-651.867" y1="-335.227" y2="-332.867" gradientTransform="scale(-1 1) rotate(-52.06 29.075 -802.903)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffdb57"/><stop offset="1" stop-color="#b55c13"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicenseh" x1="-665.076" x2="-659.751" y1="157.413" y2="150.922" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensei" x1="-665.161" x2="-664.822" y1="156.114" y2="155.701" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensej" x1="-665.308" x2="-665.836" y1="156.436" y2="155.32" gradientTransform="scale(-1 1) rotate(-18.83 -723.282 -1847.955)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensek" x1="-655.442" x2="-654.817" y1="147.568" y2="146.776" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensel" x1="-253.999" x2="-254.134" y1="175.1" y2="173.736" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensem" x1="-252.571" x2="-252.785" y1="173.138" y2="170.963" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensen" x1="-257.206" x2="-259.174" y1="169.107" y2="169.787" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicenseo" x1="-260.717" x2="-260.77" y1="170.284" y2="171.228" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicensep" x1="-257.835" x2="-257.782" y1="174.993" y2="171.93" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenseq" x1="-263.928" x2="-255.721" y1="171.018" y2="171.018" gradientTransform="scale(-1 1) rotate(26.18 205.537 615.155)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicenser" x1="-514.299" x2="-505.041" y1="-57.926" y2="-57.638" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicenses" x1="-512.744" x2="-505.964" y1="-69.496" y2="-67.904" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicenset" x1="-514.521" x2="-506.23" y1="-63.966" y2="-60.897" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicenseu" x1="-662.221" x2="-662.762" y1="-197.167" y2="-197.768" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensev" x1="-508.354" x2="-503.297" y1="-68.717" y2="-68.373" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicensew" x1="-508.338" x2="-503.351" y1="-68.723" y2="-68.384" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicensex" x1="-507.26" x2="-507.18" y1="-67.432" y2="-71.05" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicensey" x1="-508.389" x2="-505.627" y1="-57.779" y2="-57.591" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicensez" x1="-523.609" x2="-523.966" y1="-69.153" y2="-65.918" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense10" x1="-645.333" x2="-642.973" y1="-334.169" y2="-332.091" href="#vscodeIconsFileTypeLicense9"/><linearGradient id="vscodeIconsFileTypeLicense11" x1="-525.581" x2="-524.207" y1="-61.015" y2="-61.015" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense12" x1="-523.768" x2="-521.294" y1="-60.81" y2="-60.71" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense13" x1="-523.27" x2="-523.666" y1="-50.416" y2="-65.127" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense14" x1="-523.528" x2="-523.37" y1="-65.606" y2="-58.238" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense15" x1="-522.372" x2="-522.768" y1="-50.416" y2="-65.127" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense16" x1="-522.631" x2="-522.472" y1="-65.626" y2="-58.257" gradientTransform="matrix(-.947 -.323 -.148 .966 -492.49 -86.99)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense17" x1="-649.116" x2="-646.827" y1="-328.591" y2="-326.795" href="#vscodeIconsFileTypeLicense9"/><linearGradient id="vscodeIconsFileTypeLicense18" x1="-672.284" x2="-666.958" y1="-187.303" y2="-193.795" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense19" x1="-672.369" x2="-672.03" y1="-188.603" y2="-189.016" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1a" x1="-672.516" x2="-673.044" y1="-188.281" y2="-189.397" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1b" x1="-662.648" x2="-662.023" y1="-197.148" y2="-197.94" gradientTransform="matrix(-.564 -.911 -.774 .455 -516.113 -497.612)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1c" x1="-503.367" x2="-503.501" y1="-64.607" y2="-65.971" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1d" x1="-502.006" x2="-502.232" y1="-66.361" y2="-68.654" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1e" x1="-506.661" x2="-508.629" y1="-70.591" y2="-69.911" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1f" x1="-510.172" x2="-510.224" y1="-69.414" y2="-68.47" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicensec"/><linearGradient id="vscodeIconsFileTypeLicense1g" x1="-507.289" x2="-507.236" y1="-64.705" y2="-67.768" gradientTransform="matrix(-.947 -.323 -.148 .966 -476.554 -85.464)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1h" x1="-642.337" x2="-640.048" y1="-337.231" y2="-335.435" gradientTransform="scale(-1 1) rotate(-52.06 29.075 -802.903)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffdb57"/><stop offset="1" stop-color="#b66512"/></linearGradient><linearGradient id="vscodeIconsFileTypeLicense1i" x1="-628.479" x2="-627.663" y1="-215.005" y2="-209.203" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense0"/><linearGradient id="vscodeIconsFileTypeLicense1j" x1="-633.006" x2="-622.552" y1="-211.18" y2="-211.18" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicense1k" x1="-627.491" x2="-627.755" y1="-215.556" y2="-211.648" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1l" x1="-627.796" x2="-627.057" y1="-210.705" y2="-205.186" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense3"/><linearGradient id="vscodeIconsFileTypeLicense1m" x1="245.815" x2="245.923" y1="139.434" y2="136.367" gradientTransform="rotate(7.312 1187.515 -1764.249)" href="#vscodeIconsFileTypeLicense4"/><linearGradient id="vscodeIconsFileTypeLicense1n" x1="-626.269" x2="-627.643" y1="-215.112" y2="-213.078" gradientTransform="scale(-1 1) rotate(-37.85 -2.119 -997.83)" href="#vscodeIconsFileTypeLicense3"/></defs><path fill="url(#vscodeIconsFileTypeLicense0)" d="m13.372 16.416l5.013-2.464l.93 1.893l-.054.238l-2.048 1.007l5.706 11.611l-.221.359l-1.543.758l-.82-.45l-5.459-11.109l-.482.237l-1.022-2.08z"/><path fill="url(#vscodeIconsFileTypeLicense1)" d="m9.24 13.619l1.2 2.44c.072.146.416.252.617.292l2.634.683l4.609-2.268l.867-2.342a.679.679 0 0 0 .036-.674l-1.2-2.44a.546.546 0 0 0-.452-.3l-4.44.136a1.278 1.278 0 0 0-1.018.541l-2.72 3.162a.916.916 0 0 0-.133.77Zm1.932.033a.356.356 0 0 1 .011-.334l1.84-2.215a.829.829 0 0 1 .66-.351l2.877-.088a.355.355 0 0 1 .293.2l.356.725a.242.242 0 0 1-.139.339L11.833 14.5a.224.224 0 0 1-.3-.121Z"/><path fill="url(#vscodeIconsFileTypeLicense2)" d="m9.426 13.209l1.2 2.44c.072.146.416.252.617.292l2.7.547l.782 1.591l.375-.179l5.459 11.109l.82.451l1.541-.76l-.017-.683l.868-1.458l-.241-.49l-.54.1l-.31-.63l.41-.366l-.59-1.199l-.593-.006l-.277-.564l.357-.473l-.3-.607l-.568.043l-.432-.879l.382-.423l-.161-.327a.871.871 0 0 1-.659-1.342l-.345-.7a1.347 1.347 0 0 1-.962-1.956l-.29-.591l.631-.31l-.773-1.546l.843-2.277a.68.68 0 0 0 .035-.674l-1.2-2.44a.546.546 0 0 0-.453-.3l-4.435.131a1.278 1.278 0 0 0-1.018.541l-2.84 3.419a.548.548 0 0 0-.016.516Zm1.932.033a.356.356 0 0 1 .011-.334l1.84-2.215a.828.828 0 0 1 .66-.351l2.877-.088a.354.354 0 0 1 .293.2l.356.725a.242.242 0 0 1-.139.339l-5.238 2.574a.224.224 0 0 1-.3-.121Z"/><path fill="url(#vscodeIconsFileTypeLicense3)" d="m14.47 18.381l.276-.318l.335-.164l-.139.245l-.472.237z"/><path fill="url(#vscodeIconsFileTypeLicense4)" d="m11.259 15.828l2.776.6l4.38-2.152l.865-2.339a.576.576 0 0 0 .024-.567L18.1 8.917a.441.441 0 0 0-.367-.246l-4.438.13a1.169 1.169 0 0 0-.938.5L9.52 12.725a.447.447 0 0 0-.011.414l1.206 2.453a1 1 0 0 0 .544.236Zm.354-1.836l-.358-.729a.463.463 0 0 1 .013-.434v-.008l1.853-2.221a.922.922 0 0 1 .739-.389l2.881-.084a.468.468 0 0 1 .392.257l.358.729c.005.009.19.3-.187.481l-5.244 2.577c-.272.129-.44-.164-.447-.179Z"/><path fill="url(#vscodeIconsFileTypeLicense5)" d="M11.246 15.738c.006 0 2.438.51 2.751.591l4.354-2.139l.878-2.336a.472.472 0 0 0 .015-.458l-1.208-2.458a.337.337 0 0 0-.282-.187l-4.454.141a1.083 1.083 0 0 0-.864.46l-2.863 3.436a.341.341 0 0 0-.008.313l1.206 2.454a1.118 1.118 0 0 0 .475.183Zm.245-1.7l-.355-.723a.568.568 0 0 1 .018-.535v-.008l.01-.015l1.865-2.241a1.033 1.033 0 0 1 .824-.43l2.9-.091a.575.575 0 0 1 .492.316l.359.73a.456.456 0 0 1 .027.338a.484.484 0 0 1-.265.286l-5.287 2.6a.415.415 0 0 1-.331.025a.486.486 0 0 1-.258-.248Z"/><path fill="url(#vscodeIconsFileTypeLicense6)" d="M11.268 15.663c.009 0 2.53.528 2.722.577l4.3-2.113l.878-2.314a.419.419 0 0 0 .01-.4l-1.2-2.436a.282.282 0 0 0-.237-.156l-4.433.149a1.033 1.033 0 0 0-.82.437l-2.353 2.823l-.5.595a.285.285 0 0 0 0 .254l1.193 2.421a1.181 1.181 0 0 0 .44.163Zm.14-1.529l-.351-.715a.575.575 0 0 1-.011-.56l1.959-2.36a1.082 1.082 0 0 1 .86-.447l2.887-.1a.628.628 0 0 1 .538.341l.356.724a.539.539 0 0 1-.309.773l-5.267 2.588a.482.482 0 0 1-.662-.243Z"/><path fill="url(#vscodeIconsFileTypeLicense7)" d="m18.463 14.345l.7 1.433l-.653.321l.319.649a1.428 1.428 0 0 0 1 2.043l.3.619a.958.958 0 0 0 .706 1.436l.107.218l-.39.428l.5 1.011l.577-.047l.239.485l-.366.478l.336.683h.6l.523 1.065l-.419.371l.382.777l.549-.1l.181.368A96.344 96.344 0 0 1 22.8 28v.638l-1.342.659l-.729-.414l-5.488-11.176l-.467.23l-.7-1.433Z"/><path fill="url(#vscodeIconsFileTypeLicense8)" d="M14.289 15.413h4.622v1.4h-4.622z" transform="rotate(-26.171 16.6 16.113)"/><path fill="url(#vscodeIconsFileTypeLicense9)" d="m18.128 14.582l-.8.392l.617 1.256l.8-.392Zm-1.319.648l.617 1.256l.308-.152l-.617-1.256Z"/><path fill="url(#vscodeIconsFileTypeLicensea)" d="m18.4 16.123l.308.628a1.523 1.523 0 0 0 1.037 2.11l.263.535a1.052 1.052 0 0 0 .744 1.513l.054.111l-.381.423l.557 1.134l.567-.043l.177.36l-.357.472l.392.8l.591.006l.456.929l-.409.366l.45.917l.539-.1l.12.243L22.634 28l-1.027.5l-5.525-11.235Z"/><path fill="url(#vscodeIconsFileTypeLicenseb)" d="m17.141 16.745l5.528 11.248l.046.511l-1.247.613l-.613-.349l-5.483-11.154Z"/><path fill="url(#vscodeIconsFileTypeLicensec)" d="m22.287 28.694l.427-.21l-4.794-9.754l-1.028-1.554l.602 1.764l4.793 9.754z"/><path fill="url(#vscodeIconsFileTypeLicensed)" d="M16.892 17.176L22.5 28.589l-.213.105l-4.793-9.754l-.602-1.764z"/><path fill="url(#vscodeIconsFileTypeLicensee)" d="m21.481 29.09l.427-.209l-4.794-9.755l-1.028-1.554l.602 1.764l4.793 9.754z"/><path fill="url(#vscodeIconsFileTypeLicensef)" d="m16.086 17.572l5.608 11.413l-.213.105l-4.793-9.754l-.602-1.764z"/><path fill="url(#vscodeIconsFileTypeLicenseg)" d="m18.27 16.189l-.411.2l5.285 10.755l.279-.47l-.181-.369l-.386.072l-.45-.917l.294-.26l-.508-1.034h-.424l-.392-.8l.256-.338l-.237-.482l-.407.031l-.557-1.134l.273-.3l-.143-.291a1.038 1.038 0 0 1-.619-1.259l-.391-.8a1.505 1.505 0 0 1-.906-1.844Zm-.68.334l5.371 10.929l.108-.182l-5.319-10.825Z"/><path fill="url(#vscodeIconsFileTypeLicenseh)" d="m15.018 18.247l5.356 10.997l.196-.273l-5.391-11.032l-.161.308z"/><path fill="url(#vscodeIconsFileTypeLicensei)" d="m20.436 29.315l.211-.291l.705.361l-.203.294l-.713-.364z"/><path fill="url(#vscodeIconsFileTypeLicensej)" d="m21.446 29.41l-.179.26l1.382-.659l.131-.241l-1.334.64z"/><path fill="url(#vscodeIconsFileTypeLicensek)" d="m14.029 16.673l-.225.388l.601 1.293l.297-.354l-.673-1.327z"/><path fill="url(#vscodeIconsFileTypeLicensel)" d="m13.946 16.506l-.239.432l-2.944-.761l.124-.345l3.059.674z"/><path fill="url(#vscodeIconsFileTypeLicensem)" d="M9.359 13s-.145.444-.087.563l1.212 2.465l.2-.384Z"/><path fill="url(#vscodeIconsFileTypeLicensen)" d="m16.683 10.624l.1-.327l-2.963.095a.914.914 0 0 0-.51.251l-.007.165a1.871 1.871 0 0 1 .394-.1Z"/><path fill="url(#vscodeIconsFileTypeLicenseo)" d="M16.83 10.309a.329.329 0 0 1 .17.137l.382.762l-.164.279l-.341-.693c-.023-.047-.108-.145-.147-.149Z"/><path fill="url(#vscodeIconsFileTypeLicensep)" d="m11.237 13.786l.171.348a.482.482 0 0 0 .661.248l5.267-2.588a.539.539 0 0 0 .309-.773l-.153-.31l1.08-.531l.606 1.232a.419.419 0 0 1-.01.4l-.878 2.314l-4.3 2.113c-.191-.049-2.713-.575-2.722-.577a1.181 1.181 0 0 1-.439-.16l-.6-1.222Z"/><path fill="url(#vscodeIconsFileTypeLicenseq)" d="m13.377 8.968l.532 1.084l.539-.018l-.532-1.084Zm2.306-.077l-1.395.047l.533 1.084l1.4-.046Zm1.471 2.994l-1.142.561l1.106 2.25l1.142-.561Zm-1.447.711l-.441.217l1.106 2.251l.441-.217Z"/><path fill="url(#vscodeIconsFileTypeLicenser)" d="m10.65 14.159l5.287 1.803L15.623 18l-.173.134l-2.16-.737l-1.921 12.501l-.371.102l-1.627-.555l-.395-.913l1.838-11.961l-.508-.173l.344-2.239z"/><path fill="url(#vscodeIconsFileTypeLicenses)" d="m8.951 9.175l-.542 2.747a.567.567 0 0 0 .175.452l1.976 2.461l4.866 1.659l1.969-1.077a.535.535 0 0 0 .4-.463l.4-2.627a.659.659 0 0 0-.188-.544L14.453 8.7a1.313 1.313 0 0 0-1.1-.337l-3.874.345a.707.707 0 0 0-.528.467Zm1.5 1.407a.281.281 0 0 1 .192-.234l2.633-.256a.928.928 0 0 1 .724.315l2.3 2a.426.426 0 0 1 .121.352l-.1.651s-.027.237-.3.146L10.5 11.667a.269.269 0 0 1-.172-.305Z"/><path fill="url(#vscodeIconsFileTypeLicenset)" d="m9.322 9.01l-.4 2.627c-.024.157.188.481.324.653l1.817 2.33l-.263 1.714l.392.134l-1.843 11.959l.395.914l1.627.555l.363-.507l1.483-.436l.081-.528l-.479-.314l.1-.678l.523.028l.2-1.283l-.461-.428l.093-.608l.54-.087l.1-.653l-.469-.375l.145-.946l.532-.034l.054-.352a1.047 1.047 0 0 1-.29-.859a.688.688 0 0 1 .512-.585l.116-.756a1.6 1.6 0 0 1-.364-1.232a1.07 1.07 0 0 1 .688-.874l.1-.636l.666.227l.246-1.674l1.915-1.047a.535.535 0 0 0 .4-.463l.4-2.627a.657.657 0 0 0-.188-.544l-3.556-3.08a1.313 1.313 0 0 0-1.1-.336l-4.109.445a.434.434 0 0 0-.29.356Zm1.5 1.407a.281.281 0 0 1 .192-.234l2.663-.289a.852.852 0 0 1 .711.218l2.3 2a.427.427 0 0 1 .122.352l-.12.781s-.027.237-.3.146L10.871 11.5a.269.269 0 0 1-.171-.3Z"/><path fill="url(#vscodeIconsFileTypeLicenseu)" d="m10.428 16.37l.392-.033l.353.12l-.244.078l-.501-.165z"/><path fill="url(#vscodeIconsFileTypeLicensev)" d="m9.317 12.221l1.846 2.421l4.619 1.575l1.967-1.076a.454.454 0 0 0 .331-.393l.406-2.641a.53.53 0 0 0-.152-.441l-3.552-3.083a1.207 1.207 0 0 0-1.011-.31l-4.109.453a.354.354 0 0 0-.237.292l-.405 2.641a1.261 1.261 0 0 0 .297.562Zm1.289-1.077l.121-.785a.367.367 0 0 1 .25-.305h.008l2.675-.295a.953.953 0 0 1 .794.247l2.3 2a.563.563 0 0 1 .166.467l-.121.785c0 .01-.014.35-.411.215l-5.53-1.886a.423.423 0 0 1-.252-.443Z"/><path fill="url(#vscodeIconsFileTypeLicensew)" d="M9.356 12.146c0 .005 1.63 2.115 1.831 2.4l4.591 1.566l1.974-1.065a.372.372 0 0 0 .264-.321l.406-2.646a.405.405 0 0 0-.118-.338l-3.571-3.091a1.117 1.117 0 0 0-.931-.285l-4.133.444a.271.271 0 0 0-.179.221l-.406 2.642a1.421 1.421 0 0 0 .272.473Zm1.126-1.054l.12-.778a.451.451 0 0 1 .309-.375h.024l2.7-.29a1.07 1.07 0 0 1 .883.278l2.324 2.01a.694.694 0 0 1 .212.581l-.121.786a.38.38 0 0 1-.165.265a.417.417 0 0 1-.365.018l-5.576-1.9a.5.5 0 0 1-.273-.219a.55.55 0 0 1-.072-.377Z"/><path fill="url(#vscodeIconsFileTypeLicensex)" d="M9.415 12.108c.006.008 1.693 2.194 1.816 2.366l4.535 1.546l1.963-1.048a.33.33 0 0 0 .228-.282l.4-2.623a.339.339 0 0 0-.1-.283L14.7 8.719a1.066 1.066 0 0 0-.884-.271l-3.4.359l-.716.076a.226.226 0 0 0-.142.183s-.4 2.594-.4 2.611a1.506 1.506 0 0 0 .257.431Zm.952-1.007l.118-.77a.463.463 0 0 1 .3-.414l2.836-.308a1.12 1.12 0 0 1 .921.292l2.316 2a.758.758 0 0 1 .234.632s-.1.633-.12.779c-.034.219-.191.5-.668.339l-5.555-1.894a.584.584 0 0 1-.383-.657Z"/><path fill="url(#vscodeIconsFileTypeLicensey)" d="m15.781 16.3l-.237 1.543l-.689-.235l-.107.7a1.158 1.158 0 0 0-.7.917a1.723 1.723 0 0 0 .367 1.283l-.1.666a.765.765 0 0 0-.527.634a1.154 1.154 0 0 0 .29.912l-.036.235l-.542.031l-.167 1.088l.479.379l-.08.522l-.55.084l-.113.736l.471.432l-.176 1.146l-.532-.031l-.128.837l.488.317l-.061.4c-.09.027-1.455.411-1.455.411l-.352.462l-1.424-.483l-.343-.822l1.843-12.03l-.493-.168l.237-1.543Z"/><path fill="url(#vscodeIconsFileTypeLicensez)" d="m11.056 16.181l4.374 1.491l.208-1.352l-4.374-1.492l-.208 1.353z"/><path fill="url(#vscodeIconsFileTypeLicense10)" d="m15.388 16.234l-.842-.287l-.207 1.353l.841.287ZM14 15.76l-.208 1.353l.325.111l.208-1.353Z"/><path fill="url(#vscodeIconsFileTypeLicense11)" d="m14.756 17.55l-.1.676a1.251 1.251 0 0 0-.7.957A1.845 1.845 0 0 0 14.3 20.5l-.089.576a.844.844 0 0 0-.525.678a1.256 1.256 0 0 0 .275.95l-.018.119l-.531.034l-.188 1.221l.469.375l-.06.388l-.539.087l-.132.858l.46.427l-.154 1l-.522-.028l-.152.987l.478.314l-.04.262l-1.506.443l-1.083-.369l1.86-12.1Z"/><path fill="url(#vscodeIconsFileTypeLicense12)" d="m13.423 17.1l-1.86 12.1l-.246.4L10 29.16l-.289-.692l1.845-12.009Z"/><path fill="url(#vscodeIconsFileTypeLicense13)" d="m10.877 29.44l.45.154l1.614-10.501l.049-1.863l-.499 1.709l-1.614 10.501z"/><path fill="url(#vscodeIconsFileTypeLicense14)" d="m12.99 17.23l-1.888 12.287l-.225-.077l1.614-10.501l.499-1.709z"/><path fill="url(#vscodeIconsFileTypeLicense15)" d="m10.028 29.151l.449.153l1.614-10.501l.049-1.863l-.499 1.71l-1.613 10.501z"/><path fill="url(#vscodeIconsFileTypeLicense16)" d="m12.14 16.94l-1.887 12.287l-.225-.076l1.613-10.501l.499-1.71z"/><path fill="url(#vscodeIconsFileTypeLicense17)" d="m14.615 17.5l-.433-.148l-1.782 11.58l.478-.14l.061-.4l-.339-.222l.152-.987l.374.02l.171-1.113l-.33-.306l.132-.858l.387-.062l.08-.519l-.336-.268l.188-1.221l.381-.024l.048-.314a1.2 1.2 0 0 1-.154-.766a.85.85 0 0 1 .363-.59l.132-.856a1.79 1.79 0 0 1-.231-1.123a1.261 1.261 0 0 1 .536-.861Zm-.717-.244L12.09 29.024l.185-.054l1.791-11.655Z"/><path fill="url(#vscodeIconsFileTypeLicense18)" d="M10.932 16.665L9.075 28.47l.303-.058l1.85-11.855l-.296.108z"/><path fill="url(#vscodeIconsFileTypeLicense19)" d="m9.085 28.566l.325-.06l.354.766l-.321.068l-.358-.774z"/><path fill="url(#vscodeIconsFileTypeLicense1a)" d="m9.823 29.357l-.283.06l1.447.513l.235-.081l-1.399-.492z"/><path fill="url(#vscodeIconsFileTypeLicense1b)" d="m11.024 14.816l-.391.12l-.241 1.367l.429-.043l.203-1.444z"/><path fill="url(#vscodeIconsFileTypeLicense1c)" d="m11.05 14.636l-.425.141l-2.084-2.606l.483-.214l2.026 2.679z"/><path fill="url(#vscodeIconsFileTypeLicense1d)" d="M9.384 8.813s-.358.218-.378.346l-.546 2.773l.51-.253Z"/><path fill="url(#vscodeIconsFileTypeLicense1e)" d="m16.435 12.332l.256-.168l-2.375-2.052a.962.962 0 0 0-.538-.183l-.1.115a2.143 2.143 0 0 1 .362.211Z"/><path fill="url(#vscodeIconsFileTypeLicense1f)" d="M16.724 12.208a.393.393 0 0 1 .058.221c-.016.1-.112.774-.12.825l-.283.085l.115-.747a.4.4 0 0 0-.033-.213Z"/><path fill="url(#vscodeIconsFileTypeLicense1g)" d="m10.424 10.725l-.058.375a.584.584 0 0 0 .381.653l5.553 1.894c.478.163.634-.12.668-.339l.051-.334l1.139.388l-.2 1.327a.33.33 0 0 1-.228.282l-1.963 1.048l-4.535-1.546a358.09 358.09 0 0 0-1.816-2.366a1.506 1.506 0 0 1-.257-.43l.2-1.315Z"/><path fill="url(#vscodeIconsFileTypeLicense1h)" d="m14.756 8.764l-.179 1.166l.432.373l.179-1.167Zm1.851 1.595l-1.119-.965l-.179 1.167l1.119.965Zm-.5 3.223l-1.2-.411l-.372 2.423l1.2.411Zm-1.526-.52l-.461-.162l-.372 2.423l.465.159Z"/><path fill="url(#vscodeIconsFileTypeLicense1i)" d="M9.936 2.733c2.042-1.441 5.206-.715 7.065 1.8A6.169 6.169 0 0 1 18.27 9.1c-.219-.73-1.023-.427-1.664-.441a4.11 4.11 0 0 0-.763-3.207C14.6 3.778 12.41 3.1 11.07 4.094s-1.382 3.253-.143 4.929a3.68 3.68 0 0 0 3.69 1.742c.521.444 1 .871 1.507 1.329c-1.84 1.134-4.8.334-6.51-1.982c-1.86-2.512-1.93-5.789.322-7.379Z"/><path fill="url(#vscodeIconsFileTypeLicense1j)" d="M9.956 2.841c1.939-1.405 5.111-.606 6.892 1.8a6.587 6.587 0 0 1 1.38 4.159c-.293-.387-1.035-.264-1.466-.211a4.6 4.6 0 0 0-.823-3.272c-1.317-1.78-3.546-2.373-4.97-1.32s-1.442 3.27-.125 5.051a4.034 4.034 0 0 0 3.842 1.905c.4.35.79.715 1.185 1.073c-1.982 1.012-4.528.084-6.123-2.073c-1.782-2.408-1.897-5.587.208-7.112Z"/><path fill="url(#vscodeIconsFileTypeLicense1k)" d="M10.1 2.918c1.855-1.345 4.971-.5 6.675 1.8a6.635 6.635 0 0 1 1.361 3.89a1.872 1.872 0 0 0-1.148-.126a4.555 4.555 0 0 0-.946-3.23c-1.394-1.885-3.6-2.472-5.1-1.357s-1.511 3.279-.171 5.2a4.075 4.075 0 0 0 3.976 1.973c.323.285.639.58.957.871c-1.939.959-4.394-.1-5.893-2.131C8.1 7.511 8.1 4.363 10.1 2.918Z"/><path fill="url(#vscodeIconsFileTypeLicense1l)" d="M9.684 3.412C8.6 4.969 8.825 7.5 10.3 9.494c1.413 1.911 3.466 2.885 5.249 2.443c-1.694.674-4.074-.233-5.554-2.235c-1.54-2.081-1.66-4.783-.311-6.29Z"/><path fill="url(#vscodeIconsFileTypeLicense1m)" d="M9.9 3.511c-.171.291.366.627.547.144a4.29 4.29 0 0 1 2.442-1.222A3.558 3.558 0 0 0 9.9 3.511Zm.077.506a.244.244 0 1 0 .211.273a.243.243 0 0 0-.213-.273Z"/><path fill="url(#vscodeIconsFileTypeLicense1n)" d="M11.035 3.763c1.4-1.181 3.664-.647 5.163 1.132a4.723 4.723 0 0 1 1.2 3.542c-.136.014-.273.03-.411.048a4.555 4.555 0 0 0-.946-3.23c-1.394-1.885-3.6-2.472-5.1-1.357c-.071.053-.136.11-.2.167a2.672 2.672 0 0 1 .294-.302Z"/>`}})),jV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="gray" d="m16.5 30l-.011-.321c.4-.014.8-.045 1.19-.094l.039.319c-.406.048-.818.08-1.218.096Zm-1.222-.011c-.4-.021-.814-.061-1.216-.118l.045-.318c.393.055.793.094 1.188.115Zm3.642-.289l-.067-.314c.387-.083.776-.184 1.155-.3l.094.307c-.388.118-.786.222-1.182.307Zm-6.063-.053c-.4-.091-.791-.2-1.177-.326l.1-.306c.377.122.764.23 1.15.319Zm8.4-.665l-.121-.3c.364-.148.728-.314 1.08-.493h.006l.145.286c-.367.186-.741.356-1.114.507Zm-10.718-.088a13.693 13.693 0 0 1-1.1-.524l.15-.284c.35.186.713.358 1.078.512Zm12.893-1.021l-.17-.273c.337-.21.668-.437.984-.675l.193.257c-.328.243-.667.476-1.011.691Zm-15.053-.122c-.341-.22-.676-.459-1-.708l.2-.253c.312.243.64.476.972.691Zm17-1.346l-.215-.239c.294-.265.58-.546.851-.836l.235.219c-.278.297-.571.585-.872.851Zm-18.925-.153c-.3-.276-.585-.569-.856-.87l.239-.215c.265.294.547.58.836.85Zm20.587-1.632l-.253-.2c.244-.312.476-.639.692-.972l.27.175c-.221.343-.46.677-.709.997ZM4.82 24.439a14.237 14.237 0 0 1-.692-1.007l.272-.17c.21.337.438.668.676.984Zm23.547-1.867l-.284-.151c.186-.35.358-.713.513-1.078l.3.125a14.91 14.91 0 0 1-.528 1.104Zm-24.841-.2l-.006-.012a13.075 13.075 0 0 1-.5-1.1l.3-.121c.147.362.312.724.491 1.074l.006.012Zm25.794-2.047l-.306-.1c.122-.377.23-.764.319-1.15l.313.072c-.091.396-.2.792-.326 1.178Zm-26.712-.218c-.12-.388-.223-.786-.308-1.182l.314-.067c.083.387.184.776.3 1.155Zm27.262-2.161l-.318-.045c.056-.393.094-.793.115-1.188l.321.017a13.78 13.78 0 0 1-.118 1.216ZM2.1 17.72c-.05-.4-.082-.812-.1-1.218l.321-.011c.014.4.046.8.094 1.19Zm27.582-2.2c-.014-.4-.045-.8-.093-1.19l.319-.039c.049.4.082.813.1 1.218ZM2.331 15.3l-.321-.02c.021-.405.061-.814.117-1.216l.318.045c-.055.391-.093.791-.114 1.191Zm27.057-2.144a13.987 13.987 0 0 0-.3-1.155l.312-.101c.119.388.223.786.307 1.183Zm-26.725-.222l-.313-.072c.091-.4.2-.791.326-1.177l.306.1c-.123.376-.23.763-.319 1.149Zm26.026-2.062a12.639 12.639 0 0 0-.5-1.086l.286-.146c.185.363.355.736.507 1.111ZM3.4 10.665l-.3-.125c.158-.374.334-.745.524-1.1l.284.15c-.184.347-.356.71-.508 1.075Zm1.113-2.108l-.27-.174c.22-.341.458-.676.707-1l.254.2c-.243.317-.476.641-.691.974Zm1.464-1.881l-.235-.219c.276-.3.569-.585.87-.857l.215.239c-.294.261-.58.547-.85.837Zm1.77-1.6l-.193-.257c.323-.244.662-.477 1.007-.692l.17.272c-.337.215-.668.442-.984.68Zm15.705-.558l-.018-.012l.175-.27l.018.011Zm-1.047-.616a13.44 13.44 0 0 0-1.078-.512l.125-.3c.374.158.745.334 1.1.524ZM9.769 3.815l-.146-.286l.018-.009c.356-.181.724-.349 1.093-.5l.121.3c-.361.147-.72.311-1.068.488Zm10.44-.838a13.414 13.414 0 0 0-1.151-.317l.072-.313c.4.091.792.2 1.178.325Zm-8.229-.06l-.094-.307a14.25 14.25 0 0 1 1.182-.308l.067.314a13.89 13.89 0 0 0-1.155.301Zm5.9-.473a13.953 13.953 0 0 0-1.188-.113l.016-.321c.405.021.814.059 1.216.115Zm-3.572-.026l-.04-.319c.4-.05.812-.083 1.218-.1l.012.321c-.392.017-.793.049-1.186.098Z"/><circle cx="16" cy="15.998" r="10.708" fill="navy"/><circle cx="20.435" cy="11.562" r="3.136" fill="#fff"/><circle cx="26.708" cy="5.29" r="3.137" fill="navy"/><path fill="#fff" d="M13.1 21.352v-.79H9.629v-6.236h-.9v7.026H13.1m4.816 0V16.3h-.8v2.785c0 1.031-.54 1.706-1.378 1.706A.95.95 0 0 1 14.7 19.8v-3.5h-.8v3.817c0 .838.626 1.378 1.609 1.378a1.863 1.863 0 0 0 1.687-.925v.781h.723m5.872-.018v-.607a.664.664 0 0 1-.173.019c-.279 0-.434-.145-.434-.4v-2.809c0-.9-.655-1.378-1.9-1.378c-1.224 0-1.976.472-2.024 1.638h.81c.067-.617.434-.9 1.185-.9c.723 0 1.128.27 1.128.752v.212c0 .337-.2.482-.838.559a5.763 5.763 0 0 0-1.619.308a1.327 1.327 0 0 0-.887 1.311c0 .916.636 1.455 1.658 1.455a2.363 2.363 0 0 0 1.715-.742a.855.855 0 0 0 .829.665a1.967 1.967 0 0 0 .549-.087m-1.407-1.725a1.366 1.366 0 0 1-1.513 1.185c-.626 0-.993-.222-.993-.771c0-.53.357-.761 1.214-.887a4 4 0 0 0 1.291-.279v.752"/>`}})),MV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#fff" d="M7.313 18.654a.548.548 0 0 1-.6.233a.917.917 0 0 0-.869.08c-.306.218-.637.053-.579-.345a1.229 1.229 0 0 1 .583-.971c.833-.479.254-.812.711-1.293s.357-.629.341-1.283a4.648 4.648 0 0 1-3.4-1.9a6.012 6.012 0 0 1-1.46-3.764a6.365 6.365 0 0 1 .649-3.8a5.315 5.315 0 0 1 2.565-2.522a7.022 7.022 0 0 1 3.489-.77a4.96 4.96 0 0 1 2.443.452a5.148 5.148 0 0 0 1.546.8a1.217 1.217 0 0 0 .782-.226c.047 1.189-1.023 1.292-1.98 1.317s-1.546-.371-2.427-.224a4.193 4.193 0 0 0-3.03 1.774A3.783 3.783 0 0 0 5.408 8.9a1.952 1.952 0 0 0 1.441 1.8c.5.008.61-.136 1.047-.421s2.665-3.043 3.426-3.663a3.522 3.522 0 0 1 2.322-.821a3.24 3.24 0 0 1 1.671.286A12.275 12.275 0 0 1 16.9 7.139a8.833 8.833 0 0 0 .684-.576a2.865 2.865 0 0 1 2.393-.718a3.644 3.644 0 0 1 1.819.8a14.312 14.312 0 0 1 2.013 2.425a3.59 3.59 0 0 0 1.621 1.489c.771.237 1.352-.762 1.437-1.316a5.814 5.814 0 0 0 .112-.935a4.413 4.413 0 0 0-.135-1.125a4 4 0 0 0-.455-1.016a3.606 3.606 0 0 0-1.3-1.25A4.129 4.129 0 0 0 23.7 4.5a13.676 13.676 0 0 0-1.4.2c-.584.04-1.628.171-2.086-.28a1.18 1.18 0 0 1-.378-.853a.892.892 0 0 0 .469.19c.366.031.708-.268 1-.441a7.34 7.34 0 0 1 .908-.526a5.856 5.856 0 0 1 2.7-.232a6.308 6.308 0 0 1 2.2.725a6 6 0 0 1 1.634 1.48A4.983 4.983 0 0 1 29.781 6.9a8.981 8.981 0 0 1 .017 3.847a7.577 7.577 0 0 1-1.714 2.819a4.388 4.388 0 0 1-2.317 1.112a4.911 4.911 0 0 0 .086.488c.064.206.188.436.441.363a.236.236 0 0 1 .289.063c.133.116.064.567-.311.769a1.449 1.449 0 0 1-.695.131a6.612 6.612 0 0 1-1.11-.051c-.33-.058-.528-.32-.894-.361a3.572 3.572 0 0 1-1.452-.764a3.048 3.048 0 0 0-.362-.185c.059.18.138.368.177.541s.023.334.043.472s.059.247.082.359c.09.081.119.2.272.243a1.706 1.706 0 0 0 .546-.043c.156-.021.26-.106.383-.083a.85.85 0 0 1 .34.193c.1.082.191.094.274.3a3.333 3.333 0 0 1 .171.9a1.93 1.93 0 0 1-.1.755a1.261 1.261 0 0 1-.381.541a5.937 5.937 0 0 1-.956.769a1.652 1.652 0 0 0 .2.3c.1.109.324.229.421.344a.473.473 0 0 1 .148.324a.686.686 0 0 1-.109.433a1.9 1.9 0 0 1-.937.573a2.477 2.477 0 0 1 .023 1.06c-.037.159-.119.519-.315.612a3.823 3.823 0 0 1-.814.086c-.239.038-.373.074-.56.111a3.3 3.3 0 0 0-.34.492a.4.4 0 0 0 .008.35c.049.15.214.368.261.544a1.091 1.091 0 0 1 .012.541a.943.943 0 0 1-.269.46c-.15.157-.446.28-.593.406s-.294.142-.254.352a1.551 1.551 0 0 0 .781.867a.925.925 0 0 0 .65-.048c-.015.246-.228.412-.367.576a2.2 2.2 0 0 0 1-.588a2.488 2.488 0 0 1-.752.955a2.872 2.872 0 0 1-.6.4a2.652 2.652 0 0 0 .99 0a1.97 1.97 0 0 1-.748.242a2.2 2.2 0 0 1-.85-.064a5.7 5.7 0 0 1-.951-.541a.78.78 0 0 0 .217.442a2.859 2.859 0 0 0 .639.334a9.407 9.407 0 0 1-.963-.116a2.233 2.233 0 0 1-.555-.189a3.647 3.647 0 0 1-.449-.309a1.291 1.291 0 0 0 .215.411a1.963 1.963 0 0 0 .48.232a2.1 2.1 0 0 1-.5-.011a1.408 1.408 0 0 1-.517-.245a3.7 3.7 0 0 1-.52-.463a2.155 2.155 0 0 1-.4-.538c-.058-.154.035-.262.052-.393a1.233 1.233 0 0 0-.318.21a.4.4 0 0 0-.118.37a2.46 2.46 0 0 0 .315.589c-.344-.281-.536-.389-.618-.729a1.143 1.143 0 0 1 .272-.846c.075-.119.187-.23.257-.345a4.668 4.668 0 0 1-.466-.456c-.133-.173-.189-.408-.325-.573a3.412 3.412 0 0 0-.478-.407a6.246 6.246 0 0 1 .42.9a.6.6 0 0 1-.139.5c-.083.126-.216.154-.343.231s-.323.017-.4.131a.392.392 0 0 0-.023.4l.3.466a1.421 1.421 0 0 1-.381-.328c-.084-.114-.214-.218-.232-.371a.541.541 0 0 1 .073-.422c.1-.137.371-.182.493-.287s.19-.173.183-.309s-.14-.232-.253-.318a8.278 8.278 0 0 1-1.088-.815a1.08 1.08 0 0 1-.28-.443a.459.459 0 0 1 .085-.368c.083-.151.367-.352.4-.515s-.109-.2-.238-.256s-.376.029-.5-.071s.035-.311-.1-.427s-.445-.051-.6-.176a.837.837 0 0 1-.281-.459a.974.974 0 0 1-.024-.509c.038-.131.15-.154.217-.222s.127-.124.036-.225s-.385.006-.555-.124s-.066-.44-.186-.572s-.336-.079-.449-.121s-.159.106-.228-.128s-.072-.93-.166-1.189s-.278-.018-.363-.276a7.085 7.085 0 0 1-.043-1.06l-.175-1.061c-.609.409-2.53.935-2.7 1.233"/><path fill="#030303" d="M16.623 8.258a3.733 3.733 0 0 0 .077.942a.909.909 0 0 0 .382.66c.462.343.758.286 1.114.485a1.017 1.017 0 0 1 .446.421a.363.363 0 0 1-.17.422a.361.361 0 0 0 .371-.48c-.052-.128-.3-.185-.373-.314a.488.488 0 0 1-.04-.393c.064-.236.531-.451.7-.637a.772.772 0 0 0 .208-.9a2.831 2.831 0 0 0-1.45-1.141a3.209 3.209 0 0 0-.5-.15a1.65 1.65 0 0 1 .875.807c.144.374.019.515.024.84c0 .151.2.226.289.322s.07.145.009.259a.3.3 0 0 0-.13-.236c-.13-.093-.271-.073-.341-.263c-.106-.289.1-.563-.132-.888a1.029 1.029 0 0 0-.727-.522a1.267 1.267 0 0 0-.423.066l-.219-.258a4.594 4.594 0 0 0-1.34-.995a3.033 3.033 0 0 0-1.607-.3a3.068 3.068 0 0 0-2.2.771c-.808.7-2.892 3.367-3.4 3.7a1.7 1.7 0 0 1-1.248.453a2.124 2.124 0 0 1-1.657-2.002a4.041 4.041 0 0 1 .722-2.857a4.173 4.173 0 0 1 3.224-1.9a12.022 12.022 0 0 1 2.441.23c.771 0 1.534-.132 1.759-.745a1.044 1.044 0 0 1-.672.118A6.739 6.739 0 0 1 11 2.952a5.237 5.237 0 0 0-2.29-.377a6.319 6.319 0 0 0-3.215.669a5.769 5.769 0 0 0-2.582 2.475a5.866 5.866 0 0 0-.654 3.649a6.068 6.068 0 0 0 1.423 3.613a4.457 4.457 0 0 0 3.295 1.785l.329-1.45l-.587.842l.015-.937l-.531.659l-.233-.894l-.43.716l-.214-1l-.623.5l.2-.823l-.825.092l.379-.572l-.752.009l.438-.764l-.667-.106L4 10.35l-.817-.242l.676-.648l-.659-.544l.522-.406l-.492-.65l.521-.607l-.194-.8L4 6.067l.132-.916l.5-.249l.427-.715l.785-.087l.39-.643l.793.04l.749-.407l.778.181l.883-.266l.654.153l.853.125l.824.659L10.5 3.5l-.636.305l-.526-.321l-.362.246l-.64.064l-.574-.037l-.419.511l-.843.013l-.3.688l-.759.266l-.071.791l-.544.426L5 7.2l-.47.773l.361.676l-.355.619l.472.308l-.107.995l.656.166l.148.738l.715-.075l.444.506l.549-.536a6.151 6.151 0 0 0 2.193-1.625a10.282 10.282 0 0 1 2.58-2.506a3.451 3.451 0 0 1 2.493-.477c.895.154 1.194.691 1.853 1.257a.626.626 0 0 1 .2-.253a4.416 4.416 0 0 0-.108.492Zm4.665 5.934a.71.71 0 0 1-.2.143a2.376 2.376 0 0 1-.344.083c.173.27.355.543.521.826s.31.594.469.892a4.909 4.909 0 0 0-.022-.511a5.014 5.014 0 0 0-.168-.537c-.071-.239-.159-.564-.26-.9Zm-.06-1.551a.508.508 0 0 1 .168.092a.646.646 0 0 1 .255.269a1.025 1.025 0 0 1 .048.466c-.056-.016-.132-.005-.191-.055s-.092-.162-.167-.21a.439.439 0 0 0-.219-.048a.694.694 0 0 1 .043.35a.431.431 0 0 1-.409.387a1.336 1.336 0 0 1-.342-.036c.04.089.108.167.147.256a1.842 1.842 0 0 0 .439-.073a3.264 3.264 0 0 1 .345-.2a2.175 2.175 0 0 1 .395-.067c-.113.1-.188.2-.3.295l.25.728c.177.111.344.169.566.306a7.337 7.337 0 0 0 .781.515a2.887 2.887 0 0 0 .767.263c.3.057.545.3.844.343a6.43 6.43 0 0 0 1.087.025c.261-.025.6-.16.631-.447a.6.6 0 0 1-.723-.407c-.075-.183-.038-.52-.153-.737s-.274-.286-.466-.552a8.352 8.352 0 0 1-.679-1.045c-.175-.357-.217-.762-.365-1.082a5.285 5.285 0 0 0-.546-.826a2.918 2.918 0 0 0-1.308-1.18a6.4 6.4 0 0 0-.963-.249c-.131.059-.31.124-.342.276a.622.622 0 0 0 .14.493a2.1 2.1 0 0 1 .568.7a2.753 2.753 0 0 1 .03 1.029a1.146 1.146 0 0 1-.328.42Zm-1.451.173a2.483 2.483 0 0 1 .854-.242c.126-.008.321.012.448.017a1.7 1.7 0 0 0 .3-.466a2.519 2.519 0 0 0-.043-.826c-.172-.423-.34-.441-.577-.683a1.347 1.347 0 0 1-.231-.743c-.019-.11-.073-.249-.1-.363a4.64 4.64 0 0 0-1-.052a1.088 1.088 0 0 0 .39-.567a1.116 1.116 0 0 0-.132-.78a3.032 3.032 0 0 0-.576-.6c-.208-.182-.506-.332-.7-.482a5.781 5.781 0 0 1 .768-.275a2.5 2.5 0 0 1 1.842.448a4.6 4.6 0 0 1 1.053.833c.384.4.859 1.137 1.23 1.574a7.877 7.877 0 0 0 .997 1.043a4.973 4.973 0 0 0 .925.5l.481.51l.389-.481l.625.071l.129-.7l.574-.157l-.093-.947l.413-.293l-.31-.589l.315-.644l-.411-.736l.159-.708l-.476-.405l-.062-.753l-.664-.253l-.266-.655l-.75-.01l-.366-.486l-.5.035l-.56-.061l-.316-.234l-.46.3l-.557-.29l-1.106.42l.721-.627l.747-.119l.569-.138l.773.254l.68-.172l.656.388l.694-.038l.341.612l.691.079l.374.68l.435.237l.115.871l.387.367l-.17.762l.456.577l-.428.619l.457.387l-.585.518l.592.616l-.715.23l.466.661l-.584.1l.383.727l-.658-.009l.331.545l-.722-.087l.173.783l-.546-.48l-.187.949l-.377-.682l-.2.85l-.465-.627l.012.891l-.514-.8a3.638 3.638 0 0 0 .385 1.382a3.518 3.518 0 0 0 2.24-1.041a7.168 7.168 0 0 0 1.627-2.739a9.306 9.306 0 0 0 .011-3.618a5.45 5.45 0 0 0-1.045-2.109A7.963 7.963 0 0 0 26.9 3.405a6.2 6.2 0 0 0-3.2-.694a3.79 3.79 0 0 0-1.338.25c-.617.224-1.11.714-1.737.955a.6.6 0 0 1-.53 0a.989.989 0 0 0 .723.572a5.464 5.464 0 0 0 1.431-.013a9.013 9.013 0 0 1 1.451-.19a3.1 3.1 0 0 1 1.484.428a3.658 3.658 0 0 1 1.4 1.318a4 4 0 0 1 .448 1.079a5.063 5.063 0 0 1 .151 1.174a3.6 3.6 0 0 1-.112 1.035c-.212.781-.68 1.576-1.641 1.454c-.588-.075-1.475-1.18-1.772-1.585a15.7 15.7 0 0 0-1.969-2.4a3.034 3.034 0 0 0-1.705-.757a2.579 2.579 0 0 0-2.384.829a4.609 4.609 0 0 1 .532.17a3.981 3.981 0 0 1 1.094.718a1.19 1.19 0 0 1 .5.968c.008.3-.239.541-.465.758c-.139.133-.322.254-.434.357c-.149.137-.333.286-.147.5a1.883 1.883 0 0 0 .3.22c.163.121.089.572-.127.691a.712.712 0 0 1-.832-.069c.287-.043.469-.081.461-.315c0-.136-.177-.249-.347-.326a4.931 4.931 0 0 1-1.125-.452c-.411-.3-.42-.458-.531-.922a2.623 2.623 0 0 0-.646.113c-.265.087-.558.3-.8.348a1.718 1.718 0 0 1-1.058.006a4.244 4.244 0 0 0-2.1.349a5.917 5.917 0 0 0-.975.121a6.413 6.413 0 0 0-1.7.995a9.083 9.083 0 0 0-1.98 4.059c-.051.57.112.955-.248 1.233s-.349.992-.471 1.193s-.263.111-.525.392s-.4.234-.389.766a1.839 1.839 0 0 1 .845-.332c.256-.009.259.328.916-.322c.352-.348 1.027-.358 1.5-.512A4.732 4.732 0 0 0 11 16.152a5.613 5.613 0 0 0 1.415-3.381a3.984 3.984 0 0 1-.038 1.247a3.473 3.473 0 0 0 .151 2.442l.309.59a5.184 5.184 0 0 1-.652-.953l-.25-.674a5.057 5.057 0 0 1-1.463 1.662a2.916 2.916 0 0 0 .089 1.169c.128.373-.076.8.021 1.049s.321.106.394.355s-.038.741.075.983s.392.1.527.174a.774.774 0 0 1 .251.289c.073.1-.028.346.119.425s.376.012.529.088a.357.357 0 0 1 .139.422c-.036.163-.2.238-.272.4a.427.427 0 0 0 .023.434a.891.891 0 0 0 .466.314c.19.077.457.034.653.14a1.537 1.537 0 0 1 .476.473a.636.636 0 0 1 .127.425a1.19 1.19 0 0 1-.157.505c-.087.157-.278.347.021.647s.287.17.458.364c-.019-.336-.157-.609-.056-.862s.406-.3.566-.411a2.625 2.625 0 0 0 .379-.4a4.487 4.487 0 0 1 0 .491c-.041.266-.119.5.277.544a1.293 1.293 0 0 0 .535-.166c-.1.176-.269.318-.3.528a.918.918 0 0 0 .151.651a2.127 2.127 0 0 0 .582.487a2.227 2.227 0 0 0 .425.2c.007.207-.034.427-.01.621a1.134 1.134 0 0 0 .2.529a1.73 1.73 0 0 0 .465.373c-.094-.218-.283-.424-.281-.653a.734.734 0 0 1 .294-.594c.223-.2.746-.38.992-.577a1.214 1.214 0 0 0 .414-.51a2.23 2.23 0 0 0 .08-.673a2.032 2.032 0 0 1 .119.569a2.006 2.006 0 0 1-.221.794a1.217 1.217 0 0 0 .6-.612c.065.039.032.145.056.349c.109-.108.232-.191.341-.293a.949.949 0 0 0 .284-.334a.765.765 0 0 0-.008-.459a3.091 3.091 0 0 0-.324-.538c-.1-.181.017-.358.01-.576a1.727 1.727 0 0 0-.6-.1c-.229.033-.491.29-.725.293s-.365-.216-.557-.277a3.409 3.409 0 0 0-.579-.08a5.348 5.348 0 0 1 1.84-.451a11.629 11.629 0 0 1 1.715-.155a4.393 4.393 0 0 0 .769.03c.179-.051.141-.174.194-.307a1.73 1.73 0 0 0-.006-1.079A8.378 8.378 0 0 0 20.46 22c-.511.039-1.117.282-1.644.3a3.165 3.165 0 0 1-1.53-.328a3.63 3.63 0 0 1-.986-1.125c-.215-.329-.486-.975-.651-1.27a1.614 1.614 0 0 0-.339-.5a1.512 1.512 0 0 0-.488-.2c.188.019.392-.04.563.058c.256.147.543.756.7 1.021c.169-.566.129-.788.618-1.107a2.153 2.153 0 0 0-.5 1.295c.327.537.782 1.393 1.378 1.63a3.907 3.907 0 0 0 .817.168a5.91 5.91 0 0 0 2.132-.315a5.587 5.587 0 0 1 1.678-.04c.215.012.72-.117.825-.333a.382.382 0 0 0-.033-.386c-.081-.126-.3-.186-.414-.3a2.667 2.667 0 0 1-.274-.368a7.515 7.515 0 0 1-1.238.138c.257-.106.5-.167.771-.271a4.6 4.6 0 0 0 .787-.419a2.522 2.522 0 0 0 .51-.391a3.13 3.13 0 0 0 .471-.539a1.406 1.406 0 0 0 .139-.681a2.03 2.03 0 0 0-.1-.805a.634.634 0 0 0-.433-.311c-.15-.048-.252.073-.408.09s-.3.115-.527.008a1.967 1.967 0 0 1-.72-.642c-.228-.32-.39-.844-.623-1.247a21.2 21.2 0 0 0-1.376-1.986a4.043 4.043 0 0 1-.118-.593a2.861 2.861 0 0 1 .076-1.13a.987.987 0 0 1 .512-.69a.563.563 0 0 1 .371-.026a.25.25 0 0 1 .167.294c-.045.15-.15.155-.221.231a.808.808 0 0 0-.213.384a1.825 1.825 0 0 1 .412.016a.481.481 0 0 1 .339.326a.611.611 0 0 0-.456-.22a2.057 2.057 0 0 0-.316.048a2.271 2.271 0 0 1-.118.383c-.056.1-.163.075-.2.191a1.12 1.12 0 0 0-.022.455Zm.546.2c-.208.013-.258-.014-.424.1l.271.422a.65.65 0 0 1 .153-.525Zm-7.072-1.86a.812.812 0 0 1 .036-.194c-.3-.081-.423.115-.6.479c-.066.136 0 .217-.072.306s-.185.077-.3.163s-.23.251-.338.34a3.758 3.758 0 0 1-.777.418a2.536 2.536 0 0 0 .625-.513c.058-.1.05-.287.14-.377s.123-.152.24-.174s.07-.159.108-.266a1.151 1.151 0 0 1 .193-.293a.848.848 0 0 1 .339-.329c.158-.059.405 0 .525-.029s.051-.121.138-.173s.257-.029.373-.085a1.139 1.139 0 0 0 .429-.442A2.256 2.256 0 0 1 14.187 11a1.478 1.478 0 0 1-.749.89a2.38 2.38 0 0 1-.426.16c.073-.1.177-.143.219-.3a3.762 3.762 0 0 0 .02-.6Zm1.931 1.493c.157-.014.351.028.5.02a2.652 2.652 0 0 0 .377-.07c-.023-.221 0-.627-.205-.774a1.783 1.783 0 0 0-.817.008a7.63 7.63 0 0 0-1.017.385a3.168 3.168 0 0 1 .923-.514a2.428 2.428 0 0 1 .948-.09c.1.028.123.07.185.156a1.811 1.811 0 0 1 .268.9a2.524 2.524 0 0 1 .157.229a1.1 1.1 0 0 1 .081.338c-.056-.081-.022-.183-.177-.243a1.507 1.507 0 0 0-.6.018a.508.508 0 0 1-.231.934a.541.541 0 0 1-.641-.333a.988.988 0 0 1-.021-.4a.794.794 0 0 0-.688.259a1.3 1.3 0 0 0 .523.508a1.681 1.681 0 0 0 .5.186a2.516 2.516 0 0 0 .676.032a.734.734 0 0 0 .444-.216a1.04 1.04 0 0 0 .212-.47a1.369 1.369 0 0 1-.083.431a.786.786 0 0 1-.778.412a2.853 2.853 0 0 1-1.019-.2a1.542 1.542 0 0 1-.73-.624a1.8 1.8 0 0 1-.02-.557c.332-.22.413-.166.806-.231c.164-.027.277-.088.433-.1Zm.9-2.187a1.48 1.48 0 0 0 .524.212c.147 0 .185-.1.272-.154a6.578 6.578 0 0 0 .523 1.333c.1.169.159.09.232.26s.107.514.176.73a5.907 5.907 0 0 0 .242.564a7.727 7.727 0 0 1-.583-.9c-.114-.241-.041-.262-.133-.492s-.279-.588-.418-.882a.829.829 0 0 1-.3.008c-.076-.023-.061-.1-.129-.156s-.184-.032-.28-.115a.592.592 0 0 1-.127-.405Zm-1.964 7.762c.138-.112.511-.023.789 0l-.6.154c-.019.068-.01.147-.056.2s-.132.079-.2.119c.007-.179-.072-.363.066-.475Zm2.574-3.737a2.621 2.621 0 0 0 .205-.6c-.027.252.024.529-.1.712s-.339.151-.518.2c.139-.106.3-.153.411-.312Zm-.252 2.8a1 1 0 0 1 .5-.9a2.14 2.14 0 0 1 .706-.253a2.751 2.751 0 0 1 1.186.155a7.055 7.055 0 0 1 .7.459c.239.141.409.236.637.395c.35.243.554.512.8.673a1.763 1.763 0 0 0 .435.113a.73.73 0 0 1-.407.033a1.823 1.823 0 0 1-.513-.306a3.515 3.515 0 0 0-.579-.42c-.145-.084-.383-.183-.542-.287s-.435-.331-.587-.407a1.892 1.892 0 0 0-.759-.146a1.606 1.606 0 0 0-.959.267a.645.645 0 0 0-.264.66a2.992 2.992 0 0 1 .23-.3a.721.721 0 0 1 .607-.131a.531.531 0 0 1 .459.415a1.1 1.1 0 0 0-.238-.159a.573.573 0 0 0-.51.05c-.21.112-.153.278-.183.463a1.765 1.765 0 0 1-.069.231a.453.453 0 0 1-.211-.113a1.493 1.493 0 0 0 .008.259a3.194 3.194 0 0 0 .1.319a1.872 1.872 0 0 1-.39-.47a1.237 1.237 0 0 1-.148-.6Zm1.889.318a.98.98 0 0 1 .439.114a1.712 1.712 0 0 1 .314.223a1.858 1.858 0 0 1 .5.877a5.274 5.274 0 0 1 .077.745a4.767 4.767 0 0 0-.225-.687a1.682 1.682 0 0 0-.783-.8a.42.42 0 0 0-.252-.032c.028.047.075.086.077.155a.27.27 0 0 1-.13.259a.493.493 0 0 1-.541-.1a.48.48 0 0 1-.12-.535c.091-.224.439-.224.644-.216Zm-10.406.644a.726.726 0 0 0-.6.4a.548.548 0 0 1-.6.233a.917.917 0 0 0-.869.08c-.306.218-.637.053-.579-.344a1.226 1.226 0 0 1 .583-.971c.832-.479.254-.812.71-1.293s.356-.629.342-1.283a4.65 4.65 0 0 1-3.4-1.9A6.013 6.013 0 0 1 2.036 9.4a6.362 6.362 0 0 1 .649-3.8a5.314 5.314 0 0 1 2.569-2.522a7.026 7.026 0 0 1 3.489-.769a4.958 4.958 0 0 1 2.443.452a5.153 5.153 0 0 0 1.545.8a1.218 1.218 0 0 0 .782-.226c.047 1.189-1.023 1.292-1.981 1.317s-1.546-.371-2.427-.223A4.192 4.192 0 0 0 6.078 6.2a3.78 3.78 0 0 0-.669 2.683a1.951 1.951 0 0 0 1.44 1.8c.5.008.61-.136 1.047-.421s2.665-3.041 3.426-3.662a3.518 3.518 0 0 1 2.321-.821a3.236 3.236 0 0 1 1.671.285A12.282 12.282 0 0 1 16.9 7.128a8.515 8.515 0 0 0 .684-.576a2.865 2.865 0 0 1 2.393-.718a3.644 3.644 0 0 1 1.819.8a14.284 14.284 0 0 1 2.014 2.425a3.594 3.594 0 0 0 1.621 1.489c.771.237 1.351-.762 1.437-1.316a5.786 5.786 0 0 0 .112-.932a4.39 4.39 0 0 0-.134-1.125a4.012 4.012 0 0 0-.455-1.016a3.6 3.6 0 0 0-1.3-1.25a4.131 4.131 0 0 0-1.391-.424a13.632 13.632 0 0 0-1.4.2c-.584.04-1.627.171-2.085-.28a1.18 1.18 0 0 1-.378-.854a.891.891 0 0 0 .469.189c.366.031.708-.268 1-.441a7.2 7.2 0 0 1 .907-.526a5.861 5.861 0 0 1 2.7-.233a6.315 6.315 0 0 1 2.2.725a6.005 6.005 0 0 1 1.634 1.48a4.992 4.992 0 0 1 1.037 2.15a8.988 8.988 0 0 1 .017 3.847a7.581 7.581 0 0 1-1.713 2.819a4.391 4.391 0 0 1-2.317 1.112c.034.177.04.342.085.487c.065.206.188.436.442.364a.236.236 0 0 1 .289.062c.133.117.063.567-.312.769a1.444 1.444 0 0 1-.695.131a6.517 6.517 0 0 1-1.11-.051c-.33-.058-.528-.319-.894-.361a3.576 3.576 0 0 1-1.452-.764a3.069 3.069 0 0 0-.362-.185c.059.18.137.368.177.541s.022.334.043.473s.059.246.081.359c.091.081.12.2.272.243a1.688 1.688 0 0 0 .546-.043c.156-.021.261-.105.383-.083a.853.853 0 0 1 .341.193c.1.082.19.094.274.3a3.364 3.364 0 0 1 .17.9a1.922 1.922 0 0 1-.1.755a1.254 1.254 0 0 1-.381.541a5.924 5.924 0 0 1-.957.769a1.691 1.691 0 0 0 .2.3c.1.108.324.229.421.343a.474.474 0 0 1 .148.324a.689.689 0 0 1-.109.434a1.9 1.9 0 0 1-.937.573a2.484 2.484 0 0 1 .023 1.06c-.037.159-.119.519-.315.612a3.808 3.808 0 0 1-.814.086c-.239.038-.373.074-.56.111a3.312 3.312 0 0 0-.34.491a.4.4 0 0 0 .008.35c.049.15.215.369.261.544a1.091 1.091 0 0 1 .012.541a.952.952 0 0 1-.269.461c-.15.157-.446.279-.593.406s-.294.142-.254.352a1.548 1.548 0 0 0 .781.867a.93.93 0 0 0 .65-.047c-.015.246-.228.412-.367.575a2.2 2.2 0 0 0 1-.587a2.486 2.486 0 0 1-.752.954a2.86 2.86 0 0 1-.6.4a2.634 2.634 0 0 0 .991 0a1.964 1.964 0 0 1-.748.242a2.189 2.189 0 0 1-.85-.063a5.72 5.72 0 0 1-.951-.541a.782.782 0 0 0 .216.442a2.849 2.849 0 0 0 .639.334a9.6 9.6 0 0 1-.963-.116a2.274 2.274 0 0 1-.555-.189a3.8 3.8 0 0 1-.449-.309a1.3 1.3 0 0 0 .215.411a1.95 1.95 0 0 0 .481.233a2.1 2.1 0 0 1-.5-.011a1.409 1.409 0 0 1-.517-.245a3.708 3.708 0 0 1-.521-.464a2.146 2.146 0 0 1-.4-.538c-.058-.154.035-.262.052-.393a1.218 1.218 0 0 0-.319.209a.4.4 0 0 0-.118.371a2.45 2.45 0 0 0 .315.589c-.344-.281-.536-.39-.618-.729a1.142 1.142 0 0 1 .272-.846c.075-.119.187-.23.256-.345a4.636 4.636 0 0 1-.466-.456c-.133-.174-.189-.408-.325-.574a3.436 3.436 0 0 0-.478-.406a6.173 6.173 0 0 1 .42.9a.6.6 0 0 1-.139.5c-.083.126-.216.154-.342.231s-.324.016-.4.131a.393.393 0 0 0-.023.4l.3.466a1.418 1.418 0 0 1-.381-.328c-.085-.113-.214-.218-.232-.371a.541.541 0 0 1 .073-.423c.1-.136.371-.182.493-.287s.19-.173.183-.309s-.139-.233-.253-.318a8.319 8.319 0 0 1-1.088-.815a1.091 1.091 0 0 1-.28-.443a.461.461 0 0 1 .085-.368c.083-.151.367-.352.4-.515s-.109-.2-.238-.257s-.375.029-.5-.071s.035-.311-.1-.427s-.445-.051-.6-.176a.84.84 0 0 1-.281-.46a.968.968 0 0 1-.024-.509c.037-.131.149-.153.217-.221s.127-.124.036-.226s-.386.006-.556-.124s-.066-.44-.186-.571s-.336-.08-.449-.122s-.158.106-.228-.127s-.072-.929-.165-1.189s-.278-.017-.364-.276a7.171 7.171 0 0 1-.043-1.061l-.175-1.061a3.741 3.741 0 0 1-1.666.654a10.832 10.832 0 0 0 .338 4.321c.543 1.777 1.643 2.824 3.128 4.328a9.109 9.109 0 0 1-3.478-4.188a9.791 9.791 0 0 1-.414-4.277"/>`}})),NV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="none" stroke="#755838" d="M2.5 7.955h27v16.091h-27z"/><path fill="#755838" d="M5.909 20.636v-9.272h2.727l2.728 3.409l2.727-3.409h2.727v9.272h-2.727v-5.318l-2.727 3.409l-2.728-3.409v5.318H5.909zm17.046 0l-4.091-4.5h2.727v-4.772h2.727v4.772h2.727l-4.09 4.5z"/>`}})),PV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#cb3837" d="M2 10.555h28v9.335H16v1.556H9.778v-1.557H2Zm1.556 7.779h3.111v-4.668h1.555v4.667h1.556v-6.222H3.556Zm7.778-6.223v7.779h3.111v-1.556h3.111v-6.223Zm3.111 1.556H16v3.112h-1.556Zm4.667-1.556v6.223h3.111v-4.668h1.556v4.667h1.556v-4.667h1.556v4.667h1.556v-6.222Z"/>`}})),FV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#909090" d="m24.1 2.072l5.564 5.8v22.056H8.879V30h20.856V7.945L24.1 2.072"/><path fill="#f4f4f4" d="M24.031 2H8.808v27.928h20.856V7.873L24.03 2"/><path fill="#7a7b7c" d="M8.655 3.5h-6.39v6.827h20.1V3.5H8.655"/><path fill="#dd2025" d="M22.472 10.211H2.395V3.379h20.077v6.832"/><path fill="#464648" d="M9.052 4.534H7.745v4.8h1.028V7.715L9 7.728a2.042 2.042 0 0 0 .647-.117a1.427 1.427 0 0 0 .493-.291a1.224 1.224 0 0 0 .335-.454a2.13 2.13 0 0 0 .105-.908a2.237 2.237 0 0 0-.114-.644a1.173 1.173 0 0 0-.687-.65a2.149 2.149 0 0 0-.409-.104a2.232 2.232 0 0 0-.319-.026m-.189 2.294h-.089v-1.48h.193a.57.57 0 0 1 .459.181a.92.92 0 0 1 .183.558c0 .246 0 .469-.222.626a.942.942 0 0 1-.524.114m3.671-2.306c-.111 0-.219.008-.295.011L12 4.538h-.78v4.8h.918a2.677 2.677 0 0 0 1.028-.175a1.71 1.71 0 0 0 .68-.491a1.939 1.939 0 0 0 .373-.749a3.728 3.728 0 0 0 .114-.949a4.416 4.416 0 0 0-.087-1.127a1.777 1.777 0 0 0-.4-.733a1.63 1.63 0 0 0-.535-.4a2.413 2.413 0 0 0-.549-.178a1.282 1.282 0 0 0-.228-.017m-.182 3.937h-.1V5.392h.013a1.062 1.062 0 0 1 .6.107a1.2 1.2 0 0 1 .324.4a1.3 1.3 0 0 1 .142.526c.009.22 0 .4 0 .549a2.926 2.926 0 0 1-.033.513a1.756 1.756 0 0 1-.169.5a1.13 1.13 0 0 1-.363.36a.673.673 0 0 1-.416.106m5.08-3.915H15v4.8h1.028V7.434h1.3v-.892h-1.3V5.43h1.4v-.892"/><path fill="#dd2025" d="M21.781 20.255s3.188-.578 3.188.511s-1.975.646-3.188-.511Zm-2.357.083a7.543 7.543 0 0 0-1.473.489l.4-.9c.4-.9.815-2.127.815-2.127a14.216 14.216 0 0 0 1.658 2.252a13.033 13.033 0 0 0-1.4.288Zm-1.262-6.5c0-.949.307-1.208.546-1.208s.508.115.517.939a10.787 10.787 0 0 1-.517 2.434a4.426 4.426 0 0 1-.547-2.162Zm-4.649 10.516c-.978-.585 2.051-2.386 2.6-2.444c-.003.001-1.576 3.056-2.6 2.444ZM25.9 20.895c-.01-.1-.1-1.207-2.07-1.16a14.228 14.228 0 0 0-2.453.173a12.542 12.542 0 0 1-2.012-2.655a11.76 11.76 0 0 0 .623-3.1c-.029-1.2-.316-1.888-1.236-1.878s-1.054.815-.933 2.013a9.309 9.309 0 0 0 .665 2.338s-.425 1.323-.987 2.639s-.946 2.006-.946 2.006a9.622 9.622 0 0 0-2.725 1.4c-.824.767-1.159 1.356-.725 1.945c.374.508 1.683.623 2.853-.91a22.549 22.549 0 0 0 1.7-2.492s1.784-.489 2.339-.623s1.226-.24 1.226-.24s1.629 1.639 3.2 1.581s1.495-.939 1.485-1.035"/><path fill="#909090" d="M23.954 2.077V7.95h5.633l-5.633-5.873Z"/><path fill="#f4f4f4" d="M24.031 2v5.873h5.633L24.031 2Z"/><path fill="#fff" d="M8.975 4.457H7.668v4.8H8.7V7.639l.228.013a2.042 2.042 0 0 0 .647-.117a1.428 1.428 0 0 0 .493-.291a1.224 1.224 0 0 0 .332-.454a2.13 2.13 0 0 0 .105-.908a2.237 2.237 0 0 0-.114-.644a1.173 1.173 0 0 0-.687-.65a2.149 2.149 0 0 0-.411-.105a2.232 2.232 0 0 0-.319-.026m-.189 2.294h-.089v-1.48h.194a.57.57 0 0 1 .459.181a.92.92 0 0 1 .183.558c0 .246 0 .469-.222.626a.942.942 0 0 1-.524.114m3.67-2.306c-.111 0-.219.008-.295.011l-.235.006h-.78v4.8h.918a2.677 2.677 0 0 0 1.028-.175a1.71 1.71 0 0 0 .68-.491a1.939 1.939 0 0 0 .373-.749a3.728 3.728 0 0 0 .114-.949a4.416 4.416 0 0 0-.087-1.127a1.777 1.777 0 0 0-.4-.733a1.63 1.63 0 0 0-.535-.4a2.413 2.413 0 0 0-.549-.178a1.282 1.282 0 0 0-.228-.017m-.182 3.937h-.1V5.315h.013a1.062 1.062 0 0 1 .6.107a1.2 1.2 0 0 1 .324.4a1.3 1.3 0 0 1 .142.526c.009.22 0 .4 0 .549a2.926 2.926 0 0 1-.033.513a1.756 1.756 0 0 1-.169.5a1.13 1.13 0 0 1-.363.36a.673.673 0 0 1-.416.106m5.077-3.915h-2.43v4.8h1.028V7.357h1.3v-.892h-1.3V5.353h1.4v-.892"/>`}})),IV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><radialGradient id="vscodeIconsFileTypePhp0" cx="-16.114" cy="20.532" r="18.384" gradientTransform="translate(26.52 -9.307)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".5" stop-color="#4c6b96"/><stop offset="1" stop-color="#231f20"/></radialGradient></defs><ellipse cx="16" cy="16" fill="url(#vscodeIconsFileTypePhp0)" rx="14" ry="7.365"/><ellipse cx="16" cy="16" fill="#6280b6" rx="13.453" ry="6.818"/><path fill="#fff" d="m18.725 18.2l.667-3.434a1.752 1.752 0 0 0-.372-1.719a2.929 2.929 0 0 0-2-.525h-1.153l.331-1.7a.219.219 0 0 0-.215-.26h-1.6a.219.219 0 0 0-.215.177l-.709 3.646a2.051 2.051 0 0 0-.477-1.054a2.783 2.783 0 0 0-2.2-.807H7.7a.219.219 0 0 0-.215.177l-1.434 7.38a.219.219 0 0 0 .215.26h1.603a.219.219 0 0 0 .215-.177l.347-1.785h1.2a5.167 5.167 0 0 0 1.568-.2a3.068 3.068 0 0 0 1.15-.689a3.538 3.538 0 0 0 .68-.844l-.287 1.475a.219.219 0 0 0 .215.26h1.6a.219.219 0 0 0 .215-.177l.787-4.051h1.094c.466 0 .6.093.64.133s.1.165.025.569l-.635 3.265a.219.219 0 0 0 .215.26h1.62a.219.219 0 0 0 .207-.18Zm-7.395-2.834a1.749 1.749 0 0 1-.561 1.092a2.171 2.171 0 0 1-1.315.321h-.712l.515-2.651h.921c.677 0 .949.145 1.059.266a1.181 1.181 0 0 1 .093.972Zm14.216-2.034a2.783 2.783 0 0 0-2.2-.807h-3.091a.219.219 0 0 0-.215.177l-1.434 7.38a.219.219 0 0 0 .215.26h1.608a.219.219 0 0 0 .215-.177l.347-1.785h1.2a5.167 5.167 0 0 0 1.568-.2a3.068 3.068 0 0 0 1.15-.689a3.425 3.425 0 0 0 1.076-1.927a2.512 2.512 0 0 0-.439-2.232Zm-1.667 2.034a1.749 1.749 0 0 1-.561 1.092a2.171 2.171 0 0 1-1.318.32h-.71l.515-2.651h.921c.677 0 .949.145 1.059.266a1.181 1.181 0 0 1 .094.973Z"/><path fill="#000004" d="M10.178 13.908a1.645 1.645 0 0 1 1.221.338a1.34 1.34 0 0 1 .145 1.161a1.945 1.945 0 0 1-.642 1.223a2.361 2.361 0 0 1-1.448.37h-.978l.6-3.089Zm-3.917 6.216h1.608l.381-1.962h1.377a4.931 4.931 0 0 0 1.5-.191a2.84 2.84 0 0 0 1.07-.642a3.207 3.207 0 0 0 1.01-1.808a2.3 2.3 0 0 0-.385-2.044a2.568 2.568 0 0 0-2.035-.732H7.7Zm8.126-9.342h1.6l-.387 1.962h1.421a2.767 2.767 0 0 1 1.85.468a1.548 1.548 0 0 1 .305 1.516l-.667 3.434H16.89l.635-3.265a.886.886 0 0 0-.08-.76a1.121 1.121 0 0 0-.8-.2H15.37l-.822 4.228h-1.6Zm8.34 3.126a1.645 1.645 0 0 1 1.221.338a1.34 1.34 0 0 1 .145 1.161a1.945 1.945 0 0 1-.642 1.223A2.361 2.361 0 0 1 22 17h-.978l.6-3.089Zm-3.917 6.216h1.608l.381-1.962h1.377a4.931 4.931 0 0 0 1.5-.191a2.84 2.84 0 0 0 1.07-.642a3.207 3.207 0 0 0 1.01-1.808a2.3 2.3 0 0 0-.385-2.044a2.568 2.568 0 0 0-2.035-.732h-3.092Z"/>`}})),LV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f9ad00" d="M30 10.75h-8.749V2H30Zm-9.626 0h-8.75V2h8.75Zm-9.625 0H2V2h8.749ZM30 20.375h-8.749v-8.75H30Z"/><path fill="#fff" d="M20.374 20.375h-8.75v-8.75h8.75Zm0 9.625h-8.75v-8.75h8.75ZM30 30h-8.749v-8.75H30Zm-19.251 0H2v-8.75h8.749Z"/>`}})),RV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypePowerpoint0" x1="4.494" x2="13.832" y1="-1748.086" y2="-1731.914" gradientTransform="translate(0 1756)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ca4c28"/><stop offset=".5" stop-color="#c5401e"/><stop offset="1" stop-color="#b62f14"/></linearGradient></defs><path fill="#ed6c47" d="M18.93 17.3L16.977 3h-.146A12.9 12.9 0 0 0 3.953 15.854V16Z"/><path fill="#ff8f6b" d="M17.123 3h-.146v13l6.511 2.6L30 16v-.146A12.9 12.9 0 0 0 17.123 3Z"/><path fill="#d35230" d="M30 16v.143A12.905 12.905 0 0 1 17.12 29h-.287a12.907 12.907 0 0 1-12.88-12.857V16Z"/><path d="M17.628 9.389V23.26a1.2 1.2 0 0 1-.742 1.1a1.16 1.16 0 0 1-.45.091H7.027a10.08 10.08 0 0 1-.521-.65a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85a8.82 8.82 0 0 1 .456-.65h9.93a1.2 1.2 0 0 1 1.192 1.189Z" opacity=".1"/><path d="M16.977 10.04v13.871a1.15 1.15 0 0 1-.091.448a1.2 1.2 0 0 1-1.1.741H7.62q-.309-.314-.593-.65a10.08 10.08 0 0 1-.521-.65a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.735a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"/><path d="M16.977 10.04v12.571a1.2 1.2 0 0 1-1.192 1.189H6.506a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.735a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"/><path d="M16.326 10.04v12.571a1.2 1.2 0 0 1-1.192 1.189H6.506a12.735 12.735 0 0 1-2.553-7.657v-.286A12.705 12.705 0 0 1 6.05 8.85h9.084a1.2 1.2 0 0 1 1.192 1.19Z" opacity=".2"/><path fill="url(#vscodeIconsFileTypePowerpoint0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"/><path fill="#fff" d="M9.293 12.028a3.287 3.287 0 0 1 2.174.636a2.27 2.27 0 0 1 .756 1.841a2.555 2.555 0 0 1-.373 1.376a2.49 2.49 0 0 1-1.059.935a3.607 3.607 0 0 1-1.591.334H7.687v2.8H6.141v-7.922ZM7.686 15.94h1.331a1.735 1.735 0 0 0 1.177-.351a1.3 1.3 0 0 0 .4-1.025q0-1.309-1.525-1.31H7.686v2.686Z"/>`}})),zV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#56b3b4" d="M21.714 8.571h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#ea5e5e" d="M4.571 26.857h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Z"/><path fill="#bf85bf" d="M18.286 17.714h3.429a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-3.429a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#ea5e5e" d="M11.429 17.714H16a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-4.571a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#56b3b4" d="M4.571 17.714h4.572a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Z"/><path fill="#bf85bf" d="M4.571 22.286h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 22.857a.571.571 0 0 1 .571-.571Zm0-9.143h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 13.714a.571.571 0 0 1 .571-.571Z"/><path fill="#f7ba3e" d="M10.286 6.286h11.428a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H10.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#ea5e5e" d="M4.571 6.286H8a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.572H4.571A.571.571 0 0 1 4 6.857a.571.571 0 0 1 .571-.571Z"/><path fill="#f7ba3e" d="M9.143 24.571h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H9.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#56b3b4" d="M9.143 10.857h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H9.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571ZM4.571 24.571h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Z"/><path fill="#f7ba3e" d="M4.571 10.857h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.572H4.571A.571.571 0 0 1 4 11.429a.571.571 0 0 1 .571-.572Z"/><path fill="#4d616e" d="M19.429 24.571h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-6.858 0h4.571a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-4.571a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Zm10.286 0h4.571a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-4.571a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z" opacity=".5"/><path fill="#56b3b4" d="M13.714 15.429h9.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-9.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#f7ba3e" d="M8 15.429h3.429A.571.571 0 0 1 12 16a.571.571 0 0 1-.571.571H8A.571.571 0 0 1 7.429 16A.571.571 0 0 1 8 15.429Z"/><path fill="#ea5e5e" d="M4.571 15.429h1.143a.571.571 0 0 1 .572.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 16a.571.571 0 0 1 .571-.571Z"/><path fill="#bf85bf" d="M14.857 8.571h4.571a.571.571 0 0 1 .572.572a.571.571 0 0 1-.571.571h-4.572a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Z"/><path fill="#56b3b4" d="M4.571 8.571h8a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-8A.571.571 0 0 1 4 9.143a.571.571 0 0 1 .571-.572Z"/><path fill="#f7ba3e" d="M8 20h10.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H8a.571.571 0 0 1-.571-.571A.571.571 0 0 1 8 20Z"/><path fill="#bf85bf" d="M4.571 20h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 20.571A.571.571 0 0 1 4.571 20Z"/><path fill="#ea5e5e" d="M18.286 10.857H24a.571.571 0 0 1 .571.571A.571.571 0 0 1 24 12h-5.714a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Z"/><path fill="#f7ba3e" d="M18.286 13.143H24a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-5.714a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z"/><path fill="#56b3b4" d="M4.571 4h13.715a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H4.571A.571.571 0 0 1 4 4.571A.571.571 0 0 1 4.571 4Z"/><path fill="#4d616e" d="M20.571 4h6.857a.571.571 0 0 1 .572.571a.571.571 0 0 1-.571.571h-6.858A.571.571 0 0 1 20 4.571A.571.571 0 0 1 20.571 4Zm0 16h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm4.572 0h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571ZM24 17.714h3.429a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H24a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm0-11.428h3.429a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H24a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm1.143 9.143h2.286A.571.571 0 0 1 28 16a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.572-.571a.571.571 0 0 1 .572-.571Zm0-6.858h2.286a.571.571 0 0 1 .571.572a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Zm1.143 2.286h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm0 2.286h1.143a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-1.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-9.143 9.143h10.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571H17.143a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-4.572 0h2.286a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-2.286a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm9.143 4.571h5.714a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-5.714a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Zm-9.143 0h6.857a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-6.857a.571.571 0 0 1-.571-.57a.571.571 0 0 1 .571-.572Zm0-16H16a.571.571 0 0 1 .571.571A.571.571 0 0 1 16 12h-3.429a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.572Zm0 2.286H16a.571.571 0 0 1 .571.571a.571.571 0 0 1-.571.571h-3.429a.571.571 0 0 1-.571-.571a.571.571 0 0 1 .571-.571Z" opacity=".5"/>`}})),BV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypePython0" x1="-133.268" x2="-133.198" y1="-202.91" y2="-202.84" gradientTransform="matrix(189.38 0 0 189.81 25243.061 38519.17)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#387eb8"/><stop offset="1" stop-color="#366994"/></linearGradient><linearGradient id="vscodeIconsFileTypePython1" x1="-133.575" x2="-133.495" y1="-203.203" y2="-203.133" gradientTransform="matrix(189.38 0 0 189.81 25309.061 38583.42)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ffe052"/><stop offset="1" stop-color="#ffc331"/></linearGradient></defs><path fill="url(#vscodeIconsFileTypePython0)" d="M15.885 2.1c-7.1 0-6.651 3.07-6.651 3.07v3.19h6.752v1H6.545S2 8.8 2 16.005s4.013 6.912 4.013 6.912H8.33v-3.361s-.13-4.013 3.9-4.013h6.762s3.772.06 3.772-3.652V5.8s.572-3.712-6.842-3.712Zm-3.732 2.137a1.214 1.214 0 1 1-1.183 1.244v-.02a1.214 1.214 0 0 1 1.214-1.214Z"/><path fill="url(#vscodeIconsFileTypePython1)" d="M16.085 29.91c7.1 0 6.651-3.08 6.651-3.08v-3.18h-6.751v-1h9.47S30 23.158 30 15.995s-4.013-6.912-4.013-6.912H23.64V12.4s.13 4.013-3.9 4.013h-6.765S9.2 16.356 9.2 20.068V26.2s-.572 3.712 6.842 3.712h.04Zm3.732-2.147A1.214 1.214 0 1 1 21 26.519v.03a1.214 1.214 0 0 1-1.214 1.214h.03Z"/>`}})),VV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<circle cx="16" cy="15.974" r="2.5" fill="#00d8ff"/><path fill="#00d8ff" d="M16 21.706a28.385 28.385 0 0 1-8.88-1.2a11.3 11.3 0 0 1-3.657-1.958A3.543 3.543 0 0 1 2 15.974c0-1.653 1.816-3.273 4.858-4.333A28.755 28.755 0 0 1 16 10.293a28.674 28.674 0 0 1 9.022 1.324a11.376 11.376 0 0 1 3.538 1.866A3.391 3.391 0 0 1 30 15.974c0 1.718-2.03 3.459-5.3 4.541a28.8 28.8 0 0 1-8.7 1.191Zm0-10.217a27.948 27.948 0 0 0-8.749 1.282c-2.8.977-4.055 2.313-4.055 3.2c0 .928 1.349 2.387 4.311 3.4A27.21 27.21 0 0 0 16 20.51a27.6 27.6 0 0 0 8.325-1.13C27.4 18.361 28.8 16.9 28.8 15.974a2.327 2.327 0 0 0-1.01-1.573a10.194 10.194 0 0 0-3.161-1.654A27.462 27.462 0 0 0 16 11.489Z"/><path fill="#00d8ff" d="M10.32 28.443a2.639 2.639 0 0 1-1.336-.328c-1.432-.826-1.928-3.208-1.327-6.373a28.755 28.755 0 0 1 3.4-8.593a28.676 28.676 0 0 1 5.653-7.154a11.376 11.376 0 0 1 3.384-2.133a3.391 3.391 0 0 1 2.878 0c1.489.858 1.982 3.486 1.287 6.859a28.806 28.806 0 0 1-3.316 8.133a28.385 28.385 0 0 1-5.476 7.093a11.3 11.3 0 0 1-3.523 2.189a4.926 4.926 0 0 1-1.624.307Zm1.773-14.7a27.948 27.948 0 0 0-3.26 8.219c-.553 2.915-.022 4.668.75 5.114c.8.463 2.742.024 5.1-2.036a27.209 27.209 0 0 0 5.227-6.79a27.6 27.6 0 0 0 3.181-7.776c.654-3.175.089-5.119-.713-5.581a2.327 2.327 0 0 0-1.868.089A10.194 10.194 0 0 0 17.5 6.9a27.464 27.464 0 0 0-5.4 6.849Z"/><path fill="#00d8ff" d="M21.677 28.456c-1.355 0-3.076-.82-4.868-2.361a28.756 28.756 0 0 1-5.747-7.237a28.676 28.676 0 0 1-3.374-8.471a11.376 11.376 0 0 1-.158-4A3.391 3.391 0 0 1 8.964 3.9c1.487-.861 4.01.024 6.585 2.31a28.8 28.8 0 0 1 5.39 6.934a28.384 28.384 0 0 1 3.41 8.287a11.3 11.3 0 0 1 .137 4.146a3.543 3.543 0 0 1-1.494 2.555a2.59 2.59 0 0 1-1.315.324Zm-9.58-10.2a27.949 27.949 0 0 0 5.492 6.929c2.249 1.935 4.033 2.351 4.8 1.9c.8-.465 1.39-2.363.782-5.434A27.212 27.212 0 0 0 19.9 13.74a27.6 27.6 0 0 0-5.145-6.64c-2.424-2.152-4.39-2.633-5.191-2.169a2.327 2.327 0 0 0-.855 1.662a10.194 10.194 0 0 0 .153 3.565a27.465 27.465 0 0 0 3.236 8.1Z"/>`}})),HV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<circle cx="16" cy="15.974" r="2.5" fill="#007acc"/><path fill="#007acc" d="M16 21.706a28.385 28.385 0 0 1-8.88-1.2a11.3 11.3 0 0 1-3.657-1.958A3.543 3.543 0 0 1 2 15.974c0-1.653 1.816-3.273 4.858-4.333A28.755 28.755 0 0 1 16 10.293a28.674 28.674 0 0 1 9.022 1.324a11.376 11.376 0 0 1 3.538 1.866A3.391 3.391 0 0 1 30 15.974c0 1.718-2.03 3.459-5.3 4.541a28.8 28.8 0 0 1-8.7 1.191Zm0-10.217a27.948 27.948 0 0 0-8.749 1.282c-2.8.977-4.055 2.313-4.055 3.2c0 .928 1.349 2.387 4.311 3.4A27.21 27.21 0 0 0 16 20.51a27.6 27.6 0 0 0 8.325-1.13C27.4 18.361 28.8 16.9 28.8 15.974a2.327 2.327 0 0 0-1.01-1.573a10.194 10.194 0 0 0-3.161-1.654A27.462 27.462 0 0 0 16 11.489Z"/><path fill="#007acc" d="M10.32 28.443a2.639 2.639 0 0 1-1.336-.328c-1.432-.826-1.928-3.208-1.327-6.373a28.755 28.755 0 0 1 3.4-8.593a28.676 28.676 0 0 1 5.653-7.154a11.376 11.376 0 0 1 3.384-2.133a3.391 3.391 0 0 1 2.878 0c1.489.858 1.982 3.486 1.287 6.859a28.806 28.806 0 0 1-3.316 8.133a28.385 28.385 0 0 1-5.476 7.093a11.3 11.3 0 0 1-3.523 2.189a4.926 4.926 0 0 1-1.624.307Zm1.773-14.7a27.948 27.948 0 0 0-3.26 8.219c-.553 2.915-.022 4.668.75 5.114c.8.463 2.742.024 5.1-2.036a27.209 27.209 0 0 0 5.227-6.79a27.6 27.6 0 0 0 3.181-7.776c.654-3.175.089-5.119-.713-5.581a2.327 2.327 0 0 0-1.868.089A10.194 10.194 0 0 0 17.5 6.9a27.464 27.464 0 0 0-5.4 6.849Z"/><path fill="#007acc" d="M21.677 28.456c-1.355 0-3.076-.82-4.868-2.361a28.756 28.756 0 0 1-5.747-7.237a28.676 28.676 0 0 1-3.374-8.471a11.376 11.376 0 0 1-.158-4A3.391 3.391 0 0 1 8.964 3.9c1.487-.861 4.01.024 6.585 2.31a28.8 28.8 0 0 1 5.39 6.934a28.384 28.384 0 0 1 3.41 8.287a11.3 11.3 0 0 1 .137 4.146a3.543 3.543 0 0 1-1.494 2.555a2.59 2.59 0 0 1-1.315.324Zm-9.58-10.2a27.949 27.949 0 0 0 5.492 6.929c2.249 1.935 4.033 2.351 4.8 1.9c.8-.465 1.39-2.363.782-5.434A27.212 27.212 0 0 0 19.9 13.74a27.6 27.6 0 0 0-5.145-6.64c-2.424-2.152-4.39-2.633-5.191-2.169a2.327 2.327 0 0 0-.855 1.662a10.194 10.194 0 0 0 .153 3.565a27.465 27.465 0 0 0 3.236 8.1Z"/>`}})),UV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeRuby0" x1="-235.957" x2="-235.986" y1="-308.579" y2="-308.527" gradientTransform="matrix(202.935 0 0 -202.78 47910.461 -62541.16)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fb7655"/><stop offset=".41" stop-color="#e42b1e"/><stop offset=".99" stop-color="#900"/><stop offset="1" stop-color="#900"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby1" x1="-235.571" x2="-235.697" y1="-309.087" y2="-309.041" gradientTransform="matrix(60.308 0 0 -111.778 14236.351 -34525.395)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#871101"/><stop offset=".99" stop-color="#911209"/><stop offset="1" stop-color="#911209"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby2" x1="-235.896" x2="-235.937" y1="-313.362" y2="-313.129" gradientTransform="matrix(188.32 0 0 -21.986 44447.302 -6856.882)" href="#vscodeIconsFileTypeRuby1"/><linearGradient id="vscodeIconsFileTypeRuby3" x1="-233.515" x2="-233.497" y1="-309.082" y2="-309.161" gradientTransform="matrix(65.222 0 0 -97.1 15237.802 -29991.814)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".23" stop-color="#e57252"/><stop offset=".46" stop-color="#de3b20"/><stop offset=".99" stop-color="#a60003"/><stop offset="1" stop-color="#a60003"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby4" x1="-235.314" x2="-235.31" y1="-309.534" y2="-309.607" gradientTransform="matrix(105.32 0 0 -106.825 24798.925 -33053.152)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".23" stop-color="#e4714e"/><stop offset=".56" stop-color="#be1a0d"/><stop offset=".99" stop-color="#a80d00"/><stop offset="1" stop-color="#a80d00"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby5" x1="-235.882" x2="-235.869" y1="-311.851" y2="-311.935" gradientTransform="matrix(94.321 0 0 -66.418 22271.499 -20707.004)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".18" stop-color="#e46342"/><stop offset=".4" stop-color="#c82410"/><stop offset=".99" stop-color="#a80d00"/><stop offset="1" stop-color="#a80d00"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby6" x1="-235.412" x2="-235.333" y1="-321.074" y2="-320.958" gradientTransform="matrix(70.767 0 0 -24.301 16678.116 -7798.647)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".54" stop-color="#c81f11"/><stop offset=".99" stop-color="#bf0905"/><stop offset="1" stop-color="#bf0905"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby7" x1="-223.821" x2="-223.796" y1="-310.116" y2="-310.18" gradientTransform="matrix(18.177 0 0 -72.645 4071.017 -22510.233)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"/><stop offset=".31" stop-color="#de4024"/><stop offset=".99" stop-color="#bf190b"/><stop offset="1" stop-color="#bf190b"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby8" x1="-235.561" x2="-235.424" y1="-309.258" y2="-309.116" gradientTransform="matrix(158.162 0 0 -157.937 37256.313 -48819.382)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#bd0012"/><stop offset=".07" stop-color="#fff"/><stop offset=".17" stop-color="#fff"/><stop offset=".27" stop-color="#c82f1c"/><stop offset=".33" stop-color="#820c01"/><stop offset=".46" stop-color="#a31601"/><stop offset=".72" stop-color="#b31301"/><stop offset=".99" stop-color="#e82609"/><stop offset="1" stop-color="#e82609"/></linearGradient><linearGradient id="vscodeIconsFileTypeRuby9" x1="-235.424" x2="-235.476" y1="-309.143" y2="-309.126" gradientTransform="matrix(127.074 0 0 -97.409 29932.229 -30086.947)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8c0c01"/><stop offset=".54" stop-color="#990c00"/><stop offset=".99" stop-color="#a80d0e"/><stop offset="1" stop-color="#a80d0e"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubya" x1="-235.839" x2="-235.901" y1="-309.604" y2="-309.555" gradientTransform="matrix(94.011 0 0 -105.603 22198.743 -32676.856)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7e110b"/><stop offset=".99" stop-color="#9e0c00"/><stop offset="1" stop-color="#9e0c00"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubyb" x1="-235.854" x2="-235.891" y1="-311.24" y2="-311.202" gradientTransform="matrix(79.702 0 0 -81.791 18827.397 -25447.905)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#79130d"/><stop offset=".99" stop-color="#9e120b"/><stop offset="1" stop-color="#9e120b"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubyc" x1="-231.241" x2="-231.299" y1="-309.435" y2="-309.337" gradientTransform="matrix(40.137 0 0 -81.143 9286.998 -25078.589)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#8b2114"/><stop offset=".43" stop-color="#9e100a"/><stop offset=".99" stop-color="#b3100c"/><stop offset="1" stop-color="#b3100c"/></linearGradient><linearGradient id="vscodeIconsFileTypeRubyd" x1="-235.898" x2="-235.831" y1="-317.466" y2="-317.537" gradientTransform="matrix(78.099 0 0 -32.624 18447.361 -10353.553)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#b31000"/><stop offset=".44" stop-color="#910f08"/><stop offset=".99" stop-color="#791c12"/><stop offset="1" stop-color="#791c12"/></linearGradient><radialGradient id="vscodeIconsFileTypeRubye" cx="-235.882" cy="-312.543" r=".076" gradientTransform="matrix(93.113 0 0 -48.655 21986.073 -15193.61)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#a80d00"/><stop offset=".99" stop-color="#7e0e08"/><stop offset="1" stop-color="#7e0e08"/></radialGradient><radialGradient id="vscodeIconsFileTypeRubyf" cx="-235.282" cy="-309.704" r=".097" gradientTransform="matrix(97.434 0 0 -75.848 22937.057 -23467.84)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#a30c00"/><stop offset=".99" stop-color="#800e08"/><stop offset="1" stop-color="#800e08"/></radialGradient></defs><path fill="url(#vscodeIconsFileTypeRuby0)" d="M23.693 20.469L7.707 29.961l20.7-1.4L30 7.685Z"/><path fill="url(#vscodeIconsFileTypeRuby1)" d="m28.44 28.542l-1.779-12.279l-4.846 6.4Z"/><path fill="url(#vscodeIconsFileTypeRuby2)" d="M28.464 28.542L15.43 27.519l-7.654 2.415Z"/><path fill="url(#vscodeIconsFileTypeRuby3)" d="M7.794 29.937L11.05 19.27L3.885 20.8Z"/><path fill="url(#vscodeIconsFileTypeRuby4)" d="m21.813 22.7l-3-11.735L10.243 19Z"/><path fill="url(#vscodeIconsFileTypeRuby5)" d="m29.32 11.127l-8.1-6.619l-2.257 7.3Z"/><path fill="url(#vscodeIconsFileTypeRuby6)" d="m25.53 2.148l-4.767 2.634l-3.007-2.67Z"/><path fill="url(#vscodeIconsFileTypeRuby7)" d="m2 24.38l2-3.642L2.382 16.4Z"/><path fill="#fff" d="m2.274 16.263l1.626 4.61l7.062-1.584l8.062-7.489L21.3 4.569l-3.583-2.53l-6.091 2.28C9.706 6.1 5.982 9.635 5.848 9.7s-2.459 4.464-3.574 6.562Z"/><path fill="url(#vscodeIconsFileTypeRuby8)" d="M7.981 7.981C12.14 3.858 17.5 1.421 19.559 3.5s-.124 7.121-4.283 11.244s-9.455 6.69-11.511 4.614s.057-7.258 4.216-11.377Z"/><path fill="url(#vscodeIconsFileTypeRuby9)" d="m7.794 29.933l3.231-10.7l10.729 3.447c-3.879 3.638-8.194 6.713-13.96 7.254Z"/><path fill="url(#vscodeIconsFileTypeRubya)" d="m19.038 11.774l2.754 10.91c3.24-3.407 6.149-7.07 7.573-11.6l-10.328.691Z"/><path fill="url(#vscodeIconsFileTypeRubyb)" d="M29.337 11.139c1.1-3.327 1.357-8.1-3.841-8.985l-4.265 2.355l8.106 6.629Z"/><path fill="#9e1209" d="M2 24.332c.153 5.49 4.114 5.572 5.8 5.62l-3.9-9.1l-1.9 3.48Z"/><path fill="url(#vscodeIconsFileTypeRubye)" d="M19.053 11.791c2.49 1.531 7.509 4.6 7.61 4.661a17.552 17.552 0 0 0 2.619-5.343l-10.229.683Z"/><path fill="url(#vscodeIconsFileTypeRubyf)" d="m11.021 19.232l4.319 8.332a27.924 27.924 0 0 0 6.385-4.88l-10.7-3.452Z"/><path fill="url(#vscodeIconsFileTypeRubyc)" d="m3.887 20.861l-.612 7.287c1.155 1.577 2.743 1.714 4.409 1.591c-1.205-3-3.614-9-3.8-8.878Z"/><path fill="url(#vscodeIconsFileTypeRubyd)" d="m21.206 4.528l8.58 1.2c-.458-1.94-1.864-3.192-4.261-3.584l-4.319 2.38Z"/>`}})),WV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><radialGradient id="vscodeIconsFileTypeRust0" cx="-492.035" cy="-883.37" r="13.998" gradientTransform="matrix(.866 -.5 -.3 -.52 177.106 -689.033)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7d7d7d"/><stop offset=".267" stop-color="#7e7c7a"/><stop offset=".45" stop-color="#817871"/><stop offset=".608" stop-color="#867162"/><stop offset=".753" stop-color="#8d684c"/><stop offset=".886" stop-color="#965c30"/><stop offset="1" stop-color="#a04f12"/></radialGradient></defs><path fill="url(#vscodeIconsFileTypeRust0)" d="M15.124 5.3a.832.832 0 1 1 .832.832a.831.831 0 0 1-.832-.832M5.2 12.834a.832.832 0 1 1 .832.832a.832.832 0 0 1-.832-.832m19.856.039a.832.832 0 1 1 .832.832a.831.831 0 0 1-.832-.832m-17.451 1.14a.76.76 0 0 0 .386-1l-.369-.835h1.452v6.545h-2.93a10.247 10.247 0 0 1-.332-3.911Zm6.074.161v-1.929h3.458c.179 0 1.261.206 1.261 1.016c0 .672-.83.913-1.513.913ZM8.958 24.561a.832.832 0 1 1 .832.832a.831.831 0 0 1-.832-.832m12.331.039a.832.832 0 1 1 .832.832a.832.832 0 0 1-.832-.832m.257-1.887a.758.758 0 0 0-.9.584l-.418 1.949a10.249 10.249 0 0 1-8.545-.041l-.417-1.949a.759.759 0 0 0-.9-.583l-1.721.37a10.233 10.233 0 0 1-.89-1.049h8.374c.095 0 .158-.017.158-.1v-2.966c0-.086-.063-.1-.158-.1h-2.45v-1.881h2.649a1.665 1.665 0 0 1 1.629 1.412c.105.413.336 1.757.494 2.187c.157.483.8 1.447 1.482 1.447h4.323a10.243 10.243 0 0 1-.949 1.1Zm4.65-7.821a10.261 10.261 0 0 1 .022 1.779h-1.051c-.105 0-.148.069-.148.172v.483c0 1.136-.641 1.384-1.2 1.447c-.535.06-1.128-.224-1.2-.551a3.616 3.616 0 0 0-1.671-2.808c1.03-.654 2.1-1.619 2.1-2.911A3.292 3.292 0 0 0 21.44 9.8a4.559 4.559 0 0 0-2.2-.724H8.367A10.246 10.246 0 0 1 14.1 5.84l1.282 1.344a.758.758 0 0 0 1.072.026l1.434-1.372a10.248 10.248 0 0 1 7.015 5l-.982 2.217a.761.761 0 0 0 .386 1Zm2.448.036l-.033-.343l1.011-.943a.42.42 0 0 0-.013-.595a.428.428 0 0 0-.121-.081l-1.288-.483l-.1-.334l.806-1.12a.422.422 0 0 0-.13-.581a.43.43 0 0 0-.133-.055l-1.363-.222l-.164-.306l.573-1.257a.419.419 0 0 0-.236-.544a.426.426 0 0 0-.146-.029l-1.383.048l-.224-.264l.318-1.347a.421.421 0 0 0-.343-.487a.435.435 0 0 0-.144 0l-1.348.315l-.266-.219l.049-1.381a.421.421 0 0 0-.431-.411a.426.426 0 0 0-.141.028l-1.257.573l-.306-.164l-.222-1.363a.421.421 0 0 0-.5-.318a.43.43 0 0 0-.133.055l-1.121.806l-.333-.1l-.483-1.293a.421.421 0 0 0-.555-.215a.442.442 0 0 0-.12.08l-.946 1.012l-.343-.033l-.728-1.177a.421.421 0 0 0-.688 0l-.728 1.177l-.343.033l-.943-1.012a.421.421 0 0 0-.595.015a.442.442 0 0 0-.08.12L12.483 3.8l-.333.1l-1.12-.8a.422.422 0 0 0-.581.13a.43.43 0 0 0-.055.133l-.222 1.363l-.306.164l-1.258-.573a.421.421 0 0 0-.544.239a.444.444 0 0 0-.028.144l.048 1.383l-.266.217l-1.347-.316a.421.421 0 0 0-.487.343a.435.435 0 0 0 0 .144L6.3 7.819l-.218.265L4.7 8.036a.422.422 0 0 0-.383.573l.573 1.257l-.164.306l-1.363.222a.42.42 0 0 0-.318.5a.43.43 0 0 0 .055.133l.806 1.12l-.1.334l-1.293.483a.421.421 0 0 0-.215.555a.414.414 0 0 0 .081.121l1.011.943l-.033.343l-1.177.728a.421.421 0 0 0 0 .688l1.177.728l.033.343l-1.011.943a.421.421 0 0 0 .015.595a.436.436 0 0 0 .119.08l1.293.483l.1.334l-.806 1.124a.421.421 0 0 0 .131.581a.43.43 0 0 0 .133.055l1.363.222l.164.307l-.573 1.257a.422.422 0 0 0 .24.545a.438.438 0 0 0 .143.028l1.383-.048l.219.266l-.317 1.348a.42.42 0 0 0 .341.486a.4.4 0 0 0 .146 0l1.345-.319l.266.218l-.049 1.382a.419.419 0 0 0 .429.41a.413.413 0 0 0 .143-.028l1.257-.573l.306.164l.222 1.362a.421.421 0 0 0 .5.319a.407.407 0 0 0 .133-.055l1.12-.807l.334.1l.483 1.292a.422.422 0 0 0 .556.214a.436.436 0 0 0 .119-.08l.943-1.011l.343.034l.728 1.177a.422.422 0 0 0 .588.1a.413.413 0 0 0 .1-.1l.728-1.177l.343-.034l.943 1.011a.421.421 0 0 0 .595-.015a.436.436 0 0 0 .08-.119l.483-1.292l.334-.1l1.12.807a.421.421 0 0 0 .581-.131a.43.43 0 0 0 .055-.133l.222-1.362l.306-.164l1.257.573a.421.421 0 0 0 .544-.239a.438.438 0 0 0 .028-.143l-.048-1.384l.265-.218l1.347.317a.421.421 0 0 0 .487-.34a.447.447 0 0 0 0-.146l-.309-1.346l.218-.266l1.383.048a.421.421 0 0 0 .41-.431a.4.4 0 0 0-.028-.142l-.573-1.257l.164-.307l1.363-.222a.421.421 0 0 0 .319-.5a.434.434 0 0 0-.056-.135l-.806-1.12l.1-.334l1.293-.483a.42.42 0 0 0 .215-.554a.414.414 0 0 0-.081-.121l-1.011-.943l.033-.343l1.177-.728a.421.421 0 0 0 0-.688Z"/>`}})),GV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#cd6799" d="M26.11 17.572a5.8 5.8 0 0 0-2.537.588a5.345 5.345 0 0 1-.568-1.314a3.53 3.53 0 0 1-.051-1.1a9.811 9.811 0 0 1 .332-1.192c-.005-.051-.061-.292-.624-.3s-1.048.107-1.1.256a6.171 6.171 0 0 0-.235.834a19.686 19.686 0 0 1-1.713 3.294a3.186 3.186 0 0 1-.44-2.066a9.811 9.811 0 0 1 .332-1.192c-.005-.051-.061-.292-.624-.3s-1.048.107-1.1.256s-.118.5-.235.834s-1.483 3.386-1.841 4.173c-.184.4-.343.726-.455.946a.233.233 0 0 1-.02.041l-.153.292v.005c-.077.138-.159.266-.2.266a1.711 1.711 0 0 1 .01-.869c.2-1.059.69-2.705.685-2.762c0-.031.092-.317-.317-.465a.508.508 0 0 0-.578.1c-.036 0-.061.087-.061.087s.445-1.851-.849-1.851a3.855 3.855 0 0 0-2.475 1.683c-.348.189-1.089.593-1.882 1.028c-.3.169-.614.338-.905.5c-.02-.02-.041-.046-.061-.066C6.87 17.6 3.975 16.416 4.1 14.171c.046-.818.327-2.966 5.559-5.575c4.306-2.122 7.733-1.534 8.326-.23c.849 1.862-1.836 5.319-6.285 5.82a3.351 3.351 0 0 1-2.813-.711c-.235-.256-.271-.271-.358-.22c-.143.077-.051.307 0 .44a2.626 2.626 0 0 0 1.606 1.263a8.55 8.55 0 0 0 5.217-.517c2.7-1.043 4.8-3.943 4.184-6.372c-.619-2.465-4.71-3.278-8.582-1.9a19.5 19.5 0 0 0-6.595 3.783c-2.133 1.995-2.47 3.728-2.332 4.455c.5 2.578 4.051 4.255 5.472 5.5a8.554 8.554 0 0 1-.194.107c-.711.353-3.421 1.77-4.1 3.268c-.767 1.7.123 2.915.711 3.079a4.374 4.374 0 0 0 4.71-1.908a4.725 4.725 0 0 0 .423-4.353a.107.107 0 0 0-.02-.031l.557-.327a27.2 27.2 0 0 1 1.028-.578a6.74 6.74 0 0 0-.363 1.862a3.886 3.886 0 0 0 .834 2.7a.921.921 0 0 0 .675.22c.6 0 .875-.5 1.176-1.094c.368-.726.7-1.57.7-1.57s-.414 2.281.711 2.281c.409 0 .823-.532 1.008-.8v.005l.031-.051l.066-.107v-.01c.164-.286.532-.936 1.079-2.015c.706-1.391 1.386-3.13 1.386-3.13a8.888 8.888 0 0 0 .271 1.13a10.643 10.643 0 0 0 .583 1.309c-.164.23-.266.358-.266.358l.005.005c-.133.174-.276.363-.435.547a16.3 16.3 0 0 0-1.314 1.647a.447.447 0 0 0 .123.6a1.116 1.116 0 0 0 .685.113a3.147 3.147 0 0 0 1.028-.235a3.45 3.45 0 0 0 .885-.465a1.98 1.98 0 0 0 .849-1.744a3.521 3.521 0 0 0-.322-1.233c.051-.072.1-.143.148-.215a23.428 23.428 0 0 0 1.534-2.649a8.888 8.888 0 0 0 .271 1.13a7.57 7.57 0 0 0 .5 1.125a4.861 4.861 0 0 0-1.497 1.922c-.322.931-.072 1.35.4 1.447a1.425 1.425 0 0 0 .747-.153a3.4 3.4 0 0 0 .946-.486a2.126 2.126 0 0 0 1.043-1.729a3.268 3.268 0 0 0-.235-1.023a5.356 5.356 0 0 1 2.716-.312c2.434.286 2.915 1.805 2.823 2.445a1.618 1.618 0 0 1-.772 1.094c-.169.107-.225.143-.21.22c.02.113.1.107.245.087A1.9 1.9 0 0 0 30 20.7c.077-1.5-1.355-3.145-3.887-3.13ZM7.33 23.9c-.808.88-1.933 1.212-2.419.931c-.522-.3-.317-1.6.675-2.532a12.884 12.884 0 0 1 1.9-1.417c.118-.072.292-.174.5-.3l.056-.031l.123-.077A3.493 3.493 0 0 1 7.33 23.9Zm5.881-4c-.281.685-.869 2.44-1.227 2.342c-.307-.082-.5-1.412-.061-2.726a6.193 6.193 0 0 1 .956-1.754c.44-.491.926-.655 1.043-.455a9.062 9.062 0 0 1-.711 2.593Zm4.853 2.322c-.118.061-.23.1-.281.072c-.036-.02.051-.1.051-.1s.609-.655.849-.951c.138-.174.3-.378.476-.609v.066c0 .782-.757 1.309-1.094 1.524Zm3.744-.854c-.087-.061-.072-.266.22-.905a3.408 3.408 0 0 1 .834-1.074a1.448 1.448 0 0 1 .082.471a1.547 1.547 0 0 1-1.135 1.509Z"/>`}})),KV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#d9b400" d="M29.4 27.6H2.5V4.5h26.9Zm-25.9-1h24.9V5.5H3.5Z"/><path fill="#d9b400" d="m6.077 19.316l-.555-.832l4.844-3.229l-4.887-4.071l.641-.768l5.915 4.928l-5.958 3.972zM12.7 18.2h7.8v1h-7.8zM2.5 5.5h26.9v1.9H2.5z"/>`}})),qV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ffda44" d="M8.562 15.256A21.159 21.159 0 0 0 16 16.449a21.159 21.159 0 0 0 7.438-1.194c1.864-.727 2.525-1.535 2.525-2V9.7a10.357 10.357 0 0 1-2.084 1.076A22.293 22.293 0 0 1 16 12.078a22.36 22.36 0 0 1-7.879-1.3A10.28 10.28 0 0 1 6.037 9.7v3.55c0 .474.663 1.278 2.525 2.006Zm0 6.705a15.611 15.611 0 0 0 2.6.741a24.9 24.9 0 0 0 4.838.453a24.9 24.9 0 0 0 4.838-.452a15.614 15.614 0 0 0 2.6-.741c1.864-.727 2.525-1.535 2.525-2v-3.39a10.706 10.706 0 0 1-1.692.825A23.49 23.49 0 0 1 16 18.74a23.49 23.49 0 0 1-8.271-1.348a10.829 10.829 0 0 1-1.692-.825v3.393c0 .466.663 1.271 2.525 2.001ZM16 30c5.5 0 9.963-1.744 9.963-3.894v-2.837a10.5 10.5 0 0 1-1.535.762l-.157.063A23.487 23.487 0 0 1 16 25.445a23.422 23.422 0 0 1-8.271-1.351c-.054-.02-.106-.043-.157-.063a10.5 10.5 0 0 1-1.535-.762v2.837C6.037 28.256 10.5 30 16 30Z"/><ellipse cx="16" cy="5.894" fill="#ffda44" rx="9.963" ry="3.894"/>`}})),JV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ff3e00" d="M26.47 5.7a8.973 8.973 0 0 0-11.793-2.454L7.96 7.4a7.461 7.461 0 0 0-3.481 5.009a7.686 7.686 0 0 0 .8 5.058a7.358 7.358 0 0 0-1.151 2.8a7.789 7.789 0 0 0 1.4 6.028a8.977 8.977 0 0 0 11.794 2.458L24.04 24.6a7.468 7.468 0 0 0 3.481-5.009a7.673 7.673 0 0 0-.8-5.062a7.348 7.348 0 0 0 1.152-2.8A7.785 7.785 0 0 0 26.47 5.7"/><path fill="#fff" d="M14.022 26.64A5.413 5.413 0 0 1 8.3 24.581a4.678 4.678 0 0 1-.848-3.625a4.307 4.307 0 0 1 .159-.61l.127-.375l.344.238a8.76 8.76 0 0 0 2.628 1.274l.245.073l-.025.237a1.441 1.441 0 0 0 .271.968a1.63 1.63 0 0 0 1.743.636a1.512 1.512 0 0 0 .411-.175l6.7-4.154a1.366 1.366 0 0 0 .633-.909a1.407 1.407 0 0 0-.244-1.091a1.634 1.634 0 0 0-1.726-.622a1.509 1.509 0 0 0-.413.176l-2.572 1.584a4.934 4.934 0 0 1-1.364.582a5.415 5.415 0 0 1-5.727-2.06a4.678 4.678 0 0 1-.831-3.628A4.507 4.507 0 0 1 9.9 10.09l6.708-4.154a4.932 4.932 0 0 1 1.364-.581A5.413 5.413 0 0 1 23.7 7.414a4.679 4.679 0 0 1 .848 3.625a4.272 4.272 0 0 1-.159.61l-.127.375l-.344-.237a8.713 8.713 0 0 0-2.628-1.274l-.245-.074l.025-.237a1.438 1.438 0 0 0-.272-.968a1.629 1.629 0 0 0-1.725-.622a1.484 1.484 0 0 0-.411.176l-6.722 4.14a1.353 1.353 0 0 0-.631.908a1.394 1.394 0 0 0 .244 1.092a1.634 1.634 0 0 0 1.726.621a1.538 1.538 0 0 0 .413-.175l2.562-1.585a4.9 4.9 0 0 1 1.364-.581a5.417 5.417 0 0 1 5.728 2.059a4.681 4.681 0 0 1 .843 3.625a4.5 4.5 0 0 1-2.089 3.013l-6.707 4.154a4.9 4.9 0 0 1-1.364.581"/>`}})),YV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M7.674 14.488a2.218 2.218 0 1 0 0 3.137h16.652a2.218 2.218 0 1 0 0-3.137Z"/><path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M11.222 9.06A2.218 2.218 0 1 0 9 11.278l11.778 11.774A2.218 2.218 0 1 0 23 20.834Z"/><path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M17.568 7.73a2.218 2.218 0 1 0-3.137 0v16.652a2.218 2.218 0 1 0 3.137 0Z"/><path fill="#ffb13b" stroke="#000" stroke-width="3.73" d="M23 11.278a2.218 2.218 0 1 0-2.222-2.218L9 20.834a2.218 2.218 0 1 0 2.218 2.218Z"/><path fill="#ffb13b" d="M7.674 14.488a2.218 2.218 0 1 0 0 3.137h16.652a2.218 2.218 0 1 0 0-3.137Z"/><path fill="#ffb13b" d="M11.222 9.06A2.218 2.218 0 1 0 9 11.278l11.778 11.774A2.218 2.218 0 1 0 23 20.834Z"/><path fill="#ffb13b" d="M17.568 7.73a2.218 2.218 0 1 0-3.137 0v16.652a2.218 2.218 0 1 0 3.137 0Z"/><path fill="#ffb13b" d="M23 11.278a2.218 2.218 0 1 0-2.222-2.218L9 20.834a2.218 2.218 0 1 0 2.218 2.218Z"/><path d="M2 16.056h28v9.894a4.035 4.035 0 0 1-4.106 4.106H6.106A4.035 4.035 0 0 1 2 25.95Z"/><path fill="#fff" d="M6.2 23.045a3.628 3.628 0 1 1 6.2-2.565h-2.13a1.5 1.5 0 1 0-2.57 1.061a1.6 1.6 0 0 0 1.062.441a4.118 4.118 0 0 1 2.566 1.063a3.628 3.628 0 1 1-6.194 2.565h2.13a1.5 1.5 0 1 0 2.566-1.06a1.948 1.948 0 0 0-1.063-.44A4.465 4.465 0 0 1 6.2 23.045Zm13.451-6.193L17.085 29.24H14.96L12.4 16.852h2.12l1.5 7.255l1.5-7.255Zm3.629 5.131h3.628v3.628a3.628 3.628 0 1 1-7.257 0V20.48a3.628 3.628 0 0 1 7.257 0h-2.125a1.5 1.5 0 1 0-3.005 0v5.13a1.5 1.5 0 0 0 3.005 0v-1.5h-1.5v-2.127Z"/>`}})),XV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeSwift0" x1="-134.494" x2="-134.497" y1="-171.82" y2="-171.89" gradientTransform="matrix(240 0 0 -205.6 32295 -35312.585)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f88535"/><stop offset="1" stop-color="#fd2221"/></linearGradient></defs><path fill="url(#vscodeIconsFileTypeSwift0)" d="M19.422 4.007s6.217 3.554 7.844 9.2c1.466 5.1.292 7.534.292 7.534a8.915 8.915 0 0 1 1.742 2.8a4.825 4.825 0 0 1 .29 4.453s-.1-2.08-3.2-2.511c-2.841-.4-3.874 2.366-9.3 2.232A18.435 18.435 0 0 1 2 19.354C4.651 20.8 8.124 23.045 12.449 22.7s5.228-1.674 5.228-1.674A66.9 66.9 0 0 1 4.891 7.643c3.4 2.845 11.822 8.507 11.626 8.363A75.826 75.826 0 0 1 8.092 6.24s12.636 10.389 13.653 10.323c.418-.861 2.579-5.318-2.324-12.557Z"/>`}})),ZV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#44a8b3" d="M9 13.7q1.4-5.6 7-5.6c5.6 0 6.3 4.2 9.1 4.9q2.8.7 4.9-2.1q-1.4 5.6-7 5.6c-5.6 0-6.3-4.2-9.1-4.9q-2.8-.7-4.9 2.1Zm-7 8.4q1.4-5.6 7-5.6c5.6 0 6.3 4.2 9.1 4.9q2.8.7 4.9-2.1q-1.4 5.6-7 5.6c-5.6 0-6.3-4.2-9.1-4.9q-2.8-.7-4.9 2.1Z"/>`}})),QV=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#c2c2c2" d="M22.038 2H6.375a1.755 1.755 0 0 0-1.75 1.75v24.5A1.755 1.755 0 0 0 6.375 30h19.25a1.755 1.755 0 0 0 1.75-1.75V6.856Zm.525 2.844l1.663 1.531h-1.663ZM6.375 28.25V3.75h14.438v4.375h4.813V28.25Z"/><path fill="#829ec2" d="M8.125 15.097h13.076v1.75H8.125zm0 9.342h9.762v1.75H8.125zm0-4.676h15.75v1.75H8.125zm0-9.533h15.75v1.75H8.125z"/>`}})),$V=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#7f7f7f" d="M22.76 6.83v3.25h-5v15.09h-3.5V10.08h-5V6.83Z"/><path fill="#bfbfbf" d="M2 2h6.2v3.09H5.34v21.8H8.2V30H2Zm28 28h-6.2v-3.09h2.86V5.11H23.8V2H30Z"/>`}})),eH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#007acc" d="M23.827 8.243a4.424 4.424 0 0 1 2.223 1.281a5.853 5.853 0 0 1 .852 1.143c.011.045-1.534 1.083-2.471 1.662c-.034.023-.169-.124-.322-.35a2.014 2.014 0 0 0-1.67-1c-1.077-.074-1.771.49-1.766 1.433a1.3 1.3 0 0 0 .153.666c.237.49.677.784 2.059 1.383c2.544 1.1 3.636 1.817 4.31 2.843a5.158 5.158 0 0 1 .416 4.333a4.764 4.764 0 0 1-3.932 2.815a10.9 10.9 0 0 1-2.708-.028a6.531 6.531 0 0 1-3.616-1.884a6.278 6.278 0 0 1-.926-1.371a2.655 2.655 0 0 1 .327-.208c.158-.09.756-.434 1.32-.761l1.024-.6l.214.312a4.771 4.771 0 0 0 1.35 1.292a3.3 3.3 0 0 0 3.458-.175a1.545 1.545 0 0 0 .2-1.974c-.276-.4-.84-.727-2.443-1.422a8.8 8.8 0 0 1-3.349-2.055a4.687 4.687 0 0 1-.976-1.777a7.116 7.116 0 0 1-.062-2.268a4.332 4.332 0 0 1 3.644-3.374a9 9 0 0 1 2.691.084Zm-8.343 1.483l.011 1.454h-4.63v13.148H7.6V11.183H2.97V9.755a13.986 13.986 0 0 1 .04-1.466c.017-.023 2.832-.034 6.245-.028l6.211.017Z"/><path fill="#99b8c4" d="m27.075 25.107l.363-.361c1.68.055 1.706 0 1.78-.177l.462-1.124l.034-.107l-.038-.093c-.02-.049-.081-.2-1.13-1.2v-.526c1.211-1.166 1.185-1.226 1.116-1.4l-.46-1.136c-.069-.17-.1-.237-1.763-.191l-.364-.367a8.138 8.138 0 0 0-.057-1.657l-.047-.106l-1.2-.525c-.177-.081-.239-.11-1.372 1.124l-.509-.008c-1.167-1.245-1.222-1.223-1.4-1.152l-1.115.452c-.175.071-.236.1-.169 1.79l-.36.359c-1.68-.055-1.7 0-1.778.177L18.606 20l-.036.108l.038.094c.02.048.078.194 1.13 1.2v.525c-1.211 1.166-1.184 1.226-1.115 1.4l.459 1.137c.07.174.1.236 1.763.192l.363.377a8.169 8.169 0 0 0 .055 1.654l.047.107l1.208.528c.176.073.236.1 1.366-1.13l.509.006c1.168 1.247 1.228 1.223 1.4 1.154l1.113-.45c.176-.075.237-.102.169-1.795Zm-4.788-2.632a2 2 0 1 1 2.618 1.14a2.023 2.023 0 0 1-2.618-1.14Z"/>`}})),tH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#007acc" d="M23.827 8.243a4.424 4.424 0 0 1 2.223 1.281a5.853 5.853 0 0 1 .852 1.143c.011.045-1.534 1.083-2.471 1.662c-.034.023-.169-.124-.322-.35a2.014 2.014 0 0 0-1.67-1c-1.077-.074-1.771.49-1.766 1.433a1.3 1.3 0 0 0 .153.666c.237.49.677.784 2.059 1.383c2.544 1.095 3.636 1.817 4.31 2.843a5.158 5.158 0 0 1 .416 4.333a4.764 4.764 0 0 1-3.932 2.815a10.9 10.9 0 0 1-2.708-.028a6.531 6.531 0 0 1-3.616-1.884a6.278 6.278 0 0 1-.926-1.371a2.655 2.655 0 0 1 .327-.208c.158-.09.756-.434 1.32-.761l1.024-.6l.214.312a4.771 4.771 0 0 0 1.35 1.292a3.3 3.3 0 0 0 3.458-.175a1.545 1.545 0 0 0 .2-1.974c-.276-.395-.84-.727-2.443-1.422a8.8 8.8 0 0 1-3.349-2.055a4.687 4.687 0 0 1-.976-1.777a7.116 7.116 0 0 1-.062-2.268a4.332 4.332 0 0 1 3.644-3.374a9 9 0 0 1 2.691.084Zm-8.343 1.483l.011 1.454h-4.63v13.148H7.6V11.183H2.97V9.755a13.986 13.986 0 0 1 .04-1.466c.017-.023 2.832-.034 6.245-.028l6.211.017Z"/>`}})),nH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#e75749" d="M4.5 2.375A2.562 2.562 0 0 1 5.861 2h20.366a2.545 2.545 0 0 1 2.423 1.951a3.37 3.37 0 0 1 .072.862v11.176h-1.573a1.814 1.814 0 0 0-.22.022a5.236 5.236 0 0 0-.581-.011c-.3.007-.61-.014-.914.014a2.275 2.275 0 0 0-.4-.02h-4.739c-.2 0-.392.008-.587-.01l.1-.065l-6.353-3.813v3.889c-2.213-.005-4.427 0-6.64 0a2.274 2.274 0 0 0-.251.021c-.212-.032-.427-.016-.642-.016c-.284.006-.57-.015-.853.015a2.052 2.052 0 0 0-.253-.022H3.275c.006-3.635 0-7.27 0-10.9a4.786 4.786 0 0 1 .071-1.131A2.541 2.541 0 0 1 4.5 2.375Zm.54 2.188a.639.639 0 0 0-.489.606v1.316a.639.639 0 0 0 .627.6h1.309a.638.638 0 0 0 .6-.608c.005-.426 0-.853 0-1.279a.644.644 0 0 0-.329-.575a.708.708 0 0 0-.358-.078H5.264a1.081 1.081 0 0 0-.224.018Zm20.341 0a.639.639 0 0 0-.474.607v1.306a.638.638 0 0 0 .6.608c.436.005.872 0 1.308 0a.639.639 0 0 0 .627-.606c.006-.438 0-.876 0-1.314a.638.638 0 0 0-.594-.621c-.348-.009-.7 0-1.045 0a1.98 1.98 0 0 0-.422.024ZM5.042 8.38a.637.637 0 0 0-.452.4a1.078 1.078 0 0 0-.041.386v1.135a.637.637 0 0 0 .6.6c.4.008.795 0 1.192 0a.826.826 0 0 0 .395-.065a.641.641 0 0 0 .36-.574V8.983a.638.638 0 0 0-.6-.624c-.338-.008-.677 0-1.016 0a2.385 2.385 0 0 0-.438.021Zm20.338 0a.637.637 0 0 0-.433.4a1.072 1.072 0 0 0-.041.387v1.131a.638.638 0 0 0 .608.607c.406.006.812 0 1.218 0a.739.739 0 0 0 .38-.078a.64.64 0 0 0 .335-.558V8.985a.637.637 0 0 0-.593-.622c-.349-.009-.7 0-1.047 0a1.928 1.928 0 0 0-.428.022ZM5.041 12.2a.639.639 0 0 0-.491.608c0 .438-.005.877 0 1.315a.638.638 0 0 0 .627.6h1.3a.638.638 0 0 0 .608-.607v-1.307a.638.638 0 0 0-.605-.626c-.348-.007-.7 0-1.045 0a2.12 2.12 0 0 0-.394.017Zm20.335.006a.635.635 0 0 0-.43.394a1.06 1.06 0 0 0-.041.386v1.131a.638.638 0 0 0 .607.608c.435.005.87 0 1.306 0a.639.639 0 0 0 .628-.605c.006-.438 0-.876 0-1.313a.637.637 0 0 0-.592-.622c-.349-.01-.7 0-1.046 0a1.908 1.908 0 0 0-.431.015Z"/><path fill="#fff" d="M13.458 12.1q3.176 1.908 6.353 3.813l-.1.065q-3.127 1.872-6.251 3.748V15.99c-.001-1.295-.004-2.59-.002-3.89Z"/><path fill="#c0392b" d="M3.275 15.988h1.541a2.052 2.052 0 0 1 .253.022a.645.645 0 0 0-.409.273a.883.883 0 0 0-.111.518v1.045a.686.686 0 0 0 .685.689h1.192a.68.68 0 0 0 .657-.569c.008-.447 0-.9 0-1.343a.632.632 0 0 0-.521-.613a2.274 2.274 0 0 1 .251-.021h6.64v3.736q3.127-1.871 6.251-3.748c.2.018.391.007.587.01h4.741a2.275 2.275 0 0 1 .4.02a.637.637 0 0 0-.475.385a.983.983 0 0 0-.045.407v1.014a.677.677 0 0 0 .691.719h1.16a.684.684 0 0 0 .686-.658v-.984a1.074 1.074 0 0 0-.1-.589a.642.642 0 0 0-.42-.292a1.814 1.814 0 0 1 .22-.022h1.573c.011 1.721 0 3.443 0 5.165v6.293a2.567 2.567 0 0 1-.612 1.651a2.539 2.539 0 0 1-1.563.868a7.534 7.534 0 0 1-.981.033H6.724a9.27 9.27 0 0 1-1.368-.048a2.557 2.557 0 0 1-2-1.846a2.825 2.825 0 0 1-.09-.746V16.891c.007-.3-.002-.602.009-.903Zm1.795 3.843a.613.613 0 0 0-.386.234a.761.761 0 0 0-.134.464v1.162a.685.685 0 0 0 .686.658h1.283a.687.687 0 0 0 .568-.716v-1.191a.617.617 0 0 0-.2-.458a.712.712 0 0 0-.487-.17H5.264a1.039 1.039 0 0 0-.194.017Zm20.366 0a.62.62 0 0 0-.522.58v1.222a.676.676 0 0 0 .69.718c.428 0 .857.005 1.285 0a.7.7 0 0 0 .562-.684v-1.013a.9.9 0 0 0-.123-.568a.661.661 0 0 0-.532-.267h-.954a2.246 2.246 0 0 0-.406.011ZM5.071 23.648a.609.609 0 0 0-.4.249a.766.766 0 0 0-.124.448v1.132a.7.7 0 0 0 .6.688h1.376a.687.687 0 0 0 .567-.717v-1.189a.617.617 0 0 0-.2-.459a.71.71 0 0 0-.484-.17H5.265a1.028 1.028 0 0 0-.194.018Zm20.362 0a.616.616 0 0 0-.492.427a.99.99 0 0 0-.029.33V25.6a.681.681 0 0 0 .656.567h1.193a.689.689 0 0 0 .686-.719v-1.164a.657.657 0 0 0-.286-.545a1.461 1.461 0 0 0-.787-.11c-.312.01-.629-.02-.94.018Z"/>`}})),rH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<g fill="none"><path fill="url(#vscodeIconsFileTypeVite0)" d="m29.884 6.146l-13.142 23.5a.714.714 0 0 1-1.244.005L2.096 6.148a.714.714 0 0 1 .746-1.057l13.156 2.352a.714.714 0 0 0 .253 0l12.881-2.348a.714.714 0 0 1 .752 1.05z"/><path fill="url(#vscodeIconsFileTypeVite1)" d="M22.264 2.007L12.54 3.912a.357.357 0 0 0-.288.33l-.598 10.104a.357.357 0 0 0 .437.369l2.707-.625a.357.357 0 0 1 .43.42l-.804 3.939a.357.357 0 0 0 .454.413l1.672-.508a.357.357 0 0 1 .454.414l-1.279 6.187c-.08.387.435.598.65.267l.143-.222l7.925-15.815a.357.357 0 0 0-.387-.51l-2.787.537a.357.357 0 0 1-.41-.45l1.818-6.306a.357.357 0 0 0-.412-.45z"/><defs><linearGradient id="vscodeIconsFileTypeVite0" x1="6" x2="235" y1="33" y2="344" gradientTransform="translate(1.34 1.894) scale(.07142)" gradientUnits="userSpaceOnUse"><stop stop-color="#41D1FF"/><stop offset="1" stop-color="#BD34FE"/></linearGradient><linearGradient id="vscodeIconsFileTypeVite1" x1="194.651" x2="236.076" y1="8.818" y2="292.989" gradientTransform="translate(1.34 1.894) scale(.07142)" gradientUnits="userSpaceOnUse"><stop stop-color="#FFEA83"/><stop offset=".083" stop-color="#FFDD35"/><stop offset="1" stop-color="#FFA800"/></linearGradient></defs></g>`}})),iH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#fcc72b" d="m22.86 11.09l-6.55 9.46a.58.58 0 0 1-.28.21a.55.55 0 0 1-.36 0a.56.56 0 0 1-.29-.21a.59.59 0 0 1-.09-.35l.26-5.2l-4.23-.9a.55.55 0 0 1-.24-.12a.5.5 0 0 1-.16-.22a.5.5 0 0 1 0-.27a.46.46 0 0 1 .1-.25l6.54-9.46a.58.58 0 0 1 .29-.22a.53.53 0 0 1 .35 0a.58.58 0 0 1 .29.22a.52.52 0 0 1 .09.34l-.26 5.22l4.23.9a.58.58 0 0 1 .25.12a.69.69 0 0 1 .16.22a.62.62 0 0 1-.06.53Z"/><path fill="#729b1b" d="M16 28.49a1.44 1.44 0 0 1-.5-.1a1.3 1.3 0 0 1-.43-.29l-6.19-6.19A1.28 1.28 0 0 1 8.5 21a1.3 1.3 0 0 1 1.32-1.32a1.32 1.32 0 0 1 .94.38L16 25.29l11.43-11.43a1.32 1.32 0 0 1 .94-.38a1.31 1.31 0 0 1 .93.39a1.29 1.29 0 0 1 .39.93a1.34 1.34 0 0 1-.38.93L16.94 28.1a1.42 1.42 0 0 1-.43.29a1.45 1.45 0 0 1-.51.1Z"/><path fill="#729b1b" fill-opacity=".5" d="M16 28.49a1.44 1.44 0 0 0 .5-.1a1.3 1.3 0 0 0 .43-.29l6.19-6.19a1.28 1.28 0 0 0 .38-.91a1.3 1.3 0 0 0-1.32-1.32a1.32 1.32 0 0 0-.94.38L16 25.29L4.57 13.86a1.32 1.32 0 0 0-.94-.38a1.31 1.31 0 0 0-.93.39a1.29 1.29 0 0 0-.39.93a1.34 1.34 0 0 0 .38.93L15.06 28.1a1.42 1.42 0 0 0 .43.29a1.45 1.45 0 0 0 .51.1Z"/>`}})),aH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#41b883" d="M24.4 3.925H30l-14 24.15L2 3.925h10.71l3.29 5.6l3.22-5.6Z"/><path fill="#41b883" d="m2 3.925l14 24.15l14-24.15h-5.6L16 18.415L7.53 3.925Z"/><path fill="#35495e" d="M7.53 3.925L16 18.485l8.4-14.56h-5.18L16 9.525l-3.29-5.6Z"/>`}})),oH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeWord0" x1="4.494" x2="13.832" y1="-1712.086" y2="-1695.914" gradientTransform="translate(0 1720)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2368c4"/><stop offset=".5" stop-color="#1a5dbe"/><stop offset="1" stop-color="#1146ac"/></linearGradient></defs><path fill="#41a5ee" d="M28.806 3H9.705a1.192 1.192 0 0 0-1.193 1.191V9.5l11.069 3.25L30 9.5V4.191A1.192 1.192 0 0 0 28.806 3Z"/><path fill="#2b7cd3" d="M30 9.5H8.512V16l11.069 1.95L30 16Z"/><path fill="#185abd" d="M8.512 16v6.5l10.418 1.3L30 22.5V16Z"/><path fill="#103f91" d="M9.705 29h19.1A1.192 1.192 0 0 0 30 27.809V22.5H8.512v5.309A1.192 1.192 0 0 0 9.705 29Z"/><path d="M16.434 8.2H8.512v16.25h7.922a1.2 1.2 0 0 0 1.194-1.191V9.391A1.2 1.2 0 0 0 16.434 8.2Z" opacity=".1"/><path d="M15.783 8.85H8.512V25.1h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.783 8.85H8.512V23.8h7.271a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path d="M15.132 8.85h-6.62V23.8h6.62a1.2 1.2 0 0 0 1.194-1.191V10.041a1.2 1.2 0 0 0-1.194-1.191Z" opacity=".2"/><path fill="url(#vscodeIconsFileTypeWord0)" d="M3.194 8.85h11.938a1.193 1.193 0 0 1 1.194 1.191v11.918a1.193 1.193 0 0 1-1.194 1.191H3.194A1.192 1.192 0 0 1 2 21.959V10.041A1.192 1.192 0 0 1 3.194 8.85Z"/><path fill="#fff" d="M6.9 17.988c.023.184.039.344.046.481h.028c.01-.13.032-.287.065-.47s.062-.338.089-.465l1.255-5.407h1.624l1.3 5.326a7.761 7.761 0 0 1 .162 1h.022a7.6 7.6 0 0 1 .135-.975l1.039-5.358h1.477l-1.824 7.748h-1.727l-1.237-5.126q-.054-.222-.122-.578t-.084-.52h-.021q-.021.189-.084.561c-.042.249-.075.432-.1.552L7.78 19.871H6.024L4.19 12.127h1.5l1.131 5.418a4.469 4.469 0 0 1 .079.443Z"/>`}})),sH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#f1662a" d="m20.42 21.157l2.211 2.211L30 16l-7.369-7.369l-2.211 2.212L25.58 16Zm-8.84-10.314L9.369 8.631L2 16l7.369 7.369l2.211-2.211L6.42 16Zm5.831-3.166l1.6.437l-4.42 16.209l-1.6-.437l4.42-16.209Z"/>`}})),cH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#ffe885" d="M2 12.218c.755 0 1.51-.008 2.264 0l.053.038l2.761 2.758c.891-.906 1.8-1.794 2.7-2.7c.053-.052.11-.113.192-.1h1.823a1.4 1.4 0 0 1 .353.019c-.7.67-1.377 1.369-2.069 2.05L5.545 18.8c-.331.324-.648.663-.989.975c-.754.022-1.511.007-2.266.007c1.223-1.209 2.431-2.433 3.658-3.637c-1.321-1.304-2.63-2.62-3.948-3.927Zm10.7 0h1.839v7.566c-.611 0-1.222.012-1.832-.008v-4.994c-1.6 1.607-3.209 3.2-4.811 4.8c-.089.08-.166.217-.305.194c-.824-.006-1.649 0-2.474 0Q8.916 16 12.7 12.218Zm2.258.002c.47-.009.939 0 1.409 0c.836.853 1.69 1.689 2.536 2.532q1.268-1.267 2.539-2.532h1.4q-.008 3.784 0 7.567c-.471 0-.943.006-1.414 0q.008-2.387 0-4.773c-.844.843-1.676 1.7-2.526 2.536c-.856-.835-1.687-1.695-2.532-2.541c0 1.594-.006 3.188.006 4.781c-.472 0-.943.005-1.415 0q-.003-3.79-.003-7.57Zm8.301-.003c.472 0 .944-.007 1.416 0q-.007 3.083 0 6.166h3.782c.063.006.144-.012.191.045c.448.454.907.9 1.353 1.354q-3.371.007-6.741 0q.007-3.782-.001-7.565Z"/>`}})),lH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#2188b6" d="M28.208 24.409a10.493 10.493 0 0 0-3.959 1.822a23.743 23.743 0 0 1-5.835 2.642a1.632 1.632 0 0 1-.983.55a62.228 62.228 0 0 1-6.447.577c-1.163.009-1.876-.3-2.074-.776a1.573 1.573 0 0 1 .866-2.074a3.759 3.759 0 0 1-.514-.379c-.171-.171-.352-.514-.406-.388c-.225.55-.343 1.894-.947 2.5c-.83.839-2.4.559-3.328.072c-1.019-.541.072-1.813.072-1.813a.73.73 0 0 1-.992-.343a4.847 4.847 0 0 1-.667-2.949a5.374 5.374 0 0 1 1.749-2.895a9.334 9.334 0 0 1 .658-4.4a10.445 10.445 0 0 1 3.165-3.661S6.628 10.747 7.35 8.817c.469-1.262.658-1.253.812-1.308a3.633 3.633 0 0 0 1.452-.857a5.265 5.265 0 0 1 4.41-1.7S15.2 1.4 16.277 2.09a18.349 18.349 0 0 1 1.533 2.886s1.281-.748 1.425-.469a11.334 11.334 0 0 1 .523 6.132a14.01 14.01 0 0 1-2.6 5.411c-.135.225 1.551.938 2.615 3.887c.983 2.7.108 4.96.262 5.212c.027.045.036.063.036.063s1.127.09 3.391-1.308a8.5 8.5 0 0 1 4.277-1.604a1.081 1.081 0 0 1 .469 2.11Z"/>`}})),uH=n((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<defs><linearGradient id="vscodeIconsFileTypeZip0" x1="17.65" x2="21.099" y1="26.056" y2="26.056" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#4d4d4d"/><stop offset=".5" stop-color="#fff"/><stop offset="1" stop-color="#4d4d4d"/></linearGradient><linearGradient id="vscodeIconsFileTypeZip1" x1="17.65" x2="21.099" y1="23.756" y2="23.756" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip2" x1="17.65" x2="21.099" y1="21.456" y2="21.456" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip3" x1="17.65" x2="21.099" y1="19.156" y2="19.156" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip4" x1="17.65" x2="21.099" y1="16.857" y2="16.857" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip5" x1="17.65" x2="21.099" y1="14.557" y2="14.557" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip6" x1="17.65" x2="21.099" y1="12.257" y2="12.257" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip7" x1="17.65" x2="21.099" y1="9.957" y2="9.957" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip8" x1="17.65" x2="21.099" y1="7.657" y2="7.657" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZip9" x1="16.237" x2="19.686" y1="27.217" y2="27.217" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipa" x1="16.237" x2="19.686" y1="24.918" y2="24.918" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipb" x1="16.237" x2="19.686" y1="22.618" y2="22.618" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipc" x1="16.237" x2="19.686" y1="20.318" y2="20.318" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipd" x1="16.237" x2="19.686" y1="18.018" y2="18.018" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipe" x1="17.65" x2="21.099" y1="28.356" y2="28.356" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipf" x1="16.237" x2="19.686" y1="15.718" y2="15.718" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipg" x1="16.237" x2="19.686" y1="13.419" y2="13.419" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZiph" x1="16.237" x2="19.686" y1="11.119" y2="11.119" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipi" x1="16.237" x2="19.686" y1="8.819" y2="8.819" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipj" x1="16.237" x2="19.686" y1="29.514" y2="29.514" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipk" x1="16.985" x2="20.446" y1="11.196" y2="11.196" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipl" x1="18.096" x2="19.336" y1="5.329" y2="5.329" href="#vscodeIconsFileTypeZip0"/><linearGradient id="vscodeIconsFileTypeZipm" x1="16.029" x2="21.403" y1="5.591" y2="5.591" href="#vscodeIconsFileTypeZip0"/></defs><path fill="#c09553" d="M27.667 27.667V17.333L23 15V2H4.333v28h23.334Zm-4.667 0v-9.111l2.333 1.222v7.889Z"/><path fill="url(#vscodeIconsFileTypeZip0)" d="M17.65 25.559h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip1)" d="M17.65 23.26h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip2)" d="M17.65 20.96h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip3)" d="M17.65 18.66h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip4)" d="M17.65 16.36h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip5)" d="M17.65 14.06h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip6)" d="M17.65 11.76h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip7)" d="M17.65 9.461h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip8)" d="M17.65 7.161h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZip9)" d="M16.237 26.721h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipa)" d="M16.237 24.421h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipb)" d="M16.237 22.121h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipc)" d="M16.237 19.821h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipd)" d="M16.237 17.522h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipe)" d="M17.65 27.859h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipf)" d="M16.237 15.222h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipg)" d="M16.237 12.922h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZiph)" d="M16.237 10.622h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipi)" d="M16.237 8.322h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipj)" d="M16.237 29.018h3.45v.993h-3.45z"/><path fill="url(#vscodeIconsFileTypeZipk)" d="M20.1 5.911a.554.554 0 0 0-.548-.53h-.009v.557h.092l.206 2.514h-2.252l.211-2.514h.094v-.557h-.044a.552.552 0 0 0-.547.53l-.314 10.569a.513.513 0 0 0 .515.531h2.432a.512.512 0 0 0 .513-.531Zm-1.384 10.5a1.171 1.171 0 1 1 1.171-1.171a1.171 1.171 0 0 1-1.171 1.168Z"/><path fill="url(#vscodeIconsFileTypeZipl)" d="M18.096 3.802h1.24v3.054h-1.24z"/><path fill="url(#vscodeIconsFileTypeZipm)" d="M21.4 4.56a2.549 2.549 0 0 0-2.549-2.549h-.276a2.55 2.55 0 0 0-2.436 3.3v.006a7.986 7.986 0 0 1 .261 2.561a1.811 1.811 0 0 0 .641 1.271l.109-3.441a.593.593 0 0 1 .6-.551h.135v-1.57h1.653v1.57h.1a.6.6 0 0 1 .605.551l.121 3.462a1.813 1.813 0 0 0 .666-1.292V7.72a7.693 7.693 0 0 1 .236-2.359a2.543 2.543 0 0 0 .134-.801Z"/>`}})),dH=e(lV(),1),fH=e(uV(),1),pH=e(dV(),1),mH=e(fV(),1),hH=e(pV(),1),gH=e(mV(),1),_H=e(hV(),1),vH=e(gV(),1),yH=e(_V(),1),bH=e(vV(),1),xH=e(yV(),1),SH=e(bV(),1),CH=e(xV(),1),wH=e(SV(),1),TH=e(CV(),1),EH=e(wV(),1),DH=e(TV(),1),OH=e(EV(),1),kH=e(DV(),1),AH=e(OV(),1),jH=e(kV(),1),MH=e(AV(),1),NH=e(jV(),1),PH=e(MV(),1),FH=e(NV(),1),IH=e(PV(),1),LH=e(FV(),1),RH=e(IV(),1),zH=e(LV(),1),BH=e(RV(),1),VH=e(zV(),1),HH=e(BV(),1),UH=e(VV(),1),WH=e(HV(),1),GH=e(UV(),1),KH=e(WV(),1),qH=e(GV(),1),JH=e(KV(),1),YH=e(qV(),1),XH=e(JV(),1),ZH=e(YV(),1),QH=e(XV(),1),$H=e(ZV(),1),eU=e(QV(),1),tU=e($V(),1),nU=e(eH(),1),rU=e(tH(),1),iU=e(nH(),1),aU=e(rH(),1),oU=e(iH(),1),sU=e(aH(),1),cU=e(oH(),1),lU=e(sH(),1),uU=e(cH(),1),dU=e(lH(),1),fU=e(uH(),1),pU=[{icon:vH.default,name:`docker`,pattern:/^(dockerfile|\.dockerignore)$/},{icon:yH.default,name:`dotenv`,pattern:/^\.env(?:\.|$)/},{icon:CH.default,name:`git`,pattern:/^\.git(?:attributes|ignore|modules)$/},{icon:PH.default,name:`makefile`,pattern:/^makefile$/},{icon:MH.default,name:`license`,pattern:/^licen[cs]e(?:\.|$)/},{icon:FH.default,name:`markdown`,pattern:/^readme(?:\.|$)/},{icon:IH.default,name:`npm`,pattern:/^package(?:-lock)?\.json$/},{icon:zH.default,name:`pnpm`,pattern:/^(pnpm-lock\.yaml|pnpm-workspace\.yaml)$/},{icon:dU.default,name:`yarn`,pattern:/^yarn\.lock$/},{icon:pH.default,name:`bun`,pattern:/^bun\.lockb?$/},{icon:nU.default,name:`tsconfig`,pattern:/^tsconfig(?:\..+)?\.json$/},{icon:aU.default,name:`vite`,pattern:/^vite\.config\./},{icon:oU.default,name:`vitest`,pattern:/^vitest(?:\..+)?\.config\./},{icon:$H.default,name:`tailwind`,pattern:/^tailwind\.config\./},{icon:bH.default,name:`eslint`,pattern:/^(eslint\.config\.|\.eslintrc)/},{icon:VH.default,name:`prettier`,pattern:/^(prettier\.config\.|\.prettierrc)/}],mU=[{icon:WH.default,name:`react-typescript`,extensions:[`tsx`]},{icon:UH.default,name:`react-javascript`,extensions:[`jsx`]},{icon:rU.default,name:`typescript`,extensions:[`ts`,`mts`,`cts`]},{icon:kH.default,name:`javascript`,extensions:[`js`,`mjs`,`cjs`]},{icon:AH.default,name:`json`,extensions:[`json`,`json5`,`jsonc`]},{icon:FH.default,name:`markdown`,extensions:[`md`,`mdx`]},{icon:EH.default,name:`html`,extensions:[`html`,`htm`]},{icon:_H.default,name:`css`,extensions:[`css`,`pcss`,`less`]},{icon:qH.default,name:`sass`,extensions:[`sass`,`scss`]},{icon:sU.default,name:`vue`,extensions:[`vue`]},{icon:XH.default,name:`svelte`,extensions:[`svelte`]},{icon:HH.default,name:`python`,extensions:[`py`,`pyw`]},{icon:wH.default,name:`go`,extensions:[`go`]},{icon:KH.default,name:`rust`,extensions:[`rs`]},{icon:OH.default,name:`java`,extensions:[`java`]},{icon:jH.default,name:`kotlin`,extensions:[`kt`,`kts`]},{icon:QH.default,name:`swift`,extensions:[`swift`]},{icon:hH.default,name:`cpp`,extensions:[`c`,`cc`,`cpp`,`h`,`hpp`]},{icon:gH.default,name:`csharp`,extensions:[`cs`]},{icon:RH.default,name:`php`,extensions:[`php`]},{icon:GH.default,name:`ruby`,extensions:[`rb`]},{icon:NH.default,name:`lua`,extensions:[`lua`]},{icon:JH.default,name:`shell`,extensions:[`sh`,`bash`,`zsh`,`fish`,`ps1`]},{icon:TH.default,name:`graphql`,extensions:[`graphql`,`gql`]},{icon:uU.default,name:`yaml`,extensions:[`yaml`,`yml`]},{icon:tU.default,name:`toml`,extensions:[`toml`]},{icon:lU.default,name:`xml`,extensions:[`xml`]},{icon:YH.default,name:`sql`,extensions:[`sql`,`sqlite`,`db`]},{icon:ZH.default,name:`svg`,extensions:[`svg`]},{icon:DH.default,name:`image`,extensions:[`avif`,`bmp`,`gif`,`heic`,`ico`,`jpeg`,`jpg`,`png`,`tif`,`tiff`,`webp`]},{icon:fH.default,name:`audio`,extensions:[`aac`,`flac`,`m4a`,`mp3`,`ogg`,`opus`,`wav`,`weba`]},{icon:iU.default,name:`video`,extensions:[`avi`,`m4v`,`mkv`,`mov`,`mp4`,`webm`,`wmv`]},{icon:LH.default,name:`pdf`,extensions:[`pdf`]},{icon:cU.default,name:`word`,extensions:[`doc`,`docx`,`odt`,`rtf`]},{icon:xH.default,name:`excel`,extensions:[`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]},{icon:BH.default,name:`powerpoint`,extensions:[`odp`,`ppt`,`pptx`]},{icon:fU.default,name:`archive`,extensions:[`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`zip`]},{icon:SH.default,name:`font`,extensions:[`eot`,`otf`,`ttf`,`woff`,`woff2`]},{icon:mH.default,name:`config`,extensions:[`cfg`,`conf`,`ini`,`properties`]},{icon:eU.default,name:`text`,extensions:[`log`,`txt`]}],hU={icon:dH.default,name:`default`};function gU(e){return e.trim().split(/[\\/]/).filter(Boolean).pop()??e.trim()}function _U(e){return/\.([a-z0-9]{1,16})$/i.exec(e)?.[1]?.toLowerCase()??``}function vU(e){let t=gU(e).toLowerCase(),n=pU.find(({pattern:e})=>e.test(t));if(n)return n;let r=_U(t);return mU.find(({extensions:e})=>e.includes(r))??hU}function yU(e){let t=e;return`body`in t?t:t.default}function bU({className:e,fileName:t,size:n=`default`}){let r=vU(t);return(0,U.jsx)(cV,{"aria-hidden":`true`,"data-file-type-icon":r.name,icon:yU(r.icon),className:u(`shrink-0`,n===`compact`?`h-3.5 w-3.5`:`h-4 w-4`,e)})}function xU({agentId:e,fileName:t,kind:n}){return n===`overview`?(0,U.jsx)(po,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`child-sessions`?(0,U.jsx)(to,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`project-files`?(0,U.jsx)(Ya,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`cron`?(0,U.jsx)(ia,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`continuous-attention`?(0,U.jsx)(Fa,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`file`?(0,U.jsx)(bU,{fileName:t??``,size:`compact`}):n===`side-chat-draft`?(0,U.jsx)(wo,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e?(0,U.jsx)(dz,{agentId:e,className:`h-3.5 w-3.5 shrink-0`}):(0,U.jsx)(Eo,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`})}function SU(e){if(e.kind!==`file`)return;let t=[...e.onAddToChat?[{key:`add-to-chat`,icon:(0,U.jsx)(wo,{className:`h-4 w-4`}),label:b(`chatWorkspaceAddToChat`),restoreFocus:!1,onSelect:e.onAddToChat}]:[],...e.alternateViewerAction?[{key:`viewer:${e.alternateViewerAction.viewer}`,icon:e.alternateViewerAction.viewer===`rendered`?(0,U.jsx)(Fa,{className:`h-4 w-4`}):(0,U.jsx)(Ta,{className:`h-4 w-4`}),label:e.alternateViewerAction.label,onSelect:e.alternateViewerAction.onSelect}]:[]],n=e.onClose?[{key:`close`,icon:(0,U.jsx)(Ai,{className:`h-4 w-4`}),label:b(`chatWorkspaceCloseFile`),onSelect:e.onClose}]:[];return[{key:`file`,items:t},{key:`tab`,items:n}]}function CU(e){if(!(e.kind!==`child-session`||!e.sessionKey))return[{key:`session`,items:[{key:`copy-session-id`,label:b(`chatSessionCopyId`),icon:(0,U.jsx)(Oa,{className:`h-4 w-4`}),onSelect:()=>void DF(e.sessionKey)}]}]}function wU(e){return e.map(e=>({key:e.key,label:e.title,labelClassName:e.isRenderedPreview?`italic font-normal`:void 0,active:e.active,tooltip:e.tooltip,leadingIcon:(0,U.jsx)(xU,{kind:e.kind,agentId:e.agentId,fileName:e.fileName}),badge:e.kind===`file`&&e.viewMode===`diff`?(0,U.jsx)(`span`,{className:`shrink-0 rounded border border-amber-200 bg-amber-50 px-1 py-0 text-[9px] font-medium uppercase tracking-[0.08em] text-amber-700`,children:b(`chatWorkspaceDiff`)}):null,unreadIndicator:e.showUnreadDot?(0,U.jsx)(`span`,{"aria-label":b(`chatSessionUnread`),className:`h-2 w-2 shrink-0 rounded-full bg-primary`}):null,closeLabel:`${e.kind===`file`?b(`chatWorkspaceCloseFile`):b(`chatWorkspaceCloseTab`)}: ${e.title}`,closePlacement:`leading-hover`,onSelect:e.onSelect,onClose:e.onClose,menuLabel:e.kind===`child-session`?b(`chatSessionMoreActions`):b(`chatWorkspaceFileMoreActions`),menuGroups:e.menuGroups??CU(e)??SU(e)}))}function TU({canGoBack:e,canGoForward:t,isMaximized:n=!1,onClose:r,onGoBack:i,onGoForward:a,onRefreshFile:o,onToggleMaximize:s,tabs:c}){return(0,U.jsx)(di,{testId:`workspace-tabs-bar`,scrollTestId:`workspace-tabs-scroll`,tabs:wU(c),actions:[{key:`back`,icon:(0,U.jsx)(wi,{className:`h-4 w-4`}),label:b(`chatWorkspaceBack`),disabled:!e,onClick:i},{key:`forward`,icon:(0,U.jsx)(ei,{className:`h-4 w-4`}),label:b(`chatWorkspaceForward`),disabled:!t,onClick:a},...o?[{key:`refresh-file`,icon:(0,U.jsx)(ki,{className:`h-4 w-4`}),label:b(`chatWorkspaceRefreshFile`),onClick:o}]:[],...s?[{key:`maximize`,icon:n?(0,U.jsx)(ko,{className:`h-4 w-4`}):(0,U.jsx)(So,{className:`h-4 w-4`}),label:b(n?`chatWorkspaceRestorePanel`:`chatWorkspaceMaximizePanel`),onClick:s}]:[],{key:`close`,icon:(0,U.jsx)(Ai,{className:`h-4 w-4`}),label:b(`chatWorkspaceClosePanel`),onClick:r}],scrollClassName:`workspace-horizontal-scrollbar`,actionsClassName:`ml-1 mr-1 self-stretch`})}var EU=[`cmd`,`command`,`query`,`q`,`path`,`url`,`to`,`channel`,`agentId`,`sessionKey`];function DU(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function OU(e,t=2400){return e.length<=t?e:`${e.slice(0,t)}\n…`}function kU(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:t<=1?`…`:`${n.slice(0,t-1)}…`}function AU(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(e==null)return``;try{return OU(JSON.stringify(e,null,2))}catch{return String(e)}}function jU(e){if(DU(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return null;try{let e=JSON.parse(t);return DU(e)?e:null}catch{return null}}function MU(e){let t=jU(e);if(!t){let t=AU(e).trim();return t?kU(t,120):void 0}let n=[];for(let e of EU){let r=t[e];if(typeof r==`string`&&r.trim()?n.push(`${e}: ${r.trim()}`):(typeof r==`number`||typeof r==`boolean`)&&n.push(`${e}: ${String(r)}`),n.length>=2)break}if(n.length>0)return kU(n.join(` · `),120)}function NU(e){return typeof e==`string`&&e.trim()?e.trim():null}function PU(e){let t=NU(e.messageId),n=NU(e.excerpt),{role:r}=e;return t&&n&&(r===`assistant`||r===`user`)?{messageId:t,role:r,excerpt:n}:null}function FU(e,t){let n=PU(e.data??{});return n?{kind:te,key:e.tokenKey,label:e.label,rawText:t,...n}:null}function IU(e){let{entry:t,label:n,rawText:r}=e,i=NU(t.key),a=PU(t);return i&&a?{kind:te,key:i,label:n,rawText:r,...a}:null}function LU(e){return vc({tokenKind:o,tokenKey:e.uri,label:e.label,data:{reference:e}})}function RU(e,t){return e.some(e=>e.type===`token`&&e.tokenKind===`system_object`&&e.tokenKey===t.uri&&ee(e.data?.reference)?.version===t.version)?Sc([...e]):Sc([...e,LU(t)])}var zU=`$`,BU=`@panel-app:`,VU=`@project:`,HU=`@file:`,UU=`@folder:`,WU=`@excerpt:`,GU=`@message-excerpt:`,KU=`@object:`,qU=`@resource:`;function JU(e){let{label:t,tokenKey:n,tokenKind:r}=e;return r===`skill`?`${zU}${t?.trim()||n}`:r===`panel_app`?`${BU}${n}`:r===`project`?`${VU}${encodeURIComponent(n)}`:r===`workspace_file`?`${HU}${encodeURIComponent(n)}`:r===`workspace_directory`?`${UU}${encodeURIComponent(n)}`:r===`workspace_excerpt`?`${WU}${encodeURIComponent(n)}`:r===`conversation_excerpt`?`${GU}${encodeURIComponent(n)}`:r===`system_object`?`${KU}${encodeURIComponent(n)}`:r===`ui_resource`?`${qU}${encodeURIComponent(n)}`:null}function YU(e){return typeof e==`string`&&e.trim()?e.trim():null}function XU(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function ZU(e){let t=new Set;return e.filter(e=>{let n=`ref`in e?e.ref:e.key,r=`${e.kind}:${n}:${e.rawText}`;return t.has(r)?!1:(t.add(r),!0)})}function QU(e,t){let n=YU(e.data?.path),r=YU(e.data?.excerpt);return!n||!r?null:{kind:O,key:e.tokenKey,path:n,label:e.label,excerpt:r,startLine:XU(e.data?.startLine),endLine:XU(e.data?.endLine),rawText:t}}function $U(e,t){if(e.tokenKind===`workspace_excerpt`)return QU(e,t);if(e.tokenKind===`conversation_excerpt`)return FU(e,t);if(e.tokenKind===`system_object`){let n=ee(e.data?.reference);return n?.uri===e.tokenKey?{kind:o,key:e.tokenKey,label:e.label,rawText:t,reference:n}:null}if(e.tokenKind===`ui_resource`){let n=x(e.data?.reference);return n?.uri===e.tokenKey?{kind:re,key:e.tokenKey,label:e.label,rawText:t,reference:n}:null}}function eW(e,t=[]){let n=new Map(t.map(e=>[e.ref,e])),i=[];for(let t of e){if(t.type!==`token`)continue;let e=JU(t);if(!e)continue;if(t.tokenKind===`skill`){let r=n.get(t.tokenKey);r?.path.trim()&&i.push({kind:`skill`,ref:r.ref,name:r.name,source:r.source,path:r.path,label:t.label,rawText:e});continue}if(t.tokenKind===`project`){i.push({kind:s,key:t.tokenKey,label:t.label,rawText:e});continue}let a=$U(t,e);if(a!==void 0){a&&i.push(a);continue}if(t.tokenKind===`workspace_file`||t.tokenKind===`workspace_directory`){let n=t.tokenKind===`workspace_file`?r:p;i.push({kind:n,key:t.tokenKey,label:t.label,rawText:e})}}return ZU(i)}var tW=`@panel-app:`,nW=/@panel-app:([A-Za-z0-9_-]+)/g,rW=/@project:([^\s]+)/g,iW=/@file:([^\s]+)/g,aW=/@folder:([^\s]+)/g,oW=/@object:([^\s]+)/g,sW=/@resource:([^\s]+)/g;function cW(e){let t=e.projectRoot?.trim().replace(/[\\/]+$/,``)??``,n=e.relativePath.trim().replace(/\\/g,`/`).split(`/`);if(!t||n.length===0||n.some(e=>!e||e===`.`||e===`..`))return null;let r=t.includes(`\\`)?`\\`:`/`;return`${t}${r}${n.join(r)}`}function lW(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uW(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function dW(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function fW(e){let t=new Set,n=[];for(let r of e){let e=`ref`in r?r.ref:r.key,i=`${r.kind}:${e}:${r.rawText}`;t.has(i)||(t.add(i),n.push(r))}return n}function pW(e){let{kind:t,pattern:n,text:r,tokens:i}=e;for(let e of r.matchAll(n)){let n=e[1];if(!n)continue;let r;try{r=decodeURIComponent(n)}catch{continue}i.push({kind:t,key:r,label:r.split(/[\\/]+/).filter(Boolean).at(-1)??r,rawText:e[0]})}}function mW(e){let t=[];for(let n of e.matchAll(nW)){let e=n[1];e&&t.push({kind:`panel_app`,key:e,label:e,rawText:`${tW}${e}`})}return pW({kind:s,pattern:rW,text:e,tokens:t}),pW({kind:o,pattern:oW,text:e,tokens:t}),pW({kind:re,pattern:sW,text:e,tokens:t}),pW({kind:r,pattern:iW,text:e,tokens:t}),pW({kind:p,pattern:aW,text:e,tokens:t}),fW(t)}function hW(e,t){let n=mW(e).filter(n=>{let r=e.indexOf(n.rawText);return!t.some(t=>t.kind===n.kind&&n.rawText.startsWith(t.rawText)&&e.indexOf(t.rawText)===r)});return fW([...t,...n])}function gW(e){let t=e?.[_];if(Array.isArray(t))return bW(t);if(!lW(t)||t.schemaVersion!==2||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){let t=vW(e);t&&n.push(t)}return fW(n)}function _W(e){return e===`builtin`||e===`global`||e===`project`||e===`workspace`?e:null}function vW(e){if(!lW(e))return null;let t=uW(e.kind),n=uW(e.rawText),r=uW(e.label);if(!t||!r||!n)return null;if(t===`skill`){let i=uW(e.ref),a=uW(e.name),o=uW(e.path),s=_W(e.source);return i&&a&&o&&s?{kind:t,ref:i,name:a,source:s,path:o,label:r,rawText:n}:null}if(t===`workspace_excerpt`)return yW({entry:e,label:r,rawText:n});if(t===`conversation_excerpt`)return IU({entry:e,label:r,rawText:n});if(t===`system_object`){let i=uW(e.key),a=ee(e.reference);return i&&a&&a.uri===i?{kind:t,key:i,label:r,rawText:n,reference:a}:null}if(t===`ui_resource`){let i=uW(e.key),a=x(e.reference);return i&&a&&a.uri===i?{kind:t,key:i,label:r,rawText:n,reference:a}:null}let i=uW(e.key);return i?{kind:t,key:i,rawText:n,label:r}:null}function yW(e){let{entry:t,label:n,rawText:r}=e,i=uW(t.key),a=uW(t.path),o=uW(t.excerpt);return i&&a&&o?{kind:O,key:i,path:a,label:n,excerpt:o,startLine:dW(t.startLine),endLine:dW(t.endLine),rawText:r}:null}function bW(e){let t=[];for(let n of e){if(!lW(n))continue;let e=uW(n.kind),r=uW(n.key),i=uW(n.rawText);if(!e||!r||!i)continue;let a=uW(n.label)??r;t.push(e===`skill`?{kind:e,ref:r,name:a,source:null,path:null,label:a,rawText:i}:{kind:e,key:r,label:a,rawText:i})}return fW(t)}function xW(e){return{schemaVersion:2,items:e}}var SW=/\u200B|\u200C|\u200D|\u2060|\uFEFF/g;function CW(e){let t=e.trim();return t&&t.replace(SW,``).trim()?t:null}function wW(e,t){let n=CW(e.text);if(!n)return null;let r=hW(e.text,t);return{type:`markdown`,text:n,inlineTokens:r.length>0?r:void 0}}function TW(e){return CW(e)}function EW(e){return typeof e==`object`&&!!e}function DW(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function OW(e){if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=Number(t);return Number.isFinite(n)&&n>=0?n:null}function kW(e){return EW(e)?`command`in e||`workingDir`in e||`exitCode`in e||`stdout`in e||`stderr`in e||`aggregated_output`in e||`combinedOutput`in e:!1}function AW(e){return typeof e==`string`?e.trim().toLowerCase():``}function jW(e){if(!kW(e))return null;let t=AW(e.status??e.outcome);if(e.cancelled===!0||e.aborted===!0||t===`cancelled`||t===`canceled`||t===`aborted`||t===`interrupted`)return`cancelled`;let n=OW(e.exitCode??e.exit_code);return e.ok===!1||e.blocked===!0||e.timedOut===!0||e.killed===!0||t===`error`||t===`failed`||t===`blocked`||t===`declined`||t===`timed_out`||n!=null&&n!==0?`error`:`success`}function MW(e,t){if(!EW(e))return null;let n=EW(e.asset)?e.asset:Array.isArray(e.assets)&&e.assets.length>0&&EW(e.assets[0])?e.assets[0]:null;if(!n)return null;let r=DW(n.url),i=DW(n.mimeType)??`application/octet-stream`,a=OW(n.sizeBytes);return r?{type:`file`,file:{label:DW(n.name)??(i.startsWith(`image/`)?t.imageAttachmentLabel:t.fileAttachmentLabel),mimeType:i,dataUrl:r,...a==null?{}:{sizeBytes:a},isImage:i.startsWith(`image/`)}}:null}function NW(e,t){let n=(e.statusTone===`success`?jW(e.outputData):null)??e.statusTone,r=n===`error`?t.toolStatusFailedLabel:n===`cancelled`?t.toolStatusCancelledLabel:e.statusLabel;return{kind:e.kind,toolName:e.name,...e.toolCallId?{toolCallId:e.toolCallId}:{},...`agentId`in e&&e.agentId?{agentId:e.agentId}:{},summary:e.detail,inputLabel:t.toolInputLabel,input:`input`in e&&typeof e.input==`string`?e.input:void 0,inputData:e.inputData,output:e.text,outputData:e.outputData,...e.execution?{execution:{...e.execution}}:{},hasResult:!!e.hasResult,statusTone:n,statusLabel:r,titleLabel:e.kind===`call`?t.toolCallLabel:t.toolResultLabel,outputLabel:t.toolOutputLabel,emptyLabel:t.toolNoOutputLabel,...`action`in e&&e.action?{action:e.action}:{},...`fileOperation`in e&&e.fileOperation?{fileOperation:e.fileOperation}:{},...`panelApp`in e&&e.panelApp?{panelApp:e.panelApp}:{}}}function PW(e){let{cancelled:t,error:n,result:r,status:i,texts:a}=e,o=typeof i==`string`?i.trim().toLowerCase():``,s=typeof n==`string`&&n.trim().length>0;return t===!0||o===`cancelled`?{kind:`result`,hasResult:!0,statusTone:`cancelled`,statusLabel:a.toolStatusCancelledLabel}:s||o===`error`?{kind:`result`,hasResult:!0,statusTone:`error`,statusLabel:a.toolStatusFailedLabel}:o===`result`||r!=null?{kind:`result`,hasResult:!0,statusTone:`success`,statusLabel:a.toolStatusCompletedLabel}:{kind:`call`,hasResult:!1,statusTone:`running`,statusLabel:a.toolStatusRunningLabel}}function FW(e){return typeof e==`object`&&!!e}function IW(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function LW(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function RW(e){let t=IW(e);return FW(t)?LW(t.agentId):null}function zW(e){return RW(e.parsedArgs)??RW(e.args)??RW(e.result)}var BW=12e3,VW=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function HW(e){let t=e.replace(/\r\n/g,`
|
|
93
|
+
`).replace(/\r/g,`
|
|
94
|
+
`);return t===``?[]:t.split(`
|
|
95
|
+
`)}function UW(e){return typeof e==`number`?e+1:void 0}function WW(e){let{kind:t,newLineNumber:n,oldLineNumber:r,text:i}=e;return{kind:t,text:i,...typeof r==`number`?{oldLineNumber:r}:{},...typeof n==`number`?{newLineNumber:n}:{}}}function GW(e){let t=VW.exec(e);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}function KW(e){let{kind:t,newStartLine:n,oldStartLine:r,text:i}=e;return HW(i).map((e,i)=>WW(t===`add`?{kind:`add`,text:e,newLineNumber:n+i}:{kind:`context`,text:e,oldLineNumber:r+i,newLineNumber:n+i}))}function qW(e){let{afterLines:t,beforeLines:n,newStartLine:r,oldStartLine:i}=e,a=i,o=r;return[...n.map(e=>{let t=WW({kind:`remove`,text:e,oldLineNumber:a});return a=UW(a),t}),...t.map(e=>{let t=WW({kind:`add`,text:e,newLineNumber:o});return o=UW(o),t})]}function JW(e){let{afterLines:t,beforeLines:n}=e,r=Array.from({length:n.length+1},()=>Array.from({length:t.length+1},()=>0));for(let e=n.length-1;e>=0;--e)for(let i=t.length-1;i>=0;--i)r[e][i]=n[e]===t[i]?(r[e+1][i+1]??0)+1:Math.max(r[e+1][i]??0,r[e][i+1]??0);return r}function YW(e){let{afterIndex:t,afterLines:n,beforeIndex:r,beforeLines:i,lines:a,newLineNumber:o,oldLineNumber:s}=e,c=s,l=o;for(let e=r;e<i.length;e+=1)a.push(WW({kind:`remove`,text:i[e]??``,oldLineNumber:c})),c=UW(c);for(let e=t;e<n.length;e+=1)a.push(WW({kind:`add`,text:n[e]??``,newLineNumber:l})),l=UW(l)}function XW(e){let{afterText:t,beforeText:n,newStartLine:r,oldStartLine:i}=e,a=HW(n),o=HW(t);if(a.length*o.length>BW)return qW({beforeLines:a,afterLines:o,oldStartLine:i,newStartLine:r});let s=JW({beforeLines:a,afterLines:o}),c=[],l=0,u=0,d=i,f=r;for(;l<a.length&&u<o.length;){if(a[l]===o[u]){c.push(WW({kind:`context`,text:a[l]??``,oldLineNumber:d,newLineNumber:f})),l+=1,u+=1,d=UW(d),f=UW(f);continue}if((s[l+1][u]??0)>=(s[l][u+1]??0)){c.push(WW({kind:`remove`,text:a[l]??``,oldLineNumber:d})),l+=1,d=UW(d);continue}c.push(WW({kind:`add`,text:o[u]??``,newLineNumber:f})),u+=1,f=UW(f)}return YW({lines:c,beforeLines:a,afterLines:o,beforeIndex:l,afterIndex:u,oldLineNumber:d,newLineNumber:f}),c}var ZW=120;function QW(e){let{lines:t,operation:n}=e,r=t.filter(e=>e.kind===`add`).length,i=t.filter(e=>e.kind===`remove`).length,a=[],o=n?.trim().toLowerCase()??``;return o&&o!==`update`&&a.push(o),r>0&&a.push(`+${r}`),i>0&&a.push(`-${i}`),a.length>0?a.join(` · `):void 0}function $W(e){let{afterText:t,beforeText:n,newStartLine:r,oldStartLine:i,operation:a}=e,o=a?.trim().toLowerCase()??``;return{oldStartLine:typeof i==`number`?i:(o===`delete`||o===`remove`)&&n!=null?1:void 0,newStartLine:typeof r==`number`?r:(o===`write`||o===`add`)&&t!=null?1:void 0}}function eG(e){return e.length<=ZW?{lines:e,truncated:!1}:{lines:e.slice(0,ZW),truncated:!0}}function tG(e){let{lines:t,operation:n,path:r}=e,i=eG(t);return{path:r,display:`diff`,caption:QW({operation:n,lines:t}),lines:i.lines,...i.truncated?{fullLines:t}:{},truncated:i.truncated}}function nG(e){let{newStartLine:t,oldStartLine:n,operation:r,path:i,text:a}=e,o=a.trim();if(!o)return null;let s=r?.trim().toLowerCase()===`write`?`add`:`context`,c=typeof n==`number`?n:1,l=typeof t==`number`?t:1,u=KW({text:o,kind:s,oldStartLine:c,newStartLine:l});return{path:i,display:`preview`,caption:QW({operation:r,lines:u}),lines:u,rawText:o,oldStartLine:c,newStartLine:l}}function rG(e){let{afterText:t,beforeText:n,operation:r,path:i}=e,{oldStartLine:a,newStartLine:o}=$W(e),s=XW({beforeText:n??``,afterText:t??``,oldStartLine:a,newStartLine:o}),c=eG(s);return c.lines.length===0?null:{path:i,display:`diff`,caption:QW({operation:r,lines:s}),lines:c.lines,...c.truncated?{fullLines:s}:{},...n==null?{}:{beforeText:n},...t==null?{}:{afterText:t},...typeof a==`number`?{oldStartLine:a}:{},...typeof o==`number`?{newStartLine:o}:{},truncated:c.truncated}}function iG(e){let{flushCurrent:t,line:n,setCurrent:r}=e;return n.startsWith(`*** Update File: `)?(t(),r(n.slice(17).trim(),`update`),!0):n.startsWith(`*** Add File: `)?(t(),r(n.slice(14).trim(),`add`),!0):n.startsWith(`*** Delete File: `)?(t(),r(n.slice(17).trim(),`delete`),!0):!1}function aG(e){let{currentLines:t,line:n,newLineNumber:r,oldLineNumber:i}=e;return n.startsWith(`+`)?(t.push(WW({kind:`add`,text:n.slice(1),newLineNumber:r})),{oldLineNumber:i,newLineNumber:UW(r)}):n.startsWith(`-`)?(t.push(WW({kind:`remove`,text:n.slice(1),oldLineNumber:i})),{oldLineNumber:UW(i),newLineNumber:r}):n.startsWith(` `)?(t.push(WW({kind:`context`,text:n.slice(1),oldLineNumber:i,newLineNumber:r})),{oldLineNumber:UW(i),newLineNumber:UW(r)}):{oldLineNumber:i,newLineNumber:r}}function oG(e){let t=[],n=null,r=null,i=[],a,o,s=()=>{if(!n){i=[],r=null,a=void 0,o=void 0;return}t.push(tG({path:n,operation:r,lines:i})),n=null,r=null,i=[],a=void 0,o=void 0};for(let t of HW(e)){if(iG({line:t,flushCurrent:s,setCurrent:(e,t)=>{n=e,r=t}})||t.startsWith(`*** Move to: `)||t.startsWith(`*** Begin Patch`)||t.startsWith(`*** End Patch`))continue;if(t.startsWith(`@@`)){let e=GW(t);a=e?.oldLineNumber,o=e?.newLineNumber;continue}if(!n)continue;let e=aG({currentLines:i,line:t,oldLineNumber:a,newLineNumber:o});a=e.oldLineNumber,o=e.newLineNumber}return s(),t}function sG(e){let t=[],n=null,r=[],i,a,o=()=>{if(!n){r=[],i=void 0,a=void 0;return}t.push(tG({path:n,operation:`update`,lines:r})),n=null,r=[],i=void 0,a=void 0};for(let t of HW(e)){if(t.startsWith(`+++ `)){o(),n=t.slice(4).trim().replace(/^b\//,``).replace(/^a\//,``);continue}if(t.startsWith(`--- `))continue;if(t.startsWith(`@@`)){let e=GW(t);i=e?.oldLineNumber,a=e?.newLineNumber;continue}if(!n)continue;let e=aG({currentLines:r,line:t,oldLineNumber:i,newLineNumber:a});i=e.oldLineNumber,a=e.newLineNumber}return o(),t}function cG(e){return e.includes(`*** Begin Patch`)?oG(e):e.includes(`--- `)&&e.includes(`+++ `)?sG(e):[]}function lG(e){switch(e){case`"`:case`\\`:case`/`:return e;case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
|
|
96
|
+
`;case`r`:return`\r`;case`t`:return` `;default:return e}}function uG(e,t){let n=`"${t}"`,r=e.indexOf(n);if(r<0)return null;let i=e.indexOf(`:`,r+n.length);if(i<0)return null;let a=i+1;for(;a<e.length&&/\s/.test(e[a]??``);)a+=1;return e[a]===`"`?a+1:null}function dG(e,t,n=1/0){let r=``,i=!1;for(let a=t;a<e.length;a+=1){let t=e[a];if(t==null)break;if(i){r+=lG(t),i=!1;continue}if(t===`\\`){i=!0;continue}if(t===`"`)return{value:r,truncated:!1};if(r+=t,r.length>=n)return{value:r,truncated:!0}}return r.length>0?{value:r,truncated:!1}:null}function fG(e,t,n=1/0){for(let r of t){let t=uG(e,r);if(t!=null)return dG(e,t,n)}return null}function pG(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mG(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function hG(e){return typeof e==`string`&&e.trim()?e.trim():null}function gG(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:typeof e==`string`&&/^\d+$/.test(e.trim())?Number(e.trim()):null}function _G(e){if(pG(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;try{let e=JSON.parse(t);return pG(e)?e:null}catch{return null}}function vG(e){if(pG(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;let n=fG(t,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`])?.value??null,r=fG(t,[`content`,`text`,`afterText`,`after_text`])?.value??null,i=fG(t,[`oldText`,`beforeText`,`before_text`])?.value??null,a=fG(t,[`newText`,`afterText`,`after_text`])?.value??null,o=fG(t,[`patch`,`diff`,`unifiedDiff`,`unified_diff`])?.value??null,s={};return n&&(s.path=n),r&&(s.content=r),i&&(s.oldText=i),a&&(s.newText=a),o&&(s.patch=o),Object.keys(s).length>0?s:null}function yG(e){return hG(e.path)??hG(e.filePath)??hG(e.file_path)??hG(e.targetPath)??hG(e.target_path)??hG(e.filename)??hG(e.name)}function bG(e){return mG(e.operation)??mG(e.op)??mG(e.action)??mG(e.kind)??mG(e.type)??mG(e.status)}function xG(e,t){for(let n of t){let t=gG(e[n]);if(t!==null)return t}return null}function SG(e){return xG(e,[`oldStartLine`,`old_start_line`,`startOldLine`,`start_old_line`,`oldLineStart`,`old_line_start`,`oldLineNumber`,`old_line_number`,`lineStart`,`line_start`,`startLine`,`start_line`,`lineNumber`,`line_number`])}function CG(e){return xG(e,[`newStartLine`,`new_start_line`,`startNewLine`,`start_new_line`,`newLineStart`,`new_line_start`,`newLineNumber`,`new_line_number`,`lineStart`,`line_start`,`startLine`,`start_line`,`lineNumber`,`line_number`])}function wG(e){return mG(e.patch)??mG(e.diff)??mG(e.unifiedDiff)??mG(e.unified_diff)}function TG(e){return mG(e.beforeText)??mG(e.before_text)??mG(e.oldText)??mG(e.old_text)??mG(e.oldContent)??mG(e.old_content)??mG(e.before)??mG(e.previous)}function EG(e){return mG(e.afterText)??mG(e.after_text)??mG(e.newText)??mG(e.new_text)??mG(e.newContent)??mG(e.new_content)??mG(e.content)??mG(e.text)??mG(e.after)??mG(e.updated)}var DG=new Set([`file_change`,`read_file`,`write_file`,`edit_file`,`apply_patch`]);function OG(e){let t=e.map((e,t)=>({key:`${e.path}-${t+1}`,path:e.path,display:e.display,...e.caption?{caption:e.caption}:{},lines:e.lines,...e.fullLines?{fullLines:e.fullLines}:{},...e.rawText?{rawText:e.rawText}:{},...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{},...e.truncated?{truncated:!0}:{}})).filter(e=>e.lines.length>0||!!e.rawText);if(t.length===0)return null;let n=t.map(e=>e.path);return{summary:n.length===1?n[0]:`${n.length} files · ${n.slice(0,2).join(` · `)}${n.length>2?` …`:``}`,fileOperation:{blocks:t}}}function kG(e,t){let n=yG(e)??t,r=bG(e),i=SG(e),a=CG(e),o=wG(e);if(o){let e=cG(o);if(e.length>0)return e[0]??null}let s=TG(e),c=EG(e);if(s!=null||c!=null)return rG({path:n,beforeText:s,afterText:c,operation:r,oldStartLine:i,newStartLine:a});let l=mG(e.preview);return l?nG({path:n,text:l,operation:r,oldStartLine:i,newStartLine:a}):null}function AG(e){if(!Array.isArray(e))return[];let t=[];return e.forEach((e,n)=>{if(typeof e==`string`){let n=cG(e);n.length>0&&t.push(...n);return}if(!pG(e))return;let r=kG(e,yG(e)??`file-${n+1}`);if(r){t.push(r);return}let i=Array.isArray(e.changes)?AG(e.changes):[];i.length>0&&t.push(...i)}),t}function jG(e){let t=_G(e.result)??_G(e.parsedArgs)??_G(e.args);return t?OG(AG(t.changes)):null}function MG(e){let t=_G(e.parsedArgs)??_G(e.args)??vG(e.args),n=t&&yG(t),r=mG(e.result);return!n||!r?null:OG([nG({path:n,text:r,operation:`read`})].filter(e=>!!e))}function NG(e){if(e.status===`partial-call`&&typeof e.args==`string`){let t=fG(e.args,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`]),n=fG(e.args,[`content`,`text`,`afterText`,`after_text`]);if(t?.value&&n?.value){let e=nG({path:t.value,text:n.value,operation:`write`});if(e)return OG([e])}}let t=_G(e.parsedArgs)??_G(e.args)??vG(e.args);if(!t)return null;let n=yG(t),r=mG(t.content);return!n||!r?null:OG([nG({path:n,text:r,operation:`write`})].filter(e=>!!e))}function PG(e){let t=_G(e.result),n=_G(e.parsedArgs)??_G(e.args)??vG(e.args);if(!t&&!n)return null;let r=(t?yG(t):null)??(n?yG(n):null),i=(t?TG(t):null)??(n?TG(n):null),a=(t?EG(t):null)??(n?EG(n):null),o=(t?SG(t):null)??(n?SG(n):null),s=(t?CG(t):null)??(n?CG(n):null);return!r||i==null&&a==null?null:OG([rG({path:r,beforeText:i,afterText:a,operation:`edit`,oldStartLine:o,newStartLine:s})].filter(e=>!!e))}function FG(e){let t=_G(e.parsedArgs),n=_G(e.args)??vG(e.args),r=mG(e.args)??(t?mG(t.patch):null)??(n?mG(n.patch):null);return r?OG(cG(r)):null}function IG(e){return DG.has(e.toolName)?e.toolName===`file_change`?jG(e):e.toolName===`read_file`?MG(e):e.toolName===`write_file`?NG(e):e.toolName===`edit_file`?PG(e):e.toolName===`apply_patch`?FG(e):null:null}var LG=[`show_content`,`show_file`,`show_url`,`show_panel_app`];function RG(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function zG(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function BG(e){return Number.isInteger(e)&&typeof e==`number`&&e>0?e:void 0}function VG(e){return e===`file`||e===`url`||e===`panel_app`?e:null}function HG(e){return e===`read`||e===`preview`||e===`edit`||e===`interact`?e:void 0}function UG(e){return e===`inline`||e===`side_panel`?e:void 0}function WG(e){return e===`auto`||e===`source`||e===`rendered`?e:void 0}function GG(e){try{return a(e)}catch{return null}}function KG(e){if(!RG(e)||!RG(e.target))return null;let{target:t}=e,{payload:n,type:r}=t,i=VG(r);if(!i||!RG(n))return null;let a=zG(e.title),o=HG(e.purpose),s=UG(e.placement);if(i===`file`){let e=zG(n.path);if(!e)return null;let t=GG(n.params);return t===null||t&&(WG(n.viewer)===`source`||!/\.html?$/i.test(e))?null:{target:{type:`file`,payload:{path:e,line:BG(n.line),column:BG(n.column),viewer:WG(n.viewer),params:t??void 0}},title:a,purpose:o,placement:s}}if(i===`url`){let e=zG(n.url);return e?{target:{type:`url`,payload:{url:e}},title:a,purpose:o,placement:s}:null}let c=zG(n.appId);if(!c)return null;let l=GG(n.params);return l===null?null:{target:{type:`panel_app`,payload:{appId:c,path:zG(n.path),params:l??void 0}},title:a,purpose:o,placement:s}}function qG(e){return!RG(e)||e.action!==`showContent`?null:KG(e.request)}function JG(e){return e.title?e.title:e.target.type===`file`?e.target.payload.path:e.target.type===`url`?e.target.payload.url:e.target.payload.appId}function YG(e){let{actionLabel:t,invocation:n,statusLabel:r}=e;if(!LG.includes(n.toolName))return null;let i=qG(n.result);if(!i)return null;let a={kind:`show-content`,label:t,request:{...i,placement:`side_panel`}},o=i.target.type===`panel_app`&&i.placement===`inline`?{appId:i.target.payload.appId,path:i.target.payload.path,params:i.target.payload.params,title:i.title,action:a}:void 0;return{kind:`result`,name:n.toolName,detail:JG(i),text:void 0,outputData:n.result,hasResult:!0,statusTone:`success`,statusLabel:r,action:a,...o?{panelApp:o}:{}}}function XG(e){return typeof e==`object`&&!!e}function ZG(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function QG(e){return!XG(e)||e.kind!==`nextclaw.session_request`?null:e}function $G(e){return!XG(e)||e.kind!==`nextclaw.session`?null:e}function eK(e){if(typeof e!=`string`)return e;let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function tK(e){return AU(eK(e)).trim()||void 0}function nK(e,t){return[ZG(e.title)?`title: ${e.title?.trim()}`:null,ZG(e.sessionId)?`session: ${e.sessionId?.trim()}`:null,ZG(e.task)?`task: ${e.task?.trim()}`:null].filter(e=>!!e).join(` · `)||MU(t)}function rK(e,t){return[ZG(e.title)?`title: ${e.title?.trim()}`:null,ZG(e.sessionId)?`session: ${e.sessionId?.trim()}`:null].filter(e=>!!e).join(` · `)||MU(t)}function iK(e){let t=ZG(e.requestId),n=ZG(e.sessionId),r=ZG(e.title),i=ZG(e.task),a=ZG(e.status),o=ZG(e.notify),s=ZG(e.lifecycle),c=ZG(e.parentSessionId),l=ZG(e.spawnedByRequestId),u=e.message===void 0?``:AU(e.message).trim(),d=e.finalResponseText===void 0?``:AU(e.finalResponseText).trim(),f=e.error===void 0?``:AU(e.error).trim(),p=[t?`Request ID: ${t}`:null,n?`Session ID: ${n}`:null,typeof e.isChildSession==`boolean`?`Target: ${e.isChildSession?`child`:`session`}`:null,a?`Status: ${a}`:null,o?`Notify: ${o}`:null,s?`Lifecycle: ${s}`:null,c?`Parent Session ID: ${c}`:null,l?`Spawned By Request ID: ${l}`:null,r?`Title: ${r}`:null,i?`Task:\n${i}`:null,d?`Final Response:\n${d}`:f?`Error:\n${f}`:u?`Status:\n${u}`:null].filter(e=>!!e);return p.length>0?p.join(`
|
|
97
|
+
|
|
98
|
+
`):void 0}function aK(e){let t=ZG(e.sessionId),n=ZG(e.title),r=ZG(e.sessionType),i=ZG(e.lifecycle),a=ZG(e.parentSessionId),o=ZG(e.createdAt),s=[t?`Session ID: ${t}`:null,typeof e.isChildSession==`boolean`?`Target: ${e.isChildSession?`child`:`session`}`:null,n?`Title: ${n}`:null,r?`Session Type: ${r}`:null,i?`Lifecycle: ${i}`:null,a?`Parent Session ID: ${a}`:null,o?`Created At: ${o}`:null].filter(e=>!!e);return s.length>0?s.join(`
|
|
99
|
+
|
|
100
|
+
`):void 0}function oK(e){let{invocation:t,texts:n}=e,{toolName:r,toolCallId:i,args:a,result:o}=t;if(r!==`spawn`&&r!==`sessions_request`&&r!==`sessions_spawn`)return null;let s=QG(o);if(s){let e=ZG(s.status)?.toLowerCase(),t=nK(s,a),o=iK(s),c=ZG(s.sessionId),l=zW({args:a,result:s}),u=c?{kind:`open-session`,sessionId:c,sessionKind:s.isChildSession===!0?`child`:`session`,...l?{agentId:l}:{},...ZG(s.title)?{label:s.title.trim()}:{},...ZG(s.parentSessionId)?{parentSessionId:s.parentSessionId.trim()}:{}}:void 0;return e===`failed`?{kind:`result`,name:r,detail:t,input:tK(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`error`,statusLabel:n.toolStatusFailedLabel,...l?{agentId:l}:{},...u?{action:u}:{}}:e===`completed`?{kind:`result`,name:r,detail:t,input:tK(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...l?{agentId:l}:{},...u?{action:u}:{}}:{kind:`result`,name:r,detail:t,input:tK(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`running`,statusLabel:n.toolStatusRunningLabel,...l?{agentId:l}:{},...u?{action:u}:{}}}let c=$G(o);if(!c)return null;let l=rK(c,a),u=aK(c),d=ZG(c.sessionId),f=zW({args:a,result:c}),p=d?{kind:`open-session`,sessionId:d,sessionKind:c.isChildSession===!0?`child`:`session`,...f?{agentId:f}:{},...ZG(c.title)?{label:c.title.trim()}:{},...ZG(c.parentSessionId)?{parentSessionId:c.parentSessionId.trim()}:{}}:void 0;return{kind:`result`,name:r,detail:l,input:tK(a),text:u,callId:i||void 0,hasResult:!!u,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...f?{agentId:f}:{},...p?{action:p}:{}}}var sK=`ncp_internal_visibility`,cK=`observation.event`;function lK(e){return e?.metadata?.[sK]===`hidden`}var uK=`ai_execution`;function dK(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function fK(e){return e===null||typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function pK(e){return e===`reported`||e===`partial`||e===`unavailable`}function mK(e){return e===`completed`||e===`failed`||e===`aborted`}function hK(e){let t=e?.[uK];if(!dK(t)||t.version!==1||!dK(t.usage))return null;let n=t.usage;return typeof t.runId!=`string`||!t.runId.trim()||typeof t.runtimeId!=`string`||!t.runtimeId.trim()||typeof t.model!=`string`||!t.model.trim()||!(t.requestedModel===null||typeof t.requestedModel==`string`)||!mK(t.outcome)||!fK(n.inputTokens)||!fK(n.outputTokens)||!fK(n.cachedInputTokens)||!fK(n.totalTokens)||!fK(n.modelCallCount)||!fK(n.reportedModelCallCount)||!pK(n.status)?null:t}var gK=function(e){return e.EndpointReady=`endpoint.ready`,e.EndpointError=`endpoint.error`,e.MessageRequest=`message.request`,e.MessageStreamRequest=`message.stream-request`,e.MessageSent=`message.sent`,e.MessageAccepted=`message.accepted`,e.MessageIncoming=`message.incoming`,e.MessageCompleted=`message.completed`,e.MessageFailed=`message.failed`,e.MessageAbort=`message.abort`,e.MessageTextStart=`message.text-start`,e.MessageTextDelta=`message.text-delta`,e.MessageTextEnd=`message.text-end`,e.MessageReasoningStart=`message.reasoning-start`,e.MessageReasoningDelta=`message.reasoning-delta`,e.MessageReasoningEnd=`message.reasoning-end`,e.MessageToolCallStart=`message.tool-call-start`,e.MessageToolCallArgs=`message.tool-call-args`,e.MessageToolCallArgsDelta=`message.tool-call-args-delta`,e.MessageToolCallOutputDelta=`message.tool-call-output-delta`,e.MessageToolCallEnd=`message.tool-call-end`,e.MessageToolExecutionStarted=`message.tool-execution-started`,e.MessageToolCallResult=`message.tool-call-result`,e.MessageRead=`message.read`,e.MessageDelivered=`message.delivered`,e.MessageRecalled=`message.recalled`,e.MessageReaction=`message.reaction`,e.RunStarted=`run.started`,e.RunFinished=`run.finished`,e.RunError=`run.error`,e.RunMetadata=`run.metadata`,e.ContextWindowUpdated=`context-window.updated`,e.TypingStart=`typing.start`,e.TypingEnd=`typing.end`,e.PresenceUpdated=`presence.updated`,e}({});function _K(e,t=e.occurredAt??new Date().toISOString()){return{...e,occurredAt:t}}var vK=`run_trigger`;function yK(e){return typeof e==`string`&&e.trim()?e.trim():null}function bK(e){return yK(e)??void 0}function xK(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).filter(e=>e[0].trim().length>0&&(e[1]===null||typeof e[1]==`string`||typeof e[1]==`number`&&Number.isFinite(e[1])||typeof e[1]==`boolean`));return t.length>0?Object.fromEntries(t):void 0}function SK(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=t.actor,r=yK(t.source),i=yK(t.triggeredAt);if(n!==`human`&&n!==`agent`&&n!==`automation`&&n!==`system`||!r||!i||!Number.isFinite(Date.parse(i)))return null;let a=bK(t.sourceSessionId),o=bK(t.sourceMessageId),s=bK(t.sourceRunId),c=bK(t.sourceToolCallId),l=bK(t.sourceRequestId),u=bK(t.sourceModel),d=xK(t.sourceContext);return{actor:n,source:r,triggeredAt:new Date(i).toISOString(),...a?{sourceSessionId:a}:{},...o?{sourceMessageId:o}:{},...s?{sourceRunId:s}:{},...c?{sourceToolCallId:c}:{},...l?{sourceRequestId:l}:{},...u?{sourceModel:u}:{},...d?{sourceContext:d}:{}}}function CK(e){let t=e?.[vK];if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,r=SK(n),i=yK(n.targetRunId);return n.version!==1||!r||!i?null:{version:1,...r,targetRunId:i}}var wK=/\[\[\s*reply_to_current\s*\]\]/gi,TK=/\[\[\s*reply_to\s*:\s*([^\]]+?)\s*\]\]/i;function EK(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function DK(e,t){let n=e,r;wK.test(n)&&(r=EK(t),n=n.replace(wK,``).trim());let i=n.match(TK)?.[1];return i&&(r=EK(i),n=n.replace(TK,``).trim()),r?{content:n,replyTo:r}:{content:n}}function OK(e,t=e.id){if(e.role!==`assistant`)return{...e,parts:[...e.parts],metadata:e.metadata?{...e.metadata}:void 0};let n=e.parts.findIndex(e=>e.type===`text`),r=e.metadata?{...e.metadata}:void 0,i=EK(r?.reply_to);if(n<0)return{...e,parts:[...e.parts],metadata:r};let a=e.parts[n];if(!a||a.type!==`text`)return{...e,parts:[...e.parts],metadata:r};let{content:o,replyTo:s}=DK(a.text,t),c=s??i,l=e.parts.flatMap((e,t)=>t!==n||e.type!==`text`?[e]:o.length===0?[]:[{...e,text:o}]);return c?{...e,parts:l,metadata:{...r,reply_to:c}}:{...e,parts:l,metadata:r}}function kK(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function AK(e){if(typeof e!=`number`||!Number.isFinite(e))return null;let t=Math.trunc(e);return t>=0?t:null}function jK(e){return e===!0}function MK(e){let t=e;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,r=AK(n.usedContextTokens),i=AK(n.totalContextTokens),a=AK(n.prunedUsedContextTokens),o=kK(n.updatedAt);if(r===null||i===null||a===null||!o)return null;let s=AK(n.compactedUsedContextTokens),c=AK(n.fixedInputTokens),l=AK(n.dynamicInputTokens),u=AK(n.reservedContextTokens),d=AK(n.triggerContextTokens),f=AK(n.availableBeforeCompactionTokens);return{completeInputBudget:jK(n.completeInputBudget),usedContextTokens:r,totalContextTokens:i,prunedUsedContextTokens:a,availableContextTokens:AK(n.availableContextTokens)??Math.max(0,i-r),...c===null?{}:{fixedInputTokens:c},...l===null?{}:{dynamicInputTokens:l},...u===null?{}:{reservedContextTokens:u},...d===null?{}:{triggerContextTokens:d},...f===null?{}:{availableBeforeCompactionTokens:f},droppedHistoryCount:AK(n.droppedHistoryCount)??0,truncatedToolResultCount:AK(n.truncatedToolResultCount)??0,truncatedSystemPrompt:jK(n.truncatedSystemPrompt),truncatedUserMessage:jK(n.truncatedUserMessage),compacted:jK(n.compacted),...kK(n.checkpointId)?{checkpointId:kK(n.checkpointId)??void 0}:{},compactedMessageCount:AK(n.compactedMessageCount)??0,...s===null?{}:{compactedUsedContextTokens:s},updatedAt:o}}function NK(e){let{metadata:t}=e;if(!t||kK(t.inherited_from_session_id)||t.nextclaw_timeline_kind!==`context_compaction`)return null;let n=t.checkpoint&&typeof t.checkpoint==`object`&&!Array.isArray(t.checkpoint)?t.checkpoint:null;if(!n)return null;let r=kK(n.id),i=n.status===`compressing`?`compressing`:n.status===`compressed`?`compressed`:n.status===`failed`?`failed`:n.status===`cancelled`?`cancelled`:null,a=n.phase===`pre-run`?`pre-run`:n.phase===`mid-run`?`mid-run`:null,o=kK(n.continuationMessageId),s=AK(n.continuationMessageCoveredPartCount),c=typeof n.summary==`string`?n.summary:void 0,l=AK(n.coveredMessageCount),u=AK(n.coveredSessionMessageCount),d=AK(n.originalEstimatedTokens),f=AK(n.projectedEstimatedTokens),p=kK(n.createdAt),m=kK(n.updatedAt);return!r||!i||l===null||u===null||d===null||f===null||!p||!m?null:{id:r,status:i,...a?{phase:a}:{},...o?{continuationMessageId:o}:{},...s===null?{}:{continuationMessageCoveredPartCount:s},...c===void 0?{}:{summary:c},coveredMessageCount:l,coveredSessionMessageCount:u,originalEstimatedTokens:d,projectedEstimatedTokens:f,createdAt:p,updatedAt:m}}var PK=cK,FK=`nextclaw.observation.event`,IK=`ncp.observation.event`;function LK(e){return e===PK||e===IK||e===FK}function RK(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zK(e,t){let n=e[t];return typeof n==`string`&&n.trim()?n.trim():null}function BK(e){if(!RK(e))return null;let t=zK(e,`deliveryId`),n=zK(e,`extensionId`),r=zK(e,`eventId`),i=zK(e,`eventType`),a=zK(e,`occurredAt`);return!t||!n||!r||!i||!a?null:{deliveryId:t,extensionId:n,eventId:r,eventType:i,occurredAt:a,payload:e.payload,...e.sourceRefs===void 0?{}:{sourceRefs:e.sourceRefs},...typeof e.causationId==`string`&&e.causationId.trim()?{causationId:e.causationId.trim()}:{}}}function VK(e,t=6e3){let n;if(typeof e==`string`)n=e;else try{n=JSON.stringify(e,null,2)??``}catch{n=String(e)}return n.length<=t?n:`${n.slice(0,Math.max(0,t-16))}\n…`}var HK=`inherited_from_session_id`,UK=`nextclaw.context-compaction`;function WK(e){let t=e.metadata?.[HK];return typeof t==`string`&&t.trim()?t.trim():null}function GK(e){if(e.parts.length!==1)return null;let t=e.parts[0];return!t||t.type!==`extension`||!LK(t.extensionType)?null:BK(t.data)}function KK(e){return!lK(e)&&!C(e)&&!NK(e)&&!WK(e)}function qK(e){let t=e.metadata?.[f];return typeof t==`string`&&t.trim()?t.trim():null}function JK(e,t){return[...e,...t]}function YK(e,t){let n=e.lifecycle?.startedAt??t.lifecycle?.startedAt,r=t.lifecycle?.endedAt??e.lifecycle?.endedAt;return{...e,status:t.status,parts:JK(e.parts,t.parts),lifecycle:n||r?{startedAt:n,endedAt:r}:void 0,metadata:e.metadata||t.metadata?{...e.metadata,...t.metadata}:void 0}}function XK(e,t={}){let n=[],r=new Map,i=new Map,a=new Map(e.map(e=>[e.id,e.parts.length])),o=[],s=new Set,c=[],l=null;e.forEach((e,t)=>{let u=NK(e),d=u?.continuationMessageId,f=u?.phase===`pre-run`?l:null,p=d??f,m=u?.continuationMessageCoveredPartCount??(f?a.get(f):void 0),h=p?i.get(p):void 0;if((u?.phase===`mid-run`||u?.phase===`pre-run`)&&h&&m!==void 0){o.push({boundaryIndex:h.partOffset+m,checkpoint:u,messageIndex:h.messageIndex,rawOrder:t,serviceMessageId:e.id}),s.add(e.id);return}let g=qK(e);if(g&&lK(e)){l=g;return}if(!KK(e))return;let _=GK(e);if(_){c.push({boundaryIndex:n.length,event:_,messageId:e.id});return}let v=l&&e.role===`assistant`?r.get(l):void 0;if(v!==void 0&&n[v]?.role===`assistant`){let t=n[v].parts.length;n[v]=YK(n[v],e),r.set(e.id,v),i.set(e.id,{messageIndex:v,partOffset:t}),l=null;return}l=null,r.set(e.id,n.length),i.set(e.id,{messageIndex:n.length,partOffset:0}),n.push(e)});let u=new Map;for(let e of o){let t=u.get(e.messageIndex)??[];t.push(e),u.set(e.messageIndex,t)}for(let[e,t]of u){let r=n[e];if(!r)continue;let i=[...r.parts],a=0;t.sort((e,t)=>e.boundaryIndex-t.boundaryIndex||e.rawOrder-t.rawOrder).forEach(e=>{if(!Number.isSafeInteger(e.boundaryIndex)||e.boundaryIndex<0){s.delete(e.serviceMessageId);return}e.boundaryIndex>r.parts.length||(i.splice(e.boundaryIndex+a,0,{type:`extension`,extensionType:UK,data:{id:e.serviceMessageId,checkpoint:e.checkpoint}}),a+=1)}),n[e]={...r,parts:i}}let d=l?r.get(l):void 0;return t.continuationRunning&&d!==void 0&&(n[d]={...n[d],status:`pending`}),{messages:n,inlineCompactionMessageIds:s,observationEvents:c}}function ZK(e,t={}){return XK(e,t).messages}function QK(e){let{rawMessageId:t,rawMessages:n,visibleRawMessages:r}=e,i=n.findIndex(e=>e.id===t);return i<0?r.length-1:ZK(n.slice(0,i)).length-1}function $K(e){let t=e.findIndex(e=>WK(e));if(t<0)return null;let n=WK(e[t]);return n?{boundaryIndex:ZK(e.slice(0,t)).length,sourceSessionId:n,inheritedMessageCount:e.filter(e=>WK(e)===n).length}:null}function eq(e){let t=XK(e.rawMessages),n=t.messages,r=t.observationEvents,i=e.rawMessages.map(e=>({rawMessageId:e.id,checkpoint:NK(e)})).filter(e=>!!(e.checkpoint&&!t.inlineCompactionMessageIds.has(e.rawMessageId))).map(t=>({key:`compaction:${t.rawMessageId}`,checkpoint:t.checkpoint,boundaryIndex:QK({rawMessages:e.rawMessages,visibleRawMessages:n,rawMessageId:t.rawMessageId})})).sort((e,t)=>e.boundaryIndex-t.boundaryIndex),a=$K(e.rawMessages),o=[],s=[],c=0,l=0,u=()=>{s.length!==0&&(o.push(...s.map(e=>({kind:`message`,key:`message:${e.id}`,message:e}))),s=[])},d=e=>{for(;l<r.length&&r[l].boundaryIndex<=e;){let e=r[l];u(),o.push({kind:`observation-event`,key:`observation-event:${e.messageId}`,event:e.event}),l+=1}};for(n.forEach((t,n)=>{d(n),a?.boundaryIndex===n&&(u(),o.push({kind:`context-inheritance`,key:`context-inheritance:${a.sourceSessionId}`,inheritance:a}));let r=e.messages[n];for(r&&s.push(r);c<i.length&&i[c]?.boundaryIndex<=n;){let e=i[c];u(),o.push({kind:`compaction`,key:e.key,checkpoint:e.checkpoint}),c+=1}}),a?.boundaryIndex===n.length&&(u(),o.push({kind:`context-inheritance`,key:`context-inheritance:${a.sourceSessionId}`,inheritance:a})),d(n.length);c<i.length;){let e=i[c];u(),o.push({kind:`compaction`,key:e.key,checkpoint:e.checkpoint}),c+=1}return u(),o.length===0&&o.push({kind:`empty`,key:`empty`}),o}function tq(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e.error:null;return typeof t==`object`&&t&&!Array.isArray(t)&&t.code===`invalid_tool_arguments`?t:null}function nq(e,t){let n=TW(e.reasoning);return n?{type:`reasoning`,text:n,label:t.reasoningLabel}:null}function rq(e,t){let n=e.mimeType.startsWith(`image/`),r=OW(e.sizeBytes);return{type:`file`,file:{label:typeof e.name==`string`&&e.name.trim()?e.name.trim():n?t.imageAttachmentLabel:t.fileAttachmentLabel,mimeType:e.mimeType,dataUrl:typeof e.url==`string`&&e.url.trim().length>0?e.url.trim():`data:${e.mimeType};base64,${e.data}`,...r==null?{}:{sizeBytes:r},isImage:n}}}function iq(e,t){let n=e.toolInvocation,r=MW(n.result,t);if(r)return r;let i=oK({invocation:n,texts:{toolStatusRunningLabel:t.toolStatusRunningLabel,toolStatusCompletedLabel:t.toolStatusCompletedLabel,toolStatusFailedLabel:t.toolStatusFailedLabel}});if(i)return{type:`tool-card`,card:NW(i,t)};let a=YG({invocation:n,actionLabel:t.showContentActionLabel??`Show content`,statusLabel:t.toolStatusCompletedLabel});if(a)return{type:`tool-card`,card:NW(a,t)};let o=PW({status:n.status,error:n.error,cancelled:n.cancelled,result:n.result,texts:t}),s=tq(n.result),c=Array.isArray(s?.issues)?s.issues.find(e=>typeof e==`string`&&e.trim().length>0):void 0,l=IG({toolName:n.toolName,status:n.status,toolCallId:n.toolCallId,args:n.args,parsedArgs:n.parsedArgs,result:n.result}),u=c?`Invalid arguments: ${c}`:l?.summary??MU(n.parsedArgs??n.args),d=c||(typeof n.error==`string`&&n.error.trim()?n.error.trim():``),f=!n.error&&kW(n.result),p=(!l?.fileOperation||!!n.error)&&!f,m=zW(n);return{type:`tool-card`,card:NW({kind:o.kind,name:n.toolName,...m?{agentId:m}:{},detail:u,inputData:l?void 0:n.parsedArgs??n.args,text:p&&d?d:void 0,outputData:p?n.result:void 0,callId:n.toolCallId||void 0,toolCallId:n.toolCallId||void 0,...n.execution?{execution:n.execution}:{},hasResult:o.hasResult,statusTone:s?`error`:o.statusTone,statusLabel:s?t.toolStatusFailedLabel:o.statusLabel,...l?.fileOperation?{fileOperation:l.fileOperation}:{}},t)}}function aq(e,t){return{type:`unknown`,label:t.unknownPartLabel,rawType:typeof e.type==`string`?e.type:`unknown`,text:AU(e)}}function oq(e){return e.type===`text`&&typeof e.text==`string`}function sq(e){return e.type===`reasoning`&&typeof e.reasoning==`string`}function cq(e){return e.type===`file`&&typeof e.mimeType==`string`&&typeof e.data==`string`}function lq(e){return e.type!==`tool-invocation`||typeof e.toolInvocation!=`object`||e.toolInvocation===null||Array.isArray(e.toolInvocation)?!1:`toolName`in e.toolInvocation&&typeof e.toolInvocation.toolName==`string`}function uq(e){if(LK(e.extensionType)){let t=BK(e.data);return t?{type:`custom`,id:t.deliveryId,customType:e.extensionType,data:t}:null}if(e.extensionType!==`nextclaw.context-compaction`)return null;let t=e.data;return!t||typeof t.id!=`string`||!t.checkpoint?null:{type:`custom`,id:t.id,customType:e.extensionType,data:{id:t.id,checkpoint:t.checkpoint},process:!0}}function dq(e){return e.type===`extension`&&`extensionType`in e&&typeof e.extensionType==`string`&&`data`in e}function fq(e){let{inlineTokens:t,part:n,texts:r}=e;return oq(n)?wW(n,t):sq(n)?nq(n,r):cq(n)?rq(n,r):lq(n)?iq(n,r):dq(n)?uq(n)??aq(n,r):aq(n,r)}function pq(e){let t=e.meta?.timestamp;return t&&Number.isFinite(Date.parse(t))?t:new Date().toISOString()}function mq(e,t){return e===`user`?t.user:e===`assistant`?t.assistant:e===`tool`?t.tool:e===`system`?t.system:t.fallback}function hq(e){return e===`user`||e===`assistant`||e===`tool`||e===`system`?e:`message`}function gq(e,t){return{id:e.id,role:hq(e.role),roleLabel:mq(e.role,t.texts.roleLabels),timestampLabel:t.formatTimestamp(pq(e)),status:e.meta?.status,processSummary:e.meta?.processSummary,executionSummaryLabel:e.meta?.executionSummaryLabel,moreActions:e.meta?.moreActions,parts:e.parts.map(n=>fq({part:n,inlineTokens:e.meta?.inlineTokens??[],texts:t.texts})).filter(e=>e!==null)}}var _q=`nextclawUiHistoryToolPayloadSummary`;function vq(e){let t=e.metadata?.[_q];if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,{toolCallCount:r}=n;return!Number.isInteger(r)||r<=0?null:{toolCallCount:r,toolNames:Array.isArray(n.toolNames)?n.toolNames.filter(e=>typeof e==`string`&&e.trim().length>0):[]}}function yq(e){return e.type===`reasoning`||e.type===`tool-invocation`}function bq(e){return e.type===`text`||e.type===`rich-text`?e.text.trim().length>0:e.type===`file`||e.type===`source`||e.type===`card`}function xq(e){if(e.role!==`assistant`||e.status===`pending`||e.status===`streaming`)return!1;let t=-1;for(let n=e.parts.length-1;n>=0;--n){let r=e.parts[n];if(r&&yq(r)){t=n;break}}return t>=0&&t<e.parts.length-1&&e.parts.slice(t+1).some(bq)}function Sq(e){let t=e.lifecycle?.startedAt,n=e.lifecycle?.endedAt;if(!t||!n)return null;let r=Date.parse(t),i=Date.parse(n);if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return null;let a=Math.round((i-r)/1e3),o=Math.floor(a/3600),s=Math.floor(a%3600/60),c=a%60;return o>0?s>0?`${o}h ${s}m`:`${o}h`:s>0?`${s}m ${c}s`:`${c}s`}function Cq({formatDeferredToolSummary:e,message:t,processedLabel:n}){if(!xq(t))return;let r=Sq(t),i=r?`${n} ${r}`:n,a=vq(t);return{label:a&&e?`${i} · ${e(a.toolCallCount,a.toolNames)}`:i}}function wq(e){let t=e>=1e9?{divisor:1e9,suffix:`b`}:e>=1e6?{divisor:1e6,suffix:`m`}:e>=1e3?{divisor:1e3,suffix:`k`}:null;return t?`${Math.round(e/t.divisor*10)/10}${t.suffix}`:String(e)}function Tq(e,t){if(e===null)return t;let n=wq(e);return e>=1e3?`${n} (${e})`:n}function Eq(e,t){let n=[];if(e.usage.inputTokens!==null&&n.push(`${wq(e.usage.inputTokens)} ${t.input}`),e.usage.outputTokens!==null&&n.push(`${wq(e.usage.outputTokens)} ${t.output}`),n.length===0&&e.usage.totalTokens!==null&&n.push(`${wq(e.usage.totalTokens)} ${t.tokens}`),n.length===0)return e.model;let r=`${e.model} · ${n.join(` / `)}`;return e.usage.status===`partial`?`${r} · ${t.partial}`:r}function Dq(e){let{labels:t,message:n}=e;if(n.role!==`assistant`)return null;let r=hK(n.metadata);if(!r)return null;let{usage:i}=r,a=[{label:t.fields.runId,value:r.runId},{label:t.fields.runtime,value:r.runtimeId},{label:t.fields.model,value:r.model},{label:t.fields.requestedModel,value:r.requestedModel??t.notAvailable},{label:t.fields.outcome,value:t.outcomes[r.outcome]},{label:t.fields.inputTokens,value:Tq(i.inputTokens,t.notAvailable)},{label:t.fields.outputTokens,value:Tq(i.outputTokens,t.notAvailable)},{label:t.fields.cachedInputTokens,value:Tq(i.cachedInputTokens,t.notAvailable)},{label:t.fields.totalTokens,value:Tq(i.totalTokens,t.notAvailable)},{label:t.fields.modelCallCount,value:i.modelCallCount?.toString()??t.notAvailable},{label:t.fields.reportedModelCallCount,value:i.reportedModelCallCount?.toString()??t.notAvailable},{label:t.fields.usageStatus,value:t.usageStatuses[i.status]}];return{cacheKey:JSON.stringify(r),summaryLabel:Eq(r,t),moreActions:{triggerLabel:t.moreActions,items:[{key:`ai-execution-metadata`,label:t.viewMetadata,dialog:{title:t.metadataTitle,description:t.metadataDescription,closeLabel:t.close,rows:a}}]}}}function Oq(...e){let t=e.filter(e=>!!e?.items.length);if(t.length!==0)return{triggerLabel:t[0].triggerLabel,items:t.flatMap(e=>e.items)}}function kq(e){let t=e?.run_spec;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function Aq(e){let t=kq(e)?.model;return typeof t==`string`&&t.trim()?t.trim():hK(e)?.model}function jq(e){let{labels:t,message:n}=e,r=CK(n.metadata);if(!r)return null;let{fields:i}=t,a=kq(n.metadata),o=[{label:i.actor,value:t.actors[r.actor]},{label:i.source,value:r.source},{label:i.triggeredAt,value:r.triggeredAt},{label:i.targetRunId,value:r.targetRunId},{label:i.sourceSessionId,value:r.sourceSessionId},{label:i.sourceMessageId,value:r.sourceMessageId},{label:i.sourceRunId,value:r.sourceRunId},{label:i.sourceToolCallId,value:r.sourceToolCallId},{label:i.sourceRequestId,value:r.sourceRequestId},{label:i.sourceModel,value:r.sourceModel},{label:i.targetModel,value:Aq(n.metadata)},{label:i.sourceContext,value:r.sourceContext?JSON.stringify(r.sourceContext,null,2):void 0}].map(e=>({label:e.label,value:e.value??t.notAvailable}));return o.push({label:i.raw,value:JSON.stringify({run_trigger:r,...a?{run_spec:a}:{}},null,2)}),{triggerLabel:t.moreActions,items:[{key:`run-trigger-metadata`,label:t.viewTrigger,dialog:{title:t.title,description:t.description,closeLabel:t.close,rows:o}}]}}function Mq(e){return{roleLabels:{user:b(`chatRoleUser`),assistant:b(`chatRoleAssistant`),tool:b(`chatRoleTool`),system:b(`chatRoleSystem`),fallback:b(`chatRoleMessage`)},reasoningLabel:b(`chatReasoning`),toolCallLabel:b(`chatToolCall`),toolResultLabel:b(`chatToolResult`),toolInputLabel:b(`chatToolInput`),toolNoOutputLabel:b(`chatToolNoOutput`),toolOutputLabel:b(`chatToolOutput`),toolStatusPreparingLabel:b(`chatToolStatusPreparing`),toolStatusRunningLabel:b(`chatToolStatusRunning`),toolStatusCompletedLabel:b(`chatToolStatusCompleted`),toolStatusFailedLabel:b(`chatToolStatusFailed`),toolStatusCancelledLabel:b(`chatToolStatusCancelled`),showContentActionLabel:b(`chatShowContentAction`),imageAttachmentLabel:b(`chatImageAttachment`),fileAttachmentLabel:b(`chatFileAttachment`),unknownPartLabel:b(`chatUnknownPart`)}}function Nq(){return{directory:{running:b(`chatToolDirectoryRunning`),success:b(`chatToolDirectorySuccess`),error:b(`chatToolDirectoryError`),cancelled:b(`chatToolDirectoryCancelled`)},web:{running:b(`chatToolWebRunning`),success:b(`chatToolWebSuccess`),error:b(`chatToolWebError`),cancelled:b(`chatToolWebCancelled`)},message:{running:b(`chatToolMessageRunning`),success:b(`chatToolMessageSuccess`),error:b(`chatToolMessageError`),cancelled:b(`chatToolMessageCancelled`)},session:{running:b(`chatToolSessionRunning`),success:b(`chatToolSessionSuccess`),error:b(`chatToolSessionError`),cancelled:b(`chatToolSessionCancelled`)},agent:{running:b(`chatToolAgentRunning`),success:b(`chatToolAgentSuccess`),error:b(`chatToolAgentError`),cancelled:b(`chatToolAgentCancelled`)},memory:{running:b(`chatToolMemoryRunning`),success:b(`chatToolMemorySuccess`),error:b(`chatToolMemoryError`),cancelled:b(`chatToolMemoryCancelled`)},schedule:{running:b(`chatToolScheduleRunning`),success:b(`chatToolScheduleSuccess`),error:b(`chatToolScheduleError`),cancelled:b(`chatToolScheduleCancelled`)},system:{running:b(`chatToolSystemRunning`),success:b(`chatToolSystemSuccess`),error:b(`chatToolSystemError`),cancelled:b(`chatToolSystemCancelled`)},image:{running:b(`chatToolImageRunning`),success:b(`chatToolImageSuccess`),error:b(`chatToolImageError`),cancelled:b(`chatToolImageCancelled`)},display:{running:b(`chatToolDisplayRunning`),success:b(`chatToolDisplaySuccess`),error:b(`chatToolDisplayError`),cancelled:b(`chatToolDisplayCancelled`)}}}function Pq(e){return{input:b(`chatAiExecutionInput`),output:b(`chatAiExecutionOutput`),tokens:b(`chatAiExecutionTokens`),partial:b(`chatAiExecutionPartial`),moreActions:b(`chatMessageMoreActions`),viewMetadata:b(`chatAiExecutionViewMetadata`),metadataTitle:b(`chatAiExecutionMetadataTitle`),metadataDescription:b(`chatAiExecutionMetadataDescription`),close:b(`chatAiExecutionMetadataClose`),notAvailable:b(`chatAiExecutionNotAvailable`),fields:{runId:b(`chatAiExecutionRunId`),runtime:b(`chatAiExecutionRuntime`),model:b(`chatAiExecutionModel`),requestedModel:b(`chatAiExecutionRequestedModel`),outcome:b(`chatAiExecutionOutcome`),inputTokens:b(`chatAiExecutionInputTokens`),outputTokens:b(`chatAiExecutionOutputTokens`),cachedInputTokens:b(`chatAiExecutionCachedInputTokens`),totalTokens:b(`chatAiExecutionTotalTokens`),modelCallCount:b(`chatAiExecutionModelCallCount`),reportedModelCallCount:b(`chatAiExecutionReportedModelCallCount`),usageStatus:b(`chatAiExecutionUsageStatus`)},outcomes:{completed:b(`chatAiExecutionOutcomeCompleted`),failed:b(`chatAiExecutionOutcomeFailed`),aborted:b(`chatAiExecutionOutcomeAborted`)},usageStatuses:{reported:b(`chatAiExecutionUsageReported`),partial:b(`chatAiExecutionUsagePartial`),unavailable:b(`chatAiExecutionUsageUnavailable`)}}}function Fq(e){return{moreActions:b(`chatMessageMoreActions`),viewTrigger:b(`chatRunTriggerView`),title:b(`chatRunTriggerTitle`),description:b(`chatRunTriggerDescription`),close:b(`chatRunTriggerClose`),notAvailable:b(`chatAiExecutionNotAvailable`),fields:{actor:b(`chatRunTriggerActor`),source:b(`chatRunTriggerSource`),triggeredAt:b(`chatRunTriggerTime`),targetRunId:b(`chatRunTriggerTargetRun`),sourceSessionId:b(`chatRunTriggerSourceSession`),sourceMessageId:b(`chatRunTriggerSourceMessage`),sourceRunId:b(`chatRunTriggerSourceRun`),sourceToolCallId:b(`chatRunTriggerSourceToolCall`),sourceRequestId:b(`chatRunTriggerSourceRequest`),sourceModel:b(`chatRunTriggerSourceModel`),targetModel:b(`chatRunTriggerTargetModel`),sourceContext:b(`chatRunTriggerSourceContext`),raw:b(`chatRunTriggerRaw`)},actors:{human:b(`chatRunTriggerActorHuman`),agent:b(`chatRunTriggerActorAgent`),automation:b(`chatRunTriggerActorAutomation`),system:b(`chatRunTriggerActorSystem`)}}}function Iq(e){return{addSelectionToChatLabel:b(`chatWorkspaceAddToChat`),selectionTooLongLabel:b(`chatWorkspaceExcerptSelectionTooLong`),copyCodeLabel:b(`chatCodeCopy`),copiedCodeLabel:b(`chatCodeCopied`),copyMessageLabel:b(`chatMessageCopy`),copiedMessageLabel:b(`chatMessageCopied`),excerptCharacterCountTemplate:b(`chatWorkspaceExcerptCharacterCount`),mermaidDiagramLabel:b(`chatMermaidDiagram`),mermaidExpandLabel:b(`chatMermaidExpand`),mermaidLoadingLabel:b(`chatMermaidLoading`),mermaidRenderErrorLabel:b(`chatMermaidRenderError`),previewZoomInLabel:b(`chatPreviewZoomIn`),previewZoomOutLabel:b(`chatPreviewZoomOut`),previewResetZoomLabel:b(`chatPreviewResetZoom`),typingLabel:b(`chatTyping`),pendingInputLabel:b(`chatSteeringPending`),reasoningCharacterCountTemplates:{inProgress:b(`chatReasoningInProgressCharacterCount`),completed:b(`chatReasoningCompletedCharacterCount`)},toolStatusLabels:{terminal:{running:b(`chatToolTerminalRunning`),success:b(`chatToolTerminalSuccess`),error:b(`chatToolTerminalError`),cancelled:b(`chatToolTerminalCancelled`)},fileRead:{running:b(`chatToolFileReadRunning`),success:b(`chatToolFileReadSuccess`),error:b(`chatToolFileReadError`),cancelled:b(`chatToolFileReadCancelled`)},fileEdit:{running:b(`chatToolFileEditRunning`),success:b(`chatToolFileEditSuccess`),error:b(`chatToolFileEditError`),cancelled:b(`chatToolFileEditCancelled`)},search:{running:b(`chatToolSearchRunning`),success:b(`chatToolSearchSuccess`),error:b(`chatToolSearchError`),cancelled:b(`chatToolSearchCancelled`)},builtIn:Nq()},attachmentOpenLabel:b(`chatAttachmentOpen`),attachmentAttachedLabel:b(`chatAttachmentAttached`),attachmentExpandLabel:b(`chatAttachmentExpand`),attachmentCloseLabel:b(`chatAttachmentClosePreview`),attachmentCategoryLabels:{archive:b(`chatAttachmentCategoryArchive`),audio:b(`chatAttachmentCategoryAudio`),code:b(`chatAttachmentCategoryCode`),data:b(`chatAttachmentCategoryData`),document:b(`chatAttachmentCategoryDocument`),generic:b(`chatAttachmentCategoryGeneric`),image:b(`chatAttachmentCategoryImage`),pdf:b(`chatAttachmentCategoryPdf`),sheet:b(`chatAttachmentCategorySheet`),video:b(`chatAttachmentCategoryVideo`)},toolActivitySegmentTemplates:{read:{one:b(`chatToolActivityReadOne`),other:b(`chatToolActivityReadOther`)},edit:{one:b(`chatToolActivityEditOne`),other:b(`chatToolActivityEditOther`)},directory:{one:b(`chatToolActivityDirectoryOne`),other:b(`chatToolActivityDirectoryOther`)},search:{one:b(`chatToolActivitySearchOne`),other:b(`chatToolActivitySearchOther`)},bash:{one:b(`chatToolActivityBashOne`),other:b(`chatToolActivityBashOther`)},web:{one:b(`chatToolActivityWebOne`),other:b(`chatToolActivityWebOther`)},agent:{one:b(`chatToolActivityAgentOne`),other:b(`chatToolActivityAgentOther`)},panel:{one:b(`chatToolActivityPanelOne`),other:b(`chatToolActivityPanelOther`)},other:{one:b(`chatToolActivityOtherOne`),other:b(`chatToolActivityOtherOther`)}},toolActivityFailedLabel:b(`chatProcessSummaryFailed`),toolActivityCancelledLabel:b(`chatProcessSummaryCancelled`),toolPayloadLoadingLabel:b(`chatToolPayloadLoading`),toolPayloadLoadFailedLabel:b(`chatToolPayloadLoadFailed`),toolActivityShowMoreTemplate:b(`chatToolActivityShowMore`)}}async function Lq(e){let t=await yk(e);I[t?`success`:`error`](b(t?`chatCodeCopied`:`chatWorkspaceCopyPathFailed`))}function Rq({busy:e,downloadUrl:t,entry:n,onAddToChat:r,onCreateFolder:i,onCreateFile:a,onDelete:o,onOpen:s,onRenameRequest:c,onRevealPath:l,onUpload:u,ownCreateTarget:d,parentRefresh:f,relativePath:p}){let m=n.kind===`directory`,h={key:`open`,items:[{key:`open`,label:b(`chatWorkspaceOpen`),icon:(0,U.jsx)(fe,{className:`h-4 w-4`}),onSelect:s}]},g={key:`manage`,items:m?[...a?[{key:`new-file`,label:b(`chatWorkspaceNewFile`),icon:(0,U.jsx)(Va,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>a(d)}]:[],...i?[{key:`new-folder`,label:b(`chatWorkspaceNewFolder`),icon:(0,U.jsx)(Ja,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>i(d)}]:[],...u?[{key:`upload`,label:b(`chatWorkspaceUploadFilesHere`),icon:(0,U.jsx)(_s,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>u(d)}]:[]]:[]},_={key:`nextclaw`,items:[...p&&r?[{key:`add-to-chat`,label:b(`chatWorkspaceAddToChat`),icon:(0,U.jsx)(wo,{className:`h-4 w-4`}),restoreFocus:!1,onSelect:()=>r(n,p)}]:[],...t?[{key:`download`,label:b(`chatWorkspaceDownloadFile`),icon:(0,U.jsx)(ja,{className:`h-4 w-4`}),href:t,download:n.name}]:[]]},v={key:`path`,items:[...l?[{key:`reveal`,label:b(`chatWorkspaceRevealInFileManager`),icon:(0,U.jsx)(bo,{className:`h-4 w-4`}),onSelect:()=>l(n.path)}]:[],{key:`copy-path`,label:b(`chatWorkspaceCopyPath`),icon:(0,U.jsx)(Oa,{className:`h-4 w-4`}),onSelect:()=>void Lq(n.path)},...p?[{key:`copy-relative-path`,label:b(`chatWorkspaceCopyRelativePath`),icon:(0,U.jsx)(Oa,{className:`h-4 w-4`}),onSelect:()=>void Lq(p)}]:[]]},y={key:`rename`,items:c?[{key:`rename`,label:b(`chatWorkspaceRename`),icon:(0,U.jsx)(Go,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:c}]:[]},x={key:`danger`,items:o?[{key:`delete`,label:b(`chatWorkspaceDelete`),icon:(0,U.jsx)(ms,{className:`h-4 w-4`}),destructive:!0,disabled:e,restoreFocus:!1,onSelect:()=>o(n,f)}]:[]};return m?[_,g,v,y,x]:[h,_,v,y,x]}var zq=`nextclaw.chat.workspace-project-tree.state`,Bq=1,Vq=12,Hq=256,Uq=1e7;function Wq(e){return!!e&&typeof e==`object`}function Gq(e){return(e?.trim().replace(/\\/g,`/`).replace(/\/+$/g,``)??``)||(e?.trim()===`/`?`/`:``)}function Kq(e){return e?.trim().replace(/\\/g,`/`).replace(/^\/+|\/+$/g,``).replace(/\/{2,}/g,`/`)??``}function qq(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.min(Math.max(0,Math.round(e)),Uq)}function Jq(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function Yq(e){return Array.isArray(e)?Array.from(new Set(e.map(e=>typeof e==`string`?Kq(e):``).filter(Boolean))).slice(0,Hq):[]}function Xq(e){return Wq(e)?Object.entries(e).map(([e,t])=>{let n=Gq(e);return!n||!Wq(t)?null:[n,{expandedPaths:Yq(t.expandedPaths),scrollTop:qq(t.scrollTop),updatedAt:Jq(t.updatedAt)}]}).filter(e=>e!==null).sort((e,t)=>t[1].updatedAt-e[1].updatedAt).slice(0,Vq).reduce((e,[t,n])=>(e[t]=n,e),{}):{}}function Zq(e){return Xq(e)}function Qq(){return{expandedPaths:[],scrollTop:0,updatedAt:Date.now()}}var $q=P()(Mi(e=>({trees:{},collapseAll:t=>{let n=Gq(t);n&&e(e=>{let t=e.trees[n];return!t||t.expandedPaths.length===0?e:{trees:Zq({...e.trees,[n]:{...t,expandedPaths:[],updatedAt:Date.now()}})}})},setDirectoryExpanded:(t,n,r)=>{let i=Gq(t),a=Kq(n);!i||!a||e(e=>{let t=e.trees[i]??Qq(),n=r?Array.from(new Set([...t.expandedPaths,a])).slice(0,Hq):t.expandedPaths.filter(e=>e!==a);return n.length===t.expandedPaths.length&&n.every((e,n)=>e===t.expandedPaths[n])?e:{trees:Zq({...e.trees,[i]:{...t,expandedPaths:n,updatedAt:Date.now()}})}})},setScrollTop:(t,n)=>{let r=Gq(t);if(!r)return;let i=qq(n);e(e=>{let t=e.trees[r]??Qq();return t.scrollTop===i?e:{trees:Zq({...e.trees,[r]:{...t,scrollTop:i,updatedAt:Date.now()}})}})}}),{name:zq,version:Bq,storage:Ni(()=>window.localStorage),partialize:e=>({trees:e.trees}),merge:(e,t)=>({...t,trees:Xq(Wq(e)?e.trees:null)})}));function eJ(e){return`${e.kind===`directory`?b(`chatWorkspaceOpenDirectory`):b(`chatWorkspaceOpenFile`)}: ${e.name}`}function tJ(e){return e instanceof Error?e.message:String(e)}function nJ(e){return e.error?tJ(e.error):null}function rJ({fileName:e,isDirectory:t,isExpanded:n}){return t?n?(0,U.jsx)(qa,{className:`h-4 w-4 shrink-0 text-amber-500`}):(0,U.jsx)(Qa,{className:`h-4 w-4 shrink-0 text-amber-500`}):(0,U.jsx)(bU,{fileName:e})}function iJ({browseQuery:e,level:t,onFileOpen:n,onRevealPath:r,parentCreateTarget:i,parentRelativePath:a,...o}){let s=e.data?.entries??[],c=nJ(e),l={paddingLeft:`${36+t*14}px`};return e.isLoading&&!e.data?(0,U.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-gray-400`,style:l,children:b(`chatWorkspaceLoadingDirectory`)}):c&&!e.data?(0,U.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-rose-600`,style:l,title:c,children:b(`chatWorkspaceDirectoryLoadFailed`)}):s.length===0?(0,U.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-gray-400`,style:l,children:b(`chatWorkspaceDirectoryEmpty`)}):s.map(s=>(0,U.jsx)(lJ,{...o,browseParentRefresh:()=>e.refetch(),entry:s,level:t+1,onFileOpen:n,onRevealPath:r,parentCreateTarget:i,relativePath:a?`${a}/${s.name}`:null},s.path))}function aJ({entry:e,onRename:t,refresh:n}){let[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(e.name),[s,c]=(0,H.useState)(null),l=()=>i(!1);return{active:r,cancel:l,error:s,name:a,start:()=>{o(e.name),c(null),i(!0)},submit:async()=>{let r=a.trim();if(!(!t||!r||r===`.`||r===`..`||r.includes(`/`)||r.includes(`\\`))){if(r===e.name){l();return}try{await t(e,r,n),l()}catch(e){c(`${b(`chatWorkspaceRenameFailed`)}: ${tJ(e)}`)}}},updateName:e=>{o(e),c(null)}}}function oJ(e,t,n,r){let i=!n&&e!==null&&e===t;return[i,n===null?i:n===r]}function sJ(e,t,n,r,i){return e||!!(!i&&t&&r&&n?.startsWith(`${r}/`))}function cJ(e,t){let[n,r]=(0,H.useState)(!1),i=Kq(t),a=$q(t=>!!(e&&i&&t.trees[e]?.expandedPaths.includes(i))),o=$q(e=>e.setDirectoryExpanded);return{manuallyExpanded:e&&i?a:n,updateExpanded:(0,H.useCallback)(t=>{if(e&&i){o(e,i,t);return}r(t)},[i,o,e])}}function lJ({activeRelativePath:e,browseParentRefresh:t,busy:n,createTarget:r,entry:i,level:a,onAddToChat:o,onCreateFolder:s,onCreateFile:c,onDelete:l,onRename:d,onFileOpen:f,onRevealComplete:p,onRevealPath:m,onSelect:h,onUpload:g,parentCreateTarget:_,relativePath:v,renderCreateFolder:y,revealPath:x,selectedPath:S,treeRootKey:C}){let w=(0,H.useRef)(null),T=(0,H.useRef)(null),E=i.kind===`directory`,{manuallyExpanded:D,updateExpanded:O}=cJ(C,v),k=sJ(D,E,e,v,S),A=aJ({entry:i,onRename:d,refresh:t}),j=MF({path:i.path,includeFiles:!0,enabled:E&&k}),M=j.refetch,N=E?null:ln(i.path),P=(0,H.useMemo)(()=>E?{label:i.name,path:i.path,refresh:()=>M(),expand:()=>O(!0)}:_,[i.name,i.path,E,_,M,O]),ee=(0,H.useMemo)(()=>({path:i.path,createTarget:P}),[i.path,P]),[te,ne]=oJ(e,v,S,i.path);(0,H.useLayoutEffect)(()=>{te&&w.current?.scrollIntoView?.({block:`nearest`})},[te]),(0,H.useLayoutEffect)(()=>{x===i.path&&(w.current?.scrollIntoView?.({block:`nearest`}),h(ee),T.current?.focus(),p())},[i.path,p,h,x,ee]);let re=()=>{h(ee),E?O(!k):f({path:i.path,label:i.name,viewMode:`preview`})},ie=Rq({busy:n,downloadUrl:N,entry:i,onAddToChat:o,onCreateFolder:s,onCreateFile:c,onDelete:l,onOpen:re,onRenameRequest:d?A.start:void 0,onRevealPath:m,onUpload:g,ownCreateTarget:P,parentRefresh:t,relativePath:v});return(0,U.jsxs)(`div`,{role:`treeitem`,"aria-expanded":E?k:void 0,"aria-label":eJ(i),"aria-selected":ne,children:[(0,U.jsx)(ii,{groups:ie,label:b(`chatWorkspaceFileContextMenu`),children:(0,U.jsxs)(`div`,{ref:w,"data-workspace-tree-entry":``,className:u(`group flex h-[26px] w-full min-w-0 items-center text-gray-700 transition-colors hover:bg-gray-100 focus-within:bg-gray-100`,ne?`bg-primary/10`:null,i.hidden?`opacity-65`:null),style:{paddingLeft:`${6+a*12}px`},onContextMenu:()=>h(ee),children:[A.active?(0,U.jsxs)(`form`,{className:`flex h-full min-w-0 flex-1 items-center gap-1`,onSubmit:e=>{e.preventDefault(),A.submit()},children:[(0,U.jsx)(Ct,{autoFocus:!0,"aria-label":b(`chatWorkspaceRenameName`),className:`h-6 min-w-0 flex-1 px-1.5 text-xs`,value:A.name,onChange:e=>A.updateName(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),A.cancel())}}),(0,U.jsx)(V,{icon:(0,U.jsx)(jr,{className:`h-3.5 w-3.5`}),label:b(`chatWorkspaceRename`),size:`sm`,onClick:()=>void A.submit()}),(0,U.jsx)(V,{icon:(0,U.jsx)(Ai,{className:`h-3.5 w-3.5`}),label:b(`cancel`),size:`sm`,onClick:A.cancel})]}):(0,U.jsxs)(`button`,{ref:T,type:`button`,"aria-label":i.name,className:`flex h-full min-w-0 flex-1 items-center gap-1 text-left text-[13px] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,onClick:re,onKeyDown:e=>{e.key===`F2`&&d&&(e.preventDefault(),A.start())},children:[(0,U.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-gray-400`,children:E?k?(0,U.jsx)(or,{className:`h-3.5 w-3.5`}):(0,U.jsx)(ha,{className:`h-3.5 w-3.5`}):null}),(0,U.jsx)(rJ,{fileName:i.name,isDirectory:E,isExpanded:k}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:i.name,children:i.name})]}),A.active?null:(0,U.jsx)(gi,{children:(0,U.jsx)(V,{className:`mr-1 opacity-0 pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 data-[context-menu-open]:pointer-events-auto data-[context-menu-open]:opacity-100`,icon:(0,U.jsx)(Na,{className:`h-3.5 w-3.5`}),label:b(`chatWorkspaceMoreActionsFor`).replace(`{name}`,i.name),size:`sm`,tooltipSide:`left`,onClick:()=>h(ee)})})]})}),A.error?(0,U.jsx)(`p`,{role:`alert`,className:`py-1 pr-2 text-[11px] text-destructive`,style:{paddingLeft:`${36+a*14}px`},children:A.error}):null,E&&k?(0,U.jsxs)(`div`,{role:`group`,children:[r?.path===i.path?y(a+1):null,(0,U.jsx)(iJ,{activeRelativePath:e,browseQuery:j,busy:n,createTarget:r,level:a,onAddToChat:o,onCreateFolder:s,onCreateFile:c,onDelete:l,onRename:d,onFileOpen:f,onRevealComplete:p,onRevealPath:m,onSelect:h,onUpload:g,parentCreateTarget:P,parentRelativePath:v,renderCreateFolder:y,revealPath:x,selectedPath:S,treeRootKey:C})]}):null]})}function uJ(e){let t=e.trim();return!!(t&&t!==`.`&&t!==`..`&&!t.includes(`/`)&&!t.includes(`\\`))}function dJ({error:e,kind:t,isCreating:n,level:r,name:i,onCancel:a,onNameChange:o,onSubmit:s}){let c=(0,H.useRef)(null),l=(0,H.useRef)(null),u=uJ(i);(0,H.useLayoutEffect)(()=>{let e=c.current;typeof e?.scrollIntoView==`function`&&e.scrollIntoView({block:`nearest`}),l.current?.focus(),l.current?.select()},[]);let d=e=>{e.preventDefault(),u&&!n&&s()};return(0,U.jsxs)(`form`,{ref:c,role:`treeitem`,"aria-label":b(t===`file`?`chatWorkspaceNewFile`:`chatWorkspaceNewFolder`),className:`bg-primary/5`,onSubmit:d,children:[(0,U.jsxs)(`div`,{className:`flex min-h-8 min-w-0 items-center gap-1 py-0.5 pr-1`,style:{paddingLeft:`${8+r*14}px`},children:[(0,U.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0`}),t===`file`?(0,U.jsx)(Wa,{className:`h-4 w-4 shrink-0 text-gray-500`}):(0,U.jsx)(Qa,{className:`h-4 w-4 shrink-0 text-amber-500`}),(0,U.jsx)(Ct,{ref:l,"aria-label":b(t===`file`?`chatWorkspaceFileName`:`chatWorkspaceFolderName`),className:`h-7 min-w-0 flex-1 rounded-md px-2 text-xs`,disabled:n,placeholder:b(t===`file`?`chatWorkspaceFileNamePlaceholder`:`chatWorkspaceFolderNamePlaceholder`),value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),a())}}),(0,U.jsx)(V,{disabled:!u||n,icon:(0,U.jsx)(jr,{className:`h-3.5 w-3.5`}),label:b(`chatWorkspaceCreateFolder`),size:`sm`,tooltipSide:`top`,onClick:s}),(0,U.jsx)(V,{disabled:n,icon:(0,U.jsx)(Ai,{className:`h-3.5 w-3.5`}),label:b(`cancel`),size:`sm`,tooltipSide:`top`,onClick:a})]}),e?(0,U.jsx)(`p`,{role:`alert`,className:`pb-1 pr-2 text-[11px] text-destructive`,style:{paddingLeft:`${42+r*14}px`},children:e}):null]})}function fJ({disabled:e,rootLabel:t,onCollapseAll:n,onNewFile:r,onNewFolder:i,onRefresh:a}){return(0,U.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-0.5 border-b border-gray-200/80 bg-gray-50/55 px-1.5`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-0.5 text-[11px] font-semibold uppercase tracking-[0.03em] text-gray-800`,title:t,children:t}),(0,U.jsx)(V,{icon:(0,U.jsx)(Va,{className:`h-4 w-4`}),label:b(`chatWorkspaceNewFile`),size:`sm`,disabled:e,onClick:r}),(0,U.jsx)(V,{icon:(0,U.jsx)(Ja,{className:`h-4 w-4`}),label:b(`chatWorkspaceNewFolder`),size:`sm`,disabled:e,onClick:i}),(0,U.jsx)(V,{icon:(0,U.jsx)(ki,{className:`h-4 w-4`}),label:b(`chatWorkspaceRefreshExplorer`),size:`sm`,onClick:a}),(0,U.jsx)(V,{icon:(0,U.jsx)(ga,{className:`h-4 w-4`}),label:b(`chatWorkspaceCollapseAll`),size:`sm`,onClick:n}),(0,U.jsx)(gi,{children:(0,U.jsx)(V,{icon:(0,U.jsx)(Na,{className:`h-4 w-4`}),label:b(`chatWorkspaceRootMoreActions`),size:`sm`})})]})}function pJ(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``)||`/`;return/^[a-z]:/i.test(t)?t.toLowerCase():t}function mJ(e,t){if(e[0]!==`server-path-browse`||e[3]!==!0||typeof e[1]!=`string`)return!1;let n=pJ(t),r=pJ(e[1]);return r===n||(n===`/`?r.startsWith(`/`):r.startsWith(`${n}/`))}function hJ({children:e,currentPath:t,onBlankContext:n,onContextMenu:r,rootDraft:i,showRoot:a}){let o=(0,H.useRef)(null),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=Gq(t),u=$q(e=>l?e.trees[l]?.scrollTop??0:0),d=$q(e=>e.setScrollTop);return(0,H.useLayoutEffect)(()=>{o.current&&l&&(o.current.scrollTop=u)},[u,l]),(0,H.useEffect)(()=>()=>{c.current&&clearTimeout(c.current),l&&s.current!==null&&d(l,s.current)},[d,l]),(0,U.jsx)(`div`,{ref:o,"data-testid":`workspace-directory-browser`,role:`tree`,tabIndex:-1,"aria-label":b(`chatWorkspaceProjectFiles`),className:`min-h-0 flex-1 overflow-auto py-1 custom-scrollbar`,onContextMenu:e=>{e.target.closest(`[data-workspace-tree-entry]`)||n(),r?.(e)},onScroll:e=>{l&&(s.current=e.currentTarget.scrollTop,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,s.current!==null&&d(l,s.current)},120))},children:a&&t?(0,U.jsxs)(U.Fragment,{children:[i,e]}):e})}function gJ(e){return e instanceof Error?e.message:String(e)}function _J(e,t){return e.replace(`{count}`,String(t))}function vJ(){let[e,t]=(0,H.useState)(null),n=(0,H.useRef)(null),r=async(e,r)=>{if(n.current)throw Error(`another workspace file operation is already running`);n.current=e,t(e);try{return await r()}finally{n.current=null,t(null)}};return{pendingAction:e,createDirectory:e=>r(`create-directory`,()=>Kt(e)),createFile:e=>r(`create-file`,()=>nn(e)),deleteEntry:e=>r(`delete`,()=>Pt(e)),renameEntry:e=>r(`rename`,()=>xt(e)),uploadFiles:e=>r(`upload`,()=>dn(e))}}async function yJ({actions:e,confirm:t,files:n,rootPath:r,target:i}){try{let a;try{a=await e.uploadFiles({basePath:r,targetPath:i.path,files:n})}catch(o){if(!(o instanceof rn)||o.code!==`SERVER_PATH_FILE_EXISTS`)throw o;let s=Array.isArray(o.details?.conflicts)?o.details.conflicts.length:n.length;if(!await t({title:b(`chatWorkspaceUploadConflictTitle`),description:_J(b(`chatWorkspaceUploadConflictDescription`),s),confirmLabel:b(`chatWorkspaceReplaceFiles`),variant:`destructive`}))return;a=await e.uploadFiles({basePath:r,targetPath:i.path,files:n,overwrite:!0})}await i.refresh(),I.success(_J(b(`chatWorkspaceUploadSucceeded`),a.files.length))}catch(e){I.error(`${b(`chatWorkspaceUploadFailed`)}: ${gJ(e)}`)}}async function bJ({actions:e,confirm:t,entry:n,refresh:r,rootPath:i}){let a=n.kind===`directory`;if(!await t({title:b(a?`chatWorkspaceDeleteFolderTitle`:`chatWorkspaceDeleteFileTitle`).replace(`{name}`,n.name),description:b(a?`chatWorkspaceDeleteFolderDescription`:`chatWorkspaceDeleteFileDescription`),confirmLabel:b(`chatWorkspaceDelete`),variant:`destructive`}))return;let o=I.loading(b(`chatWorkspaceDeleting`).replace(`{name}`,n.name));try{let t=await e.deleteEntry({basePath:i,path:n.path});return await r(),I.dismiss(o),I.success(b(`chatWorkspaceDeleteSucceeded`).replace(`{name}`,n.name)),t}catch(e){return I.dismiss(o),I.error(`${b(`chatWorkspaceDeleteFailed`).replace(`{name}`,n.name)}: ${gJ(e)}`),null}}async function xJ({actions:e,kind:t,name:n,rootPath:r,setError:i,target:a}){i(null);try{let i=await(t===`file`?e.createFile:e.createDirectory)({basePath:r,parentPath:a.path,name:n});return await a.refresh(),I.success(b(t===`file`?`chatWorkspaceFileCreated`:`chatWorkspaceFolderCreated`)),i}catch(e){return i(`${b(t===`file`?`chatWorkspaceFileCreateFailed`:`chatWorkspaceFolderCreateFailed`)}: ${gJ(e)}`),null}}function SJ({activeRelativePath:e,confirm:t,onEntryDeleted:n,onEntryRenamed:r,rootPath:i}){let a=(0,H.useRef)(null),o=vJ(),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(``),[d,f]=(0,H.useState)(`directory`),[p,m]=(0,H.useState)(null),[h,g]=(0,H.useState)(null),[_,v]=(0,H.useState)(null),[y,x]=(0,H.useState)(null),S=h?.activeRelativePath===e?h.selection:null,C=e=>{x(e),a.current&&(a.current.value=``,a.current.click())},w=t=>{g({activeRelativePath:e,selection:t})},T=(e,t)=>{t.expand?.(),f(e),u(``),m(null),c(t)};return{actions:{cancelCreateFolder:()=>{c(null),u(``),m(null)},clearSelection:()=>{g(null)},completeReveal:()=>v(null),deleteEntry:async(e,r)=>{if(!i)return;let a=await bJ({actions:o,confirm:t,entry:e,refresh:r,rootPath:i});a&&n?.(a.path)},openCreateFile:e=>T(`file`,e),openCreateFolder:e=>T(`directory`,e),renameEntry:async(t,n,a)=>{if(!i)return null;let s=await o.renameEntry({basePath:i,path:t.path,name:n});return r?.({previousPath:s.oldPath,path:s.path,label:s.name}),await a(),g(n=>n?.activeRelativePath===e?{activeRelativePath:e,selection:{path:s.path,createTarget:n.selection.createTarget.path===t.path?{...n.selection.createTarget,label:s.name,path:s.path}:n.selection.createTarget}}:null),v(s.path),I.success(b(`chatWorkspaceRenameSucceeded`).replace(`{name}`,s.name)),s},requestUpload:C,selectEntry:w,setCreateError:m,setCreateName:u,submitCreate:async()=>{if(!i||!s)return;let t=await xJ({actions:o,kind:d,name:l,rootPath:i,setError:m,target:s});t&&(c(null),g({activeRelativePath:e,selection:{path:t.path,createTarget:{label:l.trim(),path:t.path,refresh:s.refresh}}}),v(t.path))},uploadFiles:async e=>{!i||!y||e.length===0||await yJ({actions:o,confirm:t,files:e,rootPath:i,target:y})}},refs:{fileInputRef:a},state:{createError:p,createKind:d,createName:l,createTarget:s,pendingAction:o.pendingAction,revealPath:_,selectedCreateTarget:S?.createTarget??null,selectedPath:S?.path??null}}}var CJ=2*6e4;function wJ(e){let t=e.join(`
|
|
101
|
+
`);(0,H.useEffect)(()=>{let e=t.split(`
|
|
102
|
+
`).filter(Boolean);if(e.length===0)return;let n=!1,r=null,i=null,a=async()=>{try{let t=await nee({directories:e,subscriptionId:r});if(n){await Bt(t.subscriptionId).catch(()=>void 0);return}r=t.subscriptionId}catch(e){console.warn(`Project file auto-refresh is unavailable; manual refresh remains available.`,e)}};return a().then(()=>{!n&&r&&(i=setInterval(()=>void a(),CJ))}),()=>{n=!0,i&&clearInterval(i),r&&Bt(r).catch(()=>void 0)}},[t])}var TJ=[];function EJ(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function DJ({activeRelativePath:e,busy:t,createTarget:n,entries:r,fallbackParentTarget:i,mutable:a,onAddToChat:o,onCreateFile:s,onCreateFolder:c,onDelete:l,onFileOpen:u,onRevealComplete:d,onRename:f,onRevealPath:p,onSelect:m,onUpload:h,refresh:g,relativePaths:_,renderCreateFolder:v,revealPath:y,selectedPath:x,showRoot:S,treeRootKey:C}){return r.length===0?(0,U.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-gray-400`,children:b(`chatWorkspaceDirectoryEmpty`)}):r.map(r=>(0,U.jsx)(lJ,{activeRelativePath:e,browseParentRefresh:g,busy:t,createTarget:n,entry:r,level:S?1:0,onAddToChat:o,onCreateFile:a?s:void 0,onCreateFolder:a?c:void 0,onDelete:a?l:void 0,onFileOpen:u,onRevealComplete:d,onRename:f,onRevealPath:p,onSelect:m,onUpload:a?h:void 0,parentCreateTarget:i,relativePath:_?r.name:null,renderCreateFolder:v,revealPath:y,selectedPath:x,treeRootKey:C},r.path))}function OJ({busy:e,onCollapseAll:t,onCreateFile:n,onCreateFolder:r,onRefresh:i,onRevealPath:a,onUpload:o,target:s}){return[{key:`manage`,items:[{key:`new-file`,label:b(`chatWorkspaceNewFile`),icon:(0,U.jsx)(Va,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:n},{key:`new-folder`,label:b(`chatWorkspaceNewFolder`),icon:(0,U.jsx)(Ja,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:r},{key:`upload`,label:b(`chatWorkspaceUploadFilesHere`),icon:(0,U.jsx)(_s,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:o}]},{key:`view`,items:[{key:`refresh`,label:b(`chatWorkspaceRefreshExplorer`),icon:(0,U.jsx)(ki,{className:`h-4 w-4`}),onSelect:i},{key:`collapse`,label:b(`chatWorkspaceCollapseAll`),icon:(0,U.jsx)(ga,{className:`h-4 w-4`}),onSelect:t}]},{key:`path`,items:[...a?[{key:`reveal`,label:b(`chatWorkspaceRevealInFileManager`),icon:(0,U.jsx)(bo,{className:`h-4 w-4`}),onSelect:()=>a(s.path)}]:[],{key:`copy-path`,label:b(`chatWorkspaceCopyPath`),icon:(0,U.jsx)(Oa,{className:`h-4 w-4`}),onSelect:()=>void Lq(s.path)}]}]}function kJ({activeRelativePath:e,browseQuery:t,ConfirmDialog:n,controller:r,entries:i,onAddToChat:a,onFileOpen:o,onRevealPath:s,rootLabel:c,rootPath:l,showRoot:u}){let d=xe(),{cancelCreateFolder:f,clearSelection:p,completeReveal:m,submitCreate:h,deleteEntry:g,openCreateFile:_,openCreateFolder:v,requestUpload:y,renameEntry:x,selectEntry:S,setCreateError:C,setCreateName:w,uploadFiles:T}=r.actions,{fileInputRef:E}=r.refs,{createError:D,createKind:O,createName:k,createTarget:A,pendingAction:j,revealPath:M,selectedCreateTarget:N,selectedPath:P}=r.state,ee=j!==null,te=Gq(l),ne=$q(e=>e.collapseAll),re=()=>l?d.refetchQueries({predicate:e=>mJ(e.queryKey,l),type:`active`}):t.refetch(),ie=l?{label:c,path:l,refresh:re}:null,ae=N??ie,oe=e=>(0,U.jsx)(dJ,{error:D,kind:O,isCreating:j===`create-directory`||j===`create-file`,level:e,name:k,onCancel:f,onNameChange:e=>{w(e),C(null)},onSubmit:()=>void h()}),se=(0,U.jsx)(DJ,{activeRelativePath:e,busy:ee,createTarget:A,entries:i,fallbackParentTarget:ie??{label:``,path:t.data?.currentPath??``,refresh:re},mutable:!!l,onAddToChat:a,onCreateFile:_,onCreateFolder:v,onDelete:(e,t)=>void g(e,t),onFileOpen:o,onRevealComplete:m,onRename:x,onRevealPath:s,onSelect:S,onUpload:y,refresh:re,relativePaths:!!a,renderCreateFolder:oe,revealPath:M,selectedPath:P,showRoot:!1,treeRootKey:te||null}),ce=(0,U.jsx)(hJ,{currentPath:l,onBlankContext:p,rootDraft:A?.path===l?oe(0):null,showRoot:u,children:se}),le=ie?OJ({busy:ee,onCollapseAll:()=>{te&&ne(te)},onCreateFile:()=>_(ie),onCreateFolder:()=>v(ie),onRefresh:()=>void re(),onRevealPath:s,onUpload:()=>y(ie),target:ie}):[],ue=(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,onContextMenu:e=>{e.target.closest(`[data-workspace-tree-entry]`)||p()},children:[l&&ae?(0,U.jsx)(fJ,{disabled:ee,rootLabel:c,onCollapseAll:()=>{te&&ne(te)},onNewFile:()=>_(ae),onNewFolder:()=>v(ae),onRefresh:()=>void re()}):null,l?(0,U.jsx)(`input`,{ref:E,type:`file`,multiple:!0,className:`sr-only`,"aria-label":b(`chatWorkspaceUploadFiles`),onChange:e=>void T(Array.from(e.currentTarget.files??[]))}):null,ce,(0,U.jsx)(n,{})]});return ie?(0,U.jsx)(ii,{groups:le,label:b(`chatWorkspaceRootContextMenu`),children:ue}):ue}function AJ({activeRelativePath:e=null,browseQuery:t,onFileOpen:n,sessionKey:r,renderStatus:i,showRoot:a=!1}){let o=eI(),{confirm:s,ConfirmDialog:c}=On(),l=t.data?.entries??[],u=nJ(t),d=a?t.data?.currentPath??null:null,f=Gq(d),p=$q(e=>f?e.trees[f]?.expandedPaths??TJ:TJ);wJ((0,H.useMemo)(()=>{if(!d)return[];let e=d.includes(`\\`)&&!d.includes(`/`)?`\\`:`/`,t=d.replace(/[\\/]+$/g,``),n=new Set(p);return[d,...p.filter(e=>{let t=e.split(`/`);return t.slice(0,-1).every((e,r)=>n.has(t.slice(0,r+1).join(`/`)))}).map(n=>`${t}${e}${n.replace(/[\\/]+/g,e)}`)]},[p,d]));let m=d?EJ(d):``,h=SJ({activeRelativePath:e,confirm:s,onEntryDeleted:o.chatThreadManager.removeWorkspacePath,onEntryRenamed:o.chatThreadManager.renameWorkspacePath,rootPath:d}),g=ji.canRevealPath()?e=>{ji.revealPath(e).then(e=>{e.revealed||I.error(b(`chatWorkspaceRevealPathFailed`))})}:void 0,_=r===void 0?void 0:(e,t)=>{(e.kind===`directory`?o.chatComposerIntentManager.requestDirectoryReference:o.chatComposerIntentManager.requestFileReference)({targetSessionKey:r,tokenKey:t,label:e.name})};return t.isLoading&&!t.data?i({text:b(`chatWorkspaceLoadingDirectory`)}):u&&!t.data?i({tone:`error`,text:`${b(`chatWorkspaceDirectoryLoadFailed`)}: ${u}`}):(0,U.jsx)(kJ,{activeRelativePath:e,browseQuery:t,ConfirmDialog:c,controller:h,entries:l,onAddToChat:_,onFileOpen:n,onRevealPath:g,rootLabel:m,rootPath:d,showRoot:a})}function jJ({name:e,kind:t}){return t===`directory`?(0,U.jsx)(Qa,{className:`h-3.5 w-3.5 shrink-0 text-emerald-600`}):(0,U.jsx)(bU,{fileName:e,size:`compact`})}function MJ({browsePath:e,onBrowsePathChange:t,onClose:n,onFileOpen:r}){let i=MF({path:e,includeFiles:!0,enabled:!!e}),a=i.error?i.error instanceof Error?i.error.message:String(i.error):null,o=i.data?.entries??[],s=e=>{if(e.kind===`directory`){t(e.path);return}r({path:e.path,label:e.name,viewMode:`preview`}),n()};return(0,U.jsxs)(`div`,{"data-testid":`workspace-breadcrumb-browser`,className:`flex max-h-72 flex-col overflow-hidden`,children:[(0,U.jsx)(`div`,{className:`border-b border-gray-200 px-2 py-1`,children:(0,U.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-0.5 text-[11px] leading-none text-gray-600`,children:i.data?.breadcrumbs.map((e,n)=>(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`h-5 rounded-sm px-1 text-left hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>t(e.path),children:e.label}),n<i.data.breadcrumbs.length-1?(0,U.jsx)(ha,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))})}),(0,U.jsx)(FF,{className:`min-h-0 flex-1 px-1 py-1`,children:i.isLoading?(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-4 text-[11px] text-gray-500`,children:[(0,U.jsx)(Di,{className:`h-3.5 w-3.5 animate-spin`}),b(`loading`)]}):a?(0,U.jsxs)(`div`,{className:`px-2 py-3 text-[11px] text-rose-600`,children:[b(`pathBrowseFailed`),`: `,a]}):o.length>0?(0,U.jsx)(`div`,{className:`space-y-0.5`,children:o.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:u(`flex h-6 w-full items-center gap-1.5 rounded-sm px-1.5 text-left text-[11px] text-gray-700 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e.hidden?`opacity-65`:null),onClick:()=>s(e),children:[(0,U.jsx)(jJ,{kind:e.kind,name:e.name}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`directory`?(0,U.jsx)(ha,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))}):(0,U.jsx)(`div`,{className:`px-2 py-4 text-[11px] text-gray-500`,children:b(`emptyDirectory`)})})]})}function NJ({value:e}){return(0,U.jsx)(`span`,{className:`inline-flex h-5 items-center rounded-sm border border-amber-200 bg-amber-50 px-1.5 text-[10px] font-medium leading-none text-amber-700`,children:e})}function PJ({onFileOpen:e,segment:t}){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(t.browsePath);return(0,U.jsxs)(CF,{open:n,onOpenChange:e=>{e&&a(t.browsePath),r(e)},children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-current":t.isCurrent?`page`:void 0,className:u(`inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1 text-[11px] leading-none transition-colors hover:bg-gray-200/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,t.kind===`workspace`?`bg-primary/8 text-primary hover:bg-primary/12`:t.isCurrent?`bg-gray-200/70 text-gray-900`:`text-gray-500`),disabled:!t.browsePath,children:[t.kind===`workspace`?(0,U.jsx)(Ya,{className:`h-3 w-3 shrink-0`}):t.kind===`directory`&&t.isCurrent?(0,U.jsx)(Qa,{className:`h-3 w-3 shrink-0`}):t.isCurrent?(0,U.jsx)(bU,{fileName:t.label,size:`compact`}):null,(0,U.jsx)(`span`,{children:t.label})]})}),(0,U.jsx)(EF,{"data-testid":`workspace-breadcrumb-popover`,className:`w-[22rem] rounded-md p-0`,align:`start`,children:(0,U.jsx)(MJ,{browsePath:i,onBrowsePathChange:a,onClose:()=>r(!1),onFileOpen:e})})]})}function FJ({breadcrumb:e,leading:t,onFileOpen:n,trailing:r}){let i=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{let e=i.current;if(!e)return;let t=e.querySelector(`[aria-current="page"]`);if(!t)return;let n=()=>{let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.right>n.right?e.scrollLeft+=r.right-n.right:r.left<n.left&&(e.scrollLeft-=n.left-r.left)};if(n(),typeof ResizeObserver>`u`)return;let r=new ResizeObserver(n);return r.observe(e),r.observe(t),()=>r.disconnect()},[e.fullPath]),(0,U.jsxs)(`div`,{"data-testid":`workspace-file-breadcrumbs`,title:e.fullPath,className:`flex min-w-0 items-center border-b border-gray-200/80 bg-gray-50/55`,children:[t?(0,U.jsx)(`div`,{className:`flex h-full shrink-0 items-center pl-1 pr-0.5`,children:t}):null,(0,U.jsxs)(`div`,{ref:i,"data-testid":`workspace-file-breadcrumb-scroll`,className:`workspace-horizontal-scrollbar flex min-w-0 flex-1 items-center gap-2.5 overflow-x-auto overflow-y-hidden px-3 py-1.5`,children:[(0,U.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 pr-1`,children:e.segments.map((t,r)=>(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(PJ,{segment:t,onFileOpen:n}),r<e.segments.length-1?(0,U.jsx)(ha,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},t.key))}),e.truncated?(0,U.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:(0,U.jsx)(NJ,{value:b(`chatWorkspacePreviewTruncated`)})}):null]}),r?(0,U.jsx)(`div`,{className:`flex shrink-0 items-center py-1.5 pr-2 pl-0.5`,children:r}):null]})}var IJ=8e3;function LJ(e){return e.match(/\n/g)?.length??0}function RJ(e){let{label:t,path:n,selectedText:r,sourceStartLine:i=1,sourceText:a}=e,o=n.trim(),s=t.trim(),c=r.trim();if(!o||!s||!c)return null;let l=a.indexOf(c),u=l>=0&&l===a.lastIndexOf(c)?(i??1)+LJ(a.slice(0,l)):null;return{path:o,label:s,excerpt:c,startLine:u,endLine:u===null?null:u+LJ(c)}}function zJ({children:e,fileLabel:t,filePath:n,onAddToChat:r,sourceStartLine:i,sourceText:a}){return(0,U.jsx)(_F,{actionLabel:b(`chatWorkspaceAddToChat`),className:`h-full min-h-0`,maxCharacters:IJ,selectionTooLongLabel:b(`chatWorkspaceExcerptSelectionTooLong`),onAddToChat:({text:e})=>{let o=RJ({path:n,label:t,selectedText:e,sourceText:a,sourceStartLine:i});o&&r?.(o)},children:e})}function BJ(e){let[t,n]=(0,H.useState)(null),r=t?.contentUrl===e?t:null;return(0,H.useEffect)(()=>{let t=new AbortController;return fetch(e,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`Unable to load document (${e.status}).`);return e.arrayBuffer()}).then(r=>{t.signal.aborted||n({contentUrl:e,status:`ready`,data:r})}).catch(r=>{t.signal.aborted||(console.error(`Failed to load workspace document`,r),n({contentUrl:e,status:`error`,data:null}))}),()=>t.abort()},[e]),{status:r?.status??`loading`,data:r?.data??null}}function VJ({status:e}){return e===`ready`?null:(0,U.jsx)(`div`,{className:`absolute inset-0 z-10 flex items-center justify-center bg-background/90 px-6 text-center text-sm text-muted-foreground`,children:b(e===`loading`?`chatWorkspaceLoadingPreview`:`chatWorkspacePreviewFailed`)})}function HJ(e){let t=Array.from(e.querySelectorAll(`.docx-wrapper > section.docx`)).some(e=>!e.style.width&&!e.style.padding);if(e.classList.toggle(`workspace-docx-preview--reflow`,t),t)for(let t of e.querySelectorAll(`table`)){if(t.querySelectorAll(`col`).length<5)continue;let e=document.createElement(`div`);e.className=`workspace-docx-wide-table`,t.before(e),e.append(t)}}function UJ({contentUrl:e}){let t=(0,H.useRef)(null),n=BJ(e),[r,i]=(0,H.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,H.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=!1;return r.replaceChildren(),ae(()=>import(`./docx-preview-BqwAjrj3.js`).then(async t=>{await t.renderAsync(n.data,r,r,{breakPages:!0,inWrapper:!0,ignoreLastRenderedPageBreak:!1}),a||(HJ(r),i({contentUrl:e,status:`ready`}))}),__vite__mapDeps([22,4,23])).catch(t=>{a||(console.error(`Failed to render DOCX preview`,t),i({contentUrl:e,status:`error`}))}),()=>{a=!0,r.replaceChildren()}},[e,n.data]),(0,U.jsxs)(`div`,{className:`relative h-full overflow-auto bg-muted/40 p-4 custom-scrollbar`,children:[(0,U.jsx)(VJ,{status:o}),(0,U.jsx)(`div`,{ref:t,className:`workspace-docx-preview min-h-full`,"data-testid":`workspace-content-docx`})]})}function WJ({contentUrl:e}){let t=(0,H.useRef)(null),n=BJ(e),[r,i]=(0,H.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,H.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=new AbortController,o=null;return r.replaceChildren(),ae(async()=>{let{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}=await import(`./aiden0z-pptx-renderer.es-Dp2ezlQn.js`);return{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}},__vite__mapDeps([24,4,23])).then(async({PptxViewer:t,RECOMMENDED_ZIP_LIMITS:s})=>{if(o=await t.open(n.data,r,{renderMode:`list`,fitMode:`contain`,lazySlides:!0,lazyMedia:!0,pdfjs:!1,scrollContainer:r,signal:a.signal,zipLimits:s,listOptions:{windowed:!0,batchSize:8,initialSlides:4,overscanViewport:1.5}}),a.signal.aborted){o.destroy(),o=null;return}i({contentUrl:e,status:`ready`})}).catch(t=>{a.signal.aborted||(console.error(`Failed to render presentation preview`,t),i({contentUrl:e,status:`error`}))}),()=>{a.abort(),o?.destroy(),r.replaceChildren()}},[e,n.data]),(0,U.jsxs)(`div`,{className:`relative h-full bg-muted/40`,children:[(0,U.jsx)(VJ,{status:o}),(0,U.jsx)(`div`,{ref:t,className:`h-full overflow-auto p-4 custom-scrollbar`,"data-testid":`workspace-content-presentation`})]})}var GJ=500,KJ=100;function qJ(e){let t=``,n=e+1;for(;n>0;)--n,t=String.fromCharCode(65+n%26)+t,n=Math.floor(n/26);return t}function JJ({contentUrl:e}){let t=BJ(e),[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(``),o=n?.contentUrl===e?n:null,s=t.status===`ready`?o?.status??`loading`:t.status,c=o?.sheets.find(e=>e.name===i)??o?.sheets[0]??null;return(0,H.useEffect)(()=>{if(!t.data)return;let n=!1;return ae(()=>import(`./xlsx-DrDuDNAa.js`).then(i=>{let a=i.read(t.data,{dense:!0,sheetRows:GJ+1}),o=a.SheetNames.map(e=>{let t=a.Sheets[e],n=t?i.utils.sheet_to_json(t,{header:1,raw:!1,defval:``,blankrows:!1}):[],r=n.slice(0,GJ).map(e=>e.slice(0,KJ).map(e=>String(e??``)));return{name:e,rows:r,columnCount:Math.min(KJ,r.reduce((e,t)=>Math.max(e,t.length),0)),truncated:n.length>GJ||n.some(e=>e.length>KJ)}});n||r({contentUrl:e,status:`ready`,sheets:o})}),[]).catch(t=>{n||(console.error(`Failed to render spreadsheet preview`,t),r({contentUrl:e,status:`error`,sheets:[]}))}),()=>{n=!0}},[e,t.data]),(0,U.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col bg-white`,"data-testid":`workspace-content-spreadsheet`,children:[(0,U.jsx)(VJ,{status:s}),o&&o.sheets.length>1?(0,U.jsx)(`div`,{className:`flex shrink-0 gap-1 overflow-x-auto border-b border-border px-2 py-1.5 custom-scrollbar`,children:o.sheets.map(e=>(0,U.jsx)(`button`,{type:`button`,className:u(`h-7 shrink-0 rounded-md px-2.5 text-xs transition-colors`,e.name===c?.name?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),onClick:()=>a(e.name),children:e.name},e.name))}):null,c?(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto custom-scrollbar`,children:(0,U.jsxs)(`table`,{className:`min-w-full border-collapse text-xs text-foreground`,children:[(0,U.jsx)(`thead`,{className:`sticky top-0 z-[1] bg-muted`,children:(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{className:`sticky left-0 z-[2] h-7 min-w-10 border border-border bg-muted px-2`}),Array.from({length:c.columnCount},(e,t)=>(0,U.jsx)(`th`,{className:`h-7 min-w-24 border border-border px-2 text-center font-medium text-muted-foreground`,children:qJ(t)},t))]})}),(0,U.jsx)(`tbody`,{children:c.rows.map((e,t)=>(0,U.jsxs)(`tr`,{children:[(0,U.jsx)(`th`,{className:`sticky left-0 min-w-10 border border-border bg-muted px-2 text-right font-normal text-muted-foreground`,children:t+1}),Array.from({length:c.columnCount},(t,n)=>(0,U.jsx)(`td`,{className:`max-w-80 whitespace-pre-wrap border border-border px-2 py-1.5 align-top`,children:e[n]??``},n))]},t))})]})}):null,c?.truncated?(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border bg-muted/60 px-3 py-1.5 text-xs text-muted-foreground`,children:b(`chatWorkspaceSpreadsheetPreviewTruncated`)}):null]})}function YJ(e){let t=e.mimeType?.trim().toLowerCase()??``,n=e.path.trim().toLowerCase();return t.startsWith(`image/`)||/\.(avif|bmp|gif|heic|heif|ico|jpe?g|png|svg|tiff?|webp)$/i.test(n)?`image`:t.startsWith(`audio/`)||/\.(aac|flac|m4a|mp3|ogg|opus|wav|weba)$/i.test(n)?`audio`:t.startsWith(`video/`)||/\.(avi|m4v|mkv|mov|mp4|webm|wmv)$/i.test(n)?`video`:t.includes(`pdf`)||n.endsWith(`.pdf`)?`pdf`:t===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n.endsWith(`.docx`)?`docx`:t.includes(`spreadsheet`)||t.includes(`excel`)||/\.(ods|xls|xlsb|xlsm|xlsx)$/i.test(n)?`spreadsheet`:t===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n.endsWith(`.pptx`)?`presentation`:t.includes(`html`)||/\.html?$/i.test(n)?`html`:`other`}function XJ({contentUrl:e,label:t}){return(0,U.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-6 text-center`,"data-testid":`workspace-content-unsupported`,children:[(0,U.jsxs)(`div`,{className:`max-w-sm space-y-1.5`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,title:t,children:t}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:b(`chatWorkspacePreviewUnsupported`)}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground/80`,children:b(`chatWorkspacePreviewUnsupportedHint`)})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,U.jsx)(`a`,{href:e,download:t,className:`inline-flex h-8 items-center rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-muted`,children:b(`chatWorkspacePreviewDownload`)}),(0,U.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`inline-flex h-8 items-center rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90`,children:b(`chatWorkspacePreviewOpenExternally`)})]})]})}function ZJ({contentUrl:e,contentParams:t,label:n,onContentHeightChange:r}){let i=(0,H.useRef)(null),a=(0,H.useRef)(null),o=g(t);(0,H.useEffect)(()=>()=>{a.current?.()},[]);let s=()=>{a.current?.(),a.current=null;let e=i.current;if(!(!e||!r||typeof ResizeObserver>`u`))try{let t=e.contentDocument;if(!t)return;let n=()=>{let e=j(t.body,t.documentElement);e>0&&r(e)},i=new ResizeObserver(n);i.observe(t.documentElement),t.body&&i.observe(t.body),n(),a.current=()=>i.disconnect()}catch{}};return(0,U.jsx)(`iframe`,{ref:i,allowFullScreen:!0,className:`h-full w-full border-0 bg-white`,"data-testid":`workspace-html-preview`,name:o,src:ne(e,t),title:n,onLoad:s},o??`no-content-params`)}function QJ({contentUrl:e,contentParams:t,kind:n,label:r,onHtmlContentHeightChange:i}){return n===`image`?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center overflow-auto bg-white p-4 custom-scrollbar`,children:(0,U.jsx)(`img`,{src:e,alt:r,className:`max-h-full max-w-full object-contain`,"data-testid":`workspace-content-image`})}):n===`audio`?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center bg-white px-6`,children:(0,U.jsx)(`audio`,{controls:!0,preload:`metadata`,"aria-label":r,className:`w-full max-w-xl`,"data-testid":`workspace-content-audio`,src:e})}):n===`video`?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center bg-black`,children:(0,U.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,"aria-label":r,className:`max-h-full max-w-full`,"data-testid":`workspace-content-video`,src:e})}):n===`html`?(0,U.jsx)(ZJ,{contentUrl:e,contentParams:t,label:r,onContentHeightChange:i}):n===`pdf`?(0,U.jsx)(`iframe`,{allowFullScreen:!0,className:`h-full w-full border-0 bg-white`,"data-testid":`workspace-content-pdf`,src:e,title:r}):n===`docx`?(0,U.jsx)(UJ,{contentUrl:e}):n===`spreadsheet`?(0,U.jsx)(JJ,{contentUrl:e}):n===`presentation`?(0,U.jsx)(WJ,{contentUrl:e}):(0,U.jsx)(XJ,{contentUrl:e,label:r})}function $J(e){return[`server-path-read`,e.path?.trim()??``,e.basePath??null,e.line??null]}function eY(e){let{basePath:t,enabled:n=!0,line:r,path:i}=e,a=i?.trim()??``;return z({queryKey:$J({path:a,basePath:t,line:r}),queryFn:()=>Yt({path:a,basePath:t,line:r}),enabled:n&&a.length>0,staleTime:0})}var tY=`h1, h2, h3, h4, h5, h6`,nY=`data-workspace-markdown-heading-index`,rY=16;function iY(e){let t=[],n=[];return e.querySelectorAll(tY).forEach(e=>{e.removeAttribute(nY);let r=e.textContent?.replace(/\s+/g,` `).trim();if(!r)return;let i=Number(e.tagName.slice(1));for(;t.length>0&&t[t.length-1]>=i;)t.pop();let a=n.length;e.setAttribute(nY,String(a)),n.push({depth:t.length,index:a,label:r}),t.push(i)}),n}function aY({contentKey:e,documentKey:t,scrollContainerRef:n}){let[r,i]=(0,H.useState)([]),[a,o]=(0,H.useState)(!1),s=(0,H.useRef)(null),c=(0,H.useRef)(0);if((0,H.useEffect)(()=>{c.current=0,o(!1);let e=n.current;if(!e){i([]);return}return i(iY(e)),()=>{e.querySelectorAll(`[${nY}]`).forEach(e=>e.removeAttribute(nY))}},[e,t,n]),r.length===0)return null;let l=b(`chatWorkspaceMarkdownOutline`),u=e=>{!e&&s.current&&(c.current=s.current.scrollTop),o(e)},d=e=>{let t=n.current,r=t?.querySelector(`[${nY}="${e}"]`);if(!t||!r)return;u(!1);let i=t.scrollTop+r.getBoundingClientRect().top-t.getBoundingClientRect().top;t.scrollTo({top:Math.max(0,i-rY)})};return(0,U.jsxs)(CF,{open:a,onOpenChange:u,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(yo,{className:`h-3.5 w-3.5`}),label:l,size:`sm`,tone:`surface`,className:`rounded-sm data-[state=open]:bg-gray-200/80 data-[state=open]:text-gray-900`})}),(0,U.jsx)(EF,{align:`end`,className:`w-[min(20rem,calc(100vw-1.5rem))] rounded-lg p-1.5`,"data-testid":`workspace-markdown-outline-popover`,children:(0,U.jsx)(`nav`,{ref:e=>{s.current=e,e&&(e.scrollTop=c.current)},"aria-label":l,className:`max-h-80 overflow-y-auto custom-scrollbar`,children:(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:r.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`button`,{type:`button`,className:`block w-full truncate rounded-md py-1.5 pr-2 text-left text-xs leading-4 text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-950 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border active:bg-gray-200`,style:{paddingInlineStart:`${.5+e.depth*.75}rem`},title:e.label,onClick:()=>d(e.index),children:e.label})},e.index))})})})]})}function oY({restorationKey:e,scrollRef:t,isEnabled:n=!0}){let r=(0,H.useRef)(null),i=(0,H.useRef)(null),a=t??r;return(0,H.useLayoutEffect)(()=>{if(!n||!e)return;let t=a.current,r=vi.read(e);return t&&r&&(t.scrollLeft=r.x,t.scrollTop=r.y),t&&(i.current={x:t.scrollLeft,y:t.scrollTop}),()=>{t&&vi.save(e,i.current??{x:t.scrollLeft,y:t.scrollTop})}},[n,e,a]),{onScroll:(0,H.useCallback)(t=>{if(!n||!e)return;let r={x:t.currentTarget.scrollLeft,y:t.currentTarget.scrollTop};i.current=r,vi.save(e,r)},[n,e]),scrollRef:a}}function sY(e){return e.serverKind?e.serverKind:/\.mdx?$/i.test(e.path)?`markdown`:`text`}function cY(e,t){return t<=0?e:`${e}${e.includes(`?`)?`&`:`?`}refresh=${t}`}function lY(e){let{contentUrl:t,fileKey:n,previewKind:r,previewText:i,previewViewer:a,refreshVersion:o}=e;return r!==`markdown`||a===`source`||!i||t?null:`workspace-preview:markdown:${n}:${o}`}function uY(e){let{languageHint:t,path:n,startLine:r,text:i}=e,a=r??1;return{key:`preview:${n}`,path:n,display:`preview`,lines:KW({text:i,kind:`context`,oldStartLine:a,newStartLine:a}),rawText:i,languageHint:t??null,oldStartLine:a,newStartLine:a}}function dY(e){if(Array.isArray(e.fullLines)&&e.fullLines.length>0)return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:e.fullLines,fullLines:e.fullLines,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...e.patchText?{patchText:e.patchText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}};if(e.beforeText==null&&e.afterText==null)return null;let t=XW({beforeText:e.beforeText??``,afterText:e.afterText??``,oldStartLine:e.oldStartLine??void 0,newStartLine:e.newStartLine??void 0});return{key:`diff:${e.key}`,path:e.path,display:`diff`,lines:t,fullLines:t,...e.beforeText?{beforeText:e.beforeText}:{},...e.afterText?{afterText:e.afterText}:{},...typeof e.oldStartLine==`number`?{oldStartLine:e.oldStartLine}:{},...typeof e.newStartLine==`number`?{newStartLine:e.newStartLine}:{}}}function fY({text:e,tone:t=`muted`}){return(0,U.jsx)(`div`,{className:u(`flex h-full items-center justify-center px-6 text-center text-sm`,t===`error`?`text-rose-600`:`text-gray-500`),children:e})}function pY(e){return e instanceof rn&&e.code===`SERVER_PATH_NOT_FOUND`?b(`chatWorkspacePreviewNotFound`):b(`chatWorkspacePreviewFailed`)}function mY({diffBlock:e}){return e?(0,U.jsx)(hY,{block:e}):(0,U.jsx)(fY,{text:b(`chatWorkspaceDiffEmpty`)})}function hY({block:e,targetColumn:t,targetLine:n}){return(0,U.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar bg-white`,children:(0,U.jsx)(fN,{block:e,layout:`workspace`,targetColumn:t,targetLine:n})})}function gY({contentUrl:e,contentUrlKind:t,contentLabel:n,contentParams:r,directoryQuery:i,fileBasePath:a,onFileOpen:o,onHtmlContentHeightChange:s,markdownScrollRef:c,onMarkdownScroll:l,previewBlock:u,previewKind:d,previewViewer:f,previewQuery:p,previewText:m,targetColumn:h,targetLine:g}){return e&&t?(0,U.jsx)(QJ,{contentUrl:e,contentParams:r??void 0,kind:t,label:n,onHtmlContentHeightChange:s}):i?.data?(0,U.jsx)(AJ,{browseQuery:i,onFileOpen:o,renderStatus:e=>(0,U.jsx)(fY,{...e})}):i?.isLoading&&p?.error&&!u?(0,U.jsx)(fY,{text:b(`chatWorkspaceLoadingDirectory`)}):(i?.isLoading||p?.isLoading)&&!u?(0,U.jsx)(fY,{text:b(`chatWorkspaceLoadingPreview`)}):p?.data?.kind===`binary`?(0,U.jsx)(fY,{text:b(`chatWorkspacePreviewUnsupported`)}):p?.error&&!u?(0,U.jsx)(fY,{tone:`error`,text:pY(p.error)}):d===`markdown`&&f!==`source`&&m?(0,U.jsx)(`div`,{ref:c,onScroll:l,className:`h-full overflow-auto custom-scrollbar px-5 py-4`,children:(0,U.jsx)(Uj,{text:m,role:`assistant`,texts:{copyCodeLabel:b(`chatCodeCopy`),copiedCodeLabel:b(`chatCodeCopied`)},onFileOpen:o,resolveFileContentUrl:e=>ln(e.path,a)})}):u?(0,U.jsx)(hY,{block:u,targetColumn:h,targetLine:g}):(0,U.jsx)(fY,{text:b(`chatWorkspacePreviewEmpty`)})}function _Y({breadcrumbLeading:e,file:t,refreshVersion:n=0,sessionProjectRoot:r,sessionWorkingDir:i,showBreadcrumbs:a=!0,onHtmlContentHeightChange:o,onFileOpen:s,onTextExcerptAdd:c}){let l=(0,H.useRef)(null),u=t.viewMode===`preview`,d=t.contentUrl?.trim()||null,f=u&&!d,p=eY({path:t.path,basePath:i,line:t.line,enabled:f}),m=MF({path:t.path,basePath:i,includeFiles:!0,enabled:f}),h=(0,H.useMemo)(()=>t.viewMode===`diff`?dY(t):null,[t]),g=u?p?.data?.text??t.rawText??null:null,_=sY({path:p?.data?.resolvedPath??t.path,serverKind:p?.data?.kind}),v=d?YJ({path:t.path,mimeType:t.mimeType}):null,y=m?.data?.currentPath??p?.data?.resolvedPath??t.path,b=m?.data?`directory`:`file`,x=MR(y,t.previewViewer),S=YJ({path:y}),C=ln(t.path,i),w=!d&&u&&C&&t.previewViewer!==`source`&&S!==`other`&&(S!==`html`||x===`rendered`)&&C?cY(C,n):null,T=d??w,E=v??(w?S:null),D=(0,H.useMemo)(()=>!u||!g||T?null:uY({path:p?.data?.resolvedPath??t.path,text:g,languageHint:p?.data?.languageHint??null,startLine:p?.data?.startLine??1}),[T,t.path,u,p?.data?.languageHint,p?.data?.resolvedPath,p?.data?.startLine,g]),O=!T&&!!p?.data?.truncated,{onScroll:k}=oY({restorationKey:lY({contentUrl:T,fileKey:t.key,previewKind:_,previewText:g,previewViewer:x,refreshVersion:n}),scrollRef:l}),A=r??i,j=xI({path:y,sessionProjectRoot:A})??y.trim(),M=(0,H.useMemo)(()=>CI({path:y,kind:b,sessionProjectRoot:A,truncated:O}),[A,O,b,y]),N=(0,U.jsx)(gY,{contentUrl:T,contentUrlKind:E,contentLabel:t.label?.trim()||y,contentParams:t.params,directoryQuery:m,fileBasePath:i,onFileOpen:s,onHtmlContentHeightChange:o,markdownScrollRef:l,onMarkdownScroll:k,previewBlock:D,previewKind:_,previewViewer:x,previewQuery:p,previewText:g,targetColumn:t.column,targetLine:t.line});return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-white`,children:[a?(0,U.jsx)(FJ,{breadcrumb:M,leading:e,onFileOpen:s,trailing:u&&_===`markdown`&&x!==`source`&&g&&!T?(0,U.jsx)(aY,{contentKey:g,documentKey:y,scrollContainerRef:l}):void 0}):null,(0,U.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:t.viewMode===`diff`?(0,U.jsx)(mY,{diffBlock:h}):j&&g?(0,U.jsx)(zJ,{fileLabel:t.label?.trim()||j.split(`/`).at(-1)||j,filePath:j,sourceStartLine:p?.data?.startLine??1,sourceText:g,onAddToChat:c,children:N}):N})]})}var vY=240;function yY({actions:e,children:t,contentHeight:n,isLoading:r=!1}){return(0,U.jsxs)(`section`,{className:`group/inline-content relative my-2 w-full max-w-[48rem] overflow-visible`,"data-chat-inline-content-surface":`true`,"data-chat-message-wide-content":`true`,children:[e?(0,U.jsx)(`div`,{className:u(`pointer-events-none absolute bottom-full left-1/2 z-10 -translate-x-1/2 pb-2 opacity-0 transition-opacity duration-150`,`group-hover/inline-content:pointer-events-auto group-hover/inline-content:opacity-100 group-focus-within/inline-content:pointer-events-auto group-focus-within/inline-content:opacity-100`),"data-chat-inline-content-actions":`true`,children:(0,U.jsx)(`div`,{className:`flex items-center gap-0.5 rounded-lg bg-background/95 p-0.5 shadow-md ring-1 ring-border/60 backdrop-blur-sm`,"data-chat-inline-content-actions-surface":`true`,children:e})}):null,(0,U.jsx)(`div`,{className:u(`h-[240px] min-h-[240px] max-h-[min(90vh,1440px)] overflow-hidden rounded-lg`,r&&`animate-pulse bg-muted/45`),"data-chat-inline-content-viewport":`true`,style:n?{height:Math.max(vY,n)}:void 0,children:t})]})}function bY({display:e,parentSessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,onFileOpen:i}){let[a,o]=(0,H.useState)(null);if(e.target.type!==`file`)return null;let{path:s,line:c,column:l,params:u,viewer:d}=e.target.payload,f=FR({path:s,label:e.title,viewMode:`preview`,previewViewer:d,line:c,column:l,params:u},t);if(!f)return null;let p=f.label??f.path.split(/[\\/]/).filter(Boolean).pop()??f.path,m=f.previewViewer===`rendered`&&/\.html?$/i.test(f.path),h=e=>{i({path:f.path,label:f.label??void 0,viewMode:`preview`,previewViewer:e,line:f.line??void 0,column:f.column??void 0,params:f.params??void 0})};return m?(0,U.jsx)(yY,{actions:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{size:`sm`,icon:(0,U.jsx)(xi,{className:`h-3.5 w-3.5`}),label:b(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>h(`rendered`)}),(0,U.jsx)(V,{size:`sm`,icon:(0,U.jsx)(Ta,{className:`h-3.5 w-3.5`}),label:b(`chatWorkspaceOpenSource`),tooltipSide:`top`,onClick:()=>h(`source`)})]}),contentHeight:a,children:(0,U.jsx)(_Y,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onHtmlContentHeightChange:o,onFileOpen:i})}):(0,U.jsxs)(`section`,{className:`my-2 w-full max-w-[48rem] overflow-hidden rounded-lg border border-border bg-card shadow-sm`,"data-chat-inline-file-preview":`true`,"data-chat-message-wide-content":`true`,children:[(0,U.jsxs)(`header`,{className:`border-b border-border bg-muted/45 px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-foreground`,children:[(0,U.jsx)(Wn,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,U.jsx)(`span`,{className:`truncate`,children:p})]}),(0,U.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] font-normal text-muted-foreground`,title:f.path,children:f.path})]}),(0,U.jsx)(`div`,{className:`h-[420px] min-h-[240px] max-h-[min(60vh,420px)] overflow-hidden`,children:(0,U.jsx)(_Y,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onFileOpen:i})})]})}function xY({className:e,icon:t,imageClassName:n,title:r}){let i=t?.trim();return i?SY(i)?(0,U.jsx)(`img`,{src:i,alt:``,"aria-hidden":`true`,className:u(`h-5 w-5 rounded-sm object-contain`,n,e),title:r}):(0,U.jsx)(`span`,{"aria-hidden":`true`,className:u(`max-w-6 truncate text-center leading-none`,e),title:r,children:i}):(0,U.jsx)(fi,{className:u(`h-4 w-4`,e)})}function SY(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}var CY=[`panel-apps`];function wY(e,t){return e.id===t||e.appId===t}function TY(e,t,n){return e&&{...e,entries:e.entries.map(e=>wY(e,t)?n(e):e)}}function EY(e,t){return TY(e,t.id,()=>t)}function DY(e,t){let n=e?.entries.reduce((e,t)=>Math.max(e,t.mainSidebarOrder??-1),-1)??-1;return TY(e,t.id,e=>({...e,...typeof t.preferences.favorite==`boolean`?{favorite:t.preferences.favorite}:{},...typeof t.preferences.mainSidebar==`boolean`?t.preferences.mainSidebar?{mainSidebar:!0,mainSidebarOrder:e.mainSidebar?e.mainSidebarOrder:n+1}:{mainSidebar:!1,mainSidebarOrder:void 0}:{}}))}function OY(e={}){return z({queryKey:CY,queryFn:()=>F.panelApps.listPanelApps(),enabled:e.enabled??!0,staleTime:0})}function kY(){let e=xe();return R({mutationFn:({id:e,preferences:t})=>F.panelApps.updatePanelAppPreferences(e,t),onMutate:async t=>{await e.cancelQueries({queryKey:CY});let n=e.getQueryData(CY)?.entries.find(e=>wY(e,t.id));return e.setQueryData(CY,e=>DY(e,t)),{previousEntry:n}},onSuccess:t=>{e.setQueryData(CY,e=>EY(e,t))},onError:(t,n,r)=>{let i=r?.previousEntry;i&&e.setQueryData(CY,e=>TY(e,n.id,()=>i));let a=t instanceof Error?t.message:String(t);I.error(`${b(`panelAppsPreferenceUpdateFailed`)}: ${a}`)}})}function AY(){let e=xe();return R({mutationFn:e=>F.panelApps.recordPanelAppOpened(e),onSuccess:t=>{e.setQueryData(CY,e=>EY(e,t))}})}function jY(){let e=xe();return R({mutationFn:e=>F.panelApps.grantClient(e),onSuccess:()=>{e.invalidateQueries({queryKey:CY})}})}function MY(){let e=xe();return R({mutationFn:e=>F.panelApps.deletePanelApp(e),onSuccess:()=>{e.invalidateQueries({queryKey:CY})}})}function NY({entry:e,onSelect:t}){let n=kY(),r=e.mainSidebar?b(`panelAppsRemoveFromMainSidebar`):b(`panelAppsAddToMainSidebar`),i=e.mainSidebar?Ro:Bo;return(0,U.jsxs)(`button`,{type:`button`,disabled:n.isPending,"aria-pressed":e.mainSidebar,className:`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>{t?.(),e.mainSidebar||cc.setMainSidebarAppGroupCollapsed(!1),n.mutate({id:e.id,preferences:{mainSidebar:!e.mainSidebar}})},children:[(0,U.jsx)(i,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:r})]})}function PY({deletePending:e,entry:t,favoritePending:n,onDelete:r,onOpen:i,onToggleFavorite:a}){let[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(!1),u=t.favorite?b(`panelAppsUnfavorite`):b(`panelAppsFavorite`),d=t.lastOpenedAt?`${b(`panelAppsLastOpened`)} ${IY(t.lastOpenedAt)}`:`${b(`panelAppsUpdated`)} ${IY(t.updatedAt)}`,f=e=>{e.stopPropagation(),a()},p=()=>{s(!1),l(!0)};return(0,U.jsxs)(`div`,{className:`group w-full min-w-0 rounded-lg border border-border/60 bg-card px-2.5 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-base text-muted-foreground`,children:(0,U.jsx)(xY,{icon:t.icon,title:t.title})}),(0,U.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:t.title})]}),t.description?(0,U.jsx)(`span`,{className:`mt-1.5 block truncate text-xs leading-5 text-muted-foreground`,children:t.description}):null,(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] leading-4 text-muted-foreground/70`,children:d})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:f,disabled:n,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground disabled:opacity-50`,title:u,"aria-label":u,children:(0,U.jsx)(us,{className:t.favorite?`h-4 w-4 fill-current text-foreground`:`h-4 w-4`})}),(0,U.jsxs)(CF,{open:o,onOpenChange:s,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-foreground`,"aria-label":b(`panelAppsMoreActions`),disabled:e,children:(0,U.jsx)($r,{className:`h-4 w-4`})})}),(0,U.jsxs)(EF,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:[(0,U.jsx)(NY,{entry:t,onSelect:()=>s(!1)}),(0,U.jsx)(FY,{destructive:!0,disabled:e,icon:ms,label:b(`panelAppsDelete`),onClick:p})]})]})]})]}),(0,U.jsx)(Yr,{open:c,onOpenChange:l,title:b(`panelAppsDeleteConfirmTitle`),description:`${b(`panelAppsDeleteConfirmDescription`)} ${t.fileName}`,confirmLabel:b(`delete`),variant:`destructive`,onConfirm:r,onCancel:()=>void 0})]})}function FY({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:i,children:[(0,U.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:r})]})}function IY(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=S(N()),r=new Date;return t.toDateString()===r.toDateString()?new Intl.DateTimeFormat(n,{hour:`2-digit`,minute:`2-digit`}).format(t):t.getFullYear()===r.getFullYear()?new Intl.DateTimeFormat(n,{month:`numeric`,day:`numeric`}).format(t):new Intl.DateTimeFormat(n,{year:`2-digit`,month:`numeric`,day:`numeric`}).format(t)}function LY(){let e=N9(),{isPending:t,mutateAsync:n}=jY(),r=(0,H.useRef)(new Map);return{ensurePanelAppClientGrant:(0,H.useCallback)(async t=>{if(!t.clientDeclared||t.clientGranted)return!0;let i=r.current.get(t.appId);if(i)return await i;let a=(async()=>await e.serviceActionAuthorizationManager.requestAuthorization({panelAppId:t.appId,actions:[{actionId:`nextclaw.client`,actionTitle:b(`panelAppsClientGrantTitle`),actionDescription:b(`panelAppsClientGrantDescription`),risk:`dangerous`}]})?(await n(t.appId),!0):!1)();r.current.set(t.appId,a);try{return await a}finally{r.current.delete(t.appId)}},[n,e]),isPending:t}}function RY(e,t){return t===`favorites`?zY(e.filter(e=>e.favorite),`smart`):zY(t===`recent-open`?e.filter(e=>e.lastOpenedAt):e,t)}function zY(e,t){return[...e].sort((e,n)=>BY(e,n,t))}function BY(e,t,n){return n===`recent-open`?WY(e.lastOpenedAt,t.lastOpenedAt)||VY(e,t):n===`updated`?WY(e.updatedAt,t.updatedAt)||VY(e,t):n===`name`?VY(e,t):HY(e,t)||Number(t.favorite)-Number(e.favorite)||VY(e,t)}function VY(e,t){return e.title.localeCompare(t.title)}function HY(e,t){return UY(t)-UY(e)}function UY(e){return Math.max(new Date(e.lastOpenedAt??0).getTime(),new Date(e.createdAt).getTime(),new Date(e.updatedAt).getTime())}function WY(e,t){return new Date(t??0).getTime()-new Date(e??0).getTime()}var GY=H.createContext(null);function KY({defaultValue:e,value:t,onValueChange:n,children:r}){return(0,U.jsx)(GY.Provider,{value:{value:t,onValueChange:n},children:r})}function qY({children:e,className:t}){return(0,U.jsx)(`div`,{role:`tablist`,onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;let t=Array.from(e.currentTarget.querySelectorAll(`[role="tab"]:not(:disabled)`));if(t.length===0)return;let n=t.indexOf(document.activeElement),r=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowRight`?(Math.max(n,-1)+1)%t.length:(n<=0?t.length:n)-1;e.preventDefault(),t[r]?.focus(),t[r]?.click()},className:u(`inline-flex h-9 items-center justify-center rounded-xl bg-muted p-1 text-muted-foreground`,t),children:e})}function JY({value:e,children:t,className:n}){let r=H.useContext(GY);if(!r)throw Error(`TabsTrigger must be used within Tabs`);let i=r.value===e;return(0,U.jsx)(`button`,{type:`button`,onClick:()=>r.onValueChange(e),role:`tab`,"aria-selected":i,tabIndex:i?0:-1,"data-state":i?`active`:`inactive`,className:u(`inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-[13px] font-medium transition-all duration-fast focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none disabled:opacity-50`,i?`bg-card text-foreground shadow-sm`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,n),children:t})}function YY({value:e,children:t,className:n}){let r=H.useContext(GY);if(!r)throw Error(`TabsContent must be used within Tabs`);return r.value===e?(0,U.jsx)(`div`,{className:u(`mt-2 animate-fade-in`,n),children:t}):null}var XY=[];function ZY({onOpenPanelApp:e}){let t=OY(),n=MY(),r=kY(),i=AY(),{ensurePanelAppClientGrant:a}=LY(),o=N9(),s=ce(),[c,l]=(0,H.useState)(`smart`),u=t.data?.entries??XY,d=(0,H.useMemo)(()=>RY(u,c),[u,c]),f=async t=>{await a(t)&&(e(t),i.mutate(t.id))},p=e=>{r.mutate({id:e.id,preferences:{favorite:!e.favorite}})},m=e=>{n.mutate(e.id)},h=()=>{s(`/chat`),o.chatDraftIntentManager.requestDraft(b(`panelAppsExamplePrompt`))};return t.isLoading?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:b(`panelAppsLoading`)}):t.isError?(0,U.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:t.error instanceof Error?t.error.message:b(`panelAppsLoadFailed`)}):(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end gap-2 border-b border-border/70 px-4 py-2`,children:[(0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t.data?.panelsPath?(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded p-0.5 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,"aria-label":b(`panelAppsTitle`),children:(0,U.jsx)(ya,{className:`h-3.5 w-3.5`})})}),(0,U.jsx)(ui,{side:`bottom`,className:`max-w-[320px] break-all font-mono text-xs`,children:t.data.panelsPath})]})}):null}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void t.refetch(),className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,title:b(`panelAppsRefresh`),"aria-label":b(`panelAppsRefresh`),children:(0,U.jsx)(ki,{className:`h-3.5 w-3.5`})})]}),(0,U.jsx)(`div`,{className:`border-b border-border/70 px-3 py-2`,children:(0,U.jsx)(KY,{value:c,onValueChange:e=>l(e),children:(0,U.jsxs)(qY,{className:`grid h-auto w-full grid-cols-5 rounded-lg bg-muted/70 p-0.5`,children:[(0,U.jsx)(JY,{value:`smart`,className:`px-2 py-1 text-xs`,children:b(`panelAppsSortSmart`)}),(0,U.jsx)(JY,{value:`favorites`,className:`px-2 py-1 text-xs`,children:b(`panelAppsFavorites`)}),(0,U.jsx)(JY,{value:`recent-open`,className:`px-2 py-1 text-xs`,children:b(`panelAppsSortRecentOpen`)}),(0,U.jsx)(JY,{value:`updated`,className:`px-2 py-1 text-xs`,children:b(`panelAppsSortUpdated`)}),(0,U.jsx)(JY,{value:`name`,className:`px-2 py-1 text-xs`,children:b(`panelAppsSortName`)})]})})}),u.length===0?(0,U.jsx)(QY,{panelsPath:t.data?.panelsPath,onCreateExample:h,onRefresh:()=>void t.refetch()}):d.length===0?(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground`,children:b(`panelAppsEmptyFiltered`)}):(0,U.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,U.jsx)(`div`,{className:`space-y-1.5`,children:d.map(e=>(0,U.jsx)(PY,{entry:e,deletePending:n.isPending,favoritePending:r.isPending,onDelete:()=>m(e),onOpen:()=>void f(e),onToggleFavorite:()=>p(e)},e.id))})})]})}function QY({onCreateExample:e,panelsPath:t,onRefresh:n}){return(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-y-auto px-5 py-6 text-center`,children:(0,U.jsxs)(`div`,{className:`w-full max-w-sm`,children:[(0,U.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,U.jsx)(fi,{className:`h-5 w-5`})}),(0,U.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:b(`panelAppsEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:b(`panelAppsEmptyDescription`)}),(0,U.jsxs)(`div`,{className:`mt-4 space-y-2 text-left`,children:[(0,U.jsx)($Y,{icon:(0,U.jsx)(wo,{className:`h-4 w-4`}),title:b(`panelAppsEmptyAskTitle`),description:b(`panelAppsEmptyAskDescription`),actionLabel:b(`panelAppsEmptyAskAction`),onAction:e}),(0,U.jsx)($Y,{icon:(0,U.jsx)(Ra,{className:`h-4 w-4`}),title:b(`panelAppsEmptyFileTitle`),description:b(`panelAppsEmptyFileDescription`)})]}),t?(0,U.jsxs)(`div`,{className:`mt-4 rounded-md bg-muted/60 px-3 py-2 text-left`,children:[(0,U.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:b(`panelAppsPanelsPath`)}),(0,U.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:t})]}):null,(0,U.jsxs)(`button`,{type:`button`,onClick:n,className:`mt-4 inline-flex items-center justify-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(ki,{className:`h-3.5 w-3.5`}),b(`panelAppsRefresh`)]})]})})}function $Y({actionLabel:e,description:t,icon:n,onAction:r,title:i}){let a=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:n}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:i}),(0,U.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:t}),e?(0,U.jsx)(`div`,{className:`mt-2 text-xs font-medium text-primary`,children:e}):null]})]});return r?(0,U.jsx)(`button`,{type:`button`,onClick:r,className:`flex w-full gap-2 rounded-md bg-muted/60 px-3 py-2.5 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:a}):(0,U.jsx)(`div`,{className:`flex gap-2 rounded-md bg-muted/60 px-3 py-2.5`,children:a})}var eX=`w-[56px]`,tX=`px-2`,nX=`h-9 w-9 rounded-xl`,rX=`h-4 w-4`,iX=`space-y-1`,aX=`gap-1`,oX=`text-muted-foreground transition-colors duration-base hover:bg-gray-200/60 hover:text-gray-900 active:bg-gray-200/80 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,sX=`bg-gray-200/80 text-gray-900`,cX={default:{row:`gap-3 px-3 py-2.5 text-[14px]`,icon:`h-[17px] w-[17px]`,value:`text-xs`,gap:`gap-3`,stack:`space-y-1`},compact:{row:`gap-2.5 px-3 py-2 text-[13px]`,icon:`h-4 w-4`,value:`text-[11px]`,gap:`gap-2.5`,stack:`space-y-0.5`}};function lX(e){return cX[e]}function uX(e){return lX(e).stack}function dX(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function fX({children:e,label:t,side:n=`right`}){return(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:e}),(0,U.jsx)(ui,{side:n,className:`text-xs`,children:t})]})})}function pX({collapsed:e,icon:t,iconNode:n,indicator:r,isActive:i,tone:a}){let o=u(e?rX:a.icon,`transition-colors`,i?`text-gray-700`:`text-muted-foreground group-hover:text-gray-700`);return(0,U.jsxs)(`span`,{className:`relative shrink-0`,children:[n?(0,U.jsx)(`span`,{className:u(o,`flex items-center justify-center overflow-hidden`),children:n}):t?(0,U.jsx)(t,{className:u(o,`block`)}):null,r?(0,U.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-2 ring-background`}):null]})}function mX({to:e,label:t,icon:n,iconNode:r,density:i=`default`,className:a,collapsed:o=!1,indicator:s=!1,trailing:c}){let l=lX(i),{pathname:d}=_e(),f=dX(d,e),p=(0,U.jsxs)(ue,{to:e,"aria-label":t,"aria-current":f?`page`:void 0,className:u(`group flex w-full items-center rounded-xl font-medium transition-colors duration-base focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,o?u(nX,`justify-center px-0 py-0`):l.row,f?o?sX:`bg-gray-200/80 text-gray-900 shadow-sm`:o?oX:`text-muted-foreground hover:bg-gray-200/60 hover:text-gray-900`,a),children:[(0,U.jsx)(pX,{collapsed:o,icon:n,iconNode:r,indicator:s,isActive:f,tone:l}),(0,U.jsx)(`span`,{className:o?`sr-only`:`min-w-0 flex-1 text-left`,children:t}),!o&&c?(0,U.jsx)(`span`,{className:u(`shrink-0 text-muted-foreground`,l.value),children:c}):null]});return o?(0,U.jsx)(fX,{label:t,children:p}):p}function hX({isCollapsed:e,items:t,density:n,className:r}){return(0,U.jsx)(`ul`,{className:u(uX(n),r),children:t.map(t=>(0,U.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,U.jsx)(mX,{to:t.target,label:t.label,icon:t.icon,density:n,collapsed:e})},t.target))})}function gX({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:a,trailing:o,trailingClassName:s,testId:c,trailingTestId:l,collapsed:d=!1}){let f=lX(r),p=(0,U.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":e,className:u(`group flex w-full items-center rounded-xl font-medium text-muted-foreground transition-colors duration-base hover:bg-gray-200/60 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,d?u(nX,`justify-center px-0 py-0`,oX):f.row,i),"data-testid":c,children:[(0,U.jsx)(t,{className:u(d?rX:f.icon,`shrink-0 text-muted-foreground transition-colors group-hover:text-gray-700`)}),(0,U.jsx)(`span`,{className:u(d?`sr-only`:`min-w-0 flex-1 text-left`,a),children:e}),!d&&o?(0,U.jsx)(`span`,{className:u(`shrink-0 text-muted-foreground`,f.value,s),"data-testid":l,children:o}):null]});return d?(0,U.jsx)(fX,{label:e,children:p}):p}var _X=2**53-1;function vX(e){return e.filter(e=>e.mainSidebar).sort((e,t)=>(e.mainSidebarOrder??_X)-(t.mainSidebarOrder??_X)||e.title.localeCompare(t.title))}function yX({isCollapsed:e}){let t=OY(),n=(0,H.useMemo)(()=>vX(t.data?.entries??[]),[t.data?.entries]),r=sc(e=>e.isMainSidebarAppGroupCollapsed);return n.length===0?null:e?(0,U.jsx)(CX,{entries:n}):(0,U.jsxs)(`div`,{className:`mt-1 border-t border-border/50 px-3 pt-1`,"data-testid":`panel-app-main-sidebar-nav`,children:[(0,U.jsx)(SX,{entries:n,isCollapsed:r}),r?null:(0,U.jsx)(`ul`,{className:`mt-0.5 space-y-0.5`,children:n.map(e=>(0,U.jsx)(wX,{entry:e},e.appId))})]})}function bX(e){return`/apps/panel/${encodeURIComponent(e)}`}function xX(e){let{pathname:t}=_e();return e.some(e=>t===bX(e.appId))}function SX({entries:e,isCollapsed:t}){let n=xX(e),r=b(t?`panelAppsMainSidebarGroupExpand`:`panelAppsMainSidebarGroupCollapse`);return(0,U.jsxs)(`button`,{type:`button`,"aria-label":r,"aria-expanded":!t,className:u(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-[13px] font-medium text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,t&&n&&`bg-gray-200/80 text-gray-900`),onClick:cc.toggleMainSidebarAppGroupCollapsed,children:[(0,U.jsx)(or,{"aria-hidden":`true`,className:u(`h-3.5 w-3.5 shrink-0 transition-transform`,t&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:b(`panelAppsMainSidebarGroup`)}),(0,U.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:e.length})]})}function CX({entries:e}){let[t,n]=(0,H.useState)(!1),r=xX(e),i=b(`panelAppsMainSidebarGroup`);return(0,U.jsx)(`div`,{className:`mt-1 flex justify-center border-t border-border/50 pt-1`,"data-testid":`panel-app-main-sidebar-nav`,children:(0,U.jsxs)(CF,{open:t,onOpenChange:n,children:[(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{disableHoverableContent:!0,children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(mo,{className:rX}),label:i,tooltip:!1,className:u(nX,r?sX:oX)})})}),(0,U.jsx)(ui,{side:`right`,className:`text-xs`,children:i})]})}),(0,U.jsxs)(EF,{side:`right`,align:`start`,className:`w-60 rounded-xl p-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1 text-xs font-semibold text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:i}),(0,U.jsx)(`span`,{className:`font-medium text-muted-foreground/60`,children:e.length})]}),(0,U.jsx)(`ul`,{className:`mt-1 space-y-0.5`,children:e.map(e=>(0,U.jsx)(wX,{entry:e,onNavigate:()=>n(!1)},e.appId))})]})]})})}function wX({entry:e,onNavigate:t}){let[n,r]=(0,H.useState)(!1),i=(0,U.jsx)(mX,{to:bX(e.appId),label:e.title,iconNode:(0,U.jsx)(xY,{icon:e.icon,title:e.title,className:`h-full w-full text-[13px]`,imageClassName:`rounded-[3px]`}),density:`compact`,className:`rounded-lg py-1.5 pl-5 pr-9`}),a=t?(0,U.jsx)(`div`,{onClick:t,children:i}):i,o=`${b(`panelAppsMoreActions`)}: ${e.title}`;return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`div`,{className:`group/panel-app relative`,children:[a,(0,U.jsxs)(CF,{open:n,onOpenChange:r,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":o,className:u(`absolute right-1 top-1/2 z-[1] -translate-y-1/2 rounded-md p-1 text-muted-foreground/70 transition-[color,background-color,opacity] hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,n?`pointer-events-auto opacity-100`:`pointer-events-none opacity-0 group-hover/panel-app:pointer-events-auto group-hover/panel-app:opacity-100 group-focus-within/panel-app:pointer-events-auto group-focus-within/panel-app:opacity-100`),children:(0,U.jsx)($r,{className:`h-4 w-4`})})}),(0,U.jsx)(EF,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,U.jsx)(NY,{entry:e,onSelect:()=>r(!1)})})]})]})})}function TX(e){let t=xe(),n=(0,H.useId)(),{ensurePanelAppClientGrant:r}=LY(),i=!!(e?.clientDeclared&&!e.clientGranted),a=z({queryKey:[`panel-app-main-client-grant`,e?.appId??`none`,e?.clientGranted??!1],queryFn:async()=>await r(e),enabled:i,gcTime:0,retry:!1,staleTime:1/0}),o=e?i?a.isError?`error`:a.isPending?`checking`:a.data?`allowed`:`denied`:`allowed`:`idle`;return z({queryKey:[`panel-app-main-open`,n,e?.appId??`none`],queryFn:async()=>{let n=await F.panelApps.recordPanelAppOpened(e.id);return t.setQueryData(CY,e=>EY(e,n)),n},enabled:!!(e&&o===`allowed`),retry:!1,staleTime:1/0}),{retryClientGrant:a.refetch,state:o}}var EX=`allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-downloads allow-pointer-lock allow-presentation`;function DX(e){e?.focus({preventScroll:!0}),e?.contentWindow?.focus()}function OX({className:e,icon:t,name:n}){let[r,i]=(0,H.useState)(),a=kX(t),o=r===t;return(0,U.jsx)(`span`,{className:u(`relative flex h-11 w-11 shrink-0 items-center justify-center overflow-hidden rounded-[13px] bg-gradient-to-br from-violet-500/15 via-primary/10 to-emerald-500/15 text-sm font-semibold text-foreground ring-1 ring-black/[0.04] dark:ring-white/[0.06]`,e),children:a&&!o?(0,U.jsx)(`img`,{src:t,alt:``,className:`h-full w-full object-cover`,onError:()=>i(t)}):t&&!a?(0,U.jsx)(`span`,{className:`text-base leading-none`,"aria-hidden":`true`,children:t}):(0,U.jsx)(`span`,{"aria-hidden":`true`,children:AX(n)})})}function kX(e){return!!e&&(e.startsWith(`data:`)||e.startsWith(`/`)||e.startsWith(`http://`)||e.startsWith(`https://`))}function AX(e){return[...e.trim()][0]?.toLocaleUpperCase()??`A`}function jX({accentColor:e,className:t,coverPreview:n,coverUrl:r,name:i}){let[a,o]=(0,H.useState)(),s=r&&a!==r?r:void 0;return(0,U.jsx)(`span`,{className:u(`relative block aspect-[8/5] overflow-hidden rounded-2xl bg-muted ring-1 ring-black/[0.05] dark:ring-white/[0.07]`,t),style:{"--app-accent":e??`#78716c`},children:s?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`img`,{src:s,alt:`${i} app cover`,className:`h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.015]`,loading:`lazy`,onError:()=>o(s)}),null]}):(0,U.jsx)(`span`,{"aria-label":`${i} 暂无封面`,className:`flex h-full w-full items-center justify-center bg-[radial-gradient(circle_at_30%_25%,color-mix(in_srgb,var(--app-accent)_28%,transparent),transparent_50%),linear-gradient(145deg,var(--muted),var(--background))]`,children:(0,U.jsx)(`span`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl bg-background/65 text-xl font-semibold text-foreground/65 shadow-sm ring-1 ring-black/[0.05] backdrop-blur-sm`,children:MX(i)})})})}function MX(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length>1?t.slice(0,2).map(e=>e[0]).join(``).toLocaleUpperCase():[...t[0]??`?`].slice(0,1).join(``).toLocaleUpperCase()}function NX(e,t){if(e.status!==`compatible`)return e.status===`unknown`?{actionLabel:b(`appPackagesTemporarilyUnavailable`),reason:b(`appPackagesCompatibilityUnknownReason`),statusLabel:b(`appPackagesCompatibilityUnknown`)}:{actionLabel:b(`appPackagesUnavailable`),badgeLabel:b(`appPackagesPlatformOnly`).replace(`{platforms}`,t),reason:e.reason===`unsupported-os`?b(`appPackagesUnsupportedOsReason`).replace(`{platforms}`,t):b(`appPackagesUnsupportedTargetReason`).replace(`{platforms}`,t),statusLabel:b(`appPackagesUnavailableOnDevice`)}}function PX({presentation:e}){return e?.badgeLabel?(0,U.jsx)(`span`,{className:`mt-1.5 inline-flex rounded-full bg-amber-500/12 px-2 py-0.5 text-[10px] font-semibold text-amber-700 ring-1 ring-inset ring-amber-500/20 dark:text-amber-300`,children:e.badgeLabel}):null}function FX({blocked:e,presentation:t,className:n}){return!e||!t?null:(0,U.jsx)(`p`,{className:n,children:t.statusLabel})}function IX({active:e,canUpdate:t,installed:n,isStarting:r,onAction:i,operation:a,unavailableLabel:o,unavailableReason:s}){let c=(0,U.jsx)(L,{type:`button`,size:`sm`,variant:n&&!t||e?`secondary`:`default`,disabled:!!s||n&&!t||e||r,onClick:i,className:`shrink-0 rounded-full px-4`,children:LX({active:e,canUpdate:t,installed:n,isStarting:r,operation:a,unavailableLabel:o,unavailableReason:s})});return s?(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`span`,{tabIndex:0,className:`inline-flex cursor-not-allowed rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:c})}),(0,U.jsx)(ui,{side:`top`,className:`max-w-64 text-xs`,children:s})]}):c}function LX({active:e,canUpdate:t,installed:n,isStarting:r,operation:i,unavailableLabel:a,unavailableReason:o}){return o?a??b(`appPackagesUnavailable`):n&&!t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(jr,{className:`mr-1.5 h-3.5 w-3.5`}),b(`appPackagesMarketplaceInstalled`)]}):e||r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Di,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),i?BX(i):b(`appPackagesPreparing`)]}):b(t?`appPackagesUpdate`:`appPackagesInstall`)}function RX({operation:e}){let t=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,U.jsxs)(`div`,{className:`mt-2`,role:`status`,"aria-live":`polite`,children:[(0,U.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width] duration-300`,style:{width:`${t}%`}})}),(0,U.jsx)(`p`,{className:`mt-1.5 truncate text-[11px] text-muted-foreground`,children:BX(e)})]})}function zX(e,t,n){return e.find(e=>e.appId===t||e.source===n)}function BX(e){switch(e.status){case`queued`:return b(`appPackagesPreparing`);case`resolving`:return b(`appPackagesResolving`);case`downloading`:return b(`appPackagesDownloading`);case`verifying`:return b(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?b(`appPackagesSwitchingVersion`):e.action===`uninstall`?b(`appPackagesUninstalling`):b(`appPackagesInstalling`);case`finalizing`:return b(`appPackagesFinalizing`);case`succeeded`:return b(`appPackagesCompleted`);case`failed`:case`interrupted`:return b(`appPackagesActionFailed`)}}function VX({checked:e,description:t,destructive:n=!1,disabled:r=!1,label:i,onClick:a}){return(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":e,"aria-disabled":r,disabled:r,onClick:a,className:u(`flex items-start gap-3 rounded-xl border px-3 py-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`border-foreground/25 bg-muted/55`:`border-border/60 hover:bg-muted/35`),children:[(0,U.jsx)(`span`,{className:u(`mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border`,e?`border-foreground bg-foreground text-background`:`border-border`),children:e?(0,U.jsx)(jr,{className:`h-2.5 w-2.5`}):null}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:u(`block text-sm font-medium`,n?`text-destructive`:`text-foreground`),children:i}),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:t})]})]})}function HX({storage:e,usage:t}){let n=[[b(`appDataClassData`),t.dataBytes],[b(`appDataClassConfig`),t.configBytes],[b(`appDataClassState`),t.stateBytes],[b(`appDataClassCache`),t.cacheBytes],[b(`appDataClassTemporary`),t.temporaryBytes],[b(`appDataClassLogs`),t.logsBytes]];return(0,U.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-foreground`,children:[(0,U.jsx)(io,{className:`h-3.5 w-3.5`}),b(`appDataStorageTotal`)]}),(0,U.jsx)(`span`,{className:`tabular-nums text-foreground`,children:UX(t.totalBytes)})]}),(0,U.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] sm:grid-cols-3`,children:n.map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,U.jsx)(`dt`,{className:`truncate text-muted-foreground`,children:e}),(0,U.jsx)(`dd`,{className:`shrink-0 tabular-nums text-foreground/80`,children:UX(t)})]},e))}),(0,U.jsxs)(`div`,{className:`mt-2 border-t border-border/50 pt-2`,children:[(0,U.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:b(`appDataStoragePath`)}),(0,U.jsx)(`code`,{"aria-label":b(`appDataStoragePath`),className:`mt-0.5 block select-all break-all font-mono text-[10px] leading-4 text-foreground/75`,tabIndex:0,children:e.instanceDirectory})]})]})}function UX(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}var WX=[`app-data`];function GX(){return z({queryKey:WX,queryFn:()=>F.appData.list(),staleTime:0})}function KX(){let e=xe();return R({mutationFn:({dataId:e,confirmAppId:t})=>F.appData.deleteRetained(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:WX}),I.success(b(`appDataDeleteCompleted`))}})}function qX({diagnostics:e,entries:t,error:n,isLoading:r,onDeletionFocusReturn:i}){let[a,o]=(0,H.useState)(null),s=(0,H.useRef)(null),c=(0,H.useRef)(null),l=KX(),u=t.filter(e=>e.lifecycle===`retained`),d=()=>{l.isPending||o(null)};return(0,H.useEffect)(()=>{l.isError&&s.current?.focus()},[l.isError]),!r&&!n&&e.length===0&&u.length===0?null:(0,U.jsxs)(`section`,{className:`mt-6`,"aria-labelledby":`retained-app-data-title`,children:[(0,U.jsxs)(`div`,{className:`mb-2.5 px-1`,children:[(0,U.jsx)(`h2`,{ref:c,id:`retained-app-data-title`,tabIndex:-1,className:`text-sm font-semibold text-foreground`,children:b(`appDataRetainedTitle`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:b(`appDataRetainedDescription`)})]}),r?(0,U.jsx)(Pi,{className:`h-28 w-full rounded-xl`}):null,n?(0,U.jsx)(`div`,{role:`alert`,className:`rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive`,children:n instanceof Error?n.message:b(`appDataLoadFailed`)}):null,e.length>0?(0,U.jsxs)(`div`,{role:`alert`,className:`mb-2.5 rounded-xl border border-amber-500/20 bg-amber-500/5 px-3 py-2.5 text-xs text-amber-800 dark:text-amber-200`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,U.jsx)(Hr,{className:`h-3.5 w-3.5`}),b(`appDataDiagnosticsTitle`)]}),(0,U.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`break-all`,children:[e.message,` — `,e.instanceDirectory]},e.instanceDirectory))})]}):null,(0,U.jsx)(`div`,{className:`space-y-2.5`,children:u.map(e=>(0,U.jsxs)(`article`,{className:`rounded-xl border border-border/65 bg-card p-3.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,U.jsx)(aa,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName}),(0,U.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.appId,e.publisherId?` · ${e.publisherId}`:``]})]}),(0,U.jsxs)(L,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{l.reset(),o(e)},children:[(0,U.jsx)(ms,{className:`mr-1.5 h-3.5 w-3.5`}),b(`appDataDeleteAction`)]})]}),(0,U.jsx)(`div`,{className:`mt-3`,children:(0,U.jsx)(HX,{storage:e.storage,usage:e.usage})})]},e.id))}),(0,U.jsx)(Wr,{open:!!a,onOpenChange:e=>!e&&d(),children:(0,U.jsx)(qr,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>l.isPending&&e.preventDefault(),onInteractOutside:e=>l.isPending&&e.preventDefault(),children:a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Gr,{children:[(0,U.jsx)(Jr,{children:b(`appDataDeleteTitle`)}),(0,U.jsx)(Vr,{children:b(`appDataDeleteDescription`)})]}),(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsxs)(`div`,{className:`rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive`,children:[a.displayName,` · `,a.appId]}),(0,U.jsx)(HX,{storage:a.storage,usage:a.usage}),l.isError?(0,U.jsx)(`p`,{ref:s,role:`alert`,tabIndex:-1,className:`text-xs text-destructive`,children:l.error instanceof Error?l.error.message:b(`appDataDeleteFailed`)}):null]}),(0,U.jsxs)(Fr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,U.jsx)(L,{autoFocus:!0,type:`button`,variant:`outline`,disabled:l.isPending,onClick:d,children:b(`cancel`)}),(0,U.jsxs)(L,{type:`button`,variant:`destructive`,disabled:l.isPending,onClick:()=>l.mutate({dataId:a.id,confirmAppId:a.appId},{onSuccess:()=>{o(null),window.requestAnimationFrame(()=>{c.current?c.current.focus():i?.()})}}),children:[l.isPending?(0,U.jsx)(Di,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,l.isPending?b(`appDataDeleting`):b(`appDataDeletePermanently`)]})]})]}):null})})]})}var JX=[`app-packages`],YX=[`panel-apps`],XX=[`service-apps`],ZX=[`service-actions`],QX=[`app-package-operations`],$X=new Set([`queued`,`resolving`,`downloading`,`verifying`,`installing`,`finalizing`]);function eZ(){return z({queryKey:JX,queryFn:()=>F.appPackages.list({includeStorageUsage:!1}),staleTime:0})}function tZ(){return z({queryKey:QX,queryFn:()=>F.appPackages.listOperations(),refetchInterval:e=>(e.state.data?.entries??[]).some(e=>nZ(e.status))?500:!1,staleTime:0})}function nZ(e){return $X.has(e)}function rZ({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i,settlementManager:a}){(0,H.useEffect)(()=>{a.settle({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i})},[e,t,n,r,i,a])}function iZ(){let e=xe();return R({mutationFn:async e=>{switch(e.action){case`enable`:return await F.appPackages.enable(e.appId);case`disable`:return await F.appPackages.disable(e.appId);case`install`:return await F.appPackages.startInstall({source:e.source,registryUrl:e.registryUrl});case`update`:return await F.appPackages.startUpdate(e.appId);case`rollback`:return await F.appPackages.startRollback(e.appId,e.version);case`uninstall`:return await F.appPackages.startUninstall(e.appId,e.purgeData??!1)}},onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:JX}),e.invalidateQueries({queryKey:YX}),e.invalidateQueries({queryKey:XX}),e.invalidateQueries({queryKey:ZX}),e.invalidateQueries({queryKey:QX}),e.invalidateQueries({queryKey:WX})])}})}var aZ={darwin:`macOS`,linux:`Linux`,win32:`Windows`};function oZ(e,t){return!e||e.mode===`universal`?t:e.operatingSystems.map(e=>aZ[e]).join(` · `)}function sZ(e,t){return!e||e.mode===`universal`?{status:`compatible`}:t?e.targets.includes(t.key)?{status:`compatible`}:e.operatingSystems.includes(t.operatingSystem)?{status:`incompatible`,reason:`unsupported-target`}:{status:`incompatible`,reason:`unsupported-os`}:{status:`unknown`}}function cZ(e){return e.status===`compatible`?0:e.status===`unknown`?1:2}function lZ(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function uZ(e){let{request:t,result:n}=e,r=new Date().toISOString();return n.type===`skill`?{type:`skill`,spec:n.spec,id:t.skill??n.spec,label:t.skill??n.name??n.spec,source:`workspace`,installPath:t.installPath,installedAt:r}:{type:n.type,spec:n.spec,id:n.name??n.spec,label:n.name??n.spec,source:`marketplace`,origin:`marketplace`,enabled:t.enabled??!0,runtimeStatus:t.enabled===!1?`disabled`:`ready`,installedAt:r}}function dZ(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function fZ(e,t){return t??{type:e,total:0,specs:[],records:[]}}function pZ(e){let{result:t,view:n}=e,r=fZ(t.type,n),i=uZ(e),a=r.records.findIndex(e=>dZ(e,{id:i.id,spec:i.spec})),o=[...r.records];return a>=0?o[a]={...o[a],...i}:o.unshift(i),{...r,type:t.type,records:o,specs:lZ(o),total:o.length}}function mZ(e){let{request:t,result:n,view:r}=e,i=fZ(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!dZ(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:lZ(e),total:e.length}}let a=i.records.map(e=>dZ(e,{id:n.id,spec:t.spec})?n.action===`disable`?{...e,enabled:!1,runtimeStatus:`disabled`}:n.action===`update`?{...e,installedAt:new Date().toISOString(),origin:e.origin??`marketplace`}:{...e,enabled:!0,runtimeStatus:`ready`}:e);return{...i,records:a,specs:lZ(a),total:a.length}}var hZ=3e4;function gZ(e){return e instanceof rn&&e.code===`MARKETPLACE_SKILL_LOCAL_CHANGES`}function _Z(e){let t=kn({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>ft({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&yZ(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:hZ,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,H.useMemo)(()=>see(t.data),[t.data]);return{...t,data:n}}function vZ(e,t=!0){return z({queryKey:[`marketplace-recent-items`,e],queryFn:()=>ft({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:hZ,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function yZ(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function bZ(e=!0){return z({queryKey:[`marketplace-skill-scenes`],queryFn:ve,enabled:e,staleTime:6e4})}function xZ(e,t=!0){let n=na({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>ft({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,H.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function SZ(e){return z({queryKey:[`marketplace-installed`,e],queryFn:()=>ut(e),staleTime:1e4})}function CZ(){let e=xe();return R({mutationFn:e=>Et(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>pZ({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),I.success(t.message||b(`marketplaceInstallSuccessSkill`))},onError:e=>{I.error(e.message||b(`marketplaceInstallFailed`))}})}function wZ(){let e=xe();return R({mutationFn:e=>un(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>mZ({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?b(`marketplaceEnableSuccess`):t.action===`disable`?b(`marketplaceDisableSuccess`):t.action===`update`?b(`marketplaceUpdateSuccess`):b(`marketplaceUninstallSuccess`);I.success(t.message||r)},onError:e=>{gZ(e)||I.error(e.message||b(`marketplaceOperationFailed`))}})}var TZ=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function EZ(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,U.jsx)(`div`,{className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,DZ(i),r),children:a})}function DZ(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return TZ[Math.abs(t)%TZ.length]}function OZ({title:e,spec:t}){return(0,U.jsxs)(li,{delayDuration:400,children:[(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,U.jsx)(ui,{className:`max-w-[300px] text-xs`,children:e})]}),(0,U.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,U.jsx)(ui,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function kZ(e){let{item:t,record:n,state:r,onInstall:i,onManage:a}=e,{isInstalling:o,canUpdate:s,canUninstall:c,busyAction:l}=r,d=!!l;return t&&!n||n&&(s||c)?(0,U.jsxs)(`div`,{className:u(`flex shrink-0 items-center justify-end gap-1.5 opacity-100 transition-opacity duration-150`,`md:pointer-events-none md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[t&&!n&&(0,U.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),i(t)},disabled:o,className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md bg-primary px-2 text-[11px] font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,U.jsx)(ja,{className:`h-3 w-3`}),b(o?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&s&&(0,U.jsxs)(`button`,{disabled:d,onClick:e=>{e.stopPropagation(),a(`update`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-blue-200/80 bg-white px-2 text-[11px] font-medium text-blue-600 transition-colors hover:border-blue-300 hover:bg-blue-50 disabled:opacity-50`,children:[(0,U.jsx)(ki,{className:`h-3 w-3`}),b(l===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&c&&(0,U.jsxs)(`button`,{disabled:d,onClick:e=>{e.stopPropagation(),a(`uninstall`,n)},className:`inline-flex h-6 items-center gap-1 whitespace-nowrap rounded-md border border-gray-200/80 bg-white px-2 text-[11px] font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,U.jsx)(ms,{className:`h-3 w-3`}),b(l===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function AZ(e){let{record:t,disabled:n}=e;return t?(0,U.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,U.jsx)(jZ,{disabled:n})}):null}function jZ(e){let{disabled:t}=e,n=b(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,U.jsx)(li,{delayDuration:300,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`span`,{"aria-label":n,className:u(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,U.jsx)(_a,{className:`h-4 w-4 opacity-40`}):(0,U.jsx)(_a,{className:`h-4 w-4`})})}),(0,U.jsx)(ui,{className:`text-xs`,children:n})]})})}function MZ(e){let{item:t,record:n,installState:r,manageState:i,onOpen:a,onInstall:o,onManage:s}=e,{language:c}=Gn(),l=Bn(c),u=t?.name??n?.label??n?.id??n?.spec??b(`marketplaceUnknownItem`),d=Ln(t?.summaryI18n,t?.summary,l)||(n?b(`marketplaceInstalledLocalSummary`):``),f=t?.install.spec??n?.spec??``,p=t?.tags??[],m=n?.id||n?.spec,h=m?i.actionsByTarget.get(m):void 0,g=n?.type===`skill`&&n.source===`workspace`,_=n?.type===`skill`&&n.origin===`marketplace`,v=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,y=t?.install.spec,x=typeof y==`string`&&r.installingSpecs.has(y);return(0,U.jsxs)(`article`,{onClick:a,className:`group flex h-full min-h-[156px] cursor-pointer flex-col rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,U.jsx)(EZ,{name:u,fallback:f||b(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,U.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,U.jsx)(OZ,{title:u,spec:f})}),(0,U.jsx)(AZ,{record:n,disabled:v})]}),(0,U.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,U.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:d}),(0,U.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(NZ,{tags:p})}),(0,U.jsx)(kZ,{item:t,record:n,state:{isInstalling:x,canUpdate:_,canUninstall:g,busyAction:h},onInstall:o,onManage:s})]})]})]})}function NZ({tags:e}){let t=e.filter(PZ).slice(0,3);return t.length===0?null:(0,U.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,U.jsx)(`span`,{className:`max-w-[104px] truncate rounded-md bg-gray-100 px-2 py-0.5 text-[11px] font-medium leading-5 text-gray-500`,children:e},e))})}function PZ(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function FZ({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:o,header:s,status:c,emptyLabel:l,errorLabel:d}=e,{showSkeleton:f,isRefreshing:p,error:m}=c,{hasMore:h,loadingMore:g,sentinelRef:_}=r,{installState:v,manageState:y}=n,{onOpen:b,onInstall:x,onManage:S}=i;return(0,U.jsxs)(`section`,{className:u(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:s.title}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[p&&(0,U.jsx)(`span`,{className:`font-medium text-primary`,children:s.refreshingLabel}),(0,U.jsx)(`span`,{children:s.summary})]})]}),m&&(0,U.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[d,`: `,m.message]}),p&&(0,U.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,U.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,U.jsxs)(`div`,{"data-testid":f?`marketplace-list-skeleton`:void 0,className:u(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,f&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[f&&(0,U.jsx)(Un,{count:36}),!f&&!m&&o.map(e=>(0,U.jsx)(MZ,{item:e.item,record:e.record,installState:v,manageState:y,onOpen:()=>b(e.item,e.record),onInstall:x,onManage:S},e.key))]}),!f&&!m&&o.length===0&&(0,U.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:l}),a===`all`&&!f&&!m&&(0,U.jsx)(An,{hasMore:h,loading:g,sentinelRef:_})]})}function IZ(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:a=`rail`,onOpen:o,onInstall:s}=e,{item:c,record:l}=t,d=Ln(c.summaryI18n,c.summary,r),f=c.install.spec,p=i.installingSpecs.has(f),m=!!l;return(0,U.jsxs)(`article`,{onClick:()=>o(t),className:u(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,a===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,U.jsx)(EZ,{name:c.name,fallback:c.install.spec}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,U.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:c.name}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:LZ(c)})]})]}),(0,U.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:d}),(0,U.jsx)(RZ,{tags:c.tags})]}),(0,U.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:BZ(c.updatedAt)}),m?(0,U.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,U.jsx)(_a,{className:`h-3.5 w-3.5`}),VZ({zh:`已安装`,en:`Installed`},n)]}):(0,U.jsxs)(`button`,{type:`button`,disabled:p,onClick:e=>{e.stopPropagation(),s(c)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,U.jsx)(ja,{className:`h-3.5 w-3.5`}),b(p?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function LZ(e){return e.slug||e.install.spec}function RZ({tags:e}){let t=e.filter(zZ).slice(0,2);return t.length===0?null:(0,U.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function zZ(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function BZ(e){return e.slice(0,10)||e}function VZ(e,t){return t.startsWith(`zh`)?e.zh:e.en}var HZ=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:cs,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:fee,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:Wo,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:Ma,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:Aa,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Oo,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ir,tone:`teal`,span:`md:col-span-2`}],UZ={icon:Ir,tone:`dark`,span:`md:col-span-2`},WZ={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},GZ=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function KZ(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=Bn(a);return(0,U.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,U.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,U.jsx)(XZ,{icon:Da,title:ZZ({zh:`场景`,en:`Scenes`},a),description:ZZ({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,U.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid auto-rows-[104px] grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:(0,U.jsx)(Un,{count:HZ.length})}):(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,U.jsx)(qZ,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,U.jsx)(YZ,{icon:Sa,title:ZZ({zh:`最近更新`,en:`Recently updated`},a),description:ZZ({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:t,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function qZ(e){let{scene:t,language:n,onSelect:r}=e,i=QZ(t.scene),a=i.icon,o=WZ[i.tone];return(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:u(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,o.card),children:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:u(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,o.icon),children:(0,U.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:$Z(t,i,n)}),typeof t.count==`number`&&(0,U.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:tQ(t.count,n)})]}),(0,U.jsx)(`p`,{className:u(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,o.text),children:eQ(t,i,n)})]})})}function JZ(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:o,onBack:s,onOpen:c,onInstall:l}=e,d=QZ(t.scene),f=d.icon,p=WZ[d.tone];return(0,U.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":ZZ({zh:`返回`,en:`Back`},i),children:(0,U.jsx)(wi,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:u(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,U.jsx)(f,{className:`h-4 w-4`})}),(0,U.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:$Z(t,d,i)}),(0,U.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:ZZ(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,U.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,U.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:eQ(t,d,i)})})]})]}),r?(0,U.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:u(GZ,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,U.jsx)(Un,{count:24})}):n.length>0?(0,U.jsx)(`div`,{className:GZ,children:n.map(e=>(0,U.jsx)(IZ,{entry:e,language:i,localeFallbacks:a,installState:o,layout:`grid`,onOpen:c,onInstall:l},e.item.id))}):(0,U.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:ZZ({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function YZ(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,U.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,U.jsx)(XZ,{icon:t,title:n,description:r}),s?(0,U.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 grid auto-rows-[166px] grid-cols-[repeat(4,260px)] gap-2.5 overflow-hidden px-1 pb-1.5`,children:(0,U.jsx)(Un,{count:4})}):(0,U.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,U.jsx)(IZ,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function XZ({icon:e,title:t,description:n}){return(0,U.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,U.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function ZZ(e,t){return t.startsWith(`zh`)?e.zh:e.en}function QZ(e){return HZ.find(t=>t.scene===e)??{scene:e,...UZ}}function $Z(e,t,n){return t.title?ZZ(t.title,n):e.title}function eQ(e,t,n){return t.summary?ZZ(t.summary,n):e.description??e.scene}function tQ(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var nQ=`https://skillhub.cn/`;function rQ(){return(0,U.jsx)(ge,{href:nQ,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:b(`marketplaceExternalSkillSourceTitle`)})}function iQ(e){return(e??``).trim().toLowerCase()}function aQ(e,t){let n=iQ(t);return n.length>0?`${e}:${n}`:``}function oQ(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=aQ(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function sQ(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=aQ(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function cQ(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=aQ(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function lQ(e,t){return t.get(aQ(e.type,e.spec))||t.get(aQ(e.type,e.id))||t.get(aQ(e.type,e.label))}function uQ(e,t,n,r){let i=iQ(n);if(!i)return!0;let a=Ln(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>iQ(e)).filter(Boolean).some(e=>e.includes(i))}function dQ(e){let{items:t,recentItems:n,installedRecordLookup:r,scene:i,forcedType:a,typeFilter:o,scope:s,searchText:c,query:l,showListSkeleton:u,hasCatalogError:d}=e,f=bZ(o===`skill`),p=(0,H.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=xZ(p,o===`skill`),h=(0,H.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,H.useMemo)(()=>t.map(e=>({item:e,record:cQ(e,r)})),[t,r]),_=(0,H.useMemo)(()=>n.map(e=>({item:e,record:cQ(e,r)})),[r,n]),v=(0,H.useMemo)(()=>{let e=i?.trim();if(e)return h.find(t=>t.scene===e)??{scene:e,title:e}},[i,h]),y=o===`skill`&&!!i?.trim(),b=o===`skill`&&s===`all`&&!c.trim()&&!l&&!y,x=u||t.length>=4,S=b&&!d&&x&&h.length===0&&f.isLoading;return{entries:g,recentEntries:_,scenes:h,selectedScene:v,sceneEntries:g,isSceneRoute:y,isScenesLoading:S,showShelves:b&&!d&&x&&(u||h.length>0||S),backPath:a?`/skills`:`/marketplace/skills`,pathPrefix:a?`/skills/scenes`:`/marketplace/skills/scenes`}}function fQ(){let e=CZ(),t=wZ(),{confirm:n,ConfirmDialog:r}=On(),[i,a]=(0,H.useState)(new Set),[o,s]=(0,H.useState)(new Map);return{installState:{installingSpecs:i},manageState:{actionsByTarget:o},handleInstall:async t=>{let n=t.install.spec;if(!i.has(n)){a(e=>new Set(e).add(n));try{await e.mutateAsync({type:t.type,spec:n,kind:t.install.kind,skill:t.slug,installPath:`skills/${t.slug}`})}catch{}finally{a(e=>{let t=new Set(e);return t.delete(n),t})}}},handleManage:async(e,r)=>{let i=e===`update`?r.catalogSlug||r.id||r.spec:r.id||r.spec;if(!(!i||o.has(i))&&!(e===`uninstall`&&!await n({title:`${b(`marketplaceUninstallTitle`)} ${i}?`,description:b(`marketplaceUninstallDescription`),confirmLabel:b(`marketplaceUninstall`),variant:`destructive`}))){s(t=>new Map(t).set(i,e));try{let a={type:r.type,action:e,id:i,spec:r.spec};try{await t.mutateAsync(a)}catch(r){if(e!==`update`||!gZ(r)||!await n({title:b(`marketplaceUpdateConflictTitle`),description:b(`marketplaceUpdateConflictDescription`),confirmLabel:b(`marketplaceUpdateConflictConfirm`),variant:`destructive`}))return;await t.mutateAsync({...a,force:!0})}}finally{s(e=>{let t=new Map(e);return t.delete(i),t})}}},ConfirmDialog:r}}function pQ(e){let t=Ui(),n=(0,H.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(r,i)=>{let a=r?.name??i?.label??i?.id??i?.spec??b(`marketplaceUnknownItem`),o=Pn(r?`skill`:`skill-local`,r?.slug??i?.id??i?.spec??a),s=r?`marketplace:${r.type}:${r.slug}`:`marketplace:${i?.type??`unknown`}:${i?.id??i?.spec??a}`,c=b(`marketplaceTypeSkill`);if(!r){Fn(t,{id:o,title:a,typeLabel:c,spec:i?.spec??`-`,status:`ready`,summary:b(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(i??{},null,2),contentRaw:`-`});return}let l=n.current.seq+1;n.current.seq=l,n.current.byKey.set(s,l);let u=Ln(r.summaryI18n,r.summary,e);Fn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`loading`,summary:u,tags:r.tags,author:r.author});try{let e=await Ze(r.slug);if(n.current.byKey.get(s)!==l)return;Fn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`ready`,summary:u,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:r.tags,author:r.author},{activate:!1})}catch(e){if(n.current.byKey.get(s)!==l)return;Fn(t,{id:o,title:a,typeLabel:c,spec:r.install.spec,status:`error`,summary:u,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:b(`marketplaceOperationFailed`)},{activate:!1})}}}}function mQ(e){let{scope:t,typeFilter:n,query:r,localeFallbacks:i,catalogView:a,installedView:o,isCatalogLoading:s,isCatalogFetching:c,isCatalogFetchingNextPage:l,catalogError:u,isInstalledLoading:d,installedError:f}=e,p=(0,H.useMemo)(()=>o?.records??[],[o?.records]),m=(0,H.useMemo)(()=>a?.items??[],[a?.items]),h=(0,H.useMemo)(()=>oQ(m),[m]),g=(0,H.useMemo)(()=>sQ(p),[p]),_=(0,H.useMemo)(()=>p.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:lQ(e,h)})).filter(e=>uQ(e.record,e.item,r,i)).sort((e,t)=>hQ(e.record,t.record)),[p,n,h,r,i]),v=(0,H.useMemo)(()=>t===`installed`?_:m.map(e=>({key:e.id,item:e,record:cQ(e,g)})),[m,_,g,t]),y=t===`all`&&s&&!a||t===`installed`&&d&&!o,x=t===`all`&&!y&&!!a&&c&&!l,S=t===`installed`?d&&!o?b(`loading`):`${_.length} ${b(`marketplaceInstalledSkillsCountSuffix`)}`:a?`${a.total} ${b(`marketplaceSkillsCountSuffix`)}`:b(`loading`),C=t===`all`&&u?u:t===`installed`&&f?f:void 0,w={scope:t,entries:v,header:{title:b(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:S,refreshingLabel:b(`marketplaceRefreshingResults`)},status:{showSkeleton:y,isRefreshing:x,error:C},emptyLabel:b(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:b(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:m,installedRecordLookup:g,installedTotal:o?.total??0,itemListView:w,showListSkeleton:y,isRefreshingList:x}}function hQ(e,t){let n=Date.parse(e.installedAt??``),r=Date.parse(t.installedAt??``);return Number.isNaN(n)||Number.isNaN(r)||n===r?e.spec.localeCompare(t.spec):r-n}var gQ=20;function _Q({forcedType:e}={}){let t=ce(),n=le(),{language:r}=Gn(),i=`skill`,a=(0,H.useMemo)(()=>Bn(r),[r]),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(`all`),[f,p]=(0,H.useState)(`relevance`),{installState:m,manageState:h,handleInstall:g,handleManage:_,ConfirmDialog:v}=fQ(),{openItemDetail:y}=pQ(a);(0,H.useEffect)(()=>{let e=setTimeout(()=>{l(o.trim())},250);return()=>clearTimeout(e)},[o]);let x=SZ(i),S=i===`skill`?n.scene?.trim():void 0,C=_Z({q:S?void 0:c||void 0,scene:S,type:i,sort:f,pageSize:gQ}),w=vZ(i,u===`all`&&!o.trim()&&!c&&!S),{containerRef:T,sentinelRef:E}=zn({disabled:u!==`all`||C.isError||!C.hasNextPage||C.isFetchingNextPage,onLoadMore:()=>C.fetchNextPage(),watchValue:`${i}:${u}:${c}:${S??``}:${f}:${C.data?.loadedItems??0}:${C.data?.loadedPages??0}`}),{onScroll:D}=oY({restorationKey:`marketplace:${e??`all`}`,scrollRef:T});(0,H.useEffect)(()=>{let e=T.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[T,c,S,u,f,i]);let O=mQ({scope:u,typeFilter:i,query:c,localeFallbacks:a,catalogView:C.data,installedView:x.data,isCatalogLoading:C.isLoading,isCatalogFetching:C.isFetching,isCatalogFetchingNextPage:C.isFetchingNextPage,catalogError:C.isError?C.error:void 0,isInstalledLoading:x.isLoading,installedError:x.isError?x.error:void 0}),k=dQ({items:O.allItems,recentItems:w.data?.items??[],installedRecordLookup:O.installedRecordLookup,scene:S,forcedType:e,typeFilter:i,scope:u,searchText:o,query:c,showListSkeleton:O.showListSkeleton,hasCatalogError:C.isError});return(0,U.jsxs)(Vt,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!k.isSceneRoute&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-gray-200/60`,children:[(0,U.jsx)(KY,{value:u,onValueChange:e=>d(e),children:(0,U.jsxs)(qY,{className:`mb-0 h-auto flex-1 justify-start gap-6 rounded-none border-b-0 bg-transparent p-0 text-gray-500`,children:[(0,U.jsx)(JY,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:b(`marketplaceTabMarketplaceSkills`)}),(0,U.jsxs)(JY,{value:`installed`,className:`gap-1.5 rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-transparent data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[b(`marketplaceTabInstalledSkills`),(0,U.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:O.installedTotal})]})]})}),(0,U.jsx)(rQ,{})]}),(0,U.jsx)(In,{scope:u,searchText:o,isRefreshing:O.isRefreshingList,searchPlaceholder:b(`marketplaceSearchPlaceholderSkills`),sort:f,onSearchTextChange:s,onSortChange:p})]}),(0,U.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,U.jsxs)(`div`,{ref:T,onScroll:D,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":O.showListSkeleton||C.isFetchingNextPage,children:[k.isSceneRoute&&k.selectedScene&&(0,U.jsx)(JZ,{scene:k.selectedScene,entries:k.sceneEntries,isLoading:O.showListSkeleton,language:r,localeFallbacks:a,installState:m,onBack:()=>t(k.backPath),onOpen:e=>void y(e.item,e.record),onInstall:g}),k.isSceneRoute&&!O.showListSkeleton&&(0,U.jsx)(An,{hasMore:!!C.hasNextPage,loading:C.isFetchingNextPage,sentinelRef:E}),k.showShelves&&(0,U.jsx)(KZ,{recentEntries:k.recentEntries,scenes:k.scenes,isScenesLoading:k.isScenesLoading,isItemsLoading:O.showListSkeleton||w.isLoading,language:r,installState:m,onOpen:e=>void y(e.item,e.record),onInstall:g,onOpenScene:e=>t(`${k.pathPrefix}/${e}`)}),!k.isSceneRoute&&(0,U.jsx)(FZ,{model:O.itemListView,showTitle:k.showShelves||!O.showListSkeleton,operationState:{installState:m,manageState:h},scroll:{hasMore:!!C.hasNextPage,loadingMore:C.isFetchingNextPage,sentinelRef:E},actions:{onOpen:(e,t)=>void y(e,t),onInstall:g,onManage:_}})]})}),(0,U.jsx)(v,{})]})}function vQ({error:e,filter:t,hostTarget:n,installedById:r,isError:i,isFetchingNextPage:a,isLoading:o,isStarting:s,items:c,localeFallbacks:l,onFilterChange:u,onInstall:d,onLoadMore:f,onSearchChange:p,onSelect:m,onUpdate:h,operations:g,hasNextPage:_,search:v,startingSource:y}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yQ,{filter:t,onFilterChange:u,onSearchChange:p,search:v}),(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background px-4 py-4 sm:px-6 sm:py-5`,children:[e?(0,U.jsx)(`div`,{role:`alert`,className:`mb-2 rounded-xl bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive ring-1 ring-destructive/15`,children:e.message||b(`appPackagesActionFailed`)}):null,(0,U.jsx)(bQ,{installedById:r,hostTarget:n,isError:i,isFetchingNextPage:a,isLoading:o,isStarting:s,items:c,localeFallbacks:l,onInstall:d,onLoadMore:f,onSelect:m,onUpdate:h,operations:g,hasNextPage:_,startingSource:y})]})]})}function yQ({filter:e,onFilterChange:t,onSearchChange:n,search:r}){let i=[{value:`all`,label:b(`appPackagesFilterAll`)},{value:`featured`,label:b(`appPackagesMarketplaceFeatured`)},{value:`personal`,label:b(`appPackagesFilterPersonal`)},{value:`local`,label:b(`appPackagesFilterLocal`)}];return(0,U.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 bg-card px-5 pb-3.5 pt-[max(1.25rem,env(safe-area-inset-top))] sm:px-6 sm:pt-5`,children:[(0,U.jsxs)(Gr,{className:`pr-8`,children:[(0,U.jsx)(Jr,{className:`text-xl`,children:b(`appPackagesMarketplaceTitle`)}),(0,U.jsx)(Vr,{className:`max-w-xl leading-5`,children:b(`appPackagesMarketplaceDescription`)})]}),(0,U.jsxs)(`div`,{className:`relative mt-4`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,U.jsx)(Ct,{autoFocus:!0,className:`h-10 rounded-xl border-transparent bg-muted/65 pl-9 shadow-none focus-visible:ring-1`,value:r,onChange:e=>n(e.target.value),placeholder:b(`appPackagesMarketplaceSearch`),"aria-label":b(`appPackagesMarketplaceSearch`)})]}),(0,U.jsx)(`div`,{className:`mt-3 flex gap-1 overflow-x-auto`,"aria-label":b(`appPackagesFilterLabel`),children:i.map(n=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>t(n.value),className:u(`shrink-0 rounded-full px-3 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e===n.value?`bg-foreground text-background`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:n.label},n.value))})]})}function bQ({installedById:e,hostTarget:t,isError:n,isFetchingNextPage:r,isLoading:i,isStarting:a,items:o,localeFallbacks:s,onInstall:c,onLoadMore:l,onSelect:u,onUpdate:d,operations:f,hasNextPage:p,startingSource:m}){return i?(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2 min-[820px]:grid-cols-3`,"aria-label":b(`appPackagesMarketplaceLoading`),children:[(0,U.jsx)(Pi,{className:`aspect-[16/9] w-full rounded-2xl`}),(0,U.jsx)(Pi,{className:`aspect-[16/9] w-full rounded-2xl`}),(0,U.jsx)(Pi,{className:`hidden aspect-[16/9] w-full rounded-2xl min-[820px]:block`})]}):n?(0,U.jsx)(`div`,{role:`alert`,className:`rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-5 text-sm text-destructive`,children:b(`appPackagesMarketplaceFailed`)}):o.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-center px-6 py-14 text-center`,children:[(0,U.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-2xl bg-muted`,children:(0,U.jsx)(Ti,{className:`h-5 w-5 text-muted-foreground`})}),(0,U.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:b(`appPackagesMarketplaceEmpty`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:b(`appPackagesMarketplaceEmptyHint`)})]}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 min-[820px]:grid-cols-3`,children:o.map(n=>(0,U.jsx)(xQ,{installedPackage:e.get(n.appId),hostTarget:t,isStarting:a&&m===n.install.spec,item:n,localeFallbacks:s,onInstall:c,onSelect:u,onUpdate:d,operation:zX(f,n.appId,n.install.spec)},n.id))}),p?(0,U.jsx)(`div`,{className:`flex justify-center pt-5`,children:(0,U.jsx)(`button`,{type:`button`,disabled:r,onClick:l,className:`rounded-full border border-border bg-card px-4 py-2 text-xs font-medium text-foreground transition hover:bg-[var(--interaction-hover)] disabled:cursor-wait disabled:opacity-60`,children:b(r?`appPackagesMarketplaceLoadingMore`:`appPackagesMarketplaceLoadMore`)})}):null]})}function xQ({installedPackage:e,hostTarget:t,isStarting:n,item:r,localeFallbacks:i,onInstall:a,onSelect:o,onUpdate:s,operation:c}){let l=e?SQ(e.name,e.nameI18n):r.name,u=Ln(r.summaryI18n,r.summary,i),d=c?nZ(c.status):!1,f=!!(e&&e.activeVersion!==r.latestVersion),p=oZ(r.availability,b(`appPackagesAllPlatforms`)),m=NX(sZ(r.availability,t),p),h=!!(m&&(!e||f));return(0,U.jsxs)(`article`,{className:`group relative overflow-hidden rounded-2xl border border-border/60 bg-card shadow-sm transition duration-200 hover:-translate-y-0.5 hover:border-border hover:shadow-lg`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>o(r.slug),className:`block w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:(0,U.jsx)(jX,{accentColor:r.accentColor,coverPreview:r.coverPreview,coverUrl:r.coverUrl,name:l,className:`aspect-[16/9] rounded-none ring-0`})}),(0,U.jsxs)(`div`,{className:`p-3.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(OX,{icon:r.iconUrl??e?.icon,name:l,className:`h-11 w-11 rounded-[13px]`}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>o(r.slug),className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:l}),r.featured?(0,U.jsx)(Ir,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`,"aria-label":b(`appPackagesMarketplaceFeatured`)}):null]}),(0,U.jsx)(PX,{presentation:m}),(0,U.jsx)(`span`,{className:`mt-1 line-clamp-2 block min-h-10 text-xs leading-5 text-muted-foreground`,children:u}),(0,U.jsxs)(`span`,{className:`mt-2 flex items-center gap-1.5 text-[11px] text-muted-foreground/75`,children:[(0,U.jsx)(`span`,{children:r.publisher.name}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,U.jsxs)(`span`,{children:[`v`,r.latestVersion]}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`span`,{children:p}),(0,U.jsx)(ha,{className:`ml-0.5 h-3 w-3 opacity-0 transition-opacity group-hover:opacity-60`})]})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-border/50 pt-3`,children:[(0,U.jsx)(FX,{blocked:h,presentation:m,className:`min-w-0 text-[11px] font-medium text-muted-foreground`}),(0,U.jsx)(IX,{active:d,canUpdate:f,installed:!!e,isStarting:n,onAction:()=>f?s(r.appId):a(r.install.spec,r.install.registry),operation:c,unavailableLabel:h?m?.actionLabel:void 0,unavailableReason:h?m?.reason:void 0})]})]}),c&&!h&&d?(0,U.jsx)(`div`,{className:`px-4 pb-4`,children:(0,U.jsx)(RX,{operation:c})}):null]})}function SQ(e,t){let n=N()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e??``}function CQ({detail:e,error:t,hostTarget:n,installedPackage:r,isLoading:i,isStarting:a,localeFallbacks:o,onInstall:s,onUpdate:c,operation:l}){if(i)return(0,U.jsxs)(`div`,{className:`space-y-4 p-6`,children:[(0,U.jsx)(Pi,{className:`h-24 w-full rounded-2xl`}),(0,U.jsx)(Pi,{className:`h-40 w-full rounded-2xl`})]});if(t||!e)return(0,U.jsx)(`div`,{role:`alert`,className:`m-6 rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-5 text-sm text-destructive`,children:t?.message??b(`appPackagesMarketplaceFailed`)});let u=Ln(e.summaryI18n,e.summary,o),d=Ln(e.descriptionI18n,e.description??u,o),f=l?nZ(l.status):!1,p=e.manifest.components??[],m=p.filter(e=>e.kind===`panel`).length,h=p.filter(e=>e.kind===`service`).length,g=e.manifest.runtime?.profile??(h>0?`native-process`:`panel-only`),_=!!(r&&r.activeVersion!==e.latestVersion),v=oZ(e.availability,b(`appPackagesAllPlatforms`)),y=NX(sZ(e.availability,n),v),x=!!(y&&(!r||_));return(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-5 py-5 sm:px-7 sm:py-6`,children:[(0,U.jsxs)(`div`,{className:`grid items-stretch gap-5 sm:grid-cols-[minmax(0,1.18fr)_minmax(240px,0.82fr)]`,children:[(0,U.jsx)(jX,{accentColor:e.accentColor,coverPreview:e.coverPreview,coverUrl:e.coverUrl,name:e.name,className:`aspect-[16/9] rounded-2xl`}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-2xl border border-border/60 bg-card p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(OX,{icon:e.iconUrl??r?.icon,name:e.name,className:`h-14 w-14 rounded-2xl`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-foreground`,children:e.name}),(0,U.jsx)(PX,{presentation:y}),(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(ns,{className:`h-3.5 w-3.5`}),e.publisher.name]}),(0,U.jsxs)(`span`,{children:[`v`,e.latestVersion]})]})]})]}),(0,U.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:u}),(0,U.jsxs)(`div`,{className:`mt-auto pt-4`,children:[(0,U.jsx)(FX,{blocked:x,presentation:y,className:`mb-2 text-xs font-medium text-muted-foreground`}),(0,U.jsx)(IX,{active:f,canUpdate:_,installed:!!r,isStarting:a,onAction:()=>_?c(e.appId):s(e.install.spec,e.install.registry),operation:l,unavailableLabel:x?y?.actionLabel:void 0,unavailableReason:x?y?.reason:void 0})]})]})]}),l&&!x&&f?(0,U.jsx)(RX,{operation:l}):null,(0,U.jsxs)(`section`,{className:`mt-7`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:b(`appPackagesAboutApp`)}),(0,U.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:d})]}),(0,U.jsxs)(`div`,{className:`mt-6 grid gap-3 sm:grid-cols-2`,children:[(0,U.jsx)(wQ,{icon:Mo,label:b(`appPackagesPlatformsLabel`),value:v}),(0,U.jsx)(wQ,{icon:Wn,label:b(`appPackagesPanelsAdded`),value:m>0?String(m):b(`appPackagesNone`)}),(0,U.jsx)(wQ,{icon:Qo,label:b(`appPackagesServicesAdded`),value:h>0?String(h):b(`appPackagesNone`)}),e.manifest.engines?.nextclaw?(0,U.jsx)(wQ,{icon:ns,label:b(`appPackagesNextClawRequirement`),value:e.manifest.engines.nextclaw}):null,(0,U.jsx)(wQ,{icon:g===`native-process`?ts:ns,label:b(`appPackagesIsolationLabel`),value:b(g===`native-process`?`appPackagesIsolationFullUser`:g===`wasi`?`appPackagesIsolationMediated`:`appPackagesIsolationPanel`)})]}),(0,U.jsxs)(`section`,{className:`mt-7 border-t border-border/60 pt-6`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:b(`appPackagesAccessTitle`)}),(0,U.jsx)(`div`,{className:`mt-3 space-y-2`,children:TQ(e).map(e=>(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-xl bg-muted/45 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[(0,U.jsx)(ns,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:e})]},e))})]}),(0,U.jsxs)(`a`,{href:e.webUrl,target:`_blank`,rel:`noreferrer`,className:`mt-6 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground underline-offset-4 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[b(`appPackagesOpenPublicDetails`),(0,U.jsx)(fe,{className:`h-3.5 w-3.5`})]})]})}function wQ({icon:e,label:t,value:n}){return(0,U.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border/60 px-3 py-3`,children:[(0,U.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,U.jsx)(e,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:t}),(0,U.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:n})]})]})}function TQ(e){let t=[],n=e.permissions.documentAccess??[];n.length>0&&t.push(b(`appPackagesDocumentAccess`).replace(`{count}`,String(n.length)));let r=e.permissions.allowedDomains??[];return r.length>0&&t.push(b(`appPackagesNetworkAccess`).replace(`{count}`,String(r.length))),e.permissions.capabilities?.hostBridge&&t.push(b(`appPackagesHostBridgeAccess`)),e.permissions.capabilities?.nativeProcess&&t.push(b(`appPackagesNativeProcessAccess`)),(e.permissions.storage===!0||typeof e.permissions.storage==`object`&&e.permissions.storage?.namespace)&&t.push(b(`appPackagesLocalStorageAccess`)),t.length>0?t:[b(`appPackagesNoExtraAccess`)]}var EQ=`https://apps-registry.nextclaw.io`,DQ=new Set([404,405,501]),OQ=(void 0)?.replace(/\/$/,``),kQ=void 0,AQ=new Set([`hello-notes`,`personal-organizer`,`starter-card`,`workspace-glance`]);async function jQ(e={},t){let n=await PQ(e,t);return DQ.has(n.status)?await IQ(e,t):await FQ(n)}async function MQ(e,t){let n=await fetch(`${EQ}/api/v1/apps/items/${encodeURIComponent(e)}`,{headers:{accept:`application/json`},signal:t});if(!n.ok)throw Error(`Marketplace detail request failed (${n.status})`);let r=await n.json();if(!VQ(r)||r.ok!==!0||!VQ(r.data))throw Error(`Marketplace returned an invalid app detail`);let{data:i}=r,a=i;if(!RQ(i)||!VQ(a.manifest)||!VQ(a.permissions))throw Error(`Marketplace returned an invalid app detail`);let{manifest:o,permissions:s}=a,c=Array.isArray(o.components)?o.components.filter(e=>VQ(e)&&(e.kind===`panel`||e.kind===`service`)&&typeof e.path==`string`):void 0;return{...NQ(i),description:typeof a.description==`string`?a.description:void 0,descriptionI18n:BQ(a.descriptionI18n)?a.descriptionI18n:void 0,manifest:{schemaVersion:o.schemaVersion===2?2:1,icon:typeof o.icon==`string`?o.icon:void 0,engines:VQ(o.engines)&&typeof o.engines.nextclaw==`string`?{nextclaw:o.engines.nextclaw}:void 0,components:c},permissions:s}}function NQ(e){if(e.coverUrl)return e;let t=LQ(e.slug);return e.publisher.id!==`nextclaw`||!t?e:{...e,coverUrl:t,coverPreview:!0}}async function PQ(e,t){let{cursor:n,featured:r,limit:i,publisher:a,q:o,sort:s,tag:c,tags:l}=e,u=new URLSearchParams;return o&&u.set(`q`,o),c&&u.set(`tag`,c),l?.length&&u.set(`tags`,l.join(`,`)),a&&u.set(`publisher`,a),r!==void 0&&u.set(`featured`,String(r)),s&&u.set(`sort`,s),n&&u.set(`cursor`,n),u.set(`limit`,String(i??24)),await fetch(`${EQ}/api/v2/apps/items?${u}`,{headers:{accept:`application/json`},signal:t})}async function FQ(e){if(!e.ok)throw Error(`Marketplace request failed (${e.status})`);let t=await e.json();if(!VQ(t)||t.ok!==!0||!VQ(t.data))throw Error(`Marketplace returned an invalid response`);return{items:(Array.isArray(t.data.items)?t.data.items.filter(RQ):[]).map(NQ),nextCursor:typeof t.data.nextCursor==`string`?t.data.nextCursor:void 0,hasMore:t.data.hasMore===!0,query:typeof t.data.query==`string`?t.data.query:void 0,tag:typeof t.data.tag==`string`?t.data.tag:void 0,featured:typeof t.data.featured==`boolean`?t.data.featured:void 0,sort:t.data.sort===`updated`||t.data.sort===`featured`?t.data.sort:`relevance`}}async function IQ(e,t){let{featured:n,publisher:r,q:i,sort:a,tag:o,tags:s}=e,c=new URLSearchParams({page:`1`,pageSize:`100`});i&&c.set(`q`,i),o&&c.set(`tag`,o);let l=await fetch(`${EQ}/api/v1/apps/items?${c}`,{headers:{accept:`application/json`},signal:t});if(!l.ok)throw Error(`Marketplace compatibility request failed (${l.status})`);let u=await l.json();if(!VQ(u)||u.ok!==!0||!VQ(u.data))throw Error(`Marketplace returned an invalid compatibility response`);let d=Array.isArray(u.data.items)?u.data.items.filter(RQ):[],f=new Set(s??[]);return{items:d.filter(e=>!r||e.publisher.id===r).filter(e=>n===void 0||e.featured===n).filter(e=>f.size===0||e.tags.some(e=>f.has(e))).map(NQ),hasMore:!1,query:i,tag:o,tags:s,featured:n,sort:a??(i?`relevance`:`featured`)}}function LQ(e){let t=OQ??kQ;if(t&&AQ.has(e))return`${t}/${encodeURIComponent(e)}.webp`}function RQ(e){return!VQ(e)||!VQ(e.install)||!VQ(e.publisher)?!1:typeof e.id==`string`&&typeof e.slug==`string`&&typeof e.appId==`string`&&typeof e.name==`string`&&(e.iconUrl===void 0||typeof e.iconUrl==`string`)&&(e.coverUrl===void 0||typeof e.coverUrl==`string`)&&(e.coverPreview===void 0||typeof e.coverPreview==`boolean`)&&(e.accentColor===void 0||typeof e.accentColor==`string`)&&typeof e.summary==`string`&&BQ(e.summaryI18n)&&Array.isArray(e.tags)&&e.tags.every(e=>typeof e==`string`)&&typeof e.latestVersion==`string`&&typeof e.featured==`boolean`&&(e.availability===void 0||zQ(e.availability))&&typeof e.publisher.id==`string`&&typeof e.publisher.name==`string`&&e.install.kind===`registry`&&typeof e.install.spec==`string`&&typeof e.install.registry==`string`&&typeof e.webUrl==`string`}function zQ(e){return!VQ(e)||e.mode!==`universal`&&e.mode!==`targeted`?!1:Array.isArray(e.targets)&&e.targets.every(e=>typeof e==`string`)&&Array.isArray(e.operatingSystems)&&e.operatingSystems.every(e=>e===`darwin`||e===`linux`||e===`win32`)}function BQ(e){return VQ(e)&&Object.values(e).every(e=>typeof e==`string`)}function VQ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var HQ=[`app-marketplace`,`v3`];function UQ(e,t){let n=kn({queryKey:[...HQ,e],initialPageParam:void 0,queryFn:async({pageParam:t,signal:n})=>await jQ({...e,cursor:t,limit:24},n),getNextPageParam:e=>e.nextCursor,enabled:t,retry:1,staleTime:300*1e3}),r=(0,H.useMemo)(()=>{if(!n.data)return;let e=new Map;for(let t of n.data.pages)for(let n of t.items)e.set(n.id,n);return{items:[...e.values()],hasMore:n.data.pages.at(-1)?.hasMore??!1}},[n.data]);return{...n,data:r}}function WQ(e,t){return z({queryKey:[`app-marketplace-detail`,`v2`,e],queryFn:async({signal:t})=>await MQ(e??``,t),enabled:t&&!!e,retry:1,staleTime:300*1e3})}var GQ=new Set([`nextclaw.starter-card`,`nextclaw.validation-task-board`]);function KQ({error:e,hostTarget:t,installedPackages:n,isStarting:r,onInstall:i,onOpenChange:a,onUpdate:o,open:s,operations:c,startingSource:l}){let[u,d]=(0,H.useState)(`all`),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(null);(0,H.useEffect)(()=>{let e=window.setTimeout(()=>h(f.trim()),250);return()=>window.clearTimeout(e)},[f]);let v=UQ((0,H.useMemo)(()=>({q:m||void 0,featured:u===`featured`?!0:void 0,tags:u===`personal`?[`personal`,`productivity`,`notes`,`calendar`]:void 0,tag:u===`local`?`local`:void 0,sort:m?`relevance`:`featured`}),[m,u]),s),y=WQ(g,s),x=(0,H.useMemo)(()=>new Map(n.map(e=>[e.id,e])),[n]),S=Bn(N()===`zh`?`zh-CN`:`en-US`),C=(0,H.useMemo)(()=>(v.data?.items??[]).filter(e=>!GQ.has(e.appId)).map((e,n)=>({item:e,index:n,rank:cZ(sZ(e.availability,t))})).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(({item:e})=>e),[t,v.data?.items]);return(0,U.jsx)(Wr,{open:s,onOpenChange:e=>{e||_(null),a(e)},children:(0,U.jsx)(li,{children:(0,U.jsxs)(qr,{className:`flex h-dvh w-screen max-w-none flex-col gap-0 overflow-hidden rounded-none border-0 bg-background/95 p-0 shadow-[0_32px_100px_rgba(0,0,0,0.24)] backdrop-blur-xl [&>button.absolute]:top-[max(1rem,env(safe-area-inset-top))] sm:h-[min(680px,calc(100dvh-4rem))] sm:w-[min(920px,calc(100vw-3rem))] sm:max-w-none sm:rounded-2xl sm:border sm:border-border/55`,children:[g?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(qQ,{onBack:()=>_(null)}),(0,U.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background`,children:(0,U.jsx)(CQ,{detail:y.data,error:y.error instanceof Error?y.error:null,installedPackage:y.data?x.get(y.data.appId):void 0,hostTarget:t,isLoading:y.isLoading,isStarting:r&&y.data?.install.spec===l,localeFallbacks:S,onInstall:i,onUpdate:o,operation:y.data?zX(c,y.data.appId,y.data.install.spec):void 0})})]}):(0,U.jsx)(vQ,{error:e,filter:u,installedById:x,hostTarget:t,isError:v.isError,isFetchingNextPage:v.isFetchingNextPage,isLoading:v.isLoading,isStarting:r,items:C,localeFallbacks:S,onFilterChange:d,onInstall:i,onLoadMore:()=>void v.fetchNextPage(),onSearchChange:p,onSelect:_,onUpdate:o,operations:c,hasNextPage:v.hasNextPage,search:f,startingSource:l}),(0,U.jsxs)(`div`,{className:`flex items-start gap-2 border-t border-border/60 bg-muted/25 px-5 pb-[max(.75rem,env(safe-area-inset-bottom))] pt-3 text-[11px] leading-4 text-muted-foreground sm:px-6 sm:pb-3`,children:[(0,U.jsx)(ns,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:b(`appPackagesMarketplaceTrustHint`)})]})]})})})}function qQ({onBack:e}){return(0,U.jsx)(`div`,{className:`border-b border-border/60 bg-card px-4 pb-3 pt-[max(.75rem,env(safe-area-inset-top))] sm:px-5 sm:pt-3`,children:(0,U.jsxs)(`button`,{type:`button`,onClick:e,className:`inline-flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(wi,{className:`h-4 w-4`}),b(`appPackagesBackToMarketplace`)]})})}function JQ({appPackage:e,isPending:t,operation:n,onDisable:r,onEnable:i,onOpenPanelApp:a,onRollback:o,onUninstall:s,onUpdate:c,panelApps:l,storageUsage:d,storageUsageLoading:f,storageUsageUnavailable:p,unavailableMessage:m}){let[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(!1),[y,x]=(0,H.useState)(!1),S=(0,H.useRef)(!1),C=(0,H.useRef)(null),w=e.components.filter(e=>e.kind===`panel`),T=e.components.length-w.length,E=e.installedVersions.filter(t=>t!==e.activeVersion),D=i$(e.name,e.nameI18n)??e.id,O=i$(e.description,e.descriptionI18n),k=n?nZ(n.status):!1,A=t||k,j=ZQ(e.enabled,m),M=XQ(d,f,p);return(0,U.jsxs)(Js,{surface:`flat`,hover:!1,className:`overflow-hidden border-border/60 shadow-[0_1px_2px_rgba(0,0,0,0.025)]`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3.5 px-4 pb-3.5 pt-4`,children:[(0,U.jsx)(OX,{icon:e.icon,name:D}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`truncate text-sm font-semibold text-foreground`,children:D}),(0,U.jsx)(`span`,{className:u(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium`,j.className),children:j.label})]}),m?(0,U.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs leading-5 text-destructive`,children:m}):null,O?(0,U.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-muted-foreground`,children:O}):null,(0,U.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground/75`,children:[(0,U.jsxs)(`span`,{children:[`v`,e.activeVersion]}),e.builtIn?(0,U.jsx)(`span`,{children:b(`appPackagesBuiltIn`)}):null,T>0?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(Qo,{className:`h-3 w-3`}),b(`appPackagesLocalService`)]}):null,(0,U.jsxs)(`span`,{className:u(`inline-flex items-center gap-1`,e.isolation===`full-user`&&`text-amber-700 dark:text-amber-300`),children:[e.isolation===`full-user`?(0,U.jsx)(ts,{className:`h-3 w-3`}):(0,U.jsx)(ns,{className:`h-3 w-3`}),e.isolation===`full-user`?b(`appPackagesIsolationFullUser`):e.isolation===`host-mediated`?b(`appPackagesIsolationMediated`):b(`appPackagesIsolationPanel`)]})]}),(0,U.jsxs)(`div`,{className:`mt-2 flex min-w-0 items-center gap-1.5 rounded-md bg-muted/35 px-2 py-1 text-[10px] text-muted-foreground`,title:e.storage.dataDirectory,children:[(0,U.jsx)(io,{className:`h-3 w-3 shrink-0`}),(0,U.jsxs)(`span`,{className:`shrink-0`,children:[b(`appPackagesDataUsage`),` `,M]}),(0,U.jsx)(`code`,{className:`min-w-0 truncate font-mono text-[10px]`,children:e.storage.dataDirectory})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(L,{type:`button`,size:`sm`,variant:e.enabled?`outline`:`default`,disabled:A||!j.interactive,title:j.message,onClick:e.enabled?r:i,children:QQ({enabled:e.enabled,isPending:t,operation:n,operationActive:k})}),(0,U.jsxs)(CF,{open:h,onOpenChange:g,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`appPackagesMoreActions`),title:b(`appPackagesMoreActions`),disabled:A,className:`rounded-full p-2 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,children:(0,U.jsx)(Na,{className:`h-4 w-4`})})}),(0,U.jsxs)(EF,{align:`end`,className:`w-52 rounded-xl p-1.5`,onCloseAutoFocus:e=>{S.current&&=(e.preventDefault(),!1)},children:[(0,U.jsx)($Q,{icon:ki,label:b(`appPackagesCheckUpdate`),onClick:()=>{g(!1),c()}}),E.map(e=>(0,U.jsx)($Q,{icon:Xo,label:`${b(`appPackagesRollback`)} v${e}`,onClick:()=>{g(!1),o(e)}},e)),(0,U.jsx)($Q,{destructive:!0,icon:ms,label:b(`appPackagesUninstall`),onClick:()=>{S.current=!0,g(!1),x(!1),v(!0)}})]})]})]})]}),n&&(k||n.status===`failed`||n.status===`interrupted`)?(0,U.jsx)(t$,{operation:n}):null,w.length>0?(0,U.jsx)(`div`,{className:`border-t border-border/60 bg-muted/20 p-2`,children:(0,U.jsx)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:w.map(t=>{let n=l.find(e=>e.appId===t.id),r=r$(t.id),i=i$(t.title,t.titleI18n)??t.id;return(0,U.jsxs)(`button`,{type:`button`,disabled:!e.enabled||!n||A||!j.interactive,onClick:()=>n&&a({...n,title:i,description:i$(t.description,t.descriptionI18n)}),className:`group flex min-w-0 items-center gap-2 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-default disabled:opacity-55`,title:j.message??(e.enabled?i:b(`appPackagesEnableToOpen`)),children:[(0,U.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-card text-muted-foreground shadow-sm ring-1 ring-border/60`,children:(0,U.jsx)(e$,{icon:t.icon,fallback:r})}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-foreground`,children:i}),e.enabled?(0,U.jsx)(ha,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5`}):null]},t.id)})})}):null,(0,U.jsx)(Wr,{open:_,onOpenChange:v,children:(0,U.jsxs)(qr,{className:`max-w-md [&>:last-child]:hidden`,onOpenAutoFocus:e=>{e.preventDefault(),C.current?.focus()},children:[(0,U.jsxs)(Gr,{children:[(0,U.jsx)(Jr,{children:b(`appPackagesUninstallTitle`)}),(0,U.jsx)(Vr,{children:b(`appPackagesUninstallDescription`)})]}),(0,U.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,U.jsx)(VX,{checked:!y,description:b(`appPackagesKeepDataDescription`),label:b(`appPackagesKeepData`),onClick:()=>x(!1)}),(0,U.jsx)(VX,{checked:y,destructive:!0,description:b(`appPackagesDeleteDataDescription`),label:b(`appPackagesDeleteData`),onClick:()=>x(!0)})]}),(0,U.jsx)(`div`,{className:`mt-3`,children:(0,U.jsx)(YQ,{loading:f,storage:e.storage,usage:d,unavailable:p})}),(0,U.jsxs)(Fr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,U.jsx)(L,{ref:C,autoFocus:!0,type:`button`,variant:`outline`,onClick:()=>v(!1),children:b(`cancel`)}),(0,U.jsx)(L,{type:`button`,variant:`destructive`,onClick:()=>{s(y),v(!1)},children:b(`appPackagesUninstall`)})]})]})})]})}function YQ({loading:e,storage:t,unavailable:n,usage:r}){return r?(0,U.jsx)(HX,{storage:t,usage:r}):(0,U.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-3 text-xs text-muted-foreground`,children:[e?(0,U.jsx)(Di,{className:`mr-1.5 inline h-3.5 w-3.5 animate-spin`}):null,b(e?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)]})}function XQ(e,t,n){return e?UX(e.totalBytes):b(t?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)}function ZQ(e,t){return t?{className:`bg-destructive/10 text-destructive`,interactive:!1,label:b(`appPackagesUnavailable`),message:t}:{className:e?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-muted text-muted-foreground`,interactive:!0,label:b(e?`appPackagesEnabled`:`appPackagesAvailable`),message:void 0}}function QQ({enabled:e,isPending:t,operation:n,operationActive:r}){return r?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Di,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),n?n$(n):b(`appPackagesWorking`)]}):b(t?`appPackagesWorking`:e?`appPackagesDisable`:`appPackagesEnable`)}function $Q({destructive:e=!1,icon:t,label:n,onClick:r}){return(0,U.jsxs)(`button`,{type:`button`,onClick:r,className:u(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),children:[(0,U.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:n})]})}function e$({fallback:e,icon:t}){return t&&(t.startsWith(`data:`)||t.startsWith(`/`)||t.startsWith(`http://`)||t.startsWith(`https://`))?(0,U.jsx)(`img`,{src:t,alt:``,className:`h-4 w-4 rounded object-cover`}):t?(0,U.jsx)(`span`,{className:`text-sm leading-none`,children:t}):(0,U.jsx)(e,{className:`h-3.5 w-3.5`})}function t$({operation:e}){let t=e.status===`failed`||e.status===`interrupted`,n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,U.jsxs)(`div`,{className:`border-t border-border/50 px-4 py-2.5`,role:t?`alert`:`status`,"aria-live":`polite`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[t?(0,U.jsx)(Hr,{className:`h-3.5 w-3.5 text-destructive`}):(0,U.jsx)(Di,{className:`h-3.5 w-3.5 animate-spin text-primary`}),(0,U.jsx)(`span`,{className:t?`text-destructive`:`text-muted-foreground`,children:t?e.error??b(`appPackagesActionFailed`):n$(e)})]}),(0,U.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:u(`h-full rounded-full transition-[width] duration-300`,t?`bg-destructive`:`bg-primary`),style:{width:t?`100%`:`${n}%`}})})]})}function n$(e){switch(e.status){case`queued`:return b(`appPackagesPreparing`);case`resolving`:return b(`appPackagesResolving`);case`downloading`:return b(`appPackagesDownloading`);case`verifying`:return b(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?`${b(`appPackagesSwitchingVersion`)} ${e.targetVersion?`v${e.targetVersion}`:``}`.trim():e.action===`uninstall`?b(`appPackagesUninstalling`):b(`appPackagesInstalling`);case`finalizing`:return b(`appPackagesFinalizing`);case`succeeded`:return b(`appPackagesCompleted`);case`failed`:case`interrupted`:return b(`appPackagesActionFailed`)}}function r$(e){return e.endsWith(`-todos`)?os:e.endsWith(`-notes`)?Po:e.endsWith(`-favorites`)?uee:e.endsWith(`-calendar`)?pa:fi}function i$(e,t){let n=N()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e}function a$({focusedPackageId:e,onOpenPanelApp:t}){let n=eZ(),r=GX(),i=tZ(),a=OY(),o=iZ(),s=AY(),c=jY(),l=N9(),u=(0,H.useRef)(null),[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(``),[h,g]=(0,H.useState)(!1),_=(0,H.useMemo)(()=>i.data?.entries??[],[i.data?.entries]);(0,H.useEffect)(()=>{if(!e||n.isLoading)return;let t=document.getElementById(`app-package-${e}`);t?.scrollIntoView({block:`nearest`}),t?.focus({preventScroll:!0})},[n.data,n.isLoading,e]),rZ({isLoaded:!!i.data,operations:_,refetchPackages:n.refetch,refetchPanels:a.refetch,refetchAppData:r.refetch,settlementManager:l.appPackageOperationSettlementManager});let v=(e,t)=>{o.reset(),o.mutate(e,{onSuccess:t})},y=async e=>{if(e.clientDeclared&&!e.clientGranted){if(!await l.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:b(`panelAppsClientGrantTitle`),actionDescription:b(`panelAppsClientGrantDescription`),risk:`dangerous`}]}))return;await c.mutateAsync(e.appId)}try{t(await s.mutateAsync(e.id))}catch{t(e)}},x=e=>{e.preventDefault();let t=p.trim();t&&v({action:`install`,source:t},()=>{f(!1),m(``)})};return(0,U.jsxs)(`div`,{className:`@container flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end gap-1 border-b border-border/70 px-4 py-2`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>{n.refetch(),i.refetch(),a.refetch(),r.refetch()},className:`rounded-full p-2 text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:b(`appPackagesRefresh`),"aria-label":b(`appPackagesRefresh`),children:(0,U.jsx)(ki,{className:`h-3.5 w-3.5`})}),(0,U.jsxs)(L,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{o.reset(),g(!0)},children:[(0,U.jsx)(ds,{className:`mr-1.5 h-3.5 w-3.5`}),b(`appPackagesBrowse`)]}),(0,U.jsxs)(L,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{o.reset(),f(!0)},children:[(0,U.jsx)(Fo,{className:`mr-1.5 h-3.5 w-3.5`}),b(`appPackagesInstall`)]})]}),(0,U.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl p-3 sm:p-5`,children:[(0,U.jsxs)(`div`,{className:`mb-4 px-1`,children:[(0,U.jsx)(`h1`,{ref:u,tabIndex:-1,className:`text-base font-semibold tracking-tight text-foreground`,children:b(`appPackagesLibraryTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:b(`appPackagesLibraryDescription`)})]}),o.isError?(0,U.jsx)(`div`,{role:`alert`,className:`mb-3 rounded-xl bg-destructive/8 px-3 py-2.5 text-xs leading-5 text-destructive ring-1 ring-destructive/15`,children:o.error instanceof Error?o.error.message:b(`appPackagesActionFailed`)}):null,(0,U.jsx)(o$,{appDataEntries:r.data?.entries??[],appDataLoading:r.isLoading,appDataUnavailable:r.isError,error:l$(n.error,a.error),focusedPackageId:e,isLoading:n.isLoading||a.isLoading,isPending:o.isPending,mutationAppId:`appId`in(o.variables??{})?o.variables.appId:void 0,packages:n.data?.entries??[],panelApps:a.data?.entries??[],unavailablePackages:a.data?.unavailablePackages??[],operations:_,onInstall:()=>f(!0),onMutate:v,onOpenPanelApp:e=>void y(e)}),(0,U.jsx)(qX,{diagnostics:r.data?.diagnostics??[],entries:r.data?.entries??[],error:r.error,isLoading:r.isLoading,onDeletionFocusReturn:()=>u.current?.focus()})]})}),(0,U.jsx)(KQ,{error:o.error instanceof Error?o.error:null,hostTarget:n.data?.hostTarget,installedPackages:n.data?.entries??[],startingSource:o.variables?.action===`install`?o.variables.source:void 0,isStarting:o.isPending,operations:_,open:h,onOpenChange:g,onInstall:(e,t)=>v({action:`install`,source:e,registryUrl:t}),onUpdate:e=>v({action:`update`,appId:e})}),(0,U.jsx)(Wr,{open:d,onOpenChange:f,children:(0,U.jsx)(qr,{className:`max-w-md [&>:last-child]:hidden`,children:(0,U.jsxs)(`form`,{onSubmit:x,children:[(0,U.jsxs)(Gr,{children:[(0,U.jsx)(Jr,{children:b(`appPackagesInstallTitle`)}),(0,U.jsx)(Vr,{children:b(`appPackagesInstallDescription`)})]}),(0,U.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,U.jsx)(Ct,{autoFocus:!0,value:p,onChange:e=>m(e.target.value),placeholder:b(`appPackagesInstallPlaceholder`),"aria-label":b(`appPackagesInstallSource`)}),(0,U.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl bg-muted/60 px-3 py-2.5 text-xs leading-5 text-muted-foreground`,children:[(0,U.jsx)(ns,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:b(`appPackagesInstallTrustHint`)})]}),o.isError?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:o.error instanceof Error?o.error.message:b(`appPackagesActionFailed`)}):null]}),(0,U.jsxs)(Fr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,U.jsx)(L,{type:`button`,variant:`outline`,onClick:()=>f(!1),children:b(`cancel`)}),(0,U.jsx)(L,{type:`submit`,disabled:!p.trim()||o.isPending,children:o.isPending?b(`appPackagesInstalling`):b(`appPackagesInstall`)})]})]})})})]})}function o$({appDataEntries:e,appDataLoading:t,appDataUnavailable:n,error:r,focusedPackageId:i,isLoading:a,isPending:o,mutationAppId:s,onInstall:c,onMutate:l,onOpenPanelApp:u,packages:d,panelApps:f,unavailablePackages:p,operations:m}){if(a)return(0,U.jsxs)(`div`,{className:`space-y-2.5`,"aria-label":b(`appPackagesLoading`),children:[(0,U.jsx)(Pi,{className:`h-44 w-full rounded-2xl`}),(0,U.jsx)(Pi,{className:`h-32 w-full rounded-2xl`})]});if(r)return(0,U.jsx)(`div`,{className:`rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-4 text-sm text-destructive`,children:r});if(d.length===0){let e=m.filter(e=>e.action===`install`&&nZ(e.status));return e.length>0?(0,U.jsx)(`div`,{className:`space-y-2.5`,children:e.map(e=>(0,U.jsx)(s$,{operation:e},e.id))}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-border px-6 py-10 text-center`,children:[(0,U.jsx)(Fo,{className:`h-7 w-7 text-muted-foreground`}),(0,U.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:b(`appPackagesEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-muted-foreground`,children:b(`appPackagesEmptyDescription`)}),(0,U.jsx)(L,{type:`button`,size:`sm`,className:`mt-4`,onClick:c,children:b(`appPackagesInstall`)})]})}return(0,U.jsxs)(`div`,{className:`space-y-2.5`,children:[m.filter(e=>e.action===`install`&&nZ(e.status)&&!d.some(t=>t.id===e.appId)).map(e=>(0,U.jsx)(s$,{operation:e},e.id)),d.map(r=>{let a=m.find(e=>e.appId===r.id),c=a&&(nZ(a.status)||a.status===`failed`||a.status===`interrupted`)?a:void 0;return(0,U.jsx)(`section`,{id:`app-package-${r.id}`,"aria-label":r.name,tabIndex:-1,className:i===r.id?`rounded-xl outline-none ring-2 ring-primary/35 ring-offset-2 ring-offset-background`:`rounded-xl outline-none`,children:(0,U.jsx)(JQ,{appPackage:r,unavailableMessage:p.find(e=>e.appId===r.id)?.message,storageUsage:e.find(e=>e.source===`package`&&e.lifecycle===`active`&&e.appId===r.id&&e.instanceId===r.instanceId)?.usage??r.storageUsage,storageUsageLoading:t,storageUsageUnavailable:n,panelApps:f.filter(e=>e.packageId===r.id),isPending:o&&s===r.id,operation:c,onEnable:()=>l({action:`enable`,appId:r.id}),onDisable:()=>l({action:`disable`,appId:r.id}),onUpdate:()=>l({action:`update`,appId:r.id}),onRollback:e=>l({action:`rollback`,appId:r.id,version:e}),onUninstall:e=>l({action:`uninstall`,appId:r.id,purgeData:e}),onOpenPanelApp:u})},r.id)})]})}function s$({operation:e}){let t=e.appId??e.source??b(`appPackagesInstall`),n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,U.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card px-4 py-3.5 shadow-[0_1px_2px_rgba(0,0,0,0.025)]`,role:`status`,"aria-live":`polite`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(OX,{name:t}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:t}),(0,U.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Di,{className:`h-3.5 w-3.5 animate-spin`}),c$(e)]})]})]}),(0,U.jsx)(`div`,{className:`ml-14 mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width] duration-300`,style:{width:`${n}%`}})})]})}function c$(e){switch(e.status){case`queued`:return b(`appPackagesPreparing`);case`resolving`:return b(`appPackagesResolving`);case`downloading`:return b(`appPackagesDownloading`);case`verifying`:return b(`appPackagesVerifying`);case`installing`:return b(`appPackagesInstalling`);case`finalizing`:return b(`appPackagesFinalizing`);case`succeeded`:return b(`appPackagesCompleted`);case`failed`:case`interrupted`:return e.error??b(`appPackagesActionFailed`)}}function l$(...e){return e.find(e=>e instanceof Error)?.message||(e.some(Boolean)?b(`appPackagesLoadFailed`):void 0)}function u$(){return`service-action-auth-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var d$=P((e,t)=>({pending:null,requestAuthorization:async n=>await new Promise(r=>{t().pending?.resolve(!1),e({pending:{id:u$(),...n,resolve:r}})}),resolveAuthorization:n=>{let{pending:r}=t();r&&(r.resolve(n),e({pending:null}))}}));function f$(){let e=d$(e=>e.pending),t=d$(e=>e.resolveAuthorization);return(0,U.jsx)(Wr,{open:!!e,onOpenChange:e=>{e||t(!1)},children:(0,U.jsxs)(qr,{className:`[&>:last-child]:hidden`,children:[(0,U.jsxs)(Gr,{children:[(0,U.jsxs)(Jr,{className:`flex items-center gap-2`,children:[(0,U.jsx)(ts,{className:`h-4 w-4 text-amber-600`}),b(`serviceActionAuthorizationTitle`)]}),(0,U.jsx)(Vr,{children:b(`serviceActionAuthorizationDescription`)})]}),e?(0,U.jsxs)(`div`,{className:`space-y-3 rounded-md border border-border bg-muted/60 p-3 text-sm`,children:[(0,U.jsx)(m$,{label:b(`serviceActionAuthorizationSource`),value:e.panelAppId}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:b(`serviceActionAuthorizationActions`)}),(0,U.jsx)(`div`,{className:`max-h-64 space-y-2 overflow-auto`,children:e.actions.map(e=>(0,U.jsx)(p$,{action:e},e.actionId))})]}),e.inputPreview?(0,U.jsx)(m$,{label:b(`serviceActionAuthorizationInput`),value:e.inputPreview}):null]}):null,(0,U.jsxs)(Fr,{className:`gap-2 sm:gap-0`,children:[(0,U.jsx)(L,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:b(`serviceActionAuthorizationReject`)}),(0,U.jsx)(L,{type:`button`,onClick:()=>t(!0),children:b(`serviceActionAuthorizationAllow`)})]})]})})}function p$({action:e}){return(0,U.jsxs)(`div`,{className:`space-y-1 rounded border border-border bg-card px-3 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsx)(`div`,{className:`min-w-0 break-words text-xs font-medium text-foreground`,children:e.actionTitle??e.actionId}),(0,U.jsx)(`div`,{className:`shrink-0 rounded bg-amber-50 px-1.5 py-0.5 text-[11px] font-medium text-amber-700`,children:e.risk??`dangerous`})]}),(0,U.jsx)(`div`,{className:`break-words text-[11px] text-muted-foreground`,children:e.actionId}),e.actionDescription?(0,U.jsx)(`div`,{className:`break-words text-xs text-muted-foreground`,children:e.actionDescription}):null]})}function m$({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}var h$=class{constructor(){this.requestAuthorization=async e=>await d$.getState().requestAuthorization(e)}};function g$({appId:e,appTitle:t,dataEntry:n,dataLoading:r,deleteError:i,deletePending:a,open:o,purgeData:s,onDelete:c,onOpenChange:l,onPurgeDataChange:u}){let d=(0,H.useRef)(null);(0,H.useEffect)(()=>{i&&d.current?.focus()},[i]);let f=()=>l(!1);return(0,U.jsx)(Wr,{open:o,onOpenChange:e=>!a&&l(e),children:(0,U.jsxs)(qr,{className:`max-w-md [&>:last-child]:hidden`,onEscapeKeyDown:e=>a&&e.preventDefault(),onInteractOutside:e=>a&&e.preventDefault(),children:[(0,U.jsxs)(Gr,{children:[(0,U.jsx)(Jr,{children:b(`serviceAppsDeleteConfirmTitle`)}),(0,U.jsxs)(Vr,{children:[b(`serviceAppsDeleteConfirmDescription`),` `,t]})]}),(0,U.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,U.jsx)(VX,{checked:!s,description:b(`serviceAppsKeepDataDescription`),label:b(`appPackagesKeepData`),onClick:()=>u(!1)}),(0,U.jsx)(VX,{checked:s,destructive:!0,disabled:!n||r,description:b(`serviceAppsDeleteDataDescription`),label:b(`appPackagesDeleteData`),onClick:()=>u(!0)})]}),n?(0,U.jsx)(`div`,{className:`mt-3`,children:(0,U.jsx)(HX,{storage:n.storage,usage:n.usage})}):(0,U.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:b(r?`appPackagesLoading`:`serviceAppsDataUnavailable`)}),i?(0,U.jsx)(`p`,{ref:d,role:`alert`,tabIndex:-1,className:`mt-3 text-xs text-destructive`,children:i instanceof Error?i.message:b(`appPackagesActionFailed`)}):null,(0,U.jsxs)(Fr,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,U.jsx)(L,{autoFocus:!0,type:`button`,variant:`outline`,disabled:a,onClick:f,children:b(`cancel`)}),(0,U.jsxs)(L,{type:`button`,variant:s?`destructive`:`default`,disabled:a||s&&!n,onClick:()=>c(e,s,f),children:[a?(0,U.jsx)(Di,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,b(s?`appDataDeletePermanently`:`serviceAppsDelete`)]})]})]})})}function _$({app:e,actions:t,actionsOpen:n,grants:r,deletePending:i,deleteError:a,dataEntry:o,dataLoading:s,isDiscovering:c,onActionsOpenChange:l,onDiscover:d,onManagePackage:f,onDelete:p,onResetDelete:m,onRestart:h,onRevoke:g}){let[_,v]=(0,H.useState)(!1),[y,x]=(0,H.useState)(!1),[S,C]=(0,H.useState)(!1),[w,T]=(0,H.useState)(!1),E=e.status!==`starting`&&e.status!==`stopped`,D=e.status===`running`||e.status===`failed`,O=e.sourceKind===`package`?e.packageId:void 0,k=x$(e),A=()=>{v(!1),T(!1),m(),x(!0)};return(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(`section`,{className:`group bg-card transition-colors hover:bg-muted/25`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3 px-4 py-3.5`,children:[(0,U.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,U.jsx)(Qo,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.title}),(0,U.jsx)(v$,{status:e.status})]}),e.description?(0,U.jsx)(`div`,{className:`mt-1 truncate text-xs leading-5 text-muted-foreground`,children:e.description}):null,e.lastError?(0,U.jsx)(`div`,{className:`mt-1.5 truncate text-xs text-rose-600`,title:e.lastError,children:e.lastError}):null]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[E?(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,disabled:c,className:`inline-flex h-7 items-center gap-1.5 rounded-md bg-foreground px-2.5 text-xs font-medium text-background transition-colors hover:bg-foreground/85 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40 disabled:cursor-not-allowed disabled:opacity-50`,"aria-label":b(`serviceAppsDiscoverActions`),onClick:()=>d(e.id),children:[c?(0,U.jsx)(Di,{className:`h-3.5 w-3.5 animate-spin`}):(0,U.jsx)(Jo,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:b(`serviceAppsConnect`)})]})}),(0,U.jsx)(ui,{side:`bottom`,className:`max-w-56 text-xs`,children:b(`serviceAppsDiscoverActionsHint`)})]}):null,(0,U.jsxs)(CF,{open:_,onOpenChange:v,children:[(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:opacity-50`,"aria-label":b(`serviceAppsMoreActions`),disabled:i,children:(0,U.jsx)($r,{className:`h-3.5 w-3.5`})})})}),(0,U.jsx)(ui,{side:`bottom`,className:`text-xs`,children:b(`serviceAppsMoreActions`)})]}),(0,U.jsxs)(EF,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:[(0,U.jsx)(b$,{disabled:!D,icon:gs,label:b(`serviceAppsDisconnectRuntime`),onClick:()=>{v(!1),h(e.id)}}),O?(0,U.jsx)(b$,{icon:Qr,label:b(`serviceAppsManagePackage`),onClick:()=>{v(!1),f(O)}}):(0,U.jsx)(b$,{destructive:!0,disabled:i,icon:ms,label:b(`serviceAppsDelete`),onClick:A})]})]})]})]}),(0,U.jsxs)(`div`,{className:`border-t border-border/60`,children:[(0,U.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>l(!n),className:`flex min-w-0 flex-1 items-center justify-between gap-2 px-4 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":n,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{children:b(`serviceAppsActionsSection`)}),(0,U.jsx)(`span`,{className:`tabular-nums text-muted-foreground/70`,children:t.length})]}),(0,U.jsx)(or,{className:u(`h-3.5 w-3.5 shrink-0 text-muted-foreground/70 transition-transform`,n&&`rotate-180`)})]}),k.length>0?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`flex shrink-0 items-center gap-1 border-l border-border/60 px-3 text-xs text-muted-foreground transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,"aria-expanded":S,children:[(0,U.jsx)(`span`,{children:b(`serviceAppsDetails`)}),(0,U.jsx)(or,{className:u(`h-3.5 w-3.5 transition-transform`,S&&`rotate-180`)})]}):null]}),n?(0,U.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:t.length===0?(0,U.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground`,children:b(`serviceAppsActionsEmpty`)}):(0,U.jsx)(`div`,{className:`divide-y divide-border/50`,children:t.map(e=>(0,U.jsx)(w$,{action:e,grants:r.filter(t=>t.actionId===e.id),onRevoke:g},e.id))})}):null,S?(0,U.jsx)(S$,{rows:k}):null]}),e.sourceKind===`package`?null:(0,U.jsx)(g$,{appId:e.id,appTitle:e.title,dataEntry:o,dataLoading:s,deleteError:a,deletePending:i,open:y,purgeData:w,onDelete:p,onOpenChange:x,onPurgeDataChange:T})]})})}function v$({status:e}){let t=y$(e),n=t.icon;return(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsxs)(`span`,{className:u(`inline-flex shrink-0 items-center gap-1 text-xs`,t.className),"aria-label":t.label,children:[(0,U.jsx)(n,{className:u(`h-3 w-3`,t.iconClassName)}),(0,U.jsx)(`span`,{children:t.label})]})}),(0,U.jsx)(ui,{side:`bottom`,className:`text-xs`,children:t.tooltip})]})}function y$(e){switch(e){case`running`:return{className:`text-emerald-700`,icon:_a,label:b(`serviceAppsStatus_running`),tooltip:b(`serviceAppsStatusHint_running`)};case`starting`:return{className:`text-blue-700`,icon:Di,iconClassName:`animate-spin`,label:b(`serviceAppsStatus_starting`),tooltip:b(`serviceAppsStatusHint_starting`)};case`failed`:return{className:`text-rose-700`,icon:hs,label:b(`serviceAppsStatus_failed`),tooltip:b(`serviceAppsStatusHint_failed`)};case`stopped`:return{className:`text-muted-foreground`,icon:ba,label:b(`serviceAppsStatus_stopped`),tooltip:b(`serviceAppsStatusHint_stopped`)};default:return{className:`text-muted-foreground`,icon:va,label:b(`serviceAppsStatus_idle`),tooltip:b(`serviceAppsStatusHint_idle`)}}}function b$({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:opacity-50`,e?`text-destructive hover:bg-destructive/10`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),disabled:t,onClick:i,children:[(0,U.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:r})]})}function x$(e){let t=[e.command,...e.args??[]].filter(e=>!!e?.trim()).join(` `);return[{label:b(`serviceAppsCommand`),value:t},{label:b(`serviceAppsCwd`),value:e.cwd},{label:b(`serviceAppsManifest`),value:e.manifestPath},{label:b(`serviceAppsLastStarted`),value:e.lastStartedAt},{label:b(`serviceAppsLastReady`),value:e.lastReadyAt},{label:b(`serviceAppsLastFailed`),value:e.lastFailedAt}].filter(e=>e.value)}function S$({rows:e}){return(0,U.jsx)(`div`,{className:`border-t border-border/60 px-4 py-2.5`,children:(0,U.jsx)(`dl`,{className:`grid grid-cols-[4.75rem_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-xs`,children:e.map(e=>(0,U.jsx)(C$,{label:e.label,value:e.value},e.label))})})}function C$({label:e,value:t}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground/70`,children:e}),(0,U.jsx)(`dd`,{className:`min-w-0 truncate font-mono text-muted-foreground`,title:t,children:t})]})}function w$({action:e,grants:t,onRevoke:n}){return(0,U.jsxs)(`div`,{className:`py-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center text-muted-foreground`,children:(0,U.jsx)(xs,{className:`h-3.5 w-3.5`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:e.title??e.name}),e.description?(0,U.jsx)(`div`,{className:`truncate text-[11px] text-muted-foreground`,children:e.description}):null]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.runtimeState?(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:b(`serviceAppsRuntimeState_${e.runtimeState}`)}):null,(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.risk})]})]}),t.map(e=>(0,U.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between gap-2 pl-8`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,U.jsx)(ns,{className:`h-3 w-3 shrink-0 text-emerald-500`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[b(`serviceAppsGrantedTo`),` `,e.caller.appId]})]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`rounded-md p-1 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-rose-600 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:b(`serviceAppsRevokeGrant`),"aria-label":b(`serviceAppsRevokeGrant`),children:(0,U.jsx)(ms,{className:`h-3 w-3`})})]},`${e.caller.surface}:${e.caller.appId}:${e.actionId}`))]})}var T$=[`service-apps`],E$=[`service-actions`],D$=[`service-action-grants`],O$=[`app-data`];function k$(){return z({queryKey:T$,queryFn:()=>F.serviceApps.listServiceApps()})}function A$(){return z({queryKey:E$,queryFn:()=>F.serviceApps.listServiceActions()})}function j$(){return z({queryKey:D$,queryFn:()=>F.serviceApps.listServiceActionGrants()})}function M$(){let e=xe();return R({mutationFn:e=>F.serviceApps.restartServiceApp(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:T$}),e.invalidateQueries({queryKey:E$})])}})}function N$(){let e=xe();return R({mutationFn:e=>F.serviceApps.deleteServiceApp(e.appId,e.purgeData),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:T$}),e.invalidateQueries({queryKey:E$}),e.invalidateQueries({queryKey:D$}),e.invalidateQueries({queryKey:O$})])}})}function P$(){let e=xe();return R({mutationFn:e=>F.serviceApps.discoverServiceAppActions(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:T$})}})}function F$(){let e=xe();return R({mutationFn:e=>F.serviceApps.revokeServiceActionGrant(e),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:E$}),e.invalidateQueries({queryKey:D$})])}})}function I$({onManagePackage:e}){let t=k$(),n=GX(),r=A$(),i=j$(),a=N$(),o=M$(),s=P$(),c=F$(),[l,u]=(0,H.useState)({}),[d,f]=(0,H.useState)({}),p=()=>{t.refetch(),r.refetch(),i.refetch(),n.refetch()};if(t.isLoading||r.isLoading||i.isLoading)return(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:b(`serviceAppsLoading`)});if(t.isError||r.isError||i.isError){let e=t.error??r.error??i.error;return(0,U.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:e instanceof Error?e.message:b(`serviceAppsLoadFailed`)})}let m=t.data?.entries??[],h=t.data?.diagnostics??[],g=r.data?.actions??[],_=i.data?.grants??[],v=e=>{s.mutateAsync(e).then(t=>{u(n=>({...n,[e]:t.actions})),f(t=>({...t,[e]:!0}))})},y=(n.data?.entries??[]).filter(e=>e.source===`workspace-service`&&e.lifecycle===`active`);return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,U.jsx)(`div`,{className:`flex min-h-12 shrink-0 items-center justify-end border-b border-border/60 px-4 py-2`,children:(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":b(`serviceAppsRefresh`),onClick:p,children:(0,U.jsx)(ki,{className:`h-3.5 w-3.5`})})}),(0,U.jsx)(ui,{side:`bottom`,className:`text-xs`,children:b(`serviceAppsRefresh`)})]})})}),h.length>0?(0,U.jsxs)(`div`,{role:`alert`,className:`mx-3 mt-3 rounded-xl border border-destructive/20 bg-destructive/5 px-3 py-2.5 text-xs text-destructive sm:mx-4`,children:[(0,U.jsx)(`div`,{className:`font-medium`,children:b(`serviceAppsLoadFailed`)}),(0,U.jsx)(`ul`,{className:`mt-1 space-y-1`,children:h.map(e=>(0,U.jsxs)(`li`,{className:`break-words`,children:[e.appId,`: `,e.message]},e.stagedPath))})]}):null,m.length===0?(0,U.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 py-8 text-center`,children:(0,U.jsxs)(`div`,{className:`w-full max-w-xs`,children:[(0,U.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-muted-foreground`,children:(0,U.jsx)(Qo,{className:`h-5 w-5`})}),(0,U.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:b(`serviceAppsEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:b(`serviceAppsEmptyDescription`)})]})}):(0,U.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3 sm:p-4`,children:(0,U.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-border/70 bg-card`,children:m.map(t=>(0,U.jsx)(_$,{app:t,actions:l[t.id]??g.filter(e=>e.appId===t.id),actionsOpen:!!d[t.id],grants:_,deletePending:a.isPending,deleteError:a.error,dataEntry:y.find(e=>e.appId===t.id),dataLoading:n.isLoading,isDiscovering:s.isPending,onActionsOpenChange:e=>f(n=>({...n,[t.id]:e})),onDiscover:v,onManagePackage:e,onDelete:(e,t,n)=>void a.mutate({appId:e,purgeData:t},{onSuccess:n}),onResetDelete:a.reset,onRestart:e=>void o.mutate(e),onRevoke:e=>void c.mutate({actionId:e.actionId,caller:e.caller})},t.id))})})]})}function L$({activeTab:e,onActiveTabChange:t,onOpenPanelApp:n}){let[r,i]=(0,H.useState)(),a=e=>{i(void 0),t(e)},o=e=>{i(e),t(`apps`)};return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,U.jsx)(`nav`,{className:`shrink-0 border-b border-border/70 px-4 py-3`,"aria-label":b(`appsTitle`),children:(0,U.jsx)(KY,{value:e,onValueChange:e=>a(e),children:(0,U.jsxs)(qY,{className:`grid h-auto w-full max-w-[390px] grid-cols-3 rounded-lg bg-muted/70 p-0.5`,children:[(0,U.jsxs)(JY,{value:`apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,U.jsx)(Qr,{className:`h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`appsTitle`)})]}),(0,U.jsxs)(JY,{value:`panel-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,U.jsx)(fi,{className:`h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`panelAppsTitle`)})]}),(0,U.jsxs)(JY,{value:`service-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,U.jsx)(Qo,{className:`h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`serviceAppsTitle`)})]})]})})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,children:e===`apps`?(0,U.jsx)(a$,{focusedPackageId:r,onOpenPanelApp:n}):e===`panel-apps`?(0,U.jsx)(ZY,{onOpenPanelApp:n}):(0,U.jsx)(I$,{onManagePackage:o})})]})}var R$=class{constructor(e){this.docBrowserManager=e,this.initialized=!1,this.knownTerminalOperationIds=new Set,this.settle=({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i})=>{if(!e)return;let a=t.filter(e=>!nZ(e.status));if(!this.initialized){a.forEach(e=>this.knownTerminalOperationIds.add(e.id)),this.initialized=!0;return}a.forEach(e=>{this.knownTerminalOperationIds.has(e.id)||(this.knownTerminalOperationIds.add(e.id),this.settleOperation(e,n,r,i))})},this.settleOperation=(e,t,n,r)=>{if(e.status===`succeeded`){I.success(z$(e)),t(),r(),n().then(t=>{e.action!==`rollback`&&e.action!==`update`||this.docBrowserManager.reloadByDedupeKeys(t.data?.entries.filter(t=>t.packageId===e.appId).map(e=>`panel-app:${e.id}`)??[])});return}(e.status===`failed`||e.status===`interrupted`)&&(t(),n(),r(),I.error(e.error??b(`appPackagesActionFailed`)))}}};function z$(e){switch(e.action){case`install`:return b(`appPackagesInstallCompleted`);case`update`:return e.result?.changed===!1?b(`appPackagesAlreadyCurrent`):b(`appPackagesUpdateCompleted`);case`rollback`:return e.result?.changed===!1?b(`appPackagesAlreadyOnVersion`):b(`appPackagesRollbackCompleted`);case`uninstall`:return b(`appPackagesUninstallCompleted`)}}function B$(e){return e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0)}function V$(e){let t=e.trim();try{let e=t.startsWith(`/`),n=e?new URL(t,`http://nextclaw.local`):new URL(t);return{authority:e?``:n.hostname,pathSegments:B$(n.pathname),pathname:n.pathname,raw:t,scheme:e?``:n.protocol.replace(/:$/,``).toLowerCase(),searchParams:n.searchParams}}catch{return{authority:``,pathSegments:B$(t),pathname:t,raw:t,scheme:``,searchParams:new URLSearchParams}}}var H$=class{constructor(e,t){this.routeDefinitions=e,this.options=t,this.resolve=e=>{let t=V$(e);return this.findDefinition(t).resolve(t)},this.normalize=e=>this.options.getNormalizedUri(this.resolve(e)),this.areEquivalent=(e,t)=>this.findDefinition(V$(e)).areEquivalent?.(e,t)??this.normalize(e)===this.normalize(t),this.findDefinition=e=>{let t=this.routeDefinitions.find(t=>t.match(e));if(!t)throw Error(`Unsupported resource URI: ${e.raw}`);return t}}},U$=`home`,W$=`nextclaw://new-tab`,G$=`apps`,K$=`nextclaw://apps`,q$=`${K$}?tab=panel-apps`,J$=`${K$}?tab=service-apps`,Y$=`panel-app`,X$=new Set([W$,`about:blank`]);function Z$(e){let t=e.resourceUri?.trim()||e.currentUrl.trim(),n=e.currentUrl.trim();return!t||!n||X$.has(t)?null:x({uri:t,resourceKind:e.kind,title:e.title.trim()||t,currentUrl:n,...e.contentParams?{contentParams:structuredClone(e.contentParams)}:{}})}var Q$=`apps`;function $$(e){return e===`apps`||e===`panel-apps`||e===`service-apps`}function e1(e=Q$){return e===`panel-apps`?q$:e===`service-apps`?J$:K$}function t1(e){try{let t=new URL(e).searchParams.get(`tab`);return $$(t)?t:Q$}catch{return Q$}}function n1(e){return e1(t1(e))}function r1(e,t){let n=`nextclaw://panel-app/${encodeURIComponent(e)}`,r=t?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function i1(e,t){let n=`/api/panel-apps/${encodeURIComponent(e)}/content`,r=t?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function a1(e){let t=e.scheme===`nextclaw`&&e.authority===`panel-app`?e.pathSegments[0]:(()=>{let[t,n,r,i]=e.pathSegments;return t===`api`&&n===`panel-apps`&&i===`content`?r:void 0})();if(!t)return null;try{return decodeURIComponent(t)}catch{return null}}function o1(e){let t=V$(e);return t.searchParams.has(`path`)?null:a1(t)}function s1(e){return(e.resourceUri?o1(e.resourceUri):null)??o1(e.currentUrl)}function c1(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}function l1(e){let t=e.icon?.trim();if(t)return c1(t)?{type:`url`,url:t}:{type:`text`,value:t}}function u1(e){return{dedupeKey:`panel-app:${e.appId}`,dockIcon:l1(e),historyPolicy:`managed`,kind:Y$,resourceUri:r1(e.appId),title:e.title,url:e.contentPath}}function d1(e,t){return e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}/`)}function f1(e){let t=e.pathSegments.join(`/`);return Xi(t?`/${t}`:`/`,`docs`)}function p1(e){let t=e.filter(e=>e.trim().length>0).map(e=>encodeURIComponent(decodeURIComponent(e))).join(`/`);return t?`nextclaw://docs/${t}`:`nextclaw://docs`}function m1(e){let t=Fi(e),n=t.startsWith(`/`)?t:(()=>{try{return new URL(e).pathname}catch{return``}})();return n?p1(n.split(`/`)):`nextclaw://docs`}function h1(e){return a1(e)!==null}function g1(e){let t=a1(e);if(!t)return`nextclaw://panel-app`;let n=e.searchParams.get(`path`)?.trim();return i1(t,n)}function _1(e){let t=a1(e);if(!t)return`nextclaw://panel-app`;let n=`nextclaw://panel-app/${encodeURIComponent(t)}`,r=e.searchParams.get(`path`)?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function v1(e,t){let n=V$(e),r=V$(t),i=a1(n),a=a1(r),o=n.searchParams.get(`path`)?.trim()??``,s=r.searchParams.get(`path`)?.trim()??``;return i!==null&&a!==null?i===a&&o===s:e===t}var y1=[{defaultUrl:()=>W$,id:`home`,kind:U$,match:e=>e.raw===W$,resolve:()=>({historyPolicy:`managed`,kind:U$,resourceUri:W$,title:b(`docBrowserHomeTitle`),url:W$}),areEquivalent:(e,t)=>e===t},{defaultUrl:Gi,id:`docs-url`,kind:`docs`,match:e=>zi(e.raw),resolve:e=>{let t=Xi(e.raw,`docs`);return{historyPolicy:`managed`,kind:`docs`,resourceUri:m1(t),title:b(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Fi(e)===Fi(t)},{defaultUrl:Gi,id:`nextclaw-docs`,kind:`docs`,match:e=>e.scheme===`nextclaw`&&e.authority===`docs`,resolve:e=>{let t=f1(e);return{historyPolicy:`managed`,kind:`docs`,resourceUri:p1(e.pathSegments),title:b(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Fi(e)===Fi(t)},{defaultUrl:()=>K$,id:`apps`,kind:G$,match:e=>d1(e.raw,K$),resolve:e=>{let t=n1(e.raw);return{dedupeKey:`apps`,historyPolicy:`managed`,kind:G$,resourceUri:t,title:b(t===`nextclaw://apps`?`appsTitle`:`serviceAppsTitle`),url:t}},areEquivalent:(e,t)=>n1(e)===n1(t)},{defaultUrl:()=>`nextclaw://panel-app`,id:`panel-app`,kind:Y$,match:e=>e.scheme===`nextclaw`&&e.authority===`panel-app`||h1(e),resolve:e=>{let t=g1(e),n=a1(e);return{dedupeKey:n?`panel-app:${e.searchParams.get(`path`)?.trim()||n}`:void 0,historyPolicy:`managed`,kind:Y$,resourceUri:_1(e),title:b(`panelAppsTitle`),url:t}},areEquivalent:v1},{defaultUrl:()=>`about:blank`,id:`content`,kind:`content`,match:()=>!0,resolve:e=>({historyPolicy:`managed`,kind:`content`,resourceUri:e.raw||`about:blank`,title:Bi(e.raw,`content`,`Detail`),url:e.raw||`about:blank`}),areEquivalent:(e,t)=>e===t}],b1=y1.map(e=>({areEquivalent:e.areEquivalent,id:e.id,match:e.match,resolve:e.resolve}));function x1(){return[{id:`apps`,label:b(`appsTitle`),target:{type:`right-panel-resource`,uri:K$}},{id:`service-apps`,label:b(`serviceAppsTitle`),target:{type:`right-panel-resource`,uri:J$}},{id:`docs`,label:b(`docBrowserHelp`),target:{options:{newTab:!0},type:`right-panel-resource`,uri:Gi()}},{id:`skill-marketplace`,label:b(`marketplaceSkillsPageTitle`),target:{path:`/marketplace/skills`,type:`app-route`}}]}var S1={apps:{accentClassName:`bg-emerald-50 text-emerald-700`,hoverAccentClassName:`group-hover:bg-emerald-100`,icon:(0,U.jsx)(Qr,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700`,hoverAccentClassName:`group-hover:bg-sky-100`,icon:(0,U.jsx)(ro,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700`,hoverAccentClassName:`group-hover:bg-amber-100`,icon:(0,U.jsx)(Ei,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700`,hoverAccentClassName:`group-hover:bg-rose-100`,icon:(0,U.jsx)(ua,{className:`h-5 w-5`})}};function C1(e){return S1[e.id]??{accentClassName:`bg-gray-50 text-gray-700`,hoverAccentClassName:`group-hover:bg-gray-100`,icon:(0,U.jsx)(Qr,{className:`h-5 w-5`})}}function w1({open:e}){let t=ce(),n=x1(),r=n=>{if(n.type===`app-route`){t(n.path);return}e(n.uri,n.options)};return(0,U.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5`,children:(0,U.jsx)(`div`,{className:`mx-auto w-full max-w-[520px]`,children:(0,U.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(76px,1fr))] gap-x-2 gap-y-4`,children:n.map(e=>{let t=C1(e);return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.target),className:`group flex min-h-[68px] flex-col items-center gap-1.5 rounded-md px-1.5 py-1.5 text-center focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(`span`,{className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-md transition-colors`,t.accentClassName,t.hoverAccentClassName),children:t.icon}),(0,U.jsx)(`span`,{className:`line-clamp-2 min-w-0 max-w-full text-xs font-medium leading-snug text-gray-700 transition-colors group-hover:text-gray-900`,children:e.label})]},e.id)})})})})}function T1(e){return e&&zi(e)?`docs`:`content`}var E1=class{constructor(){this.resourceUriResolver=new H$(b1,{getNormalizedUri:e=>e.resourceUri??e.url}),this.resolve=e=>this.resourceUriResolver.resolve(e),this.normalize=e=>this.resourceUriResolver.normalize(e),this.areEquivalent=(e,t)=>this.resourceUriResolver.areEquivalent(e,t),this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=this.resolveRouteDefinition(r,n,t),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i.defaultUrl());return i.resolve(V$(a))},this.areUrlsEquivalent=(e,t,n,r)=>n===r?this.resolveRouteDefinition(e,n).areEquivalent?.(e,t)??this.areEquivalent(e,t):!1,this.usesManagedHistory=e=>this.resolveRouteDefinition(e.currentUrl,e.kind).resolve(V$(e.currentUrl)).historyPolicy===`managed`,this.resolveRouteDefinition=(e,t,n)=>{let r=t??(e?void 0:n?.kind),i=r?y1.find(e=>e.kind===r):void 0;if(i)return i;let a=e?V$(e):null,o=a?y1.find(e=>e.match(a)):void 0;if(o)return o;let s=t??n?.kind??T1(e);return y1.find(e=>e.kind===s)??y1[y1.length-1]}}};function D1({appTitle:e,entry:t,onRefresh:n}){let[r,i]=(0,H.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border/70 bg-card px-3.5 py-2 shrink-0`,children:[(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-muted-foreground`,title:e,children:e}),t?(0,U.jsxs)(CF,{open:r,onOpenChange:i,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)($r,{className:`h-3.5 w-3.5`}),label:b(`panelAppsMoreActions`),size:`sm`})}),(0,U.jsx)(EF,{align:`end`,className:`w-48 rounded-xl p-1.5`,children:(0,U.jsx)(NY,{entry:t,onSelect:()=>i(!1)})})]}):null,(0,U.jsx)(V,{icon:(0,U.jsx)(ki,{className:`h-3.5 w-3.5`}),label:b(`panelAppsRefreshCurrent`),onClick:n,size:`sm`})]})}function O1({appTitle:e,currentUrl:t,onRefresh:n,resourceUri:r}){let i=OY(),a=s1({currentUrl:t,resourceUri:r}),o=(0,H.useMemo)(()=>i.data?.entries.find(e=>e.appId===a),[a,i.data?.entries]);return(0,U.jsx)(D1,{appTitle:o?.title??e,entry:o,onRefresh:n})}var k1=G$,A1=Y$,j1=`apps`;function M1(e){return e===`apps`||e===`panel-apps`||e===`service-apps`}function N1(e=j1){return e===`panel-apps`?q$:e===`service-apps`?J$:K$}function P1(e){try{let t=new URL(e).searchParams.get(`tab`);return M1(t)?t:j1}catch{return j1}}function F1(e){e.open(N1(),{kind:k1,title:b(`appsTitle`),dedupeKey:`apps`})}var I1={[U$]:{getTitle:()=>b(`docBrowserHomeTitle`),renderContent:({open:e})=>(0,U.jsx)(w1,{open:e})},[k1]:{getTitle:()=>b(`appsTitle`),renderIcon:()=>(0,U.jsx)(Qr,{className:`w-4 h-4 text-primary shrink-0`}),renderContent:({currentUrl:e,open:t,openTarget:n})=>(0,U.jsx)(L$,{activeTab:P1(e),onActiveTabChange:e=>t(N1(e),{activate:!1,kind:k1,title:b(`appsTitle`),dedupeKey:`apps`}),onOpenPanelApp:e=>n(u1(e))})},[A1]:{getIframeSandbox:()=>EX,getTitle:e=>e.title||b(`panelAppsTitle`),onIframeMessage:e=>A9().panelAppBridgeManager.handleIframeMessage(e),onIframePointerOver:e=>DX(e.currentTarget),renderIcon:()=>(0,U.jsx)(fi,{className:`w-4 h-4 text-primary shrink-0`}),renderToolbar:({refreshIframe:e,tab:t})=>(0,U.jsx)(O1,{appTitle:t.title||b(`panelAppsTitle`),currentUrl:t.currentUrl,onRefresh:e,resourceUri:t.resourceUri}),supportsScrollRestoration:!0}};function L1(){let{appId:e=``}=le(),t=N9(),n=Ui(),r=OY(),i=(0,H.useRef)(null),a=(0,H.useMemo)(()=>r.data?.entries.find(t=>t.appId===e),[e,r.data?.entries]),o=TX(a),s=_i({currentUrl:a?.contentPath??null,iframeRef:i,isEnabled:!!a,restorationKey:a?`panel-app:main:${a.appId}`:null});return(0,H.useEffect)(()=>{let e=e=>{t.panelAppBridgeManager.handleIframeMessage({event:e,iframe:i.current})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[t]),r.isLoading?(0,U.jsx)(R1,{message:b(`panelAppsLoading`)}):r.isError?(0,U.jsx)(R1,{message:r.error instanceof Error?r.error.message:b(`panelAppsLoadFailed`),actionLabel:b(`panelAppsTryAgain`),onAction:()=>void r.refetch()}):a?o.state===`checking`||o.state===`idle`?(0,U.jsx)(R1,{message:b(`panelAppsCheckingPermission`)}):o.state===`denied`||o.state===`error`?(0,U.jsx)(R1,{message:o.state===`denied`?b(`panelAppsPermissionDenied`):b(`panelAppsPermissionFailed`),actionLabel:b(`panelAppsTryAgain`),onAction:()=>void o.retryClientGrant()}):(0,U.jsx)(`div`,{className:`h-full min-h-0 bg-background`,children:(0,U.jsx)(`iframe`,{ref:i,src:a.contentPath,title:a.title,sandbox:EX,className:`block h-full w-full border-0 bg-background`,onLoad:s,onPointerOver:e=>DX(e.currentTarget)},a.appId)}):(0,U.jsx)(R1,{message:b(`panelAppsMainUnavailable`),actionLabel:b(`panelAppsOpenApps`),onAction:()=>F1(n)})}function R1({actionLabel:e,message:t,onAction:n}){return(0,U.jsx)(`div`,{className:`flex h-full min-h-0 items-center justify-center bg-background px-6 text-center`,children:(0,U.jsxs)(`div`,{className:`max-w-sm`,children:[(0,U.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:n?(0,U.jsx)(Xo,{className:`h-5 w-5`}):(0,U.jsx)(Qr,{className:`h-5 w-5`})}),(0,U.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:t}),e&&n?(0,U.jsx)(`button`,{type:`button`,className:`mt-4 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:n,children:e}):null]})})}var z1=class{constructor(e){this.authorizationManager=e,this.handleIframeMessage=({event:e,iframe:t})=>{this.isBridgeRequest(e.data)&&(!t?.contentWindow||e.source!==t.contentWindow||this.handleBridgeRequest({event:e,iframe:t},e.data))},this.handleBridgeRequest=async(e,t)=>{try{let n=this.getBridgeContext(t),r=await this.dispatchRequest(n,t);this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!0,data:r})}catch(n){this.postResponse(e,{type:`nextclaw:panel-app-service-actions:response`,requestId:t.requestId,ok:!1,error:this.toBridgeError(n)})}},this.dispatchRequest=async(e,t)=>{switch(t.method){case`list`:return await F.serviceApps.listServiceActions({bridgeSessionToken:e.token});case`requestGrant`:return await this.confirmAndGrant(e,this.requireActionId(t));case`revokeGrant`:return await F.serviceApps.revokeServiceAction(this.requireActionId(t),{bridgeSessionToken:e.token});case`invoke`:return await this.invokeWithAuthorization(e,t);case`agent.send`:return await this.sendAgentMessageWithAuthorization(e,t);case`agent.generateObject`:return await this.generateAgentObjectWithAuthorization(e,t);default:throw Error(`Unsupported panel bridge method: ${String(t.method)}`)}},this.invokeWithAuthorization=async(e,t)=>{let n=this.requireActionId(t);try{return await F.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}catch(r){if(!(r instanceof rn)||r.code!==`AUTHORIZATION_REQUIRED`)throw r;return await this.confirmAndGrant(e,n,this.readOptionalRecord(t.payload?.input)),await F.serviceApps.invokeServiceAction(n,this.readOptionalRecord(t.payload?.input),{bridgeSessionToken:e.token})}},this.sendAgentMessageWithAuthorization=async(e,t)=>{try{return await F.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof rn)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:send`),await F.panelApps.sendAgentMessage(this.readAgentSendRequest(t),{bridgeSessionToken:e.token})}},this.generateAgentObjectWithAuthorization=async(e,t)=>{try{return await F.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}catch(n){if(!(n instanceof rn)||n.code!==`AUTHORIZATION_REQUIRED`)throw n;return await this.confirmAndGrantAgentCapability(e,`agent:generateObject`),await F.panelApps.generateAgentObject(this.readGenerateObjectRequest(t),{bridgeSessionToken:e.token})}},this.confirmAndGrantAgentCapability=async(e,t)=>{if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:t,actionTitle:t===`agent:send`?`Send agent message`:`Generate object`,actionDescription:t===`agent:send`?`Send a message to a NextClaw Agent session.`:`Send context to a NextClaw Agent session and receive a structured object.`,risk:`write`}]}))throw new rn({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});return await F.panelApps.grantAgentCapability(t,{bridgeSessionToken:e.token})},this.confirmAndGrant=async(e,t,n)=>{let r=await this.listGrantCandidateActions(e,t);if(!await this.authorizationManager.requestAuthorization({panelAppId:e.appId,actions:r.map(e=>({actionId:e.id,actionTitle:e.title,actionDescription:e.description,risk:e.risk})),inputPreview:this.createInputPreview(n)}))throw new rn({code:`AUTHORIZATION_REJECTED`,message:`Permission rejected for ${t}.`});let i=await F.serviceApps.grantServiceActions(r.map(e=>e.id),{bridgeSessionToken:e.token}),a=i.grants.find(e=>e.actionId===t)??i.grants[0];if(!a)throw Error(`No permission grant returned for ${t}.`);return a},this.listGrantCandidateActions=async(e,t)=>{let n=await F.serviceApps.listServiceActions({bridgeSessionToken:e.token}),r=n.actions.find(e=>e.id===t);if(r&&r.grantState!==`not-granted`)return[r];let i=n.actions.filter(e=>e.grantState===`not-granted`),a=[...i.filter(e=>e.id===t),...i.filter(e=>e.id!==t)];return a.length>0?a:[{appId:r?.appId??t.split(`.`)[0]??t,description:r?.description,id:t,name:r?.name??t,risk:r?.risk??`dangerous`,title:r?.title}]},this.createInputPreview=e=>{if(!(!e||Object.keys(e).length===0))try{let t=JSON.stringify(e,null,2);return t.length>500?`${t.slice(0,500)}...`:t}catch{return`[unserializable input]`}},this.getBridgeContext=e=>({appId:e.appId,token:e.runtimeToken}),this.requireActionId=e=>{let t=e.payload?.actionId?.trim();if(!t)throw Error(`Panel bridge actionId is required.`);return t},this.readOptionalRecord=e=>{if(e!==void 0)return this.requireRecord(e,`input`)},this.readAgentSendRequest=e=>({payload:this.requireRecord(e.payload?.request,`agent.send request`)}),this.readGenerateObjectRequest=e=>({input:this.requireRecord(e.payload?.input,`generateObject input`)}),this.requireRecord=(e,t)=>{if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`${t} is required.`);return e},this.postResponse=(e,t)=>{e.iframe?.contentWindow?.postMessage(t,`*`)},this.toBridgeError=e=>e instanceof rn?{code:e.code,message:e.message,details:e.details}:{message:e instanceof Error?e.message:String(e)},this.isBridgeRequest=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return t.type===`nextclaw:panel-app-service-actions:request`&&typeof t.requestId==`string`&&typeof t.runtimeToken==`string`&&typeof t.appId==`string`&&(t.method===`invoke`||t.method===`agent.send`||t.method===`agent.generateObject`||t.method===`list`||t.method===`requestGrant`||t.method===`revokeGrant`)}}};function B1(e,t){let n=t.trim();return[e.id,e.appId,e.fileName,e.title].some(e=>e.trim()===n)}function V1(e,t){let n=t.trim();return n?e.find(e=>B1(e,n))??null:null}function H1(e,t){return i1(e,t)}function U1(e){return`${e}${e.includes(`?`)?`&`:`?`}${new URLSearchParams({[T.displayModeSearchParam]:T.displayMode,[T.placementSearchParam]:T.placement}).toString()}`}function W1(e){if(!e||typeof e!=`object`)return null;let t=e;return t.type===T.contentHeightMessageType&&typeof t.height==`number`&&Number.isFinite(t.height)&&t.height>0?Math.ceil(t.height):null}function G1(e){let{appId:t,params:n,path:r,title:i,url:a}=e;return{contentParams:n,currentUrl:a,dedupeKey:`panel-app:${r??t}`,history:[a],historyIndex:0,id:`inline-panel-app:${r??t}`,kind:Y$,navVersion:0,resourceUri:r1(t,r),title:i}}function K1({panelApp:e,showExpandAction:t=!0}){let n=Ui(),r=(0,H.useRef)(null),i=(0,H.useId)(),[a,o]=(0,H.useState)(null),s=OY(),c=(0,H.useMemo)(()=>e.path?void 0:V1(s.data?.entries??[],e.appId),[e.appId,e.path,s.data?.entries]),l=c?u1(c):null,u=e.title??l?.title??e.appId,d=e.path?H1(e.appId,e.path):s.isLoading?``:l?.url??H1(e.appId),f=(0,H.useMemo)(()=>d?U1(d):``,[d]),p=(0,H.useMemo)(()=>G1({appId:c?.id??e.appId,params:e.params,path:e.path,title:u,url:d}),[c?.id,e.appId,e.params,e.path,u,d]),m=g(e.params),h=`${p.id}:${p.navVersion}:${i}:${m??``}`;return(0,H.useEffect)(()=>{if(!d)return;let e=e=>{if(e.source!==r.current?.contentWindow)return;let t=W1(e.data);if(t!==null){o(t);return}A9().panelAppBridgeManager.handleIframeMessage({event:e,iframe:r.current})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[d]),d?(0,U.jsx)(yY,{actions:t?(0,U.jsx)(V,{size:`sm`,icon:(0,U.jsx)(So,{className:`h-3.5 w-3.5`}),label:b(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>{if(l){n.openTarget({...l,contentParams:e.params});return}n.open(d,{dedupeKey:p.dedupeKey,kind:p.kind,contentParams:e.params,title:u})}}):void 0,contentHeight:a,children:(0,U.jsx)(`iframe`,{ref:r,src:f,name:m,title:u,sandbox:EX,tabIndex:0,onPointerOver:()=>DX(r.current),className:`h-full w-full border-0 bg-card`},h)}):(0,U.jsx)(yY,{isLoading:!0,children:(0,U.jsx)(`span`,{className:`sr-only`,children:u})})}function q1({checkpoint:e,inline:t=!1}){let n=!e||e.status===`compressing`,r=e?.status===`failed`,i=e?.status===`cancelled`,a=e?[`${b(`chatContextCompactionCoveredMessages`)}: ${e.coveredSessionMessageCount}`,`${b(`chatContextCompactionOriginalTokens`)}: ${e.originalEstimatedTokens}`,`${b(`chatContextCompactionProjectedTokens`)}: ${e.projectedEstimatedTokens}`].join(`
|
|
103
|
+
`):void 0;return(0,U.jsxs)(`div`,{"data-context-compaction-placement":t?`assistant`:`timeline`,className:t?`my-3 flex items-center gap-3 text-[11px] text-muted-foreground`:`my-4 flex items-center gap-3 text-[11px] text-muted-foreground`,"aria-live":`polite`,title:a,children:[(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-border bg-muted px-3 py-1`,children:[n?(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground`}):(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/45`}),(0,U.jsx)(`span`,{children:b(n?`chatContextCompactionCompressing`:i?`chatContextCompactionCancelled`:r?`chatContextCompactionFailed`:`chatContextCompactionCompressed`)})]}),(0,U.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function J1({inheritance:e}){return(0,U.jsxs)(`div`,{className:`my-4 flex items-center gap-3 text-[11px] text-emerald-700`,title:[`${b(`chatContextInheritanceSourceSession`)}: ${e.sourceSessionId}`,`${b(`chatContextInheritanceMessages`)}: ${e.inheritedMessageCount}`].join(`
|
|
104
|
+
`),children:[(0,U.jsx)(`div`,{className:`h-px flex-1 bg-emerald-100`}),(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1`,children:[(0,U.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-400`}),(0,U.jsx)(`span`,{children:b(`chatContextInheritanceInherited`)})]}),(0,U.jsx)(`div`,{className:`h-px flex-1 bg-emerald-100`})]})}var Y1=`nextclaw.chat.message-layout`,X1=1,Z1=`flat`;function Q1(e){if(!e||typeof e!=`object`)return Z1;let{layout:t}=e;return t===`flat`||t===`card`?t:Z1}var $1=P()(Mi(e=>({layout:Z1,setLayout:t=>e({layout:t})}),{name:Y1,version:X1,storage:Ni(()=>window.localStorage),partialize:e=>({layout:e.layout}),merge:(e,t)=>({...t,layout:Q1(e)})}));function e0(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function t0(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function n0(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var r0=(e,t)=>Math.abs(e-t)<1.01,i0=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},a0,o0=()=>{if(a0!==void 0)return a0;if(typeof navigator>`u`)return a0=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return a0=!0;let e=navigator.maxTouchPoints;return a0=navigator.platform===`MacIntel`&&e!==void 0&&e>0},s0=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},c0=e=>e,l0=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},u0=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(s0(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(s0(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},d0={passive:!0},f0=typeof window>`u`?!0:`onscrollend`in window,p0=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&f0,o=0,s=a?null:i0(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,d0),a&&r.addEventListener(`scrollend`,u,d0),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},m0=(e,t)=>p0(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),h0=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},g0=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},_0=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:c0,rangeExtractor:l0,onChange:()=>{},measureElement:h0,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=t0(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!o0()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,d0),e.addEventListener(`touchend`,n,d0),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(o0()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=t0(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.getMeasurements=t0(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let l=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&u>0&&e.set(a.subarray(0,u*2)),a=e,this._flatMeasurements=a}let o;if(u===0)o=t+n;else{let e=u-1;o=a[e*2]+a[e*2+1]+s}for(let t=u;t<e;t++){let e=r(t),n=l.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=e0(e,a,r);return this.measurementsCache=c,c}let d=this.measurementsCache.slice(0,u),f=Array(a).fill(void 0),p=new Float64Array(a),m=0;for(let e=0;e<u;e++){let t=d[e];t&&(f[t.lane]===void 0&&m++,f[t.lane]=e,p[t.lane]=t.end)}for(let i=u;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),u,h,g=o===`estimate`||l.has(e);if(c!==void 0&&this.options.lanes>1){u=c;let e=f[u],r=e===void 0?void 0:d[e];h=r?r.end+s:t+n}else if(m===a){let e=0,t=p[0],n=f[0];for(let r=1;r<a;r++){let i=p[r];(i<t||i===t&&f[r]<n)&&(e=r,t=i,n=f[r])}u=e,h=t+s,g&&this.laneAssignments.set(i,u)}else u=i%this.options.lanes,h=t+n,g&&this.laneAssignments.set(i,u);let _=l.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),y=h+v;d[i]={index:i,start:h,size:v,end:y,key:e,lane:u},f[u]===void 0&&m++,f[u]=i,p[u]=y}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=t0(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=b0(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=t0(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=t0(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return n0(t[v0(0,t.length-1,r?e=>n[e*2]:e=>n0(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t);this.scrollState={index:null,align:t,behavior:n,startedAt:this.now(),lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e;this.scrollState={index:null,align:`start`,behavior:t,startedAt:this.now(),lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&(o0()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&r0(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},v0=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function y0(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function b0(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=y0(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=v0(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var x0=typeof document<`u`?H.useLayoutEffect:H.useEffect;function S0({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=H.useReducer(e=>e+1,0)[1],a=H.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,Dy.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=H.useState(()=>{let e=new _0(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),x0(()=>c._didMount(),[]),x0(()=>c._willUpdate()),x0(()=>{o(c)}),c}function C0(e){return S0({observeElementRect:u0,observeElementOffset:m0,scrollToFn:g0,...e})}var w0=180;function T0(e){let{activeRowKey:t,focusedRowKey:n,rows:r,scrollRef:i}=e,a=(0,H.useMemo)(()=>r.flatMap((e,r)=>e.key===t||e.key===n?[r]:[]),[t,n,r]),o=(0,H.useCallback)(e=>[...new Set([...l0(e),...a])].sort((e,t)=>e-t),[a]),s=(0,H.useRef)(null),c=C0({anchorTo:`end`,count:r.length,directDomUpdates:!0,estimateSize:()=>w0,getItemKey:e=>r[e]?.key??e,getScrollElement:()=>i.current,initialOffset:()=>r.length*w0,initialRect:{width:0,height:800},overscan:8,rangeExtractor:o,scrollToFn:(e,t,n)=>{let r=s.current;r&&(r.style.height=`${n.getTotalSize()}px`),g0(e,t,n)}});return c.shouldAdjustScrollPositionOnItemSizeChange=e=>e.end<=(c.scrollOffset??0),{containerRef:(0,H.useCallback)(e=>{s.current=e,c.containerRef(e)},[c]),virtualizer:c}}function E0(e,t){if(t.length===0)return e;let n=e[e.length-1];return n?.type===`text`?[...e.slice(0,-1),{...n,text:n.text+t}]:[...e,{type:`text`,text:t}]}function D0(e){return e?.type===`token`&&!!JU(e)}function O0(e){let{index:t,nodes:n,tokenText:r}=e,i=n[t-1],a=n[t+1],o=i?.type===`text`&&/\S$/.test(i.text)||D0(i),s=a?.type===`text`&&/^\S/.test(a.text)||D0(a);return`${o?` `:``}${r}${s?` `:``}`}function k0(e){return xc(e)}function A0(e){return wc(e)}function j0(e){return Tc(e,`skill`)}function M0(e){return Tc(e,`file`)}function N0(e,t,n){let r=new Set(t),i=Mc(e,e=>e.tokenKind===`skill`&&!r.has(e.tokenKey)),a=Tc(i,`skill`),o=new Map(n.map(e=>[e.ref,e])),s=t.filter(e=>!a.includes(e)).map(e=>vc({tokenKind:`skill`,tokenKey:e,label:o.get(e)?.name||e}));return s.length===0?i:Sc([...i,...s])}function P0(e,t){let n=new Set(M0(e));return t.filter(e=>n.has(e.id))}function F0(e,t){let n=new Map(t.map(e=>[e.id,e])),r=[];for(let[t,i]of e.entries()){if(i.type===`text`){r=E0(r,i.text);continue}let a=JU(i);if(a){r=E0(r,O0({index:t,nodes:e,tokenText:a}));continue}if(i.tokenKind!==`file`)continue;let o=n.get(i.tokenKey);o&&r.push({type:`file`,name:o.name,mimeType:o.mimeType,...o.assetUri?{assetUri:o.assetUri}:{},...o.url?{url:o.url}:{},...o.contentBase64?{contentBase64:o.contentBase64}:{},sizeBytes:o.sizeBytes})}return r}function I0(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function L0(e,t){return e?Object.fromEntries(t.map(t=>[t,e])):{}}function R0(e){let t=pI(e.projectRoot),n={...L0(e.model?.trim(),[`model`,`preferred_model`]),...L0(e.thinkingLevel?.trim(),[`thinkingEffort`,`thinking`,`preferred_thinking`]),...L0(e.sessionType?.trim(),[`agentRuntimeId`,`session_type`,`runtime`]),...L0(e.agentId?.trim(),[`agentId`,`agent_id`]),...L0(t??void 0,[`projectRoot`,`project_root`])},r=I0(e.requestedSkills);r.length>0&&(n.requested_skill_refs=r);let i=e.composerNodes?eW(e.composerNodes,e.skillRecords):[];return i.length>0&&(n[_]=xW(i)),e.sessionMaterialization&&(n[m]=e.sessionMaterialization),n}function z0(e){return e.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function B0({disabled:e,messageId:t,onCancel:n,onChange:r,onSave:i,snapshot:a}){let o=(0,H.useRef)(null),s=(0,H.useRef)([...a.nodes]),c=F0([...a.nodes],a.attachments),l=(0,H.useCallback)(e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return(0,H.useLayoutEffect)(()=>{o.current?.focusComposerAtEnd(s.current)},[t]),(0,U.jsxs)(`div`,{className:`w-full min-w-[min(32rem,76vw)] overflow-hidden rounded-xl border border-border bg-card shadow-sm`,onKeyDownCapture:l,children:[(0,U.jsx)(_x,{ref:o,actions:{canStopGeneration:!1,isSending:e,onSend:i,onStop:()=>void 0},disabled:e,nodes:[...a.nodes],onNodesChange:e=>{let t=[...e];r({...a,attachments:P0(t,a.attachments),nodes:t,selectedSkills:j0(t),text:A0(t)})},placeholder:b(`chatEditMessagePlaceholder`)},t),(0,U.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border/70 px-3 py-2`,children:[(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,disabled:e,onClick:n,children:b(`chatEditMessageCancel`)}),(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg bg-foreground px-3 py-1.5 text-xs font-medium text-background transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-40`,disabled:e||!z0(c),onClick:()=>void i(),children:b(`chatEditMessageSubmit`)})]})]})}function V0(e){let t=ZK(e.messages),n=t.findLast(e=>e.role===`user`),r=t.at(-1);return{continuationAssistantMessageId:e.canContinue&&r?.role===`assistant`?r.id:null,editableUserMessageId:e.isBusy?null:n?.id??null}}function H0(e,t){let n=[],r=0;for(;r<e.length;){let i=t.flatMap(t=>{let n=e.indexOf(t.rawText,r);return n<0?[]:[{index:n,token:t}]}).sort((e,t)=>e.index-t.index||t.token.rawText.length-e.token.rawText.length)[0];if(!i)return n.push(_c(e.slice(r))),n;i.index>r&&n.push(_c(e.slice(r,i.index))),n.push(vc({tokenKind:i.token.kind,tokenKey:`ref`in i.token?i.token.ref:i.token.key,label:i.token.label,data:i.token.kind===`system_object`&&`reference`in i.token?{reference:i.token.reference}:void 0})),r=i.index+i.token.rawText.length}return n}function U0(e){let t=e.requested_skill_refs;return I0(Array.isArray(t)?t.filter(e=>typeof e==`string`):void 0)}function W0(e){let{attachmentIdPrefix:t,availableSkills:n,message:r}=e,i=e.metadata??r.metadata??{},a=gW(i),o=[],s=[];r.parts.forEach((e,n)=>{if(e.type===`text`||e.type===`rich-text`||e.type===`reasoning`){o.push(...H0(e.text,hW(e.text,a)));return}if(e.type!==`file`)return;let r=`${t}-${n}`,i={id:r,name:e.name??`attachment`,mimeType:e.mimeType??`application/octet-stream`,sizeBytes:e.sizeBytes??0,assetUri:e.assetUri,url:e.url,contentBase64:e.contentBase64};s.push(i),o.push(vc({tokenKind:`file`,tokenKey:r,label:i.name,previewUrl:i.mimeType.startsWith(`image/`)?i.url:void 0}))});let c=Sc(o),l=U0(i),u=new Map(n.map(({ref:e,name:t})=>[e,t]));return{text:A0(c),nodes:c,selectedSkills:l,skillRecords:l.map(e=>({ref:e,name:u.get(e)??e})),attachments:s}}function G0(){return`edited-message-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function K0(e){return e.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function q0(e,t){let n={...e.metadata};delete n.requested_skill_refs,delete n[_];let r=gW(e.metadata).flatMap(e=>e.kind===`skill`&&`ref`in e&&e.source&&e.path?[{name:e.name,path:e.path,ref:e.ref,source:e.source}]:[]);return Object.assign(n,R0({composerNodes:[...t.nodes],requestedSkills:[...t.selectedSkills],skillRecords:r})),Object.keys(n).length>0?n:void 0}function J0({adaptedMessages:e,canContinue:t,disabled:n,onContinueRun:r,onEditMessage:i,rawMessages:a}){let o=(0,H.useMemo)(()=>V0({canContinue:t,isBusy:n,messages:a}),[t,n,a]),s=(0,H.useMemo)(()=>e.map(e=>{let t=[];return i&&e.id===o.editableUserMessageId&&t.push({disabled:n,icon:`edit`,key:`edit-message`,label:b(`chatEditMessage`)}),r&&e.id===o.continuationAssistantMessageId&&t.push({disabled:n,icon:`continue`,key:`continue-run`,label:b(`chatContinueRun`)}),t.length>0?{...e,actions:t}:e}),[o,e,n,r,i]),[c,l]=(0,H.useState)(null),u=(0,H.useCallback)((e,t)=>{if(t.key===`continue-run`){Promise.resolve(r?.()).catch(()=>void 0);return}if(t.key!==`edit-message`||!i)return;let n=a.find(t=>t.id===e.id);n&&l({message:n,snapshot:W0({attachmentIdPrefix:`edited-attachment-${n.id}`,availableSkills:[],message:n})})},[r,i,a]),d=(0,H.useCallback)(async()=>{if(!c||!i)return;let e=F0([...c.snapshot.nodes],c.snapshot.attachments);K0(e)&&(await i({messageId:c.message.id,message:{...c.message,id:G0(),metadata:q0(c.message,c.snapshot),parts:e,role:`user`,status:`final`,timestamp:new Date().toISOString()}}),l(null))},[c,i]);return{handleMessageAction:u,messages:s,renderMessageContent:(0,H.useCallback)(e=>c?.message.id===e.id?(0,U.jsx)(B0,{disabled:n,messageId:c.message.id,onCancel:()=>l(null),onChange:e=>l(t=>t?{...t,snapshot:e}:null),onSave:d,snapshot:c.snapshot}):void 0,[n,c,d])}}function Y0(e){let{selectedSession:t,sessionKey:n}=e,r=eI(),i=N9(),a=t?.projectRoot??t?.workingDir,o=(0,H.useCallback)(e=>{if(e.kind===`ui_resource`&&`key`in e){i.docBrowserManager.open(e.key);return}if(e.kind===`panel_app`&&`key`in e){r.chatUiManager.showContent({target:{type:`panel_app`,payload:{appId:e.key}}});return}if(`key`in e&&(e.kind===`project`||e.kind===`workspace_file`||e.kind===`workspace_directory`)){let t=e.kind===`project`?e.key:cW({projectRoot:a,relativePath:e.key});t&&r.chatThreadManager.openFilePreview({path:t,label:e.label,viewMode:`preview`});return}if(e.kind===`workspace_excerpt`&&`excerpt`in e){let t=cW({projectRoot:a,relativePath:e.path});t&&r.chatThreadManager.openFilePreview({path:t,label:e.label,line:e.startLine??void 0,viewMode:`preview`});return}if(e.kind!==`skill`||!(`ref`in e))return;let o=e.path?.trim();if(o){r.chatThreadManager.openFilePreview({path:o,label:e.label||e.name,viewMode:`preview`,previewViewer:`rendered`});return}if(!n){I.error(b(`chatSkillPreviewUnavailable`));return}Ne(n,{projectRoot:t?.projectRoot??null}).then(({records:t})=>{let n=t.find(t=>t.ref===e.ref),i=t.filter(t=>t.name===e.name),a=n??(i.length===1?i[0]:null),o=a?.path.trim();if(!a||!o){I.error(b(`chatSkillPreviewUnavailable`));return}r.chatThreadManager.openFilePreview({path:o,label:e.label||a.name,viewMode:`preview`,previewViewer:`rendered`})}).catch(()=>I.error(b(`chatSkillPreviewUnavailable`)))},[i.docBrowserManager,r,a,t?.projectRoot,n]);return{handleAttachmentOpen:(0,H.useCallback)(e=>{let t=e.dataUrl?.trim();if(!t)return;let n=e.label.trim()||`attachment`;r.chatThreadManager.openFilePreview({path:n,label:n,viewMode:`preview`,contentUrl:t,mimeType:e.mimeType})},[r]),handleInlineTokenClick:o}}function X0({event:e}){let{language:t}=Gn(),n=VK(e.payload);return(0,U.jsxs)(`details`,{"aria-label":b(`chatObservationEventLabel`,t),"data-testid":`chat-observation-event`,className:`group my-3 min-w-0 text-[11px] text-muted-foreground`,children:[(0,U.jsxs)(`summary`,{"aria-label":`${b(`chatObservationEventLabel`,t)}: ${e.eventType}. ${b(`chatObservationEventShowDetails`,t)}`,className:`flex cursor-pointer list-none items-center gap-3 rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 [&::-webkit-details-marker]:hidden`,children:[(0,U.jsx)(`span`,{className:`h-px min-w-4 flex-1 bg-border/70`}),(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-[min(80%,32rem)] items-center gap-1.5 px-1 text-xs text-muted-foreground transition-colors hover:text-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50`}),(0,U.jsx)(`span`,{className:`shrink-0`,children:b(`chatObservationEventLabel`,t)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/60`,children:`·`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:e.eventType}),(0,U.jsx)(or,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`,"aria-hidden":`true`})]}),(0,U.jsx)(`span`,{className:`h-px min-w-4 flex-1 bg-border/70`})]}),(0,U.jsxs)(`div`,{className:`mx-auto mt-3 max-w-2xl overflow-hidden rounded-xl border border-border/70 bg-card shadow-sm`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-b border-border/60 bg-muted/35 px-3 py-2`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/55`}),(0,U.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-foreground/85`,children:b(`chatObservationEventDetailsTitle`,t)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/50`,children:`·`}),(0,U.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-foreground`,children:e.eventType})]}),(0,U.jsxs)(`dl`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] gap-x-4 gap-y-2 px-3 py-3 text-xs`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`chatObservationEventExtension`,t)}),(0,U.jsx)(`dd`,{className:`min-w-0 truncate text-foreground/80`,children:e.extensionId}),(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`chatObservationEventId`,t)}),(0,U.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[11px] text-foreground/75`,children:e.eventId}),(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`chatObservationEventTime`,t)}),(0,U.jsx)(`dd`,{className:`text-foreground/80`,children:(0,U.jsx)(`time`,{dateTime:e.occurredAt,children:M(e.occurredAt,t)})})]}),(0,U.jsxs)(`div`,{className:`border-t border-border/60 px-3 py-3`,children:[(0,U.jsx)(`div`,{className:`mb-1.5 text-[11px] font-medium text-muted-foreground`,children:b(`chatObservationEventPayloadLabel`,t)}),(0,U.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-muted/55 px-3 py-2.5 text-[11px] leading-5 text-muted-foreground`,children:n||b(`chatObservationEventPayloadEmpty`,t)})]})]})]})}var Z0=new class{constructor(){this.cache=new WeakMap,this.adapt=e=>{let{continuationRunning:t,executionLabels:n,triggerLabels:r,language:i,processedLabel:a,rawMessages:o,texts:s}=e;return ZK(o,{continuationRunning:t}).map(e=>{let t=Cq({message:e,processedLabel:a,formatDeferredToolSummary:(e,t)=>{let n=b(`chatProcessSummaryToolCalls`,i).replace(`{count}`,E(e,i));if(t.length===0)return n;let r=i===`zh`?`、`:`, `;return`${n} · ${t.join(r)}`}}),o=t?.label??null,c=Dq({message:e,labels:n}),l=c?.cacheKey??null,u=jq({message:e,labels:r}),d=u?JSON.stringify({runTrigger:e.metadata?.run_trigger,runSpec:e.metadata?.run_spec,aiExecution:e.metadata?.ai_execution}):null,f=Oq(c?.moreActions,u),p=this.cache.get(e);if(p&&p.language===i&&p.processSummaryLabel===o&&p.executionPresentationKey===l&&p.triggerDetailsKey===d)return p.viewModel;let m=GI(e),h=gq({id:m.id,role:m.role,meta:{timestamp:m.meta?.timestamp,status:m.meta?.status,inlineTokens:gW(e.metadata),processSummary:t,executionSummaryLabel:c?.summaryLabel,moreActions:f},parts:UI(e.parts)},{formatTimestamp:e=>M(e,i),texts:s});return this.cache.set(e,{language:i,processSummaryLabel:o,executionPresentationKey:l,triggerDetailsKey:d,viewModel:h}),h})}}};function Q0(e){if(e.target.type===`panel_app`)return(0,U.jsx)(K1,{panelApp:{appId:e.target.payload.appId,params:e.target.payload.params,path:e.target.payload.path,title:e.title}})}var $0=e=>(0,U.jsx)(dz,{agentId:e,className:`h-4 w-4 shrink-0`}),e2=e=>(0,U.jsx)(K1,{panelApp:e}),t2=8e3;function n2(e){let t=e.commonAncestorContainer;return(t instanceof Element?t:t.parentElement)?.closest(`[data-chat-message-selectable="true"]`)??null}function r2(e,t){return e.kind===`typing`||e.key===t}function i2({canContinue:e=!1,messages:t,messageDetailStates:n,isSending:r,messageActionsDisabled:i=!1,onContinueRun:a,onEditMessage:o,onLoadMessageDetails:s,scrollRef:c,sessionKey:l,className:d}){let f=eI(),{language:p}=Gn(),m=$1(e=>e.layout),h=yR(l),g=aL(e=>e.snapshot.selectedAgentId),_=eR(e=>e.snapshot.sessionTypesQuery?.data??null),v=EL(h?.sessionType??_?.defaultType),y=v!==`native`||(h?.agentId??g).trim().toLowerCase()!==`main`,x=kL(_?.options??[]).find(e=>e.value===v),S=x?.icon?.src?.trim()?(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:x.icon.src,alt:x.icon.alt??null,name:x.label},className:`h-[65%] w-[65%]`}):void 0,C=h?.workingDir??h?.projectRoot??null,w=(0,H.useCallback)(e=>{let t=Q0(e);if(t)return t;if(e.target.type===`file`)return(0,U.jsx)(bY,{display:e,parentSessionKey:l,sessionProjectRoot:h?.projectRoot??null,sessionWorkingDir:C,onFileOpen:f.chatThreadManager.openFilePreview})},[C,f.chatThreadManager,h?.projectRoot,l]),T=(0,H.useCallback)(e=>ln(e.path,C),[C]),E=(0,H.useMemo)(()=>Mq(p),[p]),D=(0,H.useMemo)(()=>Pq(p),[p]),O=(0,H.useMemo)(()=>Fq(p),[p]),{handleMessageAction:k,messages:A,renderMessageContent:j}=J0({adaptedMessages:(0,H.useMemo)(()=>Z0.adapt({continuationRunning:r,executionLabels:D,triggerLabels:O,language:p,processedLabel:b(`chatProcessSummaryProcessed`),rawMessages:t,texts:E}),[D,r,p,t,E,O]),canContinue:e,disabled:i,onContinueRun:a,onEditMessage:o,rawMessages:t}),M=A.findLast(e=>e.role===`assistant`&&(e.status===`streaming`||e.status===`pending`)),N=!!M,P=(0,H.useMemo)(()=>Iq(p),[p]),ee=(0,H.useCallback)(({range:e})=>!!n2(e),[]),te=(0,H.useCallback)(({range:e,text:t})=>{let n=n2(e),r=n?.dataset.chatMessageId?.trim(),i=n?.dataset.chatMessageRole,a=n?.dataset.chatMessageRoleLabel?.trim();!r||!a||i!==`assistant`&&i!==`user`||f.chatComposerIntentManager.requestConversationExcerptReference({targetSessionKey:l,messageId:r,role:i,label:a,excerpt:t})},[f.chatComposerIntentManager,l]),ne=(0,H.useMemo)(()=>eq({rawMessages:t,messages:A}),[A,t]),re=(0,H.useMemo)(()=>r&&!N?[...ne,{kind:`typing`,key:`typing`}]:ne,[N,r,ne]),[ie,ae]=(0,H.useState)(null),oe=M?`message:${M.id}`:null,{containerRef:se,virtualizer:ce}=T0({rows:re,scrollRef:c,activeRowKey:oe,focusedRowKey:ie}),{handleAttachmentOpen:le,handleInlineTokenClick:ue}=Y0({selectedSession:h,sessionKey:l}),de=(0,H.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||ae(null)},[]),fe=(0,H.useCallback)(e=>{if(LK(e.customType)){let t=BK(e.data);return t?(0,U.jsx)(X0,{event:t}):void 0}if(e.customType!==`nextclaw.context-compaction`)return;let t=e.data;return(0,U.jsx)(q1,{checkpoint:t.checkpoint,inline:!0})},[]);return(0,U.jsx)(_F,{actionLabel:P.addSelectionToChatLabel??b(`chatWorkspaceAddToChat`),isSelectionAllowed:ee,maxCharacters:t2,onAddToChat:te,selectionTooLongLabel:P.selectionTooLongLabel??b(`chatWorkspaceExcerptSelectionTooLong`),children:(0,U.jsx)(`div`,{className:u(`relative`,d),ref:se,children:ce.getVirtualItems().map(e=>{let t=re[e.index];return t?(0,U.jsx)(`div`,{"data-index":e.index,ref:ce.measureElement,onBlurCapture:de,onFocusCapture:()=>ae(t.key),className:`absolute left-0 top-0 w-full`,children:t.kind===`compaction`?(0,U.jsx)(q1,{checkpoint:t.checkpoint}):t.kind===`context-inheritance`?(0,U.jsx)(J1,{inheritance:t.inheritance}):t.kind===`observation-event`?(0,U.jsx)(X0,{event:t.event}):(0,U.jsx)(`div`,{className:t.kind===`message`?`pb-5`:void 0,children:(0,U.jsx)(lF,{assistantAvatarIcon:S,showAssistantHeader:y,layout:m,messages:t.kind===`message`?[t.message]:[],isSending:r2(t,oe),hasAssistantDraft:N,texts:P,onToolAction:f.chatThreadManager.handleToolAction,onFileOpen:f.chatThreadManager.openFilePreview,onAttachmentOpen:le,onInlineTokenClick:ue,onMessageAction:k,resolveMessageToolPayloadState:e=>n?.[e],onMessageToolPayloadRequest:s,resolveFileContentUrl:T,renderCustomPart:fe,renderInlineDisplay:w,renderMessageContent:j,renderToolAgent:$0,renderPanelAppCard:e2})})},t.key):null})})})}function a2({children:e,className:t,width:n=`messages`}){let r=$1(e=>e.layout);return(0,U.jsx)(`div`,{"data-chat-conversation-track":r,"data-chat-conversation-track-width":n,className:u(`mx-auto w-full px-4 sm:px-6`,r===`flat`?n===`composer`?`max-w-[min(54rem,100%)]`:`max-w-[min(52rem,100%)]`:`max-w-[min(1120px,100%)]`,t),children:e})}function o2(e,t){return e&&!t?`chat-conversation:${e}`:null}function s2({bottomSlot:e,canContinue:t=!1,isHistoryLoading:n,hasPreviousMessages:r,historyError:i,isLoadingPreviousMessages:a,isContextCompacting:o=!1,isSending:s,messageActionsDisabled:c=!1,messages:l,messageDetailStates:u,sessionKey:d,showWelcome:f,onLoadPreviousMessages:p,onLoadMessageDetails:m,onContinueRun:h,onEditMessage:g,welcomeSlot:_}){let v=(0,H.useRef)(null),y=(0,H.useRef)(null),x=l.length>0||s,{onScroll:S}=oY({restorationKey:o2(d,f),scrollRef:v,isEnabled:!f}),{isAtBottom:C,onScroll:w,scrollToBottom:T}=wM({contentRef:y,scrollRef:v,resetKey:d,isLoading:n,hasContent:x,contentVersion:l[l.length-1]??s}),E=l.length>0;return(0,U.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,U.jsx)(`div`,{ref:v,onScroll:(0,H.useCallback)(e=>{S(e),w(),e.currentTarget.scrollTop<=320&&r&&!a&&p()},[r,a,p,w,S]),"data-chat-scroll-container":`true`,className:f?`h-full overflow-y-auto custom-scrollbar`:`h-full overflow-y-auto custom-scrollbar ${PF}`,style:{overflowAnchor:`none`},children:f?_??null:(0,U.jsxs)(`div`,{ref:y,className:`pb-7`,children:[x?(0,U.jsxs)(a2,{className:`relative py-4 sm:py-5`,children:[i?(0,U.jsx)(`div`,{role:`alert`,className:`flex h-8 justify-center`,children:(0,U.jsxs)(`button`,{type:`button`,"aria-label":b(`chatHistoryRetry`),className:`rounded px-1.5 text-xs text-foreground underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>void p(),children:[b(`chatHistoryLoadFailed`),` · `,b(`chatHistoryRetry`)]})}):a?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-1/2 top-[13px] block h-1.5 w-1.5 -translate-x-1/2 animate-pulse rounded-full bg-muted-foreground/50 sm:top-[17px]`}):null,(0,U.jsx)(i2,{canContinue:t,messages:l,messageDetailStates:u,isSending:s,messageActionsDisabled:c,onContinueRun:h,onEditMessage:g,onLoadMessageDetails:m,scrollRef:v,sessionKey:d}),o?(0,U.jsx)(q1,{}):null]}):null,e?(0,U.jsx)(a2,{className:`pb-4 sm:pb-5`,children:e}):null]})}),E&&!f&&!C?(0,U.jsx)(V,{icon:(0,U.jsx)(oa,{className:`h-4 w-4`}),label:b(`chatScrollToBottom`),onClick:T,tooltipSide:`top`,className:`absolute bottom-4 left-1/2 z-10 h-9 w-9 -translate-x-1/2 rounded-full border border-border bg-background/90 text-foreground shadow-lg backdrop-blur hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`}):null]})}function c2(e){let t=e.split(/\r?\n/),n=`message`,r=[];for(let e of t){let t=e.trimEnd();if(!(!t||t.startsWith(`:`))){if(t.startsWith(`event:`)){n=t.slice(6).trim()||`message`;continue}t.startsWith(`data:`)&&r.push(t.slice(5).trimStart())}}return r.length===0?null:{event:n,data:r.join(`
|
|
105
|
+
`)}}async function*l2(e,t={}){let n=e.getReader(),r=new TextDecoder,i=``;try{for(;;){let{value:e,done:a}=await n.read();if(a)break;t.onActivity?.(),i+=r.decode(e,{stream:!0});let{frames:o,rest:s}=u2(i);i=s;for(let e of o)yield e}i+=r.decode();let{frames:e}=u2(i,!0);for(let t of e)yield t}finally{n.releaseLock()}}function u2(e,t=!1){let n=e.split(/\r?\n\r?\n/),r=n.pop()??``,i=[];for(let e of n){let t=c2(e);t&&i.push(t)}if(t&&r.trim()){let e=c2(r);return e&&i.push(e),{frames:i,rest:``}}return{frames:i,rest:r}}var d2=`/ncp/agent`,f2=class extends Error{ncpError;alreadyPublished;constructor(e,t=!1){super(e.message),this.name=`NcpHttpAgentClientError(${e.code})`,this.ncpError=e,this.alreadyPublished=t}};function p2(e){let t=e.trim();if(!t)throw Error(`NcpHttpAgentClient requires a non-empty baseUrl.`);return new URL(t)}function m2(e){if(e)return e;if(typeof globalThis.fetch==`function`)return globalThis.fetch.bind(globalThis);throw Error(`No fetch implementation found. Pass options.fetchImpl explicitly.`)}function h2(e){let t=(e??`/ncp/agent`).trim();if(!t)return d2;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n.slice(0,-1):n}async function g2(e){try{return(await e.text()).trim()}catch{return``}}function _2(e){if(x2(e))return e.ncpError;if(y2(e))return e;let t=e instanceof Error?e.message:String(e??`Unknown error`);return{code:C2(void 0),message:t,...e instanceof Error&&e.stack?{details:{stack:e.stack}}:{}}}function v2(e,t={}){return new f2(e,t.alreadyPublished??!1)}function y2(e){return b2(e)&&typeof e.code==`string`&&typeof e.message==`string`}function b2(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function x2(e){return e instanceof f2}var S2={"config-error":`config-error`,"auth-error":`auth-error`,"runtime-error":`runtime-error`,"timeout-error":`timeout-error`,"abort-error":`abort-error`};function C2(e){if(!e)return`runtime-error`;let t=S2[e];if(t)return t;let n=e.toLowerCase();return n.includes(`timeout`)?`timeout-error`:n.includes(`abort`)||n.includes(`cancel`)?`abort-error`:n.includes(`auth`)?`auth-error`:n.includes(`config`)?`config-error`:`runtime-error`}function w2(e){let t=E2(e);return!t||typeof t.type!=`string`||!t.type.trim()?null:t}function T2(e){let t=E2(e);if(!t)return{code:`runtime-error`,message:e||`Unknown stream error.`};let n=typeof t.code==`string`?t.code:void 0,r=C2(n),i=b2(t.details)?t.details:{};return n&&n!==r&&(i.originalCode=n),{code:r,message:typeof t.message==`string`&&t.message?t.message:`Unknown stream error.`,...Object.keys(i).length>0?{details:i}:{}}}function E2(e){try{let t=JSON.parse(e);return b2(t)?t:null}catch{return null}}var D2=[`text`,`file`,`source`,`step-start`,`reasoning`,`tool-invocation`,`card`,`rich-text`,`action`,`extension`];function O2(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.trunc(e):null}var k2=class{manifest;baseUrl;basePath;fetchImpl;defaultHeaders;streamOpenTimeoutMs;streamIdleTimeoutMs;subscribers=new Set;activeControllers=new Set;started=!1;constructor(e){let{basePath:t,baseUrl:n,endpointId:r,fetchImpl:i,headers:a,streamIdleTimeoutMs:o,streamOpenTimeoutMs:s}=e;this.baseUrl=p2(n),this.basePath=h2(t),this.fetchImpl=m2(i),this.defaultHeaders=a??{},this.streamOpenTimeoutMs=O2(s),this.streamIdleTimeoutMs=O2(o),this.manifest={endpointKind:`custom`,endpointId:r?.trim()||`ncp-http-agent-client`,version:`0.1.0`,supportsStreaming:!0,supportsAbort:!0,supportsProactiveMessages:!1,supportsLiveSessionStream:!0,supportedPartTypes:D2,expectedLatency:`seconds`,metadata:{transport:`http+sse`,scope:`agent`}}}start=async()=>{this.started||(this.started=!0,this.publish(_K({type:gK.EndpointReady})))};stop=async()=>{if(this.started){this.started=!1;for(let e of this.activeControllers)e.abort();this.activeControllers.clear()}};emit=async e=>{switch(e.type){case`message.request`:await this.send(e.payload);return;case`message.stream-request`:await this.stream(e.payload);return;case`message.abort`:await this.abort(e.payload);return;default:this.publish(e);return}};subscribe=e=>(this.subscribers.add(e),()=>{this.subscribers.delete(e)});send=async e=>{await this.ensureStarted();let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(`/send`),{method:`POST`,headers:{...this.defaultHeaders,accept:`application/json`,"content-type":`application/json`},body:JSON.stringify(e),signal:t.signal});if(!n.ok)throw Error(`NCP send command failed with HTTP ${n.status}: ${await g2(n)}`);let r=await n.json();if(!r.ok||!r.data)throw Error(r.error?.message??`NCP send command returned an invalid handle.`);return r.data}catch(e){if(t.signal.aborted)throw Error(`NCP send command was cancelled.`);if(x2(e))throw e;let n=_2(e);throw this.publish(_K({type:gK.EndpointError,payload:n})),v2(n)}finally{this.activeControllers.delete(t)}};stream=async(e,t)=>{await this.ensureStarted();let n=new URLSearchParams({sessionId:e.sessionId});await this.streamRequest({path:`/stream?${n.toString()}`,method:`GET`},t)};abort=async e=>{await this.ensureStarted();let t=new AbortController;this.activeControllers.add(t);try{let n=await this.fetchImpl(this.resolveUrl(`/abort`),{method:`POST`,headers:{...this.defaultHeaders,"content-type":`application/json`,accept:`application/json`},body:JSON.stringify(e),signal:t.signal});if(!n.ok)throw Error(`Abort request failed with HTTP ${n.status}: ${await g2(n)}`)}catch(e){if(t.signal.aborted)return;let n=_2(e);throw this.publish(_K({type:gK.EndpointError,payload:n})),v2(n)}finally{this.activeControllers.delete(t)}};ensureStarted=async()=>{this.started||await this.start()};publish=e=>{for(let t of this.subscribers)t(e)};resolveUrl=e=>new URL(`${this.basePath}${e}`,this.baseUrl);streamRequest=async(e,t)=>{let{body:n,method:r,path:i}=e,a=new AbortController;this.activeControllers.add(a);let o=null,s=null,c=()=>{o&&=(clearTimeout(o),null)},l=(e,t)=>{c(),e&&(o=setTimeout(()=>{s={code:`timeout-error`,message:t},a.abort(s)},e))};try{l(this.streamOpenTimeoutMs,`NCP stream did not open within ${this.streamOpenTimeoutMs}ms.`);let e=await this.fetchImpl(this.resolveUrl(i),{method:r,headers:{...this.defaultHeaders,accept:`text/event-stream`,...n===void 0?{}:{"content-type":`application/json`}},body:n===void 0?void 0:JSON.stringify(n),signal:a.signal});if(!e.ok)throw Error(`NCP stream request failed with HTTP ${e.status}: ${await g2(e)}`);if(!e.body)throw Error(`NCP stream response has no body.`);t?.onOpen?.(),l(this.streamIdleTimeoutMs,`NCP stream received no data for ${this.streamIdleTimeoutMs}ms.`);for await(let t of l2(e.body,{onActivity:()=>{l(this.streamIdleTimeoutMs,`NCP stream received no data for ${this.streamIdleTimeoutMs}ms.`)}})){if(a.signal.aborted)return;this.handleSseFrame(t)}}catch(e){if(a.signal.aborted&&!s)return;throw x2(e)?e:v2(s??_2(e))}finally{c(),this.activeControllers.delete(a)}};handleSseFrame=e=>{if(e.event===`ncp-event`){let t=w2(e.data);if(!t){this.publish(_K({type:gK.EndpointError,payload:{code:`runtime-error`,message:`Received malformed ncp-event frame.`}}));return}this.publish(t);return}if(e.event===`error`){let t=T2(e.data);throw this.publish(_K({type:gK.EndpointError,payload:t})),v2(t,{alreadyPublished:!0})}}};function A2(e){return{...e,parts:e.parts.map(e=>e.type===`tool-invocation`?{...e,...e.execution?{execution:{...e.execution}}:{}}:e),lifecycle:e.lifecycle?{...e.lifecycle}:void 0,metadata:e.metadata?{...e.metadata}:void 0}}function j2(e){return A2(OK(e))}var M2=class{execution=null;trigger=null;get isEmpty(){return!this.execution&&!this.trigger}clear=()=>{this.execution=null,this.trigger=null};beginRun=e=>{this.execution=null,(!this.trigger||!e?.trim()||this.trigger.targetRunId!==e)&&(this.trigger=null)};observe=e=>{let t=hK(e.metadata);t&&(!e.runId||e.runId===t.runId)&&(this.execution=structuredClone(t));let n=CK(e.metadata);n&&(!e.runId||e.runId===n.targetRunId)&&(this.trigger=structuredClone(n))};take=e=>{let t=this.execution,n=this.trigger;return this.execution=null,this.trigger=null,{execution:t&&(!e?.trim()||t.runId===e)?t:null,trigger:n&&(!e?.trim()||n.targetRunId===e)?n:null}};attach=(e,t)=>{let{execution:n,trigger:r}=t;return!n&&!r?e:{...e,metadata:{...e.metadata??{},...n?{[uK]:structuredClone(n)}:{},...r?{[vK]:structuredClone(r)}:{}}}}},N2=`__nextclaw_aborted_tool_call__`;function P2(e,t){switch(t.type){case gK.MessageSent:e.handleMessageSent(t.payload);break;case gK.MessageCompleted:e.handleMessageCompleted(t.payload);break;case gK.MessageAbort:e.handleMessageAbort(t.payload,t.occurredAt);break;case gK.MessageFailed:e.handleMessageFailed(t.payload,t.occurredAt);break;case gK.MessageTextStart:e.handleMessageTextStart(t.payload);break;case gK.MessageTextDelta:e.handleMessageTextDelta(t.payload);break;case gK.MessageTextEnd:e.handleMessageTextEnd(t.payload);break;case gK.MessageReasoningStart:e.handleMessageReasoningStart(t.payload);break;case gK.MessageReasoningDelta:e.handleMessageReasoningDelta(t.payload);break;case gK.MessageReasoningEnd:e.handleMessageReasoningEnd(t.payload);break;case gK.MessageToolCallStart:e.handleMessageToolCallStart(t.payload);break;case gK.MessageToolCallArgs:e.handleMessageToolCallArgs(t.payload);break;case gK.MessageToolCallArgsDelta:e.handleMessageToolCallArgsDelta(t.payload);break;case gK.MessageToolCallEnd:e.handleMessageToolCallEnd(t.payload);break;case gK.MessageToolExecutionStarted:e.handleMessageToolExecutionStarted(t.payload,t.occurredAt);break;case gK.MessageToolCallResult:e.handleMessageToolCallResult(t.payload,t.occurredAt);break;case gK.RunStarted:e.handleRunStarted(t.payload,t.occurredAt);break;case gK.RunFinished:e.handleRunFinished(t.payload,t.occurredAt);break;case gK.RunError:e.handleRunError(t.payload,t.occurredAt);break;case gK.RunMetadata:e.handleRunMetadata(t.payload);break;case gK.ContextWindowUpdated:e.handleContextWindowUpdated(t.payload);break;case gK.EndpointError:e.handleEndpointError(t.payload,t.occurredAt);break;default:break}}function F2(e,t){let n=I2(e?.startedAt),r=I2(e?.endedAt??t),i=e?.durationMs,a=typeof i==`number`&&Number.isFinite(i)&&i>=0?i:void 0;if(!(!n&&!r&&a===void 0))return{...n?{startedAt:n}:{},...r?{endedAt:r}:{},...a===void 0?{}:{durationMs:a}}}function I2(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():void 0}function L2(e,t){if(!e)return t;if(!t)return e;let n=F2(e),r=F2(t),i=n?.startedAt,a=r?.startedAt,o=i&&a?Date.parse(i)<=Date.parse(a)?i:a:i??a,s=n?.durationMs,c=r?.durationMs,l=s??c,u=s===void 0?c===void 0?n?.endedAt??r?.endedAt:r?.endedAt??n?.endedAt:n?.endedAt??r?.endedAt;return{...o?{startedAt:o}:{},...u?{endedAt:u}:{},...l===void 0?{}:{durationMs:l}}}function R2(e){let t=e.error?.trim();return{code:e.interrupted?`run-interrupted`:`runtime-error`,message:t&&t.length>0?t:`Agent run failed.`,details:{sessionId:e.sessionId,messageId:e.messageId,threadId:e.threadId,runId:e.runId}}}function z2(e){if(!(!e.startedAt&&!e.endedAt))return{startedAt:e.startedAt,endedAt:e.endedAt}}function B2(e,t,n){let r=t===`error`||n?.endedAt?X2(e.parts,n?.endedAt).parts:e.parts;return n?{...e,status:t,parts:r,lifecycle:n}:{...e,status:t,parts:r}}function V2(e,t){let n=Date.parse(t.timestamp);if(!Number.isFinite(n))return e.length;let r=e.findIndex(e=>{let t=Date.parse(e.timestamp);return Number.isFinite(t)&&t>n});return r<0?e.length:r}function H2(e,t){let n=[...e];return n.splice(V2(e,t),0,t),n}function U2(e,t,n){let r=n>0?e[n-1]?.id:null,i=e[n]?.id,a=i?t.findIndex(e=>e.id===i):-1;if(a>=0)return a;let o=r?t.findIndex(e=>e.id===r):-1;return o>=0?o+1:t.length}function W2(e,t,n,r){let i=j2(r),a=t?.id===i.id,o=e.findIndex(e=>e.id===i.id),s=[...e];if(o>=0)s[o]=i;else{let t=a?Math.min(Math.max(n??e.length,0),e.length):e.length;s.splice(t,0,i)}return{messages:s,streamingMessage:a?null:t,streamingMessageIndex:a?null:n}}function G2(e,t,n){let r=new Set(e.map(e=>e.id));t&&r.add(t.id);let i=e;for(let e of n)r.has(e.id)||(r.add(e.id),i=H2(i,j2(e)));return i}function K2(e,t){return t.trim()?e.id.startsWith(`tool-`)?!0:e.parts.some(e=>e.type===`tool-invocation`):!1}function q2(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n];if(r.type===`tool-invocation`&&r.toolCallId===t)return r}return null}function J2(e,t){return q2(e,t)?.toolName??null}function Y2(e,t){let n=[...e];for(let e=n.length-1;e>=0;--e){let r=n[e];if(r.type===`tool-invocation`&&r.toolCallId===t.toolCallId)return n[e]={...r,...t,...r.execution||t.execution?{execution:{...r.execution,...t.execution}}:{}},n}return n.push(t),n}function X2(e,t){let n=[],r=t?Date.parse(t):NaN,i=Number.isFinite(r)?new Date(r).toISOString():void 0;return{parts:e.map(e=>e.type!==`tool-invocation`||!e.toolCallId||e.state===`result`||e.state===`cancelled`?e:(n.push(e.toolCallId),{...e,state:`cancelled`,...e.execution?.startedAt&&!e.execution.endedAt?{execution:{...e.execution,...i?{endedAt:i}:{}}}:{}})),toolCallIds:n}}function Z2(e){return e.state===`result`||e.state===`cancelled`||!!e.execution?.endedAt||typeof e.execution?.durationMs==`number`}var Q2=class{messageIdByCallId=new Map;argsRawByCallId=new Map;constructor(e){this.port=e}isEmpty=()=>this.messageIdByCallId.size===0&&this.argsRawByCallId.size===0;clear=()=>{this.messageIdByCallId.clear(),this.argsRawByCallId.clear()};hydrate=e=>{this.clear(),e.forEach(e=>{e.parts.forEach(t=>{if(t.type!==`tool-invocation`||!t.toolCallId||t.state===`result`||t.state===`cancelled`)return;let n=typeof t.args==`string`?t.args:JSON.stringify(t.args??{});this.messageIdByCallId.set(t.toolCallId,e.id),this.argsRawByCallId.set(t.toolCallId,n)})})};clearByMessageId=e=>{for(let[t,n]of this.messageIdByCallId)n===e&&(this.messageIdByCallId.delete(t),this.argsRawByCallId.delete(t))};markAborted=e=>{e.forEach(e=>this.argsRawByCallId.set(e,N2))};remapMessageId=(e,t)=>{for(let[n,r]of this.messageIdByCallId)r===e&&this.messageIdByCallId.set(n,t)};handleToolCallStart=e=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId,e.messageId);this.argsRawByCallId.set(e.toolCallId,``),this.port.replaceStreamingMessage({...t,parts:Y2(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:e.toolName,state:`partial-call`,args:``}),status:`streaming`})};handleToolCallArgs=e=>{this.argsRawByCallId.get(e.toolCallId)!==`__nextclaw_aborted_tool_call__`&&(this.argsRawByCallId.set(e.toolCallId,e.args),this.applyToolCallArgs(e.sessionId,e.toolCallId,e.args))};handleToolCallArgsDelta=e=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=`${this.argsRawByCallId.get(e.toolCallId)??``}${e.delta}`;this.argsRawByCallId.set(e.toolCallId,t),this.applyToolCallArgs(e.sessionId,e.toolCallId,t,e.messageId)};handleToolCallEnd=e=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let t=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId),n=this.argsRawByCallId.get(e.toolCallId)??``;this.port.replaceStreamingMessage({...t,parts:Y2(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:J2(t.parts,e.toolCallId)??`unknown`,state:`call`,args:n}),status:`streaming`})};handleToolExecutionStarted=(e,t)=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let n=I2(t);if(!n||this.port.updateMessageContainingToolCall(e.toolCallId,(e,t)=>{if(Z2(t))return e.parts;let r=I2(t.execution?.startedAt),i=r&&Date.parse(r)<=Date.parse(n)?r:n;return Y2(e.parts,{...t,execution:{...t.execution,startedAt:i}})}))return;let r=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId,e.messageId);this.port.replaceStreamingMessage({...r,parts:Y2(r.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:`unknown`,state:`call`,execution:{startedAt:n}}),status:`streaming`})};handleToolCallResult=(e,t)=>{if(this.argsRawByCallId.get(e.toolCallId)===`__nextclaw_aborted_tool_call__`)return;let n=e.final!==!1,r=F2(e.execution,n?t:void 0);if(this.port.updateMessageContainingToolCall(e.toolCallId,(t,i)=>i.state===`cancelled`||!n&&Z2(i)?t.parts:Y2(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:i.toolName,state:n?`result`:`call`,args:i.args,result:e.content,...e.contentItems?{resultContentItems:e.contentItems}:{},...r?{execution:L2(i.execution,r)}:{}})))return;let i=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId);this.port.replaceStreamingMessage({...i,parts:Y2(i.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:`unknown`,state:n?`result`:`call`,result:e.content,...e.contentItems?{resultContentItems:e.contentItems}:{},...r?{execution:r}:{}}),status:`streaming`})};applyToolCallArgs=(e,t,n,r)=>{let i=this.resolveToolCallTargetMessage(e,t,r),a=J2(i.parts,t)??`unknown`;this.port.replaceStreamingMessage({...i,parts:Y2(i.parts,{type:`tool-invocation`,toolCallId:t,toolName:a,state:`partial-call`,args:n}),status:`streaming`})};resolveToolCallTargetMessage=(e,t,n)=>{let r=n?.trim()||this.messageIdByCallId.get(t)||this.port.readStreamingMessageId()||`tool-${t}`;return this.messageIdByCallId.set(t,r),this.port.ensureStreamingMessage(e,r,`streaming`)}},$2=`assistant`,e4=class{messages=[];streamingMessage=null;streamingMessageIndex=null;error=null;activeRun=null;contextWindow=null;listeners=new Set;runExecution=new M2;toolCalls;lastSettledRunId=null;snapshotCache=null;snapshotVersion=-1;stateVersion=0;constructor(){this.toolCalls=new Q2({ensureStreamingMessage:this.ensureStreamingMessage,readStreamingMessageId:()=>this.streamingMessage?.id??null,replaceStreamingMessage:this.replaceStreamingMessage,updateMessageContainingToolCall:this.updateMessageContainingToolCall})}getSnapshot=()=>{if(this.snapshotCache&&this.snapshotVersion===this.stateVersion)return this.snapshotCache;let e={messages:this.messages,streamingMessage:this.streamingMessage,streamingMessageIndex:this.streamingMessageIndex,error:this.error?{...this.error,details:this.error.details?{...this.error.details}:void 0}:null,activeRun:this.activeRun?{...this.activeRun}:null,contextWindow:this.contextWindow?{...this.contextWindow}:null};return this.snapshotCache=e,this.snapshotVersion=this.stateVersion,e};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));reset=()=>{this.messages.length===0&&!this.streamingMessage&&!this.error&&!this.activeRun&&this.runExecution.isEmpty&&!this.contextWindow&&this.toolCalls.isEmpty()||(this.messages=[],this.streamingMessage=null,this.streamingMessageIndex=null,this.error=null,this.activeRun=null,this.runExecution.clear(),this.contextWindow=null,this.toolCalls.clear(),this.lastSettledRunId=null,this.stateVersion+=1,this.notifyListeners())};clearError=()=>{let e=this.stateVersion;this.setError(null),this.stateVersion!==e&&this.notifyListeners()};hydrate=e=>{this.messages=[...new Map(e.messages.map(e=>[e.id,j2(e)])).values()],this.streamingMessage=null,this.streamingMessageIndex=null,this.error=null,this.contextWindow=e.contextWindow?{...e.contextWindow}:null,this.activeRun=e.activeRun?{...e.activeRun,sessionId:e.activeRun.sessionId??e.sessionId,abortDisabledReason:e.activeRun.abortDisabledReason??null}:null,this.runExecution.clear(),this.toolCalls.hydrate(this.messages),this.lastSettledRunId=null,this.stateVersion+=1,this.notifyListeners()};prependHistory=e=>{let t=this.messages,n=G2(this.messages,this.streamingMessage,e);n!==t&&(this.messages=n,this.streamingMessageIndex!==null&&(this.streamingMessageIndex=U2(t,n,this.streamingMessageIndex)),this.toolCalls.hydrate(this.messages),this.stateVersion+=1,this.notifyListeners())};dispatch=e=>this.dispatchBatch([e]);dispatchBatch=async e=>{if(!e.length)return;let t=this.stateVersion;e.forEach(e=>P2(this,e)),this.stateVersion!==t&&this.notifyListeners()};handleMessageSent=e=>{this.upsertMessage(e.message),this.setError(null)};handleMessageCompleted=e=>{let t=this.activeRun?.runId,n=this.runExecution.attach(j2({...e.message,status:`final`}),this.runExecution.take(t));if(this.streamingMessage?.id===n.id){this.upsertMessage(n),this.toolCalls.clearByMessageId(n.id);return}this.upsertMessage(n)};handleMessageAbort=(e,t)=>{let n=e.messageId?.trim(),r=e.runId??this.activeRun?.runId,i=this.runExecution.take(r);if(this.clearActiveRun(),this.setError(null),this.streamingMessage&&(!n||this.streamingMessage.id===n)){let e=this.streamingMessage.id,{parts:r,toolCallIds:a}=X2(this.streamingMessage.parts,t);this.upsertMessage(this.runExecution.attach({...this.streamingMessage,status:`final`,parts:r},i)),this.replaceStreamingMessage(null),this.toolCalls.clearByMessageId(n||e),this.toolCalls.markAborted(a)}};handleMessageFailed=(e,t)=>{this.streamingMessage&&(!e.messageId||this.streamingMessage.id===e.messageId)&&this.settleStreamingMessage(`error`,t?{endedAt:t}:void 0,this.activeRun?.runId),this.clearActiveRun(),this.setError(e.error)};handleMessageTextStart=e=>{let t=this.streamingMessage?.id===e.messageId,n=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),r=n.parts[n.parts.length-1];t&&r?.type===`text`&&r.text.length>0&&this.replaceStreamingMessage({...n,parts:[...n.parts,{type:`text`,text:``}],status:`streaming`}),this.setError(null)};handleMessageTextDelta=e=>{if(!e.delta)return;let t=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),n=[...t.parts],r=n[n.length-1];r?.type===`text`?n[n.length-1]={type:`text`,text:`${r.text}${e.delta}`}:n.push({type:`text`,text:e.delta}),this.replaceStreamingMessage({...t,parts:n,status:`streaming`})};handleMessageTextEnd=e=>{this.streamingMessage?.id===e.messageId&&this.streamingMessage.status===`streaming`&&this.replaceStreamingMessage({...this.streamingMessage,status:`pending`})};handleMessageReasoningStart=e=>{this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`)};handleMessageReasoningDelta=e=>{if(!e.delta)return;let t=this.ensureStreamingMessage(e.sessionId,e.messageId,`streaming`),n=[...t.parts],r=n[n.length-1];r?.type===`reasoning`?n[n.length-1]={type:`reasoning`,text:`${r.text}${e.delta}`}:n.push({type:`reasoning`,text:e.delta}),this.replaceStreamingMessage({...t,parts:n,status:`streaming`})};handleMessageReasoningEnd=e=>{this.streamingMessage?.id,e.messageId};handleMessageToolCallStart=e=>{this.toolCalls.handleToolCallStart(e),this.setError(null)};handleMessageToolCallArgs=e=>{this.toolCalls.handleToolCallArgs(e)};handleMessageToolCallArgsDelta=e=>{this.toolCalls.handleToolCallArgsDelta(e)};handleMessageToolCallEnd=e=>{this.toolCalls.handleToolCallEnd(e)};handleMessageToolExecutionStarted=(e,t)=>{this.toolCalls.handleToolExecutionStarted(e,t)};handleMessageToolCallResult=(e,t)=>{this.toolCalls.handleToolCallResult(e,t)};handleRunStarted=(e,t)=>{this.isSettledRunId(e.runId)||e.runId&&this.activeRun?.runId===e.runId||(this.streamingMessage&&this.activeRun?.runId!==e.runId&&this.handleMessageAbort({sessionId:this.streamingMessage.sessionId,messageId:this.streamingMessage.id},t),this.runExecution.beginRun(e.runId),this.setError(null),this.activeRun={runId:e.runId??null,sessionId:e.sessionId},this.stateVersion+=1)};handleRunFinished=(e,t)=>{this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.settleStreamingMessage(`final`,z2({...e,endedAt:e.endedAt??t}),e.runId??this.activeRun?.runId),this.setError(null),this.clearActiveRun()};handleRunError=(e,t)=>{this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.settleStreamingMessage(`error`,z2({...e,endedAt:e.endedAt??t}),e.runId??this.activeRun?.runId),this.setError(R2(e)),this.clearActiveRun()};handleRunMetadata=e=>{this.runExecution.observe(e);let t=e.metadata;if(t?.kind===`ready`){let e=t;if(this.isSettledRunId(e.runId))return;this.activeRun={runId:e.runId??this.activeRun?.runId??null,sessionId:e.sessionId??this.activeRun?.sessionId,abortDisabledReason:e.supportsAbort===!1?e.abortDisabledReason??`Unsupported`:null},this.stateVersion+=1}else t?.kind===`final`&&(this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.clearActiveRun())};handleContextWindowUpdated=e=>{this.contextWindow={...e.contextWindow},this.stateVersion+=1};handleEndpointError=(e,t)=>{if(e.code===`abort-error`){this.handleMessageAbort({sessionId:this.activeRun?.sessionId??this.streamingMessage?.sessionId??``,...this.streamingMessage?.id?{messageId:this.streamingMessage.id}:{}},t);return}this.settleStreamingMessage(`error`,t?{endedAt:t}:void 0),this.clearActiveRun(),this.setError(e)};ensureStreamingMessage=(e,t,n)=>{if(this.streamingMessage?.id===t){if(this.streamingMessage.status===n)return this.streamingMessage;let e={...this.streamingMessage,status:n};return this.replaceStreamingMessage(e),e}let r=this.messages.findIndex(e=>e.id===t);if(r>=0){let t=A2(this.messages[r]),i=[...this.messages];i.splice(r,1),this.messages=i,this.streamingMessageIndex=r,this.stateVersion+=1;let a={...t,sessionId:e,status:n};return this.replaceStreamingMessage(a),a}let i=this.streamingMessage;if(i&&i.id!==t&&i.sessionId===e&&K2(i,t)){let r={...i,id:t,sessionId:e,status:n};return this.toolCalls.remapMessageId(i.id,t),this.replaceStreamingMessage(r),r}let a={id:t,sessionId:e,role:$2,status:n,parts:[],timestamp:new Date().toISOString()};return this.streamingMessageIndex=this.messages.length,this.replaceStreamingMessage(a),a};updateMessageContainingToolCall=(e,t)=>{if(this.streamingMessage){let n=q2(this.streamingMessage.parts,e);if(n){let e=t(this.streamingMessage,n);return this.replaceStreamingMessage({...this.streamingMessage,parts:e}),!0}}for(let n=this.messages.length-1;n>=0;--n){let r=this.messages[n],i=q2(r.parts,e);if(!i)continue;let a=[...this.messages];return a[n]={...r,parts:t(r,i)},this.messages=a,this.stateVersion+=1,!0}return!1};upsertMessage=e=>{let t=W2(this.messages,this.streamingMessage,this.streamingMessageIndex,e);this.messages=t.messages,this.streamingMessage=t.streamingMessage,this.streamingMessageIndex=t.streamingMessageIndex,this.stateVersion+=1};replaceStreamingMessage=e=>{!e&&!this.streamingMessage&&this.streamingMessageIndex===null||(this.streamingMessageIndex=e?this.streamingMessageIndex??this.messages.length:null,this.streamingMessage=e?j2(e):null,this.stateVersion+=1)};setError=e=>{this.error?.code===e?.code&&this.error?.message===e?.message&&this.error?.details===e?.details&&this.error?.cause===e?.cause||(this.error=e?{...e,details:e.details?{...e.details}:void 0}:null,this.stateVersion+=1)};clearActiveRun=()=>{this.activeRun&&(this.activeRun=null,this.stateVersion+=1)};isSettledRunId=e=>!!e?.trim()&&e===this.lastSettledRunId;markRunAsSettled=e=>{this.lastSettledRunId=e?.trim()||null};settleStreamingMessage=(e,t,n)=>{let r=this.runExecution.take(n);if(!this.streamingMessage)return;let i=this.runExecution.attach(B2(this.streamingMessage,e,t),r);this.upsertMessage(i),this.replaceStreamingMessage(null),this.toolCalls.clearByMessageId(i.id)};notifyListeners=()=>{let e=this.getSnapshot();for(let t of this.listeners)t(e)}},t4=16,n4={code:`abort-error`,message:`User stopped the current run.`,details:{source:`chat-ui`}},r4=class{constructor(e){this.dispatchBatch=e,this.queue=[],this.flushTimerId=null,this.isFlushing=!1,this.isDisposed=!1,this.enqueue=e=>{this.isDisposed||(this.queue.push(e),this.scheduleFlush())},this.dispose=()=>{this.isDisposed=!0,this.flushTimerId!==null&&(window.clearTimeout(this.flushTimerId),this.flushTimerId=null),this.queue.length=0},this.scheduleFlush=()=>{this.flushTimerId!==null||this.isFlushing||this.queue.length===0||(this.flushTimerId=window.setTimeout(()=>{this.flushTimerId=null,this.flush()},t4))},this.flush=async()=>{if(!(this.isDisposed||this.isFlushing||this.queue.length===0)){this.isFlushing=!0;try{for(;this.queue.length>0;){let e=this.queue.splice(0);await this.dispatchBatch(e)}}finally{this.isFlushing=!1,this.scheduleFlush()}}}}};function i4(e,t){if(!t)return!0;let n=`payload`in e?e.payload:null;return!n||typeof n!=`object`||!(`sessionId`in n)||typeof n.sessionId!=`string`?!0:n.sessionId===t}function a4(e){return e.parts.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function o4(e,t){if(typeof e==`string`){let n=e.trim();return n?{...t?{sessionId:t}:{},message:{id:`user-${Date.now().toString(36)}`,...t?{sessionId:t}:{},role:`user`,status:`final`,parts:[{type:`text`,text:n}],timestamp:new Date().toISOString()}}:null}if(!a4(e.message))return null;let n=e.sessionId||e.message.sessionId||t;return{...e,...n?{sessionId:n}:{},message:{...e.message,...n?{sessionId:n}:{}}}}function s4(e,t){return{...e.message,sessionId:t}}function c4(e,t,n){let r=[...e];return r.splice(Math.min(Math.max(n,0),r.length),0,t),r}function l4(e){let t=(0,H.useRef)();return t.current?e&&t.current.sessionId===null?t.current.sessionId=e:t.current.sessionId!==(e??null)&&(t.current={sessionId:e??null,manager:new e4}):t.current={sessionId:e??null,manager:new e4},t.current.manager}function u4({sessionId:e,client:t,manager:n}){let r=(0,H.useRef)(e),i=(0,H.useSyncExternalStore)(e=>n.subscribe(()=>e()),()=>n.getSnapshot(),()=>n.getSnapshot()),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(null);(0,H.useEffect)(()=>{r.current=e},[e]),(0,H.useEffect)(()=>{let e=new r4(n.dispatchBatch),i=t.subscribe(t=>{i4(t,r.current)&&e.enqueue(t)});return()=>{i(),e.dispose(),t.stop()}},[t,n]);let l=i.messages;if(i.streamingMessage){let e=i.streamingMessageIndex;if(e===null)throw Error(`Streaming conversation snapshot is missing its event-order insertion boundary.`);l=c4(i.messages,i.streamingMessage,e)}let u=s&&(!e||s.sessionId===e)&&!i.messages.some(e=>e.id===s.id)?H2(l,s):l,d=i.activeRun?.runId??null,f=!!i.activeRun,p=a===e,m=async(e,t)=>{e.runId===null||e.delivery===`steered`||(n.clearError(),await n.dispatchBatch([...t?[{type:gK.MessageSent,payload:{sessionId:e.sessionId,message:t}}]:[],{type:gK.RunStarted,payload:{sessionId:e.sessionId,runId:e.runId}}]))};return{snapshot:i,visibleMessages:u,activeRunId:d,acceptRun:m,isRunning:f,isSending:p,send:async r=>{if(p)return null;let i=o4(r,e);if(!i)return null;n.clearError(),o(e);let a=i.sessionId?s4(i,i.sessionId):null,s=async()=>{c(null),a&&await n.dispatch({type:gK.MessageSent,payload:{sessionId:a.sessionId,message:{...a,status:`error`}}})};c(f?null:a);try{let e=await t.send(i);return e?(e.runId===null||await m(e,s4(i,e.sessionId)),c(null),e):(await s(),null)}catch(e){throw await s(),e}finally{o(t=>t===e?null:t)}},abort:async()=>{e&&await t.abort({sessionId:e,runId:d??void 0,reason:n4})},streamRun:async()=>{e&&(await t.stop(),await t.stream({sessionId:e}))}}}var d4=500,f4=1e4,p4=3;function m4(e){return e instanceof Error?e:Error(String(e))}function h4(e,t){let n=e.getSnapshot();return n.activeRun?.sessionId===t||n.streamingMessage?.sessionId===t||n.messages.some(e=>e.sessionId===t)}function g4(){return new Promise(e=>window.setTimeout(e,d4))}function _4(e,t,n){let r=e.consecutiveFailures+1;return n(!e.hasHydrated||r>=p4?m4(t):null),{...e,consecutiveFailures:r}}function v4(e,t,n){return t.stable?(n(null),{...e,consecutiveFailures:0}):_4(e,t.error,n)}function y4(e){return[...e.messages,...e.streamingMessage?[e.streamingMessage]:[]]}function b4(e){let{current:t,messages:n,activeRun:r}=e,i=y4(t);return i.length!==n.length||JSON.stringify(t.activeRun)!==JSON.stringify(r)?!1:i.every((e,t)=>e===n[t]||JSON.stringify(e)===JSON.stringify(n[t]))}async function x4(e){let{loadSeed:t,manager:n,reconcileFrom:r,sessionId:i,signal:a}=e,o=await t(i,a);if(a.aborted)return;let s=n.getSnapshot(),c=!!(r&&s!==r),l=c?S4(o,s):o.messages,u=c?s.activeRun:o.status===`running`?{runId:null,sessionId:i,abortDisabledReason:null}:null;b4({current:s,messages:l,activeRun:u})||n.hydrate({sessionId:i,messages:l,activeRun:u})}function S4(e,t){let n=y4(t),r=new Map(n.map(e=>[e.id,e])),i=e.messages.map(e=>{let t=r.get(e.id);if(!t)return e;r.delete(e.id);let n=e.status===`final`||e.status===`error`,i=t.status===`final`||t.status===`error`;return n&&!i?e:t});for(let n of r.values())(n.status===`final`||n.status===`error`||n.role===`user`||e.status===`running`||t.activeRun)&&i.push(n);return i}async function C4(e){let{client:t,onOpen:n,sessionId:r,signal:i}=e,a=Date.now(),o;try{await t.stream({sessionId:r},{onOpen:n}),o=Error(`Live conversation stream disconnected.`)}catch(e){o=e}return i.aborted?null:{error:o,stable:Date.now()-a>=f4}}async function w4(e,t,n){t.reset(),n(null),await e.stop()}function T4({sessionId:e,client:t,loadSeed:n}){let r=l4(e),i=u4({sessionId:e,client:t,manager:r}),[a,o]=(0,H.useState)({sessionId:null,error:null});(0,H.useEffect)(()=>{let i=new AbortController,{signal:a}=i,s=t=>{o({sessionId:e??null,error:t})};return(async()=>{if(!e){await w4(t,r,s);return}let i=!h4(r,e),c={consecutiveFailures:0,hasHydrated:!i};for(i?(r.reset(),o({sessionId:null,error:null})):s(null),await t.stop();!a.aborted;){if(i)try{if(await x4({loadSeed:n,manager:r,sessionId:e,signal:a}),a.aborted)return;s(null),c={...c,hasHydrated:!0},i=!1}catch(e){if(a.aborted)return;c=_4(c,e,s),await g4();continue}let o=Promise.resolve(),l=await C4({client:t,sessionId:e,signal:a,onOpen:()=>{o=x4({loadSeed:n,manager:r,reconcileFrom:r.getSnapshot(),sessionId:e,signal:a}).then(()=>{a.aborted||(s(null),c={...c,hasHydrated:!0})}).catch(e=>{a.aborted||(c=_4(c,e,s))})}});if(await o,!l)return;c=v4(c,l,s),i=!0,await g4()}})().catch(e=>{a.aborted||s(m4(e))}),()=>{i.abort()}},[t,n,r,e]);let s=(0,H.useCallback)(e=>r.prependHistory(e),[r]),c=(0,H.useCallback)(t=>{e&&r.hydrate({sessionId:e,messages:t.messages,activeRun:t.status===`running`?{runId:null,sessionId:e,abortDisabledReason:null}:null})},[r,e]);return{...i,isHydrating:!!(e&&a.sessionId!==e),hydrateError:a.error,prependHistory:s,replaceHistory:c}}var E4=200*1024*1024,D4=`application/octet-stream`;function O4(e){let t=e.type.trim().toLowerCase();return t.length>0?t:D4}function k4(e,t){let n=t.acceptedMimeTypes&&t.acceptedMimeTypes.length>0?new Set(t.acceptedMimeTypes.map(e=>e.trim().toLowerCase())):null,r=t.maxBytes??209715200,i=O4(e);return n&&!n.has(i)?{ok:!1,rejected:{fileName:e.name,mimeType:i,sizeBytes:e.size,reason:`unsupported-type`}}:e.size>r?{ok:!1,rejected:{fileName:e.name,mimeType:i,sizeBytes:e.size,reason:`too-large`}}:{ok:!0,mimeType:i}}function A4(e){let t=e.parts&&e.parts.length>0?e.parts.map(e=>structuredClone(e)):[...e.text?.trim()??``?[{type:`text`,text:e.text.trim()}]:[],...(e.attachments??[]).map(e=>({type:`file`,name:e.name,mimeType:e.mimeType,...e.assetUri?.trim()?{assetUri:e.assetUri.trim()}:{},...e.url?.trim()?{url:e.url.trim()}:{},...e.contentBase64?.trim()?{contentBase64:e.contentBase64.trim()}:{},sizeBytes:e.sizeBytes}))];if(t.length===0)return null;let n=e.timestamp??new Date().toISOString(),r=e.messageId??`user-${Date.now().toString(36)}`;return{...e.sessionId?{sessionId:e.sessionId}:{},message:{id:r,...e.sessionId?{sessionId:e.sessionId}:{},role:`user`,status:`final`,parts:t,timestamp:n,...e.metadata?{metadata:e.metadata}:{}},...e.metadata?{metadata:e.metadata}:{}}}async function j4(e,t){let n=[],r=[];for(let i of e){let e=k4(i,t);if(!e.ok){r.push(e.rejected);continue}n.push(i)}if(n.length===0)return{attachments:[],rejected:r};try{return{attachments:await t.uploadBatch(n),rejected:r}}catch{return r.push(...n.map(e=>({fileName:e.name,mimeType:O4(e),sizeBytes:e.size,reason:`read-failed`}))),{attachments:[],rejected:r}}}function M4(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function N4(e){if(e instanceof Error){let t=e.name?.trim(),n=e.message?.trim();return t&&n?`${t}: ${n}`:n||t||`Unknown Error`}return String(e??`Unknown error`)}function P4(e,t){let n=Error(e);return t!==void 0&&(n.cause=t),n}function F4(){return async(e,t)=>{try{return await fetch(e,{credentials:`include`,...t})}catch(n){throw Tt.reportTransportFailure(N4(n)),P4(`NCP fetch failed for ${(t?.method||`GET`).toUpperCase()} ${M4(e)}: ${N4(n)}`,n)}}}function I4(e){return e instanceof Error&&e.message.includes(`ncp session not found:`)}function L4(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}async function R4(e,t){return t.throwIfAborted(),await new Promise((n,r)=>{let i=()=>r(new DOMException(`Aborted`,`AbortError`));t.addEventListener(`abort`,i,{once:!0}),e.then(n,r).finally(()=>{t.removeEventListener(`abort`,i)})})}async function z4(e){let{messageLimit:t,sessionId:n,signal:r}=e,i=window.__NEXTCLAW_INITIAL_SESSION_MESSAGES_PREFETCH__;if(!i||i.consumed||i.sessionId!==n||i.limit!==t)return null;i.consumed=!0;let a=await R4(i.promise,r);if(r.throwIfAborted(),!a?.responseOk||!L4(a.payload))return null;let{payload:o}=a;if(o.ok!==!0||!L4(o.data))return null;let{data:s}=o;return s.sessionId!==n||!Array.isArray(s.messages)||!L4(s.pageInfo)?null:s}async function B4(e,t,n=20,r=`compact`){t.throwIfAborted();try{let i=(r===`compact`?await z4({sessionId:e,messageLimit:n,signal:t}):null)??await We(e,{limit:n,toolPayload:`summary`,initialPayload:r===`compact`?`compact`:void 0,signal:t});return t.throwIfAborted(),{messages:i.messages,status:i.status??`idle`,contextWindow:i.contextWindow??null,deferredToolPayloads:i.deferredToolPayloads??{},total:i.total,pageInfo:i.pageInfo}}catch(e){if(t.throwIfAborted(),!I4(e))throw e;return{messages:[],status:`idle`,total:0,deferredToolPayloads:{},pageInfo:{startCursor:null,hasPreviousPage:!1}}}}function V4(e){let{hydrationRetryVersion:t,messageLimit:n,onSeedLoaded:r}=e,i=(0,H.useRef)(new Set);return(0,H.useCallback)(async(e,t)=>{let a=await B4(e,t,n,i.current.has(e)?`standard`:`compact`);return t.aborted||(i.current.add(e),r(e,a)),{messages:a.messages,status:a.status}},[t,n,r])}var H4={sessionId:null,contextWindow:null,total:0,cursor:null,hasPreviousPage:!1,isLoading:!1,error:null,deferredToolPayloads:{},messageDetails:{},messageDetailStates:{}};function U4(e){let{historyStateRef:t,sessionId:n,updateHistoryState:r}=e,i=(0,H.useRef)(new Map);return(0,H.useEffect)(()=>{let e=i.current;for(let t of e.values())t.controller.abort();return e.clear(),()=>{for(let t of e.values())t.controller.abort();e.clear()}},[n]),(0,H.useCallback)(async e=>{if(!n)return;let a=t.current;if(a.sessionId!==n||a.messageDetails[e])return;let o=a.deferredToolPayloads[e]?.cursor;if(!o)return;let s=i.current.get(e);if(s)return await s.promise;let c=new AbortController;r(n,t=>({...t,messageDetailStates:{...t.messageDetailStates,[e]:`loading`}}));let l=(async()=>{try{let t=await Ue(n,e,o,c.signal);if(c.signal.aborted)return;r(n,n=>({...n,messageDetails:{...n.messageDetails,[e]:t},messageDetailStates:{...n.messageDetailStates,[e]:`ready`}}))}catch{if(c.signal.aborted)return;r(n,t=>({...t,messageDetailStates:{...t.messageDetailStates,[e]:`error`}}))}finally{i.current.get(e)?.controller===c&&i.current.delete(e)}})();i.current.set(e,{controller:c,promise:l}),await l},[t,n,r])}function W4(e){let{hydrationRetryVersion:t,messageLimit:n,sessionId:r}=e,[i,a]=(0,H.useState)(H4),o=(0,H.useRef)(H4),s=(0,H.useRef)(null),c=(0,H.useCallback)((e,t)=>{let n=t(o.current.sessionId===e?o.current:{...H4,sessionId:e});o.current=n,a(n)},[]);(0,H.useEffect)(()=>(s.current?.abort(),s.current=null,()=>{s.current?.abort()}),[r]);let l=U4({historyStateRef:o,sessionId:r,updateHistoryState:c});return{loadSeed:V4({hydrationRetryVersion:t,messageLimit:n,onSeedLoaded:(0,H.useCallback)((e,t)=>{c(e,e=>({...e,contextWindow:t.contextWindow??null,deferredToolPayloads:t.deferredToolPayloads,messageDetails:{},messageDetailStates:Object.fromEntries(Object.keys(t.deferredToolPayloads).map(e=>[e,`summary`])),total:t.total,cursor:t.pageInfo.startCursor,hasPreviousPage:t.pageInfo.hasPreviousPage,error:null}))},[c])}),loadPreviousMessages:(0,H.useCallback)(async e=>{let t=o.current;if(!r||t.sessionId!==r||!t.hasPreviousPage||!t.cursor||s.current)return;let i=new AbortController;s.current=i,c(r,e=>({...e,isLoading:!0,error:null}));try{let a=await We(r,{limit:n,cursor:t.cursor,toolPayload:`summary`,signal:i.signal});if(i.signal.aborted||s.current!==i)return;e(a.messages),c(r,e=>({...e,contextWindow:a.contextWindow??e.contextWindow,deferredToolPayloads:{...e.deferredToolPayloads,...a.deferredToolPayloads??{}},messageDetailStates:{...Object.fromEntries(Object.keys(a.deferredToolPayloads??{}).map(e=>[e,`summary`])),...e.messageDetailStates},total:a.total,cursor:a.pageInfo.startCursor,hasPreviousPage:a.pageInfo.hasPreviousPage}))}catch(e){i.signal.aborted||c(r,t=>({...t,error:e instanceof Error?e:Error(String(e))}))}finally{s.current===i&&(s.current=null,c(r,e=>({...e,isLoading:!1})))}},[n,r,c]),loadMessageDetails:l,state:i.sessionId===r?i:H4}}var G4=`ncp agent unavailable during startup`,K4=15e3,q4=7e4;function J4(e){return e?.trim().toLowerCase().includes(G4)??!1}function Y4(){return new k2({baseUrl:qt,basePath:`/api/ncp/agent`,fetchImpl:F4(),streamOpenTimeoutMs:K4,streamIdleTimeoutMs:q4})}function X4(e,t){let n=(0,H.useRef)(null),r=(0,H.useCallback)(e=>{if(!e){n.current=null;return}n.current!==e&&(n.current=e,t())},[t]);(0,H.useEffect)(()=>{r(e)},[e,r])}function Z4(e,t){return e.map(e=>{let n=t[e.id];return n?!e.metadata&&!n.metadata?n:{...n,metadata:{...e.metadata??{},...n.metadata??{}}}:e})}function Q4(e,t={}){let[n]=(0,H.useState)(()=>Y4()),r=Qe(),[i,a]=(0,H.useState)(0),[o,s]=(0,H.useState)(null),c=(0,H.useRef)(null),{loadSeed:l,loadMessageDetails:u,loadPreviousMessages:d,state:f}=W4({sessionId:e,messageLimit:t.messageLimit??20,hydrationRetryVersion:i}),p=T4({sessionId:e,client:n,loadSeed:l}),{acceptRun:m}=p,h=(0,H.useCallback)(async(e,t)=>{if(c.current)throw Error(`A session command is already in progress.`);c.current=e,s(e);try{let e=await t();return await m(e),e}finally{c.current===e&&(c.current=null),s(t=>t===e?null:t)}},[m]),g=(0,H.useCallback)(async e=>await h(e.sessionId,async()=>{let t={messages:p.visibleMessages,status:p.isRunning?`running`:`idle`},n=p.visibleMessages.findIndex(t=>t.id===e.messageId);if(n<0)throw Error(`The message being edited is no longer in the current session history.`);p.replaceHistory({messages:[...p.visibleMessages.slice(0,n),{...e.message,sessionId:e.sessionId}],status:`idle`});try{return await F.agentRuns.editMessage(e)}catch(n){p.replaceHistory(t);try{let t=new AbortController;p.replaceHistory(await l(e.sessionId,t.signal))}catch{}throw n}}),[p,h,l]),_=(0,H.useCallback)(async e=>await h(e.sessionId,()=>F.agentRuns.continue(e)),[h]),v=(0,H.useCallback)(async()=>await d(p.prependHistory),[p.prependHistory,d]),y=p.hydrateError?.message??p.snapshot.error?.message??null;X4(e&&r.phase===`ready`&&J4(y)?`${e}:${r.lastReadyAt??0}`:null,()=>{a(e=>e+1)});let b=(0,H.useMemo)(()=>Z4(p.visibleMessages,f.messageDetails),[p.visibleMessages,f.messageDetails]);return(0,H.useMemo)(()=>({...p,visibleMessages:b,isSending:p.isSending||o===e,editMessage:g,continueRun:_,snapshot:{...p.snapshot,contextWindow:p.snapshot.contextWindow??f.contextWindow},hasPreviousMessages:f.hasPreviousPage,historyError:f.error,isLoadingPreviousMessages:f.isLoading,loadPreviousMessages:v,loadMessageDetails:u,messageDetailStates:f.messageDetailStates,messageTotal:f.total}),[p,_,g,u,v,o,e,f,b])}function $4(e){return e.bootstrapStatus?.ncpAgent.state!==`ready`}function e3(e){return e.activeSystemAction?.message?.trim()||(e.lifecyclePhase===`cold-starting`?b(`chatRuntimeInitializing`):e.lifecyclePhase===`startup-failed`?e.bootstrapStatus?.ncpAgent.error?.trim()||e.bootstrapStatus?.lastError?.trim()||e.lastError?.trim()||b(`chatRuntimeInitializationFailed`):null)}function t3(e){let{message:t,status:n}=e,r=t?.trim();if(!r)return e3(n);let i=n.activeSystemAction?.message?.trim();if(n.phase===`service-transitioning`&&i)return i;let a=He(r);return n.phase===`recovering`&&a?b(`runtimeControlRecoveringHelp`):n.phase===`stalled`&&a?null:r}function n3(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}M`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:String(e)}function r3(e){if(!e||e.completeInputBudget!==!0||!e.fixedInputTokens||e.totalContextTokens<=0)return null;let t=e.triggerContextTokens??e.totalContextTokens,n=e.usedContextTokens/Math.max(1,t),r=Math.max(0,Math.min(1,n)),i=`${Math.round(r*100)}%`,a=r>=.9?`danger`:r>=.75?`warning`:`neutral`,o=[{label:b(`chatContextWindowUsed`),value:n3(e.usedContextTokens)}];return e.triggerContextTokens!==void 0&&o.push({label:b(`chatContextWindowTrigger`),value:n3(e.triggerContextTokens)}),o.push(e.availableBeforeCompactionTokens===void 0?{label:b(`chatContextWindowAvailable`),value:n3(e.availableContextTokens)}:{label:b(`chatContextWindowAvailableBeforeCompaction`),value:n3(e.availableBeforeCompactionTokens)}),e.fixedInputTokens!==void 0&&o.push({label:b(`chatContextWindowFixed`),value:n3(e.fixedInputTokens),dividerBefore:!0}),e.dynamicInputTokens!==void 0&&o.push({label:b(`chatContextWindowDynamic`),value:n3(e.dynamicInputTokens)}),e.reservedContextTokens!==void 0&&o.push({label:b(`chatContextWindowReserve`),value:n3(e.reservedContextTokens)}),o.push({label:b(`chatContextWindowTotal`),value:n3(e.totalContextTokens)}),e.prunedUsedContextTokens!==e.usedContextTokens&&o.push({label:b(`chatContextWindowPruned`),value:n3(e.prunedUsedContextTokens)}),e.droppedHistoryCount>0&&o.push({label:b(`chatContextWindowDroppedHistory`),value:String(e.droppedHistoryCount)}),e.truncatedToolResultCount>0&&o.push({label:b(`chatContextWindowTruncatedTools`),value:String(e.truncatedToolResultCount)}),{label:b(`chatContextWindow`),percentLabel:i,ratio:r,tone:a,details:o}}var i3=wr(`18rem`);function a3({agents:e,selectedAgent:t,selectedAgentId:n,onSelectAgent:r}){return(0,U.jsxs)(Or,{value:n,onValueChange:r,children:[(0,U.jsxs)(br,{"aria-label":b(`chatDraftAgentTitle`),className:`h-auto w-auto min-w-0 gap-1 rounded-lg border-0 bg-transparent px-2 py-1.5 text-muted-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus:ring-0`,children:[(0,U.jsx)(`span`,{className:`sr-only`,children:b(`chatDraftAgentTitle`)}),(0,U.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(az,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,U.jsx)(`span`,{className:`max-w-28 truncate text-sm font-medium`,children:t.displayName?.trim()||t.id})]}):null})]}),(0,U.jsx)(Cr,{className:`rounded-xl border-border shadow-lg`,style:{maxHeight:i3},children:e.map(e=>(0,U.jsx)(Er,{value:e.id,className:`rounded-lg pr-10`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(az,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName?.trim()||e.id})]})},e.id))})]})}var o3=[{labelKey:`chatWelcomeSuggestion1Label`,promptKey:`chatWelcomeSuggestion1Prompt`},{labelKey:`chatWelcomeSuggestion2Label`,promptKey:`chatWelcomeSuggestion2Prompt`},{labelKey:`chatWelcomeSuggestion3Label`,promptKey:`chatWelcomeSuggestion3Prompt`}];function s3({onSelectPrompt:e}){return(0,U.jsx)(`div`,{className:`mt-5 flex flex-wrap justify-center gap-2`,children:o3.map(t=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>e(b(t.promptKey)),className:`rounded-full bg-muted/55 px-3.5 py-2 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:b(t.labelKey)},t.labelKey))})}var c3=xF(`20rem`);function l3({isSaving:e,projectOptions:t,projectRoot:n,selectable:r,onOpenProjectDialog:i,onSelectProjectRoot:a}){let[o,s]=(0,H.useState)(!1),c=mI(n)??b(`chatWelcomeProjectPickerPlaceholder`),l=async e=>{s(!1),await a(e)};return(0,U.jsxs)(CF,{open:o,onOpenChange:s,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:n??void 0,"aria-label":b(`chatWelcomeProjectPickerLabel`),disabled:!r||e,children:[(0,U.jsx)(qa,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:c}),(0,U.jsx)(or,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,U.jsxs)(EF,{align:`start`,className:`flex w-[min(20rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-border bg-popover p-0 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,style:{maxHeight:c3},children:[(0,U.jsx)(`div`,{className:`shrink-0 px-3 pb-2 pt-3 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:b(`chatWelcomeProjectRecentTitle`)}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1.5 pb-1.5`,children:t.length>0?t.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full min-w-0 items-start gap-2 rounded-xl px-2 py-2 text-left transition-colors hover:bg-[var(--interaction-hover)]`,title:e.projectRoot,onClick:()=>{l(e.isDefault?null:e.projectRoot)},children:[(0,U.jsx)(qa,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,U.jsx)(`span`,{className:`truncate text-[13px] font-semibold text-foreground`,children:e.projectName}),e.isDefault?(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:b(`chatWelcomeProjectDefaultBadge`)}):null]}),(0,U.jsx)(`span`,{className:`block truncate text-[11px] leading-4 text-muted-foreground`,children:e.projectRoot})]}),e.sessionCount>0?(0,U.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:e.sessionCount}):null]},e.projectRoot)):(0,U.jsx)(`div`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:b(`chatWelcomeProjectNoRecent`)})}),(0,U.jsx)(`div`,{className:`shrink-0 border-t border-border p-1.5`,children:(0,U.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-xl px-2.5 py-2 text-left text-[13px] font-semibold text-foreground transition-colors hover:bg-[var(--interaction-hover)]`,onClick:()=>{s(!1),i()},children:[(0,U.jsx)(qa,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{children:b(`chatWelcomeProjectOpenFolder`)})]})})]})]})}function u3(e){let{disabled:t=!1,option:n,onSelect:r,selected:i=!1}=e,a=n.ready===!1?n.reasonMessage?.trim()||b(`statusSetup`):null;return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i,disabled:t,onClick:r,className:u(`w-full rounded-2xl px-3 py-2.5 text-left transition-colors`,i?`bg-gray-50`:`hover:bg-gray-50`,t?`cursor-not-allowed opacity-70`:null),children:(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[n.icon?.src?(0,U.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:n.icon.src,alt:n.icon.alt??null,name:n.label}})}):(0,U.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-muted-foreground`,children:(0,U.jsx)(la,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:n.label}),(0,U.jsx)(ws,{status:n.ready===!1?`warning`:`ready`,label:n.ready===!1?b(`statusSetup`):b(`statusReady`),className:`bg-transparent px-0`})]}),a?(0,U.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:a}):null]})]}),i?(0,U.jsx)(jr,{className:`mt-1 h-3.5 w-3.5 shrink-0 text-primary`}):null]})})}var d3=xF(`18rem`);function f3({options:e,selectedSessionType:t,onSelectSessionType:n}){let[r,i]=(0,H.useState)(!1),a=e.find(e=>e.value===t)??e[0]??null;return a?(0,U.jsxs)(CF,{open:r,onOpenChange:i,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":b(`chatWelcomeSessionTypePickerLabel`),children:[a.icon?.src?(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},className:`h-4 w-4`}):(0,U.jsx)(la,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:a.label}),(0,U.jsx)(or,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,U.jsx)(EF,{align:`start`,className:`flex w-[min(16rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,style:{maxHeight:d3},children:(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e.map(e=>(0,U.jsx)(u3,{option:e,onSelect:()=>{n(e.value),i(!1)}},e.value))})})]}):null}function p3({agents:e,defaultProjectRoot:t,inputSlot:n,projectOptions:r,selectedAgentId:i,selectedProjectRoot:a,selectedSessionType:o,sessionTypeOptions:s,onSelectAgent:c,onSelectPrompt:l,onSelectProjectRoot:u,onSelectSessionType:d}){let f=e.find(e=>e.id===i)??null,[p,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(!1),_=a??t??null,v=async e=>{if(u){g(!0);try{await u(e),m(!1)}finally{g(!1)}}},y=!!u;return(0,U.jsxs)(`div`,{className:`flex min-h-full items-center justify-center px-4 py-10 sm:p-8`,children:[(0,U.jsxs)(`div`,{className:`w-full min-w-0 max-w-[min(680px,100%)]`,children:[(0,U.jsx)(`div`,{className:`text-center`,children:(0,U.jsx)(`h2`,{className:`text-2xl font-semibold leading-tight text-foreground sm:text-[2rem]`,children:b(`chatWelcomeTitle`)})}),n?(0,U.jsx)(`div`,{className:`mt-6`,children:n}):null,(0,U.jsx)(`div`,{className:`mt-2 flex justify-center px-1`,children:(0,U.jsxs)(`div`,{role:`group`,"aria-label":b(`chatWelcomeContextLabel`),className:`flex min-w-0 max-w-full flex-wrap items-center justify-center gap-0.5 rounded-xl bg-muted/40 p-1 text-sm text-muted-foreground`,children:[u?(0,U.jsx)(l3,{isSaving:h,projectOptions:r,projectRoot:_,selectable:y,onOpenProjectDialog:()=>m(!0),onSelectProjectRoot:v}):null,(0,U.jsx)(a3,{agents:e,selectedAgent:f,selectedAgentId:i,onSelectAgent:c}),(0,U.jsx)(f3,{options:s,selectedSessionType:o,onSelectSessionType:d})]})}),(0,U.jsx)(s3,{onSelectPrompt:l})]}),u?(0,U.jsx)(qF,{open:p,currentProjectRoot:_,defaultWorkspacePath:t,isSaving:h,onOpenChange:m,onSave:v}):null]})}function m3(e){let{agents:t,fallbackAgentId:n}=e;return(t?.length??0)>0?t??[]:[{id:n}]}function h3(e){return e.agents.find(t=>t.id===e.agentId)??null}function g3(e,t){if(typeof e!=`string`||e.trim().length===0)return null;let n=EL(e);return t.some(e=>e.value===n)?n:null}function _3(e){let{agentId:t,agents:n,defaultSessionType:r,pendingSessionType:i,selectedSessionType:a,sessionTypeOptions:o}=e;return(g3(a,o)??g3(i,o))||((n&&t?g3(DL(h3({agents:n,agentId:t}),r),o):null)??g3(r,o)??o[0]?.value??EL(r))}function v3(e){return new Date(e.lastMessageAt??e.createdAt).getTime()}function y3(e){let{defaultProjectRoot:t,projects:n=[],sessionSummaries:r}=e,i=new Map;for(let e of n)e.rootPath!==t&&i.set(e.rootPath,{projectRoot:e.rootPath,projectName:e.name,sessionCount:0,isDefault:!1,latestUpdatedAt:new Date(e.updatedAt).getTime()});for(let e of qI([...r])){let n=e.projectRoot?.trim();if(!n||n===t)continue;let r=i.get(n),a=v3(e);if(r){r.sessionCount+=1,r.latestUpdatedAt=Math.max(r.latestUpdatedAt,a);continue}i.set(n,{projectRoot:n,projectName:e.projectName?.trim()||mI(n)||n,sessionCount:1,isDefault:!1,latestUpdatedAt:a})}return t&&i.set(t,{projectRoot:t,projectName:mI(t)||t,sessionCount:0,isDefault:!0,latestUpdatedAt:1/0}),[...i.values()].sort((e,t)=>t.latestUpdatedAt-e.latestUpdatedAt).map(({latestUpdatedAt:e,...t})=>t)}var b3=[];function x3({inputSlot:e,pendingProjectRoot:t,pendingSessionType:n,selectedSessionTypeValue:r,onSelectProjectRoot:i,onSelectPrompt:a,onSelectSessionType:o}){let s=eI(),c=aL(e=>e.snapshot.selectedAgentId),l=$(e=>e.snapshot),u=eR(e=>e.snapshot.configQuery?.data??null),d=eR(e=>e.snapshot.sessionsQuery?.data?.sessions??b3),f=eR(e=>e.snapshot.sessionTypesQuery?.data??null),p=oz(),m=nR(),h=l.agentId??c,g=m3({agents:p.data?.agents,fallbackAgentId:h}),_=pI(u?.agents.defaults.workspace),v=pI(t),y=kL(f?.options??[]),b=EL(f?.defaultType??`native`),x=_3({defaultSessionType:b,pendingSessionType:n,selectedSessionType:r,sessionTypeOptions:y}),S=y3({defaultProjectRoot:_,projects:m.data?.projects??[],sessionSummaries:d});return(0,U.jsx)(p3,{agents:g,defaultProjectRoot:_,inputSlot:e,projectOptions:S,selectedAgentId:h,selectedProjectRoot:v,selectedSessionType:x,sessionTypeOptions:y,onSelectAgent:e=>{s.chatSessionListManager.setSelectedAgentId(e),o(_3({agents:g,agentId:e,defaultSessionType:b,pendingSessionType:null,selectedSessionType:null,sessionTypeOptions:y}))},onSelectPrompt:a,onSelectProjectRoot:i,onSelectSessionType:o})}function S3(e){return e.modelOptions.length>0}function C3(e){return!e.isProviderStateResolved&&!S3(e)}function w3(e){return e.isProviderStateResolved&&!S3(e)}function T3(e){return!1}function E3(e){let{hasSendableDraft:t,isRuntimeBlocked:n}=e;return n||!t}function D3(e){return{...e.metadata,...e.message.metadata}}function O3(e){let t=gW(D3(e)),n=e.message.parts.flatMap(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?[e.text]:[]).join(` `);return t.reduce((e,t)=>e.split(t.rawText).join(``),n).replace(/\s+/g,` `).trim()}function k3(e){if(!e.mimeType?.startsWith(`image/`))return;let t=e.url?.trim();if(t)return t;let n=e.contentBase64?.trim();if(n)return`data:${e.mimeType};base64,${n}`;let r=e.assetUri?.trim();return r?Se(r):void 0}function A3(e){return{attachments:e.message.parts.flatMap((e,t)=>{if(e.type!==`file`)return[];let n=e.mimeType??`application/octet-stream`,r=k3(e);return[{mimeType:n,name:e.name?.trim()||`attachment-${t+1}`,...r?{previewUrl:r}:{}}]}),preview:O3(e)}}function j3(e,t){return W0({attachmentIdPrefix:`queued-attachment-${e.id}`,availableSkills:t,message:e.message,metadata:D3(e)})}function M3(e){return e instanceof rn&&e.status===404&&e.code===`NOT_FOUND`}function N3(e){let t=e.sessionId?.trim();if(!t)return null;let n={id:`submitting-${e.message.id}`,sessionId:t,enqueuedAt:new Date().toISOString(),message:{...e.message,sessionId:t},metadata:structuredClone(e.metadata??{})},r=A3(n);return{attachments:r.attachments,id:n.id,preview:r.preview,sessionId:t,userMessageId:n.message.id}}function P3(e,t){let[n,r]=(0,H.useState)(null),i=(0,H.useCallback)(e=>{let t=N3(e);return t&&r(t),t},[]);return{clearSubmittingInput:(0,H.useCallback)(e=>{r(t=>t?.userMessageId===e.userMessageId?null:t)},[]),queuedInputs:(0,H.useMemo)(()=>{let r=e.map(e=>({...A3(e),id:e.id}));return n?.sessionId===t&&!e.some(e=>e.message.id===n.userMessageId)&&r.push({attachments:n.attachments,id:n.id,isSubmitting:!0,preview:n.preview}),r},[e,t,n]),stageSubmittingInput:i}}function F3(e){let{availableSkills:t,hasComposerContent:n,restoreComposer:r,runQueue:i,setSendError:a}=e,o=(0,H.useCallback)(e=>{if(n){a(b(`chatQueuedEditComposerNotEmpty`));return}i.inputs.some(t=>t.id===e)&&i.removeQueuedInput(e).then(e=>{e&&(r(j3(e,t)),a(null))}).catch(e=>{a(e instanceof Error?e.message:String(e))})},[t,n,r,i,a]);return{deleteQueuedInput:(0,H.useCallback)(e=>{i.removeQueuedInput(e).then(()=>a(null)).catch(e=>{a(e instanceof Error?e.message:String(e))})},[i,a]),editQueuedInput:o,steerQueuedInput:(0,H.useCallback)(e=>{i.steerQueuedInput(e).then(e=>{e&&a(null)}).catch(async e=>{if(M3(e))try{await i.refreshPendingInputs(),a(null);return}catch(e){a(e instanceof Error?e.message:String(e));return}a(e instanceof Error?e.message:String(e))})},[i,a])}}function I3({agent:e,sessionKey:t,setSendError:n}){return{continueRun:(0,H.useCallback)(async()=>{if(!(!t||e.isSending||e.isRunning)){n(null);try{await e.continueRun({sessionId:t})}catch(e){throw n(e instanceof Error?e.message:String(e)),e}}},[e,t,n]),editMessage:(0,H.useCallback)(async r=>{if(!(!t||e.isSending||e.isRunning)){n(null);try{await e.editMessage({message:r.message,messageId:r.messageId,sessionId:t})}catch(e){throw n(e instanceof Error?e.message:String(e)),e}}},[e,t,n])}}var L3=e=>e.some(e=>e.type!==`text`||e.text.trim().length>0),R3=e=>e?.trim()||void 0;function z3(e){return{isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeState.sessionTypeUnavailable}}function B3(e){let{agentIsSending:t,composerSnapshot:n,inputQuery:r,inputSnapshot:i,isRuntimeBlocked:a,materializationContext:o,selectedAgentId:s,sessionKey:c}=e,l=n??{text:i.text,nodes:[...i.nodes],selectedSkills:[...i.selectedSkills],skillRecords:[...i.skillRecords],attachments:[...i.attachments]},u=F0([...l.nodes],l.attachments);return E3({snapshot:z3(r),hasSendableDraft:L3(u),isRuntimeBlocked:a})||t?null:{composerSnapshot:l,metadata:R0({agentId:o?void 0:r.selectedSession?.agentId?.trim()||s,model:R3(o?i.selectedModel:i.selectedModel??r.fallbackPreferredModel??r.defaultModel),thinkingLevel:o?i.selectedThinkingLevel??void 0:i.selectedThinkingLevel??r.fallbackPreferredThinking??void 0,sessionType:o?void 0:r.sessionTypeState.selectedSessionType,projectRoot:o?i.pendingProjectRoot:c?r.selectedSession?.projectRoot??null:i.pendingProjectRoot,requestedSkills:[...l.selectedSkills],skillRecords:r.skillRecords.filter(e=>l.selectedSkills.includes(e.ref)),composerNodes:[...l.nodes],sessionMaterialization:o?{kind:o.kind,parentSessionId:o.parentSessionKey,inheritContext:o.inheritContext}:null})}}function V3(e,t,n=`queue`){let r=A4({sessionId:t??void 0,text:e.composerSnapshot.text.trim(),attachments:[...e.composerSnapshot.attachments],parts:F0([...e.composerSnapshot.nodes],e.composerSnapshot.attachments),metadata:e.metadata});return r?{...r,delivery:n}:null}function H3(e){let{agent:t,clearSubmittingInput:n,materializationContext:r,onSessionMaterialized:i,resetComposer:a,restoreComposer:o,runQueue:s,sessionKey:c,setSendError:l,stageSubmittingInput:u}=e;return(0,H.useCallback)(async(e,d,f=`queue`)=>{let p=V3(e,c??(r?null:JI()),f);if(!p)return;let m=t.isRunning&&f===`queue`?u(p):null;d===`reset-and-restore`&&a(),l(null);try{let e=await t.send(p);e?.delivery===`steered`?await s.refreshPendingInputs().catch(()=>void 0):e?.delivery===`queued`&&await s.refreshQueuedInputs().catch(()=>void 0),m&&n(m);let r=e?.sessionId?.trim()||t.snapshot.activeRun?.sessionId?.trim()||null;!c&&r&&i?.(r)}catch(t){throw m&&n(m),d===`reset-and-restore`&&o(e.composerSnapshot),l(t instanceof Error?t.message:String(t)),t}},[t,n,r,i,a,o,s,c,l,u])}function U3(e){let{agent:t,inputQuery:n,inputSnapshot:r,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:o,sessionKey:s,submitDraft:c}=e;return(0,H.useCallback)(async()=>{let e=B3({agentIsSending:t.isSending,inputSnapshot:r,inputQuery:n,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:o,sessionKey:s});e&&await c(e,`reset-and-restore`,`prefer-steer`)},[t.isSending,n,r,i,a,o,s,c])}function W3(e){let{agent:t,continueRun:n,inputQuery:r,inputSnapshot:i,isRuntimeBlocked:a,materializationContext:o,primaryAction:s,selectedAgentId:c,sessionKey:l,submitDraft:u}=e;return(0,H.useCallback)(async()=>{if(s===`continue`)return await n();let e=B3({agentIsSending:t.isSending,inputSnapshot:i,inputQuery:r,isRuntimeBlocked:a,materializationContext:o,selectedAgentId:c,sessionKey:l});e&&await u(e,`reset-and-restore`)},[t.isSending,n,r,i,a,o,s,c,l,u])}function G3(e){let{agent:t,inputSnapshot:n,inputQuery:r,isRuntimeBlocked:i,materializationContext:a,runQueue:o,selectedAgentId:s,sessionKey:c,onSessionMaterialized:l,resetComposer:u,restoreComposer:d,setSendError:f}=e,{clearSubmittingInput:p,queuedInputs:m,stageSubmittingInput:h}=P3(o.inputs,c),g=L3((0,H.useMemo)(()=>F0([...n.nodes],n.attachments),[n.attachments,n.nodes])),{deleteQueuedInput:_,editQueuedInput:v,steerQueuedInput:y}=F3({availableSkills:r.skillRecords,hasComposerContent:g,restoreComposer:d,runQueue:o,setSendError:f}),b=t.isSending||t.isRunning,x=r.selectedSession?.activityPreview?.state,S=!!(c&&!b&&!i&&(x===`cancelled`||x===`failed`)),C=S&&!g?`continue`:`send`,w=C===`continue`?!1:E3({snapshot:z3(r),hasSendableDraft:g,isRuntimeBlocked:i})||t.isSending,{continueRun:T,editMessage:E}=I3({agent:t,sessionKey:c,setSendError:f}),D=H3({agent:t,clearSubmittingInput:p,materializationContext:a,onSessionMaterialized:l,resetComposer:u,restoreComposer:d,runQueue:o,sessionKey:c,setSendError:f,stageSubmittingInput:h}),O=W3({agent:t,continueRun:T,inputQuery:r,inputSnapshot:n,isRuntimeBlocked:i,materializationContext:a,primaryAction:C,selectedAgentId:s,sessionKey:c,submitDraft:D}),k=U3({agent:t,inputQuery:r,inputSnapshot:n,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:s,sessionKey:c,submitDraft:D}),A=(0,H.useCallback)(async e=>{let o=e.trim();if(!o)return;let l=B3({agentIsSending:t.isSending,composerSnapshot:{text:o,nodes:k0(o),selectedSkills:[],skillRecords:[],attachments:[]},inputSnapshot:n,inputQuery:r,isRuntimeBlocked:i,materializationContext:a,selectedAgentId:s,sessionKey:c});l&&await D(l,`preserve`)},[t.isSending,r,n,i,a,s,c,D]),j=(0,H.useCallback)(async()=>{await t.abort()},[t]);return{canContinue:S,canStopGeneration:t.isRunning,continueRun:T,deleteQueuedInput:_,editMessage:E,editQueuedInput:v,canEditQueuedInput:!g,hasSendableDraft:g,isSending:b,queuedInputs:m,send:O,sendSteering:k,sendPresetMessage:A,sendDisabled:w,primaryAction:C,stop:j,stopDisabled:!t.isRunning,steerQueuedInput:y}}var K3=[`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`],q3=new Set(K3);function J3(e){if(!e||e.length===0)return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function Y3(e,t){let n=e.trim(),r=t.trim();if(!n||!r)return n;let i=`${r}/`;return n.startsWith(i)?n.slice(i.length):n}function X3(e,t){let n=e.trim();if(!n)return``;for(let e of t)n=Y3(n,e);return n.trim()}function Z3(e,t){let n=t.trim(),r=e.trim();return n?r?`${r}/${n}`:n:``}function Q3(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();return t&&q3.has(t)?t:null}function $3(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=Q3(n);!e||t.includes(e)||t.push(e)}return t}function e6(e){return e.includes(`off`)?[...e]:[`off`,...e]}function t6(e,t){if(!e)return{};let n={};for(let[r,i]of Object.entries(e)){let e=X3(r,t);if(!e)continue;let a={},o=$3(i?.thinking?.supported);if(o.length>0){let e=Q3(i?.thinking?.default);a.thinking=e&&o.includes(e)?{supported:o,default:e}:{supported:o}}i?.vision===!0&&(a.vision=!0),(a.thinking||a.vision===!0)&&(n[e]=a)}return n}function n6(e){return Object.fromEntries(Object.entries(e).filter(e=>!!e[1].thinking).map(([e,t])=>[e,t.thinking]))}function r6(e,t,n){let r=X3(t,n);return r?e[r]??null:null}function i6(e,t){let n=e.trim();if(!n)return null;let r=null;for(let e of t)for(let t of e.aliases){let i=t.trim();i&&(n===i||n.startsWith(`${i}/`))&&(!r||i.length>r.score)&&(r={name:e.name,score:i.length})}if(r)return r.name;for(let e of t){let t=X3(n,e.aliases);if(t&&J3(e.models??[]).some(e=>e===t))return e.name}return null}function a6(e){return e?e.enabled!==!1&&(e.apiKeyRequired===!1||e.apiKeySet===!0):!1}function o6(e){let{providersView:t,templatesView:n,config:r,onlyConfigured:i=!1}=e,a=new Map((n?.providerTemplates??[]).map(e=>[e.providerType,e])),o=Object.values(t?.providers??r?.providers??{}).map(e=>{let{providerId:t}=e,n=e.providerType?a.get(e.providerType):void 0,r=t.trim(),i=J3([t,n?.modelPrefix||``,n?.providerType||``]),o=J3((e?.models??[]).map(e=>X3(e,i))),s={...t6(n?.modelConfig,i),...t6(e?.modelConfig,i)},c=n6(s),l=e?.displayName?.trim(),u=a6(e);return{name:t,displayName:l||n?.displayName||t,prefix:r,aliases:i,models:o,modelConfig:s,modelThinking:c,configured:u}});return i?o.filter(e=>e.configured&&e.models.length>0):o}function s6(e,t){return{value:D,modelLabel:e,providerLabel:``,isRuntimeDefault:!0,thinkingCapability:t??null}}function c6(e){let t=new Set;return o6({providersView:e.providersView??void 0,templatesView:e.templatesView??void 0,config:e.config??void 0,onlyConfigured:!0}).flatMap(e=>e.models.map(n=>{let r=Z3(e.prefix,n);return!r||t.has(r)?null:(t.add(r),{value:r,modelLabel:n,providerLabel:e.displayName,thinkingCapability:r6(e.modelThinking,n,e.aliases)})})).filter(e=>e!==null).sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})}function l6(e){let{catalogView:t,config:n,providersView:r,templatesView:i}=e,a=t?.providers??{},o=new Set;return o6({providersView:r??void 0,templatesView:i??void 0,config:n??void 0}).flatMap(e=>{if(!e.configured)return[];let t=new Set(e.models);return(a[e.name]?.models??[]).map(n=>{let r=X3(n,e.aliases),i=Z3(e.prefix,r);return!r||!i||t.has(r)||o.has(i)?null:(o.add(i),{value:i,providerId:e.name,providerModel:r,modelLabel:r,providerLabel:e.displayName,thinkingCapability:r6(e.modelThinking,r,e.aliases)})}).filter(e=>e!==null)})}function u6(e){let{modelOptions:t,modelSelectionMode:n,supportedModels:r}=e;if(n===`runtime-default`)return[];if(!r||r.length===0)return t;let i=new Set(r);return t.filter(e=>i.has(e.value))}function d6(e){let{modelOptions:t,modelSelectionMode:n,runtimeDefaultThinkingCapability:r,runtimeDefaultModelLabel:i=`Runtime default`,supportedModels:a}=e,o=s6(i,r);if(n===`runtime-default`)return[o];if(!a||a.length===0)return n===`optional`?[o,...t]:t;let s=new Set(a),c=t.filter(e=>s.has(e.value)),l=c.length>0?c:t;return n===`optional`?[o,...l]:l}function f6(e){return e?.trim().toLowerCase()||`native`}function p6(e,t){if(typeof t!=`string`)return!1;let n=t.trim();return n?e.some(e=>e.value===n):!1}function m6(e,t){return typeof t==`string`&&e.includes(t)}function h6(e){return e.length===0?null:e.includes(`off`)?`off`:e[0]??null}function g6(e){let{currentValue:t,selectedSessionPreferredValue:n,fallbackPreferredValue:r,defaultValue:i,isValueSupported:a,firstAvailableValue:o,preferSessionPreferredValue:s=!1,preserveCurrentValueOnSessionChange:c=!1}=e;return a(t)&&(!s||c)?t:a(n)?n:a(r)?r:a(i)?i:o}function _6(e){let{modelOptions:t,currentSelectedModel:n,selectedSessionPreferredModel:r,fallbackPreferredModel:i,defaultModel:a,preferSessionPreferredModel:o,preserveCurrentSelectedModelOnSessionChange:s}=e;return t.length===0?``:g6({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>p6(t,e),firstAvailableValue:t[0]?.value??``,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function v6(e){let{supportedThinkingLevels:t,currentSelectedThinkingLevel:n,selectedSessionPreferredThinking:r,fallbackPreferredThinking:i,defaultThinkingLevel:a,preferSessionPreferredThinking:o,preserveCurrentSelectedThinkingOnSessionChange:s}=e;if(t.length===0)return null;let c=e6(t);return g6({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>m6(c,e),firstAvailableValue:h6(c)??`off`,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function y6(e){let{sessions:t,selectedSessionKey:n,sessionType:r,readPreference:i}=e,a=f6(r),o,s=-1/0;for(let e of t){if(e.key===n||f6(e.sessionType)!==a)continue;let t=i(e);if(t==null)continue;let r=Date.parse(e.updatedAt),c=Number.isFinite(r)?r:-1/0;(o===void 0||c>s)&&(o=t,s=c)}return o}function b6(e){let{selectedSession:t,pendingSessionType:n,setPendingSessionType:r,sessionTypesData:i}=e,a=(0,H.useMemo)(()=>kL(i?.options??[]),[i?.options]),o=(0,H.useMemo)(()=>{let e=[...a],n=EL(t?.sessionType);return e.some(e=>e.value===n)||e.push({value:n,label:OL(n),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,modelSelectionMode:`nextclaw`,runtimeDefaultThinking:null,cta:null}),e.sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))},[a,t?.sessionType]),s=(0,H.useMemo)(()=>EL(i?.defaultType??`native`),[i?.defaultType]),c=(0,H.useRef)(null),l=typeof n==`string`&&n.trim().length>0?n:void 0,u=(0,H.useMemo)(()=>EL(t?.sessionType??l??s),[s,l,t?.sessionType]),d=(0,H.useMemo)(()=>o.find(e=>e.value===u)??null,[u,o]);(0,H.useEffect)(()=>{if(t)return;let e=typeof n==`string`?n.trim():``,i=EL(n);(e.length===0||c.current===i||c.current===null&&i===`native`)&&(c.current=s,i!==s&&r(s))},[s,n,t,r]);let f=!t||!!t.sessionTypeMutable,p=(0,H.useMemo)(()=>new Set(a.map(e=>e.value)),[a]),m=(0,H.useMemo)(()=>t&&!p.has(EL(t.sessionType))?!0:d?.ready===!1,[p,t,d?.ready]),h=(0,H.useMemo)(()=>t&&!p.has(EL(t.sessionType))?`${OL(u)} ${b(`chatSessionTypeUnavailableSuffix`)}`:d?.ready===!1?d.reasonMessage?.trim()||`${d.label} setup required`:null,[p,t,u,d]);return(0,H.useMemo)(()=>({sessionTypeOptions:o,selectedSessionTypeOption:d,defaultSessionType:s,selectedSessionType:u,canEditSessionType:f,sessionTypeUnavailable:m,sessionTypeUnavailableMessage:h}),[f,s,u,d,o,m,h])}var x6=`nextclaw.chat.recent-selection.store`;function S6(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function C6(e,t){return Array.isArray(e)?Array.from(new Set(e.map(S6).filter(e=>!!e))).slice(0,t):[]}function w6(e,t){let n=S6(t?.namespace);return n?`${e.storageKey}.${encodeURIComponent(n.toLowerCase())}`:e.storageKey}function T6(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){let e=S6(n);if(!e)continue;let i=C6(r,1/0);i.length>0&&(t[e]=i)}return t}var E6=P()(Mi(e=>({entriesByKey:{},setEntries:(t,n)=>e(e=>({entriesByKey:{...e.entriesByKey,[t]:C6(n,1/0)}}))}),{name:x6,storage:Ni(()=>window.localStorage),partialize:e=>({entriesByKey:e.entriesByKey}),merge:(e,t)=>({...t,entriesByKey:T6(e?.entriesByKey)})})),D6=class{constructor(e){this.options=e,this.read=(e={})=>{let t=w6(this.options,e);return C6(E6.getState().entriesByKey[t],this.options.limit)},this.remember=(e,t={})=>{let n=S6(e);if(!n)return this.read(t);let r=w6(this.options,t),i=[n,...this.read(t).filter(e=>e!==n)].slice(0,this.options.limit);return E6.getState().setEntries(r,i),i},this.resolveVisible=e=>{let t=C6(e.availableValues,1/0);if(t.length<=e.minAvailableCount)return[];let n=new Set(t),r=[],i=Math.max(1,e.limit??this.options.limit);for(let t of this.read(e))if(!(!n.has(t)||r.includes(t))&&(r.push(t),r.length>=i))break;return r}}},O6=new D6({storageKey:`nextclaw.chat.recent-models`,limit:3});function k6(){return z({queryKey:[`config`],queryFn:tee,staleTime:3e4,refetchOnWindowFocus:!0})}function A6(){return z({queryKey:[`config-meta`],queryFn:Ht,staleTime:1/0})}function j6(){return z({queryKey:[`product-analytics-status`],queryFn:en,staleTime:15e3,refetchOnWindowFocus:!0})}function M6(){return z({queryKey:[`providers`],queryFn:At,staleTime:3e4,refetchOnWindowFocus:!0})}function N6(){return z({queryKey:[`provider-templates`],queryFn:Nt,staleTime:1/0})}function P6(e={}){return z({queryKey:[`provider-model-catalog`],queryFn:Gt,staleTime:3e4,refetchInterval:t=>e.pollWhileRefreshing&&t.state.data?.refreshing?1e3:!1,refetchOnMount:e.refreshOnMount?`always`:!0,refetchOnWindowFocus:!0})}function F6(){return z({queryKey:[`config-schema`],queryFn:pn,staleTime:1/0})}function I6(){let e=xe();return R({mutationFn:vn,onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),I.success(b(`configSaved`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function L6(){let e=xe();return R({mutationFn:({data:e})=>ot(e),onSuccess:t=>{e.setQueryData([`config`],e=>e&&{...e,productAnalytics:t}),e.invalidateQueries({queryKey:[`product-analytics-status`]}),I.success(b(`configSavedApplied`))},onError:e=>{I.error(`${b(`configSaveFailed`)}: ${e.message}`)}})}function R6(){let e=xe();return R({mutationFn:({data:e})=>qe(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),I.success(b(`configSavedApplied`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function z6(){let e=xe();return R({mutationFn:({provider:e,data:t})=>Me(e,t),onSuccess:(t,n)=>{e.setQueryData([`providers`],e=>e&&{providers:{...e.providers,[n.provider]:t}}),e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),n.silentSuccess||I.success(b(`configSaved`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function B6(){let e=xe();return R({mutationFn:({data:e})=>Jt(e??{}),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),I.success(b(`configSaved`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function V6(){let e=xe();return R({mutationFn:({provider:e})=>Ft(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`providers`]}),e.invalidateQueries({queryKey:[`config`]}),I.success(b(`configSaved`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function H6(){return R({mutationFn:({provider:e,data:t})=>rt(e,t)})}function U6(){return R({mutationFn:({provider:e,data:t})=>vt(e,t)})}function W6(){return R({mutationFn:({provider:e,data:t})=>xn(e,t)})}function G6(){return R({mutationFn:({provider:e,data:t})=>hn(e,t)})}function K6(){return R({mutationFn:({provider:e})=>ht(e)})}function q6(){let e=xe();return R({mutationFn:({channel:e,data:t})=>Ee(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),e.invalidateQueries({queryKey:[`config-meta`]}),I.success(b(`configSavedApplying`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function J6(){let e=xe();return R({mutationFn:({data:e})=>ke(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),I.success(b(`configSavedApplied`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function Y6(){let e=xe();return R({mutationFn:({data:e})=>zt(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`config`]}),I.success(b(`configSavedApplied`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}})}function X6(){return R({mutationFn:({actionId:e,data:t})=>Zt(e,t),onError:e=>{I.error(b(`error`)+`: `+e.message)}})}var Z6=`nextclaw.chat.provider-model-catalog-notices`,Q6=1,$6={version:Q6,acknowledgedModelsByProvider:{}};function e8(){return typeof window>`u`?null:window.localStorage}function t8(e){let t=new Map;for(let n of e){let e=t.get(n.providerId)??[];e.includes(n.value)||(e.push(n.value),t.set(n.providerId,e))}return t}var n8=new class{constructor(){this.read=()=>{let e=e8();if(!e)return $6;try{let t=JSON.parse(e.getItem(Z6)??`null`);return t?.version===Q6&&t.acknowledgedModelsByProvider?{version:Q6,acknowledgedModelsByProvider:t.acknowledgedModelsByProvider}:$6}catch{return $6}},this.write=e=>{let t=e8();if(!t)return!1;try{return t.setItem(Z6,JSON.stringify(e)),!0}catch{return!1}},this.initializeLargeCatalogs=e=>{let t={...this.read().acknowledgedModelsByProvider},n=!1;for(let[r,i]of t8(e))i.length>50&&!Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=i,n=!0);return n&&this.write({version:Q6,acknowledgedModelsByProvider:t})},this.filterUnseen=e=>{let t=this.read().acknowledgedModelsByProvider,n=t8(e);return e.filter(e=>{let r=t[e.providerId];return r?!r.includes(e.value):(n.get(e.providerId)?.length??0)<=50})},this.acknowledge=e=>{if(e.length===0)return!1;let t={...this.read().acknowledgedModelsByProvider},n=!1;for(let[r,i]of t8(e)){let e=t[r]??[],a=new Set(e),o=[...e];for(let e of i)a.has(e)||(a.add(e),o.push(e),n=!0);t[r]=o}return n&&this.write({version:Q6,acknowledgedModelsByProvider:t})}}},r8=`__nextclaw-preview__`,i8=[{providerId:`opencode`,providerLabel:`OpenCode Zen Free Trial`,models:[`deepseek-v4-flash-free`,`laguna-s-2.1-free`,`longcat-2.0-free`,`mimo-v2.5-free`,`nemotron-3-ultra-free`,`north-mini-code-free`,`trinity-large-preview-free`]},{providerId:`openrouter`,providerLabel:`OpenRouter`,models:[`inclusionai/ling-3.0-tiny:free`,`qwen/qwen3-coder:free`,`deepseek/deepseek-r1:free`,`mistralai/mistral-small:free`,`google/gemma-3-27b-it:free`]},{providerId:`kimi`,providerLabel:`Kimi`,models:[`kimi-k2.5-preview`,`kimi-dev-72b`,`moonshot-v1-128k-preview`]}];function a8(e){return!e.enabled||new URLSearchParams(e.search).get(`preview`)!==`model-discovery`?[]:i8.flatMap(e=>e.models.map(t=>({value:`${r8}${e.providerId}/${t}`,providerId:`${r8}${e.providerId}`,providerModel:t,modelLabel:t,providerLabel:e.providerLabel,thinkingCapability:null})))}function o8(e){return e.providerId.startsWith(r8)}function s8(e){let{config:t,modelSelectionMode:n,providersView:r,supportedModels:i,templatesView:a}=e,o=P6(),{mutateAsync:s}=z6(),[c,l]=(0,H.useState)(0),[u,d]=(0,H.useState)(!1),f=(0,H.useMemo)(()=>a8({enabled:!1,search:typeof window>`u`?``:window.location.search}),[]),p=(0,H.useMemo)(()=>l6({catalogView:o.data??null,config:t,providersView:r,templatesView:a}),[o.data,t,r,a]);(0,H.useEffect)(()=>{n8.initializeLargeCatalogs(p)},[p]);let m=(0,H.useMemo)(()=>f.length>0&&!u?f:u6({modelOptions:n8.filterUnseen(p),modelSelectionMode:n,supportedModels:i}),[p,n,c,u,f,i]);return{addDiscoveredModel:(0,H.useCallback)(async e=>{let t=m.find(t=>t.value===e);if(t&&o8(t))return t;let n=t?r?.providers[t.providerId]:void 0;return!t||!n?null:(await s({provider:t.providerId,data:{models:J3([...n.models??[],t.providerModel])},silentSuccess:!0}),n8.acknowledge([t]),l(e=>e+1),t)},[m,r,s]),dismissDiscoveredModels:(0,H.useCallback)(()=>{if(m.some(o8)){d(!0);return}n8.acknowledge(m)&&l(e=>e+1)},[m]),discoveredModelOptions:m,refreshProviderModelCatalog:o.refetch}}var c8=[],l8=[];function u8(e){let{sessionKey:t,inputSnapshot:n,setPendingSessionType:r}=e,i=t??null,a=vR(),o=eR(e=>e.snapshot),s=o.configQuery?.data??null,c=o.providersQuery?.data??null,l=o.providerTemplatesQuery?.data??null,u=o.sessionsQuery?.data?.sessions??l8,d=lL({sessionId:i?.trim()||`draft-session`,projectRoot:pI(n.pendingProjectRoot)}),f=d.data?.records??c8,p=!!(d.isLoading||d.isFetching),m=(0,H.useMemo)(()=>qI(u),[u]),h=(0,H.useMemo)(()=>m.find(e=>e.key===i)??null,[i,m]),g=b6({selectedSession:h,pendingSessionType:n.pendingSessionType,setPendingSessionType:r,sessionTypesData:o.sessionTypesQuery?.data??null}),_=(0,H.useMemo)(()=>c6({config:s,providersView:c,templatesView:l}),[s,c,l]),v=(0,H.useMemo)(()=>d6({modelOptions:_,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,runtimeDefaultThinkingCapability:g.selectedSessionTypeOption?.runtimeDefaultThinking??null,runtimeDefaultModelLabel:b(`chatRuntimeDefaultModel`),supportedModels:g.selectedSessionTypeOption?.supportedModels}),[_,g.selectedSessionTypeOption?.modelSelectionMode,g.selectedSessionTypeOption?.runtimeDefaultThinking,g.selectedSessionTypeOption?.supportedModels]),{addDiscoveredModel:y,dismissDiscoveredModels:x,discoveredModelOptions:S,refreshProviderModelCatalog:C}=s8({config:s,providersView:c,templatesView:l,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,supportedModels:g.selectedSessionTypeOption?.supportedModels}),w=(0,H.useMemo)(()=>new Set(v.map(e=>e.value)),[v]),T=O6.read({namespace:g.selectedSessionType}).find(e=>w.has(e)),E=(0,H.useMemo)(()=>T??y6({sessions:m,selectedSessionKey:i,sessionType:g.selectedSessionType,readPreference:e=>e.preferredModel?.trim()||void 0}),[T,i,g.selectedSessionType,m]),D=(0,H.useMemo)(()=>y6({sessions:m,selectedSessionKey:i,sessionType:g.selectedSessionType,readPreference:e=>e.preferredThinking??void 0}),[i,g.selectedSessionType,m]),O=pI(s?.agents.defaults.workspace);return(0,H.useMemo)(()=>({addDiscoveredModel:y,defaultModel:g.selectedSessionTypeOption?.recommendedModel??s?.agents.defaults.model,defaultProjectRoot:O,dismissDiscoveredModels:x,discoveredModelOptions:S,fallbackPreferredModel:E,fallbackPreferredThinking:D,isProviderStateResolved:a,isSkillsLoading:p,modelOptions:v,providersView:c,refreshProviderModelCatalog:C,selectedSession:h,selectedSessionKey:i,sessionTypeState:g,skillRecords:f}),[s?.agents.defaults.model,O,E,D,a,p,v,y,x,S,C,c,h,i,g,f])}var d8=`new-session`,f8=`nextclaw.chat.composer-drafts`,p8=1;function m8(e){let t=e?.trim();return t?`session:${t}`:d8}var h8=P()(Mi(e=>({drafts:{},ensureDraft:(t,n)=>{e(e=>e.drafts[t]?e:{drafts:{...e.drafts,[t]:n}})},updateDraft:(t,n,r)=>{e(e=>({drafts:{...e.drafts,[t]:r(e.drafts[t]??n)}}))}}),{name:f8,version:p8,storage:Ni(()=>window.localStorage),partialize:e=>({drafts:Object.fromEntries(Object.entries(e.drafts).map(([e,t])=>[e,{...t,composerFocusRequestId:0,sendError:null}]))})})),g8=({preferenceOwnerKey:e,selectedModel:t,selectedThinkingLevel:n,updatePreferences:r})=>{let i=(0,H.useRef)(void 0),a=(0,H.useRef)(null),o=(0,H.useCallback)(t=>{a.current={ownerKey:e,value:t},r({selectedThinkingLevel:t})},[e,r]),s=(0,H.useCallback)(({defaultModel:o,fallbackPreferredModel:s,fallbackPreferredThinking:c,modelOptions:l,selectedSessionExists:u,selectedSessionKey:d,selectedSessionType:f,selectedSessionPreferredModel:p,selectedSessionPreferredThinking:m})=>{let h=d??null,g=JSON.stringify([f,h]),_=i.current!==g,v=_&&!!h&&!u,y=a.current,b=y?.ownerKey===e&&u&&m===y.value;b&&(a.current=null);let x=y?.ownerKey===e&&!b,S=_6({currentSelectedModel:t??void 0,modelOptions:l,selectedSessionPreferredModel:p,fallbackPreferredModel:s,defaultModel:o,preferSessionPreferredModel:_,preserveCurrentSelectedModelOnSessionChange:v}),C=l.find(e=>e.value===S),w=v6({currentSelectedThinkingLevel:n,supportedThinkingLevels:C?.thinkingCapability?.supported??[],selectedSessionPreferredThinking:m,fallbackPreferredThinking:c,defaultThinkingLevel:C?.thinkingCapability?.default??null,preferSessionPreferredThinking:_,preserveCurrentSelectedThinkingOnSessionChange:v||x});(t!==S||n!==w)&&r({selectedModel:S,selectedThinkingLevel:w}),(!h||u)&&(i.current=g)},[t,n,e,r]);return(0,H.useMemo)(()=>({setSelectedThinkingLevel:o,syncSessionPreferences:s}),[o,s])},_8={text:``,nodes:[],selectedSkills:[],skillRecords:[]},v8=e=>{let t=e?.trim()??``;return{...t?{..._8,text:t,nodes:k0(t)}:_8,attachments:[],selectedModel:void 0,selectedThinkingLevel:null,pendingSessionType:TL,selectedSessionType:TL,composerFocusRequestId:t?1:0,sendError:null}},y8=e=>e?.trim()||TL,b8=e=>[e.assetUri??``,e.url??``,e.name,e.mimeType,String(e.sizeBytes),e.contentBase64??``].join(`:`),x8=(e,t)=>{let n=new Set(e.map(b8)),r=[...e];return t.forEach(e=>{let t=b8(e);n.has(t)||(n.add(t),r.push(e))}),r};function S8(e){let{attachments:t,update:n}=e,r=(0,H.useCallback)(e=>{n({attachments:e})},[n]);return{addAttachments:(0,H.useCallback)(e=>{if(e.length===0)return[];let r=new Set(t.map(b8)),i=x8(t,e),a=i.filter(e=>!r.has(b8(e)));return a.length>0&&n({attachments:i}),a},[t,n]),removeAttachment:(0,H.useCallback)(e=>{n(t=>({attachments:t.attachments.filter(t=>t.id!==e)}))},[n]),setAttachments:r}}function C8(e,t){let n=m8(t),r=(0,H.useMemo)(()=>v8(e),[e]),i=h8(e=>e.drafts[n]??r);return(0,H.useEffect)(()=>{h8.getState().ensureDraft(n,r)},[n,r]),{draftKey:n,snapshot:i,update:(0,H.useCallback)(e=>{h8.getState().updateDraft(n,r,t=>{let n=typeof e==`function`?e({...t,pendingProjectRoot:$.getState().snapshot.draftProjectRoot}):e;return{...t,...n}})},[n,r])}}var w8=(e,t=null)=>{let n=$(e=>e.snapshot.draftProjectRoot),{draftKey:r,snapshot:i,update:a}=C8(e,t),o=(0,H.useCallback)(e=>{a({text:e.text,nodes:e.nodes,selectedSkills:e.selectedSkills,skillRecords:e.skillRecords,sendError:null})},[a]),s=(0,H.useCallback)(()=>{a({..._8,attachments:[],sendError:null})},[a]),c=(0,H.useCallback)(e=>{a({...e})},[a]),l=(0,H.useCallback)(e=>{a({text:e,nodes:k0(e),selectedSkills:[],skillRecords:[],sendError:null,composerFocusRequestId:Date.now()})},[a]),u=(0,H.useCallback)(()=>{a(e=>({composerFocusRequestId:e.composerFocusRequestId+1}))},[a]),d=(0,H.useCallback)(()=>{a({composerFocusRequestId:0})},[a]),{addAttachments:f,removeAttachment:p,setAttachments:m}=S8({attachments:i.attachments,update:a}),h=g8({preferenceOwnerKey:r,selectedModel:i.selectedModel,selectedThinkingLevel:i.selectedThinkingLevel,updatePreferences:a}),g=(0,H.useCallback)(e=>{a(t=>{let n=y8(typeof e==`function`?e(t.pendingSessionType):e);return{pendingSessionType:n,selectedSessionType:n}})},[a]),_=(0,H.useCallback)(e=>{$.getState().setSnapshot({draftProjectRoot:e})},[]),v=(0,H.useCallback)((e,t)=>{a({selectedSkills:e,skillRecords:t,sendError:null})},[a]),y=(0,H.useCallback)(e=>{a({sendError:e})},[a]),b=(0,H.useMemo)(()=>({update:a,syncComposer:o,resetComposer:s,restoreComposer:c,applyPromptSuggestion:l,requestComposerFocusAtEnd:u,consumeComposerFocusRequest:d,setAttachments:m,addAttachments:f,removeAttachment:p,...h,setPendingSessionType:g,setPendingProjectRoot:_,setSelectedSkills:v,setSendError:y}),[a,o,s,c,l,u,d,m,f,p,h,g,_,v,y]);return{inputSnapshot:{...i,pendingProjectRoot:n},inputActions:b}},T8=`ncp-session-run-queue`;function E8(e){let t=xe(),n=e?.trim()||null,{data:r,isLoading:i,refetch:a}=z({queryKey:[T8,n],queryFn:()=>F.sessions.listPendingInputs(n),enabled:!!n,retry:!1,staleTime:5e3});(0,H.useEffect)(()=>{if(n)return F.eventBus.on(c.sessionRunQueueUpdated,async({sessionKey:e})=>{if(e!==n)return;let r=[T8,n];await t.cancelQueries({queryKey:r,exact:!0}),await t.invalidateQueries({queryKey:r,exact:!0})})},[n,t]);let o=(0,H.useCallback)(async e=>n?await F.sessions.deleteQueuedInput(n,e):null,[n]),s=(0,H.useCallback)(async()=>n?(await a()).data?.inputs??[]:[],[n,a]),l=(0,H.useCallback)(async()=>(await s()).filter(({placement:e})=>e===`queued`),[s]),u=(0,H.useCallback)(async e=>n?await F.sessions.steerQueuedInput(n,e):null,[n]),d=r?.inputs??[];return{inputs:d.filter(({placement:e})=>e===`queued`),pendingInputs:d,isLoading:i,refreshPendingInputs:s,refreshQueuedInputs:l,removeQueuedInput:o,steerQueuedInput:u}}function D8(){return(0,H.useEffect)(()=>cc.attach(),[]),{isMobile:sc(e=>e.mode)===`mobile`}}var O8={exactId:1200,exactLabel:1150,prefixId:1e3,prefixLabel:950,prefixToken:900,containsId:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function k8(e){return(e??``).trim().toLowerCase()}function A8(e,t){if(!e||!t)return!1;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n>=e.length))return!0;return!1}function j8(e,t){let n=k8(t);if(!n)return O8.fallback;let r=k8(e.id),i=k8(e.label||e.id),a=k8(e.description),o=(e.aliases??[]).map(k8).filter(Boolean),s=i.split(/[\s/_-]+/).filter(Boolean),c=[r,...o];return c.some(e=>e===n)?O8.exactId:i===n?O8.exactLabel:c.some(e=>e.startsWith(n))?O8.prefixId:i.startsWith(n)?O8.prefixLabel:s.some(e=>e.startsWith(n))?O8.prefixToken:c.some(e=>e.includes(n))?O8.containsId:i.includes(n)?O8.containsLabel:a.includes(n)?O8.containsDescription:A8(n,i)||c.some(e=>A8(n,e))?O8.subsequence:0}function M8(e){return e>=O8.exactLabel?4:e>=O8.prefixToken?3:e>=O8.containsLabel?2:e>0?1:0}var N8=`context-reference:navigate:files`,P8=`context-reference:navigate:folders`,F8=`context-reference:navigate:projects`,I8=`context-reference:navigate:root`,L8=`context-reference:navigate:system-object-group:`,R8=`context-reference:system-object:`,z8=`workspace-files`,B8=`workspace-folders`,V8=`projects`;function H8(e,t){return e.translations?.[t]??e.default}function U8(e){return e.groups.map(t=>({key:`${L8}${t.objectType}`,icon:t.icon,title:H8(t.label,e.language),subtitle:e.texts.systemObjectSectionLabel,description:H8(t.description,e.language),detailLines:[],hintLabel:e.texts.systemObjectGroupHintLabel,sectionKey:`system-object-groups`,sectionLabel:e.texts.systemObjectSectionLabel,selectionBehavior:`navigate`,value:t.objectType}))}function W8(e){return e.groups.flatMap(t=>{let n=H8(t.label,e.language);return t.items.map(e=>({key:`${R8}${e.uri}`,icon:t.icon,title:e.label,subtitle:n,description:e.description??e.objectId,detailLines:[e.uri],sectionKey:`system-objects:${t.objectType}`,sectionLabel:n,selectionBehavior:`action`,value:e.uri}))})}function G8(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function K8(e){let{kind:t,projectRoot:n,relativePath:r}=e,i=r.split(`/`).filter(Boolean);return{rootLabel:G8(n),segments:i.map((e,n)=>({label:e,kind:n===i.length-1?t:`directory`}))}}function q8(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.projects.map((t,n)=>({order:n,project:t,score:j8({id:t.rootPath,label:t.name,description:t.rootPath,aliases:t.template?[t.template]:[]},e.query)})).filter(({score:e})=>e>0).sort((e,n)=>{let r=M8(e.score),i=M8(n.score);return i===r?n.score===e.score?t.compare(e.project.name,n.project.name)||e.order-n.order:n.score-e.score:i-r}).map(({project:t})=>({key:`context-reference:project:${t.rootPath}`,icon:`project`,title:t.name,subtitle:e.texts.projectSubtitle,description:e.texts.projectDescription,detailLines:[`${e.texts.projectPathLabel}: ${t.rootPath}`],sectionKey:V8,sectionLabel:e.texts.projectSectionLabel,value:t.rootPath,tokenKind:s,tokenKey:t.rootPath}))}function J8(e){let t=G8(e.projectRoot);return e.entries.map(n=>{let i=e.navigateDirectories&&n.kind===`directory`;return{key:`workspace:${n.kind}:${n.relativePath}`,icon:n.kind===`directory`?`folder`:`file`,title:n.name,subtitle:n.parentRelativePath||t,description:n.kind===`directory`?e.texts.directoryDescription:e.texts.fileDescription,detailLines:[`${e.texts.projectRootLabel}: ${e.projectRoot}`,n.relativePath],sectionKey:e.sectionKey,sectionLabel:e.sectionLabel,value:n.relativePath,tokenKind:i?void 0:n.kind===`directory`?p:r,tokenKey:i?void 0:n.relativePath,selectionBehavior:i?`navigate`:void 0,pathPreview:K8({kind:n.kind,projectRoot:e.projectRoot,relativePath:n.relativePath})}})}function Y8(e){let{projectRoot:t,referencePath:n,texts:r}=e,i=n.split(`/`).filter(Boolean).join(`/`),a=i||`.`,o=i.split(`/`).filter(Boolean).at(-1)??G8(t);return{key:`context-reference:current-directory:${a}`,icon:`folder`,title:r.currentDirectoryLabel,subtitle:o,description:r.directoryDescription,detailLines:[`${r.projectRootLabel}: ${t}`,a],sectionKey:B8,sectionLabel:r.foldersLabel,value:a,tokenKind:p,tokenKey:a,pathPreview:K8({kind:`directory`,projectRoot:t,relativePath:i})}}function X8(e){return{key:N8,icon:`files`,title:e.filesLabel,subtitle:e.filesSubtitle,description:e.filesDescription,detailLines:[],hintLabel:e.filesHintLabel,selectionBehavior:`navigate`}}function Z8(e){return{key:P8,icon:`folder`,title:e.foldersLabel,subtitle:e.foldersSubtitle,description:e.foldersDescription,detailLines:[],hintLabel:e.foldersHintLabel,selectionBehavior:`navigate`}}function Q8(e){return{key:F8,icon:`project`,title:e.projectsLabel,subtitle:e.projectsSubtitle,description:e.projectsDescription,detailLines:[],hintLabel:e.projectsHintLabel,selectionBehavior:`navigate`}}function $8(e){let t=e.split(`/`).filter(Boolean);return t.length===0?null:t.slice(0,-1).join(`/`)}function e5(e){let{location:t,texts:n}=e,r=t.view===`files`||t.view===`folders`,i=r?t.path:``,a=!r||!i;return{key:I8,icon:`back`,title:a?n.backLabel:n.parentLabel,subtitle:``,description:a?n.backDescription:n.parentDescription,detailLines:[],hintLabel:a?n.backHintLabel:n.parentHintLabel,value:$8(i)??``,selectionBehavior:`navigate`}}var t5=`panel-apps`;function n5(e){return Date.parse(e.lastOpenedAt??e.updatedAt)||0}function r5(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.entries.map((t,n)=>({entry:t,order:n,score:j8({id:t.appId,label:t.title||t.appId,description:t.description,aliases:[t.id,t.fileName]},e.query)})).filter(e=>e.score>0).sort((e,n)=>{let r=M8(e.score),i=M8(n.score);if(i!==r)return i-r;if(e.entry.favorite!==n.entry.favorite)return e.entry.favorite?-1:1;let a=n5(n.entry),o=n5(e.entry);return a===o?n.score===e.score?t.compare(e.entry.title||e.entry.appId,n.entry.title||n.entry.appId)||e.order-n.order:n.score-e.score:a-o}).map(({entry:e})=>e)}function i5(e){let t=e.keyPrefix??`panel-app`;return r5({entries:e.entries,query:e.query}).map(n=>({entry:n,item:{key:`${t}:${n.appId}`,icon:`panel-app`,title:n.title||n.appId,subtitle:e.texts.subtitle,description:(n.description??``).trim()||e.texts.noDescriptionLabel,detailLines:[`${e.texts.appIdLabel}: ${n.appId}`,`${e.texts.fileLabel}: ${n.fileName}`]}}))}function a5(e){return i5(e).map(({item:e})=>e)}function Xne(e){return i5(e).map(({entry:t,item:n})=>({...n,sectionKey:t5,sectionLabel:e.sectionLabel,tokenKind:`panel_app`,tokenKey:t.appId,value:t.appId}))}var o5={key:`context-reference`,marker:`@`};function Zne(e){let{entries:t,isBrowsing:n,isFoldersMode:r,projectRoot:i,texts:a}=e,o=(e,t,n)=>J8({entries:e,navigateDirectories:n,projectRoot:i,sectionKey:t===`folders`?B8:z8,sectionLabel:t===`folders`?a.foldersLabel:a.filesLabel,texts:a});return{browsedItems:o(t,r?`folders`:`files`,n),fileItems:o(t.filter(({kind:e})=>e===`file`),`files`,!1),folderItems:o(t.filter(({kind:e})=>e===`directory`),`folders`,!1)}}function Qne(e){let{isFoldersMode:t,isWorkspaceMode:n,item:r,onNavigate:i,onSelectSystemObject:a,referencePath:o}=e;r.key===`context-reference:navigate:files`?i({view:`files`,path:``}):r.key===`context-reference:navigate:folders`?i({view:`folders`,path:``}):r.key===`context-reference:navigate:projects`?i({view:`projects`}):r.key===`context-reference:navigate:root`?i(n&&o?{view:t?`folders`:`files`,path:r.value??``}:{view:`root`}):r.key.startsWith(`context-reference:navigate:system-object-group:`)&&r.value?i({view:`system-objects`,objectType:r.value}):r.selectionBehavior===`navigate`&&r.value?i({view:t?`folders`:`files`,path:r.value}):r.key.startsWith(`context-reference:system-object:`)&&r.value&&a(r.value)}function $ne(e){return vF({key:`context-reference`,trigger:o5,resolvePanel:({data:t,trigger:n})=>{let r=t.referenceLocation.view===`files`,i=t.referenceLocation.view===`folders`,a=t.referenceLocation.view===`projects`,o=t.referenceLocation.view===`system-objects`,s=r||i,c=!!n.query.trim(),l=s&&!c,u=t.referenceLocation.view===`files`||t.referenceLocation.view===`folders`?t.referenceLocation.path:``,{browsedItems:d,fileItems:f,folderItems:p}=Zne({entries:t.serverPathEntries,isBrowsing:l,isFoldersMode:i,projectRoot:t.projectRoot,texts:e.itemTexts.context}),m=q8({projects:t.projects,query:n.query,texts:e.itemTexts.context}),h=i&&l?Y8({projectRoot:t.projectRoot,referencePath:u,texts:e.itemTexts.context}):null,g=t.systemObjectGroups??[],_=W8({groups:g,language:e.language,texts:e.itemTexts.context}),v=r?[e5({location:t.referenceLocation,texts:e.itemTexts.context}),...l?d:f]:i?[e5({location:t.referenceLocation,texts:e.itemTexts.context}),...h?[h]:[],...l?d:p]:a?[e5({location:t.referenceLocation,texts:e.itemTexts.context}),...m]:o?[e5({location:t.referenceLocation,texts:e.itemTexts.context}),..._]:[X8(e.itemTexts.context),Z8(e.itemTexts.context),Q8(e.itemTexts.context),...c?f:[],...c?p:[],...c?m:[],...c?_:U8({groups:g,language:e.language,texts:e.itemTexts.context}),...Xne({entries:t.panelApps,query:n.query,sectionLabel:e.itemTexts.context.panelAppSectionLabel,texts:e.itemTexts.panelApp})],y=s?t.isServerPathSearchLoading:a?t.isProjectsLoading:o?!!t.isSystemObjectsLoading:t.isPanelAppsLoading||!!t.isSystemObjectsLoading||c&&(t.isProjectsLoading||t.isServerPathSearchLoading),b=!s&&!a&&!o,x=null;return a&&t.projectsError?x=`${e.itemTexts.context.projectsLoadFailedLabel}: ${t.projectsError}`:(o||b)&&t.systemObjectsError?x=`${e.itemTexts.context.searchFailedLabel}: ${t.systemObjectsError}`:(s||b)&&t.serverPathSearchError&&(x=`${e.itemTexts.context.searchFailedLabel}: ${t.serverPathSearchError}`),{isLoading:a?y:y&&v.length===0,items:v,notice:x?{message:x,tone:`error`}:void 0,onSelectItem:t=>Qne({isFoldersMode:i,isWorkspaceMode:s,item:t,onNavigate:e.onNavigate,onSelectSystemObject:e.onSelectSystemObject,referencePath:u}),texts:e.menuTexts}}})}function s5(e){let t=e.modelLabel.trim(),n=e.providerLabel.trim();return n?`${n}/${t}`:t}function ere(e){let t=new Map;for(let n of e){let e=n.value.indexOf(`/`),r=e>0?n.value.slice(0,e):n.providerLabel,i=t.get(r)??{key:r,label:n.providerLabel,options:[]};i.options.push({value:n.value,label:n.modelLabel}),t.set(r,i)}return[...t.values()]}function c5(e){return e.map(e=>({value:e.value,modelLabel:e.modelLabel,providerLabel:e.providerLabel,thinkingCapability:e.thinkingCapability?{supported:e.thinkingCapability.supported,default:e.thinkingCapability.default??null}:null}))}function tre(e){let{isModelOptionsEmpty:t,onGoToProviders:n,texts:r}=e;return t?{tone:`warning`,text:r.noModelOptionsLabel,actionLabel:r.configureProviderLabel,onAction:n}:null}function nre(e){let{onDismiss:t,onSelect:n,options:r,texts:i}=e;if(!(!t||!n||r.length===0))return{summaryLabel:i.discoveredModelsSummaryLabel.replace(`{count}`,String(r.length)),viewLabel:i.discoveredModelsViewLabel,groupLabel:i.discoveredModelsGroupLabel,allGroupLabel:i.allModelsLabel,actionLabel:i.discoveredModelAddLabel,addedLabel:i.discoveredModelAddedLabel,dismissLabel:i.discoveredModelsDismissLabel,doneLabel:i.discoveredModelsDoneLabel,closeLabel:i.discoveredModelsCloseLabel,searchPlaceholder:i.modelSearchPlaceholder,searchEmptyLabel:i.modelSearchEmptyLabel,groups:ere(r),onDismiss:t,onSelect:n}}function rre({modelOptions:e,discoveredModelOptions:t,favoriteModelValues:n,recentModelValues:r,selectedModel:i,isModelOptionsLoading:a,hasModelOptions:o,onFavoriteToggle:s,onDiscoveredModelSelect:c,onDiscoveredModelsDismiss:l,onOpen:u,onValueChange:d,texts:f}){let p=e.find(e=>e.value===i)??e[0],m=o?p?.value:void 0,h=new Map(e.map(e=>[e.value,e])),g=(n??[]).map(e=>h.get(e)).filter(e=>!!e),_=new Set(g.map(e=>e.value)),v=(r??[]).map(e=>h.get(e)).filter(e=>e!==void 0&&!_.has(e.value)),y=new Set(v.map(e=>e.value)),b=e.filter(e=>!_.has(e.value)&&!y.has(e.value)),x=g.length>0||v.length>0?[{key:`favorite-models`,label:f.favoriteModelsLabel,options:g.map(e=>({value:e.value,label:s5(e)}))},{key:`recent-models`,label:f.recentModelsLabel,options:v.map(e=>({value:e.value,label:s5(e)}))},{key:`all-models`,label:f.allModelsLabel,options:b.map(e=>({value:e.value,label:s5(e)}))}].filter(e=>e.options.length>0):void 0,S=t??[];return{key:`model`,value:m,placeholder:f.modelSelectPlaceholder,selectedLabel:p?s5(p):void 0,icon:`sparkles`,options:e.map(e=>({value:e.value,label:s5(e)})),groups:x,disabled:!o&&S.length===0,loading:a,emptyLabel:f.modelNoOptionsLabel,search:{placeholder:f.modelSearchPlaceholder,emptyLabel:f.modelSearchEmptyLabel},optionAction:s?{kind:`favorite`,activeValues:g.map(e=>e.value),activeLabel:f.unfavoriteModelLabel,inactiveLabel:f.favoriteModelLabel,onToggle:s}:void 0,discovery:nre({options:S,onDismiss:l,onSelect:c,texts:f}),manageLabel:f.manageModelsLabel,manageHref:`/providers`,onOpen:u,onValueChange:d}}function ire(e){let{defaultThinkingLevel:t,onValueChange:n,selectedThinkingLevel:r,supportedLevels:i,texts:a}=e;if(i.length===0)return null;let o=e6(i),s=o.includes(`off`)?`off`:o[0],c=r&&o.includes(r)&&r||t&&o.includes(t)&&t||s;return{key:`thinking`,value:c,placeholder:a.thinkingLabels[c],selectedLabel:a.thinkingLabels[c],icon:`brain`,options:o.map(e=>({value:e,label:a.thinkingLabels[e]})),onValueChange:e=>n(e)}}var l5={exactSpec:1200,exactLabel:1150,prefixSpec:1e3,prefixLabel:950,prefixToken:900,containsSpec:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function u5(e){return(e??``).trim().toLowerCase()}function d5(e,t){if(!e||!t)return!1;let n=0;for(let r of t)if(r===e[n]&&(n+=1,n>=e.length))return!0;return!1}function are(e,t){let n=u5(t);if(!n)return l5.fallback;let r=u5(e.key),i=u5(e.label||e.key),a=u5(`${e.descriptionZh??``} ${e.description??``}`),o=i.split(/[\s/_-]+/).filter(Boolean);return r===n?l5.exactSpec:i===n?l5.exactLabel:r.startsWith(n)?l5.prefixSpec:i.startsWith(n)?l5.prefixLabel:o.some(e=>e.startsWith(n))?l5.prefixToken:r.includes(n)?l5.containsSpec:i.includes(n)?l5.containsLabel:a.includes(n)?l5.containsDescription:d5(n,i)||d5(n,r)?l5.subsequence:0}function f5(e){return e>=l5.exactLabel?4:e>=l5.prefixToken?3:e>=l5.containsLabel?2:e>0?1:0}function p5(e){return new Map(e.map((e,t)=>[e,t]))}function ore(e,t){let n=p5(t),r=[],i=[];for(let t of e){if(n.has(t.key)){r.push(t);continue}i.push(t)}return r.sort((e,t)=>(n.get(e.key)??1/0)-(n.get(t.key)??1/0)),[...r,...i]}function sre(e,t,n,r=[]){let i=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),a=p5(r),o=new Map;for(let t of e){let e=t.groupKey?.trim();e&&!o.has(e)&&o.set(e,o.size)}return e.map((e,n)=>({record:e,order:n,score:are(e,t)})).filter(e=>e.score>0).sort((e,t)=>{let n=o.get(e.record.groupKey?.trim()??``)??1/0,r=o.get(t.record.groupKey?.trim()??``)??1/0;if(n!==r)return n-r;let s=f5(e.score),c=f5(t.score);if(c!==s)return c-s;let l=a.get(e.record.key)??1/0,u=a.get(t.record.key)??1/0;if(l!==u)return l-u;if(t.score!==e.score)return t.score-e.score;let d=(e.record.label||e.record.key).trim(),f=(t.record.label||t.record.key).trim(),p=i.compare(d,f);return p===0?e.order-t.order:p}).map(({record:e})=>({key:`skill:${e.key}`,title:e.label||e.key,subtitle:n.slashSkillSubtitle,description:(e.descriptionZh??e.description??``).trim()||n.noSkillDescription,detailLines:[`${n.slashSkillSpecLabel}: ${e.key}`,...e.scopeLabel?[`${n.slashSkillScopeLabel}: ${e.scopeLabel}`]:[]],sectionKey:e.groupKey,sectionLabel:e.groupLabel,tokenKind:`skill`,tokenKey:e.key,value:e.key}))}function m5(e){return e.map(e=>({key:e.key,label:e.label,description:e.descriptionZh||e.description||``,badgeLabel:e.badgeLabel}))}function cre(e){let{allSkillsLabel:t,recentKeySet:n,recentSkillsLabel:r,skillRecords:i}=e,a=i.filter(e=>n.has(e.key)),o=new Map;for(let e of i){if(n.has(e.key))continue;let r=e.groupKey?.trim()||`all-skills`,i=e.groupLabel?.trim()||t,a=o.get(r)??{label:i,records:[]};a.records.push(e),o.set(r,a)}let s=[...o].map(([e,t])=>({key:e,label:t.label,options:m5(t.records)})),c=s.some(e=>e.key!==`all-skills`);if(!(a.length===0&&!c))return[...a.length>0?[{key:`recent-skills`,label:r,options:m5(a)}]:[],...s].filter(e=>e.options.length>0)}function lre(e){let{groupedRecentSkillValues:t,isLoading:n,onSelectedKeysChange:r,recentSkillValues:i,selectedSkills:a,skillRecords:o,texts:s}=e,c=ore(o,i??[]),l=new Set(t??[]);return{title:s.title,searchPlaceholder:s.searchPlaceholder,emptyLabel:s.emptyLabel,loadingLabel:s.loadingLabel,isLoading:n,manageLabel:s.manageLabel,manageHref:`/marketplace/skills`,options:m5(c),groups:cre({skillRecords:c,recentKeySet:l,recentSkillsLabel:s.recentSkillsLabel,allSkillsLabel:s.allSkillsLabel}),selectedKeys:a,onSelectedKeysChange:r}}var h5=`commands`,g5=`panel-app-action`,_5=`panel-apps`,v5=`skills`;function ure(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.commands.map((t,n)=>({command:t,order:n,score:j8({id:t.key,label:t.title,description:t.description,aliases:t.keywords},e.query)})).filter(e=>e.score>0).sort((e,n)=>{let r=M8(e.score),i=M8(n.score);return i===r?n.score===e.score?t.compare(e.command.title,n.command.title)||e.order-n.order:n.score-e.score:i-r}).map(({command:t})=>({key:`command:${t.key}`,icon:t.icon,title:t.title,subtitle:e.texts.commandSubtitle,description:t.description,detailLines:[...t.detailLines??[]],hintLabel:e.texts.commandHintLabel,sectionKey:h5,sectionLabel:e.texts.commandSectionLabel}))}function dre(e){let{data:t,itemTexts:n,query:r,skillHintLabel:i,skillSectionLabel:a}=e;return sre([...t.skillRecords],r,n,[...t.recentSkillValues]).map(e=>({...e,icon:`skill`,hintLabel:i,sectionKey:e.sectionKey?`${v5}:${e.sectionKey}`:v5,sectionLabel:e.sectionLabel||a}))}function fre(e){return a5({entries:e.data.panelApps,keyPrefix:g5,query:e.query,texts:e.itemTexts}).map(t=>({...t,icon:`panel-app`,hintLabel:e.panelAppHintLabel,sectionKey:_5,sectionLabel:e.panelAppSectionLabel}))}function pre(e){let t=`${g5}:`;return e.key.startsWith(t)?e.key.slice(t.length):null}function mre(e){return vF({key:`slash-command`,trigger:hc,resolvePanel:t=>{let{data:n,trigger:r}=t,i=dre({data:n,itemTexts:e.itemTexts.skillTexts,query:r.query,skillHintLabel:e.labels.skillHintLabel,skillSectionLabel:e.labels.skillSectionLabel}),a=[...new Set(i.flatMap(e=>e.sectionKey?[e.sectionKey]:[]))];return{filterOptions:[{key:`all`,label:e.labels.filterAllLabel},{key:h5,label:e.labels.filterCommandsLabel,sectionKeys:[h5]},{key:v5,label:e.labels.filterSkillsLabel,sectionKeys:a.length>0?a:[v5]},{key:_5,label:e.labels.filterPanelAppsLabel,sectionKeys:[_5]}],isLoading:n.isPanelAppsLoading||n.isSkillsLoading,items:[...ure({commands:e.commands,query:r.query,texts:{commandHintLabel:e.labels.commandHintLabel,commandSectionLabel:e.labels.commandSectionLabel,commandSubtitle:e.labels.commandSubtitle}}),...i,...fre({data:n,itemTexts:e.itemTexts.panelAppTexts,panelAppHintLabel:e.labels.panelAppHintLabel,panelAppSectionLabel:e.labels.panelAppSectionLabel,query:r.query})],onSelectItem:t=>{if(t.key.startsWith(`command:`)){e.commands.find(e=>t.key===`command:${e.key}`)?.onSelect();return}let n=pre(t);if(n){e.onSelectPanelApp(n);return}let r=t.tokenKey??t.value;r&&e.onSelectSkill?.(r)},texts:e.menuTexts}}})}function hre(e){let{commands:t,language:n,onNavigate:r,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,slashTexts:s}=e,c={appIdLabel:b(`chatPanelAppReferenceAppId`,n),fileLabel:b(`chatPanelAppReferenceFile`,n),noDescriptionLabel:b(`chatPanelAppReferenceNoDescription`,n),subtitle:b(`chatPanelAppReferenceType`,n)};return[mre({commands:t,itemTexts:{panelAppTexts:c,skillTexts:s},menuTexts:{loadingLabel:b(`chatSlashLoading`,n),sectionLabel:b(`chatSlashSection`,n),emptyLabel:b(`chatSlashNoResult`,n),hintLabel:b(`chatSlashHint`,n),itemHintLabel:b(`chatSlashSkillHint`,n)},labels:{commandHintLabel:b(`chatSlashCommandHint`,n),commandSectionLabel:b(`chatSlashSectionCommands`,n),commandSubtitle:b(`chatSlashTypeCommand`,n),filterAllLabel:b(`chatSlashFilterAll`,n),filterCommandsLabel:b(`chatSlashFilterCommands`,n),filterPanelAppsLabel:b(`chatSlashFilterPanelApps`,n),filterSkillsLabel:b(`chatSlashFilterSkills`,n),panelAppHintLabel:b(`chatSlashPanelAppHint`,n),panelAppSectionLabel:b(`chatPanelAppReferenceSection`,n),skillHintLabel:b(`chatSlashSkillHint`,n),skillSectionLabel:b(`chatSlashSectionSkills`,n)},onSelectPanelApp:i,onSelectSkill:a}),$ne({itemTexts:{context:{backLabel:b(`chatContextReferenceBack`,n),backDescription:b(`chatContextReferenceBackDescription`,n),backHintLabel:b(`chatContextReferenceBackHint`,n),currentDirectoryLabel:b(`chatContextReferenceCurrentDirectory`,n),directoryDescription:b(`chatContextReferenceDirectoryDescription`,n),fileDescription:b(`chatContextReferenceFileDescription`,n),filesDescription:b(`chatContextReferenceFilesDescription`,n),filesHintLabel:b(`chatContextReferenceFilesHint`,n),filesLabel:b(`chatContextReferenceFilesLabel`,n),filesSubtitle:b(`chatContextReferenceFilesType`,n),foldersDescription:b(`chatContextReferenceFoldersDescription`,n),foldersHintLabel:b(`chatContextReferenceFoldersHint`,n),foldersLabel:b(`chatContextReferenceFoldersLabel`,n),foldersSubtitle:b(`chatContextReferenceFoldersType`,n),panelAppSectionLabel:b(`chatPanelAppReferenceSection`,n),parentLabel:b(`chatContextReferenceParent`,n),parentDescription:b(`chatContextReferenceParentDescription`,n),parentHintLabel:b(`chatContextReferenceParentHint`,n),projectDescription:b(`chatContextReferenceProjectDescription`,n),projectPathLabel:b(`chatContextReferenceProjectPath`,n),projectSectionLabel:b(`chatContextReferenceProjectSection`,n),projectSubtitle:b(`chatContextReferenceProjectType`,n),projectsDescription:b(`chatContextReferenceProjectsDescription`,n),projectsHintLabel:b(`chatContextReferenceProjectsHint`,n),projectsLabel:b(`chatContextReferenceProjectsLabel`,n),projectsLoadFailedLabel:b(`chatContextReferenceProjectsLoadFailed`,n),projectsSubtitle:b(`chatContextReferenceProjectsType`,n),projectRootLabel:b(`chatContextReferenceProjectRoot`,n),searchFailedLabel:b(`chatContextReferenceSearchFailed`,n),systemObjectGroupHintLabel:b(`chatSystemObjectGroupHint`,n),systemObjectSectionLabel:b(`chatSystemObjectSection`,n)},panelApp:c},menuTexts:{loadingLabel:b(`chatContextReferenceLoading`,n),sectionLabel:b(`chatContextReferenceSection`,n),emptyLabel:b(`chatContextReferenceNoResult`,n),hintLabel:b(`chatContextReferenceHint`,n),itemHintLabel:b(`chatContextReferenceItemHint`,n)},language:n,onNavigate:r,onSelectSystemObject:o})]}function gre(e){return[`server-path-search`,e.basePath.trim(),e.query?.trim()??``,e.limit??null]}function _re(e){let{enabled:t,limit:n}=e,r=e.basePath.trim(),i=e.query?.trim()??``;return z({queryKey:gre({basePath:r,query:i,limit:n}),queryFn:()=>on({basePath:r,query:i,limit:n}),enabled:(t??!0)&&!!r,staleTime:5e3})}function vre(e){let{enabled:t,limit:n,objectType:r}=e,i=e.query.trim();return z({queryKey:[`system-object-references`,r??null,i,n??null],queryFn:()=>F.systemObjectReferences.list({query:i||void 0,limit:n,objectType:r}),enabled:t,staleTime:1e4})}function yre(e){let t=e.parentRelativePath.split(`/`).filter(Boolean).join(`/`);return e.entries.map(e=>({name:e.name,path:e.path,relativePath:[t,e.name].filter(Boolean).join(`/`),parentRelativePath:t,kind:e.kind,hidden:e.hidden}))}function bre(e){let{inputSurfaceTrigger:t,isContextReferenceTrigger:n,query:r,referenceLocation:i}=e,a=OY({enabled:n&&i.view===`root`||t?.key===hc.key}),o=nR({enabled:!!(n&&(i.view===`root`||i.view===`projects`))}),s=i.view===`system-objects`?i.objectType:void 0;return{panelApps:a,projects:o,systemObjects:vre({enabled:!!(n&&(i.view===`root`||i.view===`system-objects`)),query:r,limit:s?20:6,objectType:s})}}function xre(e){let{isSkillsLoading:t,itemTexts:n,language:r,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,projectRoot:s,recentSkillValues:c,skillRecords:l,commands:u}=e,[d,f]=(0,H.useState)({view:`root`}),[p,m]=(0,H.useState)(null),h=(0,H.useRef)(`null`),g=(0,H.useCallback)(e=>{let t=JSON.stringify(e?[e.key,e.marker,e.query,e.start,e.end]:null);h.current!==t&&(h.current=t,e||f({view:`root`}),m(e))},[]),_=p?.key===o5.key,v=d.view===`files`||d.view===`folders`,y=v?d.path:``,b=(0,H.useDeferredValue)(_?p.query:``),x=!!(_&&s&&v&&!b.trim()),S=!!(_&&s&&(d.view===`root`||v)&&b.trim()),C=MF({path:y||`.`,basePath:s,includeFiles:d.view===`files`,enabled:x}),w=_re({basePath:s,query:b,enabled:S}),T=x?C:w,E=(0,H.useMemo)(()=>x?yre({entries:C.data?.entries??[],parentRelativePath:y}):w.data?.entries??[],[x,y,C.data?.entries,w.data?.entries]),{panelApps:D,projects:O,systemObjects:k}=bre({inputSurfaceTrigger:p,isContextReferenceTrigger:_,query:b,referenceLocation:d}),A=(0,H.useMemo)(()=>hre({commands:u,language:r,onNavigate:f,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,slashTexts:n.slashTexts}),[u,n.slashTexts,r,i,a,o]);return{inputSurfaceState:(0,H.useMemo)(()=>yF({data:{isPanelAppsLoading:D.isLoading||D.isFetching,isProjectsLoading:O.isLoading||O.isFetching,isServerPathSearchLoading:T.isLoading||T.isFetching,isSkillsLoading:t,isSystemObjectsLoading:k.isLoading||k.isFetching,panelApps:D.data?.entries??[],projectRoot:s,projects:O.data?.projects??[],projectsError:O.error instanceof Error?O.error.message:null,recentSkillValues:c,referenceLocation:d,serverPathEntries:E,serverPathSearchError:T.error instanceof Error?T.error.message:null,skillRecords:l,systemObjectGroups:k.data?.groups??[],systemObjectsError:k.error instanceof Error?k.error.message:null},plugins:A,trigger:p}),[A,p,D.data?.entries,D.isFetching,D.isLoading,s,O.data?.projects,O.error,O.isFetching,O.isLoading,T.error,T.isFetching,T.isLoading,d,E,t,c,l,k.data?.groups,k.error,k.isFetching,k.isLoading]),setInputSurfaceTrigger:g}}var y5=gn.chat.modelFavorites,b5=[`preference`,y5];function Sre(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!=`string`)continue;let e=n.trim();e&&!t.includes(e)&&t.push(e)}return t}function Cre(e){let t=xe(),n=(0,H.useMemo)(()=>new Set(e),[e]),r=z({queryKey:b5,queryFn:()=>it(y5),staleTime:3e4}),i=(0,H.useMemo)(()=>Sre(r.data?.value),[r.data?.value]),a=(0,H.useMemo)(()=>i.filter(e=>n.has(e)),[n,i]),o=R({mutationFn:async e=>await Ae(y5,e),onMutate:async e=>{await t.cancelQueries({queryKey:b5});let n=t.getQueryData(b5);return t.setQueryData(b5,{key:y5,value:e,updatedAt:new Date().toISOString()}),{previous:n}},onError:(e,n,r)=>{r?.previous&&t.setQueryData(b5,r.previous)},onSuccess:e=>{t.setQueryData(b5,e)}}),s=(0,H.useCallback)((e,t)=>{let n=e.trim();if(!n)return;let r=t?[n,...i.filter(e=>e!==n)]:i.filter(e=>e!==n);o.mutate(r)},[i,o]);return{favoriteModelValues:a,isLoading:r.isLoading,setModelFavorite:s}}var x5=new D6({storageKey:`nextclaw.chat.recent-skills`,limit:5});function wre(e){let{addAttachments:t,attachmentSupported:n,inputBarRef:r}=e,i=(0,H.useCallback)(e=>{if(e===`unsupported-type`){I.error(b(`chatInputAttachmentUnsupported`));return}if(e===`too-large`){I.error(b(`chatInputAttachmentTooLarge`).replace(`{maxMb}`,String(E4/(1024*1024))));return}I.error(b(`chatInputAttachmentReadFailed`))},[]),a=(0,H.useCallback)(async e=>{if(!n||e.length===0)return;let a=await j4(e,{uploadBatch:ct});if(a.attachments.length>0){let e=t(a.attachments);e.length>0&&r.current?.insertFileTokens(e.map(e=>({tokenKey:e.id,label:e.name,previewUrl:e.mimeType.startsWith(`image/`)?e.url:void 0})))}a.rejected.length>0&&i(a.rejected[0].reason)},[t,n,r,i]);return{handleFilesAdd:a,handleFileInputChange:(0,H.useCallback)(async e=>{let t=Array.from(e.target.files??[]);e.currentTarget.value=``,await a(t)},[a])}}function Tre(e){let{inputBarRef:t,intentManager:n,selectedSessionKey:r}=e;(0,H.useEffect)(()=>{let e=r?.trim()||null,i=e=>{let r=t.current;r&&(r.insertToken({tokenKind:e.kind,tokenKey:e.tokenKey,label:e.label,data:e.kind===`workspace_excerpt`?{path:e.path,excerpt:e.excerpt,startLine:e.startLine,endLine:e.endLine}:e.kind===`conversation_excerpt`?{messageId:e.messageId,role:e.role,excerpt:e.excerpt}:e.kind===`ui_resource`?{reference:e.reference}:void 0}),n.markConsumed(e.id))},a=n.subscribe(e,i),o=n.consumePending(e);return o&&i(o),a},[t,n,r])}function Ere(e){return(0,H.useCallback)(t=>{let n=[...t];e.update(e=>({nodes:n,attachments:P0(n,e.attachments),text:A0(n),selectedSkills:j0(n),sendError:null}))},[e])}function S5(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Dre(e){let{inputActions:t,selectedSessionKey:n}=e,r=dc(),i=(0,H.useRef)(0),a=(0,H.useRef)(new Map),o=(0,H.useRef)(Promise.resolve());return(0,H.useCallback)((e,s,c)=>{let l=n?.trim();if(!l)return;let u=++i.current,d=`${l}:model`,f=`${l}:thinking`;S5(e,`preferredModel`)&&a.current.set(d,u),S5(e,`preferredThinking`)&&a.current.set(f,u);let p=o.current.then(()=>r({invalidateSessionSkills:!1,sessionKey:l,patch:e,successMessage:null}));o.current=p.catch(()=>void 0),p.catch(()=>{t.update(t=>{let n={};return S5(e,`preferredModel`)&&a.current.get(d)===u&&t.selectedModel===s.selectedModel&&S5(c,`selectedModel`)&&(n.selectedModel=c.selectedModel),S5(e,`preferredThinking`)&&a.current.get(f)===u&&t.selectedThinkingLevel===s.selectedThinkingLevel&&S5(c,`selectedThinkingLevel`)&&(n.selectedThinkingLevel=c.selectedThinkingLevel),n})})},[t,n,r])}function Ore(e){let{language:t,onContextCompactingChange:n,onSendPresetMessage:r,selectedSessionKey:i}=e,a=eI(),o=(0,H.useRef)(new Set),s=(0,H.useCallback)(async e=>{if(!o.current.has(e)){o.current.add(e),n?.(e,!0);try{await be(e),I.success(b(`chatSlashCommandCompactContextSuccess`,t))}catch(e){let n=e instanceof Error?e.message:String(e);I.error(`${b(`chatSlashCommandCompactContextFailed`,t)}: ${n}`)}finally{o.current.delete(e),n?.(e,!1)}}},[t,n]);return(0,H.useMemo)(()=>{let e=i?.trim();return e?[{key:`side-chat`,icon:`message-square-plus`,title:b(`chatSlashCommandSideChatTitle`,t),description:b(`chatSlashCommandSideChatDescription`,t),detailLines:[b(`chatSlashCommandSideChatDetail`,t)],keywords:[`side`,`chat`,`child`,`branch`,`new`],onSelect:()=>a.chatThreadManager.openSideChatDraft(e)},{key:`update-session-title`,icon:`command`,title:b(`chatSlashCommandUpdateSessionTitleTitle`,t),description:b(`chatSlashCommandUpdateSessionTitleDescription`,t),detailLines:[b(`chatSlashCommandUpdateSessionTitleDetail`,t)],keywords:[`update`,`rename`,`title`,`session`,`更新`,`重命名`,`标题`,`会话`],onSelect:()=>void r(b(`chatSlashCommandUpdateSessionTitlePrompt`,t))},{key:`compact-context`,icon:`list-collapse`,title:b(`chatSlashCommandCompactContextTitle`,t),description:b(`chatSlashCommandCompactContextDescription`,t),detailLines:[b(`chatSlashCommandCompactContextDetail`,t)],keywords:[`compact`,`compress`,`context`,`summary`,`压缩`,`上下文`],onSelect:()=>void s(e)}]:[]},[s,t,r,a.chatThreadManager,i])}function kre(e){return(0,H.useCallback)(t=>{F.systemObjectReferences.resolve(t).then(t=>{e.current?.insertInputSurfaceToken({tokenKind:o,tokenKey:t.uri,label:t.label,data:{reference:t}})}).catch(e=>{let t=e instanceof Error?e.message:b(`error`);I.error(`${b(`chatSystemObjectResolveFailed`)}: ${t}`)})},[e])}function Are(){return{off:b(`chatThinkingLevelOff`),minimal:b(`chatThinkingLevelMinimal`),low:b(`chatThinkingLevelLow`),medium:b(`chatThinkingLevelMedium`),high:b(`chatThinkingLevelHigh`),adaptive:b(`chatThinkingLevelAdaptive`),xhigh:b(`chatThinkingLevelXhigh`)}}function jre(e){let{allModelsLabel:t,favoriteModelLabel:n,favoriteModelValues:r,favoriteModelsLabel:i,hasModelOptions:a,isModelOptionsLoading:o,modelRecords:s,discoveredModelRecords:c,modelSearchEmptyLabel:l,modelSearchPlaceholder:u,onFavoriteModelToggle:d,onDiscoveredModelSelect:f,onDiscoveredModelsDismiss:p,onModelSelectOpen:m,onModelChange:h,onThinkingChange:g,recentModelValues:_,recentModelsLabel:v,selectedModel:y,selectedThinkingLevel:x,thinkingDefaultLevel:S,thinkingSupportedLevels:C,unfavoriteModelLabel:w}=e;return[rre({modelOptions:s,discoveredModelOptions:c,favoriteModelValues:r,recentModelValues:_,selectedModel:y,isModelOptionsLoading:o,hasModelOptions:a,onFavoriteToggle:d,onDiscoveredModelSelect:f,onDiscoveredModelsDismiss:p,onOpen:m,onValueChange:h,texts:{modelSelectPlaceholder:b(`chatSelectModel`),modelNoOptionsLabel:b(`chatModelNoOptions`),modelSearchPlaceholder:u,modelSearchEmptyLabel:l,favoriteModelsLabel:i,favoriteModelLabel:n,unfavoriteModelLabel:w,manageModelsLabel:b(`chatManageModels`),discoveredModelsSummaryLabel:b(`chatDiscoveredModelsSummary`),discoveredModelsViewLabel:b(`chatDiscoveredModelsView`),discoveredModelsGroupLabel:b(`chatDiscoveredModelsGroup`),discoveredModelAddLabel:b(`chatDiscoveredModelAdd`),discoveredModelAddedLabel:b(`chatDiscoveredModelAddedShort`),discoveredModelsDismissLabel:b(`chatDiscoveredModelsDismiss`),discoveredModelsDoneLabel:b(`chatDiscoveredModelsDone`),discoveredModelsCloseLabel:b(`chatDiscoveredModelsClose`),recentModelsLabel:v,allModelsLabel:t}}),ire({supportedLevels:C,selectedThinkingLevel:x,defaultThinkingLevel:S,onValueChange:g,texts:{thinkingLabels:Are()}})].filter(e=>e!==null)}function Mre(e){let{allSkillsLabel:t,isSkillsLoading:n,onSelectedKeysChange:r,recentSkillGroupValues:i,recentSkillValues:a,recentSkillsLabel:o,selectedSkills:s,skillRecords:c}=e;return lre({skillRecords:c,recentSkillValues:a,groupedRecentSkillValues:i,selectedSkills:[...s],isLoading:n,onSelectedKeysChange:r,texts:{title:b(`chatSkillsPickerTitle`),searchPlaceholder:b(`chatSkillsPickerSearchPlaceholder`),emptyLabel:b(`chatSkillsPickerEmpty`),loadingLabel:b(`sessionsLoading`),manageLabel:b(`chatSkillsPickerManage`),recentSkillsLabel:o,allSkillsLabel:t}})}function Nre(e,t){let n=e?.thinkingCapability;return!n||n.supported.length===0?null:t===`off`?`off`:t&&n.supported.includes(t)?t:n.default&&n.supported.includes(n.default)?n.default:`off`}function Pre({item:e}){let t=e.attachments??[],n=t.slice(0,3);return(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n.map((e,t)=>e.previewUrl?(0,U.jsx)(`img`,{alt:e.name,loading:`lazy`,src:e.previewUrl,title:e.name,className:`h-9 w-9 shrink-0 rounded-md border border-border/70 object-cover`},`${e.name}-${t}`):(0,U.jsxs)(`span`,{title:e.name,className:`inline-flex min-w-0 max-w-36 shrink items-center gap-1 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(Ho,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]},`${e.name}-${t}`)),t.length>n.length?(0,U.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`+`,t.length-n.length]}):null,e.preview||t.length===0?(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground/80`,children:e.preview||b(`chatQueuedBannerAttachmentFallback`)}):null]})}function C5({children:e,disabled:t=!1,label:n,onClick:r}){return(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`span`,{className:`inline-flex`,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":n,disabled:t,onClick:r,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:cursor-not-allowed disabled:text-muted-foreground/50`,children:e})})}),(0,U.jsx)(ui,{side:`top`,children:n})]})}function Fre({controller:e}){return e.queuedInputs.length===0?null:(0,U.jsx)(li,{delayDuration:120,children:(0,U.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.queuedInputs.map(t=>(0,U.jsxs)(`div`,{className:`flex min-h-8 min-w-0 items-center gap-2 text-sm`,children:[(0,U.jsx)(ka,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(Pre,{item:t}),t.isSubmitting?(0,U.jsxs)(`span`,{"aria-label":b(`chatQueuedSubmitting`),className:`inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(Di,{className:`h-3.5 w-3.5 animate-spin`}),b(`chatQueuedSubmitting`)]}):(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,U.jsx)(C5,{disabled:!e.canEditQueuedInput,label:e.canEditQueuedInput?b(`chatQueuedEdit`):b(`chatQueuedEditComposerNotEmpty`),onClick:()=>e.editQueuedInput(t.id),children:(0,U.jsx)(Go,{className:`h-4 w-4`})}),(0,U.jsx)(C5,{label:b(`chatQueuedSteer`),onClick:()=>e.steerQueuedInput(t.id),children:(0,U.jsx)($a,{className:`h-4 w-4`})}),(0,U.jsx)(C5,{label:b(`chatQueuedDelete`),onClick:()=>e.deleteQueuedInput(t.id),children:(0,U.jsx)(ms,{className:`h-4 w-4`})})]})]},t.id))})})}function Ire(e,t,n){return e.map(e=>({key:e.ref,label:e.name,scopeLabel:t[e.source],groupKey:e.source,groupLabel:n[e.source],description:e.description,descriptionZh:e.descriptionZh,badgeLabel:t[e.source]}))}function Lre(e){let{skillGroupLabels:t,skillScopeLabels:n}=(0,H.useMemo)(()=>({skillScopeLabels:{builtin:b(`chatSkillScopeBuiltin`),global:b(`chatSkillScopeGlobal`),project:b(`chatSkillScopeProject`),workspace:b(`chatSkillScopeWorkspace`)},skillGroupLabels:{builtin:b(`chatSkillGroupBuiltin`),global:b(`chatSkillGroupGlobal`),project:b(`chatSkillGroupProject`),workspace:b(`chatSkillGroupWorkspace`)}}),[e]);return{skillScopeLabels:n,skillGroupLabels:t,slashTexts:(0,H.useMemo)(()=>({slashSkillSubtitle:b(`chatSlashTypeSkill`),slashSkillSpecLabel:b(`chatSlashSkillSpec`),slashSkillScopeLabel:b(`chatSlashSkillScope`),noSkillDescription:b(`chatSkillsPickerNoDescription`)}),[e]),recentModelsLabel:b(`chatPickerRecentModels`),allModelsLabel:b(`chatPickerAllModels`),favoriteModelsLabel:b(`chatPickerFavoriteModels`),modelSearchPlaceholder:b(`chatModelSearchPlaceholder`),modelSearchEmptyLabel:b(`chatModelSearchEmpty`),favoriteModelLabel:b(`chatFavoriteModel`),unfavoriteModelLabel:b(`chatUnfavoriteModel`),recentSkillsLabel:b(`chatPickerRecent`),allSkillsLabel:b(`chatPickerAllSkills`)}}function Rre(e){let{modelOptions:t,skillGroupLabels:n,skillRecords:r,skillScopeLabels:i}=e,a=(0,H.useMemo)(()=>Ire(r,i,n),[n,i,r]),o=(0,H.useMemo)(()=>c5(t),[t]);return{skillRecords:a,modelRecords:o,recentModelValues:O6.resolveVisible({availableValues:o.map(e=>e.value),minAvailableCount:5}),recentSkillValues:x5.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:0}),recentSkillGroupValues:x5.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:4})}}var zre=(0,H.memo)(function(e){let{contextWindow:t,controller:n,inputActions:r,inputQuery:i,inputSnapshot:a,onContextCompactingChange:o,placeholder:s,surface:c=`default`}=e,l=eI(),{language:u}=Gn(),f=$1(e=>e.layout),{isMobile:p}=D8(),m=(0,H.useRef)(null),h=(0,H.useRef)(null),g=Lre(u),{skillRecords:_,modelRecords:v,recentModelValues:y,recentSkillValues:x,recentSkillGroupValues:S}=Rre({modelOptions:i.modelOptions,skillRecords:i.skillRecords,skillGroupLabels:g.skillGroupLabels,skillScopeLabels:g.skillScopeLabels}),C=(0,H.useMemo)(()=>c5(i.discoveredModelOptions),[i.discoveredModelOptions]),w=Ore({language:u,onContextCompactingChange:o,onSendPresetMessage:n.sendPresetMessage,selectedSessionKey:i.selectedSessionKey}),T=(0,H.useCallback)(e=>void l.chatUiManager.showContent({target:{type:`panel_app`,payload:{appId:e}}}),[l.chatUiManager]),E=i.selectedSessionKey?i.selectedSession?.projectRoot??i.defaultProjectRoot??``:a.pendingProjectRoot??i.defaultProjectRoot??``,D=kre(m),{inputSurfaceState:O,setInputSurfaceTrigger:k}=xre({commands:w,isSkillsLoading:i.isSkillsLoading,itemTexts:{slashTexts:g.slashTexts},language:u,onSelectPanelApp:T,onSelectSkill:x5.remember,onSelectSystemObject:D,projectRoot:E,recentSkillValues:x,skillRecords:_}),{favoriteModelValues:A,setModelFavorite:j}=Cre((0,H.useMemo)(()=>v.map(e=>e.value),[v])),M=a.selectedModel??``,N=a.selectedThinkingLevel,P={isProviderStateResolved:i.isProviderStateResolved,modelOptions:i.modelOptions,sessionTypeUnavailable:i.sessionTypeState.sessionTypeUnavailable},ee=S3(P),te=C3(P),ne=w3(P),re=T3(P),ie=ne?b(`chatModelNoOptions`):s??b(p?`chatInputPlaceholderCompact`:`chatInputPlaceholder`),ae=v.find(e=>e.value===M),oe=ae?.thinkingCapability?.supported??[],{handleFilesAdd:se,handleFileInputChange:ce}=wre({attachmentSupported:!0,inputBarRef:m,addAttachments:r.addAttachments}),le=Dre({inputActions:r,selectedSessionKey:i.selectedSessionKey}),ue=Ere(r);Tre({inputBarRef:m,intentManager:l.chatComposerIntentManager,selectedSessionKey:i.selectedSessionKey});let de=(0,H.useCallback)(e=>{let t=Nre(v.find(t=>t.value===e)??C.find(t=>t.value===e),N);r.update({selectedModel:e,selectedThinkingLevel:t,sendError:null}),O6.remember(e,{namespace:i.sessionTypeState.selectedSessionType}),d(e)||O6.remember(e),le({preferredModel:d(e)?null:e,preferredThinking:t},{selectedModel:e,selectedThinkingLevel:t},{selectedModel:M,selectedThinkingLevel:N})},[r,C,i.sessionTypeState.selectedSessionType,v,N,le,M]),fe=(0,H.useCallback)(async e=>{let t=await i.addDiscoveredModel(e);if(!t)throw I.error(b(`chatDiscoveredModelUnavailable`)),Error(`Discovered provider model is no longer available.`);I.success(b(`chatDiscoveredModelAdded`).replace(`{model}`,t.modelLabel))},[i]),pe=(0,H.useCallback)(e=>{r.setSelectedThinkingLevel(e),le({preferredThinking:e},{selectedThinkingLevel:e},{selectedThinkingLevel:N})},[r,le,N]),me=(0,H.useCallback)(e=>{let t=a.selectedSkills;e.filter(e=>!t.includes(e)).forEach(e=>x5.remember(e)),ue(N0([...a.nodes],e,i.skillRecords.map(e=>({ref:e.ref,name:e.name}))))},[ue,i.skillRecords,a.nodes,a.selectedSkills]);(0,H.useEffect)(()=>{a.composerFocusRequestId&&(m.current?.focusComposerAtEnd([...a.nodes]),r.consumeComposerFocusRequest())},[r,a.composerFocusRequestId,a.nodes]);let he=jre({allModelsLabel:g.allModelsLabel,favoriteModelLabel:g.favoriteModelLabel,favoriteModelValues:A,favoriteModelsLabel:g.favoriteModelsLabel,hasModelOptions:ee,isModelOptionsLoading:te,discoveredModelRecords:C,modelRecords:v,modelSearchEmptyLabel:g.modelSearchEmptyLabel,modelSearchPlaceholder:g.modelSearchPlaceholder,onFavoriteModelToggle:j,onDiscoveredModelSelect:fe,onDiscoveredModelsDismiss:i.dismissDiscoveredModels,onModelSelectOpen:()=>{i.refreshProviderModelCatalog()},onModelChange:de,onThinkingChange:pe,recentModelValues:y,recentModelsLabel:g.recentModelsLabel,selectedModel:M,selectedThinkingLevel:N,thinkingSupportedLevels:oe,thinkingDefaultLevel:ae?.thinkingCapability?.default??null,unfavoriteModelLabel:g.unfavoriteModelLabel}),ge=Mre({allSkillsLabel:g.allSkillsLabel,onSelectedKeysChange:me,recentSkillGroupValues:S,recentSkillValues:x,recentSkillsLabel:g.recentSkillsLabel,isSkillsLoading:i.isSkillsLoading,skillRecords:_,selectedSkills:a.selectedSkills}),_e=(0,H.useMemo)(()=>[...a.nodes],[a.nodes]),ve=c===`default`&&f===`flat`,ye=(0,U.jsx)(Sx,{ref:m,surface:ve?`embedded`:c,topSlot:n.queuedInputs.length>0?(0,U.jsx)(Fre,{controller:n}):null,composer:{nodes:_e,placeholder:ie,excerptCharacterCountTemplate:b(`chatWorkspaceExcerptCharacterCount`),removeTokenLabel:b(`chatInputRemoveReference`),disabled:re,onNodesChange:ue,onFilesAdd:se,inputSurfaceTriggerSpecs:O.triggerSpecs,onInputSurfaceTriggerChange:k},inputSurface:O.panel??void 0,hint:tre({isModelOptionsEmpty:ne,onGoToProviders:l.chatUiManager.goToProviders,texts:{noModelOptionsLabel:b(`chatModelNoOptions`),configureProviderLabel:b(`chatGoConfigureProvider`)}}),toolbar:{addMenuLabel:b(`chatInputAdd`),selects:[],trailingSelects:he,accessories:[{key:`attach`,label:b(`chatInputAttach`),icon:`paperclip`,disabled:re,onClick:()=>h.current?.click()}],skillPicker:ge,actions:{isSending:n.isSending,canStopGeneration:n.canStopGeneration,sendDisabled:n.sendDisabled,stopDisabled:n.stopDisabled,stopHint:b(`chatStopUnavailable`),sendButtonLabel:n.primaryAction===`continue`?b(`chatContinueRun`):b(`chatSend`),sendIcon:n.primaryAction,stopButtonLabel:b(`chatStop`),contextWindow:t,onSend:n.send,onAlternateSend:n.sendSteering,onStop:n.stop}}});return(0,U.jsxs)(U.Fragment,{children:[ve?(0,U.jsx)(a2,{className:`pb-4 pt-2`,width:`composer`,children:ye}):ye,(0,U.jsx)(`input`,{ref:h,type:`file`,multiple:!0,className:`hidden`,onChange:ce})]})});function Bre(e){let{applyPromptSuggestion:t,applySystemObjectReference:n,consumeDraftIntent:r}=e,i=N9(),a=eI();(0,H.useEffect)(()=>{if(!r)return;let e=e=>{a.chatSessionListManager.createSession(),a.chatSessionListManager.setSelectedAgentId(`main`),e.kind===`prompt`?t(e.prompt):n(e.reference),i.chatDraftIntentManager.markConsumed(e.id)},o=i.chatDraftIntentManager.subscribe(e),s=i.chatDraftIntentManager.consumePending();return s&&e(s),o},[i,t,n,r,a])}function w5(e){if(!e||typeof e!=`object`)return null;let t=e.chatDraft;return!t||typeof t!=`object`?null:t}function Vre(e){let{applyPromptSuggestion:t,sessionKey:n,setPendingProjectRoot:r,setPendingSessionType:i}=e,a=_e(),o=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(n)return;let e=w5(a.state);if(!e)return;let s=[a.key,typeof e.sessionType==`string`?e.sessionType:``,typeof e.projectRoot==`string`?e.projectRoot:``,typeof e.prompt==`string`?e.prompt:``].join(`:`);o.current!==s&&(o.current=s,typeof e.sessionType==`string`&&e.sessionType.trim()&&i(e.sessionType),typeof e.prompt==`string`&&e.prompt.trim()&&t(e.prompt),r(typeof e.projectRoot==`string`&&e.projectRoot.trim()?e.projectRoot:null))},[t,a.key,a.state,n,r,i])}function Hre({inputQuery:e}){let t=eI(),n=e.isProviderStateResolved&&e.modelOptions.length===0,r=e.sessionTypeState.sessionTypeUnavailableMessage?.trim()||null;return(0,U.jsxs)(U.Fragment,{children:[n?(0,U.jsxs)(`div`,{className:`px-4 py-2.5 border-b border-amber-200/70 bg-amber-50/70 flex items-center justify-between gap-3 shrink-0 sm:px-5`,children:[(0,U.jsx)(`span`,{className:`text-xs text-amber-800`,children:b(`chatModelNoOptions`)}),(0,U.jsx)(`button`,{type:`button`,onClick:t.chatUiManager.goToProviders,className:`text-xs font-semibold text-amber-900 underline-offset-2 hover:underline`,children:b(`chatGoConfigureProvider`)})]}):null,e.sessionTypeState.sessionTypeUnavailable&&r?(0,U.jsx)(`div`,{className:`px-4 py-2.5 border-b border-amber-200/70 bg-amber-50/70 shrink-0 sm:px-5`,children:(0,U.jsx)(`span`,{className:`text-xs text-amber-800`,children:r})}):null]})}function T5(e){let{consumeDraftIntent:t=!1,materializationContext:n=null,onSessionMaterialized:r,sessionKey:i,showWelcomeForDraft:a=!0}=e,o=_e(),s=i?null:w5(o.state),c=typeof s?.prompt==`string`?s.prompt:null,l=Qe(),u=aL(e=>e.snapshot.selectedAgentId),d=Q4(i??void 0),f=E8(i),{inputActions:p,inputSnapshot:m}=w8(c,i),h=(0,H.useCallback)(e=>{p.update(t=>{let n=RU(t.nodes,e);return{nodes:n,text:A0(n),composerFocusRequestId:Date.now(),sendError:null}})},[p]),g=u8({sessionKey:i,inputSnapshot:m,setPendingSessionType:p.setPendingSessionType}),[_,v]=(0,H.useState)(()=>new Set),y=(0,H.useCallback)((e,t)=>{v(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,H.useEffect)(()=>{p.syncSessionPreferences({defaultModel:g.defaultModel,fallbackPreferredModel:g.fallbackPreferredModel,fallbackPreferredThinking:g.fallbackPreferredThinking,modelOptions:g.modelOptions,selectedSessionExists:!!g.selectedSession,selectedSessionKey:g.selectedSessionKey,selectedSessionType:g.sessionTypeState.selectedSessionType,selectedSessionPreferredModel:g.selectedSession?.preferredModel??void 0,selectedSessionPreferredThinking:g.selectedSession?.preferredThinking??null})},[p,g.defaultModel,g.fallbackPreferredModel,g.fallbackPreferredThinking,g.modelOptions,g.selectedSession,g.selectedSessionKey,g.sessionTypeState.selectedSessionType]),Vre({applyPromptSuggestion:p.applyPromptSuggestion,sessionKey:i,setPendingProjectRoot:p.setPendingProjectRoot,setPendingSessionType:p.setPendingSessionType});let x=$4(l),S=d.isRunning||g.selectedSession?.status===`running`,C=d.snapshot.error,w=d.hydrateError?.message??(C?.code===`run-interrupted`?null:C?.message)??null,T=l.phase===`ready`&&J4(w)?null:w,E=x?null:l.phase===`ready`?T:t3({message:T,status:l}),D=G3({agent:(0,H.useMemo)(()=>({...d,isRunning:S,isSending:d.isSending}),[d,S]),inputSnapshot:m,inputQuery:g,isRuntimeBlocked:x,materializationContext:n,runQueue:f,selectedAgentId:u,sessionKey:i,onSessionMaterialized:r,resetComposer:p.resetComposer,restoreComposer:p.restoreComposer,setSendError:p.setSendError}),O=(0,H.useMemo)(()=>{let e=new Set(d.visibleMessages.map(({id:e})=>e)),t=f.pendingInputs.flatMap(t=>t.placement===`steering`&&!e.has(t.message.id)?[{...t.message,status:`pending`}]:[]);return[...d.visibleMessages,...t]},[d.visibleMessages,f.pendingInputs]),k=(0,H.useRef)(D);(0,H.useEffect)(()=>{k.current=D},[D]);let A=(0,H.useMemo)(()=>({canEditQueuedInput:D.canEditQueuedInput,canStopGeneration:D.canStopGeneration,deleteQueuedInput:e=>k.current.deleteQueuedInput(e),editQueuedInput:e=>k.current.editQueuedInput(e),isSending:D.isSending,primaryAction:D.primaryAction,queuedInputs:D.queuedInputs,send:()=>k.current.send(),sendSteering:()=>k.current.sendSteering(),sendPresetMessage:e=>k.current.sendPresetMessage(e).catch(()=>void 0),sendDisabled:D.sendDisabled,stop:()=>k.current.stop(),stopDisabled:D.stopDisabled,steerQueuedInput:e=>k.current.steerQueuedInput(e)}),[D.canStopGeneration,D.canEditQueuedInput,D.isSending,D.primaryAction,D.queuedInputs,D.sendDisabled,D.stopDisabled]),j=(0,H.useMemo)(()=>r3(MK(d.snapshot.contextWindow)),[d.snapshot.contextWindow]),{selectedSession:M}=g,N=m.sendError?.trim()||E?.trim()||(M?.activityPreview?.state===`failed`&&M.activityPreview.statusKind!==`run-interrupted`?M.activityPreview.statusText?.trim():null)||null,P=N?(0,U.jsx)(`div`,{className:`rounded-lg border-l-2 border-destructive/40 bg-muted/45 px-3 py-2.5`,role:`status`,children:(0,U.jsx)(`pre`,{className:`max-h-32 select-text overflow-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-muted-foreground`,children:N})}):null;Bre({consumeDraftIntent:t,applyPromptSuggestion:p.applyPromptSuggestion,applySystemObjectReference:h});let ee=(0,H.useCallback)((e,t)=>(0,U.jsx)(zre,{contextWindow:j,controller:A,inputActions:p,inputQuery:g,inputSnapshot:m,onContextCompactingChange:y,placeholder:t,surface:e}),[j,A,p,g,m,y]),te=a&&!i&&O.length===0&&!d.isHydrating&&!D.isSending;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Hre,{inputQuery:g}),(0,U.jsx)(s2,{hasPreviousMessages:d.hasPreviousMessages,historyError:d.historyError,isHistoryLoading:d.isHydrating,isLoadingPreviousMessages:d.isLoadingPreviousMessages,isSending:D.isSending,canContinue:D.canContinue,messageActionsDisabled:D.isSending||x,isContextCompacting:!!(i&&_.has(i)),bottomSlot:te?null:P,messages:O,messageDetailStates:d.messageDetailStates,sessionKey:i,showWelcome:te,onLoadPreviousMessages:d.loadPreviousMessages,onLoadMessageDetails:d.loadMessageDetails,onContinueRun:()=>k.current.continueRun(),onEditMessage:e=>k.current.editMessage(e),welcomeSlot:(0,U.jsx)(x3,{inputSlot:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[ee(`embedded`,b(`chatWelcomeInputPlaceholder`)),P]}),pendingProjectRoot:m.pendingProjectRoot,pendingSessionType:m.pendingSessionType,selectedSessionTypeValue:m.selectedSessionType,onSelectProjectRoot:p.setPendingProjectRoot,onSelectPrompt:p.applyPromptSuggestion,onSelectSessionType:p.setPendingSessionType})}),te?null:ee(`default`)]})}function E5(e){return M(e??void 0)}function D5(e){if(!e)return`-`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`-`;let n=Date.now(),r=t.getTime()-n,i=N(),a=Math.abs(r);if(a<6e4)return i===`zh`?`刚刚`:`just now`;if(a<36e5){let e=Math.round(a/6e4);return r>0?i===`zh`?`${e}分钟后`:`in ${e}m`:i===`zh`?`${e}分钟前`:`${e}m ago`}if(a<864e5){let e=Math.round(a/36e5);return r>0?i===`zh`?`${e}小时后`:`in ${e}h`:i===`zh`?`${e}小时前`:`${e}h ago`}let o=Math.round(a/864e5);return r>0?i===`zh`?`${o}天后`:`in ${o}d`:i===`zh`?`${o}天前`:`${o}d ago`}function Ure(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:M(new Date(e))}function Wre(e){if(typeof e!=`number`||!Number.isFinite(e))return`-`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);if(n<60)return`${n}m`;let r=Math.round(n/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}var Gre=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],Kre=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function O5(e){return e.padStart(2,`0`)}function qre(e,t){let n=e.trim().split(/\s+/);if(n.length!==5)return null;let[r,i,a,o,s]=n,c=t===`zh`;if(r===`*`&&i===`*`&&a===`*`&&o===`*`&&s===`*`)return c?`每分钟`:`every minute`;if(r.startsWith(`*/`)&&i===`*`&&a===`*`&&o===`*`&&s===`*`){let e=parseInt(r.slice(2),10);if(Number.isFinite(e)&&e>0)return c?`每 ${e} 分钟`:`every ${e}m`}if(r===`0`&&i===`*`&&a===`*`&&o===`*`&&s===`*`)return c?`每小时`:`every hour`;let l=`${O5(i)}:${O5(r)}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&s===`*`)return c?`每天 ${l}`:`daily ${l}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&s===`1-5`)return c?`工作日 ${l}`:`weekdays ${l}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&(s===`0,6`||s===`6,0`))return c?`周末 ${l}`:`weekends ${l}`;if(r!==`*`&&i!==`*`&&a===`*`&&o===`*`&&/^\d$/.test(s)){let e=parseInt(s,10),t=c?Gre[e]:Kre[e];return t?`${t} ${l}`:null}return r!==`*`&&i!==`*`&&a!==`*`&&o===`*`&&s===`*`?c?`每月 ${a} 日 ${l}`:`monthly ${a} ${l}`:null}function k5(e){let t=N(),n=t===`zh`,{schedule:r}=e;if(r.kind===`cron`)return r.expr?qre(r.expr,t)??`cron ${r.expr}`:`cron`;if(r.kind===`every`){let e=Wre(r.everyMs);return n?`每 ${e}`:`every ${e}`}return r.kind===`at`?`${n?`定时`:`at`} ${Ure(r.atMs)}`:`-`}function A5(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function j5(e){return!!(e.payload.sessionId?.trim()||e.state.lastRunAt)}function Jre(e,t){let n=t?.trim();return!!(n&&e.payload.sessionId?.trim()===n)}function M5({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border/50 py-3 last:border-b-0`,children:[(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,U.jsx)(`span`,{className:`max-w-[65%] break-words text-right text-xs font-medium text-foreground`,children:t})]})}function N5({job:e,open:t,onDelete:n,onOpenChange:r,onRun:i,onToggle:a}){if(!e)return null;let o=A5(e),s=!!e.payload.sessionId?.trim(),c=j5(e)?Q7(o):null,l=e.state.lastStatus?b(`cronLastStatus${e.state.lastStatus[0].toUpperCase()}${e.state.lastStatus.slice(1)}`):b(`cronNeverRun`);return(0,U.jsx)(iee,{open:t,onOpenChange:r,children:(0,U.jsxs)(Rn,{side:`right`,closeLabel:b(`cronCloseDetails`),className:`flex w-full flex-col overflow-hidden p-0 sm:max-w-[510px]`,children:[(0,U.jsxs)(aee,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,U.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:k5(e)}),(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`span`,{children:b(s?`cronBoundSession`:`cronDedicatedSession`)})]}),(0,U.jsx)(Nn,{children:e.name||e.id}),(0,U.jsx)(jn,{children:b(`cronDetailDescription`)})]}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:b(`cronTaskPrompt`)}),(0,U.jsx)(`div`,{className:`rounded-2xl bg-muted/55 px-4 py-3 text-sm leading-6 text-foreground`,children:e.payload.message})]}),(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:b(`cronTaskDetails`)}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(M5,{label:b(`cronScheduleLabel`),value:k5(e)}),(0,U.jsx)(M5,{label:b(`cronNextRun`),value:E5(e.state.nextRunAt)}),(0,U.jsx)(M5,{label:b(`cronAgentLabel`),value:e.payload.agentId?.trim()||`main`}),(0,U.jsx)(M5,{label:b(`cronSessionLabel`),value:c?(0,U.jsx)(ge,{href:c,size:`xs`,className:`text-[hsl(var(--link-foreground))] underline decoration-[1.2px] underline-offset-2 hover:text-[hsl(var(--link-foreground-hover))]`,children:o}):o}),(0,U.jsx)(M5,{label:b(`cronCreatedAt`),value:E5(e.createdAt)})]})]}),(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:b(`cronLatestRun`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:b(`cronLatestRunHint`)})]}),(0,U.jsx)(`span`,{className:u(`rounded-full px-2.5 py-1 text-xs font-medium`,e.state.lastStatus===`error`?`bg-red-50 text-red-700`:e.state.lastStatus===`ok`?`bg-emerald-50 text-emerald-700`:`bg-muted text-muted-foreground`),children:l})]}),(0,U.jsxs)(`div`,{className:`rounded-2xl border border-border/60 px-4 py-1`,children:[(0,U.jsx)(M5,{label:b(`cronLastRun`),value:E5(e.state.lastRunAt)}),e.state.lastError?(0,U.jsx)(M5,{label:b(`cronLastError`),value:e.state.lastError}):null]})]}),(0,U.jsxs)(`section`,{className:`flex items-center justify-between rounded-2xl border border-border/60 px-4 py-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:e.enabled?b(`cronEnabledState`):b(`cronPaused`)}),(0,U.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:b(`cronToggleHint`)})]}),(0,U.jsx)(Ie,{checked:e.enabled,onCheckedChange:t=>a(e,t),"aria-label":e.enabled?b(`cronDisable`):b(`cronEnable`)})]}),c?null:(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b(`cronSessionAvailableAfterRun`)})]}),(0,U.jsxs)(Hn,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[(0,U.jsxs)(L,{variant:`ghost`,className:`text-red-600 hover:bg-red-50 hover:text-red-700`,onClick:()=>n(e),children:[(0,U.jsx)(ms,{className:`mr-2 h-4 w-4`}),b(`delete`)]}),c?(0,U.jsx)(ge,{href:c,className:u($t({variant:`outline`}),`hover:no-underline`),children:b(`cronOpenSession`)}):(0,U.jsx)(L,{variant:`outline`,disabled:!0,children:b(`cronOpenSession`)}),(0,U.jsxs)(L,{onClick:()=>i(e),children:[(0,U.jsx)(Ko,{className:`mr-2 h-4 w-4`}),b(`cronRunNow`)]})]})]})})}function Yre({job:e}){let t=e.state.lastStatus===`error`,n=t?b(`cronNeedsAttention`):e.enabled?b(`cronRunningNormally`):b(`cronPaused`);return(0,U.jsxs)(`span`,{className:u(`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium`,t?`bg-red-50 text-red-700`:e.enabled?`bg-emerald-50 text-emerald-700`:`bg-muted text-muted-foreground`),children:[(0,U.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,t?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-muted-foreground/50`)}),n]})}function Xre({expanded:e,job:t,onDelete:n,onEdit:r,onRun:i,onToggleExpanded:a,onToggle:o}){let[s,c]=(0,H.useState)(!1),l=!!t.payload.sessionId?.trim(),d=t.state.lastStatus===`error`,f=d?hs:jr,p=t.name||t.id,m=`cron-job-preview-${t.id}`,h=A5(t),g=j5(t)?Q7(h):null;return(0,U.jsxs)(`div`,{className:u(`group relative rounded-xl border-b border-border/55 transition-colors duration-150 last:border-b-0 hover:bg-muted/35 focus-within:bg-muted/35`,e&&`bg-muted/35`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-1 py-3.5`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`grid min-w-0 flex-1 grid-cols-[36px_minmax(0,1fr)] items-center gap-3 rounded-lg pr-16 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-controls":m,"aria-expanded":e,"aria-label":`${b(e?`cronCollapseTask`:`cronExpandTask`)} ${p}`,onClick:()=>a(t),children:[(0,U.jsx)(`span`,{className:u(`flex h-9 w-9 items-center justify-center rounded-xl`,d?`bg-amber-50 text-amber-600`:`bg-emerald-50 text-emerald-600`),children:(0,U.jsx)(f,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`strong`,{className:`truncate text-[13px] font-semibold text-foreground`,children:p}),(0,U.jsx)(Yre,{job:t}),(0,U.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:b(l?`cronBoundSession`:`cronDedicatedSession`)}),t.deleteAfterRun?(0,U.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:b(`cronOneShot`)}):null]}),(0,U.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(fa,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),k5(t)]}),t.state.nextRunAt?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(Ca,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),b(`cronNextRun`),` `,D5(t.state.nextRunAt)]}):null]})]})]}),(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(`div`,{className:`relative flex shrink-0 items-center`,children:[(0,U.jsxs)(`div`,{className:`absolute right-11 top-1/2 flex -translate-y-1/2 items-center gap-0.5 opacity-100 transition-opacity duration-150 [@media(hover:hover)]:pointer-events-none [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-focus-within:pointer-events-auto [@media(hover:hover)]:group-focus-within:opacity-100 [@media(hover:hover)]:group-hover:pointer-events-auto [@media(hover:hover)]:group-hover:opacity-100`,children:[(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(L,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t),"aria-label":`${b(`cronEditDetails`)} ${p}`,children:(0,U.jsx)(Go,{className:`h-3.5 w-3.5`})})}),(0,U.jsx)(ui,{children:b(`cronEditDetails`)})]}),(0,U.jsxs)(CF,{open:s,onOpenChange:c,children:[(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(L,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":`${b(`cronMoreActions`)} ${p}`,children:(0,U.jsx)($r,{className:`h-4 w-4`})})})}),(0,U.jsx)(ui,{children:b(`cronMoreActions`)})]}),(0,U.jsxs)(EF,{align:`end`,sideOffset:4,className:`w-40 p-1`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{c(!1),i(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted`,children:[(0,U.jsx)(Ko,{className:`h-3.5 w-3.5 text-muted-foreground`}),b(`cronRunNow`)]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{c(!1),n(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 transition-colors hover:bg-red-50`,children:[(0,U.jsx)(ms,{className:`h-3.5 w-3.5`}),b(`delete`)]})]})]})]}),(0,U.jsx)(Ie,{checked:t.enabled,onCheckedChange:e=>o(t,e),"aria-label":t.enabled?b(`cronDisable`):b(`cronEnable`)})]})})]}),(0,U.jsx)(`div`,{id:m,"aria-hidden":!e,className:u(`grid transition-[grid-template-rows,opacity] duration-200 ease-out`,e?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`),children:(0,U.jsx)(`div`,{className:`overflow-hidden`,children:(0,U.jsxs)(`div`,{className:`mb-3 ml-12 mr-1 rounded-xl bg-background/70 px-4 py-3`,children:[(0,U.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:b(`cronTaskPrompt`)}),(0,U.jsx)(`p`,{className:`mt-1.5 line-clamp-4 text-xs leading-5 text-foreground`,children:t.payload.message}),(0,U.jsxs)(`dl`,{className:`mt-3 grid gap-x-5 gap-y-2 border-t border-border/50 pt-3 text-[11px] sm:grid-cols-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`cronAgentLabel`)}),(0,U.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:t.payload.agentId?.trim()||`main`})]}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`cronSessionLabel`)}),(0,U.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:g?(0,U.jsx)(ge,{href:g,size:`xs`,className:`max-w-full truncate text-[11px] text-[hsl(var(--link-foreground))] underline decoration-[1.2px] underline-offset-2 hover:text-[hsl(var(--link-foreground-hover))]`,children:h}):h})]}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`dt`,{className:`text-muted-foreground`,children:b(`cronLastRun`)}),(0,U.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:E5(t.state.lastRunAt)})]})]}),t.state.lastError?(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 border-t border-red-100 pt-3 text-[11px] leading-5 text-red-700`,children:t.state.lastError}):null]})})})]})}var P5=[{titleKey:`cronTemplateAiNewsTitle`,descriptionKey:`cronTemplateAiNewsDescription`,promptKey:`cronTemplateAiNewsPrompt`,icon:No},{titleKey:`cronTemplateWeeklyReviewTitle`,descriptionKey:`cronTemplateWeeklyReviewDescription`,promptKey:`cronTemplateWeeklyReviewPrompt`,icon:pee},{titleKey:`cronTemplateMeetingPrepTitle`,descriptionKey:`cronTemplateMeetingPrepDescription`,promptKey:`cronTemplateMeetingPrepPrompt`,icon:pa},{titleKey:`cronTemplateLearningTitle`,descriptionKey:`cronTemplateLearningDescription`,promptKey:`cronTemplateLearningPrompt`,icon:Ei},{titleKey:`cronTemplateCompetitorTitle`,descriptionKey:`cronTemplateCompetitorDescription`,promptKey:`cronTemplateCompetitorPrompt`,icon:ho},{titleKey:`cronTemplateFamilyTitle`,descriptionKey:`cronTemplateFamilyDescription`,promptKey:`cronTemplateFamilyPrompt`,icon:ao}],F5=(0,H.forwardRef)(function({prominent:e=!1,value:t,onChange:n,onSubmit:r},i){return(0,U.jsxs)(`form`,{className:u(`relative w-full`,e&&`mx-auto max-w-3xl`),onSubmit:e=>{e.preventDefault(),r()},children:[(0,U.jsx)(Ir,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`,"aria-hidden":`true`}),(0,U.jsx)(Ct,{ref:i,value:t,onChange:e=>n(e.target.value),className:`pl-9 pr-11`,placeholder:b(`cronComposerPlaceholder`),"aria-label":b(`cronComposerLabel`)}),(0,U.jsx)(L,{type:`submit`,size:`icon`,className:`absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 rounded-full shadow-none`,disabled:!t.trim(),"aria-label":b(`cronComposerSubmit`),children:(0,U.jsx)(ca,{className:`h-4 w-4`})})]})});function I5({compact:e=!1,onSelect:t}){return(0,U.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,17.5rem),1fr))] gap-3`,children:(e?P5.slice(0,4):P5).map(e=>{let n=e.icon;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t(b(e.promptKey)),className:`group grid min-h-24 grid-cols-[38px_minmax(0,1fr)] items-center gap-3 rounded-2xl border border-border/60 bg-card px-4 py-4 text-left transition-all hover:-translate-y-0.5 hover:border-primary/20 hover:shadow-[0_12px_30px_rgba(30,45,52,0.08)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-muted text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary`,children:(0,U.jsx)(n,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:b(e.titleKey)}),(0,U.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-muted-foreground`,children:b(e.descriptionKey)})]})]},e.titleKey)})})}function L5(e={all:!0}){return z({queryKey:[`cron`,e],queryFn:()=>wt(e),placeholderData:e=>e,staleTime:1e4})}function R5(){let e=xe();return{onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),I.success(b(`configSavedApplied`))},onError:e=>{I.error(b(`configSaveFailed`)+`: `+e.message)}}}function Zre(){return R({mutationFn:({id:e})=>an(e),...R5()})}function Qre(){return R({mutationFn:({id:e,enabled:t})=>bt(e,{enabled:t}),...R5()})}function $re(){return R({mutationFn:({id:e,force:t})=>Cn(e,{force:t}),...R5()})}function z5(e){return e.name?`${e.name} (${e.id})`:e.id}function B5(){let e=Zre(),t=$re(),n=Qre(),{confirm:r,ConfirmDialog:i}=On(),[a,o]=(0,H.useState)(new Set),s=async(e,t,n)=>{o(t=>new Set(t).add(e.id));try{return await t(),n?.(),!0}catch{return!1}finally{o(t=>{let n=new Set(t);return n.delete(e.id),n})}};return{ConfirmDialog:i,deleteJob:async(t,n)=>await r({title:`${b(`cronDeleteConfirm`)}?`,description:z5(t),confirmLabel:b(`delete`),variant:`destructive`})?await s(t,()=>e.mutateAsync({id:t.id}),n):!1,isPending:e=>a.has(e.id),runJob:async(e,n)=>{let i=!e.enabled;return i&&!await r({title:`${b(`cronRunForceConfirm`)}?`,description:z5(e),confirmLabel:b(`cronRunNow`)})?!1:await s(e,()=>t.mutateAsync({id:e.id,force:i}),n)},toggleJob:async(e,t,r)=>await s(e,()=>n.mutateAsync({id:e.id,enabled:t}),r)}}var V5=10;function eie({summary:e}){let{attention:t,disabled:n,enabled:r,total:i}=e,a=[{label:b(`cronSummaryTotal`),value:i},{label:b(`cronSummaryEnabled`),value:r},{label:b(`cronSummaryPaused`),value:n}],o=t>0?Hr:_a;return(0,U.jsxs)(`section`,{"aria-label":b(`cronSummaryLabel`),className:`grid grid-cols-3 overflow-hidden rounded-2xl bg-border/60 sm:grid-cols-[minmax(220px,1.35fr)_repeat(3,minmax(100px,0.55fr))] sm:gap-px`,children:[(0,U.jsxs)(`div`,{className:`col-span-3 flex items-center gap-3 bg-muted/40 px-4 py-3.5 sm:col-span-1`,children:[(0,U.jsx)(`span`,{className:u(`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl`,t>0?`bg-amber-50 text-amber-600`:`bg-emerald-50 text-emerald-600`),children:(0,U.jsx)(o,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`strong`,{className:`block truncate text-xs font-semibold text-foreground`,children:t>0?`${t} ${b(`cronAttentionSummary`)}`:b(`cronAllHealthy`)}),(0,U.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:b(t>0?`cronAttentionSummaryHint`:`cronAllHealthyHint`)})]})]}),a.map(e=>(0,U.jsxs)(`div`,{className:`bg-muted/40 px-4 py-3.5 sm:px-5`,children:[(0,U.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:e.value}),(0,U.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.label})]},e.label))]})}function tie({page:e,total:t,disabled:n,onPageChange:r}){let i=Math.ceil(t/V5);if(i<=1)return null;let a=e*V5+1,o=Math.min(t,a+V5-1);return(0,U.jsxs)(`nav`,{"aria-label":b(`cronPaginationLabel`),className:`flex items-center justify-between gap-3 border-b border-border/60 py-3 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`tabular-nums`,children:[a,`–`,o,` / `,t]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e===0,onClick:()=>r(e-1),"aria-label":b(`cronPreviousPage`),children:(0,U.jsx)(ma,{className:`h-4 w-4`})}),(0,U.jsxs)(`span`,{className:`min-w-14 text-center tabular-nums text-foreground`,children:[e+1,` / `,i]}),(0,U.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e>=i-1,onClick:()=>r(e+1),"aria-label":b(`cronNextPage`),children:(0,U.jsx)(ha,{className:`h-4 w-4`})})]})]})}function nie(){let[e,t]=(0,H.useState)(``),[n,r]=(0,H.useState)(``),[i,a]=(0,H.useState)(`all`),[o,s]=(0,H.useState)(0),[c,l]=(0,H.useState)(null),[d,f]=(0,H.useState)(null),p=(0,H.useDeferredValue)(n.trim()),m=(0,H.useRef)(null),h=eI(),g=L5({all:!0,limit:V5,offset:o*V5,query:p,status:i}),_=B5(),v=g.data?.jobs??[],y=g.data?.total??0,x=g.data?.summary,S=v.find(e=>e.id===d)??null,C=()=>{let t=e.trim();if(!t){m.current?.focus();return}h.chatSessionListManager.createSession({prompt:t})},w=e=>{t(e),m.current?.focus()},T=e=>{_.deleteJob(e,()=>{l(null),f(null),v.length===1&&o>0&&s(o-1)})},E=(e,t)=>{_.toggleJob(e,t,()=>{(i===`enabled`&&!t||i===`disabled`&&t)&&v.length===1&&o>0&&s(o-1)})},D=e=>{_.runJob(e)},O=e=>{l(null),s(e)},k=e=>{l(t=>t===e.id?null:e.id)},A=(x?.total??0)>0;return(0,U.jsxs)(Vt,{className:`space-y-6`,children:[(0,U.jsx)(St,{headingLevel:1,title:b(`cronPageTitle`),description:b(`cronPageDescription`),actions:(0,U.jsx)(V,{size:`lg`,label:b(`refresh`),icon:(0,U.jsx)(ki,{className:u(`h-4 w-4`,g.isFetching&&`animate-spin`)}),onClick:()=>{o===0?(l(null),g.refetch()):O(0)}})}),A?(0,U.jsx)(F5,{ref:m,value:e,onChange:t,onSubmit:C}):null,g.isLoading?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 text-muted-foreground`,children:[(0,U.jsx)(ki,{className:`mb-3 h-5 w-5 animate-spin`}),(0,U.jsx)(`span`,{className:`text-sm`,children:b(`cronLoading`)})]}):A?(0,U.jsxs)(U.Fragment,{children:[x?(0,U.jsx)(eie,{summary:x}):null,(0,U.jsxs)(`section`,{className:`pt-1`,children:[(0,U.jsx)(`div`,{className:`mb-3 flex items-end justify-between gap-4`,children:(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(`cronMyTasks`)}),(0,U.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[y,` `,b(`cronTaskCountUnit`)]})]})}),(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-[220px] flex-1`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,U.jsx)(Ct,{value:n,onChange:e=>{r(e.target.value),O(0)},placeholder:b(`cronSearchPlaceholder`),className:`pl-9`})]}),(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,"aria-label":b(`cronStatusLabel`),children:[[`all`,`cronStatusAll`],[`enabled`,`cronStatusEnabled`],[`disabled`,`cronStatusDisabled`],[`attention`,`cronStatusAttention`]].map(([e,t])=>(0,U.jsx)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>{a(e),O(0)},className:u(`rounded-lg px-2.5 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,i===e&&`bg-muted text-foreground`),children:b(t)},e))})]}),v.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"aria-busy":g.isFetching,className:u(`border-y border-border/60 transition-opacity`,g.isFetching&&`opacity-60`),children:v.map(e=>(0,U.jsx)(Xre,{expanded:c===e.id,job:e,onDelete:T,onEdit:e=>f(e.id),onRun:D,onToggleExpanded:k,onToggle:E},e.id))}),(0,U.jsx)(tie,{page:o,total:y,disabled:g.isFetching,onPageChange:O})]}):(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center text-muted-foreground`,children:[(0,U.jsx)(Ti,{className:`mb-3 h-5 w-5`}),(0,U.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:b(`cronNoMatchingTasks`)}),(0,U.jsx)(`span`,{className:`mt-1 text-xs`,children:b(`cronNoMatchingTasksHint`)})]})]}),(0,U.jsxs)(`section`,{className:`pt-2`,children:[(0,U.jsxs)(`div`,{className:`mb-3`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(`cronNeedInspiration`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:b(`cronTemplateSelectionHint`)})]}),(0,U.jsx)(I5,{compact:!0,onSelect:w})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`section`,{className:`flex min-h-[270px] flex-col items-center justify-center rounded-3xl bg-muted/25 px-4 py-10 text-center sm:px-8`,children:[(0,U.jsx)(`span`,{className:`mb-4 flex h-11 w-11 items-center justify-center rounded-2xl bg-card shadow-sm`,children:(0,U.jsx)(vo,{className:`h-5 w-5 text-primary`})}),(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:b(`cronEmptyHeroTitle`)}),(0,U.jsx)(`p`,{className:`mb-6 mt-2 max-w-2xl text-sm leading-6 text-muted-foreground`,children:b(`cronEmptyHeroDescription`)}),(0,U.jsx)(F5,{ref:m,prominent:!0,value:e,onChange:t,onSubmit:C}),(0,U.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:b(`cronComposerHint`)})]}),(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-3`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(`cronStartFromResult`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:b(`cronTemplateSelectionHint`)})]}),(0,U.jsx)(I5,{onSelect:w})]})]}),(0,U.jsx)(N5,{job:S,open:!!S,onOpenChange:e=>{e||f(null)},onDelete:T,onRun:D,onToggle:E}),(0,U.jsx)(_.ConfirmDialog,{})]})}function rie({job:e}){let t=e.state.lastStatus===`error`,n=t?b(`cronNeedsAttention`):e.enabled?b(`cronRunningNormally`):b(`cronPaused`);return(0,U.jsxs)(`span`,{className:u(`inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium`,t?`bg-red-50 text-red-700`:e.enabled?`bg-emerald-50 text-emerald-700`:`bg-muted text-muted-foreground`),children:[(0,U.jsx)(`span`,{className:u(`h-1.5 w-1.5 rounded-full`,t?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-muted-foreground/50`)}),n]})}function iie({cronActions:e,job:t,onOpenDetails:n}){let[r,i]=(0,H.useState)(!1),a=e.isPending(t),o=t.state.lastStatus===`error`,s=o?hs:jr,c=t.name||t.id;return(0,U.jsxs)(`article`,{className:`rounded-2xl border border-border/60 bg-background px-3.5 py-3 shadow-sm transition-colors hover:bg-muted/20 focus-within:bg-muted/20`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:u(`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl`,o?`bg-amber-50 text-amber-600`:t.enabled?`bg-emerald-50 text-emerald-600`:`bg-muted text-muted-foreground`),children:(0,U.jsx)(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:c}),(0,U.jsx)(rie,{job:t})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(fa,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),k5(t)]}),t.enabled&&t.state.nextRunAt?(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(Ca,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),b(`cronNextRun`),` `,D5(t.state.nextRunAt)]}):null]})]}),(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`span`,{children:(0,U.jsx)(Ie,{checked:t.enabled,disabled:a,onCheckedChange:n=>{e.toggleJob(t,n)},"aria-label":t.enabled?b(`cronDisable`):b(`cronEnable`)})})}),(0,U.jsx)(ui,{children:t.enabled?b(`cronDisable`):b(`cronEnable`)})]})})]}),(0,U.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-muted-foreground`,children:t.payload.message}),t.enabled?null:(0,U.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:b(`cronToggleHint`)}),t.state.lastError?(0,U.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[11px] leading-5 text-red-700`,children:t.state.lastError}):null,(0,U.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-border/50 pt-2.5`,children:[(0,U.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:()=>n(t),children:b(`cronEditDetails`)}),(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(CF,{open:r,onOpenChange:i,children:[(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,disabled:a,"aria-label":`${b(`cronMoreActions`)} ${c}`,children:(0,U.jsx)($r,{className:`h-4 w-4`})})})}),(0,U.jsx)(ui,{children:b(`cronMoreActions`)})]}),(0,U.jsxs)(EF,{align:`end`,sideOffset:4,className:`w-40 p-1`,children:[(0,U.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{i(!1),e.runJob(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,children:[(0,U.jsx)(Ko,{className:`h-3.5 w-3.5 text-muted-foreground`}),b(`cronRunNow`)]}),(0,U.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>{i(!1),e.deleteJob(t)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm text-red-600 transition-colors hover:bg-red-50 disabled:cursor-not-allowed disabled:opacity-50`,children:b(`delete`)})]})]})})]})]})}function aie({jobs:e,isError:t=!1,isLoading:n=!1,onRetry:r}){let[i,a]=(0,H.useState)(null),o=B5(),s=e.find(e=>e.id===i)??null;return(0,U.jsxs)(`div`,{className:`h-full overflow-y-auto custom-scrollbar px-4 py-4`,children:[(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:b(`chatWorkspaceSessionCronJobs`)}),(0,U.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[b(`cronTotalLabel`),`: `,e.length]})]}),n?(0,U.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:b(`cronLoading`)}):t?(0,U.jsxs)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:[(0,U.jsx)(`p`,{children:b(`cronLoadFailed`)}),r?(0,U.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-2`,onClick:r,children:b(`cronRetry`)}):null]}):e.length===0?(0,U.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:b(`chatWorkspaceCronJobEmpty`)}):(0,U.jsx)(`div`,{className:`space-y-2.5`,children:e.map(e=>(0,U.jsx)(iie,{cronActions:o,job:e,onOpenDetails:e=>a(e.id)},e.id))}),(0,U.jsx)(N5,{job:s,open:!!s,onOpenChange:e=>{e||a(null)},onDelete:e=>{o.deleteJob(e,()=>a(null))},onRun:e=>{o.runJob(e)},onToggle:(e,t)=>{o.toggleJob(e,t)}}),(0,U.jsx)(o.ConfirmDialog,{})]})}function oie({childSessionTabs:e,sessionKey:t}){let n=eI();return(0,U.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-gray-900`,children:b(`chatWorkspaceChildSessions`)}),(0,U.jsx)(`span`,{className:`rounded-full bg-gray-100 px-1.5 py-0.5 text-[10px] font-semibold tabular-nums text-gray-500`,children:e.length})]}),(0,U.jsxs)(`button`,{type:`button`,className:`inline-flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-2.5 py-1.5 text-xs font-semibold text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25 disabled:cursor-not-allowed disabled:opacity-50`,disabled:!t,onClick:()=>n.chatThreadManager.openSideChatDraft(t),children:[(0,U.jsx)(wo,{className:`h-3.5 w-3.5`}),(0,U.jsx)(`span`,{children:b(`chatWorkspaceCreateChildSession`)})]})]}),e.length===0?(0,U.jsx)(`div`,{className:`py-10 text-center text-sm text-gray-500`,children:b(`chatWorkspaceChildSessionsEmpty`)}):(0,U.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>(0,U.jsxs)(`div`,{className:`group relative flex w-full items-center rounded-lg border border-gray-200/80 bg-white transition-colors hover:border-gray-300 hover:bg-gray-50`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-3 px-3 py-3 pr-12 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/25`,onClick:()=>n.chatThreadManager.selectChildSessionDetail(e.sessionKey),children:[(0,U.jsx)(`span`,{className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-600`,children:(0,U.jsx)(to,{className:`h-4 w-4`})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm font-medium text-gray-900`,children:e.title}),e.projectName||e.sessionTypeLabel?(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-gray-500`,children:[e.sessionTypeLabel,e.projectName].filter(Boolean).join(` · `)}):null]}),(0,U.jsx)(ha,{className:`h-4 w-4 shrink-0 text-gray-300 transition-transform group-hover:translate-x-0.5 group-hover:text-gray-500`})]}),(0,U.jsx)(OF,{sessionKey:e.sessionKey,triggerSize:`sm`,triggerTone:`strong`,className:`absolute right-2 top-1/2 -translate-y-1/2 bg-white opacity-100 md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`})]},e.sessionKey))})]})})}function H5(e){return e===null?`—`:new Intl.NumberFormat().format(e)}function U5(e){return e===null?`—`:new Intl.NumberFormat().format(e)}function W5(e){return e===null?`—`:new Intl.NumberFormat(void 0,{style:`percent`,maximumFractionDigits:1}).format(e)}function G5({status:e}){return(0,U.jsx)(`span`,{className:u(`inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[10px] font-semibold`,e===`reported`?`bg-emerald-50 text-emerald-700`:e===`partial`?`bg-amber-50 text-amber-700`:`bg-gray-100 text-gray-500`),children:b(e===`reported`?`chatWorkspaceTokenUsageReported`:e===`partial`?`chatWorkspaceTokenUsagePartial`:`chatWorkspaceTokenUsageUnavailable`)})}function K5({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`min-w-0 rounded-md bg-gray-50 px-2.5 py-2`,children:[(0,U.jsx)(`div`,{className:`truncate text-[10px] font-medium text-gray-500`,children:e}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate text-sm font-semibold tabular-nums text-gray-900`,children:t})]})}function sie({sessionKey:e}){let t=uL(e),n=t.data;return(0,U.jsxs)(`section`,{"aria-labelledby":`chat-workspace-token-usage-title`,className:`mt-4 rounded-lg border border-gray-200/80 bg-white p-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-600`,children:(0,U.jsx)(mee,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`h3`,{id:`chat-workspace-token-usage-title`,className:`text-sm font-semibold text-gray-900`,children:b(`chatWorkspaceTokenUsage`)}),n?(0,U.jsx)(G5,{status:n.status}):null]}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceTokenUsageDescription`)})]})]}),t.isLoading?(0,U.jsx)(`p`,{className:`py-5 text-center text-xs text-gray-500`,"aria-live":`polite`,children:b(`chatWorkspaceTokenUsageLoading`)}):t.isError?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-4 text-xs text-rose-600`,role:`alert`,children:[(0,U.jsx)(`span`,{children:b(`chatWorkspaceTokenUsageLoadFailed`)}),(0,U.jsx)(`button`,{type:`button`,className:`shrink-0 rounded px-1.5 py-1 font-semibold text-gray-700 hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25`,onClick:()=>void t.refetch(),children:b(`chatWorkspaceTokenUsageRetry`)})]}):n&&n.runCount>0?(0,U.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageTotal`),value:H5(n.totals.totalTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageInput`),value:H5(n.totals.inputTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageOutput`),value:H5(n.totals.outputTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageCachedInput`),value:H5(n.totals.cachedInputTokens)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageCacheHitRate`),value:W5(n.totals.cacheHitRate)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageRuns`),value:String(n.runCount)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageModelCalls`),value:U5(n.modelCallCount)}),(0,U.jsx)(K5,{label:b(`chatWorkspaceTokenUsageReportedModelCalls`),value:U5(n.reportedModelCallCount)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`mb-1.5 text-[11px] font-medium text-gray-700`,children:b(`chatWorkspaceTokenUsageByModel`)}),(0,U.jsx)(`div`,{className:`space-y-1.5`,children:n.models.map(e=>(0,U.jsxs)(`div`,{className:`rounded-md border border-gray-200/70 px-2.5 py-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate text-xs font-semibold text-gray-900`,title:e.model,children:e.model}),(0,U.jsx)(G5,{status:e.status})]}),(0,U.jsxs)(`div`,{className:`mt-1 text-[10px] text-gray-500`,children:[b(`chatWorkspaceTokenUsageModelRunCount`).replace(`{count}`,String(e.runCount)),` · `,b(`chatWorkspaceTokenUsageModelCallCount`).replace(`{count}`,U5(e.modelCallCount)),` · `,b(`chatWorkspaceTokenUsageModelCacheHitRate`).replace(`{rate}`,W5(e.cacheHitRate))]}),(0,U.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-1 text-[10px] sm:grid-cols-4`,children:[[b(`chatWorkspaceTokenUsageInput`),e.inputTokens],[b(`chatWorkspaceTokenUsageOutput`),e.outputTokens],[b(`chatWorkspaceTokenUsageCachedInput`),e.cachedInputTokens],[b(`chatWorkspaceTokenUsageTotal`),e.totalTokens]].map(([e,t])=>(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-1 sm:block`,children:[(0,U.jsx)(`dt`,{className:`truncate text-gray-500`,children:e}),(0,U.jsx)(`dd`,{className:`shrink-0 font-semibold tabular-nums text-gray-800 sm:mt-0.5`,children:H5(t)})]},String(e)))})]},e.model))})]})]}):(0,U.jsx)(`p`,{className:`py-5 text-center text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceTokenUsageEmpty`)})]})}var cie={active:`border-emerald-200 bg-emerald-50 text-emerald-700`,paused:`border-amber-200 bg-amber-50 text-amber-700`,degraded:`border-orange-200 bg-orange-50 text-orange-700`,expired:`border-gray-200 bg-gray-100 text-gray-600`,broken:`border-rose-200 bg-rose-50 text-rose-700`};function q5(e,t){return e.replace(`{count}`,String(t))}function lie(e){return b(`chatWorkspaceContinuousAttentionStatus${e[0].toUpperCase()}${e.slice(1)}`)}function J5(e){return b(e===`context`?`chatWorkspaceContinuousAttentionState`:`chatWorkspaceContinuousAttentionEvents`)}function uie({item:e,isPending:t,onAction:n}){let r=e.status===`active`||e.status===`paused`,i=e.status===`active`?`pause`:`resume`,a=b(i===`pause`?`chatWorkspaceContinuousAttentionPause`:`chatWorkspaceContinuousAttentionResume`);return(0,U.jsxs)(`article`,{className:`rounded-xl border border-gray-200/80 bg-white p-3 shadow-sm`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`mt-0.5 inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-500`,children:e.kind===`context`?(0,U.jsx)(Fa,{className:`h-4 w-4`}):(0,U.jsx)(co,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`h3`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.title}),(0,U.jsx)(`span`,{className:u(`rounded-full border px-1.5 py-0.5 text-[10px] font-medium`,cie[e.status]),children:lie(e.status)})]}),(0,U.jsxs)(`p`,{className:`mt-0.5 truncate text-[11px] text-gray-400`,children:[e.extensionId,` · `,J5(e.kind)]}),e.description?(0,U.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-gray-600`,children:e.description}):null,e.statusReason?(0,U.jsxs)(`p`,{className:`mt-2 flex gap-1.5 text-xs leading-5 text-orange-700`,children:[(0,U.jsx)(hs,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,U.jsx)(`span`,{children:e.statusReason})]}):null,e.safeConfigPreview?(0,U.jsx)(`p`,{className:`mt-2 rounded-md bg-gray-50 px-2 py-1.5 text-[11px] leading-5 text-gray-500`,children:e.safeConfigPreview}):null,(0,U.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-gray-400`,children:[(0,U.jsxs)(`span`,{children:[b(`chatWorkspaceContinuousAttentionCreated`),`: `,M(e.createdAt)]}),e.expiresAt?(0,U.jsxs)(`span`,{children:[b(`chatWorkspaceContinuousAttentionExpires`),`: `,M(e.expiresAt)]}):null,e.lastReadAt?(0,U.jsxs)(`span`,{children:[b(`chatWorkspaceContinuousAttentionLastRead`),`: `,M(e.lastReadAt)]}):null,e.kind===`events`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:q5(b(`chatWorkspaceContinuousAttentionPending`),e.pendingCount??0)}),e.suppressedCount?(0,U.jsx)(`span`,{children:q5(b(`chatWorkspaceContinuousAttentionSuppressed`),e.suppressedCount)}):null,e.deliveryFailureCount?(0,U.jsx)(`span`,{className:`text-rose-600`,children:q5(b(`chatWorkspaceContinuousAttentionFailures`),e.deliveryFailureCount)}):null]}):null]})]})]}),(0,U.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-2 border-t border-gray-100 pt-2`,children:[r?(0,U.jsxs)(`button`,{type:`button`,"data-testid":`observation-${e.id}-${i}`,disabled:t,className:`inline-flex items-center gap-1.5 rounded-md border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>n(i),children:[i===`pause`?(0,U.jsx)(Uo,{className:`h-3.5 w-3.5`}):(0,U.jsx)(Ko,{className:`h-3.5 w-3.5`}),t?b(`chatWorkspaceContinuousAttentionUpdating`):a]}):null,(0,U.jsxs)(`button`,{type:`button`,"data-testid":`observation-${e.id}-remove`,disabled:t,className:`inline-flex items-center gap-1.5 rounded-md border border-rose-200 px-2.5 py-1.5 text-xs font-medium text-rose-700 transition-colors hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>n(`remove`),children:[(0,U.jsx)(ms,{className:`h-3.5 w-3.5`}),b(`chatWorkspaceContinuousAttentionRemove`)]})]})]})}function die({sessionKey:e}){let[t,n]=(0,H.useState)(`context`),[r,i]=(0,H.useState)(!1),a=fL(e),o=pL(e),{confirm:s,ConfirmDialog:c}=On();if(!e)return null;let l=a.data,d=t===`context`?l?.bindings??[]:l?.subscriptions??[],f=async(e,t)=>{if(!(t===`remove`&&!await s({title:b(`chatWorkspaceContinuousAttentionRemoveTitle`),description:b(`chatWorkspaceContinuousAttentionRemoveDescription`),confirmLabel:b(`chatWorkspaceContinuousAttentionRemove`),variant:`destructive`}))){i(!1);try{await o.mutateAsync({kind:e.kind,id:e.id,action:t})}catch{i(!0)}}};return(0,U.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,U.jsx)(c,{}),(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(`span`,{className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,U.jsx)(Fa,{className:`h-4 w-4`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:b(`chatWorkspaceContinuousAttention`)}),(0,U.jsxs)(`p`,{className:`mt-1 break-all text-xs leading-5 text-gray-500`,children:[b(`chatWorkspaceContinuousAttentionDescription`),` · `,e]})]})]}),l?(0,U.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionTotal`),value:l.counts.total}),(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionState`),value:l.counts.context}),(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionEvents`),value:l.counts.events}),(0,U.jsx)(Y5,{label:b(`chatWorkspaceContinuousAttentionNeedsAttention`),value:l.counts.needsAttention})]}):null,(0,U.jsx)(`div`,{className:`mt-4 flex rounded-lg border border-gray-200 bg-white p-1`,role:`tablist`,children:[`context`,`events`].map(e=>{let r=e===`context`?l?.counts.context??0:l?.counts.events??0;return(0,U.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e,className:u(`flex-1 rounded-md px-3 py-2 text-xs font-medium transition-colors`,t===e?`bg-gray-100 text-gray-900`:`text-gray-500 hover:text-gray-700`),onClick:()=>n(e),children:[J5(e),` `,(0,U.jsx)(`span`,{className:`ml-1 tabular-nums text-gray-400`,children:r})]},e)})}),r?(0,U.jsx)(`p`,{className:`mt-2 text-xs text-rose-600`,children:b(`chatWorkspaceContinuousAttentionActionFailed`)}):null,a.isPending?(0,U.jsx)(`div`,{className:`mt-3 space-y-2`,"aria-label":b(`chatWorkspaceContinuousAttentionLoading`),children:[0,1].map(e=>(0,U.jsx)(`div`,{className:`h-28 animate-pulse rounded-xl border border-gray-200 bg-white`},e))}):a.isError?(0,U.jsxs)(`div`,{className:`mt-4 rounded-xl border border-rose-200 bg-rose-50 px-4 py-5 text-center`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-rose-800`,children:b(`chatWorkspaceContinuousAttentionLoadFailed`)}),(0,U.jsxs)(`button`,{type:`button`,className:`mt-3 inline-flex items-center gap-1.5 rounded-md border border-rose-200 bg-white px-3 py-1.5 text-xs font-medium text-rose-700`,onClick:()=>void a.refetch(),children:[(0,U.jsx)(ki,{className:`h-3.5 w-3.5`}),b(`chatWorkspaceContinuousAttentionRetry`)]})]}):d.length===0?(0,U.jsxs)(`div`,{className:`mt-4 rounded-xl border border-dashed border-gray-300 bg-white px-4 py-8 text-center`,children:[(0,U.jsx)(Sa,{className:`mx-auto h-5 w-5 text-gray-300`}),(0,U.jsx)(`p`,{className:`mt-2 text-sm font-medium text-gray-700`,children:b(`chatWorkspaceContinuousAttentionEmpty`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceContinuousAttentionEmptyDescription`)})]}):(0,U.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,U.jsx)(uie,{item:e,isPending:o.isPending&&o.variables?.id===e.id,onAction:t=>void f(e,t)},`${e.kind}:${e.id}`))})]})})}function Y5({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`rounded-lg border border-gray-200/80 bg-white px-3 py-2`,children:[(0,U.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide text-gray-400`,children:e}),(0,U.jsx)(`div`,{className:`mt-1 text-lg font-semibold tabular-nums text-gray-900`,children:t})]})}function fie({fileActive:e,projectFilesActive:t}){let n=eI(),r=(0,H.useRef)(null),i=(0,H.useRef)(null),a=$(e=>e.snapshot.workspaceExplorerOpen),o=$(e=>e.snapshot.workspaceExplorerWidth),s=$(e=>e.setSnapshot),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(null),f=u??o,p=(0,H.useCallback)(e=>s({workspaceExplorerOpen:e}),[s]);return(0,H.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>l(e.getBoundingClientRect().width<560);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),(0,H.useEffect)(()=>{if(!e||!c||!a)return;let t=e=>{e.key===`Escape`&&p(!1)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[c,a,e,p]),{compact:c,containerRef:r,explorerOpen:a,explorerOverlay:e&&c&&a,explorerWidth:f,onResizeStart:t=>{if(c||!e)return;t.preventDefault(),t.currentTarget.setPointerCapture?.(t.pointerId),i.current={startX:t.clientX,startWidth:f,width:f};let r=e=>{let t=i.current;if(!t)return;let n=AR(t.startWidth+e.clientX-t.startX);t.width=n,d(n)},a=()=>{let e=i.current?.width;typeof e==`number`&&n.chatThreadManager.setWorkspaceExplorerWidth(e),d(null),i.current=null,window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,a)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,a)},setExplorerOpen:p,showExplorer:t||e&&a}}function X5({count:e,description:t,icon:n,onClick:r,title:i}){return(0,U.jsxs)(`button`,{type:`button`,className:`group flex w-full items-center gap-3 rounded-lg border border-gray-200/80 bg-white px-3 py-3 text-left transition-colors hover:border-gray-300 hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25`,onClick:r,children:[(0,U.jsx)(`span`,{className:`inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-gray-100 text-gray-600`,children:n}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:i}),typeof e==`number`?(0,U.jsx)(`span`,{className:`rounded-full bg-gray-100 px-1.5 py-0.5 text-[10px] font-semibold tabular-nums text-gray-500`,children:e}):null]}),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-gray-500`,children:t})]}),(0,U.jsx)(ha,{className:`h-4 w-4 shrink-0 text-gray-300 transition-transform group-hover:translate-x-0.5 group-hover:text-gray-500`})]})}function pie({childSessionTabs:e,sessionCronJobs:t,sessionKey:n}){let r=eI(),i=fL(n);return(0,U.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:b(`chatWorkspaceOverview`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceOverviewDescription`)}),(0,U.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,U.jsx)(X5,{count:i.data?.counts.total??0,description:b(`chatWorkspaceContinuousAttentionDescription`),icon:(0,U.jsx)(Fa,{className:`h-4 w-4`}),title:b(`chatWorkspaceContinuousAttention`),onClick:()=>{n&&r.chatThreadManager.openContinuousAttention(n)}}),(0,U.jsx)(X5,{count:e.length,description:b(`chatWorkspaceChildSessionsDescription`),icon:(0,U.jsx)(to,{className:`h-4 w-4`}),title:b(`chatWorkspaceChildSessions`),onClick:()=>{n&&r.chatThreadManager.openChildSessions(n)}}),(0,U.jsx)(X5,{count:t.length,description:b(`chatWorkspaceSessionCronJobsDescription`),icon:(0,U.jsx)(ia,{className:`h-4 w-4`}),title:b(`chatWorkspaceSessionCronJobs`),onClick:()=>{n&&r.chatThreadManager.openSessionCronPanel(n)}}),(0,U.jsx)(X5,{description:b(`chatWorkspaceProjectFilesDescription`),icon:(0,U.jsx)(Ya,{className:`h-4 w-4`}),title:b(`chatWorkspaceProjectFiles`),onClick:()=>{n&&r.chatThreadManager.openProjectFiles(n)}})]}),(0,U.jsx)(sie,{sessionKey:n})]})})}function mie({activePath:e,onFileOpen:t,projectRoot:n,sessionKey:r,workingDir:i}){let a=eI(),o=n??i,s=MF({path:o,includeFiles:!0,enabled:!!o});return o?(0,U.jsx)(AJ,{activeRelativePath:e?xI({path:e,sessionProjectRoot:o}):null,browseQuery:s,onFileOpen:t??a.chatThreadManager.openFilePreview,sessionKey:r,renderStatus:({text:e,tone:t=`muted`})=>(0,U.jsx)(`div`,{className:u(`flex h-full items-center justify-center px-6 text-center text-sm`,t===`error`?`text-rose-600`:`text-gray-500`),children:e}),showRoot:!0},o):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-gray-500`,children:b(`chatWorkspaceProjectFilesUnavailable`)})}function hie(){return(0,U.jsxs)(`div`,{className:`border-b border-gray-200/70 px-4 py-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-gray-900`,children:[(0,U.jsx)(wo,{className:`h-4 w-4 shrink-0 text-primary`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`chatWorkspaceSideChatDraftTitle`)})]}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:b(`chatWorkspaceSideChatDraftSubtitle`)})]})}function gie({activeSelection:e,childSessionTabs:t,filePreviewRefreshVersion:n,sessionKey:r,sessionCronJobs:i,sessionCronJobsError:a=!1,sessionCronJobsLoading:o=!1,sessionProjectRoot:s,sessionWorkingDir:c,onRetrySessionCronJobs:l,explorerControl:u}){let d=eI();return e.kind===`overview`?(0,U.jsx)(pie,{childSessionTabs:t,sessionCronJobs:i,sessionKey:r}):e.kind===`child-sessions`?(0,U.jsx)(oie,{childSessionTabs:t,sessionKey:r}):e.kind===`continuous-attention`?(0,U.jsx)(die,{sessionKey:r}):e.kind===`side-chat-draft`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(hie,{}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,U.jsx)(T5,{materializationContext:{kind:`child`,parentSessionKey:e.draft.parentSessionKey,inheritContext:!0},sessionKey:null,showWelcomeForDraft:!1,onSessionMaterialized:t=>d.chatThreadManager.materializeSideChatDraft({draftKey:e.draft.draftKey,sessionKey:t})})})]}):e.kind===`child-session`?(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,U.jsx)(T5,{sessionKey:e.tab.sessionKey})}):e.kind===`file`?(0,U.jsx)(_Y,{breadcrumbLeading:(0,U.jsx)(V,{"data-testid":`workspace-explorer-toggle`,icon:u?.open?(0,U.jsx)(Lo,{className:`h-4 w-4`}):(0,U.jsx)(zo,{className:`h-4 w-4`}),label:b(u?.open?`chatWorkspaceHideProjectFiles`:`chatWorkspaceShowProjectFiles`),size:`sm`,tooltipSide:`bottom`,onClick:u?.onToggle}),file:e.file,refreshVersion:n,sessionProjectRoot:s,sessionWorkingDir:c,onFileOpen:d.chatThreadManager.openFilePreview,onTextExcerptAdd:e=>{d.chatComposerIntentManager.requestExcerptReference({targetSessionKey:r,...e})}}):(0,U.jsx)(aie,{jobs:i,isError:a,isLoading:o,onRetry:l})}function _ie({activeSelection:e,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,...i}){let a=e.kind===`project-files`,o=e.kind===`file`,s=eI(),{compact:c,containerRef:l,explorerOpen:d,explorerOverlay:f,explorerWidth:p,onResizeStart:m,setExplorerOpen:h,showExplorer:g}=fie({fileActive:o,projectFilesActive:a});return(0,U.jsxs)(`div`,{ref:l,"data-testid":`workspace-shared-explorer-layout`,className:`relative flex h-full min-h-0 flex-1 overflow-hidden`,children:[f?(0,U.jsx)(`button`,{"data-testid":`workspace-explorer-scrim`,type:`button`,"aria-label":b(`chatWorkspaceHideProjectFiles`),className:`absolute inset-0 z-10 bg-black/15`,onClick:()=>h(!1)}):null,(0,U.jsxs)(`div`,{"data-testid":`workspace-shared-explorer`,"data-mode":a?`full`:f?`overlay`:`side`,className:u(`relative min-h-0 shrink-0 flex-col border-r border-gray-200/80 bg-white`,g?`flex`:`hidden`,a?`flex-1 border-r-0`:null,f?`absolute inset-y-0 left-0 z-20 w-[min(320px,86%)] shadow-xl`:null),style:!a&&!f?{width:p}:void 0,"aria-hidden":!g,children:[(0,U.jsx)(mie,{activePath:o?e.file.path:null,onFileOpen:e=>{c&&h(!1),s.chatThreadManager.openFilePreview(e)},projectRoot:n,sessionKey:t,workingDir:r}),o&&!c?(0,U.jsx)(`div`,{"data-testid":`workspace-explorer-resize-handle`,"aria-label":b(`chatWorkspaceResizeProjectFiles`),"aria-orientation":`vertical`,"aria-valuemax":400,"aria-valuemin":192,"aria-valuenow":p,role:`separator`,className:`absolute inset-y-0 right-[-4px] z-20 w-2 cursor-ew-resize hover:bg-primary/10`,onPointerDown:m}):null]}),a?null:(0,U.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,U.jsx)(gie,{...i,activeSelection:e,explorerControl:o?{open:d,onToggle:()=>h(!d)}:void 0,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r})})]})}function vie({sessionKey:e,childSessionTabs:t,activeChildSessionKey:n,activeSideChatDraft:r,workspaceFileTabs:i,activeWorkspaceFileKey:a,closedWorkspaceTabEntries:o,workspaceNavigationHistory:s=[],workspaceNavigationHistoryIndex:c=0,activePanelKind:l,sessionCronJobs:d=[],sessionCronJobsError:f=!1,sessionCronJobsLoading:p=!1,onRetrySessionCronJobs:m,sessionProjectRoot:h,sessionWorkingDir:g,workspacePanelWidth:_=480,displayMode:v=`docked`}){let y=eI(),b=xe(),[x,S]=(0,H.useState)(!1),[C,w]=(0,H.useState)(0),T=hz(t),E=aL(e=>e.optimisticReadAtBySessionKey),D=_z({activeChildSessionKey:n,activeSideChatDraft:r,activeWorkspaceFileKey:a,activePanelKind:l,childSessionTabs:T,workspaceFileTabs:i}),O={entries:s,index:c};(0,H.useEffect)(()=>{y.chatThreadManager.syncVisibleWorkspaceSelection(D)},[D,y]);let k=(0,H.useMemo)(()=>yz({hasSession:!!e,resolvedChildTabs:T,activeSideChatDraft:r,closedWorkspaceTabEntries:o,workspaceFileTabs:i,activeSelection:D,optimisticReadAtBySessionKey:E,sessionProjectRoot:h??g,onAddFileToChat:({label:t,tokenKey:n})=>{y.chatComposerIntentManager.requestFileReference({targetSessionKey:e,tokenKey:n,label:t})},onSelectSession:y.chatThreadManager.selectChildSessionDetail,onSelectFile:y.chatThreadManager.selectWorkspaceFile,onOpenFileViewer:y.chatThreadManager.openWorkspaceFileViewer,onCloseTab:y.chatThreadManager.closeWorkspaceTab,onSelectOverview:()=>{e&&y.chatThreadManager.openWorkspaceOverview(e)},onSelectChildSessions:()=>{e&&y.chatThreadManager.openChildSessions(e)},onSelectProjectFiles:()=>{y.chatThreadManager.openProjectFiles(e)},onSelectCronJobs:()=>{e&&y.chatThreadManager.openSessionCronPanel(e)},onSelectContinuousAttention:()=>{e&&y.chatThreadManager.openContinuousAttention(e)}}),[D,r,o,E,y.chatThreadManager,y.chatComposerIntentManager,T,e,h,g,i]);if(!D)return null;let A=v===`docked`&&x,j=v===`overlay`||A,M=D.kind===`file`&&D.file.viewMode===`preview`?D.file:null,N=M?()=>{b.invalidateQueries({queryKey:$J({path:M.path,basePath:g})}),b.invalidateQueries({queryKey:jF({path:M.path,basePath:g,includeFiles:!0})}),w(e=>e+1)}:void 0;return(0,U.jsxs)(hi,{"data-testid":`chat-session-workspace-panel`,className:u(j?`bg-white`:`hidden border-gray-200/70 bg-white/95 backdrop-blur-sm md:flex`,A?`shadow-xl`:null),defaultWidth:_,width:_,minWidth:360,maxWidth:860,onWidthCommit:y.chatThreadManager.setWorkspacePanelWidth,overlay:j,overlayScope:A?`container`:`viewport`,children:[(0,U.jsx)(TU,{tabs:k,canGoBack:oi(O),canGoForward:pi(O),isMaximized:A,onGoBack:y.chatThreadManager.goBackWorkspacePanel,onGoForward:y.chatThreadManager.goForwardWorkspacePanel,onRefreshFile:N,onToggleMaximize:v===`docked`?()=>S(e=>!e):void 0,onClose:y.chatThreadManager.closeWorkspacePanel}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-white`,children:(0,U.jsx)(_ie,{activeSelection:D,childSessionTabs:T,filePreviewRefreshVersion:C,sessionKey:e,sessionCronJobs:d,sessionCronJobsError:f,sessionCronJobsLoading:p,onRetrySessionCronJobs:m,sessionProjectRoot:h,sessionWorkingDir:g})})]})}var yie=[];function bie(e,t){let n=eR(e=>e.snapshot.sessionsQuery?.data?.sessions??yie),r=(0,H.useMemo)(()=>{let r=e.childSessionTabs.filter(e=>e.parentSessionKey===t),i=new Set(r.map(e=>e.sessionKey));return[...r,...qI(n).filter(e=>e.parentSessionId===t&&!i.has(e.key)).map(e=>({sessionKey:e.key,parentSessionKey:t}))]},[t,n,e.childSessionTabs]),i=(0,H.useMemo)(()=>e.workspaceFileTabs.filter(e=>e.parentSessionKey===t),[t,e.workspaceFileTabs]),a=e.activeSideChatDraft?.parentSessionKey===t?e.activeSideChatDraft:null,o=L5({all:!0});return{childSessionTabs:r,activeSideChatDraft:a,workspaceFileTabs:i,sessionCronJobs:(0,H.useMemo)(()=>(o.data?.jobs??[]).filter(e=>Jre(e,t)),[o.data?.jobs,t]),sessionCronJobsError:o.isError,sessionCronJobsLoading:o.isLoading,retrySessionCronJobs:()=>{o.refetch()},showWorkspacePanel:e.workspacePanelParentKey===t&&e.activeWorkspacePanelKind!=null}}function xie({layoutMode:e,sessionKey:t}){let n=$(e=>e.snapshot),r=eR(e=>pI(e.snapshot.configQuery?.data?.agents.defaults.workspace)),i=yR(t),a=t?null:n.draftProjectRoot??r,{childSessionTabs:o,activeSideChatDraft:s,workspaceFileTabs:c,sessionCronJobs:l,sessionCronJobsError:u,sessionCronJobsLoading:d,retrySessionCronJobs:f,showWorkspacePanel:p}=bie(n,t);return p?(0,U.jsx)(vie,{sessionKey:t,childSessionTabs:t?o:[],activeChildSessionKey:n.activeChildSessionKey??null,activeSideChatDraft:s,workspaceFileTabs:c,activeWorkspaceFileKey:n.activeWorkspaceFileKey??null,closedWorkspaceTabEntries:n.closedWorkspaceTabEntries,workspaceNavigationHistory:n.workspaceNavigationHistory,workspaceNavigationHistoryIndex:n.workspaceNavigationHistoryIndex,activePanelKind:n.activeWorkspacePanelKind??null,sessionCronJobs:t?l:[],sessionCronJobsError:t?u:!1,sessionCronJobsLoading:t?d:!1,onRetrySessionCronJobs:f,sessionProjectRoot:i?.projectRoot??a,sessionWorkingDir:i?.workingDir??i?.projectRoot??a,workspacePanelWidth:n.workspacePanelWidth,displayMode:e===`mobile`?`overlay`:`docked`}):null}function Z5({layoutMode:e=`desktop`,onBackToList:t}){let n=eI(),r=aL(e=>e.snapshot.selectedSessionKey);return(0,U.jsxs)(`section`,{className:`relative flex-1 min-h-0 flex overflow-hidden bg-background`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,U.jsx)(pz,{}),(0,U.jsx)(fz,{layoutMode:e,onBackToList:t}),(0,U.jsx)(T5,{consumeDraftIntent:!0,sessionKey:r,onSessionMaterialized:n.chatThreadManager.materializeRootDraftSession})]}),(0,U.jsx)(xie,{layoutMode:e,sessionKey:r})]})}function Sie(){let e=fc(),[t,n]=(0,H.useState)(null),[r,i]=(0,H.useState)(``),[a,o]=(0,H.useState)(null),s=e=>{n(e.key),i(e.label?.trim()??``)},c=()=>{n(null),i(``),o(null)};return{editingSessionKey:t,draftLabel:r,savingSessionKey:a,setDraftLabel:i,startEditingSessionLabel:s,cancelEditingSessionLabel:c,saveSessionLabel:async t=>{let n=r.trim();if(n===(t.label?.trim()??``)){c();return}o(t.key);try{await e({sessionKey:t.key,label:n||null}),c()}catch{o(null)}}}}var Q5=`nextclaw.ui.theme`,$5=`work`,e7=[{value:`work`,labelKey:`themeWork`,appearance:`light`},{value:`night`,labelKey:`themeNight`,appearance:`dark`},{value:`charcoal`,labelKey:`themeCharcoal`,appearance:`dark`},{value:`natural`,labelKey:`themeNatural`,appearance:`light`},{value:`minimal`,labelKey:`themeMinimal`,appearance:`light`},{value:`warm`,labelKey:`themeWarm`,appearance:`light`},{value:`cool`,labelKey:`themeCool`,appearance:`light`},{value:`dawn`,labelKey:`themeDawn`,appearance:`light`},{value:`graphite`,labelKey:`themeGraphite`,appearance:`light`},{value:`probe`,labelKey:`themeProbe`,appearance:`light`}],Cie=e7.map(({value:e})=>e),t7=e7.map(({value:e,labelKey:t})=>({value:e,labelKey:t}));function n7(e){return typeof e==`string`?Cie.includes(e)?e:e===`leaf`?`warm`:null:null}function r7(e){return e7.find(t=>t.value===e)?.appearance??`light`}var i7=new class{constructor(){this.activeTheme=$5,this.initialized=!1,this.listeners=new Set,this.resolveInitialTheme=()=>{if(typeof window>`u`)return $5;try{let e=n7(window.localStorage.getItem(Q5));if(e)return e}catch{}return $5},this.initializeTheme=()=>(this.initialized||=(this.activeTheme=this.resolveInitialTheme(),this.applyThemeAttribute(this.activeTheme),!0),this.activeTheme),this.getTheme=()=>this.initialized?this.activeTheme:this.initializeTheme(),this.setTheme=e=>{this.initializeTheme(),e!==this.activeTheme&&(this.activeTheme=e,this.applyThemeAttribute(this.activeTheme),this.saveTheme(this.activeTheme),this.listeners.forEach(e=>e(this.activeTheme)))},this.subscribeThemeChange=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.applyThemeAttribute=e=>{if(typeof document>`u`)return;let t=r7(e);document.documentElement.setAttribute(`data-theme`,e),document.documentElement.setAttribute(`data-theme-appearance`,t),document.documentElement.style.colorScheme=t},this.saveTheme=e=>{if(!(typeof window>`u`))try{window.localStorage.setItem(Q5,e)}catch{}}}};function wie(){return i7.initializeTheme()}function Tie(){return i7.getTheme()}function Eie(e){i7.setTheme(e)}function Die(e){return i7.subscribeThemeChange(e)}var a7=`nextclaw-pwa-install-banner-dismissed`,o7=`nextclaw-pwa-install-banner-dismissed-until`;function s7(){let e=l7();return e?e.getItem(`nextclaw-pwa-install-banner-dismissed`)===`1`?!0:kie(e):!1}function Oie(){let e=l7();e?.setItem(a7,`1`),e?.removeItem(o7)}function c7(){let e=l7();e?.removeItem(a7),e?.removeItem(o7)}function l7(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function kie(e){let t=e.getItem(o7);if(!t)return!1;let n=Number.parseInt(t,10);return e.removeItem(o7),!Number.isFinite(n)||n<=Date.now()?!1:(e.setItem(a7,`1`),!0)}function u7(){return{initialized:!1,installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`,dismissedInstallPrompt:s7()}}var d7=P(()=>u7()),f7=new class{constructor(){this.started=!1,this.deferredPrompt=null,this.displayModeMediaQuery=null,this.start=()=>{this.started||typeof window>`u`||(this.started=!0,window.addEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.addEventListener(`appinstalled`,this.handleAppInstalled),typeof window.matchMedia==`function`&&(this.displayModeMediaQuery=window.matchMedia(`(display-mode: standalone)`),this.bindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged)),this.refreshState())},this.stop=()=>{!this.started||typeof window>`u`||(window.removeEventListener(`beforeinstallprompt`,this.handleBeforeInstallPrompt),window.removeEventListener(`appinstalled`,this.handleAppInstalled),this.displayModeMediaQuery&&=(this.unbindDisplayModeListener(this.displayModeMediaQuery,this.handleDisplayModeChanged),null),this.deferredPrompt=null,this.started=!1)},this.resetForTests=()=>{this.stop(),d7.setState(u7())},this.refreshState=()=>{let e=this.resolveInstallability();d7.setState(t=>({...t,initialized:!0,installability:e.installability,installMethod:e.installMethod,blockedReason:e.blockedReason,dismissedInstallPrompt:s7()}))},this.dismissInstallPrompt=()=>{Oie(),d7.setState({dismissedInstallPrompt:!0})},this.promptInstall=async()=>{let e=this.resolveInstallability();if(e.installability!==`available`)return`unavailable`;if(e.installMethod===`manual`||!this.deferredPrompt)return`manual`;this.deferredPrompt.prompt();let t=await this.deferredPrompt.userChoice;return this.deferredPrompt=null,t.outcome===`accepted`?(c7(),this.refreshState(),I.success(b(`pwaInstallAccepted`)),`accepted`):(this.dismissInstallPrompt(),this.refreshState(),`dismissed`)},this.handleBeforeInstallPrompt=e=>{e.preventDefault(),this.deferredPrompt=e,this.refreshState()},this.handleAppInstalled=()=>{this.deferredPrompt=null,c7(),d7.setState({dismissedInstallPrompt:!0}),I.success(b(`pwaInstalledToast`)),this.refreshState()},this.handleDisplayModeChanged=()=>{this.refreshState()},this.resolveInstallability=()=>this.isDevelopmentServer()?{installability:`unsupported`,installMethod:`none`,blockedReason:`dev-server`}:this.hasDesktopHost()?{installability:`suppressed`,installMethod:`none`,blockedReason:`desktop-host`}:this.isStandalone()?{installability:`installed`,installMethod:`none`,blockedReason:null}:this.hasInstallSurfaceSupport()?this.isEligibleInstallContext()?{installability:`available`,installMethod:this.deferredPrompt?`prompt`:`manual`,blockedReason:null}:{installability:`unsupported`,installMethod:`none`,blockedReason:`insecure-context`}:{installability:`unsupported`,installMethod:`none`,blockedReason:`missing-browser-support`},this.hasDesktopHost=()=>typeof window<`u`&&!!window.nextclawDesktop,this.hasInstallSurfaceSupport=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&`serviceWorker`in navigator,this.isEligibleInstallContext=()=>typeof window>`u`?!1:window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>typeof window<`u`&&!1,this.isStandalone=()=>{if(typeof window>`u`)return!1;let e=window.navigator;return typeof window.matchMedia==`function`&&window.matchMedia(`(display-mode: standalone)`).matches||e.standalone===!0},this.bindDisplayModeListener=(e,t)=>{if(`addEventListener`in e){e.addEventListener(`change`,t);return}e.addListener?.(t)},this.unbindDisplayModeListener=(e,t)=>{if(`removeEventListener`in e){e.removeEventListener(`change`,t);return}e.removeListener?.(t)}}};function Aie(){let e=d7(e=>e.installability);return(0,U.jsx)(`span`,{className:u(`inline-flex items-center rounded-full border px-3 py-1 text-xs font-medium`,e===`installed`?`bg-emerald-50 text-emerald-700 border-emerald-200`:e===`available`?`bg-amber-50 text-amber-700 border-amber-200`:`bg-gray-100 text-gray-600 border-gray-200`),children:jie(e)})}function jie(e){return b(e===`available`?`pwaInstallStatusAvailable`:e===`installed`?`pwaInstallStatusInstalled`:e===`suppressed`?`pwaInstallStatusDesktopHost`:`pwaInstallStatusUnavailable`)}function Mie(e,t,n){return b(e===`installed`?`pwaInstallCardInstalled`:e===`suppressed`?`pwaInstallCardSuppressed`:e===`available`&&t===`prompt`?`pwaInstallCardPrompt`:e===`available`?`pwaInstallCardManual`:n===`insecure-context`?`pwaInstallCardInsecureContext`:n===`dev-server`?`pwaInstallCardDevServer`:`pwaInstallCardUnsupported`)}function Nie(){let e=d7(e=>e.installability),t=d7(e=>e.installMethod),n=d7(e=>e.blockedReason);return(0,U.jsx)(Xt,{title:b(`pwaInstallTitle`),description:b(`pwaInstallDescription`),actions:(0,U.jsx)(Aie,{}),children:(0,U.jsx)(_t,{children:(0,U.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:Mie(e,t,n)}),e===`available`&&t===`prompt`?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,U.jsxs)(L,{type:`button`,className:`gap-2`,onClick:()=>void f7.promptInstall(),children:[(0,U.jsx)(ja,{className:`h-4 w-4`}),b(`pwaInstallAction`)]}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:b(`pwaInstallPromptHint`)})]}):null,e===`available`&&t===`manual`?(0,U.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-background/65 p-4`,children:[(0,U.jsx)(is,{className:`mt-0.5 h-4 w-4 text-muted-foreground`}),(0,U.jsx)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:b(`pwaInstallManualHint`)})]}):null]})})})}function Pie(){let e=d7(e=>e.installability),t=d7(e=>e.installMethod),n=d7(e=>e.dismissedInstallPrompt);return e!==`available`||t!==`prompt`||n?null:(0,U.jsxs)(`div`,{className:`fixed bottom-5 right-5 z-50 w-[min(420px,calc(100vw-2rem))] rounded-[26px] border border-gray-200 bg-white/95 p-5 shadow-2xl backdrop-blur-xl`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold text-gray-900`,children:b(`pwaInstallBannerTitle`)}),(0,U.jsx)(`p`,{className:`text-sm leading-6 text-gray-600`,children:b(`pwaInstallBannerDescription`)})]}),(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`pwaInstallDismiss`),className:`rounded-full p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600`,onClick:()=>{f7.dismissInstallPrompt()},children:(0,U.jsx)(Ai,{className:`h-4 w-4`})})]}),(0,U.jsxs)(`div`,{className:`mt-4 flex items-center gap-3`,children:[(0,U.jsxs)(L,{type:`button`,size:`sm`,className:`gap-2`,onClick:()=>{f7.promptInstall()},children:[(0,U.jsx)(ja,{className:`h-4 w-4`}),b(`pwaInstallAction`)]}),(0,U.jsx)(L,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{f7.dismissInstallPrompt()},children:b(`pwaInstallDismiss`)})]})]})}var Fie=new class{constructor(){this.started=!1,this.registration=null,this.start=async()=>{if(!(this.started||typeof window>`u`)&&(this.started=!0,!(!(`serviceWorker`in navigator)||!this.isEligibleInstallContext()))){if(this.isDevelopmentServer()){await this.cleanupDevelopmentRegistrations();return}try{this.registration=await navigator.serviceWorker.register(`/sw.js`)}catch{return}}},this.stop=()=>{!this.started||typeof window>`u`||!(`serviceWorker`in navigator)||(this.started=!1,this.registration=null)},this.isEligibleInstallContext=()=>window.isSecureContext||this.isTrustedLocalhost(window.location.hostname),this.isTrustedLocalhost=e=>e===`localhost`||e===`127.0.0.1`||e===`::1`||e===`[::1]`,this.isDevelopmentServer=()=>!1,this.cleanupDevelopmentRegistrations=async()=>{if(typeof navigator.serviceWorker.getRegistrations!=`function`)return;let e=(await navigator.serviceWorker.getRegistrations()).filter(e=>[e.active?.scriptURL,e.installing?.scriptURL,e.waiting?.scriptURL].filter(e=>!!e).some(e=>e.endsWith(`/sw.js`)));await Promise.all(e.map(async e=>await e.unregister())),e.length>0&&await this.clearNextClawCaches()},this.clearNextClawCaches=async()=>{if(typeof window>`u`||!(`caches`in window)||typeof caches.keys!=`function`)return;let e=await caches.keys();await Promise.all(e.filter(e=>e.startsWith(`nextclaw-ui-`)).map(async e=>await caches.delete(e)))}}},p7=!1;function Iie(){p7||typeof window>`u`||(p7=!0,f7.start(),Fie.start())}var Lie={natural:`#FAF9F7`,work:`#FFFFFF`,minimal:`#FFFFFF`,warm:`#FAF8F4`,cool:`#F8FAFC`,dawn:`#FAF7F4`,graphite:`#F8F8F7`,night:`#101318`,charcoal:`#1C1C1C`,probe:`#FEFCF6`},Rie=new class{constructor(){this.syncTheme=e=>{if(typeof document>`u`)return;let t=Lie[e];this.updateThemeMeta(t),this.updateSurfaceBackgrounds(t),document.documentElement.style.colorScheme=r7(e)},this.syncCurrentTheme=()=>{if(typeof document>`u`)return;let e=document.documentElement.getAttribute(`data-theme`);this.syncTheme(n7(e)??`work`)},this.updateThemeMeta=e=>{let t=document.querySelector(`meta[name="theme-color"]`);t instanceof HTMLMetaElement&&(t.content=e)},this.updateSurfaceBackgrounds=e=>{document.documentElement.style.backgroundColor=e,document.body.style.backgroundColor=e;let t=document.getElementById(`root`);t&&(t.style.backgroundColor=e)}}},m7=(0,H.createContext)(null);function zie({children:e}){let[t,n]=(0,H.useState)(()=>wie());(0,H.useEffect)(()=>{Rie.syncTheme(t)},[t]),(0,H.useEffect)(()=>Die(e=>{n(e)}),[]);let r=(0,H.useCallback)(e=>{Eie(e),n(Tie())},[]),i=(0,H.useMemo)(()=>({theme:t,setTheme:r}),[t,r]);return(0,U.jsx)(m7.Provider,{value:i,children:e})}function h7(){let e=(0,H.useContext)(m7);if(!e)throw Error(`useTheme must be used within ThemeProvider`);return e}function g7({children:e,metrics:t,title:n}){return(0,U.jsx)(li,{delayDuration:350,skipDelayDuration:100,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:e}),(0,U.jsxs)(ui,{side:`right`,align:`start`,sideOffset:10,collisionPadding:12,className:`pointer-events-none w-64 rounded-xl border-border/80 bg-popover p-3 text-popover-foreground shadow-[0_18px_48px_-24px_rgba(15,23,42,0.45)]`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold leading-5`,children:n}),(0,U.jsx)(`div`,{className:`mt-2 space-y-0.5`,children:t.map(e=>(0,U.jsxs)(`div`,{className:`flex h-5 min-w-0 items-center gap-2 text-xs leading-5`,children:[(0,U.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:e.icon}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:e.label}),(0,U.jsx)(`span`,{className:`min-w-0 max-w-40 truncate tabular-nums text-foreground/80`,children:e.value})]},e.label))})]})]})})}function Bie({sessionKey:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(Ct,{value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:b(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-border bg-background text-xs`,autoFocus:!0,disabled:n}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`div`,{className:`min-w-0 truncate text-[11px] text-muted-foreground/65`,children:e}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(V,{icon:(0,U.jsx)(jr,{className:`h-3.5 w-3.5`}),label:b(`save`),tooltip:!1,onClick:()=>void i(),disabled:n}),(0,U.jsx)(V,{icon:(0,U.jsx)(Ai,{className:`h-3.5 w-3.5`}),label:b(`cancel`),tooltip:!1,onClick:a,disabled:n})]})]})]})}function Vie({sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:c,agentId:l,agentLabel:d,agentAvatarUrl:f,childSessionCount:p=0,cronJobCount:m=0,projectName:h,onSelect:g,onStartEditing:_,onTogglePinned:v,onDelete:y}){return(0,U.jsxs)(`div`,{className:`group/session relative`,children:[(0,U.jsx)(g7,{title:o,metrics:[{icon:(0,U.jsx)(Qa,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextProject`),value:h},{icon:(0,U.jsx)(to,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextChildSessions`),value:p},{icon:(0,U.jsx)(ia,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextScheduledTasks`),value:m}],children:(0,U.jsxs)(`button`,{type:`button`,onClick:g,className:`w-full text-left`,children:[(0,U.jsx)(`div`,{className:u(`flex min-h-6 min-w-0 items-center`,r&&`pr-6`,`group-hover/session:pr-20 group-has-[[data-session-actions]:focus-within]/session:pr-20`),children:(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[l?.trim()&&l.trim().toLowerCase()!==`main`?(0,U.jsx)(az,{agentId:l,displayName:d,avatarUrl:f,className:`h-5 w-5 shrink-0`}):null,(0,U.jsx)(`span`,{className:`truncate leading-6 font-medium`,children:o}),i.label?(0,U.jsx)(`span`,{className:u(`shrink-0 rounded-full border px-1.5 py-0.5 text-[10px] font-semibold leading-none`,t?`border-border/70 bg-background/80 text-foreground/75`:`border-transparent bg-muted/70 text-muted-foreground`),children:i.label}):null,i.icon?(0,U.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,U.jsx)(KL,{icon:i.icon,className:u(`h-[13px] w-[13px]`,t?`text-foreground/75`:`text-muted-foreground`)})}):null]})}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground/65`,children:[(0,U.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),n?(0,U.jsx)(`span`,{"aria-label":b(`chatSessionUnread`),className:`ml-auto h-2 w-2 shrink-0 rounded-full bg-primary`}):(0,U.jsx)(`span`,{className:`ml-auto shrink-0`,children:c})]})]})}),r?(0,U.jsx)(`span`,{className:`absolute right-0 top-0 inline-flex h-6 w-6 items-center justify-center transition-opacity group-hover/session:opacity-0`,children:(0,U.jsx)(JL,{status:r})}):null,(0,U.jsxs)(`div`,{"data-session-actions":!0,className:`pointer-events-none absolute right-0 top-0 flex h-6 items-center gap-0.5 opacity-0 transition-opacity group-hover/session:pointer-events-auto group-hover/session:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100`,children:[(0,U.jsx)(V,{size:`sm`,tone:`strong`,icon:(0,U.jsx)(Zr,{className:u(`h-3.5 w-3.5`,a&&`fill-current text-foreground`)}),label:b(a?`chatSidebarUnpinSession`:`chatSidebarPinSession`),tooltipSide:`right`,onClick:e=>{e.stopPropagation(),v()}}),(0,U.jsx)(V,{size:`sm`,tone:`strong`,icon:(0,U.jsx)(Go,{className:`h-3.5 w-3.5`}),label:b(`edit`),tooltipSide:`right`,onClick:e=>{e.stopPropagation(),_()}}),(0,U.jsx)(OF,{sessionKey:e,triggerSize:`sm`,triggerTone:`strong`,children:(0,U.jsx)(mc,{icon:ms,label:b(`chatDeleteSession`),onClick:y,destructive:!0})})]})]})}function Hie({sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:c,agentId:l,agentLabel:d,agentAvatarUrl:f,childSessionCount:p,cronJobCount:m,projectName:h,isEditing:g,draftLabel:_,isSaving:v,onSelect:y,onStartEditing:b,onDraftLabelChange:x,onSave:S,onCancel:C,onTogglePinned:w,onDelete:T}){return(0,U.jsx)(`div`,{className:u(`w-full rounded-lg px-2.5 py-2 text-left text-[13px] transition-colors`,t?`bg-background/90 font-medium text-foreground`:`text-foreground/80 hover:bg-background/65 hover:text-foreground`),children:g?(0,U.jsx)(Bie,{sessionKey:e,draftLabel:_,isSaving:v,onDraftLabelChange:x,onSave:S,onCancel:C}):(0,U.jsx)(Vie,{sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:c,agentId:l,agentLabel:d,agentAvatarUrl:f,onSelect:y,childSessionCount:p,cronJobCount:m,projectName:h,onStartEditing:b,onTogglePinned:w,onDelete:T})})}function Uie(e){let{item:t,selectedSessionKey:n,optimisticReadAtBySessionKey:r,agentsById:i,childSessionsByParentKey:a,cronJobCount:o,editingSessionKey:s,draftLabel:c,savingSessionKey:l,sessionTypeOptions:u,isPinned:d,sessionTitle:f,onSelectSession:p,onStartEditingSessionLabel:m,onDraftLabelChange:h,onSaveSessionLabel:g,onCancelEditingSessionLabel:_,onTogglePinned:v,onDeleteSession:y}=e,{session:x,runStatus:S}=t,C=n===x.key,w=r[x.key],T=w&&x.readAt?w.localeCompare(x.readAt)>0?w:x.readAt:w??x.readAt,E=a.get(x.key)??[],D=x.agentId?i.get(x.agentId)?.displayName??x.agentId:null,O=iI(x)??`${D?.trim()?`${D} · `:``}${x.messageCount}`;return(0,U.jsx)(Hie,{sessionKey:x.key,active:C,showUnreadDot:tL({active:C,lastMessageAt:x.lastMessageAt,readAt:T,runStatus:S}),runStatus:S,context:VL(x,u),isPinned:d,title:f(x),previewText:O,trailingText:cI(x.lastMessageAt??x.createdAt),agentId:x.agentId??null,agentLabel:D,agentAvatarUrl:x.agentId?i.get(x.agentId)?.avatarUrl??null:null,childSessionCount:E.length,cronJobCount:o,projectName:x.projectName?.trim()||x.projectRoot?.trim().split(/[\\/]/).filter(Boolean).at(-1)||b(`chatSidebarContextNoProject`),isEditing:s===x.key,draftLabel:c,isSaving:l===x.key,onSelect:()=>p(x.key),onStartEditing:()=>m(x),onDraftLabelChange:h,onSave:()=>g(x),onCancel:_,onTogglePinned:v,onDelete:()=>y(x.key)})}var Wie={maxHeight:xF(`18rem`)};function _7({className:e,onSelect:t,options:n,selectedSessionType:r,title:i=b(`chatSessionTypeLabel`),titleClassName:a}){return(0,U.jsxs)(`div`,{className:u(`space-y-1 overflow-y-auto overscroll-contain`,e),style:Wie,children:[(0,U.jsx)(`div`,{className:u(`px-3 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-[0.18em] text-gray-400`,a),children:i}),n.map(e=>(0,U.jsx)(u3,{disabled:e.ready===!1,option:e,selected:e.value===r,onSelect:()=>t(e.value)},e.value))]})}function v7({option:e}){return e?.icon?.src?(0,U.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,U.jsx)(KL,{icon:{kind:`runtime-image`,src:e.icon.src,alt:e.icon.alt??null,name:e.label},className:`h-4 w-4`})}):(0,U.jsx)(la,{className:`h-4 w-4 shrink-0`})}function Gie(e){let{query:t,selectedNewSessionType:n,selectedNewSessionTypeOption:r,sessionTypeOptions:i,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:s,onSelectNewSessionType:c,onQueryChange:l,collapsed:d=!1}=e,f=i.length>1;return d?(0,U.jsx)(`div`,{className:`px-2 pb-2`,children:(0,U.jsxs)(`div`,{className:u(`flex flex-col items-center`,aX),children:[(0,U.jsx)(V,{icon:(0,U.jsx)(Oi,{className:rX}),label:b(`chatSidebarNewTask`),className:u(nX,oX),onClick:()=>{o(!1),s(n)}}),f?(0,U.jsxs)(CF,{open:a,onOpenChange:o,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(v7,{option:r}),label:b(`chatSessionTypeLabel`),className:u(nX,oX)})}),(0,U.jsx)(EF,{align:`start`,side:`right`,className:`w-56 rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:(0,U.jsx)(_7,{options:i,selectedSessionType:n,onSelect:e=>{c(e),o(!1)}})})]}):null]})}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`px-4 pb-2`,children:(0,U.jsxs)(`div`,{className:`flex overflow-hidden rounded-lg bg-primary/10 text-primary ring-1 ring-primary/10`,children:[(0,U.jsxs)(L,{variant:`ghost`,className:u(`min-w-0 rounded-none bg-transparent px-3 text-primary shadow-none hover:bg-primary/10 hover:text-primary-700 active:bg-primary/15`,f?`flex-1`:`w-full`),onClick:()=>{o(!1),s(n)},children:[(0,U.jsx)(Oi,{className:`mr-1.5 h-4 w-4`}),b(`chatSidebarNewTask`)]}),f?(0,U.jsxs)(CF,{open:a,onOpenChange:o,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,U.jsx)(v7,{option:r}),(0,U.jsx)(or,{className:`h-3 w-3 opacity-50`})]}),label:b(`chatSessionTypeLabel`),tooltip:b(`chatSessionTypeLabel`),className:`h-9 w-12 shrink-0 rounded-none border-l border-primary/10 bg-transparent text-primary shadow-none hover:bg-primary/10 hover:text-primary-700 active:bg-primary/15`})}),(0,U.jsx)(EF,{align:`end`,className:`w-56 rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:(0,U.jsx)(_7,{options:i,selectedSessionType:n,onSelect:e=>{c(e),o(!1)}})})]}):null]})}),(0,U.jsx)(`div`,{className:`px-4 pb-2`,children:(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,U.jsx)(Ct,{value:t,onChange:e=>l(e.target.value),placeholder:b(`chatSidebarSearchPlaceholder`),className:`h-8 rounded-lg border-0 bg-background/55 pl-8 text-xs shadow-none hover:bg-background/75`})]})})]})}function Kie(e){let{query:t,defaultSessionType:n,sessionTypeOptions:r,isCreateMenuOpen:i,onCreateMenuOpenChange:a,onCreateSession:o,onQueryChange:s}=e,c=r.length>1;return(0,U.jsx)(`div`,{className:`px-4 pb-2 pt-1`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,U.jsx)(Ti,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground/70`}),(0,U.jsx)(Ct,{value:t,onChange:e=>s(e.target.value),placeholder:b(`chatSidebarSearchPlaceholder`),className:`h-9 rounded-full border-0 bg-muted pl-9 pr-3 text-[13px] shadow-none`})]}),c?(0,U.jsxs)(CF,{open:i,onOpenChange:a,children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(Oi,{className:`h-4 w-4`}),label:b(`chatSidebarNewTask`),tooltip:!1,className:`h-9 w-9 shrink-0 rounded-full bg-muted text-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`})}),(0,U.jsx)(EF,{align:`end`,className:`w-60 rounded-3xl border border-border bg-popover p-2 text-popover-foreground shadow-[0_24px_70px_-30px_rgba(15,23,42,0.45)]`,children:(0,U.jsx)(_7,{options:r,selectedSessionType:n,title:b(`chatSidebarNewTask`),titleClassName:`pb-1.5 text-[11px] font-medium normal-case tracking-normal`,onSelect:e=>{o(e),a(!1)}})})]}):(0,U.jsx)(V,{icon:(0,U.jsx)(Oi,{className:`h-4 w-4`}),label:b(`chatSidebarNewTask`),className:`h-9 w-9 shrink-0 rounded-full bg-muted text-foreground shadow-none hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`,onClick:()=>o(n)})]})})}function qie(){return z({queryKey:[`app-meta`],queryFn:cn,staleTime:1/0})}var Jie={healthy:`bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]`,attention:`bg-amber-400 shadow-[0_0_0_3px_rgba(251,191,36,0.16)]`,inactive:`bg-muted-foreground/45 shadow-[0_0_0_3px_rgba(156,163,175,0.12)]`};function Yie(){let e=pt(),t=e.actionLabel===b(`runtimeStatusRestartAction`),n=()=>{e.tone!==`healthy`&&Tt.requestRuntimeBootstrapProbeNow()},r=async()=>{if(t)try{let e=await Tt.runRuntimeControlAction(`restart-service`);I.success(e.message)}catch(e){let t=e instanceof Error?e.message:b(`runtimeControlActionFailed`);I.error(`${b(`runtimeControlActionFailed`)}: ${t}`)}};return(0,U.jsxs)(CF,{children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-105`,"aria-label":e.title,title:e.title,"data-testid":`runtime-status-entry`,onClick:n,children:(0,U.jsx)(`span`,{className:u(`h-2.5 w-2.5 rounded-full`,Jie[e.tone])})})}),(0,U.jsxs)(EF,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-border bg-popover p-4 text-popover-foreground`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:e.description})]}),e.reasonLines.length>0?(0,U.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,U.jsx)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-xs leading-5 text-amber-900`,children:e},e))}):null,e.actionLabel?(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border/70 pt-1`,children:[(0,U.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:b(`runtimeStatusActionHint`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:e.isBusy,className:`text-sm font-semibold text-primary transition-colors hover:text-primary-hover disabled:text-muted-foreground/45`,children:e.isBusy?b(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function y7({className:e,density:t=`sidebar`,suffix:n}){let{data:r}=qie(),{supported:i,busyAction:a,snapshot:o}=dt(),s=r?.name??`NextClaw`,c=r?.productVersion?.trim(),l=c?`v${c}`:null,d=st(c),f=n??(0,U.jsx)(Yie,{}),p=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,m=t===`chrome`;return(0,U.jsxs)(`div`,{className:u(e??`flex min-w-0 items-center gap-2`,p&&`pl-[58px]`),children:[(0,U.jsx)(`div`,{className:u(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,U.jsx)(`img`,{src:`/logo.svg`,alt:s,className:`h-full w-full object-contain`})}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,U.jsx)(`span`,{className:u(`shrink-0 font-semibold text-gray-800`,m?`text-[15px]`:`text-[14px]`),children:s}),l?(0,U.jsx)(Xie,{versionLabel:l,density:t,releaseNotesLink:d}):null]}),(0,U.jsx)(Zie,{supported:i,busyAction:a,snapshot:o}),f?(0,U.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:f}):null]})]})}function Xie({versionLabel:e,density:t,releaseNotesLink:n}){let r=u(`block min-w-0 flex-1 truncate font-medium text-gray-500 outline-none`,`text-[12px]`,n&&`cursor-pointer rounded-sm transition-colors hover:text-gray-700 hover:underline focus-visible:ring-2 focus-visible:ring-gray-300`),i=n?[b(`desktopUpdatesVersionTooltipCurrent`).replace(`{version}`,e),b(`desktopUpdatesVersionTooltipReleaseNotes`).replace(`{version}`,n.versionLabel)].join(`
|
|
106
|
+
`):e;return(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:n?(0,U.jsx)(ge,{href:n.url,external:!0,icon:null,"aria-label":b(`desktopUpdatesVersionReleaseNotesLabel`).replace(`{currentVersion}`,e).replace(`{releaseVersion}`,n.versionLabel),className:u(r,`p-0 text-left`),children:e}):(0,U.jsx)(`span`,{tabIndex:0,"aria-label":e,className:r,children:e})}),(0,U.jsx)(ui,{side:`bottom`,className:`max-w-72 whitespace-pre-line text-xs leading-relaxed`,children:i})]})})}function Zie({supported:e,busyAction:t,snapshot:n}){if(!e||!n)return null;let r=tn(n);return n.status===`downloading`?(0,U.jsx)(x7,{snapshot:n,releaseNotesLink:r}):n.status===`blocked`||n.status===`failed`?(0,U.jsx)(x7,{snapshot:n}):n.status===`downloaded`?(0,U.jsx)(b7,{link:r,children:(0,U.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-emerald-50 px-2 text-[11px] font-semibold leading-none text-emerald-700 ring-1 ring-emerald-100 transition-colors hover:bg-emerald-100 disabled:opacity-70`,disabled:t===`applying`,onClick:()=>void ze.applyDownloadedUpdate(),children:b(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)})}):n.status===`update-available`?(0,U.jsx)(b7,{link:r,children:(0,U.jsx)(`button`,{type:`button`,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 transition-colors hover:bg-amber-100 disabled:opacity-70`,disabled:t===`downloading`,onClick:()=>void ze.downloadUpdate(),children:b(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)})}):null}function b7({children:e,link:t}){if(!t)return e;let n=b(`desktopUpdatesUpdateReleaseNotesLabel`).replace(`{version}`,t.versionLabel);return(0,U.jsxs)(`span`,{className:`group/update-release-notes relative inline-flex shrink-0`,children:[e,(0,U.jsx)(`span`,{"data-update-release-notes-hover":`true`,className:`invisible pointer-events-none absolute left-1/2 top-full z-[var(--z-tooltip,10150)] -translate-x-1/2 pt-1 opacity-0 transition-opacity group-hover/update-release-notes:visible group-hover/update-release-notes:pointer-events-auto group-hover/update-release-notes:opacity-100 group-focus-within/update-release-notes:visible group-focus-within/update-release-notes:pointer-events-auto group-focus-within/update-release-notes:opacity-100`,children:(0,U.jsx)(ge,{href:t.url,external:!0,icon:null,"aria-label":n,className:`whitespace-nowrap rounded-md border bg-popover px-3 py-1.5 text-left text-xs font-medium text-popover-foreground shadow-md outline-none transition-colors hover:bg-gray-100 focus-visible:ring-2 focus-visible:ring-gray-300`,children:n})})]})}function x7({snapshot:e,releaseNotesLink:t}){if(e.status===`blocked`||e.status===`failed`)return(0,U.jsx)(Qie,{snapshot:e});let n=e.status===`downloading`?eae(e):null;return n?(0,U.jsx)(b7,{link:t??null,children:(0,U.jsx)(`span`,{tabIndex:t?0:void 0,className:`inline-flex h-5 shrink-0 items-center rounded-full bg-amber-50 px-2 text-[11px] font-semibold leading-none text-amber-700 ring-1 ring-amber-100 outline-none transition-colors hover:bg-amber-100 focus-visible:ring-2 focus-visible:ring-amber-300`,children:n})}):null}function Qie({snapshot:e}){let t=$ie(e),n=e.recoveryCommand?.trim()||null,r=e.diagnosticCommand?.trim()?b(`desktopUpdatesDiagnosticCommand`).replace(`{command}`,e.diagnosticCommand.trim()):null,i=e.errorMessage?.trim()||e.blockReason?.trim()||null,a=[t,e.status===`blocked`&&e.blockReason?b(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,i,n,r].filter(Boolean).join(`
|
|
107
|
+
`);return(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`span`,{role:`img`,"aria-label":t,tabIndex:0,className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-amber-50 text-[13px] font-bold leading-none text-amber-700 ring-1 ring-amber-100 outline-none focus-visible:ring-2 focus-visible:ring-amber-300`,children:`!`})}),(0,U.jsx)(ui,{side:`bottom`,className:`max-w-80 whitespace-pre-line break-words text-xs leading-relaxed`,children:a})]})})}function $ie(e){return e.status===`blocked`?b(`desktopUpdatesStatusBlocked`):b(e.failureStage?`desktopUpdatesFailureStage.${e.failureStage}`:`desktopUpdatesStatusFailed`)}function eae(e){let t=e.progress?.percent;return t==null?b(`desktopUpdatesInlineDownloading`):b(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var tae={connected:{dotClass:`bg-emerald-500`},disconnected:{dotClass:`h-2.5 w-2.5 rounded-full border border-gray-400 bg-transparent`},connecting:{dotClass:`text-amber-600`}};function nae({status:e,className:t}){let n=tae[e],r=b(e===`connected`?`connected`:e===`disconnected`?`disconnected`:`connecting`);return(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`span`,{role:`status`,"aria-label":r,className:u(`inline-flex h-5 w-5 items-center justify-center`,t),children:e===`connecting`?(0,U.jsx)(Di,{className:u(`h-3 w-3 animate-spin`,n.dotClass)}):(0,U.jsx)(`span`,{className:u(e===`connected`?`h-2 w-2 rounded-full`:``,n.dotClass)})})}),(0,U.jsx)(ui,{side:`bottom`,className:`text-xs`,children:r})]})})}var rae=[`default-src 'none'`,`base-uri 'none'`,`connect-src 'none'`,`font-src data:`,`form-action 'none'`,`frame-src 'none'`,`img-src data: blob:`,`media-src data: blob:`,`object-src 'none'`,`script-src 'none'`,`style-src 'unsafe-inline'`].join(`; `);function iae(e){let t=new DOMParser().parseFromString(e,`text/html`);t.querySelectorAll(`base, script`).forEach(e=>e.remove()),t.querySelectorAll(`meta[http-equiv]`).forEach(e=>{let t=e.getAttribute(`http-equiv`)?.toLowerCase();(t===`content-security-policy`||t===`refresh`)&&e.remove()}),t.querySelectorAll(`*`).forEach(e=>{e.getAttributeNames().filter(e=>e.toLowerCase().startsWith(`on`)).forEach(t=>e.removeAttribute(t))}),t.querySelectorAll(`a[href]`).forEach(e=>{let t=e.getAttribute(`href`)?.trim()??``;if(t.toLowerCase().startsWith(`javascript:`)){e.removeAttribute(`href`);return}e.setAttribute(`target`,t.startsWith(`#`)?`_self`:`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)});let n=t.createElement(`meta`);n.setAttribute(`http-equiv`,`Content-Security-Policy`),n.setAttribute(`content`,rae),t.head.prepend(n);let r=t.createElement(`style`);return r.dataset.nextclawInboxDefaults=``,r.textContent=[`:root { color-scheme: light dark; }`,`*, *::before, *::after { box-sizing: border-box; }`,`body { margin: 0; padding: 24px; color: CanvasText; background: Canvas; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif; line-height: 1.6; overflow-wrap: anywhere; }`,`img, svg, video { max-width: 100%; height: auto; }`,`pre { max-width: 100%; overflow: auto; }`].join(`
|
|
108
|
+
`),n.after(r),`<!doctype html>${t.documentElement.outerHTML}`}function aae({content:e,fillHeight:t,title:n}){let r=(0,H.useMemo)(()=>iae(e),[e]);return(0,U.jsx)(`iframe`,{className:u(`w-full rounded-xl bg-background`,t?`h-full min-h-0 border-0`:`h-[min(60vh,680px)] min-h-[360px] border border-border/70`),sandbox:`allow-popups allow-popups-to-escape-sandbox`,srcDoc:r,title:n})}function S7({className:e,content:t,contentType:n,fillHeight:r=!1,title:i}){return(0,U.jsx)(`div`,{className:u(`inbox-delivery-content`,e),children:n===`html`?(0,U.jsx)(aae,{content:t,fillHeight:r,title:i}):(0,U.jsx)(Uj,{text:t,role:`assistant`,texts:{copyCodeLabel:b(`chatCodeCopy`),copiedCodeLabel:b(`chatCodeCopied`)}})})}var oae={readerOpen:!1,activeDeliveryId:null},C7=P(e=>({snapshot:oae,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))})),w7=[`inbox-deliveries`];function T7(e){return{deliveries:e,total:e.length,unreadCount:e.filter(e=>!e.readAt&&!e.archivedAt).length,unpresentedCount:e.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt).length}}var sae=class{constructor(e=Mt){this.queryClient=e,this.cleanups=[],this.offerPromise=null,this.started=!1,this.start=()=>{this.started||(this.started=!0,this.cleanups.push(F.eventBus.on(c.inboxDeliveryChanged,this.handleDeliveryChanged)),typeof document<`u`&&(document.addEventListener(`visibilitychange`,this.handleVisibilityChange),this.cleanups.push(()=>document.removeEventListener(`visibilitychange`,this.handleVisibilityChange))),this.offerPendingDelivery())},this.stop=()=>{if(this.started)for(this.started=!1;this.cleanups.length>0;)this.cleanups.pop()?.()},this.closeReader=()=>{C7.getState().setSnapshot({readerOpen:!1})},this.selectInReader=async e=>{let t=await this.updateState(e,`present`);return C7.getState().setSnapshot({activeDeliveryId:t.id,readerOpen:!0}),t},this.markRead=async e=>await this.updateState(e,`read`),this.markUnread=async e=>await this.updateState(e,`mark_unread`),this.archive=async e=>await this.updateState(e,`archive`),this.restore=async e=>await this.updateState(e,`restore`),this.delete=async e=>{let t=await F.inboxDeliveries.delete(e);if(t){this.queryClient.setQueryData(w7,t=>t&&T7(t.deliveries.filter(({id:t})=>t!==e)));let{snapshot:t}=C7.getState();t.activeDeliveryId===e&&C7.getState().setSnapshot({activeDeliveryId:null,readerOpen:!1})}return t},this.prepareChatReference=async e=>{let t=await F.systemObjectReferences.resolve(y(w,e)),n=await this.updateState(e,`read`);return this.closeReader(),{delivery:n,reference:t}},this.updateState=async(e,t)=>{let n=await F.inboxDeliveries.updateState(e,t);return this.replaceCachedDelivery(n),n},this.replaceCachedDelivery=e=>{this.queryClient.setQueryData(w7,t=>t&&T7(t.deliveries.some(({id:t})=>t===e.id)?t.deliveries.map(t=>t.id===e.id?e:t):[e,...t.deliveries]))},this.handleDeliveryChanged=()=>{this.queryClient.invalidateQueries({queryKey:w7}),this.offerPendingDelivery()},this.handleVisibilityChange=()=>{document.visibilityState===`visible`&&this.offerPendingDelivery()},this.offerPendingDelivery=()=>{this.offerPromise||!this.isVisible()||C7.getState().snapshot.readerOpen||(this.offerPromise=this.openOldestPendingDelivery().catch(()=>void 0).finally(()=>{this.offerPromise=null}))},this.openOldestPendingDelivery=async()=>{let e=(await this.queryClient.fetchQuery({queryKey:w7,queryFn:()=>F.inboxDeliveries.list(),staleTime:0})).deliveries.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt),t=e[e.length-1];!t||!this.isVisible()||C7.getState().snapshot.readerOpen||await this.selectInReader(t.id)},this.isVisible=()=>typeof document>`u`||document.visibilityState===`visible`}};function E7(){return z({queryKey:w7,queryFn:()=>F.inboxDeliveries.list()})}function D7(){return E7().data?.unreadCount??0}function cae(e,t){return b(`inboxReaderPosition`).replace(`{current}`,String(e)).replace(`{total}`,String(t))}function lae(){let e=(0,H.useRef)(null),t=ce(),{chatDraftIntentManager:n,inboxManager:r}=N9(),{data:i}=E7(),{activeDeliveryId:a,readerOpen:o}=C7(e=>e.snapshot),[s,c]=(0,H.useState)(null),[l,d]=(0,H.useState)(null),f=(i?.deliveries??[]).filter(e=>!e.readAt&&!e.archivedAt),p=f.findIndex(({id:e})=>e===a),m=p>=0?f[p]:null,h=m?.contentType===`html`,g=async(e,t)=>{c(e),d(null);try{await t()}catch{d(b(`inboxActionError`))}finally{c(null)}},_=e=>{let t=f[e];t&&g(`select`,async()=>{await r.selectInReader(t.id)})},v=()=>{m&&g(`open`,async()=>{await r.markRead(m.id),r.closeReader(),t(`/inbox/${encodeURIComponent(m.id)}`)})},y=()=>{m&&g(`continue`,async()=>{let{reference:e}=await r.prepareChatReference(m.id);n.requestSystemObjectReference(e),t(X7)})},x=()=>{m&&g(`read`,async()=>{await r.markRead(m.id),r.closeReader()})},S=f.length>1?(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 pr-1`,children:[(0,U.jsx)(`span`,{className:`mr-1 text-[11px] tabular-nums text-muted-foreground`,children:cae(p+1,f.length)}),(0,U.jsx)(V,{icon:(0,U.jsx)(ma,{className:`h-4 w-4`}),label:b(`inboxPrevious`),disabled:p<=0||s===`select`,onClick:()=>_(p-1)}),(0,U.jsx)(V,{icon:(0,U.jsx)(ha,{className:`h-4 w-4`}),label:b(`inboxNext`),disabled:p>=f.length-1||s===`select`,onClick:()=>_(p+1)})]}):null;return(0,U.jsx)(Wr,{open:o&&!!m,onOpenChange:e=>{e||r.closeReader()},children:(0,U.jsx)(qr,{className:`flex h-[min(82vh,760px)] w-[calc(100vw-2rem)] max-w-[820px] flex-col gap-0 overflow-hidden rounded-[24px] border-border/70 bg-background p-0 shadow-[0_20px_55px_-22px_rgba(15,23,42,0.32)] max-sm:h-[100dvh] max-sm:max-h-none max-sm:w-screen max-sm:rounded-none max-sm:border-0`,onOpenAutoFocus:t=>{t.preventDefault(),e.current?.focus()},children:m?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`header`,{className:`shrink-0 border-b border-border/50 px-5 py-3 pr-14 sm:px-6`,children:[(0,U.jsxs)(`div`,{className:`flex min-h-7 items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-muted/70 text-muted-foreground`,children:(0,U.jsx)(co,{className:`h-3.5 w-3.5`})}),(0,U.jsx)(Jr,{ref:e,tabIndex:-1,title:m.title,className:`min-w-0 truncate text-sm font-medium text-foreground outline-none`,children:m.title}),(0,U.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:m.createdAt,children:M(m.createdAt)})]}),S]}),(0,U.jsx)(Vr,{className:`sr-only`,children:m.summary??b(`inboxNoSummary`)})]}),(0,U.jsx)(`div`,{className:u(`min-h-0 flex-1`,h?`p-3 sm:p-4`:`custom-scrollbar overflow-y-auto px-6 py-5 sm:px-8 sm:py-6`),children:(0,U.jsx)(S7,{className:h?`h-full`:void 0,content:m.content,contentType:m.contentType,fillHeight:h,title:m.title})}),(0,U.jsxs)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background px-5 py-3 sm:px-6`,children:[l?(0,U.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:l}):null,(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col-reverse gap-1 sm:flex-row sm:flex-wrap`,children:[(0,U.jsx)(L,{size:`sm`,variant:`ghost`,onClick:r.closeReader,children:b(`inboxReadLater`)}),(0,U.jsx)(L,{size:`sm`,variant:`outline`,disabled:s!==null,onClick:x,children:b(`inboxMarkRead`)}),(0,U.jsx)(L,{size:`sm`,variant:`ghost`,disabled:s!==null,onClick:v,children:b(`inboxOpenInbox`)})]}),(0,U.jsx)(L,{size:`sm`,disabled:s!==null,onClick:y,children:b(`inboxContinueChat`)})]})]})]}):null})})}function uae(){let{inboxManager:e}=N9();return(0,H.useEffect)(()=>(e.start(),()=>e.stop()),[e]),(0,U.jsx)(lae,{})}function dae(e,t){return t||(e.some(e=>!e.readAt&&!e.archivedAt)?`unread`:`all`)}function O7(e,t){return t===`unread`?e.filter(e=>!e.readAt&&!e.archivedAt):t===`archived`?e.filter(e=>!!e.archivedAt):e.filter(e=>!e.archivedAt)}function k7({selection:e=!1}){return(0,U.jsxs)(`div`,{className:`flex h-full min-h-56 flex-col items-center justify-center px-8 text-center`,children:[(0,U.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-muted text-muted-foreground`,children:(0,U.jsx)(co,{className:`h-5 w-5`})}),(0,U.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:b(e?`inboxSelectTitle`:`inboxEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-2 max-w-sm text-sm leading-6 text-muted-foreground`,children:b(e?`inboxSelectDescription`:`inboxEmptyDescription`)})]})}function fae({activeDeliveryId:e,deliveries:t,filter:n,onFilterChange:r}){let{onScroll:i,scrollRef:a}=oY({restorationKey:`inbox:list`}),o=[{id:`unread`,label:b(`inboxUnread`),count:O7(t,`unread`).length},{id:`all`,label:b(`inboxAll`),count:O7(t,`all`).length},{id:`archived`,label:b(`inboxArchived`),count:O7(t,`archived`).length}],s=O7(t,n);return(0,U.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-border/60 bg-muted/20 md:border-r`,children:[(0,U.jsx)(`div`,{className:`flex shrink-0 gap-1 border-b border-border/50 px-3 py-2`,children:o.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:u(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,n===e.id?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[e.label,(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] font-normal tabular-nums opacity-60`,children:e.count})]},e.id))}),(0,U.jsx)(`div`,{ref:a,onScroll:i,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-2`,children:s.length>0?(0,U.jsx)(`ul`,{className:`space-y-0.5`,children:s.map(t=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(ue,{to:`/inbox/${encodeURIComponent(t.id)}`,className:u(`block rounded-lg px-2.5 py-2 text-[13px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e===t.id?`bg-[var(--interaction-selection)] text-foreground`:`text-foreground/80 hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[(0,U.jsx)(`h2`,{className:u(`truncate font-medium leading-5`,!t.readAt&&`font-semibold text-foreground`),children:t.title}),(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] leading-4 text-muted-foreground/65`,children:[(0,U.jsx)(`p`,{className:`min-w-0 flex-1 truncate`,children:t.summary??b(`inboxNoSummary`)}),t.readAt?(0,U.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:t.createdAt,children:k(t.createdAt)}):(0,U.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-primary`,"aria-label":b(`inboxUnread`)})]})]})},t.id))}):(0,U.jsx)(k7,{})})]})}function pae({delivery:e,error:t,isMobile:n,pending:r,onArchiveToggle:i,onBack:a,onContinue:o,onDelete:s,onReadToggle:c}){let{onScroll:l,scrollRef:d}=oY({restorationKey:e?`inbox:delivery:${e.id}`:null});if(!e)return(0,U.jsx)(`main`,{className:`flex min-h-0 flex-col`,children:(0,U.jsx)(k7,{selection:!0})});let f=e.contentType===`html`;return(0,U.jsxs)(`main`,{className:`flex min-h-0 flex-col`,children:[(0,U.jsxs)(`div`,{className:`shrink-0 border-b border-border/50 px-5 py-3 sm:px-6`,children:[n?(0,U.jsxs)(`button`,{type:`button`,onClick:a,className:`mb-3 inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(wi,{className:`h-4 w-4`}),b(`inboxTitle`)]}):null,(0,U.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center gap-2`,children:[(0,U.jsx)(`h2`,{title:e.title,className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.title}),(0,U.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground sm:inline`,"aria-hidden":`true`,children:`·`}),(0,U.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground sm:block`,dateTime:e.createdAt,children:M(e.createdAt)})]})]}),(0,U.jsx)(`div`,{className:u(`min-h-0 flex-1`,f?`p-3 sm:p-4`:`custom-scrollbar overflow-y-auto px-5 py-5 sm:px-6 sm:py-6`),ref:d,onScroll:l,children:(0,U.jsx)(`div`,{className:u(`mx-auto max-w-5xl`,f&&`h-full`),children:(0,U.jsx)(S7,{className:f?`h-full`:void 0,content:e.content,contentType:e.contentType,fillHeight:f,title:e.title})})}),(0,U.jsxs)(`div`,{className:`shrink-0 border-t border-border/50 px-5 py-3 sm:px-6`,children:[t?(0,U.jsx)(`p`,{role:`alert`,className:`mb-2 text-sm text-destructive`,children:t}):null,(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,U.jsx)(L,{size:`sm`,variant:`outline`,disabled:r,onClick:c,children:e.readAt?b(`inboxMarkUnread`):b(`inboxMarkRead`)}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,disabled:r,onClick:i,children:[e.archivedAt?(0,U.jsx)(Xo,{className:`mr-2 h-4 w-4`}):(0,U.jsx)(aa,{className:`mr-2 h-4 w-4`}),e.archivedAt?b(`inboxRestore`):b(`inboxArchive`)]}),(0,U.jsxs)(L,{size:`sm`,variant:`ghost`,disabled:r,onClick:s,children:[(0,U.jsx)(ms,{className:`mr-2 h-4 w-4`}),b(`inboxDelete`)]})]}),(0,U.jsxs)(L,{size:`sm`,disabled:r,onClick:o,children:[(0,U.jsx)(Co,{className:`mr-2 h-4 w-4`}),b(`inboxContinueChat`)]})]})]})]})}function mae(){let e=ce(),{deliveryId:t}=le(),{isMobile:n}=D8(),{chatDraftIntentManager:r,inboxManager:i}=N9(),a=E7(),{confirm:o,ConfirmDialog:s}=On(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(null),m=(0,H.useMemo)(()=>a.data?.deliveries??[],[a.data?.deliveries]),h=(0,H.useMemo)(()=>t?m.find(({id:e})=>e===t)??null:null,[m,t]),g=dae(m,c);(0,H.useEffect)(()=>{h&&!h.readAt&&i.markRead(h.id).catch(()=>p(b(`inboxActionError`)))},[h,i]);let _=async(e,t)=>{d(e),p(null);try{await t()}catch{p(b(`inboxActionError`))}finally{d(null)}},v=()=>{h&&_(`continue`,async()=>{let{reference:t}=await i.prepareChatReference(h.id);r.requestSystemObjectReference(t),e(X7)})},y=async()=>{!h||!await o({title:b(`inboxDeleteTitle`),description:b(`inboxDeleteDescription`),confirmLabel:b(`inboxDeleteConfirm`),variant:`destructive`})||_(`delete`,async()=>{await i.delete(h.id),e(`/inbox`,{replace:!0})})},x=()=>{h&&_(`read`,async()=>{if(h.readAt){await i.markUnread(h.id),e(`/inbox`,{replace:!0});return}await i.markRead(h.id)})},S=()=>{h&&_(`archive`,async()=>{if(h.archivedAt){await i.restore(h.id);return}await i.archive(h.id),e(`/inbox`,{replace:!0})})},C=!n||!h,w=!n||!!h;return(0,U.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-6`,children:[(0,U.jsx)(St,{headingLevel:1,title:b(`inboxTitle`),className:`px-4 sm:px-0`}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden border-y border-border/60 bg-background sm:rounded-2xl sm:border`,children:a.isError?(0,U.jsx)(`div`,{role:`alert`,className:`p-6 text-sm text-destructive`,children:b(`inboxLoadError`)}):(0,U.jsxs)(`div`,{className:`grid h-full min-h-0 grid-cols-1 md:grid-cols-[300px_minmax(0,1fr)]`,children:[C?(0,U.jsx)(fae,{activeDeliveryId:h?.id??null,deliveries:m,filter:g,onFilterChange:l}):null,w?(0,U.jsx)(pae,{delivery:h,error:f,isMobile:n,pending:u!==null,onArchiveToggle:S,onBack:()=>e(`/inbox`),onContinue:v,onDelete:()=>void y(),onReadToggle:x}):null]})}),(0,U.jsx)(s,{})]})}function hae(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function gae(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,projectCronJobCountByRoot:a}=e,o=eI(),s=aL(e=>e.snapshot.collapsedProjectRoots),[c,l]=(0,H.useState)(null),u=(0,H.useMemo)(()=>hae(n,r),[n,r]),d=r.length>1;return(0,U.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>{let t=`${b(`chatSidebarNewTask`)} · ${e.projectName}`,n=s.includes(e.projectRoot),f=b(e.isPinned?`chatSidebarUnpinProject`:`chatSidebarPinProject`);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`group/project relative h-8 rounded-lg px-2 text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(g7,{title:e.projectName,metrics:[{icon:(0,U.jsx)(Qa,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextPath`),value:e.projectRoot},{icon:(0,U.jsx)(Eo,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextSessions`),value:e.items.length},{icon:(0,U.jsx)(ia,{className:`h-3.5 w-3.5`}),label:b(`chatSidebarContextScheduledTasks`),value:a.get(e.projectRoot)??0}],children:(0,U.jsxs)(`button`,{type:`button`,"aria-expanded":!n,"aria-label":b(n?`chatSidebarExpandProject`:`chatSidebarCollapseProject`),className:`flex h-full w-full min-w-0 items-center gap-1.5 pr-14 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,onClick:()=>o.chatSessionListManager.toggleProjectCollapsed(e.projectRoot),children:[(0,U.jsx)(Qa,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{className:`truncate text-[11px] font-medium uppercase tracking-wider`,title:e.projectRoot,children:e.projectName}),n?(0,U.jsx)(ha,{className:`h-3.5 w-3.5 shrink-0 opacity-0 transition-opacity group-hover/project:opacity-100 group-focus-within/project:opacity-100`,"aria-hidden":`true`}):(0,U.jsx)(or,{className:`h-3.5 w-3.5 shrink-0 opacity-0 transition-opacity group-hover/project:opacity-100 group-focus-within/project:opacity-100`,"aria-hidden":`true`})]})}),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute right-2 top-1/2 flex -translate-y-1/2 items-center opacity-0 transition-opacity group-hover/project:pointer-events-auto group-hover/project:opacity-100 focus-within:pointer-events-auto focus-within:opacity-100`,children:[d?(0,U.jsxs)(CF,{open:c===e.projectRoot,onOpenChange:t=>{l(t?e.projectRoot:null)},children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(V,{icon:(0,U.jsx)(Oi,{className:`h-3.5 w-3.5`}),label:t})}),(0,U.jsx)(EF,{align:`end`,className:`w-56 rounded-2xl border border-border bg-popover p-1.5 text-popover-foreground shadow-[0_24px_60px_-28px_rgba(15,23,42,0.38)]`,children:(0,U.jsx)(_7,{options:r,selectedSessionType:u,onSelect:t=>{o.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:t}),l(null)}})})]}):(0,U.jsx)(V,{icon:(0,U.jsx)(Oi,{className:`h-3.5 w-3.5`}),label:t,onClick:()=>o.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:u})}),(0,U.jsx)(V,{icon:(0,U.jsx)(Zr,{className:e.isPinned?`h-3.5 w-3.5 fill-current text-foreground`:`h-3.5 w-3.5`}),label:f,tooltipSide:`right`,onClick:()=>o.chatSessionListManager.toggleProjectPinned(e.projectRoot)})]})]}),n?null:(0,U.jsx)(`div`,{className:`mt-0.5 space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)})})}function A7({label:e}){return(0,U.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,U.jsx)(Eo,{className:`mx-auto mb-2 h-6 w-6 text-muted-foreground/45`}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function _ae({defaultSessionType:e,groups:t,isLoading:n,isProjectFirstView:r,projectGroups:i,projectCronJobCountByRoot:a,renderSessionItem:o,sessionTypeOptions:s}){return n?(0,U.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:b(`sessionsLoading`)}):r?i.length===0?(0,U.jsx)(A7,{label:b(`chatSidebarProjectViewEmpty`)}):(0,U.jsx)(gae,{groups:i,projectCronJobCountByRoot:a,defaultSessionType:e,sessionTypeOptions:s,renderSessionItem:o}):t.length===0?(0,U.jsx)(A7,{label:b(`sessionsEmpty`)}):(0,U.jsx)(`div`,{className:`space-y-2`,children:t.map(e=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wider text-muted-foreground/65`,children:e.label}),(0,U.jsx)(`div`,{className:`space-y-0.5`,children:e.items.map(o)})]},e.label))})}function vae({isOpen:e,onOpenChange:t,currentTheme:n,currentThemeLabel:r,themeOptions:i,onSelectTheme:a,currentLanguage:o,currentLanguageLabel:s,languageOptions:c,onSelectLanguage:l,onOpenDocs:d,onOpenApps:f,collapsed:p=!1}){return(0,U.jsxs)(CF,{open:e,onOpenChange:t,children:[p?(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`settingsMenu`),className:u(`flex items-center justify-center`,nX,oX),children:(0,U.jsx)(es,{className:u(rX,`shrink-0 text-muted-foreground`)})})})}),(0,U.jsx)(ui,{side:`right`,className:`text-xs`,children:b(`settingsMenu`)})]})}):(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-label":b(`settingsMenu`),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] font-medium text-muted-foreground transition-colors duration-base hover:bg-background/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(es,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:b(`settings`)})]})}),(0,U.jsxs)(EF,{side:p?`right`:`top`,align:p?`end`:`start`,className:`w-64 p-2`,children:[(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsxs)(pe,{to:`/settings`,onClick:()=>t(!1),className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(es,{className:`h-4 w-4 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:b(`settings`)})]}),[{key:`docs`,icon:Ei,label:b(`docBrowserHelp`),action:d},{key:`apps`,icon:Qr,label:b(`appsTitle`),action:f}].map(({key:e,icon:n,label:r,action:i})=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{i(),t(!1)},className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900`,children:[(0,U.jsx)(n,{className:`h-4 w-4 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`flex-1 text-left`,children:r})]},e))]}),(0,U.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,U.jsx)(j7,{icon:Io,label:b(`theme`),options:i,value:n,valueLabel:r,onSelect:a,onCloseMenu:()=>t(!1)}),(0,U.jsx)(j7,{icon:uo,label:b(`language`),options:c,value:o,valueLabel:s,onSelect:l,onCloseMenu:()=>t(!1)})]})]})}function j7({icon:e,label:t,options:n,value:r,valueLabel:i,onSelect:a,onCloseMenu:o}){return(0,U.jsxs)(Or,{value:r,onOpenChange:e=>{e||o()},onValueChange:e=>a(e),children:[(0,U.jsxs)(br,{"aria-label":t,className:`h-auto w-full rounded-lg border-0 bg-transparent px-3 py-2 text-[13px] font-medium text-foreground shadow-none hover:bg-gray-200/60 hover:text-gray-900 focus:ring-0`,indicator:(0,U.jsx)(ha,{className:`h-4 w-4 text-muted-foreground/70`}),children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,U.jsx)(e,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,U.jsx)(`span`,{className:`text-left`,children:t})]}),(0,U.jsx)(`span`,{className:`ml-auto max-w-[96px] truncate text-[13px] text-muted-foreground`,children:i})]}),(0,U.jsx)(Cr,{side:`right`,align:`center`,sideOffset:6,className:`z-[var(--z-tooltip)] min-w-[7rem] rounded-lg`,viewportClassName:`h-auto min-w-[7rem] w-auto`,children:n.map(e=>(0,U.jsx)(Er,{value:e.value,className:`text-[13px]`,children:e.label},e.value))})]})}var M7=P(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),yae=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}M7.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();M7.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){M7.setState({supported:!0,initialized:!0,busyAction:null}),I.error(`${b(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{M7.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(b(`runtimePresenceLaunchAtLoginUnavailable`));M7.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return M7.setState({supported:!0,initialized:!0,snapshot:n}),I.success(b(`runtimePresenceSaved`)),n}catch(e){throw I.error(`${b(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{M7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:b(`error`)}},N7=P(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null}));new class{constructor(){this.unsubscribe=null,this.subscriptionCount=0,this.start=async()=>{this.subscriptionCount+=1;let e=this.getDesktopApi();if(!e){N7.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{N7.setState({supported:!0,initialized:!0,snapshot:e})}),N7.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();N7.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){N7.setState({supported:!0,initialized:!0}),I.error(`${b(`desktopUpdatesLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.stop=()=>{this.subscriptionCount=Math.max(0,this.subscriptionCount-1),!(this.subscriptionCount>0)&&(this.unsubscribe?.(),this.unsubscribe=null)},this.checkForUpdates=async()=>{let e;try{e=await this.runSnapshotCommand(`checking`,b(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){I.success(b(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){I.success(b(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??b(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){I.success(b(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&I.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,b(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&I.success(b(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,b(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updateChannel=async e=>{if(N7.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,b(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){I.success(b(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}I.success(b(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(b(`desktopUpdatesDesktopOnlyDescription`));N7.setState({busyAction:e});try{let e=await n(r);return N7.setState({snapshot:e}),e}catch(e){throw I.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{N7.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:b(`error`),this.getChannelLabel=e=>b(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function P7(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function F7(e){let t=e.toLowerCase();return t===`/chat`||t.startsWith(`/chat/`)||t===`/inbox`||t.startsWith(`/inbox/`)||t===`/skills`||t.startsWith(`/skills/`)||t===`/cron`||t.startsWith(`/cron/`)||t===`/agents`||t.startsWith(`/agents/`)||t.startsWith(`/apps/panel/`)}function I7(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function bae(e){return[{target:`/chat`,label:e(`chat`),icon:Co},{target:`/inbox`,label:e(`inboxTitle`),icon:co},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:ua},{target:`/agents`,label:e(`agentsPageTitle`),icon:la},{target:`/settings`,label:e(`settings`),icon:es}]}function L7(e,t={}){let n=[{target:`/model`,label:e(`model`),icon:Aa},{target:`/providers`,label:e(`providers`),icon:Ir},{target:`/channels`,label:e(`channels`),icon:Do},{target:`/extensions`,label:e(`extensions`),icon:qo},{target:`/appearance`,label:e(`appearance`),icon:Io},{target:`/security`,label:e(`security`),icon:rs},{target:`/privacy`,label:e(`privacy`),icon:ra},{target:`/desktop-capabilities`,label:e(`desktopCapabilities`),icon:jo},{target:`/search`,label:e(`searchChannels`),icon:Ti},{target:`/updates`,label:e(`updates`),icon:ja},{target:`/remote`,label:e(`remote`),icon:ys},{target:`/runtime`,label:e(`runtime`),icon:Aa},{target:`/secrets`,label:e(`secrets`),icon:lo},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:xs}];return t.includeDesktopCapabilities===!1?n.filter(e=>e.target!==`/desktop-capabilities`):n}function xae(e,t={}){let n=L7(e,t);return[{label:e(`settingsGroupBasic`),items:n.slice(0,3)},{label:e(`settingsGroupAdvanced`),items:n.slice(3)}]}function Sae(e){let t=e.toLowerCase();return t===`/settings`?!0:L7(e=>e).some(e=>P7(t,e.target))}function Cae(e,t){let n=e.toLowerCase(),r=L7(t);if(I7(n))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(n===`/inbox`||n.startsWith(`/inbox/`))return{title:t(`inboxTitle`),backTarget:n===`/inbox`?null:`/inbox`,backLabel:t(`inboxTitle`)};if(n===`/skills`||n.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(n===`/agents`||n.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(n.startsWith(`/apps/panel/`))return{title:t(`panelAppsTitle`),backTarget:`/chat`,backLabel:t(`chat`)};if(n===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};for(let e of r)if(P7(n,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}var wae=[`feature-controls`];function Tae(){return z({queryKey:wae,queryFn:F.featureControls.get})}var R7=new class{constructor(){this.getStatus=async()=>await F.capabilityAccess.getDesktopStatus(),this.listGrants=async()=>await F.capabilityAccess.listDesktopGrants(),this.grantAccess=async e=>await F.capabilityAccess.grantDesktopAccess(e),this.requestSystemPermission=async()=>await F.capabilityAccess.requestDesktopPermissions(),this.openSystemSettings=async()=>await F.capabilityAccess.openDesktopPermissionSettings(),this.revokeGrant=async e=>await F.capabilityAccess.revokeDesktopAccess(e)}},z7=[`desktop-capability`,`status`],B7=[`desktop-capability`,`grants`];function Eae(){return z({queryKey:z7,queryFn:R7.getStatus})}function V7(){return Dae(Tae().data)}function Dae(e){return e?.desktopAutomation.available===!0}function Oae(){return z({queryKey:B7,queryFn:R7.listGrants})}function kae(){let e=xe();return R({mutationFn:R7.requestSystemPermission,onSuccess:async()=>{await e.invalidateQueries({queryKey:z7})}})}function Aae(){return R({mutationFn:R7.openSystemSettings})}function jae(){let e=xe();return R({mutationFn:async e=>await R7.revokeGrant(e),onSuccess:async()=>{await e.invalidateQueries({queryKey:B7})}})}function H7({isCollapsed:e,onToggle:t}){let n=b(e?`sidebarExpand`:`sidebarCollapse`);return(0,U.jsx)(V,{icon:(0,U.jsx)(e?zo:Lo,{className:rX}),label:n,className:u(oX,e&&`h-9 w-9 rounded-xl`),onClick:t})}function Mae({isCollapsed:e,onToggle:t}){return(0,U.jsx)(`div`,{className:u(`shrink-0`,e?`px-0 py-1.5`:`px-2 py-2`),children:(0,U.jsxs)(`div`,{className:u(`flex items-center py-1`,e?u(`flex-col px-0`,aX):`gap-2 px-1`),"data-testid":`settings-sidebar-header`,children:[e?(0,U.jsx)(H7,{isCollapsed:e,onToggle:t}):null,(0,U.jsxs)(pe,{to:`/chat`,"aria-label":b(`backToMain`),className:u(`group inline-flex min-w-0 items-center rounded-lg text-[12px] font-medium text-muted-foreground transition-colors hover:bg-gray-200/60 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e?u(nX,oX,`justify-center p-0`):`gap-1.5 px-1 py-1`),children:[(0,U.jsx)(wi,{className:u(e?rX:`h-3.5 w-3.5`,`shrink-0 text-muted-foreground/75 group-hover:text-gray-700`)}),(0,U.jsx)(`span`,{className:e?`sr-only`:`truncate`,children:b(`backToMain`)})]}),e?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-border`,"aria-hidden":`true`}),(0,U.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-foreground`,children:b(`settings`)}),(0,U.jsx)(`div`,{className:`ml-auto`,children:(0,U.jsx)(H7,{isCollapsed:e,onToggle:t})})]})]})})}function Nae({isCollapsed:e,sections:t}){let{onScroll:n,scrollRef:r}=oY({restorationKey:`settings-sidebar:navigation`});return(0,U.jsx)(`nav`,{ref:r,onScroll:n,className:u(`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,e?`pr-0`:`pr-1`,PF),children:e?(0,U.jsx)(hX,{isCollapsed:e,items:t.flatMap(e=>e.items),density:`compact`,className:u(iX,`pb-3`)}):(0,U.jsx)(`div`,{className:`space-y-3 pb-3`,children:t.map(t=>(0,U.jsxs)(`section`,{"aria-label":t.label,className:`space-y-1`,children:[(0,U.jsx)(`h2`,{className:`px-3 text-[11px] font-semibold text-muted-foreground/70`,children:t.label}),(0,U.jsx)(hX,{isCollapsed:e,items:t.items,density:`compact`})]},t.label))})})}function Pae(){let e=N9(),t=Ui(),n=Ts(),r=V7(),i=sc(e=>e.isSidebarCollapsed),a=cc.toggleSidebarCollapsed,o=n.data?.account.email?.trim(),s=!!n.data?.account.loggedIn,c=xae(b,{includeDesktopCapabilities:r}),l=i?iX:uX(`compact`);return(0,U.jsxs)(`aside`,{className:u(`shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary pb-6 transition-[width] duration-200 ease-out`,i?u(eX,tX):`w-[240px] px-4`),"data-sidebar-collapsed":i?`true`:`false`,children:[(0,U.jsx)(Mae,{isCollapsed:i,onToggle:a}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,U.jsx)(Nae,{isCollapsed:i,sections:c}),(0,U.jsxs)(`div`,{className:u(`shrink-0 bg-secondary`,i?`mt-2 flex flex-col items-center pt-2`:`mt-2 pt-3`,l),children:[(0,U.jsx)(gX,{onClick:()=>t.open(void 0,{kind:`docs`,title:b(`docBrowserHelp`)}),icon:Ei,label:b(`docBrowserHelp`),density:`compact`,collapsed:i}),(0,U.jsx)(gX,{onClick:()=>e.accountManager.openAccountPanel(),icon:lo,label:b(`remoteAccountEntryManage`),density:`compact`,trailing:s?o||b(`remoteAccountEntryConnected`):b(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`,collapsed:i})]})]})]})}var U7=[{action:`minimize`,label:`Minimize`,icon:Ao},{action:`close`,label:`Close`,icon:Ai,variant:`danger`}];function Fae({sidebarCollapsed:e=!1}){let t=Lae()?{action:`toggle-maximize`,label:`Restore`,icon:Oa}:{action:`toggle-maximize`,label:`Maximize`,icon:ls};return(0,U.jsxs)(`header`,{className:`desktop-window-drag relative flex h-[var(--desktop-titlebar-height)] shrink-0 bg-secondary after:absolute after:bottom-0 after:left-[var(--desktop-sidebar-width)] after:right-0 after:border-b after:border-border/80`,"data-testid":`desktop-window-chrome`,children:[(0,U.jsx)(`div`,{className:`desktop-window-no-drag absolute left-0 right-0 top-0 h-1`,"data-testid":`desktop-window-chrome-resize-strip`}),(0,U.jsx)(`div`,{className:u(`desktop-window-drag relative z-10 flex h-full w-[var(--desktop-sidebar-width)] shrink-0 items-center bg-secondary text-secondary-foreground`,e?`justify-center px-0`:`pl-4 pr-3`),"data-testid":`desktop-window-chrome-sidebar`,children:e?(0,U.jsx)(`img`,{src:`/logo.svg`,alt:`NextClaw`,className:`h-6 w-6 shrink-0 object-contain`}):(0,U.jsx)(y7,{className:`flex min-w-0 shrink-0 items-center gap-2.5`,density:`chrome`})}),(0,U.jsx)(`div`,{className:`desktop-window-no-drag absolute right-0 top-0 z-20 flex h-full w-[var(--desktop-caption-safe-right)] items-start justify-end`,"data-testid":`desktop-window-controls`,children:[U7[0],t,U7[1]].map(e=>(0,U.jsx)(Iae,{control:e},e.action))})]})}function Iae({control:e}){let t=e.icon;return(0,U.jsx)(`button`,{type:`button`,"aria-label":e.label,title:e.label,className:e.variant===`danger`?`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-red-500 hover:text-white`:`desktop-window-no-drag flex h-10 w-[46px] items-center justify-center text-gray-700 transition-colors hover:bg-black/10`,onClick:()=>{window.nextclawDesktop?.controlWindow?.(e.action)},children:(0,U.jsx)(t,{className:`h-3.5 w-3.5`})})}function Lae(){let[e,t]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let e=!0,n=window.nextclawDesktop;n?.getWindowState?.().then(n=>{e&&t(n.isMaximized)});let r=n?.onWindowStateChanged?.(e=>{t(e.isMaximized)});return()=>{e=!1,r?.()}},[]),e}function W7(){return typeof window>`u`?null:Rae()??window.nextclawDesktop?.platform??null}function G7(){return W7()===`win32`}function Rae(){return null}function K7(){let{pathname:e}=_e(),t=Ui(),n=D7();return(0,U.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":b(`settings`),className:`shrink-0 border-t border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.25rem)`},children:(0,U.jsxs)(`ul`,{className:`grid grid-cols-6 gap-1 px-2 pt-1`,children:[bae(b).map(t=>{let r=t.target===`/settings`?Sae(e):P7(e,t.target);return(0,U.jsx)(`li`,{children:(0,U.jsxs)(ue,{to:t.target,"aria-current":r?`page`:void 0,"data-testid":r?`mobile-nav-active-indicator`:void 0,className:u(`group flex min-h-[2.875rem] flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 text-[10px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,r?`bg-gray-100 text-gray-900`:`text-gray-500 hover:bg-gray-50 hover:text-gray-800`),children:[(0,U.jsxs)(`span`,{className:`relative`,children:[(0,U.jsx)(t.icon,{className:u(`h-3.5 w-3.5`,r?`text-gray-900`:`text-gray-400`)}),t.target===`/inbox`&&n>0?(0,U.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-1 ring-white`}):null]}),(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:t.label})]})},t.target)}),(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>F1(t),className:`group flex min-h-[2.875rem] w-full flex-col items-center justify-center gap-0.5 rounded-xl px-2 py-1 text-[10px] font-medium text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-800 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,U.jsx)(Qr,{className:`h-3.5 w-3.5 text-gray-400`}),(0,U.jsx)(`span`,{className:`max-w-full truncate`,children:b(`appsTitle`)})]})})]})})}function zae({leadingInset:e}){let t=ce(),{pathname:n}=_e(),r=Cae(n,b);return(0,U.jsx)(`header`,{"data-testid":`mobile-topbar`,className:`shrink-0 border-b border-gray-200/80 bg-white/95 backdrop-blur-sm`,style:{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.25rem)`},children:(0,U.jsxs)(`div`,{className:`flex min-h-[2.75rem] items-center gap-2 py-1.5 pl-3 pr-3`,style:{paddingLeft:e?`calc(${e} + 0.75rem)`:void 0},children:[r.backTarget?(0,U.jsx)(`button`,{type:`button`,onClick:()=>t(r.backTarget),className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-gray-200 text-gray-600 transition-colors hover:bg-gray-50 hover:text-gray-900`,"aria-label":r.backLabel??b(`backToMain`),children:(0,U.jsx)(wi,{className:`h-4 w-4`})}):null,(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(`h1`,{className:`truncate text-center text-[15px] font-semibold text-gray-900`,children:r.title})}),r.backTarget?(0,U.jsx)(`div`,{className:`h-8 w-8 shrink-0`,"aria-hidden":`true`}):null]})})}var Bae=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DocBrowser:e}=await import(`./doc-browser-D0qI0Z_R.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,33,1,34,35,36,37,38,39]))).DocBrowser}));function Vae({pathname:e,isDocBrowserOpen:t,docBrowserDockControls:n,docBrowserRenderers:r={},docBrowserTabMenuGroups:i,topbarLeadingInset:a,children:o}){let s=F7(e),c=!I7(e),l=!I7(e);return(0,U.jsxs)(`div`,{className:`flex h-[100svh] flex-col bg-background font-sans text-foreground supports-[height:100dvh]:h-[100dvh]`,children:[c?(0,U.jsx)(zae,{leadingInset:a}):null,(0,U.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:s?(0,U.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:o}):(0,U.jsx)(`main`,{className:`h-full overflow-auto px-4 py-4 custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:o})})}),l?(0,U.jsx)(K7,{}):null,t?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(Bae,{customTabRenderers:r,displayMode:`fullscreen`,dockControls:n,getTabMenuGroups:i})}):null]})}function Hae(){let e=L7(b,{includeDesktopCapabilities:V7()});return(0,U.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,U.jsxs)(pe,{to:e.target,className:({isActive:e})=>u(`flex items-center gap-3 rounded-2xl border border-gray-200/80 bg-white px-4 py-4 shadow-card transition-colors`,e?`border-gray-300 bg-gray-50`:`hover:border-gray-300 hover:bg-gray-50/70`),children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-gray-100 text-gray-600`,children:(0,U.jsx)(e.icon,{className:`h-4 w-4`})}),(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.label})})]},e.target))})}function Uae(){let{pathname:e}=_e(),t=ce();return I7(e)?(0,U.jsx)(Z5,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,U.jsx)(J7,{variant:`mobile`})}var q7=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DocBrowser:e}=await import(`./doc-browser-D0qI0Z_R.js`);return{DocBrowser:e}},__vite__mapDeps([25,26,4,27,28,29,30,31,32,33,1,34,35,36,37,38,39]))).DocBrowser}));function Wae({pathname:e,isMobileLayout:t=!1,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:i,docBrowserRenderers:a={},docBrowserTabMenuGroups:o,sideDock:s,children:c}){let l=F7(e),d=sc(e=>e.isSidebarCollapsed),f=t&&!I7(e),p=G7(),m=d?`56px`:l?`280px`:`240px`,{onScroll:h,scrollRef:g}=oY({restorationKey:l?null:`settings-page:${e}`});return(0,U.jsxs)(`div`,{className:u(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,p?`rounded-[10px]`:null),style:p?{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":m}:void 0,children:[p?(0,U.jsx)(Fae,{sidebarCollapsed:d}):null,(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[!l&&(0,U.jsx)(Pae,{}),(0,U.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,U.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:l?(0,U.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:c}):(0,U.jsx)(`main`,{ref:g,onScroll:h,className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:c})})}),n&&r===`docked`?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(q7,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null,s]})]}),f?(0,U.jsx)(K7,{}):null,n&&r===`floating`?(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(q7,{customTabRenderers:a,dockControls:i,getTabMenuGroups:o})}):null]})}var Gae=[{target:`/inbox`,label:()=>b(`inboxTitle`),icon:co},{target:`/cron`,label:()=>b(`chatSidebarScheduledTasks`),icon:ia},{target:`/skills`,label:()=>b(`chatSidebarSkills`),icon:ua},{target:`/agents`,label:()=>b(`agentsPageTitle`),icon:la}];function Kae({isCollapsed:e}){let t=b(e?`sidebarExpand`:`sidebarCollapse`);return(0,U.jsx)(V,{icon:(0,U.jsx)(e?zo:Lo,{className:rX}),label:t,className:u(oX,e&&`h-9 w-9 rounded-xl`),onClick:cc.toggleSidebarCollapsed})}function qae({connectionStatus:e,isCollapsed:t}){let n=G7(),r=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`;return(0,U.jsxs)(`div`,{className:u(`flex items-center`,t?`justify-center px-2 py-1.5`:n?`justify-end px-3 py-1.5`:`gap-2 px-4 py-2`,t&&r?`pt-8`:null),children:[t||n?null:(0,U.jsx)(y7,{className:`flex min-w-0 flex-1 items-center gap-2`,suffix:(0,U.jsx)(nae,{status:e})}),(0,U.jsx)(Kae,{isCollapsed:t})]})}function Jae({isCollapsed:e}){let t=D7();return(0,U.jsxs)(`div`,{className:`pb-1`,children:[(0,U.jsx)(`div`,{className:e?`px-0`:`px-3`,children:(0,U.jsx)(`ul`,{className:e?iX:`space-y-0.5`,children:Gae.map(n=>(0,U.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,U.jsx)(mX,{to:n.target,label:n.label(),icon:n.icon,density:`compact`,collapsed:e,indicator:n.target===`/inbox`&&t>0,trailing:n.target===`/inbox`&&t>0?t>99?`99+`:t:void 0,className:e?void 0:`rounded-lg px-2.5 py-1.5`})},n.target))})}),(0,U.jsx)(yX,{isCollapsed:e})]})}function Yae({defaultSessionType:e,groups:t,isCollapsed:n,isLoading:r,isProjectFirstView:i,onAddProject:a,onScrollNearEnd:o=()=>void 0,onSelectMode:s,projectGroups:c,projectCronJobCountByRoot:l,renderSessionItem:d,sessionTypeOptions:f}){let{onScroll:p,scrollRef:m}=oY({restorationKey:`chat-sidebar:sessions`,isEnabled:!n});return n?(0,U.jsx)(`div`,{className:`min-h-0 flex-1`,"aria-hidden":`true`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex h-8 items-center justify-end gap-1 px-3`,children:[i?(0,U.jsx)(V,{icon:(0,U.jsx)(Ja,{className:`h-3.5 w-3.5`}),label:b(`chatProjectAdd`),tone:`surface`,onClick:a}):null,(0,U.jsx)(wL,{isProjectFirstView:i,onSelectMode:s})]}),(0,U.jsx)(`div`,{ref:m,onScroll:e=>{p(e);let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<600&&o()},className:u(`custom-scrollbar min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-1`,PF),children:(0,U.jsx)(_ae,{isLoading:r,isProjectFirstView:i,groups:t,projectGroups:c,projectCronJobCountByRoot:l,defaultSessionType:e,sessionTypeOptions:f,renderSessionItem:d})})]})}function Xae({currentLanguage:e,currentLanguageLabel:t,currentTheme:n,currentThemeLabel:r,isCollapsed:i,isOpen:a,languageOptions:o,onOpenApps:s,onOpenChange:c,onOpenDocs:l,onSelectLanguage:d,onSelectTheme:f,themeOptions:p}){return(0,U.jsx)(`div`,{className:u(`py-2`,i?u(`flex justify-center`,tX):`px-3`),children:(0,U.jsx)(vae,{isOpen:a,onOpenChange:c,currentTheme:n,currentThemeLabel:r,themeOptions:p,onSelectTheme:f,currentLanguage:e,currentLanguageLabel:t,languageOptions:o,onSelectLanguage:d,onOpenDocs:l,onOpenApps:s,collapsed:i})})}function Zae(e){return b(e===`knowledge-base`?`chatProjectTemplateKnowledgeBase`:`chatProjectTemplateEmpty`)}function Qae({open:e,defaultWorkspacePath:t,templates:n,isCreating:r,isAddingExisting:i,createErrorMessage:a,addExistingErrorMessage:o,onOpenChange:s,onCreate:c,onAddExisting:l}){let[u,d]=(0,H.useState)(`create`),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(``),[v,y]=(0,H.useState)(!1),[x,S]=(0,H.useState)(`empty`),C=n.length>0?n.map(e=>e.id):[`empty`],w=f.trim(),T=m.trim(),E=g.trim(),D=r||i,O=D||(u===`create`?!w:!E),k=u===`create`?a:o,A=()=>{d(`create`),p(``),h(``),_(``),S(`empty`),y(!1)},j=()=>{D||(A(),s(!1))};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Wr,{open:e,onOpenChange:e=>{if(e){s(!0);return}j()},children:(0,U.jsxs)(qr,{className:`sm:max-w-lg`,children:[(0,U.jsxs)(Gr,{children:[(0,U.jsx)(Jr,{children:b(`chatProjectAddTitle`)}),(0,U.jsx)(Vr,{children:b(`chatProjectAddDescription`)})]}),(0,U.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),!O&&(u===`create`?c({name:w,template:x,rootPath:T||void 0}):l({rootPath:E})).then(A).catch(()=>void 0)},children:[(0,U.jsxs)(KY,{value:u,onValueChange:e=>{D||d(e===`existing`?`existing`:`create`)},children:[(0,U.jsxs)(qY,{className:`grid w-full grid-cols-2`,children:[(0,U.jsx)(JY,{value:`create`,children:b(`chatProjectCreateMode`)}),(0,U.jsx)(JY,{value:`existing`,children:b(`chatProjectExistingMode`)})]}),(0,U.jsxs)(YY,{value:`create`,className:`mt-4 space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:b(`chatProjectCreateModeDescription`)}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(fn,{htmlFor:`chat-project-name`,children:b(`chatProjectNameLabel`)}),(0,U.jsx)(Ct,{id:`chat-project-name`,value:f,onChange:e=>p(e.target.value),placeholder:b(`chatProjectNamePlaceholder`),autoFocus:!0,disabled:D})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(fn,{htmlFor:`chat-project-template`,children:b(`chatProjectTemplateLabel`)}),(0,U.jsxs)(Or,{value:x,onValueChange:e=>S(e),disabled:D,children:[(0,U.jsx)(br,{id:`chat-project-template`,children:(0,U.jsx)(pr,{})}),(0,U.jsx)(Cr,{children:C.map(e=>(0,U.jsx)(Er,{value:e,children:Zae(e)},e))})]})]}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(fn,{htmlFor:`chat-project-create-root-path`,children:b(`chatProjectCreatePathLabel`)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Ct,{id:`chat-project-create-root-path`,value:m,onChange:e=>h(e.target.value),placeholder:b(`chatProjectCreatePathPlaceholder`),disabled:D}),(0,U.jsxs)(L,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,U.jsx)(qa,{className:`mr-2 h-4 w-4`}),b(`browse`)]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:b(`chatProjectCreatePathHint`)})]})]}),(0,U.jsxs)(YY,{value:`existing`,className:`mt-4 space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:b(`chatProjectExistingModeDescription`)}),(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(fn,{htmlFor:`chat-project-existing-root-path`,children:b(`chatProjectExistingPathLabel`)}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Ct,{id:`chat-project-existing-root-path`,value:g,onChange:e=>_(e.target.value),placeholder:b(`chatProjectExistingPathPlaceholder`),autoFocus:!0,disabled:D}),(0,U.jsxs)(L,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:D,children:[(0,U.jsx)(qa,{className:`mr-2 h-4 w-4`}),b(`browse`)]})]}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:b(`chatProjectExistingPathHint`)})]})]})]}),k?(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:k}):null,(0,U.jsxs)(Fr,{children:[(0,U.jsx)(L,{type:`button`,variant:`outline`,onClick:j,disabled:D,children:b(`cancel`)}),(0,U.jsx)(L,{type:`submit`,disabled:O,children:b(D?`saving`:u===`create`?`chatProjectCreateAction`:`chatProjectExistingAction`)})]})]})]})}),(0,U.jsx)(GF,{open:v,allowCreateDirectory:u===`create`,currentPath:u===`create`?m:g,defaultWorkspacePath:t,isSaving:!1,onOpenChange:y,onConfirm:e=>{u===`create`?h(e):_(e),y(!1)},title:b(u===`create`?`chatProjectCreatePathPickerTitle`:`chatProjectExistingPathPickerTitle`),description:b(u===`create`?`chatProjectCreatePathPickerDescription`:`chatProjectExistingPathPickerDescription`),pathLabel:b(u===`create`?`chatProjectCreatePathLabel`:`chatProjectExistingPathLabel`),pathPlaceholder:b(u===`create`?`chatProjectCreatePathPlaceholder`:`chatProjectExistingPathPlaceholder`),confirmLabel:b(`selectCurrentDirectory`),hint:b(u===`create`?`chatProjectCreatePathHint`:`chatProjectExistingPathHint`)})]})}function $ae(e){let t=L5({all:!0});return(0,H.useMemo)(()=>{let n=new Map(e.flatMap(({session:e})=>{let t=e.projectRoot?.trim();return t?[[e.key,t]]:[]})),r=new Map,i=new Map;for(let e of t.data?.jobs??[]){let t=e.payload.sessionId?.trim();if(!t)continue;r.set(t,(r.get(t)??0)+1);let a=n.get(t);a&&i.set(a,(i.get(a)??0)+1)}return{cronJobCountByProjectRoot:i,cronJobCountBySessionKey:r}},[e,t.data?.jobs])}function eoe(e,t,n){let r=aL(e=>e.optimisticReadAtBySessionKey);return(0,H.useEffect)(()=>{(()=>{if(!t)return;let r=e.find(({session:e})=>e.key===t);if(!r||r.runStatus===`running`)return;let{session:i}=r;n(i.key,i.lastMessageAt,i.readAt)})()},[e,n,t]),r}function J7({variant:e=`desktop`}){let t=e===`mobile`,n=eI(),r=Ui(),i=sc(e=>e.isSidebarCollapsed),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),[l,d]=(0,H.useState)(!1),f=aL(e=>e.snapshot),p=eR(e=>e.snapshot.sessionTypesQuery?.data??null),m=eR(e=>e.snapshot.configQuery?.data??null),h=Qe(),g=oz(),_=nR(),v=rR(),y=iR(),{allItems:x,hasMore:S,isLoading:C,isLoadingMore:w,items:T,loadMore:E}=gL(),{cronJobCountByProjectRoot:D,cronJobCountBySessionKey:O}=$ae(x),{language:k,setLanguage:j}=Gn(),{theme:M,setTheme:N}=h7(),P=b(t7.find(e=>e.value===M)?.labelKey??`themeWork`),ee=A.find(e=>e.value===k)?.label??k,te=(0,H.useMemo)(()=>t7.map(e=>({value:e.value,label:b(e.labelKey)})),[]),ne=(0,H.useMemo)(()=>A.map(e=>({value:e.value,label:e.label})),[]),re=(0,H.useMemo)(()=>new Map((g.data?.agents??[]).map(e=>[e.id,e])),[g.data?.agents]),ie=(0,H.useMemo)(()=>new Set(f.pinnedSessionKeys),[f.pinnedSessionKeys]),ae=(0,H.useMemo)(()=>new Set(f.pinnedProjectRoots),[f.pinnedProjectRoots]),oe=(0,H.useMemo)(()=>vL(T),[T]),se=(0,H.useMemo)(()=>SL(x),[x]),ce=(0,H.useMemo)(()=>bL(oe,ie),[ie,oe]),le=(0,H.useMemo)(()=>xL(oe,ie,ae,_.data?.projects??[]),[ae,ie,_.data?.projects,oe]),ue=(0,H.useMemo)(()=>kL(p?.options??[]),[p?.options]),de=(0,H.useMemo)(()=>EL(p?.defaultType??`native`),[p?.defaultType]),fe=gR({defaultSessionType:de,sessionTypeOptions:ue}),pe=f.listMode===`project-first`,me=!t&&i,he=eoe(T,f.selectedSessionKey,n.chatSessionListManager.markSessionRead),{editingSessionKey:ge,draftLabel:_e,savingSessionKey:ve,setDraftLabel:ye,startEditingSessionLabel:be,cancelEditingSessionLabel:xe,saveSessionLabel:Se}=Sie(),Ce=e=>{k!==e&&(j(e),window.location.reload())},we=e=>(0,U.jsx)(Uie,{item:e,selectedSessionKey:f.selectedSessionKey,optimisticReadAtBySessionKey:he,agentsById:re,childSessionsByParentKey:se,cronJobCount:O.get(e.session.key)??0,editingSessionKey:ge,draftLabel:_e,savingSessionKey:ve,sessionTypeOptions:ue,isPinned:ie.has(e.session.key),sessionTitle:CL,onSelectSession:n.chatSessionListManager.selectSession,onStartEditingSessionLabel:be,onDraftLabelChange:ye,onSaveSessionLabel:Se,onCancelEditingSessionLabel:xe,onTogglePinned:()=>n.chatSessionListManager.toggleSessionPinned(e.session.key),onDeleteSession:n.chatThreadManager.deleteSession},e.session.key),Te=(e,t)=>{n.chatSessionListManager.createSession({projectRoot:typeof t==`string`?t:void 0,sessionType:e})},Ee=()=>{v.reset(),y.reset(),c(!0)},De=async e=>{await v.mutateAsync(e),c(!1)},Oe=async e=>{await y.mutateAsync(e),c(!1)};return(0,U.jsxs)(`aside`,{className:u(`flex h-full min-h-0 flex-col bg-secondary transition-[width] duration-200 ease-out`,t?`flex-1 overflow-hidden`:me?u(eX,`shrink-0`):`w-[280px] shrink-0`),"data-sidebar-collapsed":me?`true`:`false`,children:[t?null:(0,U.jsx)(qae,{connectionStatus:h.connectionStatus,isCollapsed:me}),t?(0,U.jsx)(Kie,{query:f.query,defaultSessionType:fe.selectedSessionType,sessionTypeOptions:ue,selectedNewSessionType:fe.selectedSessionType,selectedNewSessionTypeOption:fe.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:Te,onSelectNewSessionType:fe.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery}):(0,U.jsx)(Gie,{query:f.query,defaultSessionType:de,sessionTypeOptions:ue,selectedNewSessionType:fe.selectedSessionType,selectedNewSessionTypeOption:fe.selectedSessionTypeOption,isCreateMenuOpen:a,onCreateMenuOpenChange:o,onCreateSession:Te,onSelectNewSessionType:fe.setSelectedSessionType,onQueryChange:n.chatSessionListManager.setQuery,collapsed:me}),t?null:(0,U.jsx)(Jae,{isCollapsed:me}),(0,U.jsx)(Yae,{defaultSessionType:fe.selectedSessionType,groups:ce,isCollapsed:me,isLoading:C,isProjectFirstView:pe,onAddProject:Ee,onScrollNearEnd:()=>{S&&!w&&E()},onSelectMode:n.chatSessionListManager.setListMode,projectGroups:le,projectCronJobCountByRoot:D,renderSessionItem:we,sessionTypeOptions:ue}),t?null:(0,U.jsx)(Xae,{currentLanguage:k,currentLanguageLabel:ee,currentTheme:M,currentThemeLabel:P,isCollapsed:me,isOpen:l,languageOptions:ne,onOpenApps:()=>F1(r),onOpenChange:d,onOpenDocs:()=>r.open(void 0,{kind:`docs`,title:b(`docBrowserHelp`)}),onSelectLanguage:Ce,onSelectTheme:N,themeOptions:te}),(0,U.jsx)(Qae,{open:s,defaultWorkspacePath:pI(m?.agents.defaults.workspace),templates:_.data?.templates??[],isCreating:v.isPending,isAddingExisting:y.isPending,createErrorMessage:v.error?.message,addExistingErrorMessage:y.error?.message,onOpenChange:c,onCreate:De,onAddExisting:Oe})]})}var Y7=`sid_`,X7=`/chat/draft`,toe=X7.slice(6);function noe(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return`${Y7}${btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}`}function roe(e){if(!e.startsWith(Y7))return null;let t=e.slice(4).replace(/-/g,`+`).replace(/_/g,`/`),n=`=`.repeat((4-t.length%4)%4);try{let e=atob(t+n),r=Uint8Array.from(e,e=>e.charCodeAt(0));return new TextDecoder().decode(r)}catch{return null}}function Z7(e){if(!e||e===toe)return null;let t=roe(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function Q7(e){return`/chat/${noe(e)}`}function $7(e,t){let n=t.trim();return n?e.includes(n)?e.filter(e=>e!==n):[n,...e]:e}var ioe=class{constructor(e){this.uiManager=e,this.syncDraftThreadState=e=>{let t=$.getState().snapshot.workspaceFileTabs.filter(e=>e.parentSessionKey!==null);$.getState().setSnapshot({sessionKey:null,sessionDisplayName:void 0,draftProjectRoot:e,canDeleteSession:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null,workspaceFileTabs:t,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0})},this.resolveUpdateValue=(e,t)=>typeof t==`function`?t(e):t,this.shouldPersistReadAt=(e,t,n)=>{let r=aL.getState().optimisticReadAtBySessionKey[e],i=r&&n?r.localeCompare(n)>0?r:n:r??n??void 0;return i?t.localeCompare(i)>0:!0},this.setSelectedAgentId=e=>{let t=aL.getState().snapshot.selectedAgentId,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({selectedAgentId:n})},this.syncSelectedSessionAgent=()=>{let e=$.getState().snapshot.agentId?.trim();e&&this.setSelectedAgentId(e)},this.setSelectedSessionKey=e=>{e!==aL.getState().snapshot.selectedSessionKey&&aL.getState().setSnapshot({selectedSessionKey:e})},this.syncRouteSessionSelection=e=>{this.setSelectedSessionKey(e),e&&$.getState().setSnapshot({draftProjectRoot:null})},this.setListMode=e=>{let t=aL.getState().snapshot.listMode,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({listMode:n})},this.toggleSessionPinned=e=>{let{pinnedSessionKeys:t}=aL.getState().snapshot;aL.getState().setSnapshot({pinnedSessionKeys:$7(t,e)})},this.toggleProjectPinned=e=>{let{pinnedProjectRoots:t}=aL.getState().snapshot;aL.getState().setSnapshot({pinnedProjectRoots:$7(t,e)})},this.toggleProjectCollapsed=e=>{let{collapsedProjectRoots:t}=aL.getState().snapshot;aL.getState().setSnapshot({collapsedProjectRoots:$7(t,e)})},this.markSessionRead=(e,t,n)=>{let r=e?.trim(),i=t?.trim();!r||!i||this.shouldPersistReadAt(r,i,n)&&(aL.getState().markSessionRead(r,i),$e(r,{uiReadAt:i}).catch(()=>void 0))},this.markVisibleWorkspaceChildRead=e=>{this.markSessionRead(e.sessionKey,e.runStatus===`running`?null:e.lastMessageAt,e.readAt)},this.createSession=(e={})=>{let{projectRoot:t,prompt:n,sessionType:r}=e,i=EL(r??`native`),a=pI(t),o=n?.trim()||null;this.syncDraftThreadState(a),this.uiManager.navigateTo(X7,{replace:this.uiManager.isAtChatRoot(),state:{chatDraft:{sessionType:i,projectRoot:a,prompt:o}}})},this.startAgentDraftChat=(e,t,n)=>{let r=e.trim()||`main`;this.createSession({prompt:n,sessionType:t}),this.setSelectedAgentId(r)},this.selectSession=e=>{this.uiManager.goToSession(e)},this.setQuery=e=>{let t=aL.getState().snapshot.query,n=this.resolveUpdateValue(t,e);n!==t&&aL.getState().setSnapshot({query:n})}}},aoe=async()=>!1,ooe=class{constructor(e){this.docBrowserManager=e,this.state={pathname:``},this.actions={navigate:null,confirm:aoe},this.syncState=e=>{this.state={...this.state,...e}},this.bindActions=e=>{this.actions={...this.actions,...e}},this.confirm=async e=>this.actions.confirm(e),this.navigateTo=(e,t)=>{this.actions.navigate&&(this.state.pathname===e&&!t?.replace||(this.actions.navigate(e,t),this.state.pathname=e))},this.goToProviders=()=>{this.navigateTo(`/providers`)},this.isCompactViewport=()=>cc.getSnapshot().mode===`mobile`,this.resolvePanelAppEntry=async e=>{let t=e.trim();if(!t)return null;try{return V1((await F.panelApps.listPanelApps()).entries,t)}catch{return null}},this.showContent=async e=>{let{target:t,title:n}=e;if(t.type===`url`){this.docBrowserManager.open(t.payload.url,{dedupeKey:`browser:${t.payload.url}`,kind:`content`,title:n});return}let{appId:r,params:i,path:a}=t.payload;if(a){this.docBrowserManager.open(r1(r,a),{contentParams:i,title:n});return}let o=await this.resolvePanelAppEntry(r);if(o){this.docBrowserManager.openTarget({...u1(o),contentParams:i},{title:n});return}this.docBrowserManager.open(r1(r),{contentParams:i,title:n})},this.goToChatRoot=e=>{this.navigateTo(`/chat`,e)},this.isAtChatRoot=()=>this.state.pathname===`/chat`||this.state.pathname===`/chat/draft`,this.goToSession=(e,t)=>{this.navigateTo(Q7(e),t)}}};function e9(e){let t=e=>{if(!e||typeof e!=`object`)return e;let t=e,n=t.error instanceof Error?{name:t.error.name,message:t.error.message}:t.error;return{data:t.data,error:n,status:t.status,fetchStatus:t.fetchStatus,isLoading:t.isLoading,isFetching:t.isFetching,isFetched:t.isFetched,isSuccess:t.isSuccess}};return{configQuery:t(e.configQuery),providersQuery:t(e.providersQuery),providerTemplatesQuery:t(e.providerTemplatesQuery),sessionsQuery:t(e.sessionsQuery),sessionTypesQuery:t(e.sessionTypesQuery),sessionSkillsSessionId:e.sessionSkillsSessionId,sessionSkillsQuery:t(e.sessionSkillsQuery)}}function soe(e,t){return JSON.stringify(e9(e))!==JSON.stringify(e9({...e,...t}))}var coe=class{constructor(){this.syncSnapshot=e=>{let t=eR.getState();soe(t.snapshot,e)&&t.setSnapshot(e)}}};function loe(){return{sessionKey:null,sessionTypeLabel:null,agentId:null,sessionDisplayName:void 0,draftProjectRoot:null,sessionProjectName:null,canDeleteSession:!1,parentSessionKey:null,parentSessionLabel:null,workspacePanelParentKey:null,activeWorkspacePanelKind:null,childSessionTabs:[],activeChildSessionKey:null,activeSideChatDraft:null,workspaceFileTabs:[],activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0}}function t9(e,t,n){return e===t?n:e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?`${n}${e.slice(t.length)}`:null}function uoe(e,t){let n=t.previousPath.trim(),r=t.path.trim();if(!n||!r||n===r)return null;let i=new Map,a=e.workspaceFileTabs.map(e=>{let a=t9(e.path,n,r);if(!a)return e;let o=LR(e,a,e.path===n?t.label:e.label);return i.set(e.key,o.key),o});if(i.size===0)return null;let o=e=>e.kind===`file`&&i.has(e.key)?{kind:`file`,key:i.get(e.key)}:e;return{workspaceFileTabs:a,activeWorkspaceFileKey:e.activeWorkspaceFileKey?i.get(e.activeWorkspaceFileKey)??e.activeWorkspaceFileKey:null,closedWorkspaceTabEntries:e.closedWorkspaceTabEntries.map(o),workspaceNavigationHistory:e.workspaceNavigationHistory.map(o)}}function doe(e,t){let n=t.trim();if(!n)return null;let r=e,i=e.workspaceFileTabs.filter(e=>t9(e.path,n,n)!==null).map(e=>e.key);for(let e of i){let t=HR(r,{kind:`file`,key:e});t&&(r={...r,...t})}return i.length>0?r:null}var foe=class{constructor(e,t,n){this.uiManager=e,this.sessionListManager=t,this.onWorkspacePanelOpened=n,this.handledUiShowContentEventIds=new Set,this.hasSnapshotChanges=e=>{let t=$.getState().snapshot;for(let[n,r]of Object.entries(e))if(!Object.is(t[n],r))return!0;return!1},this.syncSnapshot=e=>{this.hasSnapshotChanges(e)&&$.getState().setSnapshot(e)},this.clearDeletedSessionState=()=>{$.getState().setSnapshot(loe())},this.resolveWorkspaceParentSessionKey=()=>aL.getState().snapshot.selectedSessionKey?.trim()||$.getState().snapshot.sessionKey?.trim()||(aL.getState().snapshot.selectedSessionKey??null),this.activateWorkspaceFileTab=(e,t)=>{let{parentSessionKey:n}=e,{workspaceFileTabs:r}=$.getState().snapshot;this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:`file`,workspaceFileTabs:IR(r,e,t),activeWorkspaceFileKey:e.key,activeChildSessionKey:null,activeSideChatDraft:null},{kind:`file`,key:e.key}),this.ensureWorkspaceParentRoute(n),this.onWorkspacePanelOpened?.()},this.ensureWorkspaceParentRoute=e=>{if(!e)return;let{snapshot:{selectedSessionKey:t}}=aL.getState();t!==e&&this.uiManager.goToSession(e)},this.setWorkspaceSelection=(e,t)=>{let{snapshot:n}=$.getState(),r=si({entries:n.workspaceNavigationHistory,index:n.workspaceNavigationHistoryIndex},t,zR),i=e.workspacePanelParentKey&&e.workspacePanelParentKey!==n.workspacePanelParentKey?[]:n.closedWorkspaceTabEntries.filter(e=>!zR(e,t));$.getState().setSnapshot({...e,closedWorkspaceTabEntries:i,workspaceNavigationHistory:[...r.entries],workspaceNavigationHistoryIndex:r.index})},this.openWorkspacePage=(e,t)=>{let n=e?.trim()||null;!n&&t!==`project-files`||(this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:t,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null},{kind:t}),this.ensureWorkspaceParentRoute(n),this.onWorkspacePanelOpened?.())},this.openWorkspaceOverview=e=>{this.openWorkspacePage(e,`overview`)},this.toggleWorkspacePanel=e=>{let t=e?.trim()||null,{snapshot:n}=$.getState();if(n.workspacePanelParentKey===t&&n.activeWorkspacePanelKind){this.closeWorkspacePanel();return}if(t){this.openWorkspaceOverview(t);return}this.openProjectFiles(null)},this.setWorkspacePanelWidth=e=>{this.syncSnapshot({workspacePanelWidth:kR(e)})},this.setWorkspaceExplorerWidth=e=>{this.syncSnapshot({workspaceExplorerWidth:AR(e)})},this.renameWorkspacePath=e=>{let t=uoe($.getState().snapshot,e);t&&this.syncSnapshot(t)},this.removeWorkspacePath=e=>{let t=doe($.getState().snapshot,e);t&&$.getState().setSnapshot(t)},this.openChildSessions=e=>this.openWorkspacePage(e,`child-sessions`),this.openContinuousAttention=e=>this.openWorkspacePage(e,`continuous-attention`),this.openProjectFiles=e=>this.openWorkspacePage(e,`project-files`),this.materializeRootDraftSession=e=>{let t=e.trim();if(!t||!this.uiManager.isAtChatRoot())return;let n=GR($.getState().snapshot,t);n&&(this.sessionListManager.syncRouteSessionSelection(t),$.getState().setSnapshot(n),this.uiManager.goToSession(t,{replace:!0}))},this.openChildSessionPanel=e=>{let{activeChildSessionKey:t,childSessionTab:n,parentSessionKey:r}=e,i=r.trim();if(!i)return;let a=t?.trim()||null,o={workspacePanelParentKey:i,activeWorkspacePanelKind:`child-session`,activeChildSessionKey:a,activeSideChatDraft:null,activeWorkspaceFileKey:null};a&&n&&(o.childSessionTabs=WR($.getState().snapshot.childSessionTabs,{sessionKey:a,parentSessionKey:i,label:n.label?.trim()||null,agentId:n.agentId?.trim()||null})),a?this.setWorkspaceSelection(o,{kind:`child-session`,key:a}):$.getState().setSnapshot(o),this.ensureWorkspaceParentRoute(i),this.onWorkspacePanelOpened?.()},this.openSideChatDraft=e=>{let t=e?.trim()||this.resolveWorkspaceParentSessionKey()?.trim();if(!t)return;let n=UR(t);this.setWorkspaceSelection({workspacePanelParentKey:t,activeWorkspacePanelKind:`side-chat-draft`,activeChildSessionKey:null,activeSideChatDraft:n,activeWorkspaceFileKey:null},{kind:`side-chat-draft`,key:n.draftKey}),this.ensureWorkspaceParentRoute(t),this.onWorkspacePanelOpened?.()},this.materializeSideChatDraft=e=>{let t=KR({snapshot:$.getState().snapshot,...e});t&&($.getState().setSnapshot(t.patch),this.ensureWorkspaceParentRoute(t.parentSessionKey))},this.openFilePreview=e=>{let t=FR(e,this.resolveWorkspaceParentSessionKey());t&&this.activateWorkspaceFileTab(t)},this.openWorkspaceFileViewer=(e,t)=>{let n=$.getState().snapshot.workspaceFileTabs.find(t=>t.key===e.trim());if(!n||n.viewMode!==`preview`)return;let r=t??PR(n.path,n.previewViewer);if(!r)return;let i=FR({path:n.path,label:n.label??void 0,viewMode:`preview`,previewViewer:r,line:n.line??void 0,column:n.column??void 0,params:n.params??void 0,rawText:n.rawText??void 0,contentUrl:n.contentUrl??void 0,mimeType:n.mimeType??void 0},n.parentSessionKey);i&&this.activateWorkspaceFileTab(i,n.key)},this.openSessionFromToolAction=e=>{if(e.kind!==`open-session`)return;let t=e.sessionId.trim();if(t){if(e.sessionKind===`child`&&!this.uiManager.isCompactViewport()){let n=e.parentSessionId?.trim()||aL.getState().snapshot.selectedSessionKey||null;if(n){this.openChildSessionPanel({parentSessionKey:n,activeChildSessionKey:t,childSessionTab:{label:e.label,agentId:e.agentId}});return}}this.closeWorkspacePanel(),this.uiManager.goToSession(t)}},this.handleToolAction=async e=>{if(e.kind===`show-content`){await this.showContent(e.request);return}this.openSessionFromToolAction(e)},this.handleUiShowContentEvent=async e=>{let t=e.id.trim();!t||this.handledUiShowContentEventIds.has(t)||(this.handledUiShowContentEventIds.add(t),await this.showContent({target:e.target,title:e.title,purpose:e.purpose,placement:e.placement}))},this.showContent=async e=>{if(e.placement!==`inline`){if(e.target.type===`file`){this.openFilePreview({path:e.target.payload.path,label:e.title,viewMode:`preview`,previewViewer:e.target.payload.viewer,line:e.target.payload.line,column:e.target.payload.column,params:e.target.payload.params});return}await this.uiManager.showContent({target:e.target,title:e.title})}},this.syncVisibleWorkspaceSelection=e=>{e?.kind===`child-session`&&this.sessionListManager.markVisibleWorkspaceChildRead(e.tab)},this.selectChildSessionDetail=e=>{let t=e.trim();t&&this.setWorkspaceSelection({activeChildSessionKey:t,activeWorkspaceFileKey:null,activeWorkspacePanelKind:`child-session`,activeSideChatDraft:null},{kind:`child-session`,key:t})},this.selectWorkspaceFile=e=>{let t=e.trim();if(!t)return;let{workspaceFileTabs:n}=$.getState().snapshot;n.some(e=>e.key===t)&&this.setWorkspaceSelection({activeWorkspaceFileKey:t,activeChildSessionKey:null,activeWorkspacePanelKind:`file`,activeSideChatDraft:null},{kind:`file`,key:t})},this.closeWorkspaceTab=e=>{let{snapshot:t}=$.getState(),n=HR(t,e);n&&$.getState().setSnapshot(n)},this.closeWorkspacePanel=()=>{$.getState().setSnapshot({workspacePanelParentKey:null,activeWorkspacePanelKind:null,activeChildSessionKey:null,activeSideChatDraft:null,activeWorkspaceFileKey:null,closedWorkspaceTabEntries:[],workspaceNavigationHistory:[],workspaceNavigationHistoryIndex:0})},this.openSessionCronPanel=e=>{this.openWorkspacePage(e,`cron`)},this.goBackWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`back`)},this.goForwardWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`forward`)},this.restoreWorkspaceNavigationStep=e=>{let{snapshot:t}=$.getState(),n=ci({entries:t.workspaceNavigationHistory,index:t.workspaceNavigationHistoryIndex},e);if(!n)return;let r=VR(n.entry,t);r&&$.getState().setSnapshot({...r,workspaceNavigationHistory:[...n.history.entries],workspaceNavigationHistoryIndex:n.history.index})},this.goToParentSession=()=>{let{parentSessionKey:e,activeSideChatDraft:t,childSessionTabs:n,activeChildSessionKey:r}=$.getState().snapshot,i=n.find(e=>e.sessionKey===r)?.parentSessionKey??null,a=e??t?.parentSessionKey??i;a&&(this.closeWorkspacePanel(),this.uiManager.goToSession(a))},this.deleteSession=async e=>{let{snapshot:{selectedSessionKey:t}}=aL.getState(),n=e?.trim()||t;if(n&&await this.uiManager.confirm({title:b(`chatDeleteSessionConfirm`),variant:`destructive`,confirmLabel:b(`delete`)})){$.getState().setSnapshot({isDeletePending:!0});try{await It(n),tt(Mt,n),Mt.removeQueries({queryKey:[`ncp-session-messages`,n]}),I.success(b(`chatDeleteSessionSucceeded`)),n===t&&(this.clearDeletedSessionState(),this.uiManager.goToChatRoot({replace:!0}))}catch(e){let t=e instanceof Error?e.message:String(e);I.error(`${b(`chatDeleteSessionFailed`)}: ${t}`)}finally{$.getState().setSnapshot({isDeletePending:!1})}}}}},poe=class{constructor(e){this.chatUiManager=new ooe(e.docBrowserManager),this.chatSessionListManager=new ioe(this.chatUiManager),this.chatQueryManager=new coe,this.chatComposerIntentManager=e.chatComposerIntentManager,this.chatThreadManager=new foe(this.chatUiManager,this.chatSessionListManager,e.notifyRightPanelOpened)}},moe=class{constructor(){this.nextId=0,this.pendingIntent=null,this.listeners=new Set,this.requestDraft=e=>{let t=e.trim();if(!t)return;let n={id:this.nextId+1,kind:`prompt`,prompt:t};this.nextId=n.id,this.pendingIntent=n,this.listeners.forEach(e=>e(n))},this.requestSystemObjectReference=e=>{let t={id:this.nextId+1,kind:`system-object-reference`,reference:structuredClone(e)};this.nextId=t.id,this.pendingIntent=t,this.listeners.forEach(e=>e(t))},this.consumePending=()=>{let e=this.pendingIntent;return this.pendingIntent=null,e},this.markConsumed=e=>{this.pendingIntent?.id===e&&(this.pendingIntent=null)},this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)})}};function n9(e,t){let n=2166136261;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return`${e}#excerpt-${(n>>>0).toString(36)}`}var hoe=class{constructor(){this.nextId=0,this.pendingIntent=null,this.subscriptions=new Set,this.publish=e=>{let t=this.nextId+1,n=e.targetSessionKey?.trim()||null,r={...e,id:t,targetSessionKey:n};this.nextId=r.id,this.pendingIntent=r,this.subscriptions.forEach(e=>{e.targetSessionKey===r.targetSessionKey&&e.listener(r)})},this.requestFileReference=e=>{let t=e.tokenKey.trim(),n=e.label.trim();!t||!n||this.publish({kind:r,targetSessionKey:e.targetSessionKey?.trim()||null,tokenKey:t,label:n})},this.requestDirectoryReference=e=>{let t=e.tokenKey.trim(),n=e.label.trim();!t||!n||this.publish({kind:p,targetSessionKey:e.targetSessionKey?.trim()||null,tokenKey:t,label:n})},this.requestExcerptReference=e=>{let{endLine:t,excerpt:n,label:r,path:i,startLine:a,targetSessionKey:o}=e,s=i.trim(),c=r.trim(),l=n.trim();!s||!c||!l||this.publish({kind:O,targetSessionKey:o,tokenKey:n9(s,`${s}:${a??`x`}:${t??`x`}:${l}`),path:s,label:c,excerpt:l,startLine:a,endLine:t})},this.requestConversationExcerptReference=e=>{let{targetSessionKey:t,messageId:n,role:r,label:i,excerpt:a}=e,o=n.trim(),s=i.trim(),c=a.trim();!o||!s||!c||this.publish({kind:te,targetSessionKey:t,tokenKey:n9(o,`${o}:${c}`),messageId:o,role:r,label:s,excerpt:c})},this.requestUiResourceReference=e=>{let t=x(e.reference);if(!t)return;let n=t.uri.trim(),r=t.title.trim();this.publish({kind:re,targetSessionKey:e.targetSessionKey,tokenKey:n,label:r,reference:t})},this.consumePending=e=>{if(this.pendingIntent?.targetSessionKey!==e)return null;let t=this.pendingIntent;return this.pendingIntent=null,t},this.markConsumed=e=>{this.pendingIntent?.id===e&&(this.pendingIntent=null)},this.subscribe=(e,t)=>{let n={targetSessionKey:e,listener:t};return this.subscriptions.add(n),()=>{this.subscriptions.delete(n)}}}},r9=120,goe=200;function _oe(e){return[e?.parent_session_id,e?.parentSessionId].some(e=>typeof e==`string`&&e.trim().length>0)}function voe(e){let t=e.replace(/\r\n?/gu,`
|
|
109
|
+
`).replace(/^[ \t]*\[[^\]]+\]:\s+\S+.*$/gmu,` `).replace(/^[ \t]*(?:`{3,}|~{3,})[^\n]*$/gmu,` `).replace(/^[ \t]*\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?[ \t]*$/gmu,` `).replace(/^[ \t]*(?:[-*_][ \t]*){3,}$/gmu,` `).replace(/!\[([^\]]*)\]\([^\n)]+\)/gu,`$1`).replace(/\[([^\]]+)\]\([^\n)]+\)/gu,`$1`).replace(/\[([^\]]+)\]\[[^\]]*\]/gu,`$1`).replace(/<(https?:\/\/[^>\s]+)>/gu,`$1`).replace(/<[^>]+>/gu,` `).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gmu,``).replace(/^[ \t]*>+[ \t]?/gmu,``).replace(/^[ \t]*(?:[-+*]|\d+[.)])[ \t]+/gmu,``).replace(/^[ \t]*\[(?: |x|X)\][ \t]*/gmu,``).replace(/(`+)([^`]*?)\1/gu,`$2`).replace(/(\*\*|__)(?=\S)([\s\S]*?\S)\1/gu,`$2`).replace(/~~(?=\S)([\s\S]*?\S)~~/gu,`$1`).replace(/\*(?=\S)([^*\n]*?\S)\*/gu,`$1`).replace(/\\([\\`*{}[\]()#+.!_>-])/gu,`$1`).replace(/^[ \t]*\|(.+)\|[ \t]*$/gmu,(e,t)=>t.split(`|`).map(e=>e.trim()).filter(Boolean).join(` `)).replace(/\s+/gu,` `).trim(),n=Array.from(t);return n.length<=r9?t:`${n.slice(0,r9-1).join(``)}…`}function yoe(e){return voe(e.parts.filter(e=>e.type===`text`||e.type===`rich-text`).map(e=>e.text).join(` `))}var boe=class{constructor(e){this.notificationManager=e,this.cleanups=[],this.handledMessageIds=new Set,this.visibleSessionIds=new Set,this.started=!1,this.start=()=>{this.started||(this.started=!0,this.cleanups.push(F.eventBus.on(c.ncpEvent,this.handleNcpEvent)))},this.stop=()=>{if(this.started)for(this.started=!1;this.cleanups.length>0;)this.cleanups.pop()?.()},this.syncVisibleSessions=e=>{this.visibleSessionIds=new Set(e.map(e=>e?.trim()).filter(e=>!!e))},this.handleNcpEvent=e=>{if(e.type!==gK.MessageCompleted)return;let{message:t}=e.payload,n=e.payload.sessionId.trim();if(!n||this.handledMessageIds.has(t.id)||t.role!==`assistant`||t.status!==`final`||lK(t)||(this.rememberHandledMessage(t.id),this.visibleSessionIds.has(n)))return;let r=this.resolveSessionSummary(n),i=CK(t.metadata);if(i&&i.actor!==`human`||!i&&r&&_oe(r.metadata))return;let a=r?nI(KI(r)):b(`chatBackgroundReplyFallbackTitle`),o=yoe(t);this.notificationManager.show({id:`chat-reply:${t.id}`,title:a,description:o||b(`chatBackgroundReplyFallbackPreview`),href:Q7(n),ariaLabel:b(`chatBackgroundReplyOpenAriaLabel`).replace(`{title}`,a)})},this.resolveSessionSummary=e=>(eR.getState().snapshot.sessionsQuery?.data?.sessions??[]).find(t=>t.sessionId===e),this.rememberHandledMessage=e=>{if(this.handledMessageIds.add(e),this.handledMessageIds.size<=goe)return;let t=this.handledMessageIds.values().next().value;t&&this.handledMessageIds.delete(t)}}};function i9(){return z({queryKey:[`ncp-session-types`],queryFn:Dt,staleTime:1e4,retry:!1})}var a9=`relative ml-auto flex min-h-[74px] w-[320px] max-w-[calc(100vw-2rem)] rounded-[20px] border border-border/80 bg-background text-left text-foreground shadow-[0_8px_18px_rgba(0,0,0,0.12),0_2px_5px_rgba(0,0,0,0.06)]`,o9=`flex min-h-[72px] min-w-0 flex-1 items-center gap-3 rounded-[inherit] py-3 pl-[18px] pr-[52px]`;function s9({title:e,description:t,iconSrc:n}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-border/80 bg-background p-[3px]`,children:(0,U.jsx)(`img`,{"aria-hidden":`true`,alt:``,src:n??`/logo.svg`,className:`h-full w-full object-contain`})}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-[15px] font-semibold leading-5 tracking-[-0.01em]`,children:e}),t?(0,U.jsx)(`span`,{className:`mt-0.5 block truncate text-[14px] leading-5 text-muted-foreground`,children:t}):null]})]})}function c9({dismissLabel:e,onDismiss:t}){return(0,U.jsx)(V,{className:`absolute right-2.5 top-2.5 z-10`,icon:(0,U.jsx)(Ai,{className:`h-4 w-4`,"aria-hidden":`true`}),label:e,onClick:t,size:`lg`,tooltipSide:`left`})}function xoe({title:e,description:t,href:n,iconSrc:r,ariaLabel:i,dismissLabel:a,onDismiss:o}){let s=i??[e,t].filter(Boolean).join(`: `);return n?(0,U.jsxs)(`div`,{className:a9,children:[(0,U.jsx)(ue,{to:n,"aria-label":s,className:`${o9} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50`,onClick:o,children:(0,U.jsx)(s9,{title:e,description:t,iconSrc:r})}),(0,U.jsx)(c9,{dismissLabel:a,onDismiss:o})]}):(0,U.jsxs)(`div`,{className:a9,children:[(0,U.jsx)(`div`,{role:`status`,"aria-label":s,className:o9,children:(0,U.jsx)(s9,{title:e,description:t,iconSrc:r})}),(0,U.jsx)(c9,{dismissLabel:a,onDismiss:o})]})}var Soe=8e3,Coe=class{constructor(){this.show=e=>I.custom(t=>(0,H.createElement)(xoe,{title:e.title,description:e.description,href:e.href,iconSrc:e.iconSrc,ariaLabel:e.ariaLabel,dismissLabel:e.dismissLabel??b(`notificationDismiss`),onDismiss:()=>{I.dismiss(t)}}),{id:e.id,duration:e.durationMs??Soe,unstyled:!0}),this.dismiss=e=>{I.dismiss(e)}}},woe=`nextclaw://docs`,l9=`github-project`,Toe=`https://github.com/Peiiii/nextclaw`;function u9(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:b(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:K$}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:b(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:woe}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:b(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:W$}},{builtIn:!0,icon:{type:`builtin`,name:`github`},id:l9,label:b(`sideDockGitHubProject`),removable:!1,target:{type:`external-url`,url:Toe}}]}var Eoe=[`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`];function d9(e){return!!e&&typeof e==`object`}function Doe(e){return Eoe.includes(e)}function Ooe(e){return!d9(e)||typeof e.type!=`string`?null:e.type===`builtin`&&Doe(e.name)?{type:`builtin`,name:e.name}:e.type===`url`&&typeof e.url==`string`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e.type===`text`&&typeof e.value==`string`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function koe(e){if(!d9(e)||typeof e.id!=`string`||e.id.trim().length===0||typeof e.label!=`string`||e.label.trim().length===0||typeof e.createdAt!=`string`||e.createdAt.trim().length===0||!d9(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=Ooe(e.icon);return t?{createdAt:e.createdAt,icon:t,id:e.id.trim(),label:e.label.trim(),target:{type:`right-panel-resource`,uri:e.target.uri.trim()}}:null}function f9(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=koe(e);n&&t.set(n.id,n)}),Array.from(t.values())}function Aoe(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function joe(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function Moe(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function p9(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(joe).filter(e=>e!==null)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(Moe);return[...e,...i]}var Noe=`nextclaw.side-dock.state`,Poe=1;function m9(e){return!!e&&typeof e==`object`}var h9=P()(Mi(e=>({isVisible:!0,pinnedItems:[],setVisible:t=>e({isVisible:t}),setPinnedItems:t=>e({pinnedItems:f9(t)})}),{name:Noe,version:Poe,storage:Ni(()=>window.localStorage),partialize:e=>({isVisible:e.isVisible,pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=m9(e)?f9(e.pinnedItems):[],r=m9(e)&&typeof e.isVisible==`boolean`?e.isVisible:!0;return{...t,isVisible:r,pinnedItems:n}}})),Foe={apps:Qr,docs:Ei,github:ni,"new-tab":Oi,"panel-app":fi,"service-apps":fi},Ioe=new Set([l9]),Loe=/^\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?(?:\u200D\p{Extended_Pictographic}(?:\uFE0F|\uFE0E)?)*$/u;function Roe(e){return Loe.test(e.trim())}function zoe({icon:e}){if(e.type===`url`)return(0,U.jsx)(`img`,{src:e.url,alt:``,className:`h-5 w-5 rounded object-cover`});if(e.type===`text`)return Roe(e.value)?(0,U.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center text-[20px] leading-none`,"aria-hidden":`true`,children:e.value}):(0,U.jsx)(`span`,{className:`max-w-7 truncate text-center text-[13px] font-semibold leading-none`,"aria-hidden":`true`,children:e.value});let t=Foe[e.name];return(0,U.jsx)(t,{className:`h-5 w-5`,"aria-hidden":`true`})}function g9({active:e,item:t,onOpen:n,onUnpin:r}){let{label:i}=t;return(0,U.jsxs)(mi,{children:[(0,U.jsxs)(`div`,{className:`group relative`,children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":i,title:i,"data-side-dock-item-id":t.id,onClick:()=>n(t),className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e?`bg-primary/10 text-primary`:`bg-transparent`),children:(0,U.jsx)(zoe,{icon:t.icon})})}),t.removable?(0,U.jsx)(`button`,{type:`button`,"aria-label":b(`sideDockUnpinItem`),title:b(`sideDockUnpinItem`),onClick:e=>{e.stopPropagation(),r(t)},className:`absolute -right-1 -top-1 hidden h-4 w-4 items-center justify-center rounded-full bg-background text-muted-foreground shadow-sm ring-1 ring-border/70 transition-colors hover:bg-muted hover:text-foreground group-hover:flex focus-visible:flex focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:(0,U.jsx)(Ai,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]}),(0,U.jsx)(ui,{side:`left`,children:i})]})}function Boe({icon:e,label:t,onClick:n}){return(0,U.jsxs)(mi,{children:[(0,U.jsx)(ri,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"aria-label":t,title:t,"data-side-dock-action":`hide`,onClick:n,className:u(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors`,`hover:bg-primary/10 hover:text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`),children:(0,U.jsx)(e,{className:`h-5 w-5`,"aria-hidden":`true`})})}),(0,U.jsx)(ui,{side:`left`,children:t})]})}function _9(e){return e?.trim()??``}function v9(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function y9(e,t,n,r=!1){if(!t||!n)return!1;let i=_9(v9(e)??void 0);if(!i)return!1;let a=_9(n.resourceUri);return a&&a===i||_9(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function Voe(e,t){if(!t)return!1;let n=_9(t.resourceUri),r=_9(t.currentUrl);return e.some(e=>{let t=_9(v9(e)??void 0);return t===n||t===r})}function b9(e){return Ioe.has(e.id)}function Hoe({manager:e}){let t=h9(e=>e.pinnedItems),n=h9(e=>e.setVisible),{currentTab:r,isOpen:i}=Ui(),{confirm:a,ConfirmDialog:o}=On(),s=p9(u9(),t),c=s.filter(e=>!b9(e)),l=s.filter(b9),u=Voe(s,r),d=async()=>{await a({title:b(`sideDockHideConfirmTitle`),description:b(`sideDockHideConfirmDescription`),confirmLabel:b(`sideDockHideConfirmAction`),cancelLabel:b(`cancel`)})&&n(!1)};return(0,U.jsx)(li,{delayDuration:250,children:(0,U.jsxs)(`aside`,{"data-testid":`side-dock`,className:`z-30 flex h-full w-14 shrink-0 flex-col items-center gap-1 border-l border-border/60 bg-background/95 px-2 py-3`,children:[(0,U.jsx)(`div`,{className:`flex w-full flex-col items-center gap-1`,children:c.map(t=>(0,U.jsx)(g9,{active:y9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id))}),l.length>0?(0,U.jsxs)(`div`,{"data-testid":`side-dock-utility`,className:`mt-auto flex w-full flex-col items-center gap-1`,children:[l.map(t=>(0,U.jsx)(g9,{active:y9(t,i,r,u),item:t,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},t.id)),(0,U.jsx)(Boe,{icon:Vo,label:b(`sideDockHide`),onClick:()=>{d()}})]}):null,(0,U.jsx)(o,{})]})})}var Uoe=`pinned`,Woe=new Set([`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`]);function x9(e){return e.trim()}function Goe(e){let t=0;return Array.from(x9(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${Uoe}-${x9(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function Koe(e){return e?.type===`builtin`&&Woe.has(e.name)?{type:`builtin`,name:e.name}:e?.type===`url`&&e.url.trim().length>0?{type:`url`,url:e.url.trim()}:e?.type===`text`&&e.value.trim().length>0?{type:`text`,value:e.value.trim()}:null}function qoe(e){return e.kind===`docs`?`docs`:e.kind===`home`?`new-tab`:e.kind===`apps`?e.resourceUri?.includes(`service-apps`)?`service-apps`:`apps`:e.kind===`panel-app`?`panel-app`:`apps`}var Joe=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>p9(u9(),h9.getState().pinnedItems),this.openItem=async e=>{if(e.target.type===`right-panel-resource`){this.docBrowserManager.open(e.target.uri,{dockIcon:e.icon,title:e.label});return}e.target.type===`external-url`&&await ji.openExternalUrl(e.target.url)},this.getDockState=e=>{let t=this.getTabResourceUri(e);if(!t)return{canDock:!1,isDocked:!1,removable:!1};let n=this.findItemByUri(t);return{canDock:!0,isDocked:!!n,removable:n?.removable===!0}},this.pinTab=(e,t=new Date().toISOString())=>{let n=this.getTabResourceUri(e);!e||!n||this.findItemByUri(n)||this.pinItem({builtIn:!1,icon:Koe(e.dockIcon)??{type:`builtin`,name:qoe(e)},id:Goe(n),label:e.title.trim()||n,removable:!0,target:{type:`right-panel-resource`,uri:n}},t)},this.unpinTab=e=>{let t=this.getTabResourceUri(e),n=t?this.findItemByUri(t):void 0;n?.removable&&this.unpinItem(n.id)},this.pinItem=(e,t=new Date().toISOString())=>{if(!e.removable||e.target.type!==`right-panel-resource`)return;let n=x9(e.target.uri),r={...e,target:{type:`right-panel-resource`,uri:n}};this.setPinnedItems(i=>i.some(t=>t.id===e.id||x9(t.target.uri)===n)?i:[...i,Aoe(r,t)])},this.unpinItem=e=>{this.setPinnedItems(t=>t.filter(t=>t.id!==e))},this.reorderPinnedItems=e=>{this.setPinnedItems(t=>{let n=new Map(t.map(e=>[e.id,e])),r=e.map(e=>n.get(e)).filter(e=>e!==void 0),i=new Set(r.map(e=>e.id)),a=t.filter(e=>!i.has(e.id));return[...r,...a]})},this.setPinnedItems=e=>{let{pinnedItems:t,setPinnedItems:n}=h9.getState();n(e(t))},this.getTabResourceUri=e=>{let t=e?.resourceUri??e?.currentUrl,n=t?x9(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=x9(e);return this.getItems().find(e=>e.target.type===`right-panel-resource`&&x9(e.target.uri)===t)}}},Yoe=new class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=n??(r?void 0:t?.kind)??(r&&zi(r)?`docs`:`home`),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i===`home`?`nextclaw://new-tab`:i===`docs`?Gi():`about:blank`),o=i===`docs`?Xi(a,`docs`):a;return{historyPolicy:`managed`,kind:i,title:i===`home`?b(`docBrowserHomeTitle`):Bi(o,i,i===`docs`?b(`docBrowserHelp`):`Detail`),url:o}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?Fi(e)===Fi(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==Yi}};function S9(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function C9(e,t){return S9(e,e.activeTabId,t)}function Xoe(e,t,n){let r=t.resourceUri??t.url,i=n.resourceUri??n.url;return t.tabId===n.tabId&&t.kind===n.kind&&e.areUrlsEquivalent(r,i,t.kind,n.kind)}function w9(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function T9(e,t,n){let r=si({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>Xoe(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function Zoe(e,t,n){for(let r=t.history.length-1;r>=0;--r)if(e.areUrlsEquivalent(t.history[r],n,t.kind,t.kind))return r;return-1}function E9(e,t,n){let r=t.tabs.find(e=>e.id===n.tabId);if(!r)return t;let i=n.resourceUri??n.url,a=e.resolveOpenTarget({activeTab:r,kind:n.kind,url:i}),o=Zoe(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return S9({...t,activeTabId:r.id,isOpen:!0},r.id,e=>({...e,currentUrl:a.url,dedupeKey:a.dedupeKey,dockIcon:a.dockIcon??e.dockIcon,historyIndex:o>=0?o:e.historyIndex,kind:a.kind,resourceUri:a.resourceUri??a.url,title:s?e.title:a.title}))}function Qoe(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function D9(e,t,n,r){let{activate:i,dedupeKey:a,newTab:o,title:s}=r??{},c=a?.trim()||n.dedupeKey,l=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0],u=c?t.tabs.find(e=>e.dedupeKey===c):void 0;if(u){let a=S9(t,u.id,t=>Hi(e,t,n,r,c)),o=i!==!1,s=o?u.id:t.activeTabId,l={...a,activeTabId:s,isOpen:!0};return o||u.id===t.activeTabId?T9(e,l,w9(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=qi(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon,n.contentParams);return Qoe(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[Wi(i)],activeHistoryIndex:0}:T9(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},Wi(i))}return T9(e,{...C9(t,t=>Hi(e,t,n,r,c)),isOpen:!0},w9(t.activeTabId,n))}function $oe(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return D9(e,t,{...e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),contentParams:r?.contentParams},r)}var ese=class{constructor(e=Yoe,t){this.routeResolver=e,this.onRightPanelOpened=t,this.setSnapshot=e=>{Ki.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>$oe(this.routeResolver,n,e,t)),this.onRightPanelOpened?.()},this.openTarget=(e,t)=>{this.setSnapshot(n=>D9(this.routeResolver,n,e,{...t,dedupeKey:t?.dedupeKey??e.dedupeKey,kind:t?.kind??e.kind,title:t?.title??e.title})),this.onRightPanelOpened?.()},this.reloadByDedupeKeys=e=>{let t=new Set(e);t.size!==0&&this.setSnapshot(e=>({...e,tabs:e.tabs.map(e=>t.has(e.dedupeKey??``)?{...e,navVersion:e.navVersion+1}:e)}))},this.openNewTab=()=>{this.open(void 0,{kind:Ri,newTab:!0})},this.close=()=>{this.setSnapshot(e=>({...e,isOpen:!1}))},this.toggleMode=()=>{this.setSnapshot(e=>({...e,mode:e.mode===`floating`?`docked`:`floating`})),this.onRightPanelOpened?.()},this.setDockedWidth=e=>{this.setSnapshot(t=>({...t,dockedWidth:Li(e)}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=qi(Gi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=C9(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Vi(t,n.url),kind:n.kind,navVersion:t.navVersion+1,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?T9(this.routeResolver,n,Wi(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=qi(Gi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=C9(t,t=>{if(!this.routeResolver.usesManagedHistory(t))return t;let n=this.routeResolver.resolveOpenTarget({activeTab:t,kind:t.kind,url:e});return this.routeResolver.areUrlsEquivalent(t.currentUrl,n.url,t.kind,n.kind)?t:{...t,currentUrl:n.url,dedupeKey:n.dedupeKey,dockIcon:n.dockIcon,...Vi(t,n.url),kind:n.kind,resourceUri:n.resourceUri??n.url,title:n.title}}),r=n.tabs.find(e=>e.id===n.activeTabId);return r?T9(this.routeResolver,n,Wi(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=ci({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?E9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=ci({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?E9(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.closeTab=e=>{this.setSnapshot(t=>{if(t.tabs.length<=1)return{...Ii(),isOpen:!1};let n=t.tabs.findIndex(t=>t.id===e);if(n<0)return t;let r=t.tabs.filter(t=>t.id!==e),i=t.activeTabId===e?r[Math.max(0,n-1)]?.id??r[0].id:t.activeTabId,a={...t,tabs:r,activeTabId:i},o=r.find(e=>e.id===i)??r[0],s=yi({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,Wi(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?T9(this.routeResolver,c,Wi(o)):c})},this.setActiveTab=e=>{this.setSnapshot(t=>{if(!t.tabs.some(t=>t.id===e))return t;let n=t.tabs.find(t=>t.id===e);return n?T9(this.routeResolver,{...t,activeTabId:e,isOpen:!0},Wi(n)):t})}}};function tse(e){return e.activeWorkspacePanelKind!=null}var nse=class{constructor(){this.notificationManager=new Coe,this.inboxManager=new sae,this.chatCompletionNotificationManager=new boe(this.notificationManager),this.accountManager=new tc,this.rightPanelResourceRouteResolver=new E1,this.notifyRightPanelOpened=()=>{let e=Ki.getState().snapshot,t=$.getState().snapshot;cc.collapseSidebarForDenseRightPanels({isDocBrowserDocked:e.mode===`docked`,isDocBrowserOpen:e.isOpen,isWorkspacePanelOpen:tse(t)})},this.docBrowserManager=new ese(this.rightPanelResourceRouteResolver,this.notifyRightPanelOpened),this.appPackageOperationSettlementManager=new R$(this.docBrowserManager),this.sideDockManager=new Joe(this.docBrowserManager),this.chatComposerIntentManager=new hoe,this.chatDraftIntentManager=new moe,this.serviceActionAuthorizationManager=new h$,this.panelAppBridgeManager=new z1(this.serviceActionAuthorizationManager),this.remoteAccessManager=new Ls({accountManager:this.accountManager})}},O9=null;function k9(){return O9??=new nse,O9}function A9(){return k9()}var j9=globalThis,M9=j9.__NEXTCLAW_APP_PRESENTER_CONTEXT__??(0,H.createContext)(null);j9.__NEXTCLAW_APP_PRESENTER_CONTEXT__=M9;function rse({children:e}){let t=(0,H.useMemo)(()=>k9(),[]);return(0,U.jsx)(M9.Provider,{value:t,children:e})}function N9(){let e=(0,H.useContext)(M9);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}function ise(){let e=N9();return(0,H.useEffect)(()=>(e.chatCompletionNotificationManager.start(),()=>{e.chatCompletionNotificationManager.stop()}),[e.chatCompletionNotificationManager]),null}var ase=`NextClaw`,ose=[{prefix:`/marketplace/mcp`,key:`marketplaceMcpPageTitle`},{prefix:`/marketplace/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/marketplace`,key:`marketplace`},{prefix:`/skills`,key:`marketplaceSkillsPageTitle`},{prefix:`/cron`,key:`cronPageTitle`},{prefix:`/agents`,key:`agentsPageTitle`},{prefix:`/chat`,key:`chat`},{prefix:`/model`,key:`modelPageTitle`},{prefix:`/search`,key:`searchPageTitle`},{prefix:`/providers`,key:`providersPageTitle`},{prefix:`/channels`,key:`channelsPageTitle`},{prefix:`/runtime`,key:`runtimePageTitle`},{prefix:`/updates`,key:`runtimeUpdatesPageTitle`},{prefix:`/remote`,key:`remotePageTitle`},{prefix:`/security`,key:`authSecurityTitle`},{prefix:`/secrets`,key:`secretsPageTitle`}];function sse(e,t){return e===t||e.startsWith(`${t}/`)}function cse(e){let t=e.toLowerCase();for(let{prefix:e,key:n}of ose)if(sse(t,e))return b(n);return b(`settings`)}function lse(e){let t=e.toLowerCase();return t===`localhost`||t.endsWith(`.localhost`)||t===`::1`||t===`[::1]`||t.startsWith(`127.`)}function use(e){let t=e?.host.trim(),n=e?.hostname.trim(),r=e?.port.trim();return!t||!n?null:lse(n)?r||null:t}function dse(e,t){let n=use(t);return`${ase}${n?` ${n}`:``} - ${cse(e)}`}var P9={...I1,...oee};function fse({children:e,sideDockManager:t}){let{isOpen:n,mode:r}=Ui();ree();let{pathname:i}=_e(),a=ce(),o=A9(),{language:s}=Gn(),{isMobile:c}=D8(),l=W7(),u=h9(e=>e.isVisible);h9(e=>e.pinnedItems);let d={getDockState:t.getDockState,pinTab:t.pinTab,unpinTab:t.unpinTab},f=(0,H.useCallback)(e=>{let t=Z$(e);if(t)return[{key:`chat`,items:[{key:`add-to-chat`,icon:(0,U.jsx)(wo,{className:`h-4 w-4`}),label:b(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>{let e=i===`/chat`||i.startsWith(`/chat/`),n=i===`/chat`?null:Z7(i.slice(6));o.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:e?n:null,reference:t}),e||a(X7)}}]}]},[a,i,o]);return(0,H.useEffect)(()=>{document.title=dse(i,window.location)},[i,s]),c&&l!==`win32`?(0,U.jsx)(Vae,{pathname:i,isDocBrowserOpen:n,docBrowserDockControls:d,docBrowserRenderers:P9,docBrowserTabMenuGroups:f,topbarLeadingInset:l===`darwin`?`4.75rem`:void 0,children:e}):(0,U.jsx)(Wae,{pathname:i,isMobileLayout:c,isDocBrowserOpen:n,docBrowserMode:r,docBrowserDockControls:d,docBrowserRenderers:P9,docBrowserTabMenuGroups:f,sideDock:u?(0,U.jsx)(Hoe,{manager:t}):null,children:e})}function pse({children:e}){let t=A9();return(0,U.jsx)(Ji,{manager:t.docBrowserManager,children:(0,U.jsx)(fse,{sideDockManager:t.sideDockManager,children:e})})}function mse(){let{isMobile:e}=D8();return e?(0,U.jsx)(Hae,{}):(0,U.jsx)(he,{to:`/model`,replace:!0})}var F9=new Intl.NumberFormat;function hse({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i,onOpenChange:a,onEdit:o}){if(!e)return null;let s=I9(e.model,t?.model),c=gse({agent:e,defaults:t,runtimeOptions:n,defaultRuntime:r,defaultRuntimeLabel:i}),l=L9(e.contextTokens,t?.contextTokens??2e5),u=L9(e.reservedContextTokens,t?.reservedContextTokens),d=L9(e.maxToolIterations,t?.maxToolIterations??1e3),f=I9(e.thinkingDefault,t?.thinkingDefault??`off`),p=z9(e.runtimeConfig??e.engineConfig,t?.engineConfig),m=z9(e.models,t?.models);return(0,U.jsx)(Wr,{open:e!==null,onOpenChange:a,children:(0,U.jsxs)(qr,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[720px] sm:max-w-2xl`,children:[(0,U.jsx)(`div`,{className:`shrink-0 px-5 pb-3 pt-5`,children:(0,U.jsx)(Gr,{className:`text-left`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(az,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-10 w-10 shrink-0`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(Jr,{className:`truncate text-base`,children:e.displayName?.trim()||e.id}),(0,U.jsxs)(Vr,{className:`truncate text-xs`,children:[`@`,e.id]})]})]})})}),(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-5 py-3`,children:[(0,U.jsxs)(V9,{icon:la,title:b(`agentsDetailsIdentitySection`),children:[(0,U.jsx)(H9,{label:b(`agentsDetailsFieldDisplayName`),value:e.displayName?.trim()||e.id}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldId`),value:e.id,mono:!0}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldDescription`),value:e.description?.trim()||b(`agentsDetailsEmptyValue`),wide:!0}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldWorkspace`),value:e.workspace??b(`agentsDetailsUnsetValue`),mono:!0,wide:!0})]}),(0,U.jsxs)(V9,{icon:Ir,title:b(`agentsDetailsRuntimeSection`),children:[(0,U.jsx)(H9,{label:b(`agentsDetailsFieldModel`),value:s.value,source:s.source}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldRuntime`),value:c.value,source:c.source}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldRuntimeConfig`),value:p.value,source:p.source,mono:!0,prewrap:!0})]}),(0,U.jsxs)(V9,{icon:eo,title:b(`agentsDetailsContextSection`),children:[(0,U.jsx)(H9,{label:b(`agentsDetailsFieldContextTokens`),value:l.value,source:l.source}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldReservedContextTokens`),value:u.value,source:u.source}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldMaxToolIterations`),value:d.value,source:d.source})]}),(0,U.jsxs)(V9,{icon:da,title:b(`agentsDetailsBehaviorSection`),children:[(0,U.jsx)(H9,{label:b(`agentsDetailsFieldThinkingDefault`),value:f.value,source:f.source}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldModelOverrides`),value:m.value,source:m.source,mono:!0,prewrap:!0}),(0,U.jsx)(H9,{label:b(`agentsDetailsFieldAvatar`),value:e.avatar??b(`agentsDetailsUnsetValue`),mono:!0})]})]}),(0,U.jsxs)(Fr,{className:`shrink-0 px-5 pb-4 pt-2`,children:[(0,U.jsx)(L,{type:`button`,variant:`ghost`,onClick:()=>a(!1),children:b(`cancel`)}),(0,U.jsxs)(L,{type:`button`,variant:`primary`,className:`px-4`,onClick:()=>o(e),children:[(0,U.jsx)(Go,{className:`mr-2 h-4 w-4`}),b(`agentsDetailsEditAction`)]})]})]})})}function I9(e,t){let n=e?.trim();return n?{value:n,source:`override`}:{value:t?.trim()||b(`agentsDetailsUnsetValue`),source:`default`}}function L9(e,t){return typeof e==`number`?{value:F9.format(e),source:`override`}:{value:typeof t==`number`?F9.format(t):b(`agentsDetailsUnsetValue`),source:`default`}}function gse(e){let{agent:t,defaults:n,runtimeOptions:r,defaultRuntime:i,defaultRuntimeLabel:a}=e,o=t.runtime?.trim()||t.engine?.trim();if(o)return{value:R9(o,r,a),source:`override`};let s=n?.engine?.trim()||i;return{value:s?R9(s,r,a):a,source:`default`}}function R9(e,t,n){let r=EL(e);return r?t.find(e=>e.value===r)?.label??OL(r):n}function z9(e,t){return B9(e)?{value:JSON.stringify(e,null,2),source:`override`}:{value:B9(t)?JSON.stringify(t,null,2):b(`agentsDetailsUnsetValue`),source:`default`}}function B9(e){return!!(e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length>0)}function V9(e){let{icon:t,title:n,children:r}=e;return(0,U.jsxs)(`section`,{className:`space-y-2 border-t border-border/60 pt-3 first:border-t-0 first:pt-0`,children:[(0,U.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold leading-5 text-foreground`,children:[(0,U.jsx)(t,{className:`h-3.5 w-3.5 text-muted-foreground`}),n]}),(0,U.jsx)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-2.5 pl-5 sm:grid-cols-2`,children:r})]})}function H9(e){let{label:t,value:n,source:r,mono:i=!1,prewrap:a=!1,wide:o=!1}=e,s=a&&n.trim().startsWith(`{`),c=i&&(!a||s);return(0,U.jsxs)(`div`,{className:u(`grid min-w-0 grid-cols-[10rem_minmax(0,1fr)] items-baseline gap-x-2`,(o||s)&&`sm:col-span-2`),children:[(0,U.jsx)(`dt`,{className:`flex min-w-0 items-baseline leading-5`,children:(0,U.jsx)(`span`,{className:`whitespace-nowrap text-xs font-medium text-muted-foreground`,children:t})}),(0,U.jsxs)(`dd`,{className:u(`min-w-0 break-words text-xs leading-5 text-foreground`,s?`max-h-28 overflow-auto whitespace-pre-wrap rounded bg-muted/50 px-2 py-1.5 text-left`:``),children:[(0,U.jsx)(`span`,{className:c?`font-mono`:void 0,children:n}),r?(0,U.jsx)(_se,{source:r}):null]})]})}function _se({source:e}){return(0,U.jsxs)(`span`,{className:u(`ml-1 whitespace-nowrap text-xs font-normal leading-5`,e===`override`?`text-blue-500`:`text-muted-foreground`),children:[`(`,b(e===`override`?`agentsDetailsAgentOverride`:`agentsDetailsInheritedDefault`),`)`]})}function vse({form:e,disabled:t=!1,onChange:n}){return(0,U.jsxs)(`details`,{className:`group rounded-2xl border border-border bg-card`,children:[(0,U.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-foreground [&::-webkit-details-marker]:hidden`,children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)($o,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,children:b(`agentsAdvancedConfigToggle`)})]}),(0,U.jsx)(or,{className:`h-4 w-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-180`})]}),(0,U.jsxs)(`div`,{className:`space-y-4 border-t border-border/60 px-4 py-4`,children:[(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:b(`agentsAdvancedConfigDescription`)}),(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:(0,U.jsx)(yse,{label:b(`agentsAdvancedContextTokensLabel`),value:e.contextTokens,min:1e3,step:1e3,disabled:t,onChange:e=>n({contextTokens:e})})})]})]})}function yse(e){let{label:t,value:n,min:r,step:i,disabled:a,onChange:o}=e;return(0,U.jsxs)(`label`,{className:`space-y-2 text-sm font-medium text-foreground`,children:[(0,U.jsx)(`span`,{children:t}),(0,U.jsx)(Ct,{type:`number`,min:r,step:i,value:n,disabled:a,placeholder:b(`agentsAdvancedInheritPlaceholder`),"aria-label":t,onChange:e=>o(e.target.value)})]})}function bse(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``,contextTokens:xse(e.contextTokens)}}function xse(e){return typeof e==`number`?String(e):``}var Sse=xF(`15rem`);function Cse(e){return[...new Set(e.map(e=>e.trim()).filter(Boolean))]}function wse({id:e,value:t,onChange:n,options:r,disabled:i=!1,placeholder:a,className:o,inputClassName:s,emptyText:c,createText:l,toggleLabel:d,maxItems:f=1/0,onEnter:p}){let[m,h]=(0,H.useState)(!1),g=(0,H.useRef)(null);(0,H.useEffect)(()=>{i&&m&&h(!1)},[i,m]);let _=(0,H.useMemo)(()=>Cse(r),[r]),v=t.trim().toLowerCase(),y=(0,H.useMemo)(()=>{let e=_.map((e,t)=>({option:e,index:t}));v.length>0&&e.sort((e,t)=>{let n=e.option.toLowerCase(),r=t.option.toLowerCase(),i=n===v?0:n.startsWith(v)?1:n.includes(v)?2:3,a=r===v?0:r.startsWith(v)?1:r.includes(v)?2:3;return i===a?e.index-t.index:i-a});let t=e.map(e=>e.option);return Number.isFinite(f)?t.slice(0,Math.max(1,f)):t},[_,v,f]),b=t.trim().length>0&&_.some(e=>e===t.trim()),x=()=>h(!1);return(0,U.jsxs)(CF,{open:m&&!i,onOpenChange:e=>h(!i&&e),children:[(0,U.jsx)(TF,{asChild:!0,children:(0,U.jsxs)(`div`,{ref:g,className:u(`relative`,o),children:[(0,U.jsx)(Ct,{id:e,value:t,disabled:i,onFocus:()=>{i||h(!0)},onChange:e=>{n(e.target.value),!m&&!i&&h(!0)},onKeyDown:e=>{e.key===`Enter`&&(p&&(e.preventDefault(),p()),x())},placeholder:a,className:u(`pr-10`,s)}),(0,U.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>h(e=>!e),disabled:i,className:u(`absolute inset-y-0 right-0 inline-flex w-10 items-center justify-center`,i?`cursor-not-allowed text-gray-300`:`text-gray-400 hover:text-gray-600`),"aria-label":d,children:(0,U.jsx)(hee,{className:`h-4 w-4`})})]})}),(0,U.jsx)(EF,{align:`start`,className:`flex w-[var(--radix-popover-trigger-width)] min-w-[12rem] flex-col overflow-hidden rounded-xl border border-gray-200 p-0 shadow-lg`,onInteractOutside:e=>{e.target instanceof Node&&g.current?.contains(e.target)&&e.preventDefault()},onOpenAutoFocus:e=>e.preventDefault(),style:{maxHeight:Sse},children:(0,U.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto py-1`,children:[!b&&t.trim().length>0&&(0,U.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(t.trim()),x()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,U.jsx)(jr,{className:`h-4 w-4 text-transparent`}),(0,U.jsx)(`span`,{className:`truncate text-gray-700`,children:l.replace(`{value}`,t.trim())})]}),y.map(e=>(0,U.jsxs)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>{n(e),x()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-50`,children:[(0,U.jsx)(jr,{className:u(`h-4 w-4`,e===t.trim()?`text-primary`:`text-transparent`)}),(0,U.jsx)(`span`,{className:`truncate text-gray-700`,children:e})]},e)),y.length===0&&t.trim().length===0&&(0,U.jsx)(`div`,{className:`px-3 py-2 text-sm text-gray-500`,children:c})]})})]})}var Tse=`provider/model`;function U9(e){let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function W9({id:e,value:t,onChange:n,providerCatalog:r,disabled:i=!1,providerPlaceholder:a,modelPlaceholder:o,className:s}){let[c,l]=(0,H.useState)(``),[u,d]=(0,H.useState)(``),f=r.length>0,p=o??Tse,m=(0,H.useMemo)(()=>new Map(r.map(e=>[e.name,e])),[r]),h=m.get(c),g=(0,H.useMemo)(()=>h?.aliases??[],[h]),_=(0,H.useMemo)(()=>U9(h?.models??[]),[h]);return(0,H.useEffect)(()=>{let e=t.trim();if(!f){l(``),d(e);return}if(!e){d(``),l(e=>m.has(e)?e:``);return}let n=i6(e,r)??``,i=m.get(n)?.aliases??[];l(n),d(n?X3(e,i):e)},[f,r,m,t]),f?(0,U.jsxs)(`div`,{className:s,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,U.jsx)(`div`,{className:`sm:w-[38%] sm:min-w-[170px]`,children:(0,U.jsxs)(Or,{value:c,onValueChange:e=>{let t=U9(m.get(e)?.models??[])[0]??``;if(l(e),d(t),!t){n(``);return}n(Z3(m.get(e)?.prefix??e,t))},disabled:i,children:[(0,U.jsx)(br,{className:`h-10 w-full rounded-xl`,children:(0,U.jsx)(pr,{placeholder:a??b(`providersSelectPlaceholder`)})}),(0,U.jsx)(Cr,{children:r.map(e=>(0,U.jsx)(Er,{value:e.name,children:e.displayName},e.name))})]})}),(0,U.jsx)(`span`,{className:`hidden h-10 items-center justify-center leading-none text-lg font-semibold text-gray-300 sm:inline-flex`,children:`/`}),(0,U.jsx)(wse,{id:e,value:u,onChange:e=>{if(!h){let t=e.trim();d(t),n(t);return}let t=X3(e,g);d(t),n(t?Z3(h.prefix,t):``)},options:_,disabled:i||!c,placeholder:p,className:`sm:flex-1`,inputClassName:`h-10 rounded-xl`,emptyText:b(`modelPickerNoOptions`),createText:b(`modelPickerUseCustom`),toggleLabel:b(`modelPickerToggleOptions`)},c)]}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:b(`modelInputCustomHint`)})]}):(0,U.jsxs)(`div`,{className:s,children:[(0,U.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 px-4 py-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold text-amber-950`,children:b(`providersEmptyTitle`)}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-amber-900`,children:b(`providersEmptyDescription`)})]}),(0,U.jsx)(Ct,{id:e,value:t,disabled:i,onChange:e=>n(e.target.value),placeholder:p,className:`mt-3 h-10 rounded-xl`}),(0,U.jsx)(`p`,{className:`mt-2 text-xs text-gray-500`,children:b(`modelInputCustomHint`)})]})}function Ese(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=EL(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:OL(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function Dse({value:e,disabled:t=!1,runtimeOptions:n,defaultRuntime:r,onChange:i}){let a=e.trim()?EL(e):``,o=Ese({runtimeOptions:n,currentRuntime:e}),s=o.find(e=>e.value===a)??null,c=s?.reasonMessage?.trim()||(s?.ready===!1?b(`agentsRuntimeUnavailableHelp`):``);return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(Or,{value:a||r,onValueChange:e=>i(e===r?``:e),disabled:t,children:[(0,U.jsx)(br,{"aria-label":b(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,U.jsx)(pr,{placeholder:b(`agentsRuntimeSelectPlaceholder`)})}),(0,U.jsx)(Cr,{className:`rounded-xl`,children:o.map(e=>(0,U.jsx)(Er,{value:e.value,disabled:e.ready===!1&&e.value!==a,className:`rounded-lg`,children:e.label},e.value))})]}),c?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:c}):null]})}function Ose({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,U.jsx)(Wr,{open:e!==null,onOpenChange:a,children:e?(0,U.jsx)(kse,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function kse(e){let{agent:t,pending:n,providerCatalog:r,runtimeOptions:i,defaultRuntime:a,onOpenChange:o,onSubmit:s}=e,[c,l]=(0,H.useState)(bse(t));return(0,U.jsxs)(qr,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-popover p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,U.jsx)(`div`,{className:`shrink-0 border-b border-border px-6 py-6`,children:(0,U.jsxs)(Gr,{className:`text-left`,children:[(0,U.jsx)(Jr,{children:b(`agentsEditDialogTitle`)}),(0,U.jsx)(Vr,{children:b(`agentsEditDialogDescription`)})]})}),(0,U.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(Dn,{tone:`warning`,title:b(`agentsEditHomeReadonly`),description:b(`agentsEditHomeReadonlyHint`),children:(0,U.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,U.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,U.jsx)(Ct,{value:c.displayName,onChange:e=>l(t=>({...t,displayName:e.target.value})),placeholder:b(`agentsFormNamePlaceholder`)}),(0,U.jsx)(Vn,{value:c.description,onChange:e=>l(t=>({...t,description:e.target.value})),placeholder:b(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,U.jsx)(Ct,{value:c.avatar,onChange:e=>l(t=>({...t,avatar:e.target.value})),placeholder:b(`agentsFormAvatarPlaceholder`)}),(0,U.jsx)(W9,{value:c.model,onChange:e=>l(t=>({...t,model:e})),providerCatalog:r,disabled:n,className:`md:col-span-2`}),(0,U.jsx)(Dse,{value:c.runtime,onChange:e=>l(t=>({...t,runtime:e})),runtimeOptions:i,defaultRuntime:a,disabled:n})]}),(0,U.jsx)(vse,{form:c,disabled:n,onChange:e=>l(t=>({...t,...e}))})]})}),(0,U.jsxs)(Fr,{className:`shrink-0 border-t border-border px-6 py-5`,children:[(0,U.jsx)(L,{type:`button`,variant:`ghost`,onClick:()=>o(!1),disabled:n,children:b(`cancel`)}),(0,U.jsxs)(L,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>s(t.id,c),disabled:n,children:[(0,U.jsx)(Go,{className:`mr-2 h-4 w-4`}),b(`agentsEditSaveAction`)]})]})]})}var Ase=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function jse(e){let t=e.trim();if(!t)return null;let n=Number(t);if(!Number.isFinite(n))throw Error(b(`agentsAdvancedInvalidNumberError`));return Math.trunc(n)}function Mse(e){return{displayName:e.displayName,description:e.description,avatar:e.avatar,model:e.model,...e.runtime.trim()?{runtime:e.runtime.trim()}:{runtime:``},contextTokens:jse(e.contextTokens)}}function G9(e){let{icon:t,label:n,disabled:r=!1,destructive:i=!1,onClick:a}=e;return(0,U.jsxs)(`button`,{type:`button`,className:u(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,i?`text-destructive hover:bg-destructive/10`:`text-foreground hover:bg-muted`),onClick:a,disabled:r,children:[(0,U.jsx)(t,{className:`h-4 w-4 shrink-0`}),(0,U.jsx)(`span`,{children:n})]})}function Nse(e){let{agent:t,runtimeOptions:n,defaultRuntimeLabel:r,updatePending:i,deletePending:a,onStartChat:o,onView:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?n.find(e=>e.value===EL(u))?.label??OL(u):r;return(0,U.jsx)(Js,{className:`group overflow-hidden border border-border bg-card shadow-none transition-colors duration-200 hover:border-border/80`,children:(0,U.jsxs)(Qs,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,U.jsx)(az,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold text-foreground`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,U.jsxs)(Zi,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,U.jsx)(ns,{className:`h-3 w-3`}),b(`agentsCardBuiltInTag`)]}):null]}),(0,U.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[`@`,t.id]})]})]}),(0,U.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,U.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":b(`agentsCardStartChat`),title:b(`agentsCardStartChat`),onClick:o,children:(0,U.jsx)(Co,{className:`h-4 w-4`})}),(0,U.jsxs)(CF,{children:[(0,U.jsx)(wF,{asChild:!0,children:(0,U.jsx)(L,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground`,"aria-label":b(`chatSessionMoreActions`),title:b(`chatSessionMoreActions`),children:(0,U.jsx)(Na,{className:`h-4 w-4`})})}),(0,U.jsxs)(EF,{align:`end`,className:`w-44 p-1.5`,children:[(0,U.jsx)(G9,{icon:Fa,label:b(`agentsViewDetailsAction`),onClick:s}),(0,U.jsx)(G9,{icon:Go,label:b(`agentsEditAction`),onClick:c,disabled:i}),t.builtIn?null:(0,U.jsx)(G9,{icon:ms,label:b(`agentsRemoveAction`),onClick:l,disabled:a,destructive:!0})]})]})]}),(0,U.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground`,children:t.description?.trim()||(t.builtIn?b(`agentsCardBuiltInSummary`):b(`agentsCardCustomSummary`))}),(0,U.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-border/60 pt-2 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(Ir,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,U.jsx)(`span`,{className:`truncate`,children:d})]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(oo,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60`}),(0,U.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function Pse(){let e=eI(),t=oz(),n=k6(),r=M6(),i=N6(),a=i9(),o=sz(),s=cz(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),f=(0,H.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),p=(0,H.useMemo)(()=>[...f].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[f]),m=(0,H.useMemo)(()=>o6({config:n.data,providersView:r.data,templatesView:i.data,onlyConfigured:!0}),[n.data,r.data,i.data]),h=(0,H.useMemo)(()=>kL(a.data?.options??[]),[a.data?.options]),g=(0,H.useMemo)(()=>EL(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,H.useMemo)(()=>h.find(e=>e.value===g)?.label??OL(g),[g,h]),v=n.data?.agents.defaults,y=e=>{l(e)},x=e=>{d(e)},S=async(e,t)=>{let n;try{n=Mse(t)}catch(e){I.error(e instanceof Error?e.message:b(`agentsAdvancedParseFailed`));return}await o.mutateAsync({agentId:e,data:n}),d(null)},C=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,DL(t,g))},w=()=>{e.chatSessionListManager.startAgentDraftChat(`main`,g,Ase)};return(0,U.jsxs)(Vt,{className:`space-y-6`,children:[(0,U.jsx)(St,{headingLevel:1,title:b(`agentsHeroEyebrow`),description:b(`agentsHeroDescription`),actions:(0,U.jsxs)(L,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:w,children:[(0,U.jsx)(Oi,{className:`mr-2 h-4 w-4`}),b(`agentsCreateButton`)]})}),(0,U.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,U.jsx)(Js,{className:`md:col-span-2 xl:col-span-3 border-dashed border-border bg-card/70`,children:(0,U.jsx)(Qs,{className:`py-14 text-center text-sm text-muted-foreground`,children:b(`agentsLoading`)})}):p.length===0?(0,U.jsx)(Js,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-border bg-gradient-subtle`,children:(0,U.jsxs)(Qs,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,U.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-card/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,U.jsx)(la,{className:`h-8 w-8 text-warning`})}),(0,U.jsx)(`div`,{className:`text-lg font-semibold text-foreground`,children:b(`agentsEmpty`)}),(0,U.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-muted-foreground`,children:b(`agentsEmptyDescription`)}),(0,U.jsxs)(L,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:w,children:[(0,U.jsx)(Oi,{className:`mr-2 h-4 w-4`}),b(`agentsCreateButton`)]})]})}):p.map(e=>(0,U.jsx)(Nse,{agent:e,runtimeOptions:h,defaultRuntimeLabel:_,updatePending:o.isPending,deletePending:s.isPending,onStartChat:()=>C(e),onView:()=>y(e),onEdit:()=>x(e),onDelete:()=>s.mutate({agentId:e.id})},e.id))}),(0,U.jsx)(hse,{agent:c,defaults:v,runtimeOptions:h,defaultRuntime:g,defaultRuntimeLabel:_,onOpenChange:e=>{e||l(null)},onEdit:e=>{l(null),d(e)}}),(0,U.jsx)(Ose,{agent:u,pending:o.isPending,providerCatalog:m,runtimeOptions:h,defaultRuntime:g,onOpenChange:e=>{!e&&!o.isPending&&d(null)},onSubmit:S})]})}var K9=`max-w-[min(1180px,100%)]`;function Fse(e){let{routeSessionKey:t,syncRouteSessionSelection:n}=e;(0,H.useLayoutEffect)(()=>{n(t)},[t,n])}function Ise({view:e,confirmDialog:t}){let{isMobile:n}=D8(),r=oY({restorationKey:`main-page:cron`}),i=oY({restorationKey:`main-page:agents`}),{onScroll:a,scrollRef:o}=r,{onScroll:s,scrollRef:c}=i;return(0,U.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,U.jsx)(J7,{}),e===`chat`?n?(0,U.jsx)(Uae,{}):(0,U.jsx)(Z5,{}):(0,U.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-background`,children:e===`inbox`?(0,U.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col py-4 sm:px-6 sm:py-5 ${K9}`,children:(0,U.jsx)(mae,{})}):e===`panel-app`?(0,U.jsx)(L1,{}):e===`cron`?(0,U.jsx)(`div`,{ref:o,onScroll:a,className:`h-full overflow-auto custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${K9}`,children:(0,U.jsx)(nie,{})})}):e===`agents`?(0,U.jsx)(`div`,{ref:c,onScroll:s,className:`h-full overflow-auto custom-scrollbar`,children:(0,U.jsx)(`div`,{className:`mx-auto w-full px-4 py-4 sm:px-6 sm:py-5 ${K9}`,children:(0,U.jsx)(Pse,{})})}):(0,U.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,U.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full flex-col px-4 py-4 sm:px-6 sm:py-5 ${K9}`,children:(0,U.jsx)(_Q,{forcedType:`skills`})})})}),t]})}function Lse(e){let t=eI(),n=k6(),r=M6(),i=N6(),a=sL({limit:200}),o=i9(),s=e.sessionKey?.trim()||`draft-session`,c=lL({sessionId:s});(0,H.useEffect)(()=>{t.chatQueryManager.syncSnapshot({configQuery:n,providersQuery:r,providerTemplatesQuery:i,sessionsQuery:a,sessionTypesQuery:o,sessionSkillsSessionId:s,sessionSkillsQuery:c})},[n,t.chatQueryManager,r,s,c,a,o,i])}function Rse(){let e=eI();(0,H.useEffect)(()=>F.eventBus.on(c.uiShowContent,t=>{e.chatThreadManager.handleUiShowContentEvent(t)}),[e])}function zse(){let{sessionId:e}=le(),t=(0,H.useMemo)(()=>Z7(e),[e]);return{routeSessionKey:t,sessionKey:t??void 0}}function Bse(){let e=eI(),{confirm:t,ConfirmDialog:n}=On(),r=_e(),i=ce();return(0,H.useEffect)(()=>{e.chatUiManager.syncState({pathname:r.pathname}),e.chatUiManager.bindActions({navigate:i,confirm:t})},[t,r.pathname,i,e]),(0,U.jsx)(n,{})}function Vse({view:e}){let t=N9();return(0,U.jsx)($F,{presenter:(0,H.useMemo)(()=>new poe(t),[t]),children:(0,U.jsx)(q9,{view:e})})}function q9({view:e}){let t=N9(),n=eI(),r=Bse(),{routeSessionKey:i,sessionKey:a}=zse(),o=$(e=>{let{snapshot:t}=e;return t.workspacePanelParentKey!==(a??null)||t.activeWorkspacePanelKind!==`child-session`?null:t.activeChildSessionKey?.trim()||null});return(0,H.useEffect)(()=>(t.chatCompletionNotificationManager.syncVisibleSessions([a,o]),()=>{t.chatCompletionNotificationManager.syncVisibleSessions([])}),[t.chatCompletionNotificationManager,a,o]),Lse({sessionKey:a??null}),Fse({routeSessionKey:i,syncRouteSessionSelection:n.chatSessionListManager.syncRouteSessionSelection}),Rse(),(0,U.jsx)(Ise,{view:e,confirmDialog:r})}function J9({view:e}){return(0,U.jsx)(Vse,{view:e})}var Y9=P(e=>({pending:null,present:t=>e({pending:t}),clear:()=>e({pending:null})})),Hse=`desktop.authorization.required`;function Use(){let e=Y9(e=>e.pending),t=Y9(e=>e.present),n=Y9(e=>e.clear),[r,i]=(0,H.useState)(!1);(0,H.useEffect)(()=>F.eventBus.subscribeAll(e=>{if(e.type!==Hse)return;let n=Wse(e.payload);n&&t(n)}),[t]);let a=async()=>{if(!(!e||r)){i(!0);try{await R7.grantAccess(e.request),await Mt.invalidateQueries({queryKey:[`desktop-capability`,`grants`]}),n(),I.success(b(`desktopAuthorizationAllowed`))}catch(e){I.error(e instanceof Error?e.message:b(`desktopAuthorizationFailed`))}finally{i(!1)}}};return(0,U.jsx)(Wr,{open:!!e,onOpenChange:e=>{!e&&!r&&n()},children:(0,U.jsxs)(qr,{className:`[&>:last-child]:hidden`,children:[(0,U.jsxs)(Gr,{children:[(0,U.jsxs)(Jr,{className:`flex items-center gap-2`,children:[(0,U.jsx)(ts,{className:`h-4 w-4 text-amber-600`}),b(`desktopAuthorizationTitle`)]}),(0,U.jsx)(Vr,{children:b(`desktopAuthorizationDescription`)})]}),e?(0,U.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-muted/55 p-4 text-sm`,children:[(0,U.jsx)(X9,{label:b(`desktopAuthorizationCaller`),value:Gse(e)}),(0,U.jsx)(X9,{label:b(`desktopAuthorizationApplication`),value:e.applicationId}),(0,U.jsx)(X9,{label:b(`desktopAuthorizationAccess`),value:e.request.access.map(Kse).join(`, `)}),(0,U.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:qse(e.request.access)})]}):null,(0,U.jsxs)(Fr,{className:`gap-2 sm:gap-0`,children:[(0,U.jsx)(L,{type:`button`,variant:`outline`,disabled:r,onClick:n,children:b(`desktopAuthorizationReject`)}),(0,U.jsx)(L,{type:`button`,disabled:r,onClick:()=>void a(),children:b(r?`desktopAuthorizationAllowing`:`desktopAuthorizationAllow`)})]})]})})}function X9({label:e,value:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}function Wse(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,{request:n}=t;if(!n||typeof n!=`object`||Array.isArray(n))return null;let r=n;return typeof t.applicationId!=`string`||!r.subject||!r.resource||!Array.isArray(r.access)||typeof r.declarationFingerprint!=`string`?null:{applicationId:t.applicationId,request:r}}function Gse(e){let{subject:t}=e.request;return`${t.type===`agent`?b(`desktopCapabilitiesAgent`):b(`desktopCapabilitiesExtension`)} · ${t.id}`}function Kse(e){return e===`ui.read`?b(`desktopAuthorizationRead`):e===`ui.observe`?b(`desktopAuthorizationObserve`):e===`ui.write`?b(`desktopAuthorizationWrite`):e===`screen.capture-window`?b(`desktopAuthorizationScreenCapture`):e===`input.pointer`?b(`desktopAuthorizationPointerInput`):e}function qse(e){return e.includes(`ui.write`)?b(`desktopAuthorizationWriteRisk`):e.includes(`screen.capture-window`)?b(`desktopAuthorizationScreenCaptureRisk`):e.includes(`input.pointer`)?b(`desktopAuthorizationPointerInputRisk`):b(`desktopAuthorizationReadRisk`)}function Jse(e){let t=e.trim().toLowerCase();return t?!t.startsWith(`skills`):!0}function Yse(e,t){t.startsWith(`mcp`)&&(e?.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e?.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}))}function Xse(e,t){e&&Jse(t)&&e.invalidateQueries({queryKey:[`config`]}),Yse(e,t)}function Z9(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return/^[a-z]:/i.test(t)?t.toLowerCase():t}function Zse(e,t){if(!e)return;let n=Z9(t);e.invalidateQueries({predicate:e=>e.queryKey[0]===`server-path-browse`&&typeof e.queryKey[1]==`string`&&Z9(e.queryKey[1])===n})}function Qse(e){let t=(0,H.useRef)(!1);(0,H.useEffect)(()=>{let n=F.eventBus.on(c.connectionOpen,()=>{Tt.handleConnectionRestored(),ze.refreshAfterRealtimeReconnect(),t.current&&(t.current=!1,e?.invalidateQueries({queryKey:[`ncp-sessions`]}))}),r=F.eventBus.on(c.connectionClose,()=>{Tt.handleConnectionInterrupted(null),t.current=!0}),i=F.eventBus.on(c.connectionError,e=>{Tt.handleConnectionInterrupted(e?.message??null),t.current=!0}),a=F.eventBus.on(c.configUpdated,({path:t})=>{Xse(e,t)}),o=F.eventBus.on(c.serverPathChanged,({directoryPath:t})=>Zse(e,t)),s=F.eventBus.on(c.runtimeUpdateSnapshot,e=>{ze.reportSnapshot(e)}),l=F.eventBus.on(c.sessionRunStatus,t=>{yn(e,{type:`session.run-status`,payload:t})}),u=F.eventBus.on(c.sessionSummaryUpsert,t=>{yn(e,{type:`session.summary.upsert`,payload:t})}),d=F.eventBus.on(c.sessionSummaryDelete,t=>{yn(e,{type:`session.summary.delete`,payload:t})}),f=F.eventBus.on(c.error,e=>{console.error(`Realtime transport error:`,e.message)});return()=>{n(),r(),i(),a(),o(),s(),l(),u(),d(),f()}},[e])}var $se={"--width":`320px`},ece=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ModelConfigPage:e}=await import(`./model-config-page-C173Ssil.js`);return{ModelConfigPage:e}},__vite__mapDeps([40,4,41,28,32,30,33,1,34,42,38,39,43,44,45]))).ModelConfigPage})),tce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{AppearanceSettingsPage:e}=await import(`./appearance-settings-page-BlAFMOGV.js`);return{AppearanceSettingsPage:e}},__vite__mapDeps([46,4,47,27,28,30,41,48,49,29,37,26,31,32,33,1,34,35,36,38,39,42,50,44]))).AppearanceSettingsPage})),nce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SearchConfigPage:e}=await import(`./search-config-page-b283V-fo.js`);return{SearchConfigPage:e}},__vite__mapDeps([51,4,47,27,28,30,41,31,33,1,34,52,43]))).SearchConfigPage})),rce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ProvidersConfigPage:e}=await import(`./providers-config-page-C8jUtnZb.js`);return{ProvidersConfigPage:e}},__vite__mapDeps([53,4,47,27,28,30,49,29,41,37,31,42,35,36,52,43,45,34]))).ProvidersConfigPage})),ice=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ExtensionsConfigPage:e}=await import(`./extensions-Dedd2oDI.js`);return{ExtensionsConfigPage:e}},__vite__mapDeps([54,41,4,28,36,30]))).ExtensionsConfigPage})),ace=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{ChannelsList:e}=await import(`./channels-list-page-Cfbgubyv.js`);return{ChannelsList:e}},__vite__mapDeps([55,4,47,27,28,30,41,31,32,33,1,34,42,37,52,50,43,45]))).ChannelsList})),oce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{RuntimeConfig:e}=await import(`./runtime-config-page-aeQ1Dryz.js`);return{RuntimeConfig:e}},__vite__mapDeps([56,4,47,27,28,30,41,48,49,29,37,26,31,32,33,1,34,35,36,38,39,42,50,44,57,58,43]))).RuntimeConfig})),sce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DesktopUpdateConfig:e}=await import(`./desktop-update-config-BVN4QPJn.js`);return{DesktopUpdateConfig:e}},__vite__mapDeps([59,47,4,27,28,30,41,33,1,34,36,57]))).DesktopUpdateConfig})),cce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SecurityConfig:e}=await import(`./security-config-HHz62oxH.js`);return{SecurityConfig:e}},__vite__mapDeps([60,41,4,28]))).SecurityConfig})),lce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{SecretsConfigPage:e}=await import(`./secrets-config-page-ss7x3BOo.js`);return{SecretsConfigPage:e}},__vite__mapDeps([61,4,47,27,28,30,41,35,58,43]))).SecretsConfigPage})),uce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{PrivacySettingsPage:e}=await import(`./privacy-settings-page-CRserBVF.js`);return{PrivacySettingsPage:e}},__vite__mapDeps([62,47,4,27,28,30,41]))).PrivacySettingsPage})),dce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{DesktopCapabilitiesPage:e}=await import(`./desktop-capabilities-page-C6YxsHeV.js`);return{DesktopCapabilitiesPage:e}},__vite__mapDeps([63,41,4,28]))).DesktopCapabilitiesPage})),fce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{RemoteAccessPage:e}=await import(`./remote-6BHWP5zi.js`);return{RemoteAccessPage:e}},[])).RemoteAccessPage})),pce=(0,H.lazy)(async()=>({default:(await ae(async()=>{let{McpMarketplacePage:e}=await import(`./mcp-marketplace-page-Cn-9CDh3.js`);return{McpMarketplacePage:e}},__vite__mapDeps([64,48,4,47,27,28,30,49,29,41,37,26,31,32,33,1,34,35,36,38,39,42,50,44]))).McpMarketplacePage}));function mce(){return(0,U.jsx)(`div`,{className:`h-full w-full animate-pulse rounded-2xl border border-border/40 bg-card/40`})}function hce({children:e}){return(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(mce,{}),children:e})}function Q9(e){return(0,U.jsx)(hce,{children:e})}var gce=[{path:`/chat/skills`,redirectTo:`/skills`},{path:`/chat/cron`,redirectTo:`/cron`},{path:`/chat/agents`,redirectTo:`/agents`},{path:`/chat/:sessionId?`,element:Q9((0,U.jsx)(J9,{view:`chat`}))},{path:`/agents`,element:Q9((0,U.jsx)(J9,{view:`agents`}))},{path:`/skills`,element:Q9((0,U.jsx)(J9,{view:`skills`}))},{path:`/skills/scenes/:scene`,element:Q9((0,U.jsx)(J9,{view:`skills`}))},{path:`/cron`,element:Q9((0,U.jsx)(J9,{view:`cron`}))},{path:`/inbox/:deliveryId?`,element:Q9((0,U.jsx)(J9,{view:`inbox`}))},{path:`/apps/panel/:appId`,element:Q9((0,U.jsx)(J9,{view:`panel-app`}))},{path:`/appearance`,element:Q9((0,U.jsx)(tce,{}))},{path:`/model`,element:Q9((0,U.jsx)(ece,{}))},{path:`/search`,element:Q9((0,U.jsx)(nce,{}))},{path:`/providers`,element:Q9((0,U.jsx)(rce,{}))},{path:`/extensions`,element:Q9((0,U.jsx)(ice,{}))},{path:`/channels`,element:Q9((0,U.jsx)(ace,{}))},{path:`/runtime`,element:Q9((0,U.jsx)(oce,{}))},{path:`/updates`,element:Q9((0,U.jsx)(sce,{}))},{path:`/remote`,element:Q9((0,U.jsx)(fce,{}))},{path:`/security`,element:Q9((0,U.jsx)(cce,{}))},{path:`/privacy`,element:Q9((0,U.jsx)(uce,{}))},{path:`/desktop-capabilities`,element:Q9((0,U.jsx)(dce,{}))},{path:`/secrets`,element:Q9((0,U.jsx)(lce,{}))},{path:`/settings`,element:(0,U.jsx)(mse,{})},{path:`/marketplace/skills`,redirectTo:`/skills`},{path:`/marketplace`,redirectTo:`/skills`},{path:`/marketplace/mcp`,element:Q9((0,U.jsx)(pce,{}))},{path:`/`,redirectTo:`/chat`},{path:`*`,redirectTo:`/chat`}];function _ce(e){return`redirectTo`in e?(0,U.jsx)(se,{path:e.path,element:(0,U.jsx)(he,{to:e.redirectTo,replace:!0})},e.path):(0,U.jsx)(se,{path:e.path,element:e.element},e.path)}function vce(){return(0,U.jsx)(de,{children:gce.map(_ce)})}function $9(){return Qse(Mt),ye(),(0,H.useEffect)(()=>(ze.start(),()=>{ze.stop()}),[]),(0,U.jsxs)(rse,{children:[(0,U.jsx)(ise,{}),(0,U.jsx)(uae,{}),(0,U.jsx)(pse,{children:(0,U.jsx)(vce,{})}),(0,U.jsx)(qs,{}),(0,U.jsx)(f$,{}),(0,U.jsx)(Use,{})]})}function yce(){let e=Ce(),t=e.isError&&En(e.error);return e.isLoading&&!e.isError||t||e.isError?(0,U.jsx)($9,{}):e.data?.enabled&&!e.data.authenticated?(0,U.jsx)(ec,{username:e.data.username}):(0,U.jsx)($9,{})}function bce(){return(0,H.useEffect)(()=>{Iie()},[]),(0,U.jsxs)(Rt,{client:Mt,children:[(0,U.jsx)(yce,{}),(0,U.jsx)(Pie,{}),(0,U.jsx)(kt,{position:`top-right`,richColors:!0,offset:{top:window.nextclawDesktop?.platform===`win32`?56:44,right:72},mobileOffset:window.nextclawDesktop?.platform===`win32`?56:void 0,style:$se})]})}var xce=window.nextclawDesktop?.platform===`win32`?oe:me;(0,Ss.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(H.StrictMode,{children:(0,U.jsx)(zie,{children:(0,U.jsx)(Mn,{children:(0,U.jsx)(xce,{children:(0,U.jsx)(bce,{})})})})}));export{Qs as $,I6 as A,$3 as B,j6 as C,co as Ct,W6 as D,ha as Dt,M6 as E,Na as Et,Y6 as F,qY as G,$1 as H,K3 as I,ML as J,JY as K,o6 as L,z6 as M,J6 as N,H6 as O,ra as Ot,R6 as P,Js as Q,a6 as R,G6 as S,lo as St,N6 as T,Fa as Tt,KY as U,Q3 as V,YY as W,EF as X,CF as Y,wF as Z,B6 as _,es as _t,Aae as a,Ls as at,X6 as b,Ko as bt,yae as c,js as ct,Nie as d,Fs as dt,Zs as et,t7 as f,Ds as ft,F6 as g,ls as gt,A6 as h,ms as ht,Eae as i,Vs as it,L6 as j,q6 as k,M7 as l,Ms as lt,k6 as m,ws as mt,h9 as n,Xs as nt,kae as o,Is as ot,D8 as p,Ts as pt,GL as q,Oae as r,Hs as rt,jae as s,Os as st,W9 as t,Ys as tt,h7 as u,Ns as ut,V6 as v,$o as vt,P6 as w,no as wt,K6 as x,Do as xt,U6 as y,qo as yt,t6 as z};
|