@nextclaw/ui 0.27.2 → 0.27.4
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/.vite/manifest.json +424 -424
- package/dist/assets/{account-panel-svU9I6E6.js → account-panel-Cfx3ocPY.js} +1 -1
- package/dist/assets/{agents-CtI89gpb.js → agents-BdeFtIOV.js} +1 -1
- package/dist/assets/agents-p_wcGhC3.js +1 -0
- package/dist/assets/{api-CI6_8Qt1.js → api-CXWxExzS.js} +2 -2
- package/dist/assets/app-presenter-provider-BB3Xl8b0.js +28 -0
- package/dist/assets/{appearance-settings-page-BhedtMx9.js → appearance-settings-page-DiSRSDN3.js} +1 -1
- package/dist/assets/apps-CKFrWb00.js +1 -0
- package/dist/assets/{book-open-i_BjUBqL.js → book-open-B3Ac0voD.js} +1 -1
- package/dist/assets/{card-DokH7OBp.js → card-eFBmxYiI.js} +1 -1
- package/dist/assets/{channels-list-page-B7G9lHUm.js → channels-list-page-lQOINLW8.js} +1 -1
- package/dist/assets/{circle-dashed-Cx8CIEbg.js → circle-dashed-KGwElDWV.js} +1 -1
- package/dist/assets/{client-CUJUci3r.js → client-BDS360Kz.js} +1 -1
- package/dist/assets/{config-split-page-hY1xug28.js → config-split-page-BaHtm9OW.js} +1 -1
- package/dist/assets/{confirm-dialog-B-ejV666.js → confirm-dialog-jz2cQKId.js} +1 -1
- package/dist/assets/{context-menu-dGVv8klA.js → context-menu-C0qywo73.js} +71 -72
- package/dist/assets/{createLucideIcon-reFMl-W-.js → createLucideIcon-C3LSyx-e.js} +1 -1
- package/dist/assets/cron-UqsFT41c.js +1 -0
- package/dist/assets/{desktop-capabilities-page-CYJTQ3nC.js → desktop-capabilities-page-CKq2Miye.js} +1 -1
- package/dist/assets/{desktop-update-config-guKAozXO.js → desktop-update-config-C_SBtjA1.js} +1 -1
- package/dist/assets/{dialog-DLOwdjT1.js → dialog-DMKYZDFu.js} +1 -1
- package/dist/assets/dist-D9h2cWk3.js +41 -0
- package/dist/assets/doc-browser-2VjSkax1.js +1 -0
- package/dist/assets/{doc-browser-context-CTmOmuqa.js → doc-browser-context-CoVMIiU8.js} +1 -1
- package/dist/assets/{download-DovI3Yvf.js → download-C2gYe8n1.js} +1 -1
- package/dist/assets/{extensions-BZ3qrM8M.js → extensions-DXDFcRVC.js} +1 -1
- package/dist/assets/{external-link-DUD3AbsF.js → external-link-DZzwHRHW.js} +1 -1
- package/dist/assets/{form-actions-B8VniHts.js → form-actions-CZxcWXSm.js} +1 -1
- package/dist/assets/{i18n-IGQbjBqS.js → i18n-ByVUrt9w.js} +2 -2
- package/dist/assets/{inbox-ClAG7SI_.js → inbox-CI8ATevA.js} +1 -1
- package/dist/assets/inbox-D62apR2j.js +1 -0
- package/dist/assets/{keyboard-shortcuts-settings-page-B5oxyPS2.js → keyboard-shortcuts-settings-page-BFBXVf20.js} +1 -1
- package/dist/assets/{login-page-DYaozpzz.js → login-page--Njgbmpm.js} +1 -1
- package/dist/assets/login-page-CzvxaAU8.js +1 -0
- package/dist/assets/{main-gFUvLF57.js → main-Bp1iozNB.js} +2 -2
- package/dist/assets/main-i18n-catalog.config-_4gMZaNz.js +1 -0
- package/dist/assets/main-kp_0b1bg.css +1 -0
- package/dist/assets/marketplace-BTDWnHP7.js +1 -0
- package/dist/assets/mcp-marketplace-page-oHCbBkS-.js +1 -0
- package/dist/assets/{model-config-page-Cduyz2Hy.js → model-config-page-CeVvZ29o.js} +1 -1
- package/dist/assets/{navigation-link-D-JSWFxj.js → navigation-link-O9Wm0epj.js} +1 -1
- package/dist/assets/panel-app-i18n-catalog.config-B9c87s2X.js +1 -0
- package/dist/assets/panel-apps-CniMi7QW.js +1 -0
- package/dist/assets/{panelStandalone-oHxbXvYt.js → panelStandalone-DomappXm.js} +2 -2
- package/dist/assets/plus-C42o6xrD.js +1 -0
- package/dist/assets/{privacy-settings-page-DG9E8N-F.js → privacy-settings-page-CHDv9ppI.js} +1 -1
- package/dist/assets/{projects-DvHyoKIF.js → projects-fPTOn2Wz.js} +1 -1
- package/dist/assets/{provider-models-COzjYl29.js → provider-models-D8WOdsdu.js} +1 -1
- package/dist/assets/{provider-scoped-model-input-Cvy74uj8.js → provider-scoped-model-input-BOPkUOtD.js} +1 -1
- package/dist/assets/{providers-config-page-7rCwVnhh.js → providers-config-page-BilPL0kF.js} +1 -1
- package/dist/assets/{puzzle-C5Wfpjk_.js → puzzle-DmKVREoh.js} +1 -1
- package/dist/assets/{pwa-CAg_9zFs.js → pwa-Cp7pPvsZ.js} +1 -1
- package/dist/assets/{refresh-cw-OhwaPDn1.js → refresh-cw-DOg2pWGu.js} +1 -1
- package/dist/assets/remote-CsJMF8OR.js +1 -0
- package/dist/assets/{rotate-cw-aBponvp7.js → rotate-cw-CWFIat29.js} +1 -1
- package/dist/assets/{runtime-config-page-FI2pk3HH.js → runtime-config-page-P5RUq3YK.js} +1 -1
- package/dist/assets/{save-394QCMXn.js → save-C1G0ZU-G.js} +1 -1
- package/dist/assets/{search-BG2qAlNZ.js → search-Dpgv--de.js} +1 -1
- package/dist/assets/{search-config-page-D4LeiB9y.js → search-config-page-DevSv1ZK.js} +1 -1
- package/dist/assets/{secrets-config-page-BzGcr5Vw.js → secrets-config-page-B4jWTV6V.js} +1 -1
- package/dist/assets/security-config-BGEs0SHi.js +1 -0
- package/dist/assets/{select-xUXYV0Gr.js → select-BJ-EjmCz.js} +1 -1
- package/dist/assets/{service-apps-panel-BTqXn0pg.js → service-apps-panel-BReYr_ni.js} +1 -1
- package/dist/assets/{settings-2-CWOGRRaA.js → settings-2-D3-m8a3v.js} +1 -1
- package/dist/assets/{status-dot-CYifnSnt.js → status-dot-DlELD18e.js} +1 -1
- package/dist/assets/{tag-chip-CjM6lyeh.js → tag-chip-DFzDSvcF.js} +1 -1
- package/dist/assets/{theme-provider-BToFZGZG.js → theme-provider-BsJ6HxeX.js} +1 -1
- package/dist/assets/{trash-2-DvJ6duOW.js → trash-2-BVQs-0ji.js} +1 -1
- package/dist/assets/{use-config-COusaY5p.js → use-config-M1L4xn8c.js} +1 -1
- package/dist/assets/{use-desktop-capabilities-B-u6ojjW.js → use-desktop-capabilities-BO_2CXgu.js} +1 -1
- package/dist/assets/{use-viewport-layout-IKKGpjzF.js → use-viewport-layout-Bnm5W5Qz.js} +1 -1
- package/dist/assets/{x-E9VB4HQx.js → x-waP-WLuT.js} +1 -1
- package/dist/index.html +37 -37
- package/dist/panel-standalone.html +14 -14
- package/package.json +8 -8
- package/src/features/chat/features/conversation/components/__tests__/session-conversation-input-top-slot.test.tsx +71 -0
- package/src/features/chat/features/conversation/components/__tests__/session-user-questions.test.tsx +98 -0
- package/src/features/chat/features/conversation/components/session-conversation-area.tsx +14 -3
- package/src/features/chat/features/conversation/components/session-conversation-input-top-slot.tsx +6 -7
- package/src/features/chat/features/conversation/components/session-user-questions.tsx +177 -0
- package/src/features/chat/features/conversation/hooks/use-session-user-questions.ts +100 -0
- package/src/features/chat/features/message/components/chat-message-list.container.tsx +7 -0
- package/src/features/chat/features/message/utils/__tests__/chat-message.utils.test.ts +45 -0
- package/src/features/chat/features/message/utils/chat-message-part.utils.ts +12 -0
- package/src/features/chat/features/message/utils/chat-message.utils.ts +55 -9
- package/src/shared/lib/i18n/locales/en-US/chat.json +16 -1
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +16 -1
- package/dist/assets/agents-DWygCmAK.js +0 -1
- package/dist/assets/app-presenter-provider-_UK6sArj.js +0 -28
- package/dist/assets/apps-C4c4NXqB.js +0 -1
- package/dist/assets/cron-DkYSmE-f.js +0 -1
- package/dist/assets/dist-ZaFFmAGl.js +0 -41
- package/dist/assets/doc-browser-B0zg0EXA.js +0 -1
- package/dist/assets/inbox-CJBCLB1X.js +0 -1
- package/dist/assets/login-page-BxSMwUsc.js +0 -1
- package/dist/assets/main-D_zmSVS1.css +0 -1
- package/dist/assets/main-i18n-catalog.config-itg3Gvzp.js +0 -1
- package/dist/assets/marketplace-DsAf_rnt.js +0 -1
- package/dist/assets/mcp-marketplace-page-BqUz09cj.js +0 -1
- package/dist/assets/panel-app-i18n-catalog.config-BfLHr1tc.js +0 -1
- package/dist/assets/panel-apps-Bg5Fzm3T.js +0 -1
- package/dist/assets/plus-DUdl68Eo.js +0 -1
- package/dist/assets/remote-Dhr4K1oK.js +0 -1
- package/dist/assets/security-config-vD_V0BQF.js +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/docx-preview-kPn_EtAr.js","assets/chunk-DF37yw5_.js","assets/jszip.min-DQvBVV_R.js","assets/aiden0z-pptx-renderer.es-ClCaf_Wh.js","assets/service-apps-panel-BReYr_ni.js","assets/dist-D9h2cWk3.js","assets/api-CXWxExzS.js","assets/i18n-ByVUrt9w.js","assets/preload-helper-DWTEM3RW.js","assets/createLucideIcon-C3LSyx-e.js","assets/context-menu-C0qywo73.js","assets/katex-BzT-4KBu.js","assets/search-Dpgv--de.js","assets/external-link-DZzwHRHW.js","assets/inbox-CI8ATevA.js","assets/x-waP-WLuT.js","assets/plus-C42o6xrD.js","assets/context-menu-DEcVZfaU.css","assets/theme-provider-BsJ6HxeX.js","assets/dialog-DMKYZDFu.js","assets/navigation-history-CCnxsAKR.js","assets/circle-dashed-KGwElDWV.js","assets/refresh-cw-DOg2pWGu.js","assets/trash-2-BVQs-0ji.js","assets/provider-models-D8WOdsdu.js","assets/agents-p_wcGhC3.js","assets/agents-BdeFtIOV.js","assets/provider-scoped-model-input-BOPkUOtD.js","assets/select-BJ-EjmCz.js","assets/settings-2-D3-m8a3v.js","assets/navigation-link-O9Wm0epj.js","assets/host-capabilities-B107nwS3.js","assets/tag-chip-DFzDSvcF.js","assets/card-eFBmxYiI.js","assets/use-config-M1L4xn8c.js","assets/projects-fPTOn2Wz.js","assets/use-viewport-layout-Bnm5W5Qz.js","assets/middleware-B--6mAUM.js","assets/confirm-dialog-jz2cQKId.js","assets/marketplace-BTDWnHP7.js","assets/panel-apps-CniMi7QW.js","assets/account-panel-Cfx3ocPY.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./chunk-DF37yw5_.js";import{S as n,_ as r,c as i,d as a,f as o,g as s,h as c,l,n as u,o as d,p as f,s as p,u as m,v as h,w as g,x as _,y as v}from"./theme-provider-BsJ6HxeX.js";import{$ as y,$n as b,$t as x,A as S,An as C,B as w,Bn as T,C as E,Cn as D,D as O,Dn as k,E as A,En as j,F as M,Fn as N,Ft as P,G as ee,Gn as te,Gt as F,H as ne,Hn as I,I as re,In as ie,It as ae,J as oe,Jn as se,Jt as ce,K as le,Kn as ue,L as de,Ln as fe,Lt as L,M as pe,Mn as me,N as he,Nn as ge,O as _e,On as ve,P as ye,Pn as be,Pt as xe,Q as Se,Qn as R,Qt as Ce,R as we,Rn as Te,Rt as Ee,S as De,T as Oe,Tn as ke,U as Ae,Un as je,Ut as Me,V as Ne,Vn as Pe,W as Fe,Wn as Ie,Wt as Le,X as Re,Xn as z,Xt as ze,Y as Be,Yt as B,Z as Ve,Zn as He,Zt as Ue,_ as We,_n as V,_r as Ge,a as Ke,an as qe,ar as Je,b as Ye,bn as Xe,br as Ze,bt as Qe,c as $e,cn as et,ct as tt,d as nt,dn as rt,dr as it,en as at,er as ot,et as st,fn as ct,fr as lt,ft as ut,g as dt,gn as ft,gr as pt,h as mt,hn as ht,hr as gt,i as _t,in as vt,ir as yt,it as bt,j as xt,jn as St,k as Ct,kn as wt,l as Tt,ln as Et,lr as Dt,m as Ot,mn as kt,mr as At,n as jt,nr as Mt,nt as Nt,o as Pt,on as Ft,or as It,p as Lt,pr as Rt,pt as zt,q as Bt,qn as Vt,qt as Ht,r as Ut,rr as Wt,s as Gt,sr as Kt,t as qt,tr as Jt,tt as Yt,u as Xt,ur as Zt,v as Qt,vr as $t,w as en,wn as tn,xn as nn,xr as rn,xt as an,y as on,yr as sn,z as cn,zn as ln}from"./api-CXWxExzS.js";import{t as un}from"./preload-helper-DWTEM3RW.js";import{a as dn,d as fn,f as pn,l as mn,p as hn,r as gn,t as _n,u as vn}from"./navigation-link-O9Wm0epj.js";import{t as H}from"./createLucideIcon-C3LSyx-e.js";import{n as yn,t as bn}from"./puzzle-DmKVREoh.js";import{$ as xn,C as Sn,D as Cn,E as wn,F as Tn,G as En,I as Dn,J as On,K as kn,L as An,M as jn,N as Mn,O as Nn,P as Pn,Q as Fn,R as In,St as Ln,T as Rn,W as zn,X as Bn,Y as Vn,Z as Hn,_t as Un,a as Wn,at as Gn,bt as Kn,c as qn,ct as Jn,d as Yn,dt as Xn,et as Zn,ft as Qn,g as $n,gt as er,h as tr,ht as nr,i as rr,it as ir,j as ar,k as or,l as sr,lt as cr,m as lr,mt as ur,n as dr,nt as fr,o as pr,ot as mr,p as hr,pt as gr,q as _r,r as vr,s as yr,st as br,t as xr,tt as Sr,u as Cr,ut as wr,w as Tr,xt as Er,yt as Dr}from"./context-menu-C0qywo73.js";import{n as Or,t as kr}from"./search-Dpgv--de.js";import{t as Ar}from"./book-open-B3Ac0voD.js";import{B as jr,z as Mr}from"./dist-D9h2cWk3.js";import{t as Nr}from"./download-C2gYe8n1.js";import{t as Pr}from"./external-link-DZzwHRHW.js";import{n as Fr,t as Ir}from"./inbox-CI8ATevA.js";import{a as Lr,i as Rr,n as zr,r as Br,t as Vr}from"./x-waP-WLuT.js";import{i as Hr,n as Ur,r as Wr,t as Gr}from"./use-viewport-layout-Bnm5W5Qz.js";import{t as Kr}from"./plus-C42o6xrD.js";import{t as qr}from"./refresh-cw-DOg2pWGu.js";import{t as Jr}from"./trash-2-BVQs-0ji.js";import{c as Yr,l as Xr,n as Zr,s as U,t as Qr,u as $r}from"./i18n-ByVUrt9w.js";import{a as ei,c as ti,d as ni,f as ri,i as ii,l as ai,n as oi,o as si,r as ci,s as W,t as li,u as ui}from"./dialog-DMKYZDFu.js";import{_ as di,d as fi,f as pi,g as mi,h as hi,n as gi,p as _i,r as vi,s as yi,u as bi}from"./provider-models-D8WOdsdu.js";import{n as xi,t as Si}from"./middleware-B--6mAUM.js";import{a as Ci,i as wi,n as Ti,o as Ei,r as Di,t as Oi}from"./tag-chip-DFzDSvcF.js";import{n as ki,t as Ai}from"./status-dot-DlELD18e.js";import{a as ji,i as Mi,n as Ni,o as Pi,r as Fi,s as Ii,t as Li}from"./navigation-history-CCnxsAKR.js";import{C as Ri,S as zi,_ as Bi,a as Vi,b as Hi,c as Ui,d as Wi,g as Gi,h as Ki,i as qi,l as Ji,m as Yi,n as Xi,o as Zi,p as Qi,r as $i,s as ea,u as ta,v as na,w as ra,x as ia,y as aa}from"./doc-browser-context-CoVMIiU8.js";import{t as oa}from"./confirm-dialog-jz2cQKId.js";import{t as sa}from"./host-capabilities-B107nwS3.js";import{a as ca,i as la,n as ua,o as da,r as fa,t as pa}from"./select-BJ-EjmCz.js";import{t as ma}from"./card-eFBmxYiI.js";import{d as ha,f as ga,p as _a,t as va,y as ya}from"./use-config-M1L4xn8c.js";import{s as ba,t as xa}from"./use-desktop-capabilities-BO_2CXgu.js";var Sa=class extends At{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Rt()})}getOptimisticResult(e){return e.behavior=Rt(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:it(t,n.data),hasPreviousPage:lt(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function Ca(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function wa(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ta=class extends sn{#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,gt.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||!$t(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Ca(e,n).forEach(e=>{e.destroy()}),Ca(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=Ge(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 At(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=wa(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)&>.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},G=e(rn(),1);function Ea({queries:e,...t},n){let r=Dt(n),i=Kt(),a=It(),o=G.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{ot(e),Wt(e,a,r.getQueryCache().get(e.queryHash))}),Je(a);let[s]=G.useState(()=>new Ta(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;G.useSyncExternalStore(G.useCallback(e=>d?s.subscribe(gt.batchCalls(e)):pt,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),G.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>Mt(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&Mt(n,e)?Jt(n,new At(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&yt({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())}function Da(e,t){return b(e,Sa,t)}function Oa(e){return e.split(`/`).map(e=>e.trim()).filter(e=>e.length>0)}function ka(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:Oa(n.pathname),pathname:n.pathname,raw:t,scheme:e?``:n.protocol.replace(/:$/,``).toLowerCase(),searchParams:n.searchParams}}catch{return{authority:``,pathSegments:Oa(t),pathname:t,raw:t,scheme:``,searchParams:new URLSearchParams}}}var Aa=class{constructor(e,t){this.routeDefinitions=e,this.options=t,this.resolve=e=>{let t=ka(e);return this.findDefinition(t).resolve(t)},this.normalize=e=>this.options.getNormalizedUri(this.resolve(e)),this.areEquivalent=(e,t)=>this.findDefinition(ka(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}}},ja=`home`,Ma=`nextclaw://new-tab`,Na=`apps`,Pa=`nextclaw://apps`,Fa=`${Pa}?tab=panel-apps`,Ia=`${Pa}?tab=service-apps`,La=`panel-app`,Ra=new Set([Ma,`about:blank`]);function za(e){let t=e.resourceUri?.trim()||e.currentUrl.trim(),n=e.currentUrl.trim();return!t||!n||Ra.has(t)?null:me({uri:t,resourceKind:e.kind,title:e.title.trim()||t,currentUrl:n,...e.contentParams?{contentParams:structuredClone(e.contentParams)}:{}})}var Ba=`apps`;function Va(e){return e===`apps`||e===`panel-apps`||e===`service-apps`||e===`marketplace`}function Ha(e=Ba){return e===`marketplace`?`${Pa}?tab=marketplace`:e===`panel-apps`?Fa:e===`service-apps`?Ia:Pa}function Ua(e){try{let t=new URL(e).searchParams.get(`tab`);return Va(t)?t:Ba}catch{return Ba}}function Wa(e){return Ha(Ua(e))}function Ga(e,t){let n=`/api/panel-apps/${encodeURIComponent(e)}/content`,r=t?.trim();return r?`${n}?${new URLSearchParams({path:r}).toString()}`:n}function Ka(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 qa(e){let t=ka(e);return t.searchParams.has(`path`)?null:Ka(t)}function Ja(e){return(e.resourceUri?qa(e.resourceUri):null)??qa(e.currentUrl)}function Ya(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}function Xa(e){let t=e.icon?.trim();if(t)return Ya(t)?{type:`url`,url:t}:{type:`text`,value:t}}function Za(e){return{dedupeKey:`panel-app:${e.appId}`,dockIcon:Xa(e),historyPolicy:`managed`,kind:La,resourceUri:wt(e.appId),title:e.title,url:e.contentPath}}var Qa=H(`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`}]]),$a=H(`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`}]]),eo=H(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),to=H(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),no=H(`Bookmark`,[[`path`,{d:`m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z`,key:`1fy3hk`}]]),ro=H(`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`}]]),io=H(`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`}]]),ao=H(`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`}]]),oo=H(`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`}]]),so=H(`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`}]]),co=H(`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`}]]),lo=H(`ChevronsUp`,[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]),uo=H(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),fo=H(`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`}]]),po=H(`CircleSlash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),mo=H(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),ho=H(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),go=H(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),_o=H(`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`}]]),vo=H(`CornerDownRight`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),yo=H(`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`}]]),bo=H(`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`}]]),xo=H(`FolderKey`,[[`circle`,{cx:`16`,cy:`20`,r:`2`,key:`1vifvg`}],[`path`,{d:`M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2`,key:`3hgo9p`}],[`path`,{d:`m22 14-4.5 4.5`,key:`1ef6z8`}],[`path`,{d:`m21 15 1 1`,key:`1ejcpy`}]]),So=H(`FolderMinus`,[[`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`}]]),Co=H(`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`}]]),wo=H(`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`}]]),To=H(`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`}]]),Eo=H(`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`}]]),Do=H(`Forward`,[[`polyline`,{points:`15 17 20 12 15 7`,key:`1w3sku`}],[`path`,{d:`M4 18v-2a4 4 0 0 1 4-4h12`,key:`jmiej9`}]]),Oo=H(`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`}]]),ko=H(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),Ao=H(`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`}]]),jo=H(`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`}]]),Mo=H(`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`}]]),No=H(`History`,[[`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`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Po=H(`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`}]]),Fo=H(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Io=H(`Keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Lo=H(`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`}]]),Ro=H(`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`}]]),zo=H(`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`}]]),Bo=H(`LayoutPanelLeft`,[[`rect`,{width:`7`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`2obqm`}],[`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`}]]),Vo=H(`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`}]]),Ho=H(`Link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),Uo=H(`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`}]]),Wo=H(`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`}]]),Go=H(`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`}]]),Ko=H(`MessageCircleQuestion`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`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`}]]),qo=H(`MessageCircle`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}]]),Jo=H(`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`}]]),Yo=H(`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`}]]),Xo=H(`Mic`,[[`path`,{d:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z`,key:`131961`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}]]),Zo=H(`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`}]]),Qo=H(`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`}]]),$o=H(`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`}]]),es=H(`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`}]]),ts=H(`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`}]]),ns=H(`PackageCheck`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`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`}]]),rs=H(`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`}]]),is=H(`PackageSearch`,[[`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`}],[`circle`,{cx:`18.5`,cy:`15.5`,r:`2.5`,key:`b5zd12`}],[`path`,{d:`M20.27 17.27 22 19`,key:`1l4muz`}]]),as=H(`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`}]]),os=H(`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`}]]),ss=H(`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`}]]),cs=H(`PanelLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),ls=H(`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`}]]),us=H(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),ds=H(`PanelRight`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),fs=H(`PanelsTopLeft`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 21V9`,key:`1oto5p`}]]),ps=H(`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`}]]),ms=H(`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`}]]),hs=H(`PictureInPicture2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),gs=H(`PinOff`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),_s=H(`Pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),vs=H(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ys=H(`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`}]]),bs=H(`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`}]]),xs=H(`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`}]]),Ss=H(`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`}]]),Cs=H(`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`}]]),ws=H(`SquareCheck`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ts=H(`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`}]]),Es=H(`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`}]]),Ds=H(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Os=H(`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`}]]),ks=H(`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`}]]),As=H(`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`}]]),js=H(`Zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),Ms=`sid_`,Ns=`chat-session`,Ps=C,Fs=St,Is=`/chat/draft`,Ls=Is.slice(6);function Rs(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCharCode(e);return`${Ms}${btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``)}`}function zs(e){if(!e.startsWith(Ms))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 Bs(e){if(!e||e===Ls)return null;let t=zs(e);if(t)return t;try{return decodeURIComponent(e)}catch{return e}}function Vs(e){return`/chat/${e===Ls||e.startsWith(Ms)?Rs(e):encodeURIComponent(e)}`}function Hs(e){return{key:e.key,triggerSpecs:[e.trigger],resolvePanel:t=>t.trigger.key===e.trigger.key?e.resolvePanel(t):null}}function Us(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 K=Zt();function Ws({parentSessionLabel:e,onGoToParentSession:t}){if(!e)return null;let n=e.trim();return(0,K.jsx)(`div`,{"data-theme-surface":`header`,className:`bg-background/75 px-4 py-2 backdrop-blur-sm sm:px-5`,children:(0,K.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,K.jsx)(Or,{className:`h-3.5 w-3.5`}),(0,K.jsxs)(`span`,{children:[U(`chatBackToParent`),n?` · ${n}`:``]})]})})}function Gs({layoutMode:e,actions:t,leading:n,onBackToList:r,projectBadge:i,sessionTypeBadge:a,shouldShow:o,title:s,titleContent:c}){let l=e===`mobile`;return(0,K.jsxs)(`div`,{"data-testid":`chat-conversation-header`,"data-theme-surface":`header`,className:V(`bg-background/80 backdrop-blur-sm flex items-center justify-between gap-2 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-[var(--mobile-header-height)] pb-0.5 pt-0.5`:`h-[52px]`)),style:l&&o?{paddingTop:`calc(env(safe-area-inset-top, 0px) + 0.125rem)`}:void 0,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-center gap-2 max-md:gap-0`,children:[l&&r?(0,K.jsx)(W,{icon:(0,K.jsx)(Or,{className:`h-4 w-4`}),label:U(`chat`),onClick:r,size:`lg`}):null,n,c??(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:s}),a,i]}),t]})}function Ks(){let e=Dt();return(0,G.useCallback)(async t=>{let{invalidateSessionSkills:n=!0,sessionKey:r,patch:i,successMessage:a}=t;try{E(e,await cn(r,i)),n&&await e.invalidateQueries({queryKey:[`ncp-session-skills`,r]}),a!==null&&z.success(a??U(`configSavedApplied`))}catch(e){throw z.error(U(`configSaveFailed`)+`: `+(e instanceof Error?e.message:String(e))),e}},[e])}function qs(){let e=Ks();return async t=>{await e({sessionKey:t.sessionKey,patch:{label:t.label},successMessage:U(`configSavedApplied`)})}}function Js(){let e=Ks();return async t=>{let{persistToServer:n,projectRoot:r,sessionKey:i}=t,a=U(r?`chatSessionProjectUpdated`:`chatSessionProjectCleared`);if(!n){z.success(a);return}await e({sessionKey:i,patch:{projectRoot:r},successMessage:a})}}function Ys({icon:e,label:t,onClick:n,disabled:r=!1,destructive:i=!1}){return(0,K.jsxs)(`button`,{type:`button`,className:V($n,i?tr.destructive:`text-foreground ${tr.item}`),onClick:n,disabled:r,children:[(0,K.jsx)(e,{className:V(`h-4 w-4 shrink-0`,!i&&`text-muted-foreground`)}),(0,K.jsx)(`span`,{children:t})]})}async function Xs(e){let t=await Cr(e);z[t?`success`:`error`](U(t?`chatSessionCopyIdSuccess`:`chatSessionCopyIdFailed`))}function Zs({sessionKey:e,sessionTitle:t,children:n,disabled:r=!1,triggerSize:i=`md`,triggerTone:a=`default`,triggerTooltipSide:o=`bottom`,className:s}){let[c,l]=(0,G.useState)(!1),u=G.Children.toArray(n),d=e=>(0,G.isValidElement)(e)&&e.props.destructive,f=u.filter(d);return(0,K.jsxs)(_i,{open:c,onOpenChange:l,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(W,{icon:(0,K.jsx)(wr,{className:`h-4 w-4`}),label:U(`chatSessionMoreActions`),size:i,tone:a,tooltipSide:o,className:s,disabled:r,onClick:e=>e.stopPropagation()})}),(0,K.jsxs)(hi,{align:`end`,variant:`menu`,children:[(0,K.jsxs)(`div`,{onClick:()=>l(!1),children:[u.filter(e=>!d(e)),(0,K.jsx)(Ys,{icon:Qn,label:U(`chatSessionCopyId`),onClick:()=>{l(!1),Xs(e)},disabled:r})]}),(0,K.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,K.jsx)(Mz,{page:Cz({kind:`chat-session`,title:t||U(`chatFloatingConversation`),url:Ps(e),resourceUri:Ps(e),historyPolicy:`none`}),onSelect:()=>l(!1)}),f.length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,K.jsx)(`div`,{onClick:()=>l(!1),children:f})]}):null]})]})}function Qs(e){try{return JSON.stringify(e??{},null,2)}catch{return`{}`}}function $s({open:e,metadata:t,onOpenChange:n}){return(0,K.jsx)(li,{open:e,onOpenChange:n,children:(0,K.jsxs)(oi,{className:`max-w-2xl gap-0 overflow-hidden p-0`,children:[(0,K.jsxs)(ei,{className:`border-b border-border px-5 py-4`,children:[(0,K.jsx)(si,{className:`text-base`,children:U(`chatSessionMetadataDialogTitle`)}),(0,K.jsx)(ci,{className:`sr-only`,children:U(`chatSessionMetadataDialogDescription`)})]}),(0,K.jsx)(`div`,{className:`px-5 pb-5 pt-4`,children:(0,K.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:Qs(t)})})]})})}function ec(e){return[`server-path-browse`,e.path?.trim()??``,e.basePath?.trim()??``,e.includeFiles??!1]}function tc(e){let{basePath:t,enabled:n,includeFiles:r,path:i}=e,a=i?.trim()??``,o=t?.trim()??``;return R({queryKey:ec({path:a,basePath:o,includeFiles:r}),queryFn:()=>Ke({path:a,basePath:o,includeFiles:r}),enabled:n??!0,staleTime:0})}function nc(){return He({mutationFn:jt})}var rc=`[mask-image:linear-gradient(to_bottom,black_calc(100%_-_28px),transparent)] [-webkit-mask-image:linear-gradient(to_bottom,black_calc(100%_-_28px),transparent)]`,ic=G.forwardRef(({className:e,children:t,...n},r)=>(0,K.jsx)(`div`,{ref:r,className:V(`overflow-auto`,e),...n,children:t}));ic.displayName=`ScrollArea`;function ac({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,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-background`,children:[(0,K.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,K.jsx)(`span`,{children:U(`pathPickerNameColumn`)}),(0,K.jsx)(`span`,{children:U(`pathPickerTypeColumn`)})]}),(0,K.jsx)(ic,{className:`min-h-0 flex-1`,children:e.length>0?(0,K.jsx)(`div`,{role:`listbox`,"aria-label":U(`pathPickerDirectoryList`),className:`p-1.5`,children:e.map(e=>{let t=a===e.path;return(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t,"data-server-path-row":!0,className:V(`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,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(ir,{className:`h-4 w-4 shrink-0 fill-amber-300 text-amber-500`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,K.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:U(`pathPickerDirectoryType`)})]},e.path)})}):(0,K.jsx)(`div`,{className:`grid h-full min-h-48 place-items-center px-6 text-center text-sm text-muted-foreground`,children:t})})]})}function oc({confirmLabel:e,disabled:t,hint:n,isSaving:r,onCancel:i,onSelectedPathChange:a,pathLabel:o,pathPlaceholder:s,selectedPath:c}){return(0,K.jsxs)(`div`,{className:`min-w-0 border-t border-border bg-muted/20 px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(Le,{htmlFor:`server-path-picker-selection`,className:`shrink-0 text-sm`,children:o}),(0,K.jsx)(F,{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,K.jsxs)(ii,{className:`shrink-0 flex-row gap-2`,children:[(0,K.jsx)(B,{type:`button`,variant:`outline`,onClick:i,disabled:r,children:U(`cancel`)}),(0,K.jsx)(B,{type:`submit`,disabled:t,children:r?U(`saving`):e})]})]}),n?(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-muted-foreground`,children:n}):null]})}var sc={applications:Ln,desktop:$o,documents:Jn,downloads:Nr,home:Po,"icloud-drive":go,workspace:mr,root:jo,volumes:jo},cc={applications:`pathPickerApplications`,desktop:`pathPickerDesktop`,documents:`pathPickerDocuments`,downloads:`pathPickerDownloads`,"icloud-drive":`pathPickerICloudDrive`,volumes:`pathPickerVolumes`};function lc({currentPath:e,defaultWorkspacePath:t,disabled:n,homePath:r,locations:i,rootPath:a,onNavigate:o}){let s=[],c=[],l=new Set,u=(e,t)=>{let n=t.path.trim();!n||l.has(n)||(l.add(n),e.push({...t,path:n}))};t&&u(s,{icon:`workspace`,label:U(`pathPickerDefaultWorkspace`),path:t}),r&&u(s,{icon:`home`,label:U(`homeDirectory`),path:r});for(let e of i)u(e.kind===`volumes`?c:s,{icon:e.kind,label:U(cc[e.kind]),path:e.path});a&&u(c,{icon:`root`,label:U(`pathPickerFileSystem`),path:a});let d=t=>t.map(t=>{let r=sc[t.icon],i=e===t.path;return(0,K.jsxs)(`button`,{type:`button`,className:V(`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-[var(--interaction-selection)] text-foreground`:`text-foreground hover:bg-[var(--interaction-hover)]`),"aria-current":i?`location`:void 0,onClick:()=>o(t.path),disabled:n,children:[(0,K.jsx)(r,{className:V(`h-4 w-4 shrink-0`,i?`text-primary`:`text-amber-500`)}),(0,K.jsx)(`span`,{className:`truncate`,children:t.label})]},t.path)});return(0,K.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,K.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:[(0,K.jsx)(kn,{className:`h-3.5 w-3.5`}),U(`pathPickerQuickAccess`)]}),(0,K.jsx)(`nav`,{"aria-label":U(`pathPickerQuickAccess`),className:`space-y-0.5`,children:d(s)}),c.length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mb-1 mt-3 px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:U(`pathPickerLocations`)}),(0,K.jsx)(`nav`,{"aria-label":U(`pathPickerLocations`),className:`space-y-0.5`,children:d(c)})]}):null]})}function uc({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,G.useState)(!1),[h,g]=(0,G.useState)(``),_=t.length>5?[t[0],...t.slice(-4)]:t,v=_.length<t.length,y=()=>{a||(g(e),m(!0))},b=()=>{g(``),m(!1)},x=()=>{let e=h.trim();e&&(m(!1),c(e))};return(0,K.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,K.jsx)(W,{icon:(0,K.jsx)(Or,{className:`h-4 w-4`}),label:U(`pathPickerBack`),size:`lg`,onClick:o,disabled:!n||a}),(0,K.jsx)(W,{icon:(0,K.jsx)(to,{className:`h-4 w-4`}),label:U(`pathPickerForward`),size:`lg`,onClick:s,disabled:!r||a}),(0,K.jsx)(W,{icon:(0,K.jsx)(To,{className:`h-4 w-4`}),label:U(`parentDirectory`),size:`lg`,onClick:d,disabled:!i||a}),(0,K.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,K.jsx)(F,{value:h,onChange:e=>g(e.target.value),onBlur:b,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x()),e.key===`Escape`&&(e.preventDefault(),b())},"aria-label":U(`pathPickerAddressLabel`),className:`h-full rounded-none border-0 bg-transparent px-3 shadow-none focus-visible:ring-0`,autoFocus:!0}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ir,{className:`ml-3 h-4 w-4 shrink-0 text-amber-500`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center overflow-hidden pl-2`,onDoubleClick:y,children:[_.length>0?_.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center`,children:[t>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(nr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),v&&t===1?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`rounded px-1.5 py-1 text-sm text-muted-foreground hover:bg-[var(--interaction-hover)]`,"aria-label":U(`pathPickerShowFullAddress`),onClick:y,children:`…`}),(0,K.jsx)(nr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):null]}):null,(0,K.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,K.jsx)(`span`,{className:`truncate text-sm text-foreground`,children:e}),(0,K.jsx)(`span`,{className:`h-full min-w-2 flex-1 cursor-text`,"aria-hidden":`true`}),(0,K.jsx)(W,{icon:(0,K.jsx)(Hn,{className:`h-3.5 w-3.5`}),label:U(`pathPickerEditAddress`),size:`md`,tooltipSide:`bottom`,onClick:y,disabled:a,className:`mr-1`})]})]})}),(0,K.jsx)(W,{icon:(0,K.jsx)(ys,{className:`h-4 w-4`}),label:U(`chatRefresh`),size:`lg`,onClick:l,disabled:a}),(0,K.jsxs)(`div`,{className:`relative hidden w-56 shrink-0 sm:block`,children:[(0,K.jsx)(kr,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,K.jsx)(F,{value:f,onChange:e=>u(e.target.value),placeholder:U(`pathPickerSearchPlaceholder`),disabled:a,className:`h-9 rounded-md bg-background pl-9`})]})]})}function dc({errorMessage:e,isCreating:t,name:n,onCancel:r,onCreate:i,onNameChange:a}){return(0,K.jsxs)(`div`,{className:`border-b border-gray-200 bg-white px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(F,{value:n,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i()),e.key===`Escape`&&r()},placeholder:U(`pathPickerNewFolderPlaceholder`),"aria-label":U(`pathPickerNewFolderName`),autoFocus:!0,disabled:t}),(0,K.jsx)(B,{type:`button`,onClick:i,disabled:!n.trim()||t,children:U(t?`saving`:`pathPickerCreateFolder`)}),(0,K.jsx)(B,{type:`button`,variant:`outline`,onClick:r,disabled:t,children:U(`cancel`)})]}),e?(0,K.jsxs)(`p`,{role:`alert`,className:`mt-2 text-sm text-destructive`,children:[U(`pathPickerCreateFolderFailed`),`: `,e]}):null]})}function fc({allowCreateDirectory:e,disabled:t,onNewFolder:n}){return(0,K.jsxs)(`div`,{className:`flex items-center border-b border-border bg-background px-3 py-1.5`,children:[e?(0,K.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,disabled:t,children:[(0,K.jsx)(wo,{className:`mr-1 h-4 w-4`}),U(`pathPickerNewFolder`)]}):null,(0,K.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:U(`pathPickerDoubleClickHint`)})]})}function pc(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 mc({open:e,allowCreateDirectory:t=!0,currentPath:n,defaultWorkspacePath:r,isSaving:i,onOpenChange:a,onCloseAutoFocus:o,onConfirm:s,title:c,description:l,pathLabel:u,pathPlaceholder:d,confirmLabel:f,hint:p}){let m=n?.trim()??``,h=r?.trim()??``,g=`${m}\u0000${h}`;return(0,K.jsx)(li,{open:e,onOpenChange:e=>{i||a(e)},children:(0,K.jsxs)(oi,{onCloseAutoFocus:o,className:`max-h-[92vh] overflow-hidden p-0 sm:h-[44rem] sm:max-w-5xl sm:grid-rows-[auto_minmax(0,1fr)]`,children:[(0,K.jsxs)(ei,{className:`border-b border-border px-5 py-4`,children:[(0,K.jsx)(si,{children:c}),(0,K.jsx)(ci,{className:l?void 0:`sr-only`,children:l??c})]}),e?(0,K.jsx)(hc,{allowCreateDirectory:t,currentPath:m,defaultWorkspacePath:h,isSaving:i,onCancel:()=>a(!1),onConfirm:s,pathLabel:u,pathPlaceholder:d,confirmLabel:f,hint:p},g):null]})})}function hc({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,G.useState)(u||null),[p,m]=(0,G.useState)(u||null),[h,g]=(0,G.useState)([]),[_,v]=(0,G.useState)([]),[y,b]=(0,G.useState)(``),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(``),T=tc({path:p,enabled:!0}),E=nc(),D=pc(p?.trim()??``,T.data?.homePath),O=d===null?T.data?.currentPath??``:d===p&&T.data?.currentPath===D?T.data.currentPath:d,k=O.trim(),A=k.length===0||r,j=D||T.data?.currentPath||``,M=!p||T.data?.currentPath===j?T.data?.breadcrumbs??[]:[],N=(0,G.useMemo)(()=>T.error?T.error instanceof Error?T.error.message:String(T.error):null,[T.error]),P=(0,G.useMemo)(()=>E.error?E.error instanceof Error?E.error.message:String(E.error):null,[E.error]),ee=C.trim().toLowerCase(),te=(0,G.useMemo)(()=>(T.data?.entries??[]).filter(e=>e.kind===`directory`),[T.data?.entries]),ne=(0,G.useMemo)(()=>ee.length===0?te:te.filter(e=>{let t=e.name.toLowerCase(),n=e.path.toLowerCase();return t.includes(ee)||n.includes(ee)}),[te,ee]),I=e=>{m(e),f(e),w(``),S(!1),b(``),E.reset()},re=e=>{let t=e.trim();if(!t)return;let n=j;n&&n!==t&&g(e=>[...e,n].slice(-50)),v([]),I(t)},ie=()=>{let e=h.at(-1);if(!e)return;let t=j;g(e=>e.slice(0,-1)),t&&v(e=>[t,...e].slice(0,50)),I(e)},ae=()=>{let e=_[0];if(!e)return;let t=j;v(e=>e.slice(1)),t&&g(e=>[...e,t].slice(-50)),I(e)},oe=async()=>{let t=T.data?.currentPath,n=y.trim();if(!(!e||!t||!n||E.isPending))try{let e=await E.mutateAsync({parentPath:t,name:n});await T.refetch(),f(e.path),b(``),S(!1)}catch{}},se=T.isLoading?U(`loading`):N?`${U(`pathBrowseFailed`)}: ${N}`:te.length>0?U(`pathPickerSearchEmpty`):U(`emptyDirectory`),ce=r||T.isLoading;return(0,K.jsxs)(`form`,{className:`flex min-h-0 min-w-0 flex-col overflow-hidden`,onSubmit:e=>{e.preventDefault(),!A&&a(k)},children:[(0,K.jsx)(uc,{addressPath:j,breadcrumbs:M,canGoBack:h.length>0,canGoForward:_.length>0,canGoUp:!!T.data?.parentPath,disabled:ce,onBack:ie,onForward:ae,onNavigate:re,onRefresh:()=>void T.refetch(),onSearchChange:w,onUp:()=>{let e=T.data?.parentPath;e&&re(e)},searchText:C}),(0,K.jsx)(fc,{allowCreateDirectory:e,disabled:ce||!T.data?.currentPath,onNewFolder:()=>{S(!0),b(``),E.reset()}}),(0,K.jsxs)(`div`,{className:`relative border-b border-border p-2 sm:hidden`,children:[(0,K.jsx)(kr,{className:`pointer-events-none absolute left-5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,K.jsx)(F,{value:C,onChange:e=>w(e.target.value),placeholder:U(`pathPickerSearchPlaceholder`),disabled:ce,className:`h-9 pl-9`})]}),e&&x?(0,K.jsx)(dc,{errorMessage:P,isCreating:E.isPending,name:y,onCancel:()=>S(!1),onCreate:()=>void oe(),onNameChange:e=>{b(e),E.reset()}}):null,(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 overflow-hidden`,children:[(0,K.jsx)(lc,{currentPath:j,defaultWorkspacePath:pc(n,T.data?.homePath)||null,disabled:ce,homePath:T.data?.homePath,locations:T.data?.locations??[],rootPath:T.data?.breadcrumbs[0]?.path,onNavigate:re}),(0,K.jsx)(ac,{entries:ne,emptyMessage:se,disabled:r,onOpen:re,onSelect:f,selectedPath:k})]}),(0,K.jsx)(oc,{confirmLabel:c,disabled:A,hint:l,isSaving:r,onCancel:i,onSelectedPathChange:f,pathLabel:o,pathPlaceholder:s,selectedPath:O})]})}function gc({open:e,currentProjectRoot:t,defaultWorkspacePath:n,isSaving:r,onOpenChange:i,onSave:a}){return(0,K.jsx)(mc,{open:e,currentPath:t,defaultWorkspacePath:n,isSaving:r,onOpenChange:i,onConfirm:a,title:U(`chatSessionProjectDialogTitle`),description:U(`chatSessionProjectDialogDescription`),pathLabel:U(`chatSessionProjectPathLabel`),pathPlaceholder:U(`chatSessionProjectPathPlaceholder`),confirmLabel:U(`chatSessionSetProject`),hint:U(`chatSessionProjectUpdateHint`)})}function _c({sessionKey:e,sessionTitle:t,canDeleteSession:n,isDeletePending:r,currentPath:i,defaultWorkspacePath:a,metadata:o,isWorkspaceOpen:s,onToggleWorkspace:c,onDeleteSession:l}){let u=Js(),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),_=r||h,v=async t=>{if(!e)return;let r=n;g(!0);try{await u({sessionKey:e,projectRoot:t,persistToServer:r}),f(!1)}finally{g(!1)}};return(0,K.jsxs)(ti,{children:[(0,K.jsx)(W,{icon:s?(0,K.jsx)(ls,{className:`h-4 w-4`}):(0,K.jsx)(us,{className:`h-4 w-4`}),label:U(s?`chatSessionCloseWorkspace`:`chatSessionOpenWorkspace`),"aria-pressed":s,onClick:c,disabled:_}),e?(0,K.jsxs)(Zs,{sessionKey:e,sessionTitle:t,disabled:_,children:[(0,K.jsx)(Ys,{icon:Co,label:U(`chatSessionSetProject`),onClick:()=>f(!0),disabled:_}),(0,K.jsx)(Ys,{icon:ro,label:U(`chatSessionViewMetadata`),onClick:()=>m(!0),disabled:_}),(0,K.jsx)(Ys,{icon:Jr,label:U(`chatDeleteSession`),onClick:l,disabled:!n||_,destructive:!0})]}):null,e?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gc,{open:d,currentProjectRoot:i,defaultWorkspacePath:a,isSaving:h,onOpenChange:f,onSave:v}),(0,K.jsx)($s,{open:p,metadata:o,onOpenChange:m})]}):null]})}var vc={maxHeight:di(`18rem`)};function yc({sessionKey:e,projectName:t,projectRoot:n,defaultWorkspacePath:r,persistToServer:i}){let a=Js(),[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.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,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(_i,{open:o,onOpenChange:s,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,title:n?`${t}\n${n}`:t,className:`min-w-0 max-w-[40%] shrink-0 rounded-full border border-border bg-muted px-2 py-0.5 text-[11px] 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 disabled:cursor-not-allowed disabled:opacity-60`,"aria-label":U(`chatSessionSetProject`),disabled:u,children:(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(Co,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:t}),(0,K.jsx)(Mr,{className:`h-3 w-3 shrink-0 opacity-70`})]})})}),(0,K.jsxs)(hi,{align:`start`,className:`w-72 p-2`,style:vc,children:[(0,K.jsxs)(`div`,{className:`px-3 pb-2 pt-1`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground`,children:t}),n?(0,K.jsx)(`div`,{className:`mt-1 break-all text-xs text-muted-foreground`,children:n}):null]}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(Ys,{icon:Hn,label:U(`chatSessionSetProject`),onClick:()=>{s(!1),l(!0)},disabled:u}),(0,K.jsx)(Ys,{icon:Eo,label:U(`chatSessionClearProject`),onClick:()=>{f(null)},disabled:u})]})]})]}),(0,K.jsx)(gc,{open:c,currentProjectRoot:n,defaultWorkspacePath:r,isSaving:u,onOpenChange:l,onSave:f})]})}var bc=(0,G.createContext)(null);function xc({presenter:e,children:t}){return(0,K.jsx)(bc.Provider,{value:e,children:t})}function q(){let e=(0,G.useContext)(bc);if(!e)throw Error(`usePresenter must be used inside ChatPresenterProvider`);return e}var Sc=[[`Thinking`,`thinking`],[`Calling tool`,`tool-running`],[`Tool call completed`,`tool-completed`],[`Run failed`,`run-failed`],[`Run interrupted`,`run-interrupted`]];function Cc(e){let t=e.label?.trim();if(t)return t;let n=e.key.split(`:`);return n[n.length-1]||e.key}function wc(e,t){let n=e.statusText?.trim(),r=e.statusKind||!n?void 0:Sc.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 U(`chatTyping`,t);case`tool-running`:return[U(`chatToolCall`,t),U(`chatToolStatusRunning`,t),a].filter(Boolean).join(` · `);case`tool-completed`:return[U(`chatToolCall`,t),U(`chatToolStatusCompleted`,t),a].filter(Boolean).join(` · `);case`run-failed`:return[U(`chatToolStatusFailed`,t),a].filter(Boolean).join(` · `);case`run-interrupted`:return U(`chatSessionActivityInterrupted`,t);default:return a??null}}function Tc(e,t=Xr()){let n=e.activityPreview;return!n||n.state===`cancelled`?null:n.state===`completed`&&n.replyText?n.replyText:wc(n,t)??n.replyText??null}function Ec(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function Dc(e,t){return e.getFullYear()===t.getFullYear()}function Oc(e,t){let n=`${e.getMonth()+1}月${e.getDate()}日`;return Dc(e,t)?n:`${e.getFullYear()}年${n}`}function kc(e,t=Xr(),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=$r(t),a=Ec(r),o=Ec(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 U(`chatSidebarYesterday`,t);if(s>1&&s<7)return new Intl.DateTimeFormat(i,{weekday:`long`}).format(r);if(t===`zh`)return Oc(r,n);let c=Dc(r,n)?{month:`numeric`,day:`numeric`}:{year:`numeric`,month:`numeric`,day:`numeric`};return new Intl.DateTimeFormat(i,c).format(r)}function Ac(e){return e.trim().toLowerCase()}function jc(e,t){let n=Ac(t);return n?[e.key,Cc(e),e.projectRoot??``,e.projectName??``].map(Ac).some(e=>e.includes(n)):!0}var Mc=function(e){return e.CALL=`call`,e.RESULT=`result`,e.PARTIAL_CALL=`partial-call`,e.ERROR=`error`,e.CANCELLED=`cancelled`,e}({});function Nc(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Pc(e){return Nc(e)}function Fc(e){let t=Nc(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 Ic(e){return/^[A-Za-z]:[\\/]?$/.test(e)||e===`/`?e:e.replace(/[\\/]+$/,``)}function Lc(e){let t=Ic(e.trim().replace(/\\/g,`/`));return/^[A-Za-z]:/.test(t)?`${t.slice(0,1).toLowerCase()}${t.slice(1)}`:t}function Rc(e,t){if(!e)return t.join(`/`);let n=Ic(e.trim().replace(/\\/g,`/`));return t.length===0?n:n===`/`?`/${t.join(`/`)}`:`${n}/${t.join(`/`)}`}function zc(e){let t=Ic(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 Bc(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 Vc(e){let t=Lc(e.path),n=Lc(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 Hc(e){let t=e.sessionProjectRoot?.trim();if(!t)return null;let n=Vc({path:e.path,sessionProjectRoot:t});return!n?.length||n.some(e=>e===`.`||e===`..`)?null:n.join(`/`)}function Uc(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=Rc(t,r.slice(0,i+1));return{key:`${i}:${e}`,label:e,kind:a,path:o,browsePath:a===`file`?zc(o):o,isCurrent:i===r.length-1}});return i?[i,...a]:a}function Wc(e){let{kind:t=`file`,path:n,sessionProjectRoot:r,truncated:i}=e,a=n.trim(),o=r?.trim()&&a?Vc({path:a,sessionProjectRoot:r}):null,s;if(r?.trim()&&o){let e=r.trim(),n=Fc(e)??e;s=Uc({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}=Bc(a),r=e===`/`?`/`:e?`${e}/`:null;s=Uc({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:zc(a),isCurrent:!0}]),{fullPath:a,truncated:i,segments:s}}var Gc=new Set([`off`,`minimal`,`low`,`medium`,`high`,`adaptive`,`xhigh`]),Kc=new Set([`running`,`completed`,`failed`,`cancelled`,`idle`]),qc=new Set([`thinking`,`tool-running`,`tool-completed`,`run-failed`,`run-interrupted`]);function Jc(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Yc(e){let{metadata:t}=e;return!t||typeof t!=`object`||Array.isArray(t)?null:t}function Xc(e){let t=Yc(e)?.last_activity_preview;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,{state:r}=n,i=Jc(n.timestamp);if(!Kc.has(r)||!i)return null;let a=Jc(n.statusKind);return{state:r,timestamp:i,statusKind:qc.has(a)?a:void 0,statusText:Jc(n.statusText)??void 0,replyText:Jc(n.replyText)??void 0}}function Zc(e){let t=Yc(e);return t?Jc(t.preferred_model)??Jc(t.preferredModel)??Jc(t.model):null}function Qc(e){let t=Yc(e);if(!t)return null;let n=Jc(t.preferred_thinking)??Jc(t.thinking)??Jc(t.thinking_level)??Jc(t.thinkingLevel);if(!n)return null;let r=n.toLowerCase();return Gc.has(r)?r:null}function $c(e){let t=Yc(e);return t?Jc(t.label):null}function el(e){let t=Yc(e);return t?Pc(t.project_root??t.projectRoot):null}function tl(e){return Jc(e.workingDir)}function nl(e){let t=Yc(e);return t?Jc(t.ui_last_read_at):null}function rl(e){let t=Yc(e);return t?Jc(t.runtime)??Jc(t.session_type)??Jc(t.sessionType)??`native`:`native`}function il(e){let t=Yc(e);return t?Jc(t.parent_session_id)??Jc(t.parentSessionId):null}function al(e){let t=Yc(e);return t?Jc(t.spawned_by_request_id)??Jc(t.spawnedByRequestId):null}function ol(e){let t=Yc(e);return t?t.child_session_promoted===!0:!1}function sl(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 cl(e){return e.state===`cancelled`?Mc.CANCELLED:e.state===`result`?Mc.RESULT:e.state===`partial-call`?Mc.PARTIAL_CALL:Mc.CALL}function ll(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:Ne(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:cl(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 ul(e){return e.flatMap(e=>e.type===`extension`?[e]:ll([e]))}function dl(e){return e===`service`?`system`:e===`tool`?`assistant`:e}function fl(e){return{id:e.id,role:dl(e.role),parts:ll(e.parts),meta:{source:`stream`,status:e.status,sessionKey:e.sessionId,timestamp:e.timestamp}}}function pl(e){let t=Yc(e),n=$c(e),r=Zc(e),i=Qc(e),a=el(e),o=tl(e)??a,s=nl(e),c=Jc(e.lastMessageAt),l=Fc(a),u=sl(e.sessionId),d=il(e),f=al(e),p=ol(e),m=Xc(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:rl(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 ml(e){return e.map(pl)}function hl(){return`ncp-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}var gl=`nextclaw.chat.session-list.mode`,_l=`time-first`;function vl(e){return e===`time-first`||e===`project-first`}function yl(e){return Array.isArray(e)?[...new Set(e.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean))]:[]}function bl(e){if(!e||typeof e!=`object`)return null;let{snapshot:t}=e;return!t||typeof t!=`object`?null:vl(t.listMode)?t.listMode:null}function xl(e,t){let n=e?.trim();if(!n)return!1;let r=t?.trim();return r?n.localeCompare(r)>0:!1}function Sl(e){let{active:t,readAt:n,runStatus:r,lastMessageAt:i}=e;return t||r===`running`?!1:xl(i,n)}var Cl={selectedSessionKey:null,selectedAgentId:`main`,query:``,listMode:_l,pinnedSessionKeys:[],pinnedProjectRoots:[],collapsedProjectRoots:[]};function wl(e){return t=>e(e=>({snapshot:{...e.snapshot,...t}}))}function Tl(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}}})}function El(e){return(t,n)=>e(e=>{let r=t.trim();if(!r)return e;let i=e.runningSessionKeys.includes(r);return n===`running`===i?e:{...e,runningSessionKeys:n===`running`?[...e.runningSessionKeys,r]:e.runningSessionKeys.filter(e=>e!==r)}})}var J=ct()(xi(e=>({snapshot:Cl,optimisticReadAtBySessionKey:{},runningSessionKeys:[],setSnapshot:wl(e),markSessionRead:Tl(e),setSessionRunStatus:El(e),clearSessionRunStatuses:()=>e({runningSessionKeys:[]})}),{name:gl,storage:Si(()=>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=bl(e);return{...t,snapshot:{...t.snapshot,...r?{listMode:r}:{},pinnedSessionKeys:yl(n?.pinnedSessionKeys),pinnedProjectRoots:yl(n?.pinnedProjectRoots),collapsedProjectRoots:yl(n?.collapsedProjectRoots)}}}})),Dl={staleTime:5e3,retry:!1};function Ol(e){return R({queryKey:[`ncp-sessions`,e?.limit??null,e?.peerId?.trim()||null],queryFn:()=>we(e),...Dl})}function kl(e){return Da({queryKey:[`ncp-session-pages`,e.pageSize,e.query?.trim()||null],initialPageParam:1,queryFn:({pageParam:t})=>we({page:t,pageSize:e.pageSize,...e.query?.trim()?{query:e.query.trim()}:{}}),getNextPageParam:e=>e.hasMore?(e.page??1)+1:void 0,...Dl})}function Al(e){return R({queryKey:[`ncp-session-skills`,e.sessionId,e.projectRoot??null],queryFn:()=>re(e.sessionId,{...Object.prototype.hasOwnProperty.call(e,`projectRoot`)?{projectRoot:e.projectRoot??null}:{}}),enabled:!!e.sessionId,...Dl})}function jl(e){return R({queryKey:[`ncp-session-token-usage`,e],queryFn:()=>de(e),enabled:!!e,...Dl})}var Ml=e=>[`ncp-session-observations`,e];function Nl(e){return R({queryKey:Ml(e),queryFn:()=>M(e),enabled:!!e,...Dl})}function Pl(e){let t=Dt();return He({mutationFn:t=>w(e,t),onSuccess:()=>{t.invalidateQueries({queryKey:Ml(e)})}})}function Fl(e,t){return e.filter(e=>jc(e,t))}function Il(e){return e.isChildSession?e.isPromotedChildSession===!0:!0}function Ll(e={}){let t=J(e=>e.snapshot.query),n=J(e=>e.runningSessionKeys),r=e.query??t,i=(0,G.useDeferredValue)(r),a=kl({pageSize:e.limit??100,query:i}),o=(0,G.useMemo)(()=>{let e=a.data?.pages.flatMap(e=>e.sessions)??[],t=new Set(n);return ml(e).map(e=>({session:e,runStatus:t.has(e.key)||e.status===`running`?`running`:void 0}))},[n,a.data?.pages]),s=(0,G.useMemo)(()=>{let e=o.filter(({session:e})=>Il(e)),t=new Set(Fl(e.map(({session:e})=>e),r).map(e=>e.key));return e.filter(({session:e})=>t.has(e.key))},[o,r]);return{allItems:o,isLoading:a.isLoading,items:s,hasMore:a.hasNextPage,isLoadingMore:a.isFetchingNextPage,loadMore:a.fetchNextPage}}function Rl(e){return new Date(e.session.lastMessageAt??e.session.createdAt).getTime()}function zl(e){return[...e].sort((e,t)=>Rl(t)-Rl(e))}function Bl(e,t){return[...e].sort((e,n)=>Number(t.has(n.session.key))-Number(t.has(e.session.key))||Rl(n)-Rl(e))}function Vl(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=Bl(e.filter(e=>t.has(e.session.key)),t);for(let e of u){let t=Rl(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:U(`chatSidebarPinned`),items:d}),o.length>0&&f.push({label:U(`chatSidebarToday`),items:o}),s.length>0&&f.push({label:U(`chatSidebarYesterday`),items:s}),c.length>0&&f.push({label:U(`chatSidebarPrevious7Days`),items:c}),l.length>0&&f.push({label:U(`chatSidebarOlder`),items:l}),f}function Hl(e,t=new Set,n=new Set,r=[]){let i=new Map;for(let e of r)i.set(e.rootPath,{projectId:e.id,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 n=i.get(e),r=Rl(t);if(n){n.items.push(t),n.latestUpdatedAt=Math.max(n.latestUpdatedAt,r);continue}}return[...i.values()].map(e=>({...e,items:Bl(e.items,t)})).sort((e,t)=>Number(t.isPinned)-Number(e.isPinned)||t.latestUpdatedAt-e.latestUpdatedAt)}function Ul(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)=>Rl(t)-Rl(e));return t}function Wl(e){if(e.label&&e.label.trim())return e.label.trim();let t=e.key.split(`:`);return t[t.length-1]||e.key}function Gl({isProjectFirstView:e,onSelectMode:t}){return(0,K.jsxs)(`div`,{role:`group`,"aria-label":U(`chatSidebarViewMode`),className:`relative grid h-7 grid-cols-2 rounded-full bg-foreground/[0.04] p-0.5 text-[11px]`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:V(`pointer-events-none absolute bottom-0.5 left-0.5 top-0.5 w-[calc(50%-2px)] rounded-full bg-[var(--sidebar-segment-selection)] transition-transform duration-200 ease-out motion-reduce:transition-none`,e&&`translate-x-full`)}),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":!e,onClick:()=>t(`time-first`),className:V(`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,K.jsx)(mo,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),U(`chatSidebarViewTime`)]}),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:()=>t(`project-first`),className:V(`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,K.jsx)(ir,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),U(`chatSidebarViewProject`)]})]})}var Kl=`native`;function ql(e){return typeof e==`string`?e.trim().toLowerCase()||`native`:Kl}function Jl(e,t=Kl){return ql(e?.runtime?.trim()||e?.engine?.trim()||t)}function Yl(e,t){return e===`native`?U(`chatSessionTypeNative`):t?.trim()||e.trim().split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||e}function Xl(e){let t=new Map;for(let n of e){let e=ql(n.value);t.set(e,{value:e,label:n.label?.trim()||Yl(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(Kl,{value:Kl,label:Yl(Kl),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 Zl={wx:`weixin`,lark:`feishu`},Ql={cron:{icon:`cron`}},$l={codex:`chatSessionTypeCodex`,claude:`chatSessionTypeClaude`};function eu(e){return e?.trim().toLowerCase()??``}function tu(e){return e.split(/[-_]+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function nu(e,t){let n=eu(e);if(!n||n===`native`)return null;let r=t.find(e=>eu(e.value)===n);return r?.label.trim()?r.label.trim():tu(n)}function ru(e,t){let n=eu(e);return!n||n===`native`?null:t.find(e=>eu(e.value)===n)??null}function iu(e){let t=eu(e);if(!t)return null;let n=Zl[t]??t;return Ei(n)?n:null}function au(e,t){let n=iu(e.channel??``);if(n)return{icon:{kind:`channel-logo`,channel:n},label:null};let r=Ql[eu(e.type)];if(r)return{icon:{kind:`symbol`,icon:r.icon},label:null};let i=eu(e.sessionType),a=ru(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=$l[i];return o?{icon:null,label:U(o)}:{icon:null,label:a?.label?.trim()||nu(e.sessionType,t)}}var ou=`app://`;function su(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 cu(e){let t=e.trim();if(!t)return null;if(!t.startsWith(ou))return t;let n=su(t.slice(6));return n?`/${n}`:null}function lu({icon:e,className:t}){if(e.kind===`channel-logo`)return(0,K.jsx)(uu,{channel:e.channel,className:t});if(e.kind===`runtime-image`){let n=cu(e.src);return(0,K.jsx)(ki,{name:e.name?.trim()||e.alt?.trim()||`runtime`,src:n??void 0,className:V(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,K.jsx)(Dr,{className:V(`h-3 w-3 text-current`,t),strokeWidth:2.4})})}return(0,K.jsx)(Qa,{className:V(`h-3.5 w-3.5`,t)})}function uu({channel:e,className:t}){return(0,K.jsx)(ki,{name:e,src:Ei(e),className:V(`h-[1.125rem] w-[1.125rem]`,t),imgClassName:`h-full w-full object-contain`,fallback:(0,K.jsx)(Dr,{className:`h-3 w-3 text-muted-foreground`})})}function du({status:e,className:t}){let n=U(e===`running`?`sessionsRunStatusRunning`:`sessionsRunStatusQueued`);return(0,K.jsxs)(`span`,{className:V(`inline-flex h-3.5 w-3.5 items-center justify-center text-muted-foreground/70`,t),title:n,"aria-label":n,children:[(0,K.jsx)(Rr,{className:`h-3 w-3 animate-spin`}),(0,K.jsx)(`span`,{className:`sr-only`,children:n})]})}function fu({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,u=Sl({active:s,lastMessageAt:a.lastMessageAt,readAt:l,runStatus:o}),d=Tc(a)??a.projectName??a.projectRoot??`${a.messageCount}`,f=kc(a.lastMessageAt??a.createdAt),p=au(a,r);return(0,K.jsxs)(`button`,{type:`button`,"aria-current":s?`page`:void 0,className:V(`flex w-full min-w-0 items-start gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,s?`bg-accent/60 text-accent-foreground`:`text-foreground hover:bg-[var(--interaction-hover)] hover:text-accent-foreground`),onClick:()=>i(a.key),children:[(0,K.jsx)(`span`,{className:`relative mt-1 flex h-2.5 w-2.5 shrink-0 items-center justify-center`,children:u?(0,K.jsx)(`span`,{"aria-label":U(`chatSidebarUnread`),className:`h-1.5 w-1.5 rounded-full bg-primary`}):s?(0,K.jsx)(jr,{className:`h-3 w-3 text-primary`}):(0,K.jsx)(`span`,{className:`h-1 w-1 rounded-full bg-muted-foreground/45`})}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:Cc(a)}),p.label?(0,K.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:p.label}):null,p.icon?(0,K.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] shrink-0 items-center justify-center text-muted-foreground`,children:(0,K.jsx)(lu,{icon:p.icon})}):null]}),(0,K.jsxs)(`span`,{className:`mt-0.5 flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground/75`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:d}),(0,K.jsx)(`span`,{className:`shrink-0`,children:f})]})]}),o?(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,K.jsx)(du,{status:o})}):null]})}function pu({items:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i,className:a}){return(0,K.jsx)(`div`,{className:V(`space-y-1`,a),children:e.map(e=>(0,K.jsx)(fu,{item:e,selectedSessionKey:t,optimisticReadAtBySessionKey:n,sessionTypeOptions:r,onSelect:i},e.session.key))})}function mu({group:e,...t}){return(0,K.jsxs)(`section`,{"aria-label":e.label,children:[(0,K.jsx)(`div`,{className:`px-2 py-1 text-[11px] font-medium uppercase tracking-wider text-muted-foreground/70`,children:e.label}),(0,K.jsx)(pu,{items:e.items,...t})]})}function hu({group:e,isCollapsed:t,onToggleCollapsed:n,...r}){let i=(0,G.useId)(),a=`${U(t?`chatSidebarExpandProject`:`chatSidebarCollapseProject`)} · ${e.projectName}`;return(0,K.jsxs)(`section`,{"aria-label":e.projectName,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-controls":i,"aria-expanded":!t,"aria-label":a,className:`group flex h-8 w-full min-w-0 items-center gap-1.5 rounded-lg px-2 text-left 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`,onClick:()=>n(e.projectRoot),children:[(0,K.jsx)(ir,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,title:e.projectRoot,children:e.projectName}),(0,K.jsx)(`span`,{className:`shrink-0 text-[10px] text-muted-foreground/70`,children:e.items.length}),t?(0,K.jsx)(nr,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):(0,K.jsx)(Mr,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`})]}),t?null:(0,K.jsx)(pu,{items:e.items,className:`mt-0.5`,...r})]})}function gu({collapsedProjectRoots:e,dateGroups:t,isProjectFirstView:n,onToggleProjectCollapsed:r,projectGroups:i,...a}){return(0,K.jsx)(`div`,{className:`space-y-0.5`,children:n?i.map(t=>(0,K.jsx)(hu,{group:t,isCollapsed:e.includes(t.projectRoot),onToggleCollapsed:r,...a},t.projectRoot)):t.map(e=>(0,K.jsx)(mu,{group:e,...a},e.label))})}var _u=ct(e=>({snapshot:{},setSnapshot:t=>e(({snapshot:e})=>({snapshot:{...e,...t}}))})),vu=[`projects`];function yu(e={}){return R({queryKey:vu,queryFn:Ct,enabled:e.enabled??!0,staleTime:3e4})}function bu(){let e=Dt();return He({mutationFn:_e,onSuccess:async()=>{await e.invalidateQueries({queryKey:vu}),z.success(U(`chatProjectCreated`))},onError:e=>{z.error(`${U(`chatProjectCreateFailed`)}: ${e.message}`)}})}function xu(){let e=Dt();return He({mutationFn:O,onSuccess:async()=>{await e.invalidateQueries({queryKey:vu}),z.success(U(`chatProjectExistingAdded`))},onError:e=>{z.error(`${U(`chatProjectExistingFailed`)}: ${e.message}`)}})}function Su(){let e=Dt();return He({mutationFn:S,onSuccess:async()=>{await e.invalidateQueries({queryKey:vu}),z.success(U(`projectsRemoveSuccess`))},onError:e=>{z.error(`${U(`projectsRemoveFailed`)}: ${e.message}`)}})}var Cu=`group inline-flex min-w-0 max-w-full items-center gap-1.5 max-md:gap-1 rounded-md px-2 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 wu({title:e}){return(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground truncate`,children:e})}function Tu({label:e}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-xs text-muted-foreground`,children:[(0,K.jsx)(Jo,{className:`h-4 w-4 shrink-0 text-muted-foreground/55`}),(0,K.jsx)(`span`,{children:e})]})}function Eu(){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-4 text-xs text-muted-foreground`,children:[(0,K.jsx)(Rr,{className:`h-4 w-4 shrink-0 animate-spin`}),(0,K.jsx)(`span`,{children:U(`sessionsLoading`)})]})}function Du({selectedSessionKey:e,title:t}){let n=q(),[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(``),s=J(e=>e.optimisticReadAtBySessionKey),c=J(e=>e.snapshot.pinnedSessionKeys),l=J(e=>e.snapshot.pinnedProjectRoots),u=J(e=>e.snapshot.collapsedProjectRoots),d=J(e=>e.snapshot.listMode),f=_u(e=>e.snapshot.sessionTypesQuery?.data??null),{isLoading:p,items:m}=Ll({query:a}),h=yu(),g=(0,G.useMemo)(()=>{let e=a.trim().toLowerCase(),t=h.data?.projects??[];return e?t.filter(t=>t.name.toLowerCase().includes(e)||t.rootPath.toLowerCase().includes(e)):t},[h.data?.projects,a]),_=(0,G.useMemo)(()=>zl(m),[m]),v=(0,G.useMemo)(()=>Vl(_,new Set(c)),[c,_]),y=(0,G.useMemo)(()=>Hl(_,new Set(c),new Set(l),g),[l,c,_,g]),b=(0,G.useMemo)(()=>Xl(f?.options??[]),[f?.options]),x=t=>{i(!1),o(``),t!==e&&n.chatSessionListManager.selectSession(t)},S=e=>{i(e),e||o(``)},C={selectedSessionKey:e,optimisticReadAtBySessionKey:s,sessionTypeOptions:b,onSelect:x},w=d===`project-first`,T=w?y.length>0:v.length>0;return(0,K.jsxs)(_i,{open:r,onOpenChange:S,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":`${U(`chatSessionSwitch`)}: ${t}`,"aria-expanded":r,className:Cu,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,K.jsx)(Mr,{className:V(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform group-hover:text-accent-foreground`,r?`rotate-180`:null)})]})}),(0,K.jsxs)(hi,{align:`start`,className:`flex w-[22rem] max-w-[calc(100vw-2rem)] flex-col overflow-hidden p-0`,children:[(0,K.jsxs)(`div`,{className:`shrink-0 space-y-2 border-b border-border/40 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-muted-foreground/75`,children:U(`chatSessionSwitcherTitle`)}),(0,K.jsx)(Gl,{isProjectFirstView:w,onSelectMode:n.chatSessionListManager.setListMode})]}),(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(kr,{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,K.jsx)(F,{density:`compact`,value:a,onChange:e=>o(e.target.value),placeholder:U(`chatSearchSessionPlaceholder`),"aria-label":U(`chatSearchSessionPlaceholder`),className:`h-8 rounded-lg border-0 bg-muted/50 pl-8 pr-2`,autoFocus:!0})]})]}),(0,K.jsx)(`div`,{className:`min-h-0 max-h-80 overflow-y-auto overscroll-contain p-1.5`,children:p?(0,K.jsx)(Eu,{}):T?(0,K.jsx)(gu,{collapsedProjectRoots:u,dateGroups:v,isProjectFirstView:w,onToggleProjectCollapsed:n.chatSessionListManager.toggleProjectCollapsed,projectGroups:y,...C}):(0,K.jsx)(Tu,{label:a.trim()?U(`chatSessionSwitcherNoResults`):U(w?`chatSidebarProjectViewEmpty`:`sessionsEmpty`)})})]})]})}function Ou({layoutMode:e,selectedSessionKey:t,title:n}){let r=Wr(e=>e.isSidebarCollapsed);return e===`desktop`&&!r?(0,K.jsx)(wu,{title:n}):(0,K.jsx)(Du,{selectedSessionKey:t,title:n})}var ku=en.chat.newSessionType,Au=[`preference`,ku];function ju(e,t){let n=ql(e);return t.find(e=>e.value===n&&e.ready!==!1)??null}function Mu(e){let{defaultSessionType:t,preferredSessionType:n,sessionTypeOptions:r}=e,i=n?ju(n,r):null,a=ju(t,r);return i??a??r.find(e=>e.ready!==!1)??r[0]??{value:ql(t),label:ql(t),icon:null,ready:!0,reason:null,reasonMessage:null,supportedModels:void 0,recommendedModel:null,modelSelectionMode:`nextclaw`,runtimeDefaultThinking:null,cta:null}}function Nu(e){return typeof e?.value==`string`?ql(e.value):null}function Pu({defaultSessionType:e,sessionTypeOptions:t}){let n=Dt(),r=R({queryKey:Au,queryFn:()=>Oe(ku),staleTime:3e4,retry:!1}),i=(0,G.useMemo)(()=>Nu(r.data),[r.data]),a=(0,G.useMemo)(()=>Mu({preferredSessionType:i,defaultSessionType:e,sessionTypeOptions:t}),[e,i,t]),o=He({mutationFn:async e=>await A(ku,ql(e)),onMutate:async e=>{let t=ql(e);await n.cancelQueries({queryKey:Au});let r=n.getQueryData(Au);return n.setQueryData(Au,{key:ku,value:t,updatedAt:new Date().toISOString()}),{previous:r}},onError:(e,t,r)=>{r?.previous&&n.setQueryData(Au,r.previous)},onSuccess:e=>{n.setQueryData(Au,e)}}),s=(0,G.useCallback)(e=>{let n=ju(e,t);n&&o.mutate(n.value)},[t,o]);return{selectedSessionType:a.value,selectedSessionTypeOption:a,isLoading:r.isLoading,setSelectedSessionType:s}}var Fu=[];function Iu(){let e=_u(e=>!!(e.snapshot.configQuery?.isFetched||e.snapshot.configQuery?.isSuccess)),t=_u(e=>!!(e.snapshot.providersQuery?.isFetched||e.snapshot.providersQuery?.isSuccess)),n=_u(e=>!!(e.snapshot.providerTemplatesQuery?.isFetched||e.snapshot.providerTemplatesQuery?.isSuccess));return e&&t&&n}function Lu(e){let t=_u(e=>e.snapshot.sessionsQuery?.data?.sessions??Fu),n=(0,G.useMemo)(()=>ml(t),[t]);return(0,G.useMemo)(()=>n.find(t=>t.key===e)??null,[n,e])}function Ru(e){return!!e&&typeof e==`object`}function zu(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function Bu(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function Vu(e){return typeof e==`string`?e:null}function Hu(e){return e===`auto`||e===`source`||e===`rendered`?e:null}function Uu(e){try{return N(e)??null}catch{return null}}function Wu(e){if(!Ru(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:zu(e.parentSessionKey),path:n,label:zu(e.label),viewMode:e.viewMode,previewViewer:Hu(e.previewViewer),line:Bu(e.line),column:Bu(e.column),params:Uu(e.params),rawText:Vu(e.rawText),contentUrl:zu(e.contentUrl),mimeType:zu(e.mimeType),beforeText:Vu(e.beforeText),afterText:Vu(e.afterText),patchText:Vu(e.patchText),oldStartLine:Bu(e.oldStartLine),newStartLine:Bu(e.newStartLine),fullLines:Array.isArray(e.fullLines)?e.fullLines.filter(e=>e&&[`context`,`add`,`remove`].includes(e.kind)&&typeof e.text==`string`&&(e.oldLineNumber===void 0||Number.isFinite(e.oldLineNumber))&&(e.newLineNumber===void 0||Number.isFinite(e.newLineNumber))):void 0}}function Gu(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,fullLines:e.fullLines}}function Ku(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 qu(e){return typeof e!=`number`||!Number.isFinite(e)?480:Math.max(360,Math.min(860,e))}function Ju(e){return typeof e!=`number`||!Number.isFinite(e)?224:Math.max(192,Math.min(400,e))}function Yu(e){return/\.html?$/i.test(e)?`html`:/\.mdx?$/i.test(e)?`markdown`:null}function Xu(e,t){let n=Yu(e);return n===`html`?t===`rendered`?`rendered`:`source`:n===`markdown`?t===`source`?`source`:`rendered`:t===`source`||t===`rendered`?t:null}function Zu(e,t){return Xu(e,t)??t??null}function Qu(e,t){return Yu(e)?Xu(e,t)===`source`?`rendered`:`source`:null}function $u(e,t){let n=e.path.trim();if(!n)return null;let r=t?.trim()||null,i=e.viewMode===`preview`?Zu(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 ed(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 td(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 nd(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 rd(e,t){return $u({path:e.path,label:e.label??void 0,viewMode:`preview`,previewViewer:t,line:e.line??void 0,column:e.column??void 0,params:e.params??void 0,rawText:e.rawText??void 0,contentUrl:e.contentUrl??void 0,mimeType:e.mimeType??void 0},e.parentSessionKey)}function id(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 ad(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 od(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 sd(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=ji({entries:e.workspaceNavigationHistory,index:e.workspaceNavigationHistoryIndex},e=>!id(e,t),{kind:`overview`}),r={closedWorkspaceTabEntries:t.kind!==`file`&&t.kind!==`side-chat-draft`?[...e.closedWorkspaceTabEntries.filter(e=>!id(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=ad(e);if(!i||!id(i,t))return r;let a=od(n.entries[n.index]??{kind:`overview`},{...e,...r});return{...r,...a??od({kind:`overview`},e)}}function cd(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 ld(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 ud(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=nd(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 dd(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=Pi(ji({entries:a.workspaceNavigationHistory,index:a.workspaceNavigationHistoryIndex},e=>e.kind!==`side-chat-draft`||e.key!==s),{kind:`child-session`,key:o},id);return{parentSessionKey:l,patch:{workspacePanelParentKey:l,activeWorkspacePanelKind:`child-session`,activeChildSessionKey:o,activeSideChatDraft:null,activeWorkspaceFileKey:null,childSessionTabs:ld(a.childSessionTabs,{sessionKey:o,parentSessionKey:l,label:r?.trim()||null,agentId:t?.trim()||null}),workspaceNavigationHistory:[...u.entries],workspaceNavigationHistoryIndex:u.index}}}var fd=`nextclaw.chat.workspace-panel.state`,pd=3,md=8,hd={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 gd(e){return!!e&&typeof e==`object`}function _d(e){return typeof e==`string`&&e.trim().length>0?e.trim():null}function vd(e,t){return typeof e==`number`&&Number.isInteger(e)?Math.min(Math.max(0,e),t):t}function yd(e){return e===`overview`||e===`child-sessions`||e===`child-session`||e===`project-files`||e===`file`||e===`cron`}function bd(e){if(!gd(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=_d(e.key);return!t||e.kind!==`child-session`&&e.kind!==`file`?null:{kind:e.kind,key:t}}function xd(e){if(!gd(e))return null;let t=_d(e.workspacePanelParentKey),n=_d(e.activeWorkspaceFileKey),r=Ku(Array.isArray(e.workspaceFileTabs)?e.workspaceFileTabs.map(Wu).filter(e=>e!==null):[],n,md),i=r.filter(e=>e.parentSessionKey===t),a=n&&i.some(e=>e.key===n)?n:i[0]?.key??null,o=yd(e.activeWorkspacePanelKind)?e.activeWorkspacePanelKind:null,s=o===`file`&&!a?null:o,c=_d(e.activeChildSessionKey),l=Array.isArray(e.closedWorkspaceTabEntries)?e.closedWorkspaceTabEntries.map(bd).filter(e=>e!==null&&e.kind!==`overview`):[],u=ad({activeWorkspacePanelKind:s,activeChildSessionKey:c,activeSideChatDraft:null,activeWorkspaceFileKey:a}),d=Array.isArray(e.workspaceNavigationHistory)?e.workspaceNavigationHistory.map(bd).filter(e=>e!==null).filter(e=>e.kind!==`file`||r.some(t=>t.key===e.key)):[],f=d.length>0?d:u?[u]:[],p=f.length>0?vd(e.workspaceNavigationHistoryIndex,f.length-1):0;return{workspacePanelHidden:e.workspacePanelHidden===!0,workspacePanelParentKey:t,activeWorkspacePanelKind:s,activeChildSessionKey:c,workspaceFileTabs:r,activeWorkspaceFileKey:a,closedWorkspaceTabEntries:l,workspaceNavigationHistory:f,workspaceNavigationHistoryIndex:p,workspaceExplorerOpen:e.workspaceExplorerOpen===!0,workspaceExplorerWidth:Ju(e.workspaceExplorerWidth),workspacePanelWidth:qu(e.workspacePanelWidth)}}var Y=ct()(xi(e=>({snapshot:hd,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))}),{name:fd,version:pd,storage:Si(()=>new Li),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:{workspacePanelHidden:e.snapshot.workspacePanelHidden,workspacePanelParentKey:e.snapshot.workspacePanelParentKey,activeWorkspacePanelKind:e.snapshot.activeWorkspacePanelKind===`side-chat-draft`?null:e.snapshot.activeWorkspacePanelKind,activeChildSessionKey:e.snapshot.activeChildSessionKey,workspaceFileTabs:Ku(e.snapshot.workspaceFileTabs,e.snapshot.activeWorkspaceFileKey,md).map(Gu),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=xd(gd(e)?e.snapshot:null);return n?{...t,snapshot:{...t.snapshot,...n}}:t}})),Sd=[[`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 Cd(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 wd({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]`]:Sd[Cd(e)%Sd.length]??Sd[0];return n?.trim()?(0,K.jsx)(`img`,{src:n,alt:t?.trim()||e,className:V(`rounded-full object-cover`,r)}):(0,K.jsx)(`div`,{className:V(`rounded-full flex items-center justify-center font-semibold`,o,s,r),"aria-label":t?.trim()||e,children:a?(0,K.jsx)(Dr,{className:`h-[55%] w-[55%]`,strokeWidth:2.4}):(i.trim()||`A`).slice(0,1).toUpperCase()})}function Td(){return R({queryKey:[`agents`],queryFn:P,staleTime:3e4})}function Ed(){let e=Dt();return He({mutationFn:({agentId:e,data:t})=>ae(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),z.success(U(`configSavedApplied`))},onError:e=>{z.error(U(`configSaveFailed`)+`: `+e.message)}})}function Dd(){let e=Dt();return He({mutationFn:({agentId:e})=>xe(e),onSuccess:()=>{e.invalidateQueries({queryKey:[`agents`]}),e.invalidateQueries({queryKey:[`config`]}),z.success(U(`configSavedApplied`))},onError:e=>{z.error(U(`configSaveFailed`)+`: `+e.message)}})}function Od(e){return new Map(e.filter(e=>typeof e.id==`string`&&e.id.trim().length>0).map(e=>[e.id,e]))}function kd(e){let t=e?.trim()??``,n=Td(),r=(0,G.useMemo)(()=>Od(n.data?.agents??[]),[n.data?.agents]);return(0,G.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 Ad({agentId:e,className:t}){let n=kd(e);return n?(0,K.jsx)(wd,{agentId:n.agentId,displayName:n.displayName,avatarUrl:n.avatarUrl,className:t}):null}function jd({layoutMode:e,onBackToList:t}){let n=q(),r=Y(e=>e.snapshot),i=J(e=>e.snapshot.selectedSessionKey),a=J(e=>e.snapshot.selectedAgentId),o=_u(e=>e.snapshot.sessionTypesQuery?.data??null),s=_u(e=>e.snapshot.configQuery?.data??null),c=Lu(i),l=(0,G.useMemo)(()=>Xl(o?.options??[]),[o?.options]),u=ql(o?.defaultType??`native`),d=Pu({defaultSessionType:u,sessionTypeOptions:l}),f=ql(c?.sessionType??u),p=l.find(e=>e.value===f)??null,m=p?.label??Yl(f),h=f!==`native`&&!!m,g=c?.projectRoot??null,_=Pc(s?.agents.defaults.workspace),v=c?.projectName??Fc(g),y=!!c,b=!!(i||m),x=(c?Cc(c):void 0)||(y&&i?i:null)||U(`chatSidebarNewTask`),S=c?.agentId?.trim()??a?.trim()??``,C=S.length>0&&S.toLowerCase()!==`main`,w=!!(r.workspacePanelParentKey===i&&r.activeWorkspacePanelKind);return(0,K.jsx)(Gs,{layoutMode:e,title:x,titleContent:(0,K.jsx)(Ou,{layoutMode:e,selectedSessionKey:i,title:x}),shouldShow:b,onBackToList:t,leading:C?(0,K.jsx)(`div`,{className:`inline-flex shrink-0 items-center`,children:(0,K.jsx)(Ad,{agentId:S,className:`h-5 w-5`})}):null,sessionTypeBadge:h?(0,K.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,K.jsx)(`span`,{className:`inline-flex h-[1.125rem] w-[1.125rem] items-center justify-center`,children:(0,K.jsx)(lu,{icon:{kind:`runtime-image`,src:p.icon.src,alt:p.icon.alt??null,name:m}})}):null,m]}):null,projectBadge:v?(0,K.jsx)(yc,{sessionKey:i??`draft`,projectName:v,projectRoot:g,defaultWorkspacePath:_,persistToServer:y}):null,actions:(0,K.jsxs)(ti,{className:`[--icon-control-size:2rem] [--icon-feedback-size:1.75rem]`,children:[e===`mobile`&&i?(0,K.jsx)(W,{icon:(0,K.jsx)(Ts,{className:`h-4 w-4`}),label:U(`chatSidebarNewTask`),tooltip:!1,onClick:()=>n.chatSessionListManager.createSession({sessionType:d.selectedSessionType})}):null,(0,K.jsx)(_c,{sessionKey:i,sessionTitle:x,canDeleteSession:y,isDeletePending:r.isDeletePending,currentPath:g??c?.workingDir??r.draftProjectRoot??_,defaultWorkspacePath:_,metadata:c?.metadata??null,isWorkspaceOpen:w,onToggleWorkspace:()=>{n.chatThreadManager.toggleWorkspacePanel(i)},onDeleteSession:n.chatThreadManager.deleteSession})]})})}function Md(){let e=q(),t=Y(e=>e.snapshot);return(0,K.jsx)(Ws,{parentSessionLabel:t.parentSessionKey?t.parentSessionLabel??null:null,onGoToParentSession:e.chatThreadManager.goToParentSession})}var Nd=`workspace-file`;function Pd(e,t){let n=`nextclaw://workspace-file?${new URLSearchParams({key:e.key,path:e.path,base:t.workingDir??``,parent:e.parentSessionKey??``,view:e.viewMode,viewer:e.previewViewer??``,line:String(e.line??``),column:String(e.column??``)})}`;return{kind:Nd,title:e.label||e.path.split(`/`).pop()||e.path,url:n,resourceUri:n,dedupeKey:n,historyPolicy:`none`,viewState:{...t,file:Gu(e)}}}function Fd(e){let t=e.viewState;if(!t)try{let n=new URL(e.resourceUri??e.currentUrl),r=n.searchParams.get(`path`);if(n.hostname!==`workspace-file`||!r||n.searchParams.get(`view`)===`diff`)return null;t={workingDir:n.searchParams.get(`base`)||null,projectRoot:null,file:{key:n.searchParams.get(`key`)||r,path:r,parentSessionKey:n.searchParams.get(`parent`)||null,viewMode:`preview`,line:Number(n.searchParams.get(`line`))||null,column:Number(n.searchParams.get(`column`))||null,previewViewer:n.searchParams.get(`viewer`)||void 0}}}catch{return null}if(!t||typeof t!=`object`||!(`file`in t)||!(`workingDir`in t)||!(`projectRoot`in t))return null;let n=Wu(t.file);return!n||t.workingDir!==null&&typeof t.workingDir!=`string`||t.projectRoot!==null&&typeof t.projectRoot!=`string`?null:{file:n,workingDir:t.workingDir,projectRoot:t.projectRoot}}function Id(e,t){let n=new URL(e);if(n.protocol!==`nextclaw:`||n.hostname!==`file`)return null;let[r,...i]=n.pathname.split(`/`).filter(Boolean).map(decodeURIComponent);if(!i.length||i.some(e=>e===`..`||e.includes(`\\`)||e.includes(`/`)))return null;let a=i.join(`/`),o=n.searchParams.get(`base`)||t?.workingDir||null;if(r!==`absolute`&&(r!==`workspace`||!o?.startsWith(`/`)))return null;let s=n.searchParams.get(`view`)||n.searchParams.get(`viewer`),c=e=>{let t=Number(n.searchParams.get(e));return Number.isSafeInteger(t)&&t>0?t:void 0},l=$u({path:r===`absolute`?`/`+a:a,viewMode:`preview`,previewViewer:s===`source`||s===`rendered`?s:void 0,line:c(`line`),column:c(`column`)},t?.sessionKey??null);return l?Pd(l,{workingDir:r===`workspace`?o:null,projectRoot:null}):null}var Ld=12,Rd=(e,t,n)=>Math.max(t,Math.min(n,e));function zd(e,t){let n=Math.max(1,t.width-Ld*2),r=Math.max(1,t.height-Ld*2),i=Rd(e.w,Math.min(320,n),n),a=Rd(e.h,Math.min(240,r),r);return{w:i,h:a,x:Rd(e.x,Ld,t.width-i-Ld),y:Rd(e.y,Ld,t.height-a-Ld)}}function Bd(e,t,n,r,i){let a=t.split(`-`),o=e.x+e.w,s=e.y+e.h,c=a.includes(`left`)?Rd(e.x+n,Ld,o-Math.min(320,e.w)):e.x,l=a.includes(`top`)?Rd(e.y+r,Ld,s-Math.min(240,e.h)):e.y;return zd({x:c,y:l,w:a.includes(`right`)?e.w+n:o-c,h:a.includes(`bottom`)?e.h+r:s-l},i)}var Vd=new class{constructor(){this.isVisible=e=>ia.getState().visibleSurfaceIds.includes(e),this.setVisible=(e,t)=>{ia.setState(({visibleSurfaceIds:n})=>({visibleSurfaceIds:t?[...new Set([...n,e])]:n.filter(t=>t!==e)}))},this.get=e=>ia.getState().surfaces[e]??zi,this.update=(e,t)=>{ia.setState(({surfaces:n})=>({surfaces:{...n,[e]:{...this.get(e),...t}}}))},this.place=(e,t)=>{this.update(e,{placement:t,minimized:!1,maximized:!1}),this.focus(e)},this.minimize=e=>this.update(e,{minimized:!0,maximized:!1}),this.restore=e=>this.update(e,{minimized:!1}),this.toggleMaximize=e=>{this.update(e,{maximized:!this.get(e).maximized,minimized:!1}),this.focus(e)},this.focus=e=>{let{surfaces:t}=ia.getState(),n=Object.keys(t).sort((e,n)=>t[e].layer-t[n].layer);if(n.at(-1)===e&&this.get(e).layer>0)return;let r=[...n.filter(t=>t!==e),e];ia.setState({surfaces:Object.fromEntries(r.map((e,t)=>[e,{...this.get(e),layer:t+1}]))})},this.reset=e=>{ia.setState(({surfaces:t})=>{let n={...t};return delete n[e],{surfaces:n}})},this.constrain=(e,t)=>{let n=this.get(e).rect,r=zd(n,t);Object.keys(r).some(e=>r[e]!==n[e])&&this.update(e,{rect:r})},this.move=(e,t,n,r,i)=>{this.update(e,{rect:zd({...t,x:t.x+n,y:t.y+r},i)})},this.resize=(e,t,n,r,i,a)=>{this.update(e,{rect:Bd(t,n,r,i,a)})}}},Hd=ct(()=>({session:null})),Ud=new class{constructor(){this.open=e=>{Hd.setState({session:e}),Vd.place(ra,`floating`)},this.minimize=()=>{Vd.minimize(ra)},this.restore=()=>{Vd.restore(ra)},this.close=()=>{Hd.setState({session:null}),Vd.place(ra,`floating`)},this.dock=(e,t)=>{Vd.place(Ri,`docked`),t.open(Ps(e.sessionKey),{kind:Ns,title:e.title,newTab:!0,dedupeKey:Ps(e.sessionKey)}),Hd.getState().session?.sessionKey===e.sessionKey&&this.close()},this.popOut=(e,t)=>{let n=Fs(e.currentUrl);n&&(this.open({sessionKey:n,title:e.title}),t.closeTab(e.id))}}};function Wd(e,t){return e.label?.trim()?e.label.trim():t?Cc(t):e.sessionKey}function Gd(e){let t=Ol({limit:200}),n=J(e=>e.runningSessionKeys),r=(0,G.useMemo)(()=>t.data?.sessions??[],[t.data?.sessions]),i=(0,G.useMemo)(()=>{let e=ml(r);return new Map(e.map(e=>[e.key,e]))},[r]),a=(0,G.useMemo)(()=>new Set(n),[n]);return(0,G.useMemo)(()=>e.map(e=>{let t=i.get(e.sessionKey)??null,n=e.agentId?.trim()||t?.agentId||null;return{sessionKey:e.sessionKey,parentSessionKey:e.parentSessionKey,title:Wd(e,t),agentId:n,updatedAt:t?.updatedAt??null,lastMessageAt:t?.lastMessageAt??null,readAt:t?.readAt??null,runStatus:a.has(e.sessionKey)||t?.status===`running`?`running`:void 0,sessionTypeLabel:t?.sessionType?Yl(t.sessionType):null,preferredModel:t?.preferredModel?.trim()||null,projectName:t?.projectName?.trim()||null,projectRoot:t?.projectRoot?.trim()||null}}),[a,i,e])}function Kd(e){let t=e.path.split(`/`).filter(Boolean).pop();return e.label?.trim()||t||e.path}function qd(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 Jd({activeSelection:e,hasSession:t,resolvedChildTabs:n,onSelectChildSessions:r,onSelectCronJobs:i,onSelectOverview:a,onSelectProjectFiles:o,onSelectContinuousAttention:s}){let c=[{key:`overview`,kind:`overview`,title:U(`chatWorkspaceOverview`),tooltip:U(`chatWorkspaceOverview`),active:e?.kind===`overview`,onSelect:a},{key:`child-sessions`,kind:`child-sessions`,title:U(`chatWorkspaceChildSessions`),tooltip:U(`chatWorkspaceChildSessions`),active:e?.kind===`child-sessions`,runStatus:n.some(e=>e.runStatus===`running`)?`running`:void 0,onSelect:r},{key:`cron:session`,kind:`cron`,title:U(`chatWorkspaceSessionCronJobs`),tooltip:U(`chatWorkspaceSessionCronJobs`),active:e?.kind===`cron`,onSelect:i},{key:`continuous-attention`,kind:`continuous-attention`,title:U(`chatWorkspaceContinuousAttention`),tooltip:U(`chatWorkspaceContinuousAttention`),active:e?.kind===`continuous-attention`,onSelect:s??(()=>void 0)},{key:`project-files`,kind:`project-files`,title:U(`chatWorkspaceProjectFiles`),tooltip:U(`chatWorkspaceProjectFiles`),active:e?.kind===`project-files`,onSelect:o}];return t?c:c.filter(e=>e.kind===`project-files`)}function Yd(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=Jd({activeSelection:o,hasSession:t,resolvedChildTabs:i,onSelectChildSessions:h,onSelectCronJobs:_,onSelectOverview:m,onSelectProjectFiles:g,onSelectContinuousAttention:v}),b=n?[{key:`side-chat-draft:${n.draftKey}`,kind:`side-chat-draft`,title:U(`chatWorkspaceSideChatDraftTitle`),tooltip:U(`chatWorkspaceSideChatDraftSubtitle`),active:o?.kind===`side-chat-draft`&&o.draft.draftKey===n.draftKey,onSelect:()=>void 0,onClose:()=>p({kind:`side-chat-draft`,key:n.draftKey})}]:[],x=i.filter(e=>!r.some(t=>id(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:Sl({active:o?.kind===`child-session`&&o.tab.sessionKey===e.sessionKey,lastMessageAt:e.lastMessageAt,readAt:n,runStatus:e.runStatus}),runStatus:e.runStatus,onSelect:()=>u(e.sessionKey),onClose:()=>p({kind:`child-session`,key:e.sessionKey})}}),S=a.map(e=>{let t=e.viewMode===`preview`?Xu(e.path,e.previewViewer):null,n=e.viewMode===`preview`?Qu(e.path,e.previewViewer):null,r=Kd(e),i=Hc({path:e.path,sessionProjectRoot:c??null});return{key:`file:${e.key}`,kind:`file`,title:t===`rendered`?`${U(`chatWorkspacePreview`)}: ${r}`:r,tooltip:e.path,fileName:e.path,viewMode:e.viewMode,isRenderedPreview:t===`rendered`,alternateViewerAction:n?{label:U(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,...b,...x,...S]}function Xd(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 Zd=Object.freeze({left:0,top:0,width:16,height:16}),Qd=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),$d=Object.freeze({...Zd,...Qd}),ef=Object.freeze({...$d,body:``,hidden:!1});function tf(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 nf(e,t){let n=tf(e,t);for(let r in ef)r in Qd?r in e&&!(r in n)&&(n[r]=Qd[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function rf(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=nf(r[e]||i[e],a)}return o(t),n.forEach(o),nf(e,a)}function af(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=Xd(e);for(let i in r){let a=r[i];a&&(t(i,rf(e,i,a)),n.push(i))}return n}var of={provider:``,aliases:{},not_found:{},...Zd};function sf(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function cf(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!sf(e,of))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!sf(t,ef))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]||!sf(t,ef))return null}return t}var lf=Object.create(null);function uf(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function df(e,t){let n=lf[e]||(lf[e]=Object.create(null));return n[t]||(n[t]=uf(e,t))}function ff(e,t){return cf(t)?af(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function pf(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var mf=/^[a-z0-9]+(-[a-z0-9]+)*$/,hf=(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&&!gf(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&&!gf(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!gf(e,n)?null:e}return null},gf=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1,_f=!1;function vf(e){return typeof e==`boolean`&&(_f=e),_f}function yf(e){let t=typeof e==`string`?hf(e,!0,_f):e;if(t){let e=df(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function bf(e,t){let n=hf(e,!0,_f);if(!n)return!1;let r=df(n.provider,n.prefix);return t?pf(r,n.name,t):(r.missing.add(n.name),!0)}function xf(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),_f&&!t&&!e.prefix){let t=!1;return cf(e)&&(e.prefix=``,af(e,(e,n)=>{bf(e,n)&&(t=!0)})),t}let n=e.prefix;return gf({prefix:n,name:`a`})?!!ff(df(t,n),e):!1}var Sf=Object.freeze({width:null,height:null}),Cf=Object.freeze({...Sf,...Qd}),wf=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Tf=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function Ef(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(wf);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=Tf.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 Df(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 Of(e,t){return e?`<defs>`+e+`</defs>`+t:t}function kf(e,t,n){let r=Df(e);return Of(r.defs,t+r.content+n)}var Af=e=>e===`unset`||e===`undefined`||e===`none`;function jf(e,t){let n={...$d,...e},r={...Cf,...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=kf(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=Ef(d,c/l)):(u=o===`auto`?c:o,d=s===null?Ef(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{Af(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 Mf=/\sid="(\S+)"/g,Nf=`IconifyId`+Date.now().toString(16)+(Math.random()*16777216|0).toString(16),Pf=0;function Ff(e,t=Nf){let n=[],r;for(;r=Mf.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+(Pf++).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 If=Object.create(null);function Lf(e,t){If[e]=t}function Rf(e){return If[e]||If[``]}function zf(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 Bf=Object.create(null),Vf=[`https://api.simplesvg.com`,`https://api.unisvg.com`],Hf=[];Vf.length>0;)Vf.length===1||Math.random()>.5?Hf.push(Vf.shift()):Hf.push(Vf.pop());Bf[``]=zf({resources:[`https://api.iconify.design`].concat(Hf)});function Uf(e,t){let n=zf(t);return n===null?!1:(Bf[e]=n,!0)}function Wf(e){return Bf[e]}var Gf=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function Kf(e,t){let n=Wf(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 qf(e){return e===404}var Jf=(e,t,n)=>{let r=[],i=Kf(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 Yf(e){if(typeof e==`string`){let t=Wf(e);if(t)return t.path}return`/`}var Xf={prepare:Jf,send:(e,t,n)=>{if(!Gf){n(`abort`,424);return}let r=Yf(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;Gf(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(qf(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 Zf(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function Qf(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||Zf([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var $f=0;function ep(e,t,n){let r=$f++,i=Zf.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 tp(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]=df(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 np(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?hf(e,t,n):e;i&&r.push(i)}),r}var rp={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function ip(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 ap(e){let t={...rp,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=ip(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 op(){}var sp=Object.create(null);function cp(e){if(!sp[e]){let t=Wf(e);if(!t)return;sp[e]={config:t,redundancy:ap(t)}}return sp[e]}function lp(e,t,n){let r,i;if(typeof e==`string`){let t=Rf(e);if(!t)return n(void 0,424),op;i=t.send;let a=cp(e);a&&(r=a.redundancy)}else{let t=zf(e);if(t){r=ap(t);let n=Rf(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),op):r.query(t,i,n)().abort}function up(){}function dp(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Qf(e)}))}function fp(e){let t=[],n=[];return e.forEach(e=>{(e.match(mf)?t:n).push(e)}),{valid:t,invalid:n}}function pp(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(!ff(e,n).length){r();return}}catch(e){console.error(e)}r(),dp(e)}function mp(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function hp(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)){mp(e.loadIcons(r,n,t),t=>{pp(e,r,t)});return}if(i){r.forEach(r=>{mp(i(r,n,t),t=>{pp(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=fp(r);if(o.length&&pp(e,o,null),!a.length)return;let s=n.match(mf)?Rf(t):null;if(!s){pp(e,a,null);return}s.prepare(t,n,a).forEach(n=>{lp(t,n,t=>{pp(e,n.icons,t)})})}))}var gp=(e,t)=>{let n=tp(np(e,!0,vf()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,up)}),()=>{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(df(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=df(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&&hp(e,t)}),t?ep(t,n,i):up};function _p(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in Sf?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var vp=/[\s,]+/;function yp(e,t){t.split(vp).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0;break}})}function bp(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 xp(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 Sp(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Cp(e){return`data:image/svg+xml,`+Sp(e)}function wp(e){return`url("`+Cp(e)+`")`}var Tp;function Ep(){try{Tp=window.trustedTypes.createPolicy(`iconify`,{createHTML:e=>e})}catch{Tp=null}}function Dp(e){return Tp===void 0&&Ep(),Tp?Tp.createHTML(e):e}var Op={...Cf,inline:!1},kp={xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Ap={display:`inline-block`},jp={backgroundColor:`currentColor`},Mp={backgroundColor:`transparent`},Np={Image:`var(--svg)`,Repeat:`no-repeat`,Size:`100% 100%`},Pp={WebkitMask:jp,mask:jp,background:Mp};for(let e in Pp){let t=Pp[e];for(let n in Np)t[e+n]=Np[n]}var Fp={...Op,inline:!0};function Ip(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}var Lp=(e,t,n)=>{let r=t.inline?Fp:Op,i=_p(r,t),a=t.mode||`svg`,o={},s=t.style||{},c={...a===`svg`?kp:{}};if(n){let e=hf(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`&&yp(i,n);break;case`color`:o.color=n;break;case`rotate`:typeof n==`string`?i[e]=bp(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=jf(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:Dp(Ff(l.body,n?()=>n+`ID`+ e++:`iconifyReact`))},(0,G.createElement)(`svg`,c)}let{body:d,width:f,height:p}=e,m=a===`mask`||(a===`bg`?!1:d.indexOf(`currentColor`)!==-1),h=xp(d,{...u,width:f+``,height:p+``});return c.style={...o,"--svg":wp(h),width:Ip(u.width),height:Ip(u.height),...Ap,...m?jp:Mp,...s},(0,G.createElement)(`span`,c)};if(vf(!0),Lf(``,Xf),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`||!xf(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;Uf(e,r)||console.error(n)}catch{console.error(n)}}}}function Rp(e){let[t,n]=(0,G.useState)(!!e.ssr),[r,i]=(0,G.useState)({});function a(t){if(t){let t=e.icon;if(typeof t==`object`)return{name:``,data:t};let n=yf(t);if(n)return{name:t,data:n}}return{name:``}}let[o,s]=(0,G.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=yf(n);l({name:n,data:r})&&(r===void 0?i({callback:gp([n],u)}):r&&((t=e.onLoad)==null||t.call(e,n)))}(0,G.useEffect)(()=>(n(!0),c),[]),(0,G.useEffect)(()=>{t&&u()},[e.icon,t]);let{name:d,data:f}=o;return f?Lp({...$d,...f},e,d):e.children?e.children:e.fallback?e.fallback:(0,G.createElement)(`span`,{})}var zp=(0,G.forwardRef)((e,t)=>Rp({...e,_ref:t}));(0,G.forwardRef)((e,t)=>Rp({inline:!0,...e,_ref:t}));var Bp=t((e=>{e.__esModule=!0,e.default={width:32,height:32,body:`<path fill="#c5c5c5" d="M20.414 2H5v28h22V8.586ZM7 28V4h12v6h6v18Z"/>`}})),Vp=t((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"/>`}})),Hp=t((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"/>`}})),Up=t((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"/>`}})),Wp=t((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"/>`}})),Gp=t((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"/>`}})),Kp=t((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"/>`}})),qp=t((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"/>`}})),Jp=t((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>`}})),Yp=t((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"/>`}})),Xp=t((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"/>`}})),Zp=t((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"/>`}})),Qp=t((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"/>`}})),$p=t((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"/>`}})),em=t((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"/>`}})),tm=t((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"/>`}})),nm=t((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"/>`}})),rm=t((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"/>`}})),im=t((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"/>`}})),am=t((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"/>`}})),om=t((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"/>`}})),sm=t((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"/>`}})),cm=t((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"/>`}})),lm=t((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"/>`}})),um=t((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"/>`}})),dm=t((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"/>`}})),fm=t((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"/>`}})),pm=t((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"/>`}})),mm=t((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"/>`}})),hm=t((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"/>`}})),gm=t((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"/>`}})),_m=t((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"/>`}})),vm=t((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"/>`}})),ym=t((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"/>`}})),bm=t((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"/>`}})),xm=t((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"/>`}})),Sm=t((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"/>`}})),Cm=t((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"/>`}})),wm=t((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"/>`}})),Tm=t((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"/>`}})),Em=t((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"/>`}})),Dm=t((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"/>`}})),Om=t((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"/>`}})),km=t((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"/>`}})),Am=t((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"/>`}})),jm=t((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"/>`}})),Mm=t((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"/>`}})),Nm=t((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"/>`}})),Pm=t((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>`}})),Fm=t((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"/>`}})),Im=t((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"/>`}})),Lm=t((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"/>`}})),Rm=t((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"/>`}})),zm=t((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"/>`}})),Bm=t((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"/>`}})),Vm=t((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"/>`}})),Hm=e(Bp(),1),Um=e(Vp(),1),Wm=e(Hp(),1),Gm=e(Up(),1),Km=e(Wp(),1),qm=e(Gp(),1),Jm=e(Kp(),1),Ym=e(qp(),1),Xm=e(Jp(),1),Zm=e(Yp(),1),Qm=e(Xp(),1),$m=e(Zp(),1),eh=e(Qp(),1),th=e($p(),1),nh=e(em(),1),rh=e(tm(),1),ih=e(nm(),1),ah=e(rm(),1),oh=e(im(),1),sh=e(am(),1),ch=e(om(),1),lh=e(sm(),1),uh=e(cm(),1),dh=e(lm(),1),fh=e(um(),1),ph=e(dm(),1),mh=e(fm(),1),hh=e(pm(),1),gh=e(mm(),1),_h=e(hm(),1),vh=e(gm(),1),yh=e(_m(),1),bh=e(vm(),1),xh=e(ym(),1),Sh=e(bm(),1),Ch=e(xm(),1),wh=e(Sm(),1),Th=e(Cm(),1),Eh=e(wm(),1),Dh=e(Tm(),1),Oh=e(Em(),1),kh=e(Dm(),1),Ah=e(Om(),1),jh=e(km(),1),Mh=e(Am(),1),Nh=e(jm(),1),Ph=e(Mm(),1),Fh=e(Nm(),1),Ih=e(Pm(),1),Lh=e(Fm(),1),Rh=e(Im(),1),zh=e(Lm(),1),Bh=e(Rm(),1),Vh=e(zm(),1),Hh=e(Bm(),1),Uh=e(Vm(),1),Wh=[{icon:Ym.default,name:`docker`,pattern:/^(dockerfile|\.dockerignore)$/},{icon:Xm.default,name:`dotenv`,pattern:/^\.env(?:\.|$)/},{icon:eh.default,name:`git`,pattern:/^\.git(?:attributes|ignore|modules)$/},{icon:dh.default,name:`makefile`,pattern:/^makefile$/},{icon:lh.default,name:`license`,pattern:/^licen[cs]e(?:\.|$)/},{icon:fh.default,name:`markdown`,pattern:/^readme(?:\.|$)/},{icon:ph.default,name:`npm`,pattern:/^package(?:-lock)?\.json$/},{icon:gh.default,name:`pnpm`,pattern:/^(pnpm-lock\.yaml|pnpm-workspace\.yaml)$/},{icon:Hh.default,name:`yarn`,pattern:/^yarn\.lock$/},{icon:Wm.default,name:`bun`,pattern:/^bun\.lockb?$/},{icon:Nh.default,name:`tsconfig`,pattern:/^tsconfig(?:\..+)?\.json$/},{icon:Ih.default,name:`vite`,pattern:/^vite\.config\./},{icon:Lh.default,name:`vitest`,pattern:/^vitest(?:\..+)?\.config\./},{icon:Ah.default,name:`tailwind`,pattern:/^tailwind\.config\./},{icon:Zm.default,name:`eslint`,pattern:/^(eslint\.config\.|\.eslintrc)/},{icon:vh.default,name:`prettier`,pattern:/^(prettier\.config\.|\.prettierrc)/}],Gh=[{icon:xh.default,name:`react-typescript`,extensions:[`tsx`]},{icon:bh.default,name:`react-javascript`,extensions:[`jsx`]},{icon:Ph.default,name:`typescript`,extensions:[`ts`,`mts`,`cts`]},{icon:oh.default,name:`javascript`,extensions:[`js`,`mjs`,`cjs`]},{icon:sh.default,name:`json`,extensions:[`json`,`json5`,`jsonc`]},{icon:fh.default,name:`markdown`,extensions:[`md`,`mdx`]},{icon:rh.default,name:`html`,extensions:[`html`,`htm`]},{icon:Jm.default,name:`css`,extensions:[`css`,`pcss`,`less`]},{icon:wh.default,name:`sass`,extensions:[`sass`,`scss`]},{icon:Rh.default,name:`vue`,extensions:[`vue`]},{icon:Dh.default,name:`svelte`,extensions:[`svelte`]},{icon:yh.default,name:`python`,extensions:[`py`,`pyw`]},{icon:th.default,name:`go`,extensions:[`go`]},{icon:Ch.default,name:`rust`,extensions:[`rs`]},{icon:ah.default,name:`java`,extensions:[`java`]},{icon:ch.default,name:`kotlin`,extensions:[`kt`,`kts`]},{icon:kh.default,name:`swift`,extensions:[`swift`]},{icon:Km.default,name:`cpp`,extensions:[`c`,`cc`,`cpp`,`h`,`hpp`]},{icon:qm.default,name:`csharp`,extensions:[`cs`]},{icon:hh.default,name:`php`,extensions:[`php`]},{icon:Sh.default,name:`ruby`,extensions:[`rb`]},{icon:uh.default,name:`lua`,extensions:[`lua`]},{icon:Th.default,name:`shell`,extensions:[`sh`,`bash`,`zsh`,`fish`,`ps1`]},{icon:nh.default,name:`graphql`,extensions:[`graphql`,`gql`]},{icon:Vh.default,name:`yaml`,extensions:[`yaml`,`yml`]},{icon:Mh.default,name:`toml`,extensions:[`toml`]},{icon:Bh.default,name:`xml`,extensions:[`xml`]},{icon:Eh.default,name:`sql`,extensions:[`sql`,`sqlite`,`db`]},{icon:Oh.default,name:`svg`,extensions:[`svg`]},{icon:ih.default,name:`image`,extensions:[`avif`,`bmp`,`gif`,`heic`,`ico`,`jpeg`,`jpg`,`png`,`tif`,`tiff`,`webp`]},{icon:Um.default,name:`audio`,extensions:[`aac`,`flac`,`m4a`,`mp3`,`ogg`,`opus`,`wav`,`weba`]},{icon:Fh.default,name:`video`,extensions:[`avi`,`m4v`,`mkv`,`mov`,`mp4`,`webm`,`wmv`]},{icon:mh.default,name:`pdf`,extensions:[`pdf`]},{icon:zh.default,name:`word`,extensions:[`doc`,`docx`,`odt`,`rtf`]},{icon:Qm.default,name:`excel`,extensions:[`csv`,`numbers`,`ods`,`tsv`,`xls`,`xlsx`]},{icon:_h.default,name:`powerpoint`,extensions:[`odp`,`ppt`,`pptx`]},{icon:Uh.default,name:`archive`,extensions:[`7z`,`bz2`,`gz`,`rar`,`tar`,`tgz`,`zip`]},{icon:$m.default,name:`font`,extensions:[`eot`,`otf`,`ttf`,`woff`,`woff2`]},{icon:Gm.default,name:`config`,extensions:[`cfg`,`conf`,`ini`,`properties`]},{icon:jh.default,name:`text`,extensions:[`log`,`txt`]}],Kh={icon:Hm.default,name:`default`};function qh(e){return e.trim().split(/[\\/]/).filter(Boolean).pop()??e.trim()}function Jh(e){return/\.([a-z0-9]{1,16})$/i.exec(e)?.[1]?.toLowerCase()??``}function Yh(e){let t=qh(e).toLowerCase(),n=Wh.find(({pattern:e})=>e.test(t));if(n)return n;let r=Jh(t);return Gh.find(({extensions:e})=>e.includes(r))??Kh}function Xh(e){let t=e;return`body`in t?t:t.default}function Zh({className:e,fileName:t,size:n=`default`}){let r=Yh(t);return(0,K.jsx)(zp,{"aria-hidden":`true`,"data-file-type-icon":r.name,icon:Xh(r.icon),className:V(`shrink-0`,n===`compact`?`h-3.5 w-3.5`:`h-4 w-4`,e)})}function Qh(e,t){e.stopPropagation(),t()}function $h(e){return(0,K.jsx)(W,{...e,size:`sm`,tone:`strong`})}function eg({tab:e}){if(!e.menuGroups?.some(e=>e.items.length>0))return null;let t=e.menuLabel??e.label;return(0,K.jsx)(`div`,{className:`flex shrink-0`,children:(0,K.jsx)(dr,{children:(0,K.jsx)($h,{icon:(0,K.jsx)(wr,{className:`h-3.5 w-3.5`}),label:t})})})}function tg({tab:e}){let t=e.menuGroups?.some(e=>e.items.length>0)??!1,n=!!(e.onClose&&e.closePlacement!==`leading-hover`),r=n?(0,K.jsx)($h,{icon:(0,K.jsx)(Vr,{className:`h-3.5 w-3.5`}),label:e.closeLabel??``,tooltip:e.closeLabel??null,onClick:t=>Qh(t,e.onClose)}):null;return!t&&!n?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,"data-compact-tab-trailing-spacer":``,className:V(`shrink-0`,t&&n?`w-[50px]`:`w-6`)}),(0,K.jsxs)(`div`,{"data-compact-tab-trailing-actions":``,className:V(`pointer-events-none absolute inset-y-0 right-1 z-10 flex items-center gap-0.5 opacity-0`,`group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100`,`group-data-[context-menu-open]:pointer-events-auto group-data-[context-menu-open]:opacity-100`),children:[t?(0,K.jsx)(eg,{tab:e}):null,r]})]})}function ng({tab:e}){return!e.onClose||e.closePlacement!==`leading-hover`?null:(0,K.jsx)(`div`,{"data-compact-tab-leading-actions":``,className:V(`pointer-events-none absolute inset-y-0 left-1 z-10 flex items-center opacity-0`,`group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100`),children:(0,K.jsx)($h,{icon:(0,K.jsx)(Vr,{className:`h-3.5 w-3.5`}),label:e.closeLabel??``,tooltip:e.closeLabel??null,onClick:t=>Qh(t,e.onClose)})})}function rg({labelClassName:e,tab:t}){let n=!!(t.onClose&&t.closePlacement===`leading-hover`),r=(0,K.jsxs)(`button`,{type:`button`,onClick:t.onSelect,"aria-label":t.label,className:`flex min-w-0 flex-1 items-center gap-1.5 text-left`,children:[t.leadingIcon||n?(0,K.jsx)(`span`,{"data-compact-tab-leading-slot":``,className:V(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center`,n&&`group-hover:opacity-0 group-focus-within:opacity-0`),children:t.leadingIcon}):null,(0,K.jsx)(`span`,{className:V(`min-w-0 truncate text-[12px] font-medium`,e,t.labelClassName),children:t.label}),t.badge,t.unreadIndicator]}),i=t.tooltip??t.label;return i?(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:r}),(0,K.jsx)(ui,{className:`text-xs`,children:i})]})}):r}function ig({activeTabClassName:e,inactiveTabClassName:t,itemRef:n,labelClassName:r,tab:i,tabBaseClassName:a}){let o=(0,K.jsxs)(`div`,{ref:n,"data-compact-tab-item":``,onClick:e=>e.target===e.currentTarget&&i.onSelect(),className:V(a??`flex h-8 max-w-[180px] cursor-pointer items-center gap-1.5 border-r border-border/50 px-2.5 transition-colors`,`group relative`,i.active?e??`bg-background text-foreground`:t??`bg-transparent text-muted-foreground hover:bg-[var(--interaction-hover)]`),children:[(0,K.jsx)(rg,{tab:i,labelClassName:r}),(0,K.jsx)(ng,{tab:i}),(0,K.jsx)(tg,{tab:i})]});return i.menuGroups?.some(e=>e.items.length>0)?(0,K.jsx)(xr,{groups:i.menuGroups,label:i.menuLabel??i.label,children:o}):o}function ag({actionButtonClassName:e,actions:t,actionsClassName:n,actionsTestId:r,className:i,onPointerDown:a,onScrollPointerDown:o,scrollClassName:s,scrollTestId:c,tabs:l,tabsClassName:u,testId:d,...f}){let p=G.useCallback(e=>{e?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[]);return(0,K.jsxs)(`div`,{"data-testid":d,className:V(`flex min-w-0 items-stretch border-b border-gray-200/70 bg-gray-50/85`,i),onPointerDown:a,children:[(0,K.jsx)(`div`,{className:V(`compact-tab-scrollbar flex min-w-0 flex-1 items-stretch overflow-x-auto overflow-y-hidden`,s),onPointerDown:o,children:(0,K.jsx)(`div`,{"data-testid":c,className:V(`flex min-w-max items-stretch`,u),children:l.map(e=>(0,K.jsx)(ig,{itemRef:e.active?p:void 0,tab:e,...f},e.key))})}),(0,K.jsx)(ti,{className:n,"data-testid":r,onPointerDown:e=>e.stopPropagation(),children:t.map(t=>(0,K.jsx)(W,{size:`sm`,icon:t.icon,label:t.label,disabled:t.disabled,onClick:t.onClick,className:e},t.key))})]})}function og({agentId:e,fileName:t,kind:n}){return n===`overview`?(0,K.jsx)(zo,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`child-sessions`?(0,K.jsx)(Oo,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`project-files`?(0,K.jsx)(Gn,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`cron`?(0,K.jsx)(Qa,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`continuous-attention`?(0,K.jsx)(Fr,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`}):n===`file`?(0,K.jsx)(Zh,{fileName:t??``,size:`compact`}):n===`side-chat-draft`?(0,K.jsx)(Sr,{className:`h-3.5 w-3.5 shrink-0 text-primary`}):e?(0,K.jsx)(Ad,{agentId:e,className:`h-3.5 w-3.5 shrink-0`}):(0,K.jsx)(Jo,{className:`h-3.5 w-3.5 shrink-0 text-gray-400`})}function sg(e){if(e.kind!==`file`)return;let t=[...e.onAddToChat?[{key:`add-to-chat`,icon:(0,K.jsx)(Sr,{className:`h-4 w-4`}),label:U(`chatWorkspaceAddToChat`),restoreFocus:!1,onSelect:e.onAddToChat}]:[],...e.alternateViewerAction?[{key:`viewer:${e.alternateViewerAction.viewer}`,icon:e.alternateViewerAction.viewer===`rendered`?(0,K.jsx)(Fr,{className:`h-4 w-4`}):(0,K.jsx)(gr,{className:`h-4 w-4`}),label:e.alternateViewerAction.label,onSelect:e.alternateViewerAction.onSelect}]:[]],n=e.onClose?[{key:`close`,icon:(0,K.jsx)(Vr,{className:`h-4 w-4`}),label:U(`workbenchCloseTab`),onSelect:e.onClose}]:[];return[{key:`file`,items:t},{key:`tab`,items:n}]}function cg(e){if(!(e.kind!==`child-session`||!e.sessionKey))return[{key:`session`,items:[{key:`copy-session-id`,label:U(`chatSessionCopyId`),icon:(0,K.jsx)(Qn,{className:`h-4 w-4`}),onSelect:()=>void Xs(e.sessionKey)}]}]}function lg(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,K.jsx)(og,{kind:e.kind,agentId:e.agentId,fileName:e.fileName}),badge:e.runStatus?(0,K.jsx)(du,{status:e.runStatus}):e.kind===`file`&&e.viewMode===`diff`?(0,K.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:U(`chatWorkspaceDiff`)}):null,unreadIndicator:e.showUnreadDot?(0,K.jsx)(`span`,{"aria-label":U(`chatSessionUnread`),className:`h-2 w-2 shrink-0 rounded-full bg-primary`}):null,closeLabel:`${e.kind===`file`?U(`chatWorkspaceCloseFile`):U(`workbenchCloseTab`)}: ${e.title}`,closePlacement:`leading-hover`,onSelect:e.onSelect,onClose:e.onClose,menuLabel:`${U(`pageActions`)}: ${e.title}`,menuGroups:[...e.menuGroups??[],...(cg(e)??sg(e)??[]).map(t=>({...t,items:t.items.filter(t=>!e.menuGroups?.some(e=>e.items.some(e=>e.key===t.key)))})).filter(e=>e.items.length>0),{key:`placement`,items:[...e.onMoveGlobal?[{key:`move-global`,label:U(`workbenchMoveGlobal`),icon:(0,K.jsx)(ds,{className:`h-4 w-4`}),onSelect:e.onMoveGlobal}]:[],...e.onFloat?[{key:`float`,label:U(`workbenchFloatView`),icon:(0,K.jsx)(hs,{className:`h-4 w-4`}),onSelect:e.onFloat}]:[]]}]}))}function ug({canGoBack:e,canGoForward:t,onGoBack:n,onGoForward:r,onRefreshFile:i,tabs:a}){return(0,K.jsx)(ag,{className:`h-8 min-w-0 flex-1 border-0 bg-transparent px-0`,testId:`workspace-tabs-bar`,scrollTestId:`workspace-tabs-scroll`,tabs:lg(a),actions:[{key:`back`,icon:(0,K.jsx)(Or,{className:`h-4 w-4`}),label:U(`chatWorkspaceBack`),disabled:!e,onClick:n},{key:`forward`,icon:(0,K.jsx)(to,{className:`h-4 w-4`}),label:U(`chatWorkspaceForward`),disabled:!t,onClick:r},...i?[{key:`refresh-file`,icon:(0,K.jsx)(qr,{className:`h-4 w-4`}),label:U(`chatWorkspaceRefreshFile`),onClick:i}]:[]],scrollClassName:`workspace-horizontal-scrollbar`,actionsClassName:`ml-1 mr-1 self-stretch`})}var dg=`nextclaw.chat.message-layout`,fg=1,pg=`flat`;function mg(e){if(!e||typeof e!=`object`)return pg;let{layout:t}=e;return t===`flat`||t===`card`?t:pg}var hg=ct()(xi(e=>({layout:pg,setLayout:t=>e({layout:t})}),{name:dg,version:fg,storage:Si(()=>window.localStorage),partialize:e=>({layout:e.layout}),merge:(e,t)=>({...t,layout:mg(e)})}));function gg({children:e,className:t,width:n=`messages`}){let r=hg(e=>e.layout);return(0,K.jsx)(`div`,{"data-chat-conversation-track":r,"data-chat-conversation-track-width":n,className:V(`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})}var _g=`ncp_internal_visibility`,vg=`observation.event`;function yg(e){return e?.metadata?.[_g]===`hidden`}var bg=`ai_execution`;function xg(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function Sg(e){return e===null||typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Cg(e){return e===`reported`||e===`partial`||e===`unavailable`}function wg(e){return e===`completed`||e===`failed`||e===`aborted`}function Tg(e){let t=e?.[bg];if(!xg(t)||t.version!==1||!xg(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`)||!wg(t.outcome)||!Sg(n.inputTokens)||!Sg(n.outputTokens)||!Sg(n.cachedInputTokens)||!Sg(n.totalTokens)||!Sg(n.modelCallCount)||!Sg(n.reportedModelCallCount)||!Cg(n.status)?null:t}var X=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 Eg(e,t=e.occurredAt??new Date().toISOString()){return{...e,occurredAt:t}}var Dg=`run_trigger`;function Og(e){return typeof e==`string`&&e.trim()?e.trim():null}function kg(e){return Og(e)??void 0}function Ag(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 jg(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=t.actor,r=Og(t.source),i=Og(t.triggeredAt);if(n!==`human`&&n!==`agent`&&n!==`automation`&&n!==`system`||!r||!i||!Number.isFinite(Date.parse(i)))return null;let a=kg(t.sourceSessionId),o=kg(t.sourceMessageId),s=kg(t.sourceRunId),c=kg(t.sourceToolCallId),l=kg(t.sourceRequestId),u=kg(t.sourceModel),d=Ag(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 Mg(e){let t=e?.[Dg];if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,r=jg(n),i=Og(n.targetRunId);return n.version!==1||!r||!i?null:{version:1,...r,targetRunId:i}}var Ng=/^\s*\[\[\s*reply_to_current\s*\]\]/i,Pg=/^\s*\[\[\s*reply_to\s*:\s*([^\]]+?)\s*\]\]/i;function Fg(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function Ig(e,t){let n=e,r;Ng.test(n)&&(r=Fg(t),n=n.replace(Ng,``).trim());let i=n.match(Pg)?.[1];return i&&(r=Fg(i),n=n.replace(Pg,``).trim()),r?{content:n,replyTo:r}:{content:n}}function Lg(e,t){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=Fg(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}=Ig(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}}var Rg=`session-user-questions`;function zg(e){try{return new Set(JSON.parse(sessionStorage.getItem(`nextclaw-question-seen:${e}`)??`[]`))}catch{return new Set}}function Bg(e,t){try{sessionStorage.setItem(`nextclaw-question-seen:${e}`,JSON.stringify([...t]))}catch{}}function Vg({sessionId:e,disabled:t,onResolved:n}){let r=Dt(),i=R({queryKey:[Rg,e],queryFn:()=>L.sessions.listUserQuestions(e),enabled:!!e,retry:!1,staleTime:0}),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),l=(0,G.useRef)(null),u=(0,G.useMemo)(()=>i.data?.questions??[],[i.data]),d=u.filter(e=>e.status===`pending`),f=e?zg(e):new Set;if(s?.sessionId===e)for(let e of s.ids)f.add(e);let p=d.findLast(e=>!f.has(e.id))?.id??null,m=a?.sessionId===e&&d.some(e=>e.id===a.id)?a.id:p;return(0,G.useEffect)(()=>{if(!e)return;let t=()=>void r.invalidateQueries({queryKey:[Rg,e],exact:!0}),n=L.eventBus.on(Vt.ncpEvent,n=>{if(n.type!==X.MessageSent||n.payload.sessionId!==e)return;let{message:r}=n.payload;(typeof r.metadata?.nextclaw_user_question_id==`string`||r.parts.some(e=>e.type===`extension`&&e.extensionType===`nextclaw.user-question`))&&t()}),i=L.eventBus.on(Vt.sessionRunQueueUpdated,n=>{n.sessionKey===e&&t()});return()=>{n(),i()}},[r,e]),{questions:u,openId:m,openQuestion:(t,n)=>{e&&(l.current=n??null,o({sessionId:e,id:t}))},closeQuestion:()=>{if(e){let t=new Set([...zg(e),...d.map(e=>e.id)]);Bg(e,t),c({sessionId:e,ids:t})}o(null),l.current?.focus(),l.current=null},sessionId:e,disabled:t,onResolved:n,refresh:async()=>{e&&await r.invalidateQueries({queryKey:[Rg,e],exact:!0})},error:!!i.error}}var Hg=(0,G.createContext)(null);function Ug({children:e,sessionId:t,disabled:n,onResolved:r}){let i=Vg({sessionId:t,disabled:n,onResolved:r});return(0,K.jsx)(Hg.Provider,{value:i,children:e})}function Wg({data:e}){let t=(0,G.useContext)(Hg),n=e&&typeof e==`object`&&!Array.isArray(e)?e.questions:null;return Array.isArray(n)?(0,K.jsx)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5 align-middle`,children:n.map(e=>{if(!e||typeof e!=`object`||typeof e.id!=`string`||typeof e.title!=`string`)return null;let n=t?.questions.find(t=>t.id===e.id),r=n?.status??`pending`,i=U(r===`answered`?`chatUserQuestionAnswered`:r===`dismissed`?`chatUserQuestionDismissed`:`chatUserQuestionPending`);return r===`pending`?(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":t?.openId===e.id,onClick:n=>t?.openQuestion(e.id,n.currentTarget),className:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/60 px-2 py-1 text-xs leading-4 text-foreground transition-colors hover:border-[var(--interaction-selection-border)] hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,K.jsx)(Ko,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.title}),(0,K.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:i})]},e.id):(0,K.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-md bg-muted/40 px-2 py-1 text-xs leading-4 text-muted-foreground`,title:n?.answer,children:[(0,K.jsx)(`span`,{className:`truncate`,children:e.title}),(0,K.jsxs)(`span`,{children:[`· `,i]})]},e.id)})}):null}function Gg({data:e}){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e;if(typeof t.questionId!=`string`||typeof t.title!=`string`)return null;let n=t.action===`dismissed`,r=U(n?`chatUserQuestionDismissed`:`chatUserQuestionReplyReference`),i=n?po:Zn;return(0,K.jsxs)(`blockquote`,{"data-chat-question-reference-id":t.questionId,"data-chat-question-message-id":t.questionMessageId??void 0,"aria-label":`${r}:${t.title}`,title:`${r}:${t.title}`,className:`mb-2 flex max-w-full items-center gap-1.5 border-l-2 border-current/35 py-0.5 pl-2 text-xs leading-4 opacity-70`,children:[(0,K.jsx)(i,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:t.title})]})}function Kg({question:e,pending:t,state:n}){let[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),p=(0,G.useRef)(null),m=(0,G.useRef)(null),h=(0,G.useRef)(!1);(0,G.useEffect)(()=>{p.current?.focus()},[]),(0,G.useEffect)(()=>{e.options?.length||m.current?.focus()},[e.options]);let g=async(t,r)=>{if(!(!n.sessionId||h.current||t===`answer`&&!r?.trim())){h.current=!0,u(!0),f(null),o(t===`answer`&&e.options?.includes(r??``)?r??null:null);try{let i=await L.sessions.resolveUserQuestion(n.sessionId,e.id,{action:t,...t===`answer`?{answer:r?.trim()}:{}});n.closeQuestion(),await n.refresh(),i.handle&&await n.onResolved(i.handle)}catch(e){o(null),f(e instanceof Error?e.message:U(`chatUserQuestionFailed`))}finally{h.current=!1,u(!1)}}};return(0,K.jsxs)(`div`,{ref:p,role:`dialog`,"aria-label":e.title,tabIndex:-1,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),n.closeQuestion())},className:`max-h-[min(70vh,30rem)] overflow-y-auto rounded-2xl border border-border bg-card p-3 text-card-foreground shadow-card outline-none sm:p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-sm text-muted-foreground`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(fo,{"aria-hidden":`true`,className:`h-4 w-4`}),U(`chatUserQuestionPanelHeading`)]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":U(`chatUserQuestionClose`),onClick:n.closeQuestion,className:`-mr-1 rounded-md p-1 hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,K.jsx)(Vr,{className:`h-4 w-4`})})]}),t.length>1?(0,K.jsx)(`nav`,{"aria-label":U(`chatUserQuestionsLabel`),className:`mt-3 flex gap-1.5 overflow-x-auto pb-1`,children:t.map(t=>(0,K.jsx)(`button`,{type:`button`,"aria-current":t.id===e.id?`true`:void 0,onClick:()=>n.openQuestion(t.id),className:`shrink-0 rounded-md px-2 py-1 text-xs text-muted-foreground hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring aria-[current=true]:bg-[var(--interaction-selection)] aria-[current=true]:text-foreground`,children:t.title},t.id))}):null,(0,K.jsx)(`h2`,{className:`mt-3 text-base font-semibold leading-6`,children:e.title}),(0,K.jsx)(ni,{delayDuration:180,children:(0,K.jsx)(`div`,{className:`mt-2 space-y-0.5`,children:e.options?.map((t,r)=>{let i=e.optionDescriptions?.[t];return(0,K.jsxs)(`div`,{className:V(`group flex min-h-10 w-full items-center rounded-xl transition-colors hover:bg-[var(--interaction-hover)]`,e.recommendedOption===t&&`bg-[var(--interaction-selection)]`),children:[(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,disabled:n.disabled||l,onClick:()=>void g(`answer`,t),className:`flex min-h-10 min-w-0 flex-1 items-center gap-2.5 rounded-xl px-2 py-1.5 text-left text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-muted/50 text-xs text-muted-foreground`,children:r<26?String.fromCharCode(65+r):r+1}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:t}),e.recommendedOption===t?(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:U(`chatUserQuestionRecommended`)}):null,l&&a===t?(0,K.jsx)(Rr,{"aria-label":U(`chatUserQuestionSending`),className:`h-4 w-4 animate-spin`}):(0,K.jsx)(to,{"aria-hidden":`true`,className:V(`h-4 w-4 shrink-0 text-muted-foreground transition-opacity`,e.recommendedOption===t?`opacity-70`:`opacity-0 group-hover:opacity-70 group-focus-within:opacity-70`)})]}),i?(0,K.jsxs)(ai,{open:s===t,onOpenChange:e=>c(e?t:null),children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":`${t}:${U(`chatUserQuestionOptionHelp`)}`,onClick:()=>c(s===t?null:t),className:`mr-2 flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,K.jsx)(fo,{"aria-hidden":`true`,className:`h-4 w-4`})})}),(0,K.jsx)(ui,{side:`top`,align:`end`,className:`max-w-64 whitespace-normal break-words text-xs`,children:i})]}):null]},t)})})}),(0,K.jsxs)(`div`,{className:`mt-2 flex h-10 items-center gap-2.5 px-2`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border bg-muted/50 text-xs text-muted-foreground`,children:(e.options?.length??0)<26?String.fromCharCode(65+(e.options?.length??0)):(e.options?.length??0)+1}),(0,K.jsx)(`input`,{ref:m,"aria-label":U(`chatUserQuestionAnswerLabel`),value:r,disabled:n.disabled||l,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g(`answer`,r))},placeholder:U(`chatUserQuestionAnswerPlaceholder`),className:`min-w-0 flex-1 border-0 bg-transparent p-0 text-sm text-foreground outline-none placeholder:text-muted-foreground disabled:opacity-50`}),(0,K.jsx)(`button`,{type:`button`,disabled:n.disabled||l,onClick:()=>void g(`dismiss`),className:`h-8 shrink-0 rounded-full border border-border px-3 text-xs hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50`,children:U(`chatUserQuestionDismiss`)}),(0,K.jsx)(`button`,{type:`button`,disabled:n.disabled||l||!r.trim(),onClick:()=>void g(`answer`,r),className:`h-8 shrink-0 rounded-full bg-primary px-3 text-xs font-medium text-primary-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:bg-muted disabled:text-muted-foreground`,children:U(l&&!a?`chatUserQuestionSending`:`chatUserQuestionSend`)})]}),d?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-destructive`,children:d}):null]})}function qg(){let e=(0,G.useContext)(Hg),t=hg(e=>e.layout);if(!e?.sessionId)return null;let n=e.questions.filter(e=>e.status===`pending`),r=n.find(t=>t.id===e.openId);if(!n.length&&!e.error)return null;let i=(0,K.jsxs)(`div`,{className:V(`relative mx-auto w-full`,t!==`flat`&&`max-w-[min(1120px,100%)] px-3 sm:px-4`),"aria-label":U(`chatUserQuestionsLabel`),children:[r?(0,K.jsx)(Kg,{question:r,pending:n,state:e},r.id):null,n.length&&!r?(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:t=>e.openQuestion(n[n.length-1].id,t.currentTarget),className:`inline-flex items-center gap-1.5 rounded-md px-1.5 py-1 text-xs text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,K.jsx)(Ko,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),U(`chatUserQuestionsPendingCount`).replace(`{{count}}`,String(n.length))]}):null,e.error?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void e.refresh(),className:`ml-2 text-xs text-destructive underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[U(`chatUserQuestionFailed`),` · `,U(`chatHistoryRetry`)]}):null]});return t===`flat`?(0,K.jsx)(gg,{width:`composer`,children:i}):(0,K.jsx)(`div`,{className:`bg-background`,children:i})}var Jg=[`cmd`,`command`,`query`,`q`,`path`,`url`,`to`,`channel`,`agentId`,`sessionKey`];function Yg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xg(e,t=2400){return e.length<=t?e:`${e.slice(0,t)}\n…`}function Zg(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:t<=1?`…`:`${n.slice(0,t-1)}…`}function Qg(e){if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`boolean`)return String(e);if(e==null)return``;try{return Xg(JSON.stringify(e,null,2))}catch{return String(e)}}function $g(e){if(Yg(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 Yg(e)?e:null}catch{return null}}function e_(e){let t=$g(e);if(!t){let t=Qg(e).trim();return t?Zg(t,120):void 0}let n=[];for(let e of Jg){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 Zg(n.join(` · `),120)}function t_(e){return typeof e==`string`&&e.trim()?e.trim():null}function n_(e){let t=t_(e.messageId),n=t_(e.excerpt),{role:r}=e;return t&&n&&(r===`assistant`||r===`user`)?{messageId:t,role:r,excerpt:n}:null}function r_(e,t){let n=n_(e.data??{});return n?{kind:ie,key:e.tokenKey,label:e.label,rawText:t,...n}:null}function i_(e){let{entry:t,label:n,rawText:r}=e,i=t_(t.key),a=n_(t);return i&&a?{kind:ie,key:i,label:n,rawText:r,...a}:null}function a_(e){return Pn({tokenKind:ln,tokenKey:e.uri,label:e.label,data:{reference:e}})}function o_(e,t){return e.some(e=>e.type===`token`&&e.tokenKind===`system_object`&&e.tokenKey===t.uri&&k(e.data?.reference)?.version===t.version)?Dn([...e]):Dn([...e,a_(t)])}var s_=`$`,c_=`@panel-app:`,l_=`@project:`,u_=`@file:`,d_=`@folder:`,f_=`@excerpt:`,p_=`@message-excerpt:`,m_=`@object:`,h_=`@resource:`;function g_(e){let{label:t,tokenKey:n,tokenKind:r}=e;return r===`skill`?`${s_}${t?.trim()||n}`:r===`panel_app`?`${c_}${n}`:r===`project`?`${l_}${encodeURIComponent(n)}`:r===`workspace_file`?`${u_}${encodeURIComponent(n)}`:r===`workspace_directory`?`${d_}${encodeURIComponent(n)}`:r===`workspace_excerpt`?`${f_}${encodeURIComponent(n)}`:r===`conversation_excerpt`?`${p_}${encodeURIComponent(n)}`:r===`system_object`?`${m_}${encodeURIComponent(n)}`:r===`ui_resource`?`${h_}${encodeURIComponent(n)}`:null}function __(e){return typeof e==`string`&&e.trim()?e.trim():null}function v_(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function y_(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 b_(e,t){let n=__(e.data?.path),r=__(e.data?.excerpt);return!n||!r?null:{kind:Pe,key:e.tokenKey,path:n,label:e.label,excerpt:r,startLine:v_(e.data?.startLine),endLine:v_(e.data?.endLine),rawText:t}}function x_(e,t){if(e.tokenKind===`workspace_excerpt`)return b_(e,t);if(e.tokenKind===`conversation_excerpt`)return r_(e,t);if(e.tokenKind===`system_object`){let n=k(e.data?.reference);return n?.uri===e.tokenKey?{kind:ln,key:e.tokenKey,label:e.label,rawText:t,reference:n}:null}if(e.tokenKind===`ui_resource`){let n=me(e.data?.reference);return n?.uri===e.tokenKey?{kind:ve,key:e.tokenKey,label:e.label,rawText:t,reference:n}:null}}function S_(e,t=[]){let n=new Map(t.map(e=>[e.ref,e])),r=[];for(let t of e){if(t.type!==`token`)continue;let e=g_(t);if(!e)continue;if(t.tokenKind===`skill`){let i=n.get(t.tokenKey);i?.path.trim()&&r.push({kind:`skill`,ref:i.ref,name:i.name,source:i.source,path:i.path,label:t.label,rawText:e});continue}if(t.tokenKind===`project`){r.push({kind:Te,key:t.tokenKey,label:t.label,rawText:e});continue}let i=x_(t,e);if(i!==void 0){i&&r.push(i);continue}if(t.tokenKind===`workspace_file`||t.tokenKind===`workspace_directory`){let n=t.tokenKind===`workspace_file`?I:T;r.push({kind:n,key:t.tokenKey,label:t.label,rawText:e})}}return y_(r)}var C_=`@panel-app:`,w_=/@panel-app:([A-Za-z0-9_-]+)/g,T_=/@project:([^\s]+)/g,E_=/@file:([^\s]+)/g,D_=/@folder:([^\s]+)/g,O_=/@object:([^\s]+)/g,k_=/@resource:([^\s]+)/g;function A_(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 j_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function M_(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function N_(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:null}function P_(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 F_(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 I_(e){let t=[];for(let n of e.matchAll(w_)){let e=n[1];e&&t.push({kind:`panel_app`,key:e,label:e,rawText:`${C_}${e}`})}return F_({kind:Te,pattern:T_,text:e,tokens:t}),F_({kind:ln,pattern:O_,text:e,tokens:t}),F_({kind:ve,pattern:k_,text:e,tokens:t}),F_({kind:I,pattern:E_,text:e,tokens:t}),F_({kind:T,pattern:D_,text:e,tokens:t}),P_(t)}function L_(e,t){let n=I_(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 P_([...t,...n])}function R_(e){let t=e?.[fe];if(Array.isArray(t))return H_(t);if(!j_(t)||t.schemaVersion!==2||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){let t=B_(e);t&&n.push(t)}return P_(n)}function z_(e){return e===`builtin`||e===`global`||e===`project`||e===`workspace`?e:null}function B_(e){if(!j_(e))return null;let t=M_(e.kind),n=M_(e.rawText),r=M_(e.label);if(!t||!r||!n)return null;if(t===`skill`){let i=M_(e.ref),a=M_(e.name),o=M_(e.path),s=z_(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 V_({entry:e,label:r,rawText:n});if(t===`conversation_excerpt`)return i_({entry:e,label:r,rawText:n});if(t===`system_object`){let i=M_(e.key),a=k(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=M_(e.key),a=me(e.reference);return i&&a&&a.uri===i?{kind:t,key:i,label:r,rawText:n,reference:a}:null}let i=M_(e.key);return i?{kind:t,key:i,rawText:n,label:r}:null}function V_(e){let{entry:t,label:n,rawText:r}=e,i=M_(t.key),a=M_(t.path),o=M_(t.excerpt);return i&&a&&o?{kind:Pe,key:i,path:a,label:n,excerpt:o,startLine:N_(t.startLine),endLine:N_(t.endLine),rawText:r}:null}function H_(e){let t=[];for(let n of e){if(!j_(n))continue;let e=M_(n.kind),r=M_(n.key),i=M_(n.rawText);if(!e||!r||!i)continue;let a=M_(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 P_(t)}function U_(e){return{schemaVersion:2,items:e}}var W_=/\u200B|\u200C|\u200D|\u2060|\uFEFF/g;function G_(e){let t=e.trim();return t&&t.replace(W_,``).trim()?t:null}function K_(e,t){let n=G_(e.text);if(!n)return null;let r=L_(e.text,t);return{type:`markdown`,text:n,inlineTokens:r.length>0?r:void 0}}function q_(e){return G_(e)}function J_(e){return typeof e==`object`&&!!e}function Y_(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function X_(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 Z_(e){return J_(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 Q_(e){return typeof e==`string`?e.trim().toLowerCase():``}function $_(e){if(!Z_(e))return null;let t=Q_(e.status??e.outcome);if(e.cancelled===!0||e.aborted===!0||t===`cancelled`||t===`canceled`||t===`aborted`||t===`interrupted`)return`cancelled`;let n=X_(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 ev(e,t){if(!J_(e))return null;let n=J_(e.asset)?e.asset:Array.isArray(e.assets)&&e.assets.length>0&&J_(e.assets[0])?e.assets[0]:null;if(!n)return null;let r=Y_(n.url),i=Y_(n.mimeType)??`application/octet-stream`,a=X_(n.sizeBytes);return r?{type:`file`,file:{label:Y_(n.name)??(i.startsWith(`image/`)?t.imageAttachmentLabel:t.fileAttachmentLabel),mimeType:i,dataUrl:r,...a==null?{}:{sizeBytes:a},isImage:i.startsWith(`image/`)}}:null}function tv(e,t){let n=(e.statusTone===`success`?$_(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 nv(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 rv(e){return typeof e==`object`&&!!e}function iv(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 av(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function ov(e){let t=iv(e);return rv(t)?av(t.agentId):null}function sv(e){return ov(e.parsedArgs)??ov(e.args)??ov(e.result)}var cv=12e3,lv=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function uv(e){let t=e.replace(/\r\n/g,`
|
|
3
|
+
`).replace(/\r/g,`
|
|
4
|
+
`);return t===``?[]:t.split(`
|
|
5
|
+
`)}function dv(e){return typeof e==`number`?e+1:void 0}function fv(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 pv(e){let t=lv.exec(e);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}function mv(e){let{kind:t,newStartLine:n,oldStartLine:r,text:i}=e;return uv(i).map((e,i)=>fv(t===`add`?{kind:`add`,text:e,newLineNumber:n+i}:{kind:`context`,text:e,oldLineNumber:r+i,newLineNumber:n+i}))}function hv(e){let{afterLines:t,beforeLines:n,newStartLine:r,oldStartLine:i}=e,a=i,o=r;return[...n.map(e=>{let t=fv({kind:`remove`,text:e,oldLineNumber:a});return a=dv(a),t}),...t.map(e=>{let t=fv({kind:`add`,text:e,newLineNumber:o});return o=dv(o),t})]}function gv(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 _v(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(fv({kind:`remove`,text:i[e]??``,oldLineNumber:c})),c=dv(c);for(let e=t;e<n.length;e+=1)a.push(fv({kind:`add`,text:n[e]??``,newLineNumber:l})),l=dv(l)}function vv(e){let{afterText:t,beforeText:n,newStartLine:r,oldStartLine:i}=e,a=uv(n),o=uv(t);if(a.length*o.length>cv)return hv({beforeLines:a,afterLines:o,oldStartLine:i,newStartLine:r});let s=gv({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(fv({kind:`context`,text:a[l]??``,oldLineNumber:d,newLineNumber:f})),l+=1,u+=1,d=dv(d),f=dv(f);continue}if((s[l+1][u]??0)>=(s[l][u+1]??0)){c.push(fv({kind:`remove`,text:a[l]??``,oldLineNumber:d})),l+=1,d=dv(d);continue}c.push(fv({kind:`add`,text:o[u]??``,newLineNumber:f})),u+=1,f=dv(f)}return _v({lines:c,beforeLines:a,afterLines:o,beforeIndex:l,afterIndex:u,oldLineNumber:d,newLineNumber:f}),c}var yv=120;function bv(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 xv(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 Sv(e){return e.length<=yv?{lines:e,truncated:!1}:{lines:e.slice(0,yv),truncated:!0}}function Cv(e){let{lines:t,operation:n,path:r}=e,i=Sv(t);return{path:r,display:`diff`,caption:bv({operation:n,lines:t}),lines:i.lines,...i.truncated?{fullLines:t}:{},truncated:i.truncated}}function wv(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=mv({text:o,kind:s,oldStartLine:c,newStartLine:l});return{path:i,display:`preview`,caption:bv({operation:r,lines:u}),lines:u,rawText:o,oldStartLine:c,newStartLine:l}}function Tv(e){let{afterText:t,beforeText:n,operation:r,path:i}=e,{oldStartLine:a,newStartLine:o}=xv(e),s=vv({beforeText:n??``,afterText:t??``,oldStartLine:a,newStartLine:o}),c=Sv(s);return c.lines.length===0?null:{path:i,display:`diff`,caption:bv({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 Ev(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 Dv(e){let{currentLines:t,line:n,newLineNumber:r,oldLineNumber:i}=e;return n.startsWith(`+`)?(t.push(fv({kind:`add`,text:n.slice(1),newLineNumber:r})),{oldLineNumber:i,newLineNumber:dv(r)}):n.startsWith(`-`)?(t.push(fv({kind:`remove`,text:n.slice(1),oldLineNumber:i})),{oldLineNumber:dv(i),newLineNumber:r}):n.startsWith(` `)?(t.push(fv({kind:`context`,text:n.slice(1),oldLineNumber:i,newLineNumber:r})),{oldLineNumber:dv(i),newLineNumber:dv(r)}):{oldLineNumber:i,newLineNumber:r}}function Ov(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(Cv({path:n,operation:r,lines:i})),n=null,r=null,i=[],a=void 0,o=void 0};for(let t of uv(e)){if(Ev({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=pv(t);a=e?.oldLineNumber,o=e?.newLineNumber;continue}if(!n)continue;let e=Dv({currentLines:i,line:t,oldLineNumber:a,newLineNumber:o});a=e.oldLineNumber,o=e.newLineNumber}return s(),t}function kv(e){let t=[],n=null,r=[],i,a,o=()=>{if(!n){r=[],i=void 0,a=void 0;return}t.push(Cv({path:n,operation:`update`,lines:r})),n=null,r=[],i=void 0,a=void 0};for(let t of uv(e)){if(t.startsWith(`+++ `)){o(),n=t.slice(4).trim().replace(/^b\//,``).replace(/^a\//,``);continue}if(t.startsWith(`--- `))continue;if(t.startsWith(`@@`)){let e=pv(t);i=e?.oldLineNumber,a=e?.newLineNumber;continue}if(!n)continue;let e=Dv({currentLines:r,line:t,oldLineNumber:i,newLineNumber:a});i=e.oldLineNumber,a=e.newLineNumber}return o(),t}function Av(e){return e.includes(`*** Begin Patch`)?Ov(e):e.includes(`--- `)&&e.includes(`+++ `)?kv(e):[]}function jv(e){switch(e){case`"`:case`\\`:case`/`:return e;case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
|
|
6
|
+
`;case`r`:return`\r`;case`t`:return` `;default:return e}}function Mv(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 Nv(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+=jv(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 Pv(e,t,n=1/0){for(let r of t){let t=Mv(e,r);if(t!=null)return Nv(e,t,n)}return null}function Fv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Iv(e){return typeof e==`string`&&e.trim()?e.trim():null}function Lv(e){return typeof e==`number`&&Number.isInteger(e)&&e>0?e:typeof e==`string`&&/^\d+$/.test(e.trim())?Number(e.trim()):null}function Rv(e){if(Fv(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 Fv(e)?e:null}catch{return null}}function zv(e){if(Fv(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t.startsWith(`{`))return null;let n=Pv(t,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`])?.value??null,r=Pv(t,[`content`,`text`,`afterText`,`after_text`])?.value??null,i=Pv(t,[`oldText`,`beforeText`,`before_text`])?.value??null,a=Pv(t,[`newText`,`afterText`,`after_text`])?.value??null,o=Pv(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 Bv(e){return Iv(e.path)??Iv(e.filePath)??Iv(e.file_path)??Iv(e.targetPath)??Iv(e.target_path)??Iv(e.filename)??Iv(e.name)}function Vv(e){return Z(e.operation)??Z(e.op)??Z(e.action)??Z(e.kind)??Z(e.type)??Z(e.status)}function Hv(e,t){for(let n of t){let t=Lv(e[n]);if(t!==null)return t}return null}function Uv(e){return Hv(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 Wv(e){return Hv(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 Gv(e){return Z(e.patch)??Z(e.diff)??Z(e.unifiedDiff)??Z(e.unified_diff)}function Kv(e){return Z(e.beforeText)??Z(e.before_text)??Z(e.oldText)??Z(e.old_text)??Z(e.oldContent)??Z(e.old_content)??Z(e.before)??Z(e.previous)}function qv(e){return Z(e.afterText)??Z(e.after_text)??Z(e.newText)??Z(e.new_text)??Z(e.newContent)??Z(e.new_content)??Z(e.content)??Z(e.text)??Z(e.after)??Z(e.updated)}var Jv=new Set([`file_change`,`read_file`,`write_file`,`edit_file`,`apply_patch`]);function Yv(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 Xv(e,t){let n=Bv(e)??t,r=Vv(e),i=Uv(e),a=Wv(e),o=Gv(e);if(o){let e=Av(o);if(e.length>0)return e[0]??null}let s=Kv(e),c=qv(e);if(s!=null||c!=null)return Tv({path:n,beforeText:s,afterText:c,operation:r,oldStartLine:i,newStartLine:a});let l=Z(e.preview);return l?wv({path:n,text:l,operation:r,oldStartLine:i,newStartLine:a}):null}function Zv(e){if(!Array.isArray(e))return[];let t=[];return e.forEach((e,n)=>{if(typeof e==`string`){let n=Av(e);n.length>0&&t.push(...n);return}if(!Fv(e))return;let r=Xv(e,Bv(e)??`file-${n+1}`);if(r){t.push(r);return}let i=Array.isArray(e.changes)?Zv(e.changes):[];i.length>0&&t.push(...i)}),t}function Qv(e){let t=Rv(e.result)??Rv(e.parsedArgs)??Rv(e.args);return t?Yv(Zv(t.changes)):null}function $v(e){let t=Rv(e.parsedArgs)??Rv(e.args)??zv(e.args),n=t&&Bv(t),r=Z(e.result);return!n||!r?null:Yv([wv({path:n,text:r,operation:`read`})].filter(e=>!!e))}function ey(e){if(e.status===`partial-call`&&typeof e.args==`string`){let t=Pv(e.args,[`path`,`filePath`,`file_path`,`targetPath`,`target_path`,`filename`,`name`]),n=Pv(e.args,[`content`,`text`,`afterText`,`after_text`]);if(t?.value&&n?.value){let e=wv({path:t.value,text:n.value,operation:`write`});if(e)return Yv([e])}}let t=Rv(e.parsedArgs)??Rv(e.args)??zv(e.args);if(!t)return null;let n=Bv(t),r=Z(t.content);return!n||!r?null:Yv([wv({path:n,text:r,operation:`write`})].filter(e=>!!e))}function ty(e){let t=Rv(e.result),n=Rv(e.parsedArgs)??Rv(e.args)??zv(e.args);if(!t&&!n)return null;let r=(t?Bv(t):null)??(n?Bv(n):null),i=(t?Kv(t):null)??(n?Kv(n):null),a=(t?qv(t):null)??(n?qv(n):null),o=(t?Uv(t):null)??(n?Uv(n):null),s=(t?Wv(t):null)??(n?Wv(n):null);return!r||i==null&&a==null?null:Yv([Tv({path:r,beforeText:i,afterText:a,operation:`edit`,oldStartLine:o,newStartLine:s})].filter(e=>!!e))}function ny(e){let t=Rv(e.parsedArgs),n=Rv(e.args)??zv(e.args),r=Z(e.args)??(t?Z(t.patch):null)??(n?Z(n.patch):null);return r?Yv(Av(r)):null}function ry(e){return Jv.has(e.toolName)?e.toolName===`file_change`?Qv(e):e.toolName===`read_file`?$v(e):e.toolName===`write_file`?ey(e):e.toolName===`edit_file`?ty(e):e.toolName===`apply_patch`?ny(e):null:null}var iy=[`show_content`,`show_file`,`show_url`,`show_panel_app`];function ay(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function oy(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function sy(e){return Number.isInteger(e)&&typeof e==`number`&&e>0?e:void 0}function cy(e){return e===`file`||e===`url`||e===`panel_app`?e:null}function ly(e){return e===`read`||e===`preview`||e===`edit`||e===`interact`?e:void 0}function uy(e){return e===`inline`||e===`side_panel`?e:void 0}function dy(e){return e===`auto`||e===`source`||e===`rendered`?e:void 0}function fy(e){try{return N(e)}catch{return null}}function py(e){if(!ay(e)||!ay(e.target))return null;let{target:t}=e,{payload:n,type:r}=t,i=cy(r);if(!i||!ay(n))return null;let a=oy(e.title),o=ly(e.purpose),s=uy(e.placement);if(i===`file`){let e=oy(n.path);if(!e)return null;let t=fy(n.params);return t===null||t&&(dy(n.viewer)===`source`||!/\.html?$/i.test(e))?null:{target:{type:`file`,payload:{path:e,line:sy(n.line),column:sy(n.column),viewer:dy(n.viewer),params:t??void 0}},title:a,purpose:o,placement:s}}if(i===`url`){let e=oy(n.url);return e?{target:{type:`url`,payload:{url:e}},title:a,purpose:o,placement:s}:null}let c=oy(n.appId);if(!c)return null;let l=fy(n.params);return l===null?null:{target:{type:`panel_app`,payload:{appId:c,path:oy(n.path),params:l??void 0}},title:a,purpose:o,placement:s}}function my(e){return!ay(e)||e.action!==`showContent`?null:py(e.request)}function hy(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 gy(e){let{actionLabel:t,invocation:n,statusLabel:r}=e;if(!iy.includes(n.toolName))return null;let i=my(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:hy(i),text:void 0,outputData:n.result,hasResult:!0,statusTone:`success`,statusLabel:r,action:a,...o?{panelApp:o}:{}}}function _y(e){return typeof e==`object`&&!!e}function Q(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function vy(e){return!_y(e)||e.kind!==`nextclaw.session_request`?null:e}function yy(e){return!_y(e)||e.kind!==`nextclaw.session`?null:e}function by(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 xy(e){return Qg(by(e)).trim()||void 0}function Sy(e,t){return[Q(e.title)?`title: ${e.title?.trim()}`:null,Q(e.sessionId)?`session: ${e.sessionId?.trim()}`:null,Q(e.task)?`task: ${e.task?.trim()}`:null].filter(e=>!!e).join(` · `)||e_(t)}function Cy(e,t){return[Q(e.title)?`title: ${e.title?.trim()}`:null,Q(e.sessionId)?`session: ${e.sessionId?.trim()}`:null].filter(e=>!!e).join(` · `)||e_(t)}function wy(e){let t=Q(e.requestId),n=Q(e.sessionId),r=Q(e.title),i=Q(e.task),a=Q(e.status),o=Q(e.notify),s=Q(e.wait),c=Q(e.lifecycle),l=Q(e.parentSessionId),u=Q(e.spawnedByRequestId),d=e.message===void 0?``:Qg(e.message).trim(),f=e.finalResponseText===void 0?``:Qg(e.finalResponseText).trim(),p=e.error===void 0?``:Qg(e.error).trim(),m=[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?`Wait: ${s}`:null,c?`Lifecycle: ${c}`:null,l?`Parent Session ID: ${l}`:null,u?`Spawned By Request ID: ${u}`:null,r?`Title: ${r}`:null,i?`Task:\n${i}`:null,f?`Final Response:\n${f}`:p?`Error:\n${p}`:d?`Status:\n${d}`:null].filter(e=>!!e);return m.length>0?m.join(`
|
|
7
|
+
|
|
8
|
+
`):void 0}function Ty(e){let t=Q(e.sessionId),n=Q(e.title),r=Q(e.sessionType),i=Q(e.lifecycle),a=Q(e.parentSessionId),o=Q(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(`
|
|
9
|
+
|
|
10
|
+
`):void 0}function Ey(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=vy(o);if(s){let e=Q(s.status)?.toLowerCase(),t=Sy(s,a),o=wy(s),c=Q(s.sessionId),l=sv({args:a,result:s}),u=c?{kind:`open-session`,sessionId:c,sessionKind:s.isChildSession===!0?`child`:`session`,...l?{agentId:l}:{},...Q(s.title)?{label:s.title.trim()}:{},...Q(s.parentSessionId)?{parentSessionId:s.parentSessionId.trim()}:{}}:void 0;return e===`failed`?{kind:`result`,name:r,detail:t,input:xy(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:xy(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:xy(a),text:o,callId:i||void 0,hasResult:!!o,statusTone:`running`,statusLabel:n.toolStatusRunningLabel,...l?{agentId:l}:{},...u?{action:u}:{}}}let c=yy(o);if(!c)return null;let l=Cy(c,a),u=Ty(c),d=Q(c.sessionId),f=sv({args:a,result:c}),p=d?{kind:`open-session`,sessionId:d,sessionKind:c.isChildSession===!0?`child`:`session`,...f?{agentId:f}:{},...Q(c.title)?{label:c.title.trim()}:{},...Q(c.parentSessionId)?{parentSessionId:c.parentSessionId.trim()}:{}}:void 0;return{kind:`result`,name:r,detail:l,input:xy(a),text:u,callId:i||void 0,hasResult:!!u,statusTone:`success`,statusLabel:n.toolStatusCompletedLabel,...f?{agentId:f}:{},...p?{action:p}:{}}}function Dy(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Oy(e){if(typeof e!=`number`||!Number.isFinite(e))return null;let t=Math.trunc(e);return t>=0?t:null}function ky(e){return e===!0}function Ay(e){let t=e;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t,r=Oy(n.usedContextTokens),i=Oy(n.totalContextTokens),a=Oy(n.prunedUsedContextTokens),o=Dy(n.updatedAt);if(r===null||i===null||a===null||!o)return null;let s=Oy(n.compactedUsedContextTokens),c=Oy(n.fixedInputTokens),l=Oy(n.dynamicInputTokens),u=Oy(n.reservedContextTokens),d=Oy(n.triggerContextTokens),f=Oy(n.availableBeforeCompactionTokens);return{completeInputBudget:ky(n.completeInputBudget),usedContextTokens:r,totalContextTokens:i,prunedUsedContextTokens:a,availableContextTokens:Oy(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:Oy(n.droppedHistoryCount)??0,truncatedToolResultCount:Oy(n.truncatedToolResultCount)??0,truncatedSystemPrompt:ky(n.truncatedSystemPrompt),truncatedUserMessage:ky(n.truncatedUserMessage),compacted:ky(n.compacted),...Dy(n.checkpointId)?{checkpointId:Dy(n.checkpointId)??void 0}:{},compactedMessageCount:Oy(n.compactedMessageCount)??0,...s===null?{}:{compactedUsedContextTokens:s},updatedAt:o}}function jy(e){let{metadata:t}=e;if(!t||Dy(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=Dy(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=Dy(n.continuationMessageId),s=Oy(n.continuationMessageCoveredPartCount),c=typeof n.summary==`string`?n.summary:void 0,l=Oy(n.coveredMessageCount),u=Oy(n.coveredSessionMessageCount),d=Oy(n.originalEstimatedTokens),f=Oy(n.projectedEstimatedTokens),p=Dy(n.createdAt),m=Dy(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 My=vg,Ny=`nextclaw.observation.event`,Py=`ncp.observation.event`;function Fy(e){return e===My||e===Py||e===Ny}function Iy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ly(e,t){let n=e[t];return typeof n==`string`&&n.trim()?n.trim():null}function Ry(e){if(!Iy(e))return null;let t=Ly(e,`deliveryId`),n=Ly(e,`extensionId`),r=Ly(e,`eventId`),i=Ly(e,`eventType`),a=Ly(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 zy(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 By=`inherited_from_session_id`,Vy=`nextclaw.context-compaction`;function Hy(e){let t=e.metadata?.[By];return typeof t==`string`&&t.trim()?t.trim():null}function Uy(e){if(e.parts.length!==1)return null;let t=e.parts[0];return!t||t.type!==`extension`||!Fy(t.extensionType)?null:Ry(t.data)}function Wy(e){return!yg(e)&&!Xe(e)&&!jy(e)&&!Hy(e)}function Gy(e){let t=e.metadata?.[te];return typeof t==`string`&&t.trim()?t.trim():null}function Ky(e,t){return[...e,...t]}function qy(e,t){let n=e.lifecycle?.startedAt??t.lifecycle?.startedAt,r=t.lifecycle?.endedAt??e.lifecycle?.endedAt;return{...e,status:t.status,parts:Ky(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 Jy(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=jy(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=Gy(e);if(g&&yg(e)){l=g;return}if(!Wy(e))return;let _=Uy(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]=qy(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:Vy,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 Yy(e,t={}){return Jy(e,t).messages}function Xy(e){let{rawMessageId:t,rawMessages:n,visibleRawMessages:r}=e,i=n.findIndex(e=>e.id===t);return i<0?r.length-1:Yy(n.slice(0,i)).length-1}function Zy(e){let t=e.findIndex(e=>Hy(e));if(t<0)return null;let n=Hy(e[t]);return n?{boundaryIndex:Yy(e.slice(0,t)).length,sourceSessionId:n,inheritedMessageCount:e.filter(e=>Hy(e)===n).length}:null}function Qy(e){let t=Jy(e.rawMessages),n=t.messages,r=t.observationEvents,i=e.rawMessages.map(e=>({rawMessageId:e.id,checkpoint:jy(e)})).filter(e=>!!(e.checkpoint&&!t.inlineCompactionMessageIds.has(e.rawMessageId))).map(t=>({key:`compaction:${t.rawMessageId}`,checkpoint:t.checkpoint,boundaryIndex:Xy({rawMessages:e.rawMessages,visibleRawMessages:n,rawMessageId:t.rawMessageId})})).sort((e,t)=>e.boundaryIndex-t.boundaryIndex),a=Zy(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 $y(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 eb(e,t){let n=q_(e.reasoning);return n?{type:`reasoning`,text:n,label:t.reasoningLabel}:null}function tb(e,t){let n=e.mimeType.startsWith(`image/`),r=X_(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 nb(e,t){let n=e.toolInvocation,r=ev(n.result,t);if(r)return r;let i=Ey({invocation:n,texts:{toolStatusRunningLabel:t.toolStatusRunningLabel,toolStatusCompletedLabel:t.toolStatusCompletedLabel,toolStatusFailedLabel:t.toolStatusFailedLabel}});if(i)return{type:`tool-card`,card:tv(i,t)};let a=gy({invocation:n,actionLabel:t.showContentActionLabel??`Show content`,statusLabel:t.toolStatusCompletedLabel});if(a)return{type:`tool-card`,card:tv(a,t)};let o=nv({status:n.status,error:n.error,cancelled:n.cancelled,result:n.result,texts:t}),s=$y(n.result),c=Array.isArray(s?.issues)?s.issues.find(e=>typeof e==`string`&&e.trim().length>0):void 0,l=ry({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??e_(n.parsedArgs??n.args),d=c||(typeof n.error==`string`&&n.error.trim()?n.error.trim():``),f=!n.error&&Z_(n.result),p=(!l?.fileOperation||!!n.error)&&!f,m=sv(n);return{type:`tool-card`,card:tv({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||f?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 rb(e,t){return{type:`unknown`,label:t.unknownPartLabel,rawType:typeof e.type==`string`?e.type:`unknown`,text:Qg(e)}}function ib(e){return e.type===`text`&&typeof e.text==`string`}function ab(e){return e.type===`reasoning`&&typeof e.reasoning==`string`}function ob(e){return e.type===`file`&&typeof e.mimeType==`string`&&typeof e.data==`string`}function sb(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 cb(e){if(e.extensionType===`nextclaw.user-question`){let t=typeof e.data==`object`&&e.data!==null?e.data.questions:null;return!Array.isArray(t)||!t.length||typeof t[0]?.id!=`string`?null:{type:`custom`,id:t[0].id,customType:e.extensionType,data:e.data}}if(Fy(e.extensionType)){let t=Ry(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 lb(e){return e.type===`extension`&&`extensionType`in e&&typeof e.extensionType==`string`&&`data`in e}function ub(e){let{inlineTokens:t,part:n,texts:r}=e;return ib(n)?K_(n,t):ab(n)?eb(n,r):ob(n)?tb(n,r):sb(n)?nb(n,r):lb(n)?cb(n)??rb(n,r):rb(n,r)}function db(e){if(e.role!==`user`)return null;let{metadata:t}=e,n=t?.nextclaw_user_question_id,r=t?.nextclaw_user_question_action;if(typeof n!=`string`||r!==`answered`&&r!==`dismissed`)return null;let i=e.parts.find(e=>e.type===`text`),a=i?.type===`text`?/^↳ ([^\n]+)\n([\s\S]*)$/.exec(i.text):null,o=typeof t?.nextclaw_user_question_title==`string`?t.nextclaw_user_question_title:a?.[1];if(!o?.trim())return null;let s=typeof t?.nextclaw_user_question_answer==`string`?t.nextclaw_user_question_answer:a?.[2]??null;return r===`answered`&&!s?.trim()?null:{questionId:n,questionMessageId:typeof t?.nextclaw_user_question_message_id==`string`?t.nextclaw_user_question_message_id:null,title:o,action:r,answer:r===`answered`?s:null}}function fb(e){let t=e.meta?.timestamp;return t&&Number.isFinite(Date.parse(t))?t:new Date().toISOString()}function pb(e,t){return e===`user`?t.user:e===`assistant`?t.assistant:e===`tool`?t.tool:e===`system`?t.system:t.fallback}function mb(e){return e===`user`||e===`assistant`||e===`tool`||e===`system`?e:`message`}function hb(e,t){let n=e.parts.map(n=>ub({part:n,inlineTokens:e.meta?.inlineTokens??[],texts:t.texts})).filter(e=>e!==null),r=n.some(e=>e.type===`custom`&&e.customType===`nextclaw.user-question`),i=e.meta?.userQuestionReply,a=i?[{type:`custom`,id:i.questionId,customType:`nextclaw.user-question-reply`,data:i},...i.answer?[{type:`markdown`,text:i.answer}]:[]]:r?n.filter(e=>e.type!==`markdown`):n;return{id:e.id,role:mb(e.role),roleLabel:pb(e.role,t.texts.roleLabels),timestampLabel:t.formatTimestamp(fb(e)),status:e.meta?.status,processSummary:e.meta?.processSummary,executionSummaryLabel:e.meta?.executionSummaryLabel,moreActions:e.meta?.moreActions,parts:a}}function gb(e){return e.type===`reasoning`||e.type===`tool-invocation`}function _b(e){return e.type===`text`||e.type===`rich-text`?e.text.trim().length>0:e.type===`file`||e.type===`source`||e.type===`card`}function vb(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&&gb(r)){t=n;break}}return t>=0&&t<e.parts.length-1&&e.parts.slice(t+1).some(_b)}function yb(e,t){let n=e.lifecycle?.startedAt,r=e.lifecycle?.endedAt;if(!n||!r)return null;let i=Date.parse(n),a=Date.parse(r);if(!Number.isFinite(i)||!Number.isFinite(a)||a<i)return null;let o=Math.round((a-i)/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60;return U(s>0?c>0?`chatProcessDurationHoursMinutes`:`chatProcessDurationHours`:c>0?`chatProcessDurationMinutesSeconds`:`chatProcessDurationSeconds`,t).replace(`{hours}`,String(s)).replace(`{minutes}`,String(c)).replace(`{seconds}`,String(l))}function bb({message:e,processedLabel:t,language:n}){if(!vb(e))return;let r=yb(e,n);return{label:r?`${t} ${r}`:t}}function xb(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 Sb(e,t){if(e===null)return t;let n=xb(e);return e>=1e3?`${n} (${e})`:n}function Cb(e,t){let n=[];if(e.usage.inputTokens!==null&&n.push(`${xb(e.usage.inputTokens)} ${t.input}`),e.usage.outputTokens!==null&&n.push(`${xb(e.usage.outputTokens)} ${t.output}`),n.length===0&&e.usage.totalTokens!==null&&n.push(`${xb(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 wb(e){let{labels:t,message:n}=e;if(n.role!==`assistant`)return null;let r=Tg(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:Sb(i.inputTokens,t.notAvailable)},{label:t.fields.outputTokens,value:Sb(i.outputTokens,t.notAvailable)},{label:t.fields.cachedInputTokens,value:Sb(i.cachedInputTokens,t.notAvailable)},{label:t.fields.totalTokens,value:Sb(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:Cb(r,t),moreActions:{triggerLabel:t.moreActions,items:[{key:`ai-execution-metadata`,icon:(0,G.createElement)(ro,{className:`h-4 w-4`}),label:t.viewMetadata,dialog:{title:t.metadataTitle,description:t.metadataDescription,closeLabel:t.close,rows:a}}]}}}function Tb(...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 Eb(e){let t=e?.run_spec;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function Db(e){let t=Eb(e)?.model;return typeof t==`string`&&t.trim()?t.trim():Tg(e)?.model}function Ob(e){let{labels:t,message:n}=e,r=Mg(n.metadata);if(!r)return null;let{fields:i}=t,a=Eb(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:Db(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`,icon:(0,G.createElement)(js,{className:`h-4 w-4`}),label:t.viewTrigger,dialog:{title:t.title,description:t.description,closeLabel:t.close,rows:o}}]}}function kb(e){return{roleLabels:{user:U(`chatRoleUser`),assistant:U(`chatRoleAssistant`),tool:U(`chatRoleTool`),system:U(`chatRoleSystem`),fallback:U(`chatRoleMessage`)},reasoningLabel:U(`chatReasoning`),toolCallLabel:U(`chatToolCall`),toolResultLabel:U(`chatToolResult`),toolInputLabel:U(`chatToolInput`),toolNoOutputLabel:U(`chatToolNoOutput`),toolOutputLabel:U(`chatToolOutput`),toolStatusPreparingLabel:U(`chatToolStatusPreparing`),toolStatusRunningLabel:U(`chatToolStatusRunning`),toolStatusCompletedLabel:U(`chatToolStatusCompleted`),toolStatusFailedLabel:U(`chatToolStatusFailed`),toolStatusCancelledLabel:U(`chatToolStatusCancelled`),showContentActionLabel:U(`chatShowContentAction`),imageAttachmentLabel:U(`chatImageAttachment`),fileAttachmentLabel:U(`chatFileAttachment`),unknownPartLabel:U(`chatUnknownPart`)}}function Ab(){return{directory:{running:U(`chatToolDirectoryRunning`),success:U(`chatToolDirectorySuccess`),error:U(`chatToolDirectoryError`),cancelled:U(`chatToolDirectoryCancelled`)},web:{running:U(`chatToolWebRunning`),success:U(`chatToolWebSuccess`),error:U(`chatToolWebError`),cancelled:U(`chatToolWebCancelled`)},message:{running:U(`chatToolMessageRunning`),success:U(`chatToolMessageSuccess`),error:U(`chatToolMessageError`),cancelled:U(`chatToolMessageCancelled`)},session:{running:U(`chatToolSessionRunning`),success:U(`chatToolSessionSuccess`),error:U(`chatToolSessionError`),cancelled:U(`chatToolSessionCancelled`)},agent:{running:U(`chatToolAgentRunning`),success:U(`chatToolAgentSuccess`),error:U(`chatToolAgentError`),cancelled:U(`chatToolAgentCancelled`)},memory:{running:U(`chatToolMemoryRunning`),success:U(`chatToolMemorySuccess`),error:U(`chatToolMemoryError`),cancelled:U(`chatToolMemoryCancelled`)},schedule:{running:U(`chatToolScheduleRunning`),success:U(`chatToolScheduleSuccess`),error:U(`chatToolScheduleError`),cancelled:U(`chatToolScheduleCancelled`)},system:{running:U(`chatToolSystemRunning`),success:U(`chatToolSystemSuccess`),error:U(`chatToolSystemError`),cancelled:U(`chatToolSystemCancelled`)},image:{running:U(`chatToolImageRunning`),success:U(`chatToolImageSuccess`),error:U(`chatToolImageError`),cancelled:U(`chatToolImageCancelled`)},display:{running:U(`chatToolDisplayRunning`),success:U(`chatToolDisplaySuccess`),error:U(`chatToolDisplayError`),cancelled:U(`chatToolDisplayCancelled`)}}}function jb(e){return{input:U(`chatAiExecutionInput`),output:U(`chatAiExecutionOutput`),tokens:U(`chatAiExecutionTokens`),partial:U(`chatAiExecutionPartial`),moreActions:U(`chatMessageMoreActions`),viewMetadata:U(`chatAiExecutionViewMetadata`),metadataTitle:U(`chatAiExecutionMetadataTitle`),metadataDescription:U(`chatAiExecutionMetadataDescription`),close:U(`chatAiExecutionMetadataClose`),notAvailable:U(`chatAiExecutionNotAvailable`),fields:{runId:U(`chatAiExecutionRunId`),runtime:U(`chatAiExecutionRuntime`),model:U(`chatAiExecutionModel`),requestedModel:U(`chatAiExecutionRequestedModel`),outcome:U(`chatAiExecutionOutcome`),inputTokens:U(`chatAiExecutionInputTokens`),outputTokens:U(`chatAiExecutionOutputTokens`),cachedInputTokens:U(`chatAiExecutionCachedInputTokens`),totalTokens:U(`chatAiExecutionTotalTokens`),modelCallCount:U(`chatAiExecutionModelCallCount`),reportedModelCallCount:U(`chatAiExecutionReportedModelCallCount`),usageStatus:U(`chatAiExecutionUsageStatus`)},outcomes:{completed:U(`chatAiExecutionOutcomeCompleted`),failed:U(`chatAiExecutionOutcomeFailed`),aborted:U(`chatAiExecutionOutcomeAborted`)},usageStatuses:{reported:U(`chatAiExecutionUsageReported`),partial:U(`chatAiExecutionUsagePartial`),unavailable:U(`chatAiExecutionUsageUnavailable`)}}}function Mb(e){return{moreActions:U(`chatMessageMoreActions`),viewTrigger:U(`chatRunTriggerView`),title:U(`chatRunTriggerTitle`),description:U(`chatRunTriggerDescription`),close:U(`chatRunTriggerClose`),notAvailable:U(`chatAiExecutionNotAvailable`),fields:{actor:U(`chatRunTriggerActor`),source:U(`chatRunTriggerSource`),triggeredAt:U(`chatRunTriggerTime`),targetRunId:U(`chatRunTriggerTargetRun`),sourceSessionId:U(`chatRunTriggerSourceSession`),sourceMessageId:U(`chatRunTriggerSourceMessage`),sourceRunId:U(`chatRunTriggerSourceRun`),sourceToolCallId:U(`chatRunTriggerSourceToolCall`),sourceRequestId:U(`chatRunTriggerSourceRequest`),sourceModel:U(`chatRunTriggerSourceModel`),targetModel:U(`chatRunTriggerTargetModel`),sourceContext:U(`chatRunTriggerSourceContext`),raw:U(`chatRunTriggerRaw`)},actors:{human:U(`chatRunTriggerActorHuman`),agent:U(`chatRunTriggerActorAgent`),automation:U(`chatRunTriggerActorAutomation`),system:U(`chatRunTriggerActorSystem`)}}}function Nb(e){return{addSelectionToChatLabel:U(`chatWorkspaceAddToChat`),selectionTooLongLabel:U(`chatWorkspaceExcerptSelectionTooLong`),copyCodeLabel:U(`chatCodeCopy`),copiedCodeLabel:U(`chatCodeCopied`),copyMessageLabel:U(`chatMessageCopy`),copiedMessageLabel:U(`chatMessageCopied`),excerptCharacterCountTemplate:U(`chatWorkspaceExcerptCharacterCount`),mermaidDiagramLabel:U(`chatMermaidDiagram`),frontmatterLabel:U(`chatMarkdownFrontmatter`),detailsLabel:U(`chatMarkdownDetails`),mermaidExpandLabel:U(`chatMermaidExpand`),mermaidLoadingLabel:U(`chatMermaidLoading`),mermaidRenderErrorLabel:U(`chatMermaidRenderError`),previewZoomInLabel:U(`chatPreviewZoomIn`),previewZoomOutLabel:U(`chatPreviewZoomOut`),previewResetZoomLabel:U(`chatPreviewResetZoom`),typingLabel:U(`chatTyping`),pendingInputLabel:U(`chatSteeringPending`),reasoningCharacterCountTemplates:{inProgress:U(`chatReasoningInProgressCharacterCount`),completed:U(`chatReasoningCompletedCharacterCount`)},toolStatusLabels:{terminal:{running:U(`chatToolTerminalRunning`),success:U(`chatToolTerminalSuccess`),error:U(`chatToolTerminalError`),cancelled:U(`chatToolTerminalCancelled`)},fileRead:{running:U(`chatToolFileReadRunning`),success:U(`chatToolFileReadSuccess`),error:U(`chatToolFileReadError`),cancelled:U(`chatToolFileReadCancelled`)},fileEdit:{running:U(`chatToolFileEditRunning`),success:U(`chatToolFileEditSuccess`),error:U(`chatToolFileEditError`),cancelled:U(`chatToolFileEditCancelled`)},search:{running:U(`chatToolSearchRunning`),success:U(`chatToolSearchSuccess`),error:U(`chatToolSearchError`),cancelled:U(`chatToolSearchCancelled`)},builtIn:Ab()},attachmentOpenLabel:U(`chatAttachmentOpen`),attachmentAttachedLabel:U(`chatAttachmentAttached`),attachmentExpandLabel:U(`chatAttachmentExpand`),attachmentCloseLabel:U(`chatAttachmentClosePreview`),attachmentCategoryLabels:{archive:U(`chatAttachmentCategoryArchive`),audio:U(`chatAttachmentCategoryAudio`),code:U(`chatAttachmentCategoryCode`),data:U(`chatAttachmentCategoryData`),document:U(`chatAttachmentCategoryDocument`),generic:U(`chatAttachmentCategoryGeneric`),image:U(`chatAttachmentCategoryImage`),pdf:U(`chatAttachmentCategoryPdf`),sheet:U(`chatAttachmentCategorySheet`),video:U(`chatAttachmentCategoryVideo`)},toolActivitySegmentTemplates:{read:{one:U(`chatToolActivityReadOne`),other:U(`chatToolActivityReadOther`)},edit:{one:U(`chatToolActivityEditOne`),other:U(`chatToolActivityEditOther`)},directory:{one:U(`chatToolActivityDirectoryOne`),other:U(`chatToolActivityDirectoryOther`)},search:{one:U(`chatToolActivitySearchOne`),other:U(`chatToolActivitySearchOther`)},bash:{one:U(`chatToolActivityBashOne`),other:U(`chatToolActivityBashOther`)},web:{one:U(`chatToolActivityWebOne`),other:U(`chatToolActivityWebOther`)},agent:{one:U(`chatToolActivityAgentOne`),other:U(`chatToolActivityAgentOther`)},panel:{one:U(`chatToolActivityPanelOne`),other:U(`chatToolActivityPanelOther`)},other:{one:U(`chatToolActivityOtherOne`),other:U(`chatToolActivityOtherOther`)}},toolActivityFailedLabel:U(`chatProcessSummaryFailed`),toolActivityCancelledLabel:U(`chatProcessSummaryCancelled`),toolPayloadLoadingLabel:U(`chatToolPayloadLoading`),toolPayloadLoadFailedLabel:U(`chatToolPayloadLoadFailed`),toolActivityShowMoreTemplate:U(`chatToolActivityShowMore`)}}async function Pb(e){let t=await Cr(e);z[t?`success`:`error`](U(t?`chatCodeCopied`:`chatWorkspaceCopyPathFailed`))}function Fb({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:U(`chatWorkspaceOpen`),icon:(0,K.jsx)(Pr,{className:`h-4 w-4`}),onSelect:s}]},g={key:`manage`,items:m?[...a?[{key:`new-file`,label:U(`chatWorkspaceNewFile`),icon:(0,K.jsx)(bo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>a(d)}]:[],...i?[{key:`new-folder`,label:U(`chatWorkspaceNewFolder`),icon:(0,K.jsx)(wo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>i(d)}]:[],...u?[{key:`upload`,label:U(`chatWorkspaceUploadFilesHere`),icon:(0,K.jsx)(ks,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:()=>u(d)}]:[]]:[]},_={key:`nextclaw`,items:[...p&&r?[{key:`add-to-chat`,label:U(`chatWorkspaceAddToChat`),icon:(0,K.jsx)(Sr,{className:`h-4 w-4`}),restoreFocus:!1,onSelect:()=>r(n,p)}]:[],...t?[{key:`download`,label:U(`chatWorkspaceDownloadFile`),icon:(0,K.jsx)(Nr,{className:`h-4 w-4`}),href:t,download:n.name}]:[]]},v={key:`path`,items:[...l?[{key:`reveal`,label:U(`chatWorkspaceRevealInFileManager`),icon:(0,K.jsx)(Wo,{className:`h-4 w-4`}),onSelect:()=>l(n.path)}]:[],{key:`copy-path`,label:U(`chatWorkspaceCopyPath`),icon:(0,K.jsx)(Qn,{className:`h-4 w-4`}),onSelect:()=>void Pb(n.path)},...p?[{key:`copy-relative-path`,label:U(`chatWorkspaceCopyRelativePath`),icon:(0,K.jsx)(Qn,{className:`h-4 w-4`}),onSelect:()=>void Pb(p)}]:[]]},y={key:`rename`,items:c?[{key:`rename`,label:U(`chatWorkspaceRename`),icon:(0,K.jsx)(Hn,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:c}]:[]},b={key:`danger`,items:o?[{key:`delete`,label:U(`chatWorkspaceDelete`),icon:(0,K.jsx)(Jr,{className:`h-4 w-4`}),destructive:!0,disabled:e,restoreFocus:!1,onSelect:()=>o(n,f)}]:[]};return m?[_,g,v,y,b]:[h,_,v,y,b]}var Ib=`nextclaw.chat.workspace-project-tree.state`,Lb=1,Rb=12,zb=256,Bb=1e7;function Vb(e){return!!e&&typeof e==`object`}function Hb(e){return(e?.trim().replace(/\\/g,`/`).replace(/\/+$/g,``)??``)||(e?.trim()===`/`?`/`:``)}function Ub(e){return e?.trim().replace(/\\/g,`/`).replace(/^\/+|\/+$/g,``).replace(/\/{2,}/g,`/`)??``}function Wb(e){return typeof e!=`number`||!Number.isFinite(e)?0:Math.min(Math.max(0,Math.round(e)),Bb)}function Gb(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0}function Kb(e){return Array.isArray(e)?Array.from(new Set(e.map(e=>typeof e==`string`?Ub(e):``).filter(Boolean))).slice(0,zb):[]}function qb(e){return Vb(e)?Object.entries(e).map(([e,t])=>{let n=Hb(e);return!n||!Vb(t)?null:[n,{expandedPaths:Kb(t.expandedPaths),scrollTop:Wb(t.scrollTop),updatedAt:Gb(t.updatedAt)}]}).filter(e=>e!==null).sort((e,t)=>t[1].updatedAt-e[1].updatedAt).slice(0,Rb).reduce((e,[t,n])=>(e[t]=n,e),{}):{}}function Jb(e){return qb(e)}function Yb(){return{expandedPaths:[],scrollTop:0,updatedAt:Date.now()}}var Xb=ct()(xi(e=>({trees:{},collapseAll:t=>{let n=Hb(t);n&&e(e=>{let t=e.trees[n];return!t||t.expandedPaths.length===0?e:{trees:Jb({...e.trees,[n]:{...t,expandedPaths:[],updatedAt:Date.now()}})}})},setDirectoryExpanded:(t,n,r)=>{let i=Hb(t),a=Ub(n);!i||!a||e(e=>{let t=e.trees[i]??Yb(),n=r?Array.from(new Set([...t.expandedPaths,a])).slice(0,zb):t.expandedPaths.filter(e=>e!==a);return n.length===t.expandedPaths.length&&n.every((e,n)=>e===t.expandedPaths[n])?e:{trees:Jb({...e.trees,[i]:{...t,expandedPaths:n,updatedAt:Date.now()}})}})},setScrollTop:(t,n)=>{let r=Hb(t);if(!r)return;let i=Wb(n);e(e=>{let t=e.trees[r]??Yb();return t.scrollTop===i?e:{trees:Jb({...e.trees,[r]:{...t,scrollTop:i,updatedAt:Date.now()}})}})}}),{name:Ib,version:Lb,storage:Si(()=>window.localStorage),partialize:e=>({trees:e.trees}),merge:(e,t)=>({...t,trees:qb(Vb(e)?e.trees:null)})}));function Zb(e){return`${e.kind===`directory`?U(`chatWorkspaceOpenDirectory`):U(`chatWorkspaceOpenFile`)}: ${e.name}`}function Qb(e){return e instanceof Error?e.message:String(e)}function $b(e){return e.error?Qb(e.error):null}function ex({fileName:e,isDirectory:t,isExpanded:n}){return t?n?(0,K.jsx)(Co,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):(0,K.jsx)(ir,{className:`h-4 w-4 shrink-0 text-muted-foreground`}):(0,K.jsx)(Zh,{fileName:e})}function tx({browseQuery:e,level:t,onFileOpen:n,onRevealPath:r,parentCreateTarget:i,parentRelativePath:a,...o}){let s=e.data?.entries??[],c=$b(e),l={paddingLeft:`${36+t*14}px`};return e.isLoading&&!e.data?(0,K.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-gray-400`,style:l,children:U(`chatWorkspaceLoadingDirectory`)}):c&&!e.data?(0,K.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-rose-600`,style:l,title:c,children:U(`chatWorkspaceDirectoryLoadFailed`)}):s.length===0?(0,K.jsx)(`div`,{className:`h-7 truncate pr-2 text-[11px] leading-7 text-gray-400`,style:l,children:U(`chatWorkspaceDirectoryEmpty`)}):s.map(s=>(0,K.jsx)(ox,{...o,browseParentRefresh:()=>e.refetch(),entry:s,level:t+1,onFileOpen:n,onRevealPath:r,parentCreateTarget:i,relativePath:a?`${a}/${s.name}`:null},s.path))}function nx({entry:e,onRename:t,refresh:n}){let[r,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(e.name),[s,c]=(0,G.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(`${U(`chatWorkspaceRenameFailed`)}: ${Qb(e)}`)}}},updateName:e=>{o(e),c(null)}}}function rx(e,t,n,r){let i=!n&&e!==null&&e===t;return[i,n===null?i:n===r]}function ix(e,t,n,r,i){return e||!!(!i&&t&&r&&n?.startsWith(`${r}/`))}function ax(e,t){let[n,r]=(0,G.useState)(!1),i=Ub(t),a=Xb(t=>!!(e&&i&&t.trees[e]?.expandedPaths.includes(i))),o=Xb(e=>e.setDirectoryExpanded);return{manuallyExpanded:e&&i?a:n,updateExpanded:(0,G.useCallback)(t=>{if(e&&i){o(e,i,t);return}r(t)},[i,o,e])}}function ox({activeRelativePath:e,browseParentRefresh:t,busy:n,createTarget:r,entry:i,level:a,onAddToChat:o,onCreateFolder:s,onCreateFile:c,onDelete:l,onRename:u,onFileOpen:d,onRevealComplete:f,onRevealPath:p,onSelect:m,onUpload:h,parentCreateTarget:g,relativePath:_,renderCreateFolder:v,revealPath:y,selectedPath:b,treeRootKey:x}){let S=(0,G.useRef)(null),C=(0,G.useRef)(null),w=i.kind===`directory`,{manuallyExpanded:T,updateExpanded:E}=ax(x,_),D=ix(T,w,e,_,b),O=nx({entry:i,onRename:u,refresh:t}),k=tc({path:i.path,includeFiles:!0,enabled:w&&D}),A=k.refetch,j=w?null:qt(i.path),M=(0,G.useMemo)(()=>w?{label:i.name,path:i.path,refresh:()=>A(),expand:()=>E(!0)}:g,[i.name,i.path,w,g,A,E]),N=(0,G.useMemo)(()=>({path:i.path,createTarget:M}),[i.path,M]),[P,ee]=rx(e,_,b,i.path);(0,G.useLayoutEffect)(()=>{P&&S.current?.scrollIntoView?.({block:`nearest`})},[P]),(0,G.useLayoutEffect)(()=>{y===i.path&&(S.current?.scrollIntoView?.({block:`nearest`}),m(N),C.current?.focus(),f())},[i.path,f,m,y,N]);let te=()=>{m(N),w?E(!D):d({path:i.path,label:i.name,viewMode:`preview`})},ne=Fb({busy:n,downloadUrl:j,entry:i,onAddToChat:o,onCreateFolder:s,onCreateFile:c,onDelete:l,onOpen:te,onRenameRequest:u?O.start:void 0,onRevealPath:p,onUpload:h,ownCreateTarget:M,parentRefresh:t,relativePath:_});return(0,K.jsxs)(`div`,{role:`treeitem`,"aria-expanded":w?D:void 0,"aria-label":Zb(i),"aria-selected":ee,children:[(0,K.jsx)(xr,{groups:ne,label:U(`chatWorkspaceFileContextMenu`),children:(0,K.jsxs)(`div`,{ref:S,"data-workspace-tree-entry":``,className:V(`group flex h-[26px] w-full min-w-0 items-center text-gray-700 transition-colors hover:bg-[var(--interaction-hover)] focus-within:bg-[var(--interaction-hover)]`,ee?`bg-[var(--interaction-selection)] hover:bg-[var(--interaction-selection)] focus-within:bg-[var(--interaction-selection)]`:null,i.hidden?`opacity-65`:null),style:{paddingLeft:`${6+a*12}px`},onContextMenu:()=>m(N),children:[O.active?(0,K.jsxs)(`form`,{className:`flex h-full min-w-0 flex-1 items-center gap-1`,onSubmit:e=>{e.preventDefault(),O.submit()},children:[(0,K.jsx)(F,{density:`compact`,autoFocus:!0,"aria-label":U(`chatWorkspaceRenameName`),className:`h-6 min-w-0 flex-1 px-1.5`,value:O.name,onChange:e=>O.updateName(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),O.cancel())}}),(0,K.jsx)(W,{icon:(0,K.jsx)(jr,{className:`h-3.5 w-3.5`}),label:U(`chatWorkspaceRename`),size:`sm`,onClick:()=>void O.submit()}),(0,K.jsx)(W,{icon:(0,K.jsx)(Vr,{className:`h-3.5 w-3.5`}),label:U(`cancel`),size:`sm`,onClick:O.cancel})]}):(0,K.jsxs)(`button`,{ref:C,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:te,onKeyDown:e=>{e.key===`F2`&&u&&(e.preventDefault(),O.start())},children:[(0,K.jsx)(`span`,{className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center text-gray-400`,children:w?D?(0,K.jsx)(Mr,{className:`h-3.5 w-3.5`}):(0,K.jsx)(nr,{className:`h-3.5 w-3.5`}):null}),(0,K.jsx)(ex,{fileName:i.name,isDirectory:w,isExpanded:D}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:i.name,children:i.name})]}),O.active?null:(0,K.jsx)(dr,{children:(0,K.jsx)(W,{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,K.jsx)(wr,{className:`h-3.5 w-3.5`}),label:U(`chatWorkspaceMoreActionsFor`).replace(`{name}`,i.name),size:`sm`,tooltipSide:`left`,onClick:()=>m(N)})})]})}),O.error?(0,K.jsx)(`p`,{role:`alert`,className:`py-1 pr-2 text-[11px] text-destructive`,style:{paddingLeft:`${36+a*14}px`},children:O.error}):null,w&&D?(0,K.jsxs)(`div`,{role:`group`,children:[r?.path===i.path?v(a+1):null,(0,K.jsx)(tx,{activeRelativePath:e,browseQuery:k,busy:n,createTarget:r,level:a,onAddToChat:o,onCreateFolder:s,onCreateFile:c,onDelete:l,onRename:u,onFileOpen:d,onRevealComplete:f,onRevealPath:p,onSelect:m,onUpload:h,parentCreateTarget:M,parentRelativePath:_,renderCreateFolder:v,revealPath:y,selectedPath:b,treeRootKey:x})]}):null]})}function sx(e){let t=e.trim();return!!(t&&t!==`.`&&t!==`..`&&!t.includes(`/`)&&!t.includes(`\\`))}function cx({error:e,kind:t,isCreating:n,level:r,name:i,onCancel:a,onNameChange:o,onSubmit:s}){let c=(0,G.useRef)(null),l=(0,G.useRef)(null),u=sx(i);(0,G.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,K.jsxs)(`form`,{ref:c,role:`treeitem`,"aria-label":U(t===`file`?`chatWorkspaceNewFile`:`chatWorkspaceNewFolder`),className:`bg-primary/5`,onSubmit:d,children:[(0,K.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,K.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0`}),t===`file`?(0,K.jsx)(br,{className:`h-4 w-4 shrink-0 text-gray-500`}):(0,K.jsx)(ir,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,K.jsx)(F,{density:`compact`,ref:l,"aria-label":U(t===`file`?`chatWorkspaceFileName`:`chatWorkspaceFolderName`),className:`h-7 min-w-0 flex-1 rounded-md px-2`,disabled:n,placeholder:U(t===`file`?`chatWorkspaceFileNamePlaceholder`:`chatWorkspaceFolderNamePlaceholder`),value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),a())}}),(0,K.jsx)(W,{disabled:!u||n,icon:(0,K.jsx)(jr,{className:`h-3.5 w-3.5`}),label:U(`chatWorkspaceCreateFolder`),size:`sm`,tooltipSide:`top`,onClick:s}),(0,K.jsx)(W,{disabled:n,icon:(0,K.jsx)(Vr,{className:`h-3.5 w-3.5`}),label:U(`cancel`),size:`sm`,tooltipSide:`top`,onClick:a})]}),e?(0,K.jsx)(`p`,{role:`alert`,className:`pb-1 pr-2 text-[11px] text-destructive`,style:{paddingLeft:`${42+r*14}px`},children:e}):null]})}function lx({disabled:e,rootLabel:t,onCollapseAll:n,onNewFile:r,onNewFolder:i,onRefresh:a}){return(0,K.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-0.5 border-b border-border bg-background px-1.5`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-1 text-xs font-medium text-muted-foreground`,title:t,children:t}),(0,K.jsxs)(ti,{children:[(0,K.jsx)(W,{icon:(0,K.jsx)(bo,{className:`h-4 w-4`}),label:U(`chatWorkspaceNewFile`),size:`sm`,disabled:e,onClick:r}),(0,K.jsx)(W,{icon:(0,K.jsx)(wo,{className:`h-4 w-4`}),label:U(`chatWorkspaceNewFolder`),size:`sm`,disabled:e,onClick:i}),(0,K.jsx)(W,{icon:(0,K.jsx)(qr,{className:`h-4 w-4`}),label:U(`chatWorkspaceRefreshExplorer`),size:`sm`,onClick:a}),(0,K.jsx)(W,{icon:(0,K.jsx)(lo,{className:`h-4 w-4`}),label:U(`chatWorkspaceCollapseAll`),size:`sm`,onClick:n}),(0,K.jsx)(dr,{children:(0,K.jsx)(W,{icon:(0,K.jsx)(wr,{className:`h-4 w-4`}),label:U(`chatWorkspaceRootMoreActions`),size:`sm`})})]})]})}function ux(e){let t=e.trim().replace(/\\/g,`/`).replace(/\/+$/g,``)||`/`;return/^[a-z]:/i.test(t)?t.toLowerCase():t}function dx(e,t){if(e[0]!==`server-path-browse`||e[3]!==!0||typeof e[1]!=`string`)return!1;let n=ux(t),r=ux(e[1]);return r===n||(n===`/`?r.startsWith(`/`):r.startsWith(`${n}/`))}function fx({children:e,currentPath:t,onBlankContext:n,onContextMenu:r,rootDraft:i,showRoot:a}){let o=(0,G.useRef)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=Hb(t),u=Xb(e=>l?e.trees[l]?.scrollTop??0:0),d=Xb(e=>e.setScrollTop);return(0,G.useLayoutEffect)(()=>{o.current&&l&&(o.current.scrollTop=u)},[u,l]),(0,G.useEffect)(()=>()=>{c.current&&clearTimeout(c.current),l&&s.current!==null&&d(l,s.current)},[d,l]),(0,K.jsx)(`div`,{ref:o,"data-testid":`workspace-directory-browser`,role:`tree`,tabIndex:-1,"aria-label":U(`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,K.jsxs)(K.Fragment,{children:[i,e]}):e})}function px(e){return e instanceof Error?e.message:String(e)}function mx(e,t){return e.replace(`{count}`,String(t))}function hx(){let[e,t]=(0,G.useState)(null),n=(0,G.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`,()=>jt(e)),createFile:e=>r(`create-file`,()=>Ut(e)),deleteEntry:e=>r(`delete`,()=>_t(e)),renameEntry:e=>r(`rename`,()=>$e(e)),uploadFiles:e=>r(`upload`,()=>Xt(e))}}async function gx({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 ht)||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:U(`chatWorkspaceUploadConflictTitle`),description:mx(U(`chatWorkspaceUploadConflictDescription`),s),confirmLabel:U(`chatWorkspaceReplaceFiles`),variant:`destructive`}))return;a=await e.uploadFiles({basePath:r,targetPath:i.path,files:n,overwrite:!0})}await i.refresh(),z.success(mx(U(`chatWorkspaceUploadSucceeded`),a.files.length))}catch(e){z.error(`${U(`chatWorkspaceUploadFailed`)}: ${px(e)}`)}}async function _x({actions:e,confirm:t,entry:n,refresh:r,rootPath:i}){let a=n.kind===`directory`;if(!await t({title:U(a?`chatWorkspaceDeleteFolderTitle`:`chatWorkspaceDeleteFileTitle`).replace(`{name}`,n.name),description:U(a?`chatWorkspaceDeleteFolderDescription`:`chatWorkspaceDeleteFileDescription`),confirmLabel:U(`chatWorkspaceDelete`),variant:`destructive`}))return;let o=z.loading(U(`chatWorkspaceDeleting`).replace(`{name}`,n.name));try{let t=await e.deleteEntry({basePath:i,path:n.path});return await r(),z.dismiss(o),z.success(U(`chatWorkspaceDeleteSucceeded`).replace(`{name}`,n.name)),t}catch(e){return z.dismiss(o),z.error(`${U(`chatWorkspaceDeleteFailed`).replace(`{name}`,n.name)}: ${px(e)}`),null}}async function vx({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(),z.success(U(t===`file`?`chatWorkspaceFileCreated`:`chatWorkspaceFolderCreated`)),i}catch(e){return i(`${U(t===`file`?`chatWorkspaceFileCreateFailed`:`chatWorkspaceFolderCreateFailed`)}: ${px(e)}`),null}}function yx({activeRelativePath:e,confirm:t,onEntryDeleted:n,onEntryRenamed:r,rootPath:i}){let a=(0,G.useRef)(null),o=hx(),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(`directory`),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(null),[_,v]=(0,G.useState)(null),[y,b]=(0,G.useState)(null),x=h?.activeRelativePath===e?h.selection:null,S=e=>{b(e),a.current&&(a.current.value=``,a.current.click())},C=t=>{g({activeRelativePath:e,selection:t})},w=(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 _x({actions:o,confirm:t,entry:e,refresh:r,rootPath:i});a&&n?.(a.path)},openCreateFile:e=>w(`file`,e),openCreateFolder:e=>w(`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),z.success(U(`chatWorkspaceRenameSucceeded`).replace(`{name}`,s.name)),s},requestUpload:S,selectEntry:C,setCreateError:m,setCreateName:u,submitCreate:async()=>{if(!i||!s)return;let t=await vx({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 gx({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:x?.createTarget??null,selectedPath:x?.path??null}}}var bx={open:!1,title:``,description:``,confirmLabel:U(`confirm`),cancelLabel:U(`cancel`),variant:`default`,resolve:null};function xx(){let[e,t]=(0,G.useState)(bx),n=(0,G.useCallback)(e=>new Promise(n=>{t({open:!0,title:e.title,description:e.description??``,confirmLabel:e.confirmLabel??U(`confirm`),cancelLabel:e.cancelLabel??U(`cancel`),variant:e.variant??`default`,resolve:e=>{n(e),t(e=>({...e,open:!1,resolve:null}))}})}),[]),r=(0,G.useCallback)(e=>{t(t=>(!e&&t.resolve&&t.resolve(!1),{...t,open:e,resolve:e?t.resolve:null}))},[]);return{confirm:n,ConfirmDialog:(0,G.useCallback)(()=>(0,K.jsx)(oa,{open:e.open,onOpenChange:r,title:e.title,description:e.description||void 0,confirmLabel:e.confirmLabel,cancelLabel:e.cancelLabel,variant:e.variant,onConfirm:()=>e.resolve?.(!0),onCancel:()=>e.resolve?.(!1)}),[e,r])}}var Sx=2*6e4;function Cx(e){let t=e.join(`
|
|
11
|
+
`);(0,G.useEffect)(()=>{let e=t.split(`
|
|
12
|
+
`).filter(Boolean);if(e.length===0)return;let n=!1,r=null,i=null,a=async()=>{try{let t=await nt({directories:e,subscriptionId:r});if(n){await Tt(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(),Sx))}),()=>{n=!0,i&&clearInterval(i),r&&Tt(r).catch(()=>void 0)}},[t])}var wx=[];function Tx(e){return e.split(/[\\/]/).filter(Boolean).pop()??e}function Ex({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:b,showRoot:x,treeRootKey:S}){return r.length===0?(0,K.jsx)(`div`,{className:`px-4 py-8 text-center text-xs text-gray-400`,children:U(`chatWorkspaceDirectoryEmpty`)}):r.map(r=>(0,K.jsx)(ox,{activeRelativePath:e,browseParentRefresh:g,busy:t,createTarget:n,entry:r,level:x?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:b,treeRootKey:S},r.path))}function Dx({busy:e,onCollapseAll:t,onCreateFile:n,onCreateFolder:r,onRefresh:i,onRevealPath:a,onUpload:o,target:s}){return[{key:`manage`,items:[{key:`new-file`,label:U(`chatWorkspaceNewFile`),icon:(0,K.jsx)(bo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:n},{key:`new-folder`,label:U(`chatWorkspaceNewFolder`),icon:(0,K.jsx)(wo,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:r},{key:`upload`,label:U(`chatWorkspaceUploadFilesHere`),icon:(0,K.jsx)(ks,{className:`h-4 w-4`}),disabled:e,restoreFocus:!1,onSelect:o}]},{key:`view`,items:[{key:`refresh`,label:U(`chatWorkspaceRefreshExplorer`),icon:(0,K.jsx)(qr,{className:`h-4 w-4`}),onSelect:i},{key:`collapse`,label:U(`chatWorkspaceCollapseAll`),icon:(0,K.jsx)(lo,{className:`h-4 w-4`}),onSelect:t}]},{key:`path`,items:[...a?[{key:`reveal`,label:U(`chatWorkspaceRevealInFileManager`),icon:(0,K.jsx)(Wo,{className:`h-4 w-4`}),onSelect:()=>a(s.path)}]:[],{key:`copy-path`,label:U(`chatWorkspaceCopyPath`),icon:(0,K.jsx)(Qn,{className:`h-4 w-4`}),onSelect:()=>void Pb(s.path)}]}]}function Ox({activeRelativePath:e,browseQuery:t,ConfirmDialog:n,controller:r,entries:i,onAddToChat:a,onFileOpen:o,onRevealPath:s,rootLabel:c,rootPath:l,showRoot:u}){let d=Dt(),{cancelCreateFolder:f,clearSelection:p,completeReveal:m,submitCreate:h,deleteEntry:g,openCreateFile:_,openCreateFolder:v,requestUpload:y,renameEntry:b,selectEntry:x,setCreateError:S,setCreateName:C,uploadFiles:w}=r.actions,{fileInputRef:T}=r.refs,{createError:E,createKind:D,createName:O,createTarget:k,pendingAction:A,revealPath:j,selectedCreateTarget:M,selectedPath:N}=r.state,P=A!==null,ee=Hb(l),te=Xb(e=>e.collapseAll),F=()=>l?d.refetchQueries({predicate:e=>dx(e.queryKey,l),type:`active`}):t.refetch(),ne=l?{label:c,path:l,refresh:F}:null,I=M??ne,re=e=>(0,K.jsx)(cx,{error:E,kind:D,isCreating:A===`create-directory`||A===`create-file`,level:e,name:O,onCancel:f,onNameChange:e=>{C(e),S(null)},onSubmit:()=>void h()}),ie=(0,K.jsx)(Ex,{activeRelativePath:e,busy:P,createTarget:k,entries:i,fallbackParentTarget:ne??{label:``,path:t.data?.currentPath??``,refresh:F},mutable:!!l,onAddToChat:a,onCreateFile:_,onCreateFolder:v,onDelete:(e,t)=>void g(e,t),onFileOpen:o,onRevealComplete:m,onRename:b,onRevealPath:s,onSelect:x,onUpload:y,refresh:F,relativePaths:!!a,renderCreateFolder:re,revealPath:j,selectedPath:N,showRoot:!1,treeRootKey:ee||null}),ae=(0,K.jsx)(fx,{currentPath:l,onBlankContext:p,rootDraft:k?.path===l?re(0):null,showRoot:u,children:ie}),oe=ne?Dx({busy:P,onCollapseAll:()=>{ee&&te(ee)},onCreateFile:()=>_(ne),onCreateFolder:()=>v(ne),onRefresh:()=>void F(),onRevealPath:s,onUpload:()=>y(ne),target:ne}):[],se=(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,onContextMenu:e=>{e.target.closest(`[data-workspace-tree-entry]`)||p()},children:[l&&I?(0,K.jsx)(lx,{disabled:P,rootLabel:c,onCollapseAll:()=>{ee&&te(ee)},onNewFile:()=>_(I),onNewFolder:()=>v(I),onRefresh:()=>void F()}):null,l?(0,K.jsx)(`input`,{ref:T,type:`file`,multiple:!0,className:`sr-only`,"aria-label":U(`chatWorkspaceUploadFiles`),onChange:e=>void w(Array.from(e.currentTarget.files??[]))}):null,ae,(0,K.jsx)(n,{})]});return ne?(0,K.jsx)(xr,{groups:oe,label:U(`chatWorkspaceRootContextMenu`),children:se}):se}function kx({activeRelativePath:e=null,browseQuery:t,onFileOpen:n,sessionKey:r,renderStatus:i,showRoot:a=!1}){let o=q(),{confirm:s,ConfirmDialog:c}=xx(),l=t.data?.entries??[],u=$b(t),d=a?t.data?.currentPath??null:null,f=Hb(d),p=Xb(e=>f?e.trees[f]?.expandedPaths??wx:wx);Cx((0,G.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?Tx(d):``,h=yx({activeRelativePath:e,confirm:s,onEntryDeleted:o.chatThreadManager.removeWorkspacePath,onEntryRenamed:o.chatThreadManager.renameWorkspacePath,rootPath:d}),g=sa.canRevealPath()?e=>{sa.revealPath(e).then(e=>{e.revealed||z.error(U(`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:U(`chatWorkspaceLoadingDirectory`)}):u&&!t.data?i({tone:`error`,text:`${U(`chatWorkspaceDirectoryLoadFailed`)}: ${u}`}):(0,K.jsx)(Ox,{activeRelativePath:e,browseQuery:t,ConfirmDialog:c,controller:h,entries:l,onAddToChat:_,onFileOpen:n,onRevealPath:g,rootLabel:m,rootPath:d,showRoot:a})}function Ax({name:e,kind:t}){return t===`directory`?(0,K.jsx)(ir,{className:`h-3.5 w-3.5 shrink-0 text-emerald-600`}):(0,K.jsx)(Zh,{fileName:e,size:`compact`})}function jx({browsePath:e,onBrowsePathChange:t,onClose:n,onFileOpen:r}){let i=tc({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,K.jsxs)(`div`,{"data-testid":`workspace-breadcrumb-browser`,className:`flex max-h-72 flex-col overflow-hidden`,children:[(0,K.jsx)(`div`,{className:`border-b border-gray-200 px-2 py-1`,children:(0,K.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,K.jsxs)(G.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`h-5 rounded-sm px-1 text-left hover:bg-[var(--interaction-hover)] 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,K.jsx)(nr,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))})}),(0,K.jsx)(ic,{className:`min-h-0 flex-1 px-1 py-1`,children:i.isLoading?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 px-2 py-4 text-[11px] text-gray-500`,children:[(0,K.jsx)(Rr,{className:`h-3.5 w-3.5 animate-spin`}),U(`loading`)]}):a?(0,K.jsxs)(`div`,{className:`px-2 py-3 text-[11px] text-rose-600`,children:[U(`pathBrowseFailed`),`: `,a]}):o.length>0?(0,K.jsx)(`div`,{className:`space-y-0.5`,children:o.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:V(`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-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e.hidden?`opacity-65`:null),onClick:()=>s(e),children:[(0,K.jsx)(Ax,{kind:e.kind,name:e.name}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.kind===`directory`?(0,K.jsx)(nr,{className:`h-3 w-3 shrink-0 text-gray-300`}):null]},e.path))}):(0,K.jsx)(`div`,{className:`px-2 py-4 text-[11px] text-gray-500`,children:U(`emptyDirectory`)})})]})}function Mx({value:e}){return(0,K.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 Nx({onFileOpen:e,segment:t}){let[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(t.browsePath);return(0,K.jsxs)(_i,{open:n,onOpenChange:e=>{e&&a(t.browsePath),r(e)},children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-current":t.isCurrent?`page`:void 0,className:V(`inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-sm px-1 text-[11px] leading-none transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,t.isCurrent?`font-medium text-foreground`:`text-muted-foreground`),disabled:!t.browsePath,children:[t.kind===`workspace`?(0,K.jsx)(Gn,{className:`h-3 w-3 shrink-0`}):t.kind===`directory`&&t.isCurrent?(0,K.jsx)(ir,{className:`h-3 w-3 shrink-0`}):t.isCurrent?(0,K.jsx)(Zh,{fileName:t.label,size:`compact`}):null,(0,K.jsx)(`span`,{children:t.label})]})}),(0,K.jsx)(hi,{"data-testid":`workspace-breadcrumb-popover`,className:`w-[22rem] rounded-md p-0`,align:`start`,children:(0,K.jsx)(jx,{browsePath:i,onBrowsePathChange:a,onClose:()=>r(!1),onFileOpen:e})})]})}function Px({breadcrumb:e,leading:t,onFileOpen:n,trailing:r}){let i=(0,G.useRef)(null);return(0,G.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,K.jsxs)(`div`,{"data-testid":`workspace-file-breadcrumbs`,title:e.fullPath,className:`flex h-7 min-w-0 shrink-0 items-center border-b border-border/40 bg-muted text-foreground`,children:[t?(0,K.jsx)(`div`,{className:`flex h-full shrink-0 items-center pl-1 pr-0.5`,children:t}):null,(0,K.jsxs)(`div`,{ref:i,"data-testid":`workspace-file-breadcrumb-scroll`,className:`workspace-horizontal-scrollbar flex h-full min-w-0 flex-1 items-center gap-1 overflow-x-auto overflow-y-hidden px-1.5`,children:[(0,K.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 pr-1`,children:e.segments.map((t,r)=>(0,K.jsxs)(G.Fragment,{children:[(0,K.jsx)(Nx,{segment:t,onFileOpen:n}),r<e.segments.length-1?(0,K.jsx)(nr,{className:`h-3 w-3 shrink-0 text-muted-foreground/65`}):null]},t.key))}),e.truncated?(0,K.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:(0,K.jsx)(Mx,{value:U(`chatWorkspacePreviewTruncated`)})}):null]}),r?(0,K.jsx)(`div`,{className:`flex h-full shrink-0 items-center pr-1 pl-0.5`,children:r}):null]})}var Fx=8e3;function Ix(e){return e.match(/\n/g)?.length??0}function Lx(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)+Ix(a.slice(0,l)):null;return{path:o,label:s,excerpt:c,startLine:u,endLine:u===null?null:u+Ix(c)}}function Rx({children:e,fileLabel:t,filePath:n,onAddToChat:r,sourceStartLine:i,sourceText:a}){return(0,K.jsx)(Wn,{actionLabel:U(`chatWorkspaceAddToChat`),className:`h-full min-h-0`,maxCharacters:Fx,selectionTooLongLabel:U(`chatWorkspaceExcerptSelectionTooLong`),onAddToChat:({text:e})=>{let o=Lx({path:n,label:t,selectedText:e,sourceText:a,sourceStartLine:i});o&&r?.(o)},children:e})}function zx(e){let[t,n]=(0,G.useState)(null),r=t?.contentUrl===e?t:null;return(0,G.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 Bx({status:e}){return e===`ready`?null:(0,K.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:U(e===`loading`?`chatWorkspaceLoadingPreview`:`chatWorkspacePreviewFailed`)})}function Vx(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 Hx({contentUrl:e}){let t=(0,G.useRef)(null),n=zx(e),[r,i]=(0,G.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,G.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=!1;return r.replaceChildren(),un(()=>import(`./docx-preview-kPn_EtAr.js`).then(async t=>{await t.renderAsync(n.data,r,r,{breakPages:!0,inWrapper:!0,ignoreLastRenderedPageBreak:!1}),a||(Vx(r),i({contentUrl:e,status:`ready`}))}),__vite__mapDeps([0,1,2])).catch(t=>{a||(console.error(`Failed to render DOCX preview`,t),i({contentUrl:e,status:`error`}))}),()=>{a=!0,r.replaceChildren()}},[e,n.data]),(0,K.jsxs)(`div`,{className:`relative h-full overflow-auto bg-muted/40 p-4 custom-scrollbar`,children:[(0,K.jsx)(Bx,{status:o}),(0,K.jsx)(`div`,{ref:t,className:`workspace-docx-preview min-h-full`,"data-testid":`workspace-content-docx`})]})}function Ux({contentUrl:e}){let t=(0,G.useRef)(null),n=zx(e),[r,i]=(0,G.useState)(null),a=r?.contentUrl===e?r.status:`loading`,o=n.status===`ready`?a:n.status;return(0,G.useEffect)(()=>{let r=t.current;if(!r||!n.data)return;let a=new AbortController,o=null;return r.replaceChildren(),un(async()=>{let{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}=await import(`./aiden0z-pptx-renderer.es-ClCaf_Wh.js`);return{PptxViewer:e,RECOMMENDED_ZIP_LIMITS:t}},__vite__mapDeps([3,1,2])).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,K.jsxs)(`div`,{className:`relative h-full bg-muted/40`,children:[(0,K.jsx)(Bx,{status:o}),(0,K.jsx)(`div`,{ref:t,className:`h-full overflow-auto p-4 custom-scrollbar`,"data-testid":`workspace-content-presentation`})]})}var Wx=500,Gx=100;function Kx(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 qx({contentUrl:e}){let t=zx(e),[n,r]=(0,G.useState)(null),[i,a]=(0,G.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,G.useEffect)(()=>{if(!t.data)return;let n=!1;return un(()=>import(`./xlsx--SB9KlFl.js`).then(i=>{let a=i.read(t.data,{dense:!0,sheetRows:Wx+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,Wx).map(e=>e.slice(0,Gx).map(e=>String(e??``)));return{name:e,rows:r,columnCount:Math.min(Gx,r.reduce((e,t)=>Math.max(e,t.length),0)),truncated:n.length>Wx||n.some(e=>e.length>Gx)}});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,K.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col bg-white`,"data-testid":`workspace-content-spreadsheet`,children:[(0,K.jsx)(Bx,{status:s}),o&&o.sheets.length>1?(0,K.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,K.jsx)(`button`,{type:`button`,className:V(`h-7 shrink-0 rounded-md px-2.5 text-xs transition-colors`,e.name===c?.name?`bg-[var(--interaction-selection)] font-medium text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),onClick:()=>a(e.name),children:e.name},e.name))}):null,c?(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto custom-scrollbar`,children:(0,K.jsxs)(`table`,{className:`min-w-full border-collapse text-xs text-foreground`,children:[(0,K.jsx)(`thead`,{className:`sticky top-0 z-[1] bg-muted`,children:(0,K.jsxs)(`tr`,{children:[(0,K.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,K.jsx)(`th`,{className:`h-7 min-w-24 border border-border px-2 text-center font-medium text-muted-foreground`,children:Kx(t)},t))]})}),(0,K.jsx)(`tbody`,{children:c.rows.map((e,t)=>(0,K.jsxs)(`tr`,{children:[(0,K.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,K.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,K.jsx)(`div`,{className:`shrink-0 border-t border-border bg-muted/60 px-3 py-1.5 text-xs text-muted-foreground`,children:U(`chatWorkspaceSpreadsheetPreviewTruncated`)}):null]})}function Jx(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 Yx({contentUrl:e,label:t}){return(0,K.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,K.jsxs)(`div`,{className:`max-w-sm space-y-1.5`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,title:t,children:t}),(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U(`chatWorkspacePreviewUnsupported`)}),(0,K.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground/80`,children:U(`chatWorkspacePreviewUnsupportedHint`)})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[(0,K.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-[var(--interaction-hover)]`,children:U(`chatWorkspacePreviewDownload`)}),(0,K.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-[hsl(var(--primary-hover))]`,children:U(`chatWorkspacePreviewOpenExternally`)})]})]})}function Xx({contentUrl:e,contentParams:t,label:n,onContentHeightChange:r}){let i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=be(t);(0,G.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=nn(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,K.jsx)(`iframe`,{ref:i,allowFullScreen:!0,className:`h-full w-full border-0 bg-white`,"data-testid":`workspace-html-preview`,name:o,src:ge(e,t),title:n,onLoad:s},o??`no-content-params`)}function Zx({contentUrl:e,contentParams:t,kind:n,label:r,onHtmlContentHeightChange:i}){return n===`image`?(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center overflow-auto bg-white p-4 custom-scrollbar`,children:(0,K.jsx)(`img`,{src:e,alt:r,className:`max-h-full max-w-full object-contain`,"data-testid":`workspace-content-image`})}):n===`audio`?(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center bg-white px-6`,children:(0,K.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,K.jsx)(`div`,{className:`flex h-full items-center justify-center bg-black`,children:(0,K.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,K.jsx)(Xx,{contentUrl:e,contentParams:t,label:r,onContentHeightChange:i}):n===`pdf`?(0,K.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,K.jsx)(Hx,{contentUrl:e}):n===`spreadsheet`?(0,K.jsx)(qx,{contentUrl:e}):n===`presentation`?(0,K.jsx)(Ux,{contentUrl:e}):(0,K.jsx)(Yx,{contentUrl:e,label:r})}function Qx(e){return[`server-path-read`,e.path?.trim()??``,e.basePath??null,e.line??null]}function $x(e){let{basePath:t,enabled:n=!0,line:r,path:i}=e,a=i?.trim()??``;return R({queryKey:Qx({path:a,basePath:t,line:r}),queryFn:()=>Pt({path:a,basePath:t,line:r}),enabled:n&&a.length>0,staleTime:0})}var eS=`h1, h2, h3, h4, h5, h6`,tS=`data-workspace-markdown-heading-index`,nS=16;function rS(e){let t=[],n=[];return e.querySelectorAll(eS).forEach(e=>{e.removeAttribute(tS);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(tS,String(a)),n.push({depth:t.length,index:a,label:r}),t.push(i)}),n}function iS({contentKey:e,documentKey:t,scrollContainerRef:n}){let[r,i]=(0,G.useState)([]),[a,o]=(0,G.useState)(!1),s=(0,G.useRef)(null),c=(0,G.useRef)(0);if((0,G.useEffect)(()=>{c.current=0,o(!1);let e=n.current;if(!e){i([]);return}return i(rS(e)),()=>{e.querySelectorAll(`[${tS}]`).forEach(e=>e.removeAttribute(tS))}},[e,t,n]),r.length===0)return null;let l=U(`chatWorkspaceMarkdownOutline`),u=e=>{!e&&s.current&&(c.current=s.current.scrollTop),o(e)},d=e=>{let t=n.current,r=t?.querySelector(`[${tS}="${e}"]`);if(!t||!r)return;u(!1);let i=t.scrollTop+r.getBoundingClientRect().top-t.getBoundingClientRect().top;t.scrollTo({top:Math.max(0,i-nS)})};return(0,K.jsxs)(_i,{open:a,onOpenChange:u,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(W,{icon:(0,K.jsx)(Uo,{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,K.jsx)(hi,{align:`end`,className:`w-[min(20rem,calc(100vw-1.5rem))] rounded-lg p-1.5`,"data-testid":`workspace-markdown-outline-popover`,children:(0,K.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,K.jsx)(`ul`,{className:`space-y-0.5`,children:r.map(e=>(0,K.jsx)(`li`,{children:(0,K.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-[var(--interaction-hover)] hover:text-gray-950 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border active:bg-[var(--interaction-hover)]`,style:{paddingInlineStart:`${.5+e.depth*.75}rem`},title:e.label,onClick:()=>d(e.index),children:e.label})},e.index))})})})]})}function aS({restorationKey:e,scrollRef:t,isEnabled:n=!0}){let r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=(0,G.useRef)(!1),o=t??r;return(0,G.useLayoutEffect)(()=>{if(!n||!e)return;let t=o.current;if(!t)return;let r=Ni.read(e);i.current=r,a.current=!!r;let s=()=>{!a.current||!r||(t.scrollLeft=r.x,t.scrollTop=r.y,Math.abs(t.scrollTop-r.y)<1&&Math.abs(t.scrollLeft-r.x)<1&&(a.current=!1))},c=()=>{a.current=!1};s();let l=typeof ResizeObserver>`u`?null:new ResizeObserver(s);l?.observe(t);for(let e of t.children)l?.observe(e);let u=typeof MutationObserver>`u`?null:new MutationObserver(()=>{for(let e of t.children)l?.observe(e);s()});return u?.observe(t,{childList:!0,subtree:!0}),t.addEventListener(`wheel`,c,{passive:!0}),t.addEventListener(`touchstart`,c,{passive:!0}),t.addEventListener(`pointerdown`,c),t.addEventListener(`keydown`,c),()=>{l?.disconnect(),u?.disconnect(),t.removeEventListener(`wheel`,c),t.removeEventListener(`touchstart`,c),t.removeEventListener(`pointerdown`,c),t.removeEventListener(`keydown`,c),i.current&&Ni.save(e,i.current),a.current=!1}},[n,e,o]),{onScroll:(0,G.useCallback)(t=>{if(!n||!e||a.current||t.currentTarget.closest(`[hidden]`)!==null)return;let r={x:t.currentTarget.scrollLeft,y:t.currentTarget.scrollTop};i.current=r,Ni.save(e,r)},[n,e]),scrollRef:o}}function oS(e){return e.serverKind?e.serverKind:/\.mdx?$/i.test(e.path)?`markdown`:`text`}function sS(e,t){return t<=0?e:`${e}${e.includes(`?`)?`&`:`?`}refresh=${t}`}function cS(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 lS(e){let{languageHint:t,path:n,startLine:r,text:i}=e,a=r??1;return{key:`preview:${n}`,path:n,display:`preview`,lines:mv({text:i,kind:`context`,oldStartLine:a,newStartLine:a}),rawText:i,languageHint:t??null,oldStartLine:a,newStartLine:a}}function uS(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=vv({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 dS({text:e,tone:t=`muted`}){return(0,K.jsx)(`div`,{className:V(`flex h-full items-center justify-center bg-background px-6 text-center text-sm`,t===`error`?`text-destructive`:`text-muted-foreground`),children:e})}function fS(e){return e instanceof ht&&e.code===`SERVER_PATH_NOT_FOUND`?U(`chatWorkspacePreviewNotFound`):U(`chatWorkspacePreviewFailed`)}function pS({diffBlock:e,fileKey:t}){return e?(0,K.jsx)(mS,{block:e,restorationKey:`workspace-preview:diff:${t}`}):(0,K.jsx)(dS,{text:U(`chatWorkspaceDiffEmpty`)})}function mS({block:e,restorationKey:t,targetColumn:n,targetLine:r}){let{scrollRef:i,onScroll:a}=aS({restorationKey:t,isEnabled:!r});return(0,K.jsx)(`div`,{ref:i,onScroll:a,className:`h-full overflow-auto custom-scrollbar bg-card`,children:(0,K.jsx)(yr,{block:e,layout:`workspace`,targetColumn:n,targetLine:r})})}function hS({fileKey:e,contentUrl:t,contentUrlKind:n,contentLabel:r,contentParams:i,directoryQuery:a,fileBasePath:o,onFileOpen:s,onHtmlContentHeightChange:c,markdownScrollRef:l,onMarkdownScroll:u,previewBlock:d,previewKind:f,previewViewer:p,previewQuery:m,previewText:h,targetColumn:g,targetLine:_}){return t&&n?(0,K.jsx)(Zx,{contentUrl:t,contentParams:i??void 0,kind:n,label:r,onHtmlContentHeightChange:c}):a?.data?(0,K.jsx)(kx,{browseQuery:a,onFileOpen:s,renderStatus:e=>(0,K.jsx)(dS,{...e})}):a?.isLoading&&m?.error&&!d?(0,K.jsx)(dS,{text:U(`chatWorkspaceLoadingDirectory`)}):(a?.isLoading||m?.isLoading)&&!d?(0,K.jsx)(dS,{text:U(`chatWorkspaceLoadingPreview`)}):m?.data?.kind===`binary`?(0,K.jsx)(dS,{text:U(`chatWorkspacePreviewUnsupported`)}):m?.error&&!d?(0,K.jsx)(dS,{tone:`error`,text:fS(m.error)}):f===`markdown`&&p!==`source`&&h?(0,K.jsx)(`div`,{ref:l,onScroll:u,className:`h-full overflow-auto bg-background text-foreground custom-scrollbar px-5 py-4`,children:(0,K.jsx)(sr,{text:h,role:`assistant`,texts:{copyCodeLabel:U(`chatCodeCopy`),copiedCodeLabel:U(`chatCodeCopied`),frontmatterLabel:U(`chatMarkdownFrontmatter`),detailsLabel:U(`chatMarkdownDetails`)},onFileOpen:s,resolveFileContentUrl:e=>qt(e.path,o)})}):d?(0,K.jsx)(mS,{block:d,restorationKey:`workspace-preview:source:${e}`,targetColumn:g,targetLine:_}):(0,K.jsx)(dS,{text:U(`chatWorkspacePreviewEmpty`)})}function gS({breadcrumbLeading:e,file:t,refreshVersion:n=0,sessionProjectRoot:r,sessionWorkingDir:i,showBreadcrumbs:a=!0,onHtmlContentHeightChange:o,onFileOpen:s,onTextExcerptAdd:c}){let l=(0,G.useRef)(null),u=t.viewMode===`preview`,d=t.contentUrl?.trim()||null,f=u&&!d&&t.rawText==null,p=$x({path:t.path,basePath:i,line:t.line,enabled:f}),m=tc({path:t.path,basePath:i,includeFiles:!0,enabled:f}),h=(0,G.useMemo)(()=>t.viewMode===`diff`?uS(t):null,[t]),g=u?p?.data?.text??t.rawText??null:null,_=oS({path:p?.data?.resolvedPath??t.path,serverKind:p?.data?.kind}),v=d?Jx({path:t.path,mimeType:t.mimeType}):null,y=m?.data?.currentPath??p?.data?.resolvedPath??t.path,b=m?.data?`directory`:`file`,x=Xu(y,t.previewViewer),S=Jx({path:y}),C=qt(t.path,i),w=!d&&t.rawText==null&&u&&C&&t.previewViewer!==`source`&&S!==`other`&&(S!==`html`||x===`rendered`)&&C?sS(C,n):null,T=d??w,E=v??(w?S:null),D=(0,G.useMemo)(()=>!u||!g||T?null:lS({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}=aS({restorationKey:cS({contentUrl:T,fileKey:t.key,previewKind:_,previewText:g,previewViewer:x,refreshVersion:n}),scrollRef:l}),A=r??i,j=Hc({path:y,sessionProjectRoot:A})??y.trim(),M=(0,G.useMemo)(()=>Wc({path:y,kind:b,sessionProjectRoot:A,truncated:O}),[A,O,b,y]),N=(0,K.jsx)(hS,{fileKey:t.key,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,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:[a?(0,K.jsx)(Px,{breadcrumb:M,leading:e,onFileOpen:s,trailing:u&&_===`markdown`&&x!==`source`&&g&&!T?(0,K.jsx)(iS,{contentKey:g,documentKey:y,scrollContainerRef:l}):void 0}):null,(0,K.jsx)(`div`,{className:`flex-1 min-h-0 overflow-hidden`,children:t.viewMode===`diff`?(0,K.jsx)(pS,{diffBlock:h,fileKey:t.key}):j&&g&&c?(0,K.jsx)(Rx,{fileLabel:t.label?.trim()||j.split(`/`).at(-1)||j,filePath:j,sourceStartLine:p?.data?.startLine??1,sourceText:g,onAddToChat:c,children:N}):N})]})}var _S=240;function vS({actions:e,children:t,contentHeight:n,isLoading:r=!1}){return(0,K.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,K.jsx)(`div`,{className:V(`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,K.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,K.jsx)(`div`,{className:V(`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(_S,n)}:void 0,children:t})]})}function yS({display:e,parentSessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,onFileOpen:i}){let[a,o]=(0,G.useState)(null);if(e.target.type!==`file`)return null;let{path:s,line:c,column:l,params:u,viewer:d}=e.target.payload,f=$u({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,K.jsx)(vS,{actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(us,{className:`h-3.5 w-3.5`}),label:U(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>h(`rendered`)}),(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(gr,{className:`h-3.5 w-3.5`}),label:U(`chatWorkspaceOpenSource`),tooltipSide:`top`,onClick:()=>h(`source`)})]}),contentHeight:a,children:(0,K.jsx)(gS,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onHtmlContentHeightChange:o,onFileOpen:i})}):(0,K.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,K.jsxs)(`header`,{className:`border-b border-border bg-muted/45 px-3 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-foreground`,children:[(0,K.jsx)(Jn,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`truncate`,children:p})]}),(0,K.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] font-normal text-muted-foreground`,title:f.path,children:f.path})]}),(0,K.jsx)(`div`,{className:`h-[420px] min-h-[240px] max-h-[min(60vh,420px)] overflow-hidden`,children:(0,K.jsx)(gS,{file:f,sessionProjectRoot:n,sessionWorkingDir:r,showBreadcrumbs:!1,onFileOpen:i})})]})}function bS({className:e,icon:t,imageClassName:n,title:r}){let i=t?.trim();return i?xS(i)?(0,K.jsx)(`img`,{src:i,alt:``,"aria-hidden":`true`,className:V(`h-5 w-5 rounded-sm object-contain`,n,e),title:r}):(0,K.jsx)(`span`,{"aria-hidden":`true`,className:V(`max-w-6 truncate text-center leading-none`,e),title:r,children:i}):(0,K.jsx)(Ln,{className:V(`h-4 w-4`,e)})}function xS(e){return e.startsWith(`data:image/`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)}function SS({entry:e,onSelect:t}){return(0,K.jsx)(Mz,{page:Cz(Za(e)),onSelect:t})}function CS({entry:e,onSelect:t}){let n=typeof window<`u`&&window.nextclawDesktop?U(`panelAppsOpenInBrowser`):U(`panelAppsOpenInNewTab`);return(0,K.jsxs)(`a`,{href:`/apps/panel/${encodeURIComponent(e.appId)}/standalone`,target:`_blank`,rel:`opener`,referrerPolicy:`no-referrer`,className:V($n,tr.item),onClick:t,children:[(0,K.jsx)(Pr,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{children:n})]})}function wS({deletePending:e,entry:t,favoritePending:n,onDelete:r,onOpen:i,onToggleFavorite:a}){let[o,s]=(0,G.useState)(!1),[c,l]=(0,G.useState)(!1),u=t.favorite?U(`panelAppsUnfavorite`):U(`panelAppsFavorite`),d=t.lastOpenedAt?`${U(`panelAppsLastOpened`)} ${ES(t.lastOpenedAt)}`:`${U(`panelAppsUpdated`)} ${ES(t.updatedAt)}`,f=e=>{e.stopPropagation(),a()},p=()=>{s(!1),l(!0)};return(0,K.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-[var(--interaction-hover)]`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 text-left`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.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,K.jsx)(bS,{icon:t.icon,title:t.title})}),(0,K.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-sm font-medium text-foreground`,children:t.title})]}),t.description?(0,K.jsx)(`span`,{className:`mt-1.5 block truncate text-xs leading-5 text-muted-foreground`,children:t.description}):null,(0,K.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] leading-4 text-muted-foreground/70`,children:d})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover:opacity-100`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:f,disabled:n,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground disabled:opacity-50`,title:u,"aria-label":u,children:(0,K.jsx)(kn,{className:t.favorite?`h-4 w-4 fill-current text-foreground`:`h-4 w-4`})}),(0,K.jsxs)(_i,{open:o,onOpenChange:s,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,"aria-label":U(`panelAppsMoreActions`),disabled:e,children:(0,K.jsx)(wr,{className:`h-4 w-4`})})}),(0,K.jsxs)(hi,{align:`end`,variant:`menu`,children:[(0,K.jsx)(CS,{entry:t,onSelect:()=>s(!1)}),(0,K.jsx)(SS,{entry:t,onSelect:()=>s(!1)}),(0,K.jsx)(TS,{destructive:!0,disabled:e,icon:Jr,label:U(`panelAppsDelete`),onClick:p})]})]})]})]}),(0,K.jsx)(oa,{open:c,onOpenChange:l,title:U(`panelAppsDeleteConfirmTitle`),description:`${U(`panelAppsDeleteConfirmDescription`)} ${t.fileName}`,confirmLabel:U(`delete`),variant:`destructive`,onConfirm:r,onCancel:()=>void 0})]})}function TS({destructive:e=!1,disabled:t=!1,icon:n,label:r,onClick:i}){return(0,K.jsxs)(`button`,{type:`button`,className:V($n,e?tr.destructive:`text-foreground ${tr.item}`),disabled:t,onClick:i,children:[(0,K.jsx)(n,{className:V(`h-4 w-4 shrink-0`,!e&&`text-muted-foreground`)}),(0,K.jsx)(`span`,{children:r})]})}function ES(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=$r(Xr()),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 DS(e,t){return t===`favorites`?OS(e.filter(e=>e.favorite),`smart`):OS(t===`recent-open`?e.filter(e=>e.lastOpenedAt):e,t)}function OS(e,t){return[...e].sort((e,n)=>kS(e,n,t))}function kS(e,t,n){return n===`recent-open`?NS(e.lastOpenedAt,t.lastOpenedAt)||AS(e,t):n===`updated`?NS(e.updatedAt,t.updatedAt)||AS(e,t):n===`name`?AS(e,t):jS(e,t)||Number(t.favorite)-Number(e.favorite)||AS(e,t)}function AS(e,t){return e.title.localeCompare(t.title)}function jS(e,t){return MS(t)-MS(e)}function MS(e){return Math.max(new Date(e.lastOpenedAt??0).getTime(),new Date(e.createdAt).getTime(),new Date(e.updatedAt).getTime())}function NS(e,t){return new Date(t??0).getTime()-new Date(e??0).getTime()}var PS=[];function FS({onOpenPanelApp:e}){let t=c(),n=o(),i=r(),l=s(),{ensurePanelAppClientGrant:u}=a(),d=$(),f=fn(),[p,m]=(0,G.useState)(`smart`),h=t.data?.entries??PS,g=(0,G.useMemo)(()=>DS(h,p),[h,p]),_=async t=>{await u(t)&&(e(t),l.mutate(t.id))},v=e=>{i.mutate({id:e.id,preferences:{favorite:!e.favorite}})},y=e=>{n.mutate(e.id)},b=()=>{f(`/chat`),d.chatDraftIntentManager.requestDraft(U(`panelAppsExamplePrompt`))};return t.isLoading?(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center text-sm text-muted-foreground`,children:U(`panelAppsLoading`)}):t.isError?(0,K.jsx)(`div`,{className:`p-4 text-sm text-rose-600`,children:t.error instanceof Error?t.error.message:U(`panelAppsLoadFailed`)}):(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,K.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,K.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t.data?.panelsPath?(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.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":U(`panelAppsTitle`),children:(0,K.jsx)(fo,{className:`h-3.5 w-3.5`})})}),(0,K.jsx)(ui,{side:`bottom`,className:`max-w-[320px] break-all font-mono text-xs`,children:t.data.panelsPath})]})}):null}),(0,K.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:U(`panelAppsRefresh`),"aria-label":U(`panelAppsRefresh`),children:(0,K.jsx)(qr,{className:`h-3.5 w-3.5`})})]}),(0,K.jsx)(`div`,{className:`border-b border-border/70 px-3 py-2`,children:(0,K.jsx)(Ti,{value:p,onValueChange:e=>m(e),children:(0,K.jsxs)(wi,{className:`grid h-auto w-full grid-cols-5 rounded-lg bg-muted/70 p-0.5`,children:[(0,K.jsx)(Ci,{value:`smart`,className:`px-2 py-1 text-xs`,children:U(`panelAppsSortSmart`)}),(0,K.jsx)(Ci,{value:`favorites`,className:`px-2 py-1 text-xs`,children:U(`panelAppsFavorites`)}),(0,K.jsx)(Ci,{value:`recent-open`,className:`px-2 py-1 text-xs`,children:U(`panelAppsSortRecentOpen`)}),(0,K.jsx)(Ci,{value:`updated`,className:`px-2 py-1 text-xs`,children:U(`panelAppsSortUpdated`)}),(0,K.jsx)(Ci,{value:`name`,className:`px-2 py-1 text-xs`,children:U(`panelAppsSortName`)})]})})}),h.length===0?(0,K.jsx)(IS,{panelsPath:t.data?.panelsPath,onCreateExample:b,onRefresh:()=>void t.refetch()}):g.length===0?(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-center text-sm text-muted-foreground`,children:U(`panelAppsEmptyFiltered`)}):(0,K.jsx)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-3`,children:(0,K.jsx)(`div`,{className:`space-y-1.5`,children:g.map(e=>(0,K.jsx)(wS,{entry:e,deletePending:n.isPending,favoritePending:i.isPending,onDelete:()=>y(e),onOpen:()=>void _(e),onToggleFavorite:()=>v(e)},e.id))})})]})}function IS({onCreateExample:e,panelsPath:t,onRefresh:n}){return(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center overflow-y-auto px-5 py-6 text-center`,children:(0,K.jsxs)(`div`,{className:`w-full max-w-sm`,children:[(0,K.jsx)(`div`,{className:`mx-auto flex h-10 w-10 items-center justify-center rounded-lg bg-primary/10 text-primary`,children:(0,K.jsx)(Ln,{className:`h-5 w-5`})}),(0,K.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:U(`panelAppsEmptyTitle`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-muted-foreground`,children:U(`panelAppsEmptyDescription`)}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-2 text-left`,children:[(0,K.jsx)(LS,{icon:(0,K.jsx)(Sr,{className:`h-4 w-4`}),title:U(`panelAppsEmptyAskTitle`),description:U(`panelAppsEmptyAskDescription`),actionLabel:U(`panelAppsEmptyAskAction`),onAction:e}),(0,K.jsx)(LS,{icon:(0,K.jsx)(cr,{className:`h-4 w-4`}),title:U(`panelAppsEmptyFileTitle`),description:U(`panelAppsEmptyFileDescription`)})]}),t?(0,K.jsxs)(`div`,{className:`mt-4 rounded-md bg-muted/60 px-3 py-2 text-left`,children:[(0,K.jsx)(`div`,{className:`text-[11px] font-medium uppercase text-muted-foreground/70`,children:U(`panelAppsPanelsPath`)}),(0,K.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:t})]}):null,(0,K.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,K.jsx)(qr,{className:`h-3.5 w-3.5`}),U(`panelAppsRefresh`)]})]})})}function LS({actionLabel:e,description:t,icon:n,onAction:r,title:i}){let a=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`mt-0.5 text-muted-foreground`,children:n}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-foreground`,children:i}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:t}),e?(0,K.jsx)(`div`,{className:`mt-2 text-xs font-medium text-primary`,children:e}):null]})]});return r?(0,K.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,K.jsx)(`div`,{className:`flex gap-2 rounded-md bg-muted/60 px-3 py-2.5`,children:a})}function RS({className:e,icon:t,name:n}){let[r,i]=(0,G.useState)(),a=zS(t),o=r===t;return(0,K.jsx)(`span`,{className:V(`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,K.jsx)(`img`,{src:t,alt:``,className:`h-full w-full object-cover`,onError:()=>i(t)}):t&&!a?(0,K.jsx)(`span`,{className:`text-base leading-none`,"aria-hidden":`true`,children:t}):(0,K.jsx)(`span`,{"aria-hidden":`true`,children:BS(n)})})}function zS(e){return!!e&&(e.startsWith(`data:`)||e.startsWith(`/`)||e.startsWith(`http://`)||e.startsWith(`https://`))}function BS(e){return[...e.trim()][0]?.toLocaleUpperCase()??`A`}function VS({accentColor:e,className:t,coverPreview:n,coverUrl:r,name:i,icon:a}){let[o,s]=(0,G.useState)(),c=r&&o!==r?r:void 0;return(0,K.jsx)(`span`,{className:V(`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:c?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`img`,{src:c,alt:`${i} app cover`,className:`h-full w-full object-cover transition-transform duration-500 group-hover:scale-[1.015]`,loading:`lazy`,onError:()=>s(c)}),null]}):(0,K.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:a?(0,K.jsx)(RS,{icon:a,name:i,className:`h-16 w-16 rounded-2xl`}):(0,K.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:HS(i)})})})}function HS(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 US(e,t){if(e.status!==`compatible`)return e.status===`unknown`?{actionLabel:U(`appPackagesTemporarilyUnavailable`),reason:U(`appPackagesCompatibilityUnknownReason`),statusLabel:U(`appPackagesCompatibilityUnknown`)}:{actionLabel:U(`appPackagesUnavailable`),badgeLabel:U(`appPackagesPlatformOnly`).replace(`{platforms}`,t),reason:e.reason===`unsupported-os`?U(`appPackagesUnsupportedOsReason`).replace(`{platforms}`,t):U(`appPackagesUnsupportedTargetReason`).replace(`{platforms}`,t),statusLabel:U(`appPackagesUnavailableOnDevice`)}}function WS({presentation:e}){return e?.badgeLabel?(0,K.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 GS({blocked:e,presentation:t,className:n}){return!e||!t?null:(0,K.jsx)(`p`,{className:n,children:t.statusLabel})}function KS({active:e,canUpdate:t,installed:n,isStarting:r,onAction:i,onInstalled:a,operation:o,unavailableLabel:s,unavailableReason:c}){let l=(0,K.jsx)(B,{type:`button`,size:`sm`,variant:n&&!t||e?`secondary`:`default`,disabled:!!c||n&&!t&&!a||e||r,onClick:n&&!t&&a?a:i,className:`shrink-0 rounded-full px-4`,children:n&&!t&&a&&!e&&!r?U(`appPackagesViewInstalled`):qS({active:e,canUpdate:t,installed:n,isStarting:r,operation:o,unavailableLabel:s,unavailableReason:c})});return c?(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.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:l})}),(0,K.jsx)(ui,{side:`top`,className:`max-w-64 text-xs`,children:c})]}):l}function qS({active:e,canUpdate:t,installed:n,isStarting:r,operation:i,unavailableLabel:a,unavailableReason:o}){return o?a??U(`appPackagesUnavailable`):n&&!t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(jr,{className:`mr-1.5 h-3.5 w-3.5`}),U(`appPackagesMarketplaceInstalled`)]}):e||r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Rr,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),i?XS(i):U(`appPackagesPreparing`)]}):U(t?`appPackagesUpdate`:`appPackagesInstall`)}function JS({operation:e}){if(e.status===`failed`||e.status===`interrupted`)return(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs leading-5 text-destructive`,children:e.error||U(`appPackagesActionFailed`)});let t=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,K.jsxs)(`div`,{className:`mt-2`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(`div`,{className:`h-1 overflow-hidden rounded-full bg-muted`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width] duration-300`,style:{width:`${t}%`}})}),(0,K.jsx)(`p`,{className:`mt-1.5 truncate text-[11px] text-muted-foreground`,children:XS(e)})]})}function YS(e,t,n){return e.find(e=>e.appId===t||e.source===n)}function XS(e){switch(e.status){case`queued`:return U(`appPackagesPreparing`);case`resolving`:return U(`appPackagesResolving`);case`downloading`:return U(`appPackagesDownloading`);case`verifying`:return U(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?U(`appPackagesSwitchingVersion`):e.action===`uninstall`?U(`appPackagesUninstalling`):U(`appPackagesInstalling`);case`finalizing`:return U(`appPackagesFinalizing`);case`succeeded`:return U(`appPackagesCompleted`);case`failed`:case`interrupted`:return U(`appPackagesActionFailed`)}}function ZS({checked:e,description:t,destructive:n=!1,disabled:r=!1,label:i,onClick:a}){return(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":e,"aria-disabled":r,disabled:r,onClick:a,className:V(`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-[var(--interaction-selection-border)] bg-[var(--interaction-selection)]`:`border-border/60 hover:bg-[var(--interaction-hover)]`),children:[(0,K.jsx)(`span`,{className:V(`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,K.jsx)(jr,{className:`h-2.5 w-2.5`}):null}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:V(`block text-sm font-medium`,n?`text-destructive`:`text-foreground`),children:i}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground`,children:t})]})]})}function QS({storage:e,usage:t}){let n=[[U(`appDataClassData`),t.dataBytes],[U(`appDataClassConfig`),t.configBytes],[U(`appDataClassState`),t.stateBytes],[U(`appDataClassCache`),t.cacheBytes],[U(`appDataClassTemporary`),t.temporaryBytes],[U(`appDataClassLogs`),t.logsBytes]];return(0,K.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-foreground`,children:[(0,K.jsx)(jo,{className:`h-3.5 w-3.5`}),U(`appDataStorageTotal`)]}),(0,K.jsx)(`span`,{className:`tabular-nums text-foreground`,children:$S(t.totalBytes)})]}),(0,K.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,K.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,K.jsx)(`dt`,{className:`truncate text-muted-foreground`,children:e}),(0,K.jsx)(`dd`,{className:`shrink-0 tabular-nums text-foreground/80`,children:$S(t)})]},e))}),(0,K.jsxs)(`div`,{className:`mt-2 border-t border-border/50 pt-2`,children:[(0,K.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:U(`appDataStoragePath`)}),(0,K.jsx)(`code`,{"aria-label":U(`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 $S(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 eC=[`app-data`];function tC(){return R({queryKey:eC,queryFn:()=>L.appData.list(),staleTime:0})}function nC(){let e=Dt();return He({mutationFn:({dataId:e,confirmAppId:t})=>L.appData.deleteRetained(e,t),onSuccess:async()=>{await e.invalidateQueries({queryKey:eC}),z.success(U(`appDataDeleteCompleted`))}})}function rC({diagnostics:e,entries:t,error:n,isLoading:r,onDeletionFocusReturn:i}){let[a,o]=(0,G.useState)(null),s=(0,G.useRef)(null),c=(0,G.useRef)(null),l=nC(),u=t.filter(e=>e.lifecycle===`retained`),d=()=>{l.isPending||o(null)};return(0,G.useEffect)(()=>{l.isError&&s.current?.focus()},[l.isError]),!r&&!n&&e.length===0&&u.length===0?null:(0,K.jsxs)(`section`,{className:`mt-6`,"aria-labelledby":`retained-app-data-title`,children:[(0,K.jsxs)(`div`,{className:`mb-2.5 px-1`,children:[(0,K.jsx)(`h2`,{ref:c,id:`retained-app-data-title`,tabIndex:-1,className:`text-sm font-semibold text-foreground`,children:U(`appDataRetainedTitle`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-muted-foreground`,children:U(`appDataRetainedDescription`)})]}),r?(0,K.jsx)(`div`,{role:`status`,"aria-label":U(`appPackagesLoading`),children:(0,K.jsx)(Hi,{})}):null,n?(0,K.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:U(`appDataLoadFailed`)}):null,e.length>0?(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,K.jsx)(ur,{className:`h-3.5 w-3.5`}),U(`appDataDiagnosticsTitle`)]}),(0,K.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.map(e=>(0,K.jsxs)(`li`,{className:`break-all`,children:[e.message,` — `,e.instanceDirectory]},e.instanceDirectory))})]}):null,(0,K.jsx)(`div`,{className:`space-y-2.5`,children:u.map(e=>(0,K.jsxs)(`article`,{className:`rounded-xl border border-border/65 bg-card p-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(`span`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,K.jsx)($a,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName}),(0,K.jsxs)(`div`,{className:`mt-0.5 truncate font-mono text-[10px] text-muted-foreground`,children:[e.appId,e.publisherId?` · ${e.publisherId}`:``]})]}),(0,K.jsxs)(B,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>{l.reset(),o(e)},children:[(0,K.jsx)(Jr,{className:`mr-1.5 h-3.5 w-3.5`}),U(`appDataDeleteAction`)]})]}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(QS,{storage:e.storage,usage:e.usage})})]},e.id))}),(0,K.jsx)(li,{open:!!a,onOpenChange:e=>!e&&d(),children:(0,K.jsx)(oi,{className:`max-w-md`,onEscapeKeyDown:e=>l.isPending&&e.preventDefault(),onInteractOutside:e=>l.isPending&&e.preventDefault(),children:a?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(ei,{showClose:!1,children:[(0,K.jsx)(si,{children:U(`appDataDeleteTitle`)}),(0,K.jsx)(ci,{children:U(`appDataDeleteDescription`)})]}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,K.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,K.jsx)(QS,{storage:a.storage,usage:a.usage}),l.isError?(0,K.jsx)(`p`,{ref:s,role:`alert`,tabIndex:-1,className:`text-xs text-destructive`,children:l.error instanceof Error?l.error.message:U(`appDataDeleteFailed`)}):null]}),(0,K.jsxs)(ii,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,K.jsx)(B,{autoFocus:!0,type:`button`,variant:`outline`,disabled:l.isPending,onClick:d,children:U(`cancel`)}),(0,K.jsxs)(B,{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,K.jsx)(Rr,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}):null,l.isPending?U(`appDataDeleting`):U(`appDataDeletePermanently`)]})]})]}):null})})]})}var iC=[`app-packages`],aC=[`panel-apps`],oC=[`service-apps`],sC=[`service-actions`],cC=[`app-package-operations`],lC=new Set([`queued`,`resolving`,`downloading`,`verifying`,`installing`,`finalizing`]);function uC(){return R({queryKey:iC,queryFn:()=>L.appPackages.list({includeStorageUsage:!1}),staleTime:0})}function dC(){return R({queryKey:cC,queryFn:()=>L.appPackages.listOperations(),refetchInterval:e=>(e.state.data?.entries??[]).some(e=>fC(e.status))?500:!1,staleTime:0})}function fC(e){return lC.has(e)}function pC({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i,settlementManager:a}){(0,G.useEffect)(()=>{a.settle({isLoaded:e,operations:t,refetchPackages:n,refetchPanels:r,refetchAppData:i})},[e,t,n,r,i,a])}function mC(){let e=Dt();return He({mutationFn:async e=>{switch(e.action){case`enable`:return await L.appPackages.enable(e.appId);case`disable`:return await L.appPackages.disable(e.appId);case`install`:return await L.appPackages.startInstall({source:e.source,registryUrl:e.registryUrl});case`update`:return await L.appPackages.startUpdate(e.appId);case`rollback`:return await L.appPackages.startRollback(e.appId,e.version);case`uninstall`:return await L.appPackages.startUninstall(e.appId,e.purgeData??!1)}},onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:iC}),e.invalidateQueries({queryKey:aC}),e.invalidateQueries({queryKey:oC}),e.invalidateQueries({queryKey:sC}),e.invalidateQueries({queryKey:cC}),e.invalidateQueries({queryKey:eC})])}})}function hC(){let e=Dt();return He({mutationFn:async e=>e.action===`revoke`?await L.appPackages.revokeDocumentAccess(e.appId,e.scopeId):await L.appPackages.grantDocumentAccess(e.appId,{scopeId:e.scopeId,directoryPath:e.directoryPath,mode:e.mode}),onSuccess:async()=>{await Promise.all([e.invalidateQueries({queryKey:iC}),e.invalidateQueries({queryKey:oC}),e.invalidateQueries({queryKey:sC})])}})}var gC={darwin:`macOS`,linux:`Linux`,win32:`Windows`};function _C(e,t){return!e||e.mode===`universal`?t:e.operatingSystems.map(e=>gC[e]).join(` · `)}function vC(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 yC(e){return e.status===`compatible`?0:e.status===`unknown`?1:2}function bC(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function xC(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 SC(e,t){let{id:n,spec:r}=t;return!!(r&&e.spec===r||n&&e.id===n)}function CC(e,t){return t??{type:e,total:0,specs:[],records:[]}}function wC(e){let{result:t,view:n}=e,r=CC(t.type,n),i=xC(e),a=r.records.findIndex(e=>SC(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:bC(o),total:o.length}}function TC(e){let{request:t,result:n,view:r}=e,i=CC(n.type,r);if(n.action===`uninstall`||n.action===`remove`){let e=i.records.filter(e=>!SC(e,{id:n.id,spec:t.spec}));return{...i,records:e,specs:bC(e),total:e.length}}let a=i.records.map(e=>SC(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:bC(a),total:a.length}}function EC(e){if(!e||e.pages.length===0)return;let t=e.pages.flatMap(e=>e.items);return{...e.pages[e.pages.length-1],items:t,pages:e.pages,loadedItems:t.length,loadedPages:e.pages.length}}var DC=3e4;function OC(e){return e instanceof ht&&e.code===`MARKETPLACE_SKILL_LOCAL_CHANGES`}function kC(e){let t=Da({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>Se({...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&&jC(r,e)?t:void 0},staleTime:15e3,refetchInterval:e.q?!1:DC,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`}),n=(0,G.useMemo)(()=>EC(t.data),[t.data]);return{...t,data:n}}function AC(e,t=!0){return R({queryKey:[`marketplace-recent-items`,e],queryFn:()=>Se({type:e,sort:`updated`,page:1,pageSize:6}),enabled:t,staleTime:15e3,refetchInterval:DC,refetchOnMount:`always`,refetchOnReconnect:`always`,refetchOnWindowFocus:`always`})}function jC(e,t){return e.tag===t.tag&&e.scene===t.scene&&e.pageSize===t.pageSize}function MC(e=!0){return R({queryKey:[`marketplace-skill-scenes`],queryFn:st,enabled:e,staleTime:6e4})}function NC(e,t=!0){let n=Ea({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>Se({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,G.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 PC(e){return R({queryKey:[`marketplace-installed`,e],queryFn:()=>Ve(e),staleTime:1e4})}function FC(){let e=Dt();return He({mutationFn:e=>Yt(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>wC({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),z.success(t.message||U(`marketplaceInstallSuccessSkill`))},onError:e=>{z.error(e.message||U(`marketplaceInstallFailed`))}})}function IC(){let e=Dt();return He({mutationFn:e=>Nt(e),onSuccess:(t,n)=>{e.setQueryData([`marketplace-installed`,t.type],e=>TC({view:e,request:n,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let r=t.action===`enable`?U(`marketplaceEnableSuccess`):t.action===`disable`?U(`marketplaceDisableSuccess`):t.action===`update`?U(`marketplaceUpdateSuccess`):U(`marketplaceUninstallSuccess`);z.success(t.message||r)},onError:e=>{OC(e)||z.error(e.message||U(`marketplaceOperationFailed`))}})}function LC({scope:e,isRefreshing:t,searchText:n,searchPlaceholder:r,sort:i,onSearchTextChange:a,onSortChange:o}){return(0,K.jsx)(`div`,{className:`mb-4`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,K.jsx)(is,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,K.jsx)(F,{value:n,onChange:e=>a(e.target.value),placeholder:r,className:`h-9 w-full rounded-xl border border-border/75 bg-card pl-9 pr-9 text-sm transition-colors focus:outline-none focus:ring-0`}),t&&(0,K.jsx)(Rr,{className:`absolute right-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 animate-spin text-primary`,"aria-label":U(`marketplaceRefreshingResults`)})]}),e===`all`&&(0,K.jsxs)(pa,{value:i,onValueChange:e=>o(e),children:[(0,K.jsx)(la,{className:`h-9 w-[110px] sm:w-[150px] shrink-0 rounded-lg`,children:(0,K.jsx)(ca,{})}),(0,K.jsxs)(ua,{children:[(0,K.jsx)(fa,{value:`relevance`,children:U(`marketplaceSortRelevance`)}),(0,K.jsx)(fa,{value:`updated`,children:U(`marketplaceSortUpdated`)})]})]})]})})}function RC({count:e}){return(0,K.jsx)(K.Fragment,{children:Array.from({length:e},(e,t)=>(0,K.jsx)(`article`,{className:`h-full rounded-xl border border-gray-200/60 bg-white p-3.5 shadow-sm`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-2.5`,children:[(0,K.jsx)(aa,{className:`h-9 w-9 shrink-0 rounded-lg`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,K.jsx)(aa,{className:`h-4 w-32 max-w-[70%]`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(aa,{className:`h-3 w-12`}),(0,K.jsx)(aa,{className:`h-3 w-24`})]}),(0,K.jsx)(aa,{className:`h-3 w-full`}),(0,K.jsxs)(`div`,{className:`flex gap-1.5 pt-0.5`,children:[(0,K.jsx)(aa,{className:`h-5 w-14 rounded-md`}),(0,K.jsx)(aa,{className:`h-5 w-16 rounded-md`}),(0,K.jsx)(aa,{className:`h-5 w-12 rounded-md`})]})]})]}),(0,K.jsx)(aa,{className:`h-7 w-16 shrink-0 rounded-md`})]})},`marketplace-skeleton-${t}`))})}function zC({hasMore:e,loading:t,sentinelRef:n}){return!e&&!t?null:(0,K.jsxs)(`div`,{className:`py-4`,children:[e&&(0,K.jsx)(`div`,{ref:n,className:`h-1 w-full`,"aria-hidden":`true`}),t&&(0,K.jsx)(`div`,{"data-testid":`marketplace-loading-more`,className:`pt-3 text-center text-xs text-gray-500`,children:U(`loading`)})]})}function BC(e){let t=e.trim().toLowerCase().replace(/_/g,`-`),n=[t,t.split(`-`)[0],`en`];return Array.from(new Set(n.filter(Boolean)))}function VC(e){return e.trim().toLowerCase().replace(/_/g,`-`)}function HC(e,t,n){if(e){let t=Object.entries(e).map(([e,t])=>({locale:VC(e),text:typeof t==`string`?t.trim():``})).filter(e=>e.text.length>0);if(t.length>0){let e=new Map(t.map(e=>[e.locale,e.text]));for(let t of n){let n=VC(t),r=e.get(n);if(r)return r}for(let e of n){let n=VC(e).split(`-`)[0];if(!n)continue;let r=t.find(e=>e.locale===n||e.locale.startsWith(`${n}-`));if(r)return r.text}return t[0]?.text??``}}return t?.trim()??``}function UC(e,t){if(!e)return``;for(let n of t)if(VC(n).split(`-`)[0]===`zh`&&e.descriptionZh?.trim())return e.descriptionZh.trim();return e.description?.trim()?e.description.trim():e.descriptionZh?.trim()?e.descriptionZh.trim():``}var WC=ct(e=>({entries:{},setEntry:t=>e(e=>({entries:{...e.entries,[t.id]:t}}))}));function GC(e){WC.getState().setEntry(e)}function KC(e){let t=e.indexOf(`:`);return t<=0||t>=e.length-1?null:{scope:e.slice(0,t),key:e.slice(t+1)}}function qC(e){return e===`skill`||e===`skill-preview`}function JC(e){let t=WC(t=>e?t.entries[e]:void 0);return(0,G.useEffect)(()=>{if(!e||WC.getState().entries[e])return;let t=KC(e);if(!t||!qC(t.scope))return;let n=!1,r=t.key,i=U(`marketplaceTypeSkill`);return y(t.key).then(a=>{n||GC({id:e,title:r,typeLabel:i,spec:t.key,status:`ready`,summary:U(`marketplaceInstalledLocalSummary`),metadataRaw:a.metadataRaw,contentRaw:a.bodyRaw||a.raw,sourceUrl:a.sourceUrl,sourceLabel:a.source?`Source (${a.source})`:void 0})}).catch(()=>{n||GC({id:e,title:r,typeLabel:i,spec:t.key,status:`error`,summary:U(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify({skill:t.key},null,2),contentRaw:U(`marketplaceDetailUnavailableDescription`)})}),()=>{n=!0}},[e]),t}var YC=`marketplace-detail`,XC=`nextclaw://marketplace-detail`;function ZC(e,t){return`${e}:${t}`}function QC(e){return`${XC}/${encodeURIComponent(e)}`}function $C(e){try{let t=new URL(e);if(t.protocol!==`nextclaw:`||t.hostname!==`marketplace-detail`)return null;let n=t.pathname.replace(/^\//,``);return n?decodeURIComponent(n):null}catch{return null}}function ew(e){let t=QC(e.id);return{dedupeKey:`marketplace-detail:${e.id}`,historyPolicy:`managed`,kind:YC,resourceUri:t,title:e.title,url:t}}function tw(e,t,n){GC(t),e.openTarget(ew(t),{activate:n?.activate,dedupeKey:`marketplace-detail:${t.id}`,title:t.title})}function nw(e){let t=e.replace(/\r\n/g,`
|
|
13
|
+
`).split(`
|
|
14
|
+
`);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
|
|
15
|
+
`).trim():e}function rw(e){let t=[],n=/(`[^`]+`|\*\*[^*]+\*\*|\[[^\]]+\]\(https?:\/\/[^)\s]+\))/g,r=0,i=0;for(let a of e.matchAll(n)){if(a.index===void 0)continue;a.index>r&&t.push(e.slice(r,a.index));let n=a[0],o=`${i}-${a.index}`;if(n.startsWith("`"))t.push((0,K.jsx)(`code`,{className:`rounded border border-border bg-muted px-1 py-0.5 font-mono text-[0.88em] text-foreground`,children:n.slice(1,-1)},o));else if(n.startsWith(`**`))t.push((0,K.jsx)(`strong`,{children:n.slice(2,-2)},o));else{let e=n.match(/^\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)$/);t.push(e?(0,K.jsx)(`a`,{href:e[2],target:`_blank`,rel:`noopener noreferrer`,children:e[1]},o):n)}r=a.index+n.length,i+=1}return r<e.length&&t.push(e.slice(r)),t}function iw(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function aw(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;let a=n[1]??``;return{node:(0,K.jsxs)(`div`,{className:`relative my-3 overflow-hidden rounded-lg border border-border bg-muted/70`,children:[a?(0,K.jsx)(`span`,{className:`absolute right-3 top-2 font-mono text-[10px] text-muted-foreground`,children:a}):null,(0,K.jsx)(`pre`,{className:`m-0 overflow-x-auto p-3 text-xs leading-6 text-foreground`,children:(0,K.jsx)(`code`,{children:r.join(`
|
|
16
|
+
`)})})]},t),nextIndex:i+1}}function ow(e,t,n){let r=[],i=t,a=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&a.test(e[i]?.trim()??``);)r.push((e[i]??``).trim().replace(a,``)),i+=1;return{node:(0,K.jsx)(n?`ol`:`ul`,{className:V(`my-2 pl-5`,n?`list-decimal`:`list-disc`),children:r.map((e,n)=>(0,K.jsx)(`li`,{className:`my-1`,children:rw(e)},`${t}-${n}`))},t),nextIndex:i}}function sw(e,t,n){let r=`mb-2 mt-5 font-semibold leading-tight text-foreground`;return e===1?(0,K.jsx)(`h1`,{className:r,children:n},t):e===2?(0,K.jsx)(`h2`,{className:r,children:n},t):e===3?(0,K.jsx)(`h3`,{className:r,children:n},t):(0,K.jsx)(`h4`,{className:r,children:n},t)}function cw(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return aw(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);if(i)return{node:sw(Math.min(4,i[1]?.length??2),t,rw(i[2]??``)),nextIndex:t+1};if(/^[-*]\s+/.test(n))return ow(e,t,!1);if(/^\d+\.\s+/.test(n))return ow(e,t,!0);if(/^>\s?/.test(n)){let n=[],r=t;for(;r<e.length&&/^>\s?/.test(e[r]?.trim()??``);)n.push((e[r]??``).trim().replace(/^>\s?/,``)),r+=1;return{node:(0,K.jsx)(`blockquote`,{className:`my-3 rounded-lg border-l-4 border-primary/50 bg-muted/60 px-3 py-2 text-muted-foreground`,children:rw(n.join(` `))},t),nextIndex:r}}let a=[],o=t;for(;o<e.length;){let t=e[o]?.trim()??``;if(!t||iw(t))break;a.push(t),o+=1}return{node:(0,K.jsx)(`p`,{children:rw(a.join(` `))},t),nextIndex:o}}function lw(e){let t=nw(e).replace(/\r\n/g,`
|
|
17
|
+
`).split(`
|
|
18
|
+
`),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=cw(t,r);n.push(e.node),r=e.nextIndex}return n}function uw(e){return Array.isArray(e)?e.map(e=>uw(e)).filter(e=>e.trim().length>0).join(`, `):e&&typeof e==`object`?``:String(e??``)}function dw(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:uw(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function fw(e){return e.replace(/\r\n/g,`
|
|
19
|
+
`).split(`
|
|
20
|
+
`).map(e=>e.match(/^([A-Za-z0-9_.-]+):\s*(.+)$/)).filter(e=>!!e).map(e=>({key:e[1]??``,value:e[2]?.replace(/^["']|["']$/g,``)??``})).filter(e=>e.key&&e.value.trim().length>0)}function pw(e){let t=dw(e);return t.length>0?t:fw(e)}function mw(){return(0,K.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,K.jsxs)(`section`,{className:`rounded-xl border border-border bg-card p-5`,children:[(0,K.jsx)(aa,{className:`h-7 w-1/2`}),(0,K.jsx)(aa,{className:`mt-3 h-4 w-3/4`}),(0,K.jsx)(aa,{className:`mt-4 h-4 w-full`}),(0,K.jsx)(aa,{className:`mt-3 h-4 w-2/3`})]}),(0,K.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(220px,0.42fr)_minmax(0,1fr)]`,children:[(0,K.jsx)(aa,{className:`h-56 rounded-xl`}),(0,K.jsx)(aa,{className:`h-56 rounded-xl`})]})]})}function hw({raw:e}){let t=pw(e);return t.length===0?(0,K.jsx)(`pre`,{className:`m-0 whitespace-pre-wrap break-words font-mono text-xs leading-6`,children:e}):(0,K.jsx)(`dl`,{className:`m-0`,children:t.map(e=>(0,K.jsxs)(`div`,{className:`grid grid-cols-[minmax(104px,0.34fr)_minmax(0,1fr)] gap-3 border-b border-border/70 py-2 last:border-b-0`,children:[(0,K.jsx)(`dt`,{className:`break-words font-semibold text-primary`,children:e.key}),(0,K.jsx)(`dd`,{className:`m-0 break-words text-card-foreground`,children:e.value})]},e.key))})}function gw({title:e,children:t}){return(0,K.jsxs)(`article`,{className:`overflow-hidden rounded-xl border border-border bg-card shadow-sm`,children:[(0,K.jsx)(`h2`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-sm font-semibold text-card-foreground`,children:e}),(0,K.jsx)(`div`,{className:`p-4 text-sm leading-7 text-card-foreground`,children:t})]})}function _w(){return(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center bg-background p-6 text-center text-muted-foreground`,children:(0,K.jsxs)(`div`,{className:`max-w-sm`,children:[(0,K.jsx)(ur,{className:`mx-auto mb-3 h-7 w-7 text-muted-foreground`}),(0,K.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:U(`marketplaceDetailUnavailableTitle`)}),(0,K.jsx)(`p`,{className:`mt-2 text-sm leading-6`,children:U(`marketplaceDetailUnavailableDescription`)})]})})}function vw({entry:e}){let t=e.metadataRaw?.trim()||`-`,n=e.contentRaw?.trim()||`-`,r=e.summary?.trim(),i=e.description?.trim(),a=!!i&&i!==r;return(0,K.jsx)(`main`,{className:`h-full overflow-auto bg-background text-foreground custom-scrollbar`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-[940px] space-y-4 p-5 pb-9`,children:[(0,K.jsxs)(`section`,{className:`rounded-xl border border-border bg-card p-5 shadow-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(`div`,{className:`mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border bg-muted text-primary`,children:(0,K.jsx)(Jn,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h1`,{className:`break-words text-2xl font-semibold leading-tight text-foreground`,children:e.title}),(0,K.jsxs)(`p`,{className:`mt-2 break-words text-xs text-muted-foreground`,children:[e.typeLabel,` · `,e.spec,e.author?` · ${e.author}`:``]})]})]}),r?(0,K.jsx)(`p`,{className:`mt-4 text-sm leading-7 text-card-foreground`,children:r}):null,a?(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-7 text-card-foreground`,children:i}):null,e.tags&&e.tags.length>0?(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:e.tags.map(e=>(0,K.jsx)(`span`,{className:`rounded-full border border-border bg-muted px-3 py-1 text-xs text-muted-foreground`,children:e},e))}):null,e.sourceUrl?(0,K.jsxs)(`p`,{className:`mt-4 break-all text-xs text-muted-foreground`,children:[e.sourceLabel??U(`marketplaceDetailSource`),`: `,` `,(0,K.jsx)(`a`,{href:e.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-primary hover:underline`,children:e.sourceUrl})]}):null]}),(0,K.jsxs)(`section`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(300px,100%),1fr))] gap-4`,children:[(0,K.jsx)(gw,{title:U(`marketplaceDetailMetadata`),children:(0,K.jsx)(hw,{raw:t})}),(0,K.jsx)(gw,{title:U(`marketplaceDetailContent`),children:(0,K.jsx)(`div`,{className:`marketplace-detail-markdown space-y-3 text-sm leading-7 text-card-foreground [&_a]:font-medium [&_a]:text-primary [&_a:hover]:underline`,children:lw(n)})})]})]})})}function yw({currentUrl:e}){let t=$C(e),n=JC(t);return t?!n||n.status===`loading`?(0,K.jsx)(mw,{}):n.status===`error`&&!n.contentRaw?(0,K.jsx)(_w,{}):(0,K.jsx)(vw,{entry:n}):(0,K.jsx)(_w,{})}var bw={[YC]:{getTitle:e=>e.title,renderContent:({currentUrl:e})=>(0,K.jsx)(yw,{currentUrl:e}),renderIcon:()=>(0,K.jsx)(Jn,{className:`h-4 w-4 text-primary`})}},xw=[`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 Sw(e){let{name:t,fallback:n,className:r}=e,i=t||n,a=i.substring(0,2).toUpperCase();return(0,K.jsx)(`div`,{className:V(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,Cw(i),r),children:a})}function Cw(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return xw[Math.abs(t)%xw.length]}function ww({title:e,spec:t}){return(0,K.jsxs)(ni,{delayDuration:400,children:[(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-950`,children:e})}),(0,K.jsx)(ui,{className:`max-w-[300px] text-xs`,children:e})]}),(0,K.jsx)(`div`,{className:`mb-2 mt-1 flex min-w-0 items-center gap-1.5`,children:t?(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono leading-tight text-gray-400`,children:t})}),(0,K.jsx)(ui,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null})]})}function Tw(e){let{item:t,record:n,state:r,onInstall:i,onManage:a}=e,{isInstalling:o,canUpdate:s,canUninstall:c,busyAction:l}=r,u=!!l;return t&&!n||n&&(s||c)?(0,K.jsxs)(`div`,{className:V(`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,K.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-[hsl(var(--primary-hover))] disabled:opacity-50`,children:[(0,K.jsx)(Nr,{className:`h-3 w-3`}),U(o?`marketplaceInstalling`:`marketplaceInstall`)]}),n&&s&&(0,K.jsxs)(`button`,{disabled:u,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-[var(--interaction-hover)] disabled:opacity-50`,children:[(0,K.jsx)(qr,{className:`h-3 w-3`}),U(l===`update`?`marketplaceUpdating`:`marketplaceUpdate`)]}),n&&c&&(0,K.jsxs)(`button`,{disabled:u,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-destructive/10 hover:text-rose-600 disabled:opacity-50`,children:[(0,K.jsx)(Jr,{className:`h-3 w-3`}),U(l===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]}):null}function Ew(e){let{record:t,disabled:n}=e;return t?(0,K.jsx)(`div`,{className:`flex h-5 w-5 shrink-0 items-center justify-end`,children:(0,K.jsx)(Dw,{disabled:n})}):null}function Dw(e){let{disabled:t}=e,n=U(t?`marketplaceDisabledStatus`:`marketplaceInstalledStatus`);return(0,K.jsx)(ni,{delayDuration:300,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`span`,{"aria-label":n,className:V(`inline-flex h-5 w-5 items-center justify-center`,t?`text-gray-400`:`text-emerald-700`),children:t?(0,K.jsx)(uo,{className:`h-4 w-4 opacity-40`}):(0,K.jsx)(uo,{className:`h-4 w-4`})})}),(0,K.jsx)(ui,{className:`text-xs`,children:n})]})})}function Ow(e){let{item:t,record:n,installState:r,manageState:i,onOpen:a,onInstall:o,onManage:s}=e,{language:c}=d(),l=BC(c),u=t?.name??n?.label??n?.id??n?.spec??U(`marketplaceUnknownItem`),f=HC(t?.summaryI18n,t?.summary,l)||(n?U(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??n?.spec??``,m=t?.tags??[],h=n?.id||n?.spec,g=h?i.actionsByTarget.get(h):void 0,_=n?.type===`skill`&&n.source===`workspace`,v=n?.type===`skill`&&n.origin===`marketplace`,y=n?n.enabled===!1||n.runtimeStatus===`disabled`:!1,b=t?.install.spec,x=typeof b==`string`&&r.installingSpecs.has(b);return(0,K.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-[var(--interaction-hover)]`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,K.jsx)(Sw,{name:u,fallback:p||U(`marketplaceTypeSkill`),className:`h-9 w-9 rounded-lg text-xs`}),(0,K.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:(0,K.jsx)(ww,{title:u,spec:p})}),(0,K.jsx)(Ew,{record:n,disabled:y}),n?.resourceUri?(0,K.jsx)(jz,{page:{uri:n.resourceUri,title:u,target:{kind:`system-object`,title:u,url:n.resourceUri,resourceUri:n.resourceUri,historyPolicy:`none`}}}):t&&(0,K.jsx)(jz,{page:Cz(ew({id:`skill:${t.slug}`,title:u,typeLabel:U(`marketplaceTypeSkill`),spec:p,status:`loading`}))})]}),(0,K.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-1 flex-col`,children:[(0,K.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500`,children:f}),(0,K.jsxs)(`div`,{className:`mt-auto flex min-w-0 items-end justify-between gap-2 pt-2`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(kw,{tags:m})}),(0,K.jsx)(Tw,{item:t,record:n,state:{isInstalling:x,canUpdate:v,canUninstall:_,busyAction:g},onInstall:o,onManage:s})]})]})]})}function kw({tags:e}){let t=e.filter(Aw).slice(0,3);return t.length===0?null:(0,K.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-1.5 overflow-hidden`,children:t.map(e=>(0,K.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 Aw(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function jw({model:e,showTitle:t,operationState:n,scroll:r,actions:i}){let{scope:a,entries:o,header:s,status:c,emptyLabel:l,errorLabel:u}=e,{showSkeleton:d,isRefreshing:f,error:p}=c,{hasMore:m,loadingMore:h,sentinelRef:g}=r,{installState:_,manageState:v}=n,{onOpen:y,onInstall:b,onManage:x}=i;return(0,K.jsxs)(`section`,{className:V(`flex min-h-full flex-col`,t&&`gap-3`),children:[t&&(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:s.title}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-gray-500`,children:[f&&(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:s.refreshingLabel}),(0,K.jsx)(`span`,{children:s.summary})]})]}),p&&(0,K.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[u,`: `,p.message]}),f&&(0,K.jsx)(`div`,{"data-testid":`marketplace-list-refreshing`,className:`h-0.5 overflow-hidden rounded-full bg-primary/10`,children:(0,K.jsx)(`div`,{className:`h-full w-1/3 animate-pulse rounded-full bg-primary`})}),(0,K.jsxs)(`div`,{"data-testid":d?`marketplace-list-skeleton`:void 0,className:V(`grid grid-cols-1 gap-2.5 md:grid-cols-2 xl:grid-cols-3`,d&&`min-h-0 flex-1 auto-rows-[156px] content-start`),children:[d&&(0,K.jsx)(RC,{count:36}),!d&&!p&&o.map(e=>(0,K.jsx)(Ow,{item:e.item,record:e.record,installState:_,manageState:v,onOpen:()=>y(e.item,e.record),onInstall:b,onManage:x},e.key))]}),!d&&!p&&o.length===0&&(0,K.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:l}),a===`all`&&!d&&!p&&(0,K.jsx)(zC,{hasMore:m,loading:h,sentinelRef:g})]})}function Mw(e){let{entry:t,language:n,localeFallbacks:r,installState:i,layout:a=`rail`,onOpen:o,onInstall:s}=e,{item:c,record:l}=t,u=HC(c.summaryI18n,c.summary,r),d=c.install.spec,f=i.installingSpecs.has(d),p=!!l;return(0,K.jsxs)(`article`,{onClick:()=>o(t),className:V(`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-[var(--interaction-hover)]`,a===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,K.jsx)(Sw,{name:c.name,fallback:c.install.spec}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,K.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:c.name}),(0,K.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:Nw(c)})]})]}),(0,K.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:u}),(0,K.jsx)(Pw,{tags:c.tags})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:Iw(c.updatedAt)}),p?(0,K.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,K.jsx)(uo,{className:`h-3.5 w-3.5`}),Lw({zh:`已安装`,en:`Installed`},n)]}):(0,K.jsxs)(`button`,{type:`button`,disabled:f,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-[var(--interaction-hover)] disabled:opacity-50`,children:[(0,K.jsx)(Nr,{className:`h-3.5 w-3.5`}),U(f?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function Nw(e){return e.slug||e.install.spec}function Pw({tags:e}){let t=e.filter(Fw).slice(0,2);return t.length===0?null:(0,K.jsx)(`div`,{className:`mt-auto truncate pt-2 text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function Fw(e){let t=e.trim().toLowerCase();return t.length>0&&t!==`skill`}function Iw(e){return e.slice(0,10)||e}function Lw(e,t){return t.startsWith(`zh`)?e.zh:e.en}var Rw=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:Es,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:ao,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:ms,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:Xn,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:yo,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Yo,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:_r,tone:`teal`,span:`md:col-span-2`}],zw={icon:_r,tone:`dark`,span:`md:col-span-2`},Bw={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`}},Vw=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`;function Hw(e){let{recentEntries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=BC(a);return(0,K.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,K.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,K.jsx)(Kw,{icon:_o,title:qw({zh:`场景`,en:`Scenes`},a),description:qw({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,K.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,K.jsx)(RC,{count:Rw.length})}):(0,K.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,K.jsx)(Uw,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||t.length>0)&&(0,K.jsx)(Gw,{icon:mo,title:qw({zh:`最近更新`,en:`Recently updated`},a),description:qw({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 Uw(e){let{scene:t,language:n,onSelect:r}=e,i=Jw(t.scene),a=i.icon,o=Bw[i.tone];return(0,K.jsx)(`button`,{type:`button`,onClick:()=>r(t.scene),className:V(`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-[var(--interaction-hover)]`,o.card),children:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:V(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,o.icon),children:(0,K.jsx)(a,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:Yw(t,i,n)}),typeof t.count==`number`&&(0,K.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Zw(t.count,n)})]}),(0,K.jsx)(`p`,{className:V(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,o.text),children:Xw(t,i,n)})]})})}function Ww(e){let{scene:t,entries:n,isLoading:r,language:i,localeFallbacks:a,installState:o,onBack:s,onOpen:c,onInstall:l}=e,u=Jw(t.scene),d=u.icon,f=Bw[u.tone];return(0,K.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,K.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,K.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-[var(--interaction-hover)] hover:text-gray-900`,"aria-label":qw({zh:`返回`,en:`Back`},i),children:(0,K.jsx)(Or,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:V(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,f.icon),children:(0,K.jsx)(d,{className:`h-4 w-4`})}),(0,K.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:Yw(t,u,i)}),(0,K.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:qw(r?{zh:`加载中`,en:`Loading`}:{zh:`${n.length} 个技能`,en:`${n.length} skills`},i)})]}),(0,K.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,K.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:Xw(t,u,i)})})]})]}),r?(0,K.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:V(Vw,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,K.jsx)(RC,{count:24})}):n.length>0?(0,K.jsx)(`div`,{className:Vw,children:n.map(e=>(0,K.jsx)(Mw,{entry:e,language:i,localeFallbacks:a,installState:o,layout:`grid`,onOpen:c,onInstall:l},e.item.id))}):(0,K.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:qw({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},i)})]})}function Gw(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,K.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,K.jsx)(Kw,{icon:t,title:n,description:r}),s?(0,K.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,K.jsx)(RC,{count:4})}):(0,K.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,K.jsx)(Mw,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function Kw({icon:e,title:t,description:n}){return(0,K.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,K.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,K.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function qw(e,t){return t.startsWith(`zh`)?e.zh:e.en}function Jw(e){return Rw.find(t=>t.scene===e)??{scene:e,...zw}}function Yw(e,t,n){return t.title?qw(t.title,n):e.title}function Xw(e,t,n){return t.summary?qw(t.summary,n):e.description??e.scene}function Zw(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}var Qw=`https://skillhub.cn/`;function $w(){return(0,K.jsx)(_n,{href:Qw,external:!0,className:`h-7 shrink-0 px-1.5 text-[13px]`,children:U(`marketplaceExternalSkillSourceTitle`)})}function eT(e){return(e??``).trim().toLowerCase()}function tT(e,t){let n=eT(t);return n.length>0?`${e}:${n}`:``}function nT(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=tT(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function rT(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=tT(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function iT(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=tT(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function aT(e,t){return t.get(tT(e.type,e.spec))||t.get(tT(e.type,e.id))||t.get(tT(e.type,e.label))}function oT(e,t,n,r){let i=eT(n);if(!i)return!0;let a=HC(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>eT(e)).filter(Boolean).some(e=>e.includes(i))}function sT(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=MC(o===`skill`),p=(0,G.useMemo)(()=>f.data?.scenes??[],[f.data?.scenes]),m=NC(p,o===`skill`),h=(0,G.useMemo)(()=>p.map(e=>({...e,count:typeof e.count==`number`?e.count:m.get(e.scene)})),[m,p]),g=(0,G.useMemo)(()=>t.map(e=>({item:e,record:iT(e,r)})),[t,r]),_=(0,G.useMemo)(()=>n.map(e=>({item:e,record:iT(e,r)})),[r,n]),v=(0,G.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 cT(){let e=FC(),t=IC(),{confirm:n,ConfirmDialog:r}=xx(),[i,a]=(0,G.useState)(new Set),[o,s]=(0,G.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:`${U(`marketplaceUninstallTitle`)} ${i}?`,description:U(`marketplaceUninstallDescription`),confirmLabel:U(`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`||!OC(r)||!await n({title:U(`marketplaceUpdateConflictTitle`),description:U(`marketplaceUpdateConflictDescription`),confirmLabel:U(`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 lT(){return(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center bg-background px-5 py-6`,children:(0,K.jsxs)(`div`,{className:`flex max-w-[260px] flex-col items-center gap-3 text-center`,children:[(0,K.jsx)(`span`,{className:`flex h-12 w-12 items-center justify-center rounded-lg border border-border bg-muted text-muted-foreground shadow-[0_1px_2px_rgba(30,20,10,0.04)]`,children:(0,K.jsx)(n,{className:`h-5 w-5`})}),(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:U(`docBrowserHomeTitle`)})]})})}function uT({currentTab:e,iframeRef:t,isEnabled:n}){return i({currentUrl:e?.currentUrl??null,iframeRef:t,isEnabled:n,restorationKey:e?`panel-app:resource:${e.dedupeKey??e.resourceUri??e.currentUrl}`:null})}function dT({isVisible:e,onRefresh:t,onSubmit:n,onUrlInputChange:r,placeholder:i,urlInput:a}){return e?(0,K.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/70 bg-card px-3.5 py-2 shrink-0`,children:[(0,K.jsxs)(`form`,{onSubmit:n,className:`flex-1 relative`,children:[(0,K.jsx)(kr,{className:`absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/70`}),(0,K.jsx)(`input`,{type:`text`,value:a,onChange:e=>r(e.target.value),"aria-label":U(`docBrowserAddressLabel`),placeholder:i,className:`h-8 w-full rounded-lg border border-border/75 bg-background pl-8 pr-3 text-xs text-foreground transition-colors placeholder:text-muted-foreground/55 focus:outline-none focus:ring-0`})]}),(0,K.jsx)(W,{icon:(0,K.jsx)(qr,{className:`h-3.5 w-3.5`}),label:U(`docBrowserRefresh`),onClick:t})]}):null}function fT({currentTab:e,currentUrl:t,customContent:n,iframeRef:r,iframeInstanceId:i,iframeSandbox:a,isDragging:o,isResizing:s,onIframeLoad:c,onIframePointerOver:l}){return(0,K.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[n||(0,K.jsx)(`iframe`,{ref:r,src:t,name:be(e?.contentParams),className:`absolute inset-0 w-full h-full border-0`,title:e?.title||`NextClaw Docs`,sandbox:a??(e?.kind===`content`?void 0:`allow-same-origin allow-scripts allow-popups allow-forms`),tabIndex:l?0:void 0,onLoad:c,onPointerOver:l,allow:`clipboard-read; clipboard-write`,allowFullScreen:!0},i),(s||o)&&(0,K.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function pT(e){try{let t=new URL(e,window.location.origin);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function mT({currentUrl:e,isVisible:t}){if(!t||!pT(e))return null;let n=Gi(e)?U(`docBrowserOpenExternal`):U(`docBrowserOpenInBrowser`);return(0,K.jsx)(`div`,{className:`flex items-center justify-between border-t border-border/70 bg-muted/55 px-4 py-2 shrink-0`,children:(0,K.jsx)(_n,{href:e,external:!0,iconPosition:`trailing`,size:`xs`,"data-doc-external":!0,children:n})})}function hT({tab:e}){return(0,K.jsx)(vz,{uri:e.resourceUri??e.currentUrl,icon:e.dockIcon})}function gT({tabs:e,activeTabId:t,canGoBack:n,canGoForward:r,dockState:i,onGoBack:a,onGoForward:o,onOpenNewTab:s,onToggleDock:c,onSetActiveTab:l,onCloseTab:u,getTabMenuGroups:d,mobileToolbar:f,compact:p=!1}){let[m,h]=(0,G.useState)(!1),g=U(`docBrowserBack`),_=U(`workbenchCloseTab`),v=i?.isDocked?i.removable?U(`sideDockUnpinCurrent`):U(`sideDockBuiltInDocked`):U(`sideDockPinCurrent`),y=U(`docBrowserForward`),b=U(`docBrowserNewTab`),x=e.map(e=>({key:e.id,label:e.title||U(`docBrowserTabUntitled`),active:e.id===t,tooltip:e.title,leadingIcon:(0,K.jsx)(hT,{tab:e}),closeLabel:_,closePlacement:`leading-hover`,onSelect:()=>l(e.id),onClose:()=>u(e.id),menuLabel:U(`docBrowserTabMoreActions`),menuGroups:d?.(e)})),S=[{key:`back`,disabled:!n,icon:(0,K.jsx)(Or,{className:`h-3.5 w-3.5`}),label:g,onClick:a},{key:`forward`,disabled:!r,icon:(0,K.jsx)(to,{className:`h-3.5 w-3.5`}),label:y,onClick:o},{key:`new-tab`,icon:(0,K.jsx)(Kr,{className:`h-3.5 w-3.5`}),label:b,onClick:s},...i?.canDock?[{key:`dock`,disabled:i.isDocked&&!i.removable,icon:i.isDocked&&i.removable?(0,K.jsx)(gs,{className:`h-3.5 w-3.5`}):(0,K.jsx)(_s,{className:`h-3.5 w-3.5`}),label:v,onClick:()=>c?.()}]:[]],C=e.find(e=>e.id===t),w=[{key:`tabs`,items:x.map(e=>({key:e.key,label:e.label,icon:e.leadingIcon,pressed:e.active,onSelect:e.onSelect}))},{key:`navigation`,items:S.map(e=>({key:e.key,label:e.label,icon:e.icon,disabled:e.disabled,onSelect:e.onClick}))},...C?d?.(C)??[]:[],...C?[{key:`close-tab`,items:[{key:`close-tab`,label:_,onSelect:()=>u(C.id)}]}]:[]];return p?(0,K.jsx)(`div`,{className:`flex h-12 min-w-0 flex-1 items-center`,children:(0,K.jsxs)(_i,{open:m,onOpenChange:h,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`flex h-8 min-w-0 items-center gap-2 rounded-lg px-2 text-sm font-medium hover:bg-[var(--interaction-hover)]`,"aria-label":U(`docBrowserTabMoreActions`),children:[C?(0,K.jsx)(hT,{tab:C}):null,(0,K.jsx)(`span`,{className:`truncate`,children:C?.title||U(`docBrowserTabUntitled`)}),(0,K.jsx)(Mr,{className:`h-4 w-4 shrink-0`})]})}),(0,K.jsxs)(hi,{align:`start`,variant:`menu`,className:`max-h-[70dvh]`,children:[(0,K.jsx)(rr,{groups:w,onClose:()=>h(!1)}),f]})]})}):(0,K.jsx)(ag,{testId:`doc-browser-tab-strip`,actionsTestId:`doc-browser-tab-actions`,tabs:x,actions:S,className:`flex h-10 min-w-0 flex-1 gap-1 border-0 bg-transparent px-0 select-none`,scrollClassName:`flex h-full max-md:h-11 max-md:basis-full items-center gap-0.5`,tabsClassName:`items-center gap-0.5`,actionsClassName:`h-full max-md:h-11 max-md:w-full items-center gap-0.5`,tabBaseClassName:`inline-flex cursor-pointer items-center gap-0.5 h-7 max-md:min-h-11 px-2 rounded-md text-xs max-w-[220px] shrink-0 transition-colors`,activeTabClassName:`bg-[var(--interaction-selection)] text-foreground`,inactiveTabClassName:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`,labelClassName:`px-0.5 text-xs font-normal`})}function _T({state:e,compact:t,onPlace:n,onMinimize:r,onRestore:i,onMaximize:a,onClose:o,closeLabel:s,onOpenMain:c,moreActions:l}){return(0,K.jsxs)(ti,{"data-workbench-actions":``,children:[c&&(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(Er,{className:`h-4 w-4`}),label:U(`workbenchOpenMain`),onClick:c}),!t&&n&&(0,K.jsx)(W,{size:`sm`,icon:e.placement===`floating`?(0,K.jsx)(ds,{className:`h-4 w-4`}):(0,K.jsx)(hs,{className:`h-4 w-4`}),label:U(e.placement===`floating`?`workbenchDock`:`workbenchFloatGroup`),onClick:n}),(0,K.jsx)(W,{size:`sm`,icon:e.minimized?(0,K.jsx)(Go,{className:`h-4 w-4`}):(0,K.jsx)(xn,{className:`h-4 w-4`}),label:U(e.minimized?`workbenchExpand`:`workbenchCollapse`),onClick:e.minimized?i:r}),!t&&!e.minimized&&(0,K.jsx)(W,{size:`sm`,icon:e.maximized?(0,K.jsx)(Zo,{className:`h-4 w-4`}):(0,K.jsx)(Go,{className:`h-4 w-4`}),label:U(e.maximized?`workbenchRestoreSize`:`workbenchMaximize`),onClick:a}),l,(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(Vr,{className:`h-4 w-4`}),label:s,onClick:o})]})}var vT={left:`left-0 top-3 bottom-3 w-1.5 cursor-ew-resize`,right:`right-0 top-3 bottom-3 w-1.5 cursor-ew-resize`,top:`top-0 left-3 right-3 h-1.5 cursor-ns-resize`,bottom:`bottom-0 left-3 right-3 h-1.5 cursor-ns-resize`,"top-left":`left-0 top-0 h-3 w-3 cursor-nwse-resize`,"top-right":`right-0 top-0 h-3 w-3 cursor-nesw-resize`,"bottom-left":`left-0 bottom-0 h-3 w-3 cursor-nesw-resize`,"bottom-right":`right-0 bottom-0 h-3 w-3 cursor-nwse-resize`},yT=()=>({width:window.innerWidth,height:window.innerHeight}),bT=e=>e instanceof Element&&!!e.closest(`button, a, input, textarea, select, [role="menu"], [data-compact-tab-item]`);function xT({id:e,manager:t,title:n,icon:r,navigation:i,moreActions:a,children:o,onClose:s,closeLabel:c=U(`workbenchCloseView`),onPlace:l,onOpenMain:u,width:d=480,minWidth:f=320,maxWidth:p=960,onWidthCommit:m,fullscreen:h=!1,hidden:g=!1,testId:_,className:v,focusOnOpen:y=!1}){let b=ia(t=>t.surfaces[e]??zi),x=(0,G.useRef)(null),S=(0,G.useRef)(null),C=(0,G.useRef)(null),[w,T]=(0,G.useState)(()=>window.innerWidth<768),[E,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(null),A=w||h,j=b.placement===`floating`,M=A||b.maximized;(0,G.useEffect)(()=>{C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,y&&x.current?.focus();let n=()=>{T(window.innerWidth<768),t.constrain(e,yT())};return n(),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`resize`,n),S.current?.()}},[e,t,y]),(0,G.useEffect)(()=>(t.setVisible(e,!g),()=>t.setVisible(e,!1)),[g,e,t]);let N=()=>x.current?.focus(),P=()=>{s(),C.current?.isConnected&&!x.current?.contains(C.current)&&C.current.focus()},ee=(n,r)=>{if(n.button!==0||M||b.minimized||!r&&bT(n.target)||!r&&!j)return;n.preventDefault(),n.stopPropagation(),n.currentTarget.setPointerCapture?.(n.pointerId),S.current?.(),t.focus(e),D(!0);let i={x:n.clientX,y:n.clientY,rect:b.rect,width:d},a=d,o=n=>{let o=n.clientX-i.x,s=n.clientY-i.y;r===`dock`?(a=Math.max(Math.min(f,window.innerWidth),Math.min(p,window.innerWidth,i.width-o)),k(a)):r?t.resize(e,i.rect,r,o,s,yT()):t.move(e,i.rect,o,s,yT())},s=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)},c=()=>{s(),S.current=null,D(!1),k(null),r===`dock`&&m?.(a)};S.current=s,window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},te=ia(t=>t.visibleSurfaceIds.filter(e=>t.surfaces[e]?.minimized).sort().indexOf(e)),F=ia(e=>e.visibleSurfaceIds.filter(t=>(e.surfaces[t]?.layer??0)<=b.layer).length),ne=b.minimized?{position:`fixed`,bottom:12+Math.max(0,te)*48,right:12,width:`min(360px, calc(100vw - 24px))`,zIndex:50+F}:M?{position:`fixed`,inset:0,width:`100%`,height:`100dvh`,zIndex:50+F}:j?{position:`fixed`,left:b.rect.x,top:b.rect.y,width:b.rect.w,height:b.rect.h,zIndex:50+F}:{width:O??d,height:`100%`};return(0,K.jsxs)(`aside`,{ref:x,role:`region`,"aria-label":n,tabIndex:-1,hidden:g,"data-testid":_,"data-workbench-surface":e,"data-placement":b.placement,"data-maximized":b.maximized||void 0,"data-minimized":b.minimized||void 0,"data-theme-surface":`workspace-panel`,className:V(`relative min-h-0 min-w-0 shrink-0 flex-col overflow-hidden bg-card text-card-foreground outline-none`,g?`hidden`:`flex`,(j||b.minimized)&&!M?`rounded-xl border border-border shadow-2xl`:`border-l border-border`,v),style:ne,onPointerDownCapture:()=>t.focus(e),onFocusCapture:()=>t.focus(e),onKeyDown:n=>{n.key!==`Escape`||n.defaultPrevented||n.nativeEvent.isComposing||(b.maximized?(n.stopPropagation(),t.toggleMaximize(e),N()):j&&!b.minimized&&(n.stopPropagation(),t.minimize(e),N()))},children:[(0,K.jsxs)(`header`,{className:V(`flex shrink-0 select-none items-center gap-1 border-b border-border/60 bg-muted/30 pr-2`,i&&!b.minimized?`min-h-8 pl-0`:`min-h-10 pl-2`),style:{touchAction:j?`none`:void 0,paddingTop:A?`env(safe-area-inset-top, 0px)`:void 0},onPointerDown:e=>ee(e),onDoubleClick:n=>{!A&&!bT(n.target)&&t.toggleMaximize(e)},children:[(0,K.jsx)(`div`,{hidden:b.minimized,className:V(`min-w-0 flex-1`,b.minimized||!i?`hidden`:`flex`),children:i}),(0,K.jsxs)(`span`,{className:V(`flex min-w-0 flex-1 items-center gap-2 px-1 text-xs font-medium`,j&&!M&&`cursor-grab active:cursor-grabbing`,i&&!b.minimized&&`hidden`),children:[r,(0,K.jsx)(`span`,{className:`truncate`,title:n,children:n})]}),(0,K.jsx)(_T,{state:b,compact:A,onPlace:l??(()=>t.place(e,j?`docked`:`floating`)),onMinimize:()=>{t.minimize(e),N()},onRestore:()=>t.restore(e),onMaximize:()=>t.toggleMaximize(e),onClose:P,closeLabel:c,onOpenMain:u,moreActions:a})]}),(0,K.jsx)(`div`,{hidden:b.minimized,className:V(`min-h-0 min-w-0 flex-1 flex-col`,b.minimized?`hidden`:`flex`),children:o}),!M&&!b.minimized&&(0,K.jsx)(ST,{floating:j,width:O??d,minWidth:f,maxWidth:p,onWidthCommit:m,onPointerDown:ee}),E&&(0,K.jsx)(`div`,{className:`fixed inset-0 z-30`,"data-workbench-interaction-shield":``})]})}function ST({floating:e,width:t,minWidth:n,maxWidth:r,onWidthCommit:i,onPointerDown:a}){return e?(0,K.jsx)(K.Fragment,{children:Object.entries(vT).map(([e,t])=>(0,K.jsx)(`div`,{"data-workbench-resize":e,className:V(`absolute z-20 touch-none`,t),onPointerDown:t=>a(t,e)},e))}):i?(0,K.jsx)(`div`,{role:`separator`,"aria-label":U(`workbenchResize`),"aria-orientation":`vertical`,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":t,tabIndex:0,"data-testid":`resizable-right-panel-handle`,className:`absolute bottom-0 left-0 top-0 z-20 w-1.5 cursor-ew-resize touch-none hover:bg-primary/20 focus-visible:bg-primary/30 focus-visible:outline-none`,onPointerDown:e=>a(e,`dock`),onKeyDown:e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let a=e.key===`Home`?n:e.key===`End`?r:t+(e.key===`ArrowLeft`?24:-24);i(Math.max(n,Math.min(r,window.innerWidth,a)))}}):null}function CT(e,t){if(e.startsWith(`/`))try{return new URL(e,t).toString()}catch{return e}return/^[a-z][a-z\d+.-]*:\/\//i.test(e)||e===`about:blank`?e:/^(localhost|127\.|0\.0\.0\.0|\[::1\])(?::|\/|$)/i.test(e)?`http://${e}`:`https://${e}`}function wT(e,t,n){return(0,G.useCallback)(()=>{if(n?.canDock){if(n.isDocked){n.removable&&e?.unpinTab(t);return}e?.pinTab(t)}},[t,e,n])}function TT({activeTabId:e,currentUrl:t,isAddressToolbarTab:n,isContentTab:r,isDocsTab:i,navigate:a}){let o=`${e}:${t}:${r?`content`:`docs`}`,[s,c]=(0,G.useState)(null),l=(()=>{if(!n)return``;if(r)return t;try{return new URL(t).pathname}catch{return t}})(),u=s?.key===o?s.value:l,d=(0,G.useCallback)(e=>c({key:o,value:e}),[o]);return{handleUrlSubmit:(0,G.useCallback)(e=>{if(e.preventDefault(),!n)return;let r=u.trim();r&&(i&&r.startsWith(`/`)?a(Yi(r)):i&&r.startsWith(`http`)?a(r):a(i?Yi(`/${r}`):CT(r,t)))},[t,n,i,a,u]),setUrlInput:d,urlInput:u}}function ET({customTabRenderers:e={},displayMode:t=`desktop`,dockControls:n,getTabMenuGroups:r}){let{isOpen:i,dockedWidth:a,tabs:o,activeTabId:s,activeHistory:c,activeHistoryIndex:l,currentTab:u,open:d,openTarget:f,openNewTab:p,close:m,setDockedWidth:h,goBack:g,goForward:_,navigate:v,syncUrl:y,setActiveTab:b,closeTab:x}=Xi(),[S,C]=(0,G.useState)(0),w=(0,G.useRef)(null),T=u?.currentUrl??Qi(),E=u?.navVersion??0,D=`${s}:${E}:${S}`,O=(0,G.useRef)(null),k=(0,G.useRef)(E),A=u?.kind===`docs`,j=u?.kind===Wi,M=l>0,N=l<c.length-1,P=u?e[u.kind]:void 0,ee=n?.getDockState(u),te=u?.kind===`content`,F=A||te,ne=uT({currentTab:u,iframeRef:w,isEnabled:P?.supportsScrollRestoration===!0}),{handleUrlSubmit:I,setUrlInput:re,urlInput:ie}=TT({activeTabId:s,currentUrl:T,isAddressToolbarTab:F,isContentTab:te,isDocsTab:A,navigate:v});(0,G.useEffect)(()=>{if(!A){O.current=null;return}if(E!==k.current){k.current=E,O.current=Bi(T);return}if(w.current?.contentWindow)try{let e=new URL(T).pathname;O.current=Bi(T),w.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[T,E,A]),(0,G.useEffect)(()=>{let e=e=>{if(!(!A||e.source!==w.current?.contentWindow)&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=Bi(e.data.url);if(O.current&&t!==O.current)return;O.current=null,y(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[T,y,A]),(0,G.useEffect)(()=>{if(!u||!P?.onIframeMessage)return;let e=e=>{P.onIframeMessage?.({event:e,iframe:w.current,iframeInstanceId:D,tab:u})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[u,P,D]);let ae=(0,G.useCallback)(()=>{C(e=>e+1)},[]),oe=wT(n,u,ee),se=t===`fullscreen`,{isMobile:ce}=Gr(),le=u?{currentUrl:T,open:d,openTarget:f,refreshIframe:ae,tab:u}:void 0,ue=le?P?.renderToolbar?.(le):null,de=le?P?.renderContent?.(le)??(j?(0,K.jsx)(lT,{}):null):null,fe=u?P?.getIframeSandbox?.(u):void 0,L=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(dT,{isVisible:F,onRefresh:ae,onSubmit:I,onUrlInputChange:re,placeholder:U(A?`docBrowserSearchPlaceholder`:`docBrowserAddressPlaceholder`),urlInput:ie}),ce?null:ue,(0,K.jsx)(fT,{currentTab:u,currentUrl:T,customContent:de,iframeRef:w,iframeInstanceId:D,iframeSandbox:fe,isDragging:!1,isResizing:!1,onIframeLoad:ne,onIframePointerOver:P?.onIframePointerOver}),(0,K.jsx)(mT,{currentUrl:T,isVisible:A||te})]});return(0,K.jsx)(xT,{id:Ri,manager:rV().workbenchSurfaceManager,title:u?.title||U(`workbenchGlobalGroup`),testId:`doc-browser-panel`,width:a,minWidth:320,maxWidth:860,onWidthCommit:h,onClose:m,closeLabel:U(`workbenchHideGroup`),hidden:!i,fullscreen:se,navigation:(0,K.jsx)(gT,{mobileToolbar:ue,compact:ce,tabs:o,activeTabId:s,canGoBack:M,canGoForward:N,dockState:ee,onGoBack:g,onGoForward:_,onOpenNewTab:p,onToggleDock:oe,onSetActiveTab:b,onCloseTab:x,getTabMenuGroups:r}),children:L})}function DT(){let e=$(),t=fn();(0,G.useEffect)(()=>{let n=n=>{if(n.defaultPrevented||n.button!==0||n.ctrlKey||n.metaKey||n.shiftKey||n.altKey)return;let r=n.target instanceof Element?n.target.closest(`a[href]`):null;if(!r||r.hasAttribute(`data-doc-external`)||r.hasAttribute(`download`))return;let i=r.getAttribute(`href`)??``;if(!i.startsWith(`nextclaw://`)&&!Gi(i))return;n.preventDefault(),n.stopPropagation();let a=r.closest(`[data-resource-session]`),o=e.pageResourceManager.resolve(i,{workingDir:a?.dataset.resourceWorkingDir,sessionKey:a?.dataset.resourceSession});if(o){let n=r.cloneNode(!0);n.querySelectorAll(`[aria-hidden="true"]`).forEach(e=>e.remove());let i=n.textContent?.trim();e.pageResourceManager.open(i?{...o,title:i,target:{...o.target,title:i}}:o,`default`,t)}else z.error(U(`pageUnavailable`))};return document.addEventListener(`click`,n,!0),()=>document.removeEventListener(`click`,n,!0)},[e,t])}function OT(e){let t=$(),n=fn(),r=Xi(),i=(0,G.useRef)({byKey:new Map,seq:0});return{openItemDetail:async(a,o)=>{if(o?.resourceUri){let e=t.pageResourceManager.resolve(o.resourceUri);e?t.pageResourceManager.open(e,`default`,n):z.error(U(`pageUnavailable`));return}let s=a?.name??o?.label??o?.id??o?.spec??U(`marketplaceUnknownItem`),c=ZC(a?`skill`:`skill-local`,a?.slug??o?.id??o?.spec??s),l=a?`marketplace:${a.type}:${a.slug}`:`marketplace:${o?.type??`unknown`}:${o?.id??o?.spec??s}`,u=U(`marketplaceTypeSkill`);if(!a){tw(r,{id:c,title:s,typeLabel:u,spec:o?.spec??`-`,status:`ready`,summary:U(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(o??{},null,2),contentRaw:`-`});return}let d=i.current.seq+1;i.current.seq=d,i.current.byKey.set(l,d);let f=HC(a.summaryI18n,a.summary,e);tw(r,{id:c,title:s,typeLabel:u,spec:a.install.spec,status:`loading`,summary:f,tags:a.tags,author:a.author});try{let e=await y(a.slug);if(i.current.byKey.get(l)!==d)return;tw(r,{id:c,title:s,typeLabel:u,spec:a.install.spec,status:`ready`,summary:f,metadataRaw:e.metadataRaw,contentRaw:e.bodyRaw||e.raw,sourceUrl:e.sourceUrl,sourceLabel:`Source (${e.source})`,tags:a.tags,author:a.author},{activate:!1})}catch(e){if(i.current.byKey.get(l)!==d)return;tw(r,{id:c,title:s,typeLabel:u,spec:a.install.spec,status:`error`,summary:f,metadataRaw:JSON.stringify({error:e instanceof Error?e.message:String(e)},null,2),contentRaw:U(`marketplaceOperationFailed`)},{activate:!1})}}}}function kT(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,G.useMemo)(()=>o?.records??[],[o?.records]),m=(0,G.useMemo)(()=>a?.items??[],[a?.items]),h=(0,G.useMemo)(()=>nT(m),[m]),g=(0,G.useMemo)(()=>rT(p),[p]),_=(0,G.useMemo)(()=>p.filter(e=>e.type===n).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:aT(e,h)})).filter(e=>oT(e.record,e.item,r,i)).sort((e,t)=>AT(e.record,t.record)),[p,n,h,r,i]),v=(0,G.useMemo)(()=>t===`installed`?_:m.map(e=>({key:e.id,item:e,record:iT(e,g)})),[m,_,g,t]),y=t===`all`&&s&&!a||t===`installed`&&d&&!o,b=t===`all`&&!y&&!!a&&c&&!l,x=t===`installed`?d&&!o?U(`loading`):`${_.length} ${U(`marketplaceInstalledSkillsCountSuffix`)}`:a?`${a.total} ${U(`marketplaceSkillsCountSuffix`)}`:U(`loading`),S=t===`all`&&u?u:t===`installed`&&f?f:void 0,C={scope:t,entries:v,header:{title:U(t===`installed`?`marketplaceSectionInstalledSkills`:`marketplaceAllSkills`),summary:x,refreshingLabel:U(`marketplaceRefreshingResults`)},status:{showSkeleton:y,isRefreshing:b,error:S},emptyLabel:U(t===`installed`?`marketplaceNoInstalledSkills`:`marketplaceNoSkills`),errorLabel:U(t===`installed`?`marketplaceErrorLoadingInstalledSkills`:`marketplaceErrorLoadingSkillsData`)};return{allItems:m,installedRecordLookup:g,installedTotal:o?.total??0,itemListView:C,showListSkeleton:y,isRefreshingList:b}}function AT(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 jT=160;function MT({disabled:e,onLoadMore:t,thresholdPx:n=jT,watchValue:r}){let i=(0,G.useRef)(null),a=(0,G.useRef)(null),o=(0,G.useRef)(t),s=(0,G.useRef)(!1);return(0,G.useEffect)(()=>{o.current=t},[t]),(0,G.useEffect)(()=>{e&&(s.current=!1)},[e]),(0,G.useEffect)(()=>{let t=i.current,r=a.current;if(e||!t||!r)return;let c=()=>{s.current||e||(s.current=!0,Promise.resolve(o.current()).finally(()=>{s.current=!1}))},l=()=>{r.getBoundingClientRect().top-t.getBoundingClientRect().bottom<=n&&c()};if(typeof IntersectionObserver==`function`){let e=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c()},{root:t,rootMargin:`0px 0px ${n}px 0px`});return e.observe(r),l(),()=>{e.disconnect()}}return t.addEventListener(`scroll`,l,{passive:!0}),l(),()=>{t.removeEventListener(`scroll`,l)}},[e,n,r]),{containerRef:i,sentinelRef:a}}var NT=20;function PT({forcedType:e}={}){let t=fn(),n=pn(),{language:r}=d(),i=`skill`,a=(0,G.useMemo)(()=>BC(r),[r]),[o,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(``),[u,f]=(0,G.useState)(`all`),[p,m]=(0,G.useState)(`relevance`),{installState:h,manageState:g,handleInstall:_,handleManage:v,ConfirmDialog:y}=cT(),{openItemDetail:b}=OT(a);(0,G.useEffect)(()=>{let e=setTimeout(()=>{l(o.trim())},250);return()=>clearTimeout(e)},[o]);let S=PC(i),C=i===`skill`?n.scene?.trim():void 0,w=kC({q:C?void 0:c||void 0,scene:C,type:i,sort:p,pageSize:NT}),T=AC(i,u===`all`&&!o.trim()&&!c&&!C),{containerRef:E,sentinelRef:D}=MT({disabled:u!==`all`||w.isError||!w.hasNextPage||w.isFetchingNextPage,onLoadMore:()=>w.fetchNextPage(),watchValue:`${i}:${u}:${c}:${C??``}:${p}:${w.data?.loadedItems??0}:${w.data?.loadedPages??0}`}),{onScroll:O}=aS({restorationKey:`marketplace:${e??`all`}`,scrollRef:E});(0,G.useEffect)(()=>{let e=E.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[E,c,C,u,p,i]);let k=kT({scope:u,typeFilter:i,query:c,localeFallbacks:a,catalogView:w.data,installedView:S.data,isCatalogLoading:w.isLoading,isCatalogFetching:w.isFetching,isCatalogFetchingNextPage:w.isFetchingNextPage,catalogError:w.isError?w.error:void 0,isInstalledLoading:S.isLoading,installedError:S.isError?S.error:void 0}),A=sT({items:k.allItems,recentItems:T.data?.items??[],installedRecordLookup:k.installedRecordLookup,scene:C,forcedType:e,typeFilter:i,scope:u,searchText:o,query:c,showListSkeleton:k.showListSkeleton,hasCatalogError:w.isError});return(0,K.jsxs)(x,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!A.isSceneRoute&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3 border-b border-border/60`,children:[(0,K.jsx)(Ti,{value:u,onValueChange:e=>f(e),children:(0,K.jsxs)(wi,{className:`mb-0 h-auto flex-1 justify-start gap-4 sm:gap-6 rounded-none border-b-0 bg-transparent p-0 text-muted-foreground`,children:[(0,K.jsx)(Ci,{value:`all`,className:`rounded-none border-b-2 border-transparent bg-transparent px-0 pb-3 pt-0 shadow-none hover:bg-[var(--interaction-hover)] data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:U(`marketplaceTabMarketplaceSkills`)}),(0,K.jsxs)(Ci,{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-[var(--interaction-hover)] data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:text-gray-950 data-[state=active]:shadow-none`,children:[U(`marketplaceTabInstalledSkills`),(0,K.jsx)(`span`,{className:`text-[11px] font-medium text-gray-500`,children:k.installedTotal})]})]})}),(0,K.jsx)($w,{})]}),(0,K.jsx)(LC,{scope:u,searchText:o,isRefreshing:k.isRefreshingList,searchPlaceholder:U(`marketplaceSearchPlaceholderSkills`),sort:p,onSearchTextChange:s,onSortChange:m})]}),(0,K.jsx)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,K.jsxs)(`div`,{ref:E,onScroll:O,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":k.showListSkeleton||w.isFetchingNextPage,children:[A.isSceneRoute&&A.selectedScene&&(0,K.jsx)(Ww,{scene:A.selectedScene,entries:A.sceneEntries,isLoading:k.showListSkeleton,language:r,localeFallbacks:a,installState:h,onBack:()=>t(A.backPath),onOpen:e=>void b(e.item,e.record),onInstall:_}),A.isSceneRoute&&!k.showListSkeleton&&(0,K.jsx)(zC,{hasMore:!!w.hasNextPage,loading:w.isFetchingNextPage,sentinelRef:D}),A.showShelves&&(0,K.jsx)(Hw,{recentEntries:A.recentEntries,scenes:A.scenes,isScenesLoading:A.isScenesLoading,isItemsLoading:k.showListSkeleton||T.isLoading,language:r,installState:h,onOpen:e=>void b(e.item,e.record),onInstall:_,onOpenScene:e=>t(`${A.pathPrefix}/${e}`)}),!A.isSceneRoute&&(0,K.jsx)(jw,{model:k.itemListView,showTitle:A.showShelves||!k.showListSkeleton,operationState:{installState:h,manageState:g},scroll:{hasMore:!!w.hasNextPage,loadingMore:w.isFetchingNextPage,sentinelRef:D},actions:{onOpen:(e,t)=>void b(e,t),onInstall:_,onManage:v}})]})}),(0,K.jsx)(y,{})]})}function FT(e){return(e??``).trim().toLowerCase()}function IT(e){let t=new Map;for(let n of e){let e=[n.catalogSlug,n.spec,n.id,n.label];for(let r of e){let e=FT(r);!e||t.has(e)||t.set(e,n)}}return t}function LT(e,t){let n=[e.slug,e.install.spec,e.id,e.name];for(let e of n){let n=FT(e);if(!n)continue;let r=t.get(n);if(r)return r}}function RT(e,t,n){return HC(t?.summaryI18n,t?.summary,e)||UC(n,e)||U(`marketplaceInstalledLocalSummary`)}function zT(e,t){return t?.transport?t.transport.toUpperCase():(e?.install?.transportTypes??[]).map(e=>e.toUpperCase()).join(` / `)||`MCP`}function BT(e){let{item:t,record:n,localeFallbacks:r,onOpen:i,onInstall:a,onToggle:o,onDoctor:s,onRemove:c}=e,l=n,u=t?.name??n?.label??n?.id??`MCP`,d=RT(r,t,n),f=zT(t,n),p=l?l.enabled===!1?U(`marketplaceDisable`):U(`statusReady`):null;return(0,K.jsx)(`article`,{onClick:i,className:`rounded-2xl border border-gray-200/70 bg-white p-4 shadow-sm transition${i?` cursor-pointer hover:border-blue-300 hover:shadow-md`:``}`,children:(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-sm font-semibold text-gray-900`,children:u}),(0,K.jsx)(`div`,{className:`mt-1 text-xs text-gray-500`,children:f}),(0,K.jsx)(`div`,{className:`mt-2 line-clamp-2 text-sm text-gray-600`,children:d}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(t?.tags??[]).map(e=>(0,K.jsx)(Oi,{children:e},e)),p?(0,K.jsx)(Oi,{tone:`success`,children:p}):null]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[!l&&t&&a?(0,K.jsx)(B,{type:`button`,size:`sm`,variant:`primary`,className:`rounded-xl`,onClick:e=>{e.stopPropagation(),a()},children:U(`marketplaceInstall`)}):null,l?(0,K.jsxs)(K.Fragment,{children:[o?(0,K.jsx)(B,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-gray-200 text-gray-700`,onClick:e=>{e.stopPropagation(),o()},children:l.enabled===!1?U(`marketplaceEnable`):U(`marketplaceDisable`)}):null,s?(0,K.jsx)(B,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-blue-200 text-blue-700 hover:border-blue-300 hover:bg-[var(--interaction-hover)] hover:text-blue-700`,onClick:e=>{e.stopPropagation(),s()},children:U(`marketplaceMcpDoctor`)}):null,c?(0,K.jsx)(B,{type:`button`,size:`sm`,variant:`outline`,className:`rounded-xl border-rose-200 text-rose-600 hover:border-rose-300 hover:bg-destructive/10 hover:text-rose-600`,onClick:e=>{e.stopPropagation(),c()},children:U(`marketplaceMcpRemove`)}):null]}):null,n?.id&&(0,K.jsx)(jz,{page:Ez(`mcp-server`,n.id,u)})]})]})})}var VT=Nn,HT=Cn,UT=G.forwardRef(({className:e,...t},n)=>(0,K.jsx)(wn,{ref:n,"data-theme-overlay":`modal-backdrop`,className:V(`fixed inset-0 z-[var(--z-modal-backdrop,10000)] bg-black/35 backdrop-blur-[1px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));UT.displayName=wn.displayName;var WT=ft(`fixed z-[var(--z-modal,10050)] bg-background shadow-2xl transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),GT=G.forwardRef(({children:e,className:t,closeLabel:n=`Close`,side:r,...i},a)=>(0,K.jsxs)(HT,{children:[(0,K.jsx)(UT,{}),(0,K.jsxs)(Tr,{ref:a,"data-theme-overlay":`sheet`,className:V(WT({side:r}),t),...i,onEscapeKeyDown:e=>{vr(e)||i.onEscapeKeyDown?.(e)},children:[e,(0,K.jsxs)(Sn,{className:`absolute right-4 top-4 rounded-lg p-1.5 text-muted-foreground opacity-75 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground hover:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border disabled:pointer-events-none`,children:[(0,K.jsx)(Vr,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`sr-only`,children:n})]})]})]}));GT.displayName=Tr.displayName;function KT({className:e,...t}){return(0,K.jsx)(`div`,{className:V(`flex flex-col space-y-2 text-left`,e),...t})}KT.displayName=`SheetHeader`;function qT({className:e,...t}){return(0,K.jsx)(`div`,{className:V(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}qT.displayName=`SheetFooter`;var JT=G.forwardRef(({className:e,...t},n)=>(0,K.jsx)(or,{ref:n,className:V(`text-lg font-semibold tracking-tight text-foreground`,e),...t}));JT.displayName=or.displayName;var YT=G.forwardRef(({className:e,...t},n)=>(0,K.jsx)(Rn,{ref:n,className:V(`text-sm leading-relaxed text-muted-foreground`,e),...t}));YT.displayName=Rn.displayName;var XT=G.forwardRef(({className:e,...t},n)=>(0,K.jsx)(`textarea`,{className:V(`flex min-h-28 w-full rounded-xl border border-border/75 bg-card px-3.5 py-2.5 text-sm text-foreground placeholder:text-muted-foreground/55 placeholder:font-normal transition-colors focus:outline-none focus:ring-0 disabled:cursor-not-allowed disabled:opacity-50`,`max-md:text-base`,e),ref:n,...t}));XT.displayName=`Textarea`;function ZT({open:e,testing:t,saving:n,onOpenChange:r,onTest:i,onSave:a}){let[o,s]=(0,G.useState)(`stdio`),[c,l]=(0,G.useState)(``),[u,d]=(0,G.useState)(``),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(``),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(``),[b,x]=(0,G.useState)(``),[S,C]=(0,G.useState)(`15000`),[w,T]=(0,G.useState)(!0),[E,D]=(0,G.useState)(null),[O,k]=(0,G.useState)(null),A=(0,G.useMemo)(()=>$T({transport:o,name:c,command:u,args:f,cwd:m,env:g,url:v,headers:b,timeout:S,verifyTls:w}),[f,u,m,g,b,c,S,o,v,w]),j=()=>{D(null),k(null)},M=async()=>{if(A instanceof Error)return k(A.message);j();try{let e=await i(A);D(e),e.accessible||k(e.error??U(`mcpConnectionTestFailed`))}catch(e){k(e instanceof Error?e.message:String(e))}},N=async()=>{if(!(A instanceof Error||!E?.accessible))try{await a(A),r(!1),j()}catch(e){k(e instanceof Error?e.message:String(e))}};return(0,K.jsx)(VT,{open:e,onOpenChange:r,children:(0,K.jsxs)(GT,{side:`right`,closeLabel:U(`cancel`),className:`flex h-full w-full flex-col overflow-hidden p-0 sm:max-w-[560px]`,children:[(0,K.jsxs)(KT,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,K.jsx)(JT,{children:U(`mcpConnectionTitle`)}),(0,K.jsx)(YT,{children:U(`mcpConnectionDescription`)})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,K.jsx)(QT,{label:U(`mcpConnectionTransport`),children:(0,K.jsxs)(`select`,{className:`flex h-10 w-full rounded-xl border border-border/75 bg-card px-3 text-sm`,value:o,onChange:e=>{s(e.target.value),j()},children:[(0,K.jsx)(`option`,{value:`stdio`,children:U(`mcpConnectionStdio`)}),(0,K.jsx)(`option`,{value:`http`,children:`HTTP`}),(0,K.jsx)(`option`,{value:`sse`,children:`SSE`})]})}),(0,K.jsx)(QT,{label:U(`mcpConnectionName`),children:(0,K.jsx)(F,{value:c,onChange:e=>{l(e.target.value),j()},placeholder:`my-mcp`})}),o===`stdio`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(QT,{label:U(`mcpConnectionCommand`),children:(0,K.jsx)(F,{value:u,onChange:e=>{d(e.target.value),j()},placeholder:`npx`})}),(0,K.jsx)(QT,{label:U(`mcpConnectionArgs`),hint:U(`mcpConnectionArgsHint`),children:(0,K.jsx)(F,{value:f,onChange:e=>{p(e.target.value),j()},placeholder:`-y @example/mcp-server`})}),(0,K.jsx)(QT,{label:U(`mcpConnectionCwd`),children:(0,K.jsx)(F,{value:m,onChange:e=>{h(e.target.value),j()}})}),(0,K.jsx)(QT,{label:U(`mcpConnectionEnv`),hint:U(`mcpConnectionPairsHint`),children:(0,K.jsx)(XT,{className:`min-h-20 font-mono`,value:g,onChange:e=>{_(e.target.value),j()},placeholder:`API_KEY=...`})}),(0,K.jsx)(`p`,{className:`rounded-xl bg-amber-500/10 px-3 py-2 text-sm text-amber-900 dark:text-amber-100`,children:U(`mcpConnectionLocalWarning`)})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(QT,{label:U(`mcpConnectionUrl`),children:(0,K.jsx)(F,{type:`url`,value:v,onChange:e=>{y(e.target.value),j()},placeholder:`https://example.com/mcp`})}),(0,K.jsx)(QT,{label:U(`mcpConnectionHeaders`),hint:U(`mcpConnectionPairsHint`),children:(0,K.jsx)(XT,{className:`min-h-20 font-mono`,value:b,onChange:e=>{x(e.target.value),j()},placeholder:`Authorization=Bearer ...`})}),(0,K.jsx)(QT,{label:U(`mcpConnectionTimeout`),children:(0,K.jsx)(F,{type:`number`,min:`1`,value:S,onChange:e=>{C(e.target.value),j()}})}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-muted/60 px-3 py-3`,children:[(0,K.jsx)(`span`,{className:`text-sm`,children:U(`mcpConnectionVerifyTls`)}),(0,K.jsx)(Me,{checked:w,onCheckedChange:e=>{T(e),j()}})]}),(0,K.jsx)(`p`,{className:`rounded-xl bg-muted px-3 py-2 text-sm text-muted-foreground`,children:U(`mcpConnectionRemoteWarning`)})]}),E?.accessible?(0,K.jsx)(`p`,{className:`rounded-xl bg-emerald-500/10 px-3 py-2 text-sm text-emerald-800 dark:text-emerald-100`,children:U(`mcpConnectionTestSuccess`).replace(`{count}`,String(E.toolCount))}):null,O?(0,K.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:O}):null]}),(0,K.jsxs)(qT,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[(0,K.jsx)(B,{type:`button`,variant:`outline`,onClick:()=>r(!1),disabled:t||n,children:U(`cancel`)}),(0,K.jsx)(B,{type:`button`,variant:`outline`,onClick:()=>void M(),disabled:t||n,children:U(t?`mcpConnectionTesting`:`mcpConnectionTest`)}),(0,K.jsx)(B,{type:`button`,onClick:()=>void N(),disabled:!E?.accessible||t||n,children:U(n?`saving`:`mcpConnectionSave`)})]})]})})}function QT({label:e,hint:t,children:n}){return(0,K.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,K.jsx)(`span`,{className:`text-sm font-medium`,children:e}),t?(0,K.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:t}):null,n]})}function $T(e){try{let t=e.name.trim();if(!t)throw Error(U(`mcpConnectionNameRequired`));if(e.transport===`stdio`){let n=e.command.trim();if(!n)throw Error(U(`mcpConnectionCommandRequired`));return{name:t,definition:{enabled:!0,transport:{type:`stdio`,command:n,args:e.args.trim()?e.args.trim().split(/\s+/):[],cwd:e.cwd.trim(),env:eE(e.env),stderr:`pipe`},scope:{allAgents:!0,agents:[]},policy:{trust:`explicit`,start:`eager`}}}}let n=e.url.trim();if(!n)throw Error(U(`mcpConnectionUrlRequired`));let r=Number(e.timeout);if(!Number.isFinite(r)||r<=0)throw Error(U(`mcpConnectionTimeoutInvalid`));let i={url:n,headers:eE(e.headers),timeoutMs:Math.trunc(r),verifyTls:e.verifyTls};return{name:t,definition:{enabled:!0,transport:e.transport===`http`?{type:`http`,...i}:{type:`sse`,...i,reconnect:{enabled:!0,initialDelayMs:1e3,maxDelayMs:3e4}},scope:{allAgents:!0,agents:[]},policy:{trust:`explicit`,start:`eager`}}}}catch(e){return e instanceof Error?e:Error(String(e))}}function eE(e){return Object.fromEntries(e.split(`
|
|
21
|
+
`).filter(Boolean).map(e=>{let t=e.indexOf(`=`);if(t<=0)throw Error(U(`mcpConnectionPairsInvalid`));return[e.slice(0,t).trim(),e.slice(t+1)]}))}var tE=ft(`rounded-2xl border px-4 py-3`,{variants:{tone:{neutral:`border-gray-200 bg-gray-50 text-gray-900`,success:`border-emerald-200 bg-emerald-50 text-emerald-900`,warning:`border-amber-200 bg-amber-50 text-amber-900`,danger:`border-rose-200 bg-rose-50 text-rose-700`,info:`border-primary/20 bg-primary/10 text-primary`},borderStyle:{solid:``,dashed:`border-dashed`}},defaultVariants:{tone:`neutral`,borderStyle:`solid`}}),nE={neutral:`text-gray-900`,success:`text-emerald-800`,warning:`text-amber-900`,danger:`text-rose-700`,info:`text-primary`},rE={neutral:`text-gray-600`,success:`text-emerald-700`,warning:`text-amber-800`,danger:`text-rose-700`,info:`text-primary/90`},iE=G.forwardRef(({className:e,tone:t=`neutral`,borderStyle:n=`solid`,title:r,description:i,icon:a,actions:o,children:s,...c},l)=>{let u=t??`neutral`,d=!!r||!!i||!!a||!!o;return(0,K.jsxs)(`div`,{ref:l,className:V(tE({tone:u,borderStyle:n}),e),...c,children:[d?(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a?(0,K.jsx)(`div`,{className:`mt-0.5 shrink-0`,children:a}):null,(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[r?(0,K.jsx)(`p`,{className:V(`text-sm font-medium`,nE[u]),children:r}):null,i?(0,K.jsx)(`p`,{className:V(r?`mt-1`:``,`text-sm leading-6`,rE[u]),children:i}):null]})]})}),o?(0,K.jsx)(`div`,{className:`shrink-0`,children:o}):null]}):null,s?(0,K.jsx)(`div`,{className:V(d?`mt-3`:``),children:s}):null]})});iE.displayName=`NoticeCard`;function aE(e){let{item:t,open:n,pending:r,onOpenChange:i,onSubmit:a}=e;return(0,K.jsx)(li,{open:n,onOpenChange:i,children:t?(0,K.jsx)(oE,{item:t,pending:r,onOpenChange:i,onSubmit:a},`${t.slug}:${n?`open`:`closed`}`):null})}function oE(e){let{item:t,pending:n,onOpenChange:r,onSubmit:i}=e,a=t.install,[o,s]=(0,G.useState)(a?.defaultName??``),[c,l]=(0,G.useState)(!0),[u,d]=(0,G.useState)(Object.fromEntries((a?.inputs??[]).map(e=>[e.id,e.defaultValue??``])));return(0,K.jsxs)(oi,{children:[(0,K.jsxs)(ei,{children:[(0,K.jsx)(si,{children:U(`marketplaceMcpInstallDialogTitle`)}),(0,K.jsx)(ci,{children:t.name})]}),(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:U(`marketplaceMcpServerName`)}),(0,K.jsx)(F,{value:o,onChange:e=>s(e.target.value),placeholder:a?.defaultName??`mcp-server`})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl border border-gray-200 px-3 py-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-900`,children:U(`marketplaceMcpAllAgents`)}),(0,K.jsx)(`div`,{className:`text-xs text-gray-500`,children:U(`marketplaceMcpAllAgentsDescription`)})]}),(0,K.jsx)(Me,{checked:c,onCheckedChange:l})]}),(a?.inputs??[]).map(e=>(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-gray-800`,children:e.label}),e.description?(0,K.jsx)(`div`,{className:`text-xs text-gray-500`,children:e.description}):null,(0,K.jsx)(F,{type:e.secret?`password`:`text`,value:u[e.id]??``,onChange:t=>d(n=>({...n,[e.id]:t.target.value})),placeholder:e.defaultValue??``})]},e.id))]}),(0,K.jsxs)(ii,{children:[(0,K.jsx)(B,{variant:`outline`,onClick:()=>r(!1),disabled:n,children:U(`cancel`)}),(0,K.jsx)(B,{onClick:()=>void i({name:o,allAgents:c,inputs:u}),disabled:n||!o.trim(),children:U(n?`marketplaceInstalling`:`marketplaceInstall`)})]})]})}function sE(e){let{result:t,targetName:n,open:r,pending:i,onOpenChange:a}=e;return(0,K.jsx)(li,{open:r,onOpenChange:a,children:(0,K.jsxs)(oi,{children:[(0,K.jsxs)(ei,{children:[(0,K.jsx)(si,{children:U(`marketplaceMcpDoctorTitle`)}),(0,K.jsx)(ci,{children:n??`-`})]}),i?(0,K.jsx)(`div`,{className:`text-sm text-gray-500`,children:U(`loading`)}):null,!i&&t?(0,K.jsxs)(`div`,{className:`space-y-3 text-sm text-gray-700`,children:[(0,K.jsxs)(`div`,{children:[U(`marketplaceMcpDoctorAccessible`),`:`,` `,t.accessible?U(`statusReady`):U(`marketplaceOperationFailed`)]}),(0,K.jsxs)(`div`,{children:[U(`marketplaceMcpDoctorTransport`),`:`,` `,t.transport.toUpperCase()]}),(0,K.jsxs)(`div`,{children:[U(`marketplaceMcpDoctorTools`),`: `,t.toolCount]}),t.error?(0,K.jsx)(iE,{tone:`danger`,description:t.error,className:`rounded-lg`}):null]}):null]})})}function cE(e){let t=Da({queryKey:[`marketplace-mcp-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>oe({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,staleTime:15e3}),n=(0,G.useMemo)(()=>EC(t.data),[t.data]);return{...t,data:n}}function lE(){return R({queryKey:[`marketplace-mcp-installed`],queryFn:()=>Bt(),staleTime:1e4})}function uE(){let e=Dt();return He({mutationFn:Be,onSuccess:t=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),z.success(t.message||U(`marketplaceInstallSuccessMcp`))},onError:e=>{z.error(e.message||U(`marketplaceInstallFailed`))}})}function dE(){let e=Dt();return He({mutationFn:Re,onSuccess:t=>{e.invalidateQueries({queryKey:[`marketplace-mcp-installed`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-items`]}),e.invalidateQueries({queryKey:[`marketplace-mcp-doctor`]}),z.success(t.message||U(`marketplaceMcpManageSuccess`))},onError:e=>{z.error(e.message||U(`marketplaceOperationFailed`))}})}var fE=12;function pE({resourceId:e}={}){let t=$(),n=fn(),[r,i]=(0,G.useState)(`catalog`),[a,o]=(0,G.useState)(``),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(`relevance`),[f,p]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,_]=(0,G.useState)(null),[v,y]=(0,G.useState)(!1),{language:b}=d(),x=Xi(),{confirm:S,ConfirmDialog:C}=xx(),w=(0,G.useMemo)(()=>BC(b),[b]);(0,G.useEffect)(()=>{let e=window.setTimeout(()=>{c(a.trim())},250);return()=>window.clearTimeout(e)},[a]);let T=cE({q:s||void 0,sort:l,pageSize:fE}),E=lE(),{containerRef:D,sentinelRef:O}=MT({disabled:r!==`catalog`||T.isError||!T.hasNextPage||T.isFetchingNextPage,onLoadMore:()=>T.fetchNextPage(),watchValue:`${r}:${s}:${l}:${T.data?.loadedItems??0}:${T.data?.loadedPages??0}`});(0,G.useEffect)(()=>{let e=D.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[D,s,r,l]);let k=uE(),A=dE(),j=He({mutationFn:ee,onSuccess:(e,t)=>{h(t),_(e)}}),M=He({mutationFn:Fe}),N=He({mutationFn:Ae}),P=(0,G.useMemo)(()=>IT(E.data?.records??[]),[E.data?.records]),te=(0,G.useMemo)(()=>(E.data?.records??[]).filter(e=>{let t=[e.id??``,e.label??``,e.catalogSlug??``,e.description??``,e.descriptionZh??``].join(` `).toLowerCase();return s?t.includes(s.toLowerCase()):!0}),[E.data?.records,s]),F=async(e,r)=>{if(r?.id){t.pageResourceManager.open(Ez(`mcp-server`,r.id,r.label||r.id),`default`,n);return}let i=e?.name??r?.label??r?.id??`MCP`,a=ZC(e?`mcp`:`mcp-local`,e?.slug??r?.id??r?.spec??i),o=RT(w,e,r);if(!e){tw(x,{id:a,title:i,typeLabel:U(`marketplaceTypeMcp`),spec:r?.spec??`-`,status:`ready`,summary:o,metadataRaw:JSON.stringify(r??{},null,2),contentRaw:U(`marketplaceInstalledLocalSummary`),sourceUrl:r?.docsUrl,sourceLabel:U(`marketplaceDetailSource`)});return}tw(x,{id:a,title:i,typeLabel:U(`marketplaceTypeMcp`),spec:e.install.spec,status:`loading`,summary:o,tags:e.tags,author:e.author});try{let t=await le(e.slug);tw(x,{id:a,title:i,typeLabel:U(`marketplaceTypeMcp`),spec:e.install.spec,status:`ready`,summary:o,metadataRaw:t.metadataRaw||JSON.stringify(e,null,2),contentRaw:t.bodyRaw||t.raw,sourceUrl:t.sourceUrl,sourceLabel:U(`marketplaceDetailSource`),tags:e.tags,author:e.author},{activate:!1})}catch(t){tw(x,{id:a,title:i,typeLabel:U(`marketplaceTypeMcp`),spec:e.install.spec,status:`error`,summary:o,metadataRaw:JSON.stringify({error:t instanceof Error?t.message:String(t)},null,2),contentRaw:o},{activate:!1})}},ne=async e=>{f&&(await k.mutateAsync({spec:f.slug,name:e.name.trim(),allAgents:e.allAgents,inputs:e.inputs}),p(null))},I=async(e,t)=>{let n=t.id||t.spec;n&&(e===`remove`&&!await S({title:`${U(`marketplaceMcpRemoveTitle`)} ${n}?`,description:U(`marketplaceMcpRemoveDescription`),confirmLabel:U(`marketplaceMcpRemove`),variant:`destructive`})||await A.mutateAsync({action:e,id:n,spec:t.spec}))};if(e){let t=E.data?.records.find(t=>t.id===e);return E.isPending?(0,K.jsx)(`p`,{role:`status`,className:`p-4`,children:U(`loading`)}):t?(0,K.jsxs)(`div`,{className:`h-full overflow-auto p-4`,children:[(0,K.jsx)(BT,{record:t,localeFallbacks:w,onToggle:()=>void I(t.enabled===!1?`enable`:`disable`,t),onDoctor:()=>{h(t.id??null),_(null),j.mutateAsync(t.id??``)},onRemove:()=>void I(`remove`,t)}),(0,K.jsx)(sE,{open:!!m,targetName:m,result:g,pending:j.isPending,onOpenChange:e=>!e&&h(null)}),(0,K.jsx)(C,{})]}):(0,K.jsx)(`p`,{role:`alert`,className:`p-4`,children:U(E.isError?`resourceLoadFailed`:`resourceNotFound`)})}let re=[{id:`catalog`,label:U(`marketplaceMcpTabCatalog`),icon:_r},{id:`installed`,label:U(`marketplaceMcpTabInstalled`),icon:ns,count:E.data?.total??0}];return(0,K.jsxs)(Ue,{title:U(`marketplaceMcpPageTitle`),description:U(`marketplaceMcpPageDescription`),layout:`split`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsx)(`div`,{className:`flex w-fit max-w-full items-center gap-1 rounded-xl bg-muted/60 p-1`,children:re.map(e=>{let t=r===e.id,n=e.icon;return(0,K.jsxs)(`button`,{onClick:()=>i(e.id),className:V(`relative flex min-w-0 items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,t?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[(0,K.jsx)(n,{className:`h-4 w-4 shrink-0`}),e.label,e.id===`installed`&&typeof e.count==`number`&&(0,K.jsx)(`span`,{className:V(`flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[11px] font-semibold`,t?`bg-[var(--interaction-selection)] text-foreground`:`bg-muted text-muted-foreground`),children:e.count})]},e.id)})}),(0,K.jsx)(`div`,{className:`w-full max-w-xl`,children:(0,K.jsx)(LC,{scope:r===`catalog`?`all`:`installed`,searchText:a,isRefreshing:!1,searchPlaceholder:U(`marketplaceMcpSearchPlaceholder`),sort:l,onSearchTextChange:o,onSortChange:u})})]}),(0,K.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between px-1`,children:[(0,K.jsxs)(`h3`,{className:`flex items-center gap-2 text-base font-semibold text-foreground`,children:[U(r===`catalog`?`marketplaceMcpSectionCatalog`:`marketplaceMcpSectionInstalled`),(0,K.jsx)(`span`,{className:`flex h-6 items-center justify-center rounded-lg bg-muted px-2 text-xs font-medium text-muted-foreground`,children:r===`catalog`?T.data?.total??0:E.data?.total??0})]}),(0,K.jsx)(B,{type:`button`,size:`sm`,onClick:()=>y(!0),children:U(`mcpConnectionOpen`)})]}),(0,K.jsxs)(`div`,{ref:D,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto pb-8`,"aria-busy":T.isLoading||T.isFetchingNextPage,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,280px),1fr))] items-stretch gap-4`,children:[r===`catalog`&&T.isLoading&&(0,K.jsx)(RC,{count:fE}),r===`catalog`&&!T.isLoading&&(T.data?.items??[]).map(e=>{let t=LT(e,P);return(0,K.jsx)(BT,{item:e,record:t,localeFallbacks:w,onOpen:()=>void F(e,t),onInstall:()=>p(e),onToggle:t?()=>void I(t.enabled===!1?`enable`:`disable`,t):void 0,onDoctor:t?()=>{h(t.id??null),_(null),j.mutateAsync(t.id??``)}:void 0,onRemove:t?()=>void I(`remove`,t):void 0},e.id)}),r===`installed`&&te.map(e=>(0,K.jsx)(BT,{record:e,localeFallbacks:w,onOpen:()=>void F(void 0,e),onToggle:()=>void I(e.enabled===!1?`enable`:`disable`,e),onDoctor:()=>{h(e.id??null),_(null),j.mutateAsync(e.id??``)},onRemove:()=>void I(`remove`,e)},e.id??e.spec))]}),r===`catalog`&&T.isError&&(0,K.jsx)(iE,{tone:`danger`,title:U(`marketplaceMcpSectionCatalog`),description:T.error.message}),r===`installed`&&E.isError&&(0,K.jsx)(iE,{tone:`danger`,title:U(`marketplaceMcpSectionInstalled`),description:E.error.message}),r===`catalog`&&!T.isLoading&&!T.isError&&(T.data?.items?.length??0)===0&&(0,K.jsx)(`div`,{className:`mt-4 flex flex-col items-center justify-center rounded-2xl bg-muted/35 py-16`,children:(0,K.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:U(`marketplaceNoMcp`)})}),r===`installed`&&!E.isError&&te.length===0&&(0,K.jsx)(`div`,{className:`mt-4 flex flex-col items-center justify-center rounded-2xl bg-muted/35 py-16`,children:(0,K.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:U(`marketplaceNoInstalledMcp`)})}),r===`catalog`&&!T.isError&&(0,K.jsx)(zC,{hasMore:!!T.hasNextPage,loading:T.isFetchingNextPage,sentinelRef:O})]})]}),(0,K.jsx)(aE,{item:f,open:!!f,pending:k.isPending,onOpenChange:e=>!e&&p(null),onSubmit:ne}),(0,K.jsx)(ZT,{open:v,testing:M.isPending,saving:N.isPending,onOpenChange:y,onTest:e=>M.mutateAsync(e),onSave:async e=>{await N.mutateAsync(e)}}),(0,K.jsx)(sE,{open:!!m,targetName:m,result:g,pending:j.isPending,onOpenChange:e=>!e&&h(null)}),(0,K.jsx)(C,{})]})}function mE({error:e,onCustomInstall:t,sourceButtonRef:n,filter:r,hostTarget:i,installedById:a,isError:o,onRetry:s,isFetchingNextPage:c,isLoading:l,isStarting:u,items:d,localeFallbacks:f,onFilterChange:p,onInstall:m,onLoadMore:h,onSearchChange:g,onSelect:_,onUpdate:v,onManagePackage:y,operations:b,hasNextPage:x,search:S,startingSource:C}){let w=(0,G.useRef)(null);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(hE,{onCustomInstall:t,sourceButtonRef:n,filter:r,onFilterChange:e=>{w.current&&(w.current.scrollTop=0),p(e)},onSearchChange:e=>{w.current&&(w.current.scrollTop=0),g(e)},search:S}),(0,K.jsxs)(`div`,{ref:w,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background px-4 py-5 [@container(min-width:40rem)]:px-6`,children:[e?(0,K.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||U(`appPackagesActionFailed`)}):null,(0,K.jsx)(gE,{installedById:a,hostTarget:i,isError:o,onRetry:s,isFetchingNextPage:c,isLoading:l,isStarting:u,items:d,localeFallbacks:f,onInstall:m,onLoadMore:h,onSelect:_,onUpdate:v,onManagePackage:y,operations:b,hasNextPage:x,startingSource:C})]})]})}function hE({onCustomInstall:e,sourceButtonRef:t,filter:n,onFilterChange:r,onSearchChange:i,search:a}){let o=[{value:`all`,label:U(`appPackagesFilterAll`)},{value:`featured`,label:U(`appPackagesMarketplaceFeatured`)},{value:`personal`,label:U(`appPackagesFilterPersonal`)},{value:`local`,label:U(`appPackagesFilterLocal`)}];return(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border/60 bg-card px-4 pb-4 pt-5 [@container(min-width:40rem)]:px-6`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-[872px]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:U(`appPackagesMarketplaceTitle`)}),e?(0,K.jsx)(W,{ref:t,icon:(0,K.jsx)(rs,{className:`h-4 w-4`}),label:U(`appPackagesCustomSource`),onClick:e}):null]}),(0,K.jsx)(`p`,{className:`mt-1.5 text-sm leading-5 text-muted-foreground`,children:U(`appPackagesMarketplaceDescription`)}),(0,K.jsxs)(`div`,{className:`relative mt-4`,children:[(0,K.jsx)(kr,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,K.jsx)(F,{className:`h-10 rounded-xl border-0 bg-muted/65 pl-9 pr-10 ![box-shadow:none]`,value:a,onChange:e=>i(e.target.value),placeholder:U(`appPackagesMarketplaceSearch`),"aria-label":U(`appPackagesMarketplaceSearch`)}),a?(0,K.jsx)(`div`,{className:`absolute right-1 top-1/2 -translate-y-1/2`,children:(0,K.jsx)(W,{icon:(0,K.jsx)(Vr,{className:`h-3.5 w-3.5`}),label:U(`appPackagesClearSearch`),onClick:()=>i(``)})}):null]}),(0,K.jsx)(`div`,{className:`custom-scrollbar mt-3 flex gap-1 overflow-x-auto`,"aria-label":U(`appPackagesFilterLabel`),children:o.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":n===e.value,onClick:()=>r(e.value),className:V(`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`,n===e.value?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:e.label},e.value))})]})})}function gE({installedById:e,hostTarget:t,isError:n,onRetry:r,isFetchingNextPage:i,isLoading:a,isStarting:o,items:s,localeFallbacks:c,onInstall:l,onLoadMore:u,onSelect:d,onUpdate:f,onManagePackage:p,operations:m,hasNextPage:h,startingSource:g}){return a?(0,K.jsxs)(`div`,{className:`mx-auto grid max-w-[872px] gap-4 [@container(min-width:36rem)]:grid-cols-2 [@container(min-width:52rem)]:grid-cols-3`,role:`status`,"aria-label":U(`appPackagesMarketplaceLoading`),children:[(0,K.jsx)(Hi,{}),(0,K.jsx)(Hi,{}),(0,K.jsx)(Hi,{className:`hidden [@container(min-width:52rem)]:flex`})]}):n?(0,K.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-5 text-sm text-destructive`,children:[U(`appPackagesMarketplaceFailed`),r?(0,K.jsx)(B,{className:`mt-3 block`,variant:`outline`,size:`sm`,onClick:r,children:U(`appPackagesRefresh`)}):null]}):s.length===0?(0,K.jsxs)(`div`,{className:`flex flex-col items-center px-6 py-14 text-center`,children:[(0,K.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-2xl bg-muted`,children:(0,K.jsx)(kr,{className:`h-5 w-5 text-muted-foreground`})}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-foreground`,children:U(`appPackagesMarketplaceEmpty`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:U(`appPackagesMarketplaceEmptyHint`)})]}):(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-[872px]`,children:[(0,K.jsx)(`div`,{className:`grid gap-1 [@container(min-width:36rem)]:gap-4 [@container(min-width:36rem)]:grid-cols-2 [@container(min-width:52rem)]:grid-cols-3`,children:s.map(n=>(0,K.jsx)(_E,{installedPackage:e.get(n.appId),hostTarget:t,isStarting:o&&g===n.install.spec,item:n,localeFallbacks:c,onInstall:l,onSelect:d,onUpdate:f,onManagePackage:p,operation:YS(m,n.appId,n.install.spec)},n.id))}),h?(0,K.jsx)(`div`,{className:`flex justify-center pt-5`,children:(0,K.jsx)(`button`,{type:`button`,disabled:i,onClick:u,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:U(i?`appPackagesMarketplaceLoadingMore`:`appPackagesMarketplaceLoadMore`)})}):null]})}function _E({installedPackage:e,hostTarget:t,isStarting:n,item:r,localeFallbacks:i,onInstall:a,onSelect:o,onUpdate:s,onManagePackage:c,operation:l}){let u=e?vE(e.name,e.nameI18n):r.name,d=HC(r.summaryI18n,r.summary,i),f=l?fC(l.status):!1,p=!!(e&&e.activeVersion!==r.latestVersion),m=_C(r.availability,U(`appPackagesAllPlatforms`)),h=US(vC(r.availability,t),m),g=!!(h&&(!e||p));return(0,K.jsxs)(`article`,{className:`group relative overflow-hidden rounded-lg bg-card transition-colors duration-150 hover:bg-[var(--interaction-hover)] [@container(min-width:36rem)]:rounded-2xl [@container(min-width:36rem)]:border [@container(min-width:36rem)]:border-border/60 [@container(min-width:36rem)]:shadow-sm`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(r.slug),"aria-label":u,className:`hidden w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [@container(min-width:36rem)]:block`,children:(0,K.jsx)(VS,{icon:r.iconUrl??e?.icon,accentColor:r.accentColor,coverPreview:r.coverPreview,coverUrl:r.coverUrl,name:u,className:`aspect-[16/9] rounded-none ring-0`})}),(0,K.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-end gap-2 px-2 py-3 [@container(min-width:36rem)]:block [@container(min-width:36rem)]:p-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,K.jsx)(RS,{icon:r.iconUrl??e?.icon,name:u,className:`h-11 w-11 rounded-[13px]`}),(0,K.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,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:u}),r.featured?(0,K.jsx)(_r,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`,"aria-label":U(`appPackagesMarketplaceFeatured`)}):null]}),(0,K.jsx)(WS,{presentation:h}),(0,K.jsx)(`span`,{className:`mt-1 block truncate text-xs leading-5 text-muted-foreground [@container(min-width:36rem)]:line-clamp-2 [@container(min-width:36rem)]:min-h-10 [@container(min-width:36rem)]:whitespace-normal`,children:d}),(0,K.jsxs)(`span`,{className:`mt-1 flex items-center gap-1.5 overflow-hidden text-[11px] text-muted-foreground [@container(min-width:36rem)]:mt-2 [@container(min-width:36rem)]:flex-wrap`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:r.publisher.name}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`hidden [@container(min-width:36rem)]:inline`,children:`·`}),(0,K.jsxs)(`span`,{className:`hidden [@container(min-width:36rem)]:inline`,children:[`v`,r.latestVersion]}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`hidden [@container(min-width:36rem)]:inline`,children:`·`}),(0,K.jsx)(`span`,{className:`hidden [@container(min-width:36rem)]:inline`,children:m}),(0,K.jsx)(nr,{className:`ml-0.5 h-3 w-3 opacity-0 transition-opacity group-hover:opacity-60`})]})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 [@container(min-width:36rem)]:mt-3 [@container(min-width:36rem)]:border-t [@container(min-width:36rem)]:border-border/50 [@container(min-width:36rem)]:pt-3`,children:[(0,K.jsx)(GS,{blocked:g,presentation:h,className:`hidden min-w-0 text-[11px] font-medium text-muted-foreground [@container(min-width:36rem)]:block`}),(0,K.jsx)(KS,{onInstalled:c?()=>c(r.appId):void 0,active:f,canUpdate:p,installed:!!e,isStarting:n,onAction:()=>p?s(r.appId):a(r.install.spec,r.install.registry),operation:l,unavailableLabel:g?h?.actionLabel:void 0,unavailableReason:g?h?.reason:void 0})]})]}),l&&!g&&(f||l.status===`failed`||l.status===`interrupted`)?(0,K.jsx)(`div`,{className:`px-4 pb-4`,children:(0,K.jsx)(JS,{operation:l})}):null]})}function vE(e,t){let n=Xr()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e??``}function yE({detail:e,error:t,hostTarget:n,installedPackage:r,isLoading:i,isStarting:a,localeFallbacks:o,onInstall:s,onUpdate:c,onManagePackage:l,operation:u}){if(i)return(0,K.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6 px-5 py-5`,role:`status`,"aria-label":U(`appPackagesMarketplaceLoading`),children:[(0,K.jsx)(Hi,{}),(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(aa,{className:`h-3 w-full`}),(0,K.jsx)(aa,{className:`h-3 w-5/6`}),(0,K.jsx)(aa,{className:`h-3 w-2/3`})]})]});if(t||!e)return(0,K.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??U(`appPackagesMarketplaceFailed`)});let d=HC(e.summaryI18n,e.summary,o),f=HC(e.descriptionI18n,e.description??d,o),p=u?fC(u.status):!1,m=e.manifest.components??[],h=m.filter(e=>e.kind===`panel`).length,g=m.filter(e=>e.kind===`service`).length,v=e.manifest.runtime?.profile??(g>0?`native-process`:`panel-only`),y=!!(r&&r.activeVersion!==e.latestVersion),b=_C(e.availability,U(`appPackagesAllPlatforms`)),x=US(vC(e.availability,n),b),S=!!(x&&(!r||y));return(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-5 py-5 [@container(min-width:40rem)]:px-7 [@container(min-width:40rem)]:py-6`,children:[(0,K.jsxs)(`div`,{className:`grid items-stretch gap-5 [@container(min-width:40rem)]:grid-cols-[minmax(0,1.18fr)_minmax(240px,0.82fr)]`,children:[(0,K.jsx)(VS,{icon:e.iconUrl??r?.icon,accentColor:e.accentColor,coverPreview:e.coverPreview,coverUrl:e.coverUrl,name:e.name,className:`aspect-[16/9] rounded-2xl`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col rounded-2xl border border-border/60 bg-card p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(RS,{icon:e.iconUrl??r?.icon,name:e.name,className:`h-14 w-14 rounded-2xl`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-foreground`,children:e.name}),(0,K.jsx)(WS,{presentation:x}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(xs,{className:`h-3.5 w-3.5`}),e.publisher.name]}),(0,K.jsxs)(`span`,{children:[`v`,e.latestVersion]})]})]})]}),(0,K.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-muted-foreground`,children:d}),(0,K.jsxs)(`div`,{className:`mt-auto pt-4`,children:[(0,K.jsx)(GS,{blocked:S,presentation:x,className:`mb-2 text-xs font-medium text-muted-foreground`}),(0,K.jsx)(KS,{onInstalled:l?()=>l(e.appId):void 0,active:p,canUpdate:y,installed:!!r,isStarting:a,onAction:()=>y?c(e.appId):s(e.install.spec,e.install.registry),operation:u,unavailableLabel:S?x?.actionLabel:void 0,unavailableReason:S?x?.reason:void 0})]})]})]}),u&&!S&&(p||u.status===`failed`||u.status===`interrupted`)?(0,K.jsx)(JS,{operation:u}):null,(0,K.jsxs)(`section`,{className:`mt-7`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:U(`appPackagesAboutApp`)}),(0,K.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-muted-foreground`,children:f})]}),(0,K.jsxs)(`div`,{className:`mt-6 grid gap-3 [@container(min-width:40rem)]:grid-cols-2`,children:[(0,K.jsx)(bE,{icon:$o,label:U(`appPackagesPlatformsLabel`),value:b}),(0,K.jsx)(bE,{icon:Jn,label:U(`appPackagesPanelsAdded`),value:h>0?String(h):U(`appPackagesNone`)}),(0,K.jsx)(bE,{icon:bs,label:U(`appPackagesServicesAdded`),value:g>0?String(g):U(`appPackagesNone`)}),e.manifest.engines?.nextclaw?(0,K.jsx)(bE,{icon:xs,label:U(`appPackagesNextClawRequirement`),value:e.manifest.engines.nextclaw}):null,(0,K.jsx)(bE,{icon:v===`native-process`?_:xs,label:U(`appPackagesIsolationLabel`),value:U(v===`native-process`?`appPackagesIsolationFullUser`:v===`wasi`?`appPackagesIsolationMediated`:`appPackagesIsolationPanel`)})]}),(0,K.jsxs)(`section`,{className:`mt-7 border-t border-border/60 pt-6`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:U(`appPackagesAccessTitle`)}),(0,K.jsx)(`div`,{className:`mt-3 space-y-2`,children:xE(e).map(e=>(0,K.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,K.jsx)(xs,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:e})]},e))})]}),(0,K.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 underline-offset-4 hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[U(`appPackagesOpenPublicDetails`),(0,K.jsx)(Pr,{className:`h-3.5 w-3.5`})]})]})}function bE({icon:e,label:t,value:n}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl border border-border/60 px-3 py-3`,children:[(0,K.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-muted-foreground`,children:(0,K.jsx)(e,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:t}),(0,K.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:n})]})]})}function xE(e){let t=[],n=e.permissions.documentAccess??[];n.length>0&&t.push(U(`appPackagesDocumentAccess`).replace(`{count}`,String(n.length)));let r=e.permissions.allowedDomains??[];return r.length>0&&t.push(U(`appPackagesNetworkAccess`).replace(`{count}`,String(r.length))),e.permissions.capabilities?.hostBridge&&t.push(U(`appPackagesHostBridgeAccess`)),e.permissions.capabilities?.nativeProcess&&t.push(U(`appPackagesNativeProcessAccess`)),(e.permissions.storage===!0||typeof e.permissions.storage==`object`&&e.permissions.storage?.namespace)&&t.push(U(`appPackagesLocalStorageAccess`)),t.length>0?t:[U(`appPackagesNoExtraAccess`)]}var SE=`https://apps-registry.nextclaw.io`,CE=new Set([404,405,501]),wE=(void 0)?.replace(/\/$/,``),TE=void 0,EE=new Set([`hello-notes`,`personal-organizer`,`starter-card`,`workspace-glance`]);async function DE(e={},t){let n=await AE(e,t);return CE.has(n.status)?await ME(e,t):await jE(n)}async function OE(e,t){let n=await fetch(`${SE}/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(!LE(r)||r.ok!==!0||!LE(r.data))throw Error(`Marketplace returned an invalid app detail`);let{data:i}=r,a=i;if(!PE(i)||!LE(a.manifest)||!LE(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=>LE(e)&&(e.kind===`panel`||e.kind===`service`)&&typeof e.path==`string`):void 0;return{...kE(i),description:typeof a.description==`string`?a.description:void 0,descriptionI18n:IE(a.descriptionI18n)?a.descriptionI18n:void 0,manifest:{schemaVersion:o.schemaVersion===2?2:1,icon:typeof o.icon==`string`?o.icon:void 0,engines:LE(o.engines)&&typeof o.engines.nextclaw==`string`?{nextclaw:o.engines.nextclaw}:void 0,components:c},permissions:s}}function kE(e){if(e.coverUrl)return e;let t=NE(e.slug);return e.publisher.id!==`nextclaw`||!t?e:{...e,coverUrl:t,coverPreview:!0}}async function AE(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(`${SE}/api/v2/apps/items?${u}`,{headers:{accept:`application/json`},signal:t})}async function jE(e){if(!e.ok)throw Error(`Marketplace request failed (${e.status})`);let t=await e.json();if(!LE(t)||t.ok!==!0||!LE(t.data))throw Error(`Marketplace returned an invalid response`);return{items:(Array.isArray(t.data.items)?t.data.items.filter(PE):[]).map(kE),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 ME(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(`${SE}/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(!LE(u)||u.ok!==!0||!LE(u.data))throw Error(`Marketplace returned an invalid compatibility response`);let d=Array.isArray(u.data.items)?u.data.items.filter(PE):[],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(kE),hasMore:!1,query:i,tag:o,tags:s,featured:n,sort:a??(i?`relevance`:`featured`)}}function NE(e){let t=wE??TE;if(t&&EE.has(e))return`${t}/${encodeURIComponent(e)}.webp`}function PE(e){return!LE(e)||!LE(e.install)||!LE(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`&&IE(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||FE(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 FE(e){return!LE(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 IE(e){return LE(e)&&Object.values(e).every(e=>typeof e==`string`)}function LE(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var RE=[`app-marketplace`,`v3`];function zE(e,t){let n=Da({queryKey:[...RE,e],initialPageParam:void 0,queryFn:async({pageParam:t,signal:n})=>await DE({...e,cursor:t,limit:24},n),getNextPageParam:e=>e.nextCursor,enabled:t,retry:1,staleTime:300*1e3}),r=(0,G.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 BE(e,t){return R({queryKey:[`app-marketplace-detail`,`v2`,e],queryFn:async({signal:t})=>await OE(e??``,t),enabled:t&&!!e,retry:1,staleTime:300*1e3})}var VE=new Set([`nextclaw.starter-card`,`nextclaw.validation-task-board`]);function HE({error:e,hostTarget:t,installedPackages:n,isStarting:r,onInstall:i,onCustomInstall:a,onManagePackage:o,sourceButtonRef:s,onUpdate:c,active:l,operations:u,startingSource:d}){let[f,p]=(0,G.useState)(`all`),[m,h]=(0,G.useState)(``),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(null);(0,G.useEffect)(()=>{let e=window.setTimeout(()=>_(m.trim()),250);return()=>window.clearTimeout(e)},[m]);let b=zE((0,G.useMemo)(()=>({q:g||void 0,featured:f===`featured`?!0:void 0,tags:f===`personal`?[`personal`,`productivity`,`notes`,`calendar`]:void 0,tag:f===`local`?`local`:void 0,sort:g?`relevance`:`featured`}),[g,f]),l),x=BE(v,l),S=(0,G.useMemo)(()=>new Map(n.map(e=>[e.id,e])),[n]),C=BC(Xr()===`zh`?`zh-CN`:`en-US`),w=(0,G.useMemo)(()=>(b.data?.items??[]).filter(e=>!VE.has(e.appId)).map((e,n)=>({item:e,index:n,rank:yC(vC(e.availability,t))})).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(({item:e})=>e),[t,b.data?.items]),T=(0,G.useRef)(null),E=(0,G.useRef)(null);return(0,G.useEffect)(()=>{v&&E.current?.focus()},[v]),(0,K.jsx)(ni,{children:(0,K.jsxs)(`div`,{className:`[container-type:inline-size] flex h-full min-h-0 flex-col bg-card`,children:[v?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border/50 px-4 py-3`,children:(0,K.jsxs)(B,{ref:E,type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{y(null),requestAnimationFrame(()=>T.current?.focus({preventScroll:!0}))},children:[(0,K.jsx)(Or,{className:`mr-2 h-4 w-4`}),U(`appPackagesBackToMarketplace`)]})}),(0,K.jsxs)(`div`,{className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto bg-background`,children:[e?(0,K.jsx)(`p`,{role:`alert`,className:`mx-5 mt-4 text-sm text-destructive`,children:e.message||U(`appPackagesActionFailed`)}):null,(0,K.jsx)(yE,{detail:x.data,error:x.error instanceof Error?x.error:null,installedPackage:x.data?S.get(x.data.appId):void 0,hostTarget:t,isLoading:x.isLoading,isStarting:r&&x.data?.install.spec===d,localeFallbacks:C,onInstall:i,onUpdate:c,onManagePackage:o,operation:x.data?YS(u,x.data.appId,x.data.install.spec):void 0})]})]}):null,(0,K.jsx)(`div`,{hidden:!!v,className:v?`hidden`:`flex min-h-0 flex-1 flex-col`,children:(0,K.jsx)(mE,{error:e,filter:f,installedById:S,hostTarget:t,isError:b.isError,isFetchingNextPage:b.isFetchingNextPage,isLoading:b.isLoading,isStarting:r,items:w,localeFallbacks:C,onFilterChange:p,onInstall:i,onLoadMore:()=>void b.fetchNextPage(),onSearchChange:h,onSelect:e=>{T.current=document.activeElement instanceof HTMLElement?document.activeElement:null,y(e)},onCustomInstall:a,sourceButtonRef:s,onManagePackage:o,onRetry:()=>void b.refetch(),onUpdate:c,operations:u,hasNextPage:b.hasNextPage,search:m,startingSource:d})})]})})}function UE({appId:e,appName:t,disabled:n,scopes:r}){let i=hC(),a=(0,G.useRef)(null),[o,s]=(0,G.useState)(null),[c,l]=(0,G.useState)({}),u=r.find(e=>e.id===o),d=u?c[u.id]??u.effectiveMode??`read`:`read`;if(r.length===0)return null;let f=i.error instanceof Error?i.error.message:null;return(0,K.jsxs)(`section`,{className:`[container-type:inline-size] border-t border-border/60 pt-4`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,K.jsx)(xo,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,K.jsx)(`h3`,{className:`text-xs font-semibold text-foreground`,children:U(`appPackagesDocumentAccessTitle`)})]}),(0,K.jsx)(`div`,{className:`space-y-2`,children:r.map(t=>{let r=c[t.id]??t.effectiveMode??`read`;return(0,K.jsx)(`div`,{className:`rounded-lg bg-muted/30 px-3 py-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-col items-stretch gap-3 [@container(min-width:26rem)]:flex-row [@container(min-width:26rem)]:items-start`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,K.jsx)(xs,{className:`h-3.5 w-3.5 text-muted-foreground`}),(0,K.jsx)(`code`,{children:t.id}),(0,K.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:t.status===`ungranted`?U(`appPackagesDocumentAccessUngranted`):t.status===`unavailable`?U(`appPackagesDocumentAccessUnavailable`):t.effectiveMode===`read-write`?U(`appPackagesDocumentAccessReadWrite`):U(`appPackagesDocumentAccessRead`)})]}),t.description?(0,K.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-muted-foreground`,children:t.description}):null,t.grantedPath?(0,K.jsx)(`code`,{className:`mt-1 block truncate text-[10px] text-muted-foreground`,title:t.grantedPath,children:t.grantedPath}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5`,children:[(0,K.jsx)(`label`,{className:`sr-only`,htmlFor:`${e}-${t.id}-mode`,children:U(`appPackagesDocumentAccessMode`)}),(0,K.jsxs)(`select`,{id:`${e}-${t.id}-mode`,value:r,disabled:n||i.isPending,onChange:e=>l(n=>({...n,[t.id]:e.target.value})),className:`h-8 rounded-md border border-input bg-background px-2 text-[11px] text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50`,children:[(0,K.jsx)(`option`,{value:`read`,children:U(`appPackagesDocumentAccessRead`)}),t.mode===`read-write`?(0,K.jsx)(`option`,{value:`read-write`,children:U(`appPackagesDocumentAccessReadWrite`)}):null]}),(0,K.jsx)(B,{type:`button`,size:`sm`,variant:`outline`,disabled:n||i.isPending,onClick:e=>{a.current=e.currentTarget,i.reset(),s(t.id)},children:t.granted?U(`appPackagesDocumentAccessReplace`):U(`appPackagesDocumentAccessChoose`)}),t.granted?(0,K.jsx)(W,{label:U(`appPackagesDocumentAccessRevoke`),icon:(0,K.jsx)(Jr,{className:`h-3.5 w-3.5`}),disabled:n||i.isPending,onClick:()=>i.mutate({action:`revoke`,appId:e,scopeId:t.id})}):null]})]})},t.id)})}),f?(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-destructive`,children:f}):null,(0,K.jsx)(mc,{onCloseAutoFocus:e=>{e.preventDefault(),a.current?.focus()},open:!!u,currentPath:u?.grantedPath,isSaving:i.isPending,onOpenChange:e=>{e||s(null)},onConfirm:async t=>{u&&(await i.mutateAsync({action:`grant`,appId:e,scopeId:u.id,directoryPath:t,mode:d}),s(null))},title:`${U(`appPackagesDocumentAccessChooseTitle`)} · ${t}`,description:u?.description??U(`appPackagesDocumentAccessChooseDescription`),pathLabel:U(`appPackagesDocumentAccessPath`),confirmLabel:u?.granted?U(`appPackagesDocumentAccessReplace`):U(`appPackagesDocumentAccessGrant`),hint:U(d===`read-write`?`appPackagesDocumentAccessWriteWarning`:`appPackagesDocumentAccessReadHint`)})]})}function WE({appPackage:e,disabled:t,displayName:n,displayDescription:r,open:i,onOpenChange:a,onFocusReturn:o,storageUsage:s,storageUsageLoading:c,storageUsageUnavailable:l}){let u=e.components.filter(e=>e.kind!==`panel`).length,d=GE(s,c,l);return(0,K.jsx)(li,{open:i,onOpenChange:a,children:(0,K.jsxs)(oi,{className:`max-w-xl`,onCloseAutoFocus:e=>{e.preventDefault(),o()},children:[(0,K.jsxs)(ei,{children:[(0,K.jsx)(si,{children:n}),(0,K.jsx)(ci,{children:r??U(`appPackagesDetails`)})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{children:[`v`,e.activeVersion]}),e.builtIn?(0,K.jsx)(`span`,{children:U(`appPackagesBuiltIn`)}):null,u>0?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(bs,{className:`h-3 w-3`}),U(`appPackagesLocalService`)]}):null,(0,K.jsxs)(`span`,{className:V(`inline-flex items-center gap-1`,e.isolation===`full-user`&&`text-amber-700 dark:text-amber-300`),children:[e.isolation===`full-user`?(0,K.jsx)(_,{className:`h-3 w-3`}):(0,K.jsx)(xs,{className:`h-3 w-3`}),e.isolation===`full-user`?U(`appPackagesIsolationFullUser`):e.isolation===`host-mediated`?U(`appPackagesIsolationMediated`):U(`appPackagesIsolationPanel`)]})]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 rounded-md bg-muted/35 px-2 py-1 text-xs text-muted-foreground`,title:e.storage.dataDirectory,children:[(0,K.jsx)(jo,{className:`h-3 w-3 shrink-0`}),(0,K.jsxs)(`span`,{className:`shrink-0`,children:[U(`appPackagesDataUsage`),` `,d]}),(0,K.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs`,children:e.storage.dataDirectory})]}),(0,K.jsx)(UE,{appId:e.id,appName:n,disabled:t,scopes:e.documentAccess??[]})]})})}function GE(e,t,n){return e?$S(e.totalBytes):U(t?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)}function KE(e,t){if(t)return{className:`bg-destructive/10 text-destructive`,interactive:!1,label:U(`appPackagesUnavailable`),message:t,messageClassName:`text-destructive`};if(!e.enabled&&e.readiness.status!==`ready`){let t=e.readiness.status===`needs-capability`;return{className:`bg-amber-500/10 text-amber-800 dark:text-amber-200`,interactive:!1,label:U(t?`appPackagesNeedsCapability`:`appPackagesNeedsConfiguration`),message:U(t?`appPackagesNeedsCapabilityDescription`:`appPackagesNeedsConfigurationDescription`),messageClassName:`text-amber-800 dark:text-amber-200`}}return{className:e.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-muted text-muted-foreground`,interactive:!0,label:e.enabled?U(`appPackagesEnabled`):U(`appPackagesAvailable`)}}function qE({appPackage:e,isPending:t,operation:n,onDisable:r,onEnable:i,onOpenPanelApp:a,onRollback:o,onUninstall:s,onUpdate:c,panelApps:l,storageUsage:u,storageUsageLoading:d,storageUsageUnavailable:f,unavailableMessage:p}){let[m,h]=(0,G.useState)(!1),g=(0,G.useRef)(null),[_,v]=(0,G.useState)(!1),[y,b]=(0,G.useState)(!1),x=(0,G.useRef)(null),S=e.components.filter(e=>e.kind===`panel`),C=e.installedVersions.filter(t=>t!==e.activeVersion),w=eD(e.name,e.nameI18n)??e.id,T=eD(e.description,e.descriptionI18n),E=n?fC(n.status):!1,D=t||E,O=KE(e,p),k=S.length===1?l.find(e=>e.appId===S[0].id):void 0,A=e.enabled?S.length===1?`open`:`details`:`enable`,j=D||A!==`details`&&!O.interactive||A===`open`&&!k;return(0,K.jsxs)(ma,{surface:`flat`,hover:!1,className:`[container-type:inline-size] overflow-hidden rounded-none border-0 shadow-none`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-3 px-3 py-4`,children:[(0,K.jsx)(RS,{icon:e.icon,name:w}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,K.jsx)(`h2`,{className:`min-w-0 max-w-full text-sm font-semibold text-foreground`,children:(0,K.jsx)(`button`,{ref:g,type:`button`,onClick:()=>h(!0),className:`block max-w-full truncate rounded-sm text-left hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,title:w,children:w})}),(0,K.jsx)(`span`,{className:V(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium`,O.className),children:O.label})]}),O.message?(0,K.jsx)(`p`,{role:`alert`,className:V(`mt-2 text-xs leading-5`,O.messageClassName),children:O.message}):null,!e.enabled&&e.readiness.status!==`ready`?(0,K.jsx)(`ul`,{className:`mt-1.5 space-y-1 text-xs leading-5 text-muted-foreground`,children:e.readiness.requirements.map(e=>(0,K.jsxs)(`li`,{children:[e.title,e.description?` — ${e.description}`:``]},`${e.componentId}:${e.kind}:${e.id}`))}):null,T?(0,K.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-muted-foreground`,children:T}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1`,children:[(0,K.jsx)(B,{type:`button`,size:`sm`,variant:`outline`,disabled:j,title:O.message,onClick:()=>{e.enabled?k?a(k):h(!0):i()},children:D?YE({enabled:e.enabled,isPending:t,operation:n,operationActive:E}):U({enable:`appPackagesEnable`,open:`appPackagesOpen`,details:`appPackagesDetails`}[A])}),(0,K.jsx)(xr,{label:U(`appPackagesMoreActions`),groups:D?[]:[{key:`manage`,items:[{key:`details`,icon:(0,K.jsx)(Fo,{className:`h-4 w-4`}),label:U(`appPackagesDetails`),restoreFocus:!1,onSelect:()=>h(!0)},...e.enabled?[{key:`disable`,icon:(0,K.jsx)(vs,{className:`h-4 w-4`}),label:U(`appPackagesDisable`),onSelect:r}]:[],{key:`update`,icon:(0,K.jsx)(qr,{className:`h-4 w-4`}),label:U(`appPackagesCheckUpdate`),onSelect:c},...C.map(e=>({key:e,icon:(0,K.jsx)(On,{className:`h-4 w-4`}),label:`${U(`appPackagesRollback`)} v${e}`,onSelect:()=>o(e)}))]},{key:`remove`,items:[{key:`uninstall`,destructive:!0,icon:(0,K.jsx)(Jr,{className:`h-4 w-4`}),label:U(`appPackagesUninstall`),restoreFocus:!1,onSelect:()=>{b(!1),v(!0)}}]}],children:(0,K.jsx)(`div`,{children:(0,K.jsx)(dr,{children:(0,K.jsx)(W,{icon:(0,K.jsx)(wr,{className:`h-4 w-4`}),label:U(`appPackagesMoreActions`),disabled:D})})})})]})]}),(0,K.jsx)(WE,{appPackage:e,disabled:D||!!p,displayName:w,displayDescription:T,open:m,onOpenChange:h,onFocusReturn:()=>g.current?.focus(),storageUsage:u,storageUsageLoading:d,storageUsageUnavailable:f}),n&&(E||n.status===`failed`||n.status===`interrupted`)?(0,K.jsx)(ZE,{operation:n}):null,e.enabled&&S.length>1?(0,K.jsx)(`div`,{className:`px-3 pb-3 [@container(min-width:28rem)]:pl-16`,children:(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-1 [@container(min-width:20rem)]:grid-cols-2`,children:S.map(e=>{let t=l.find(t=>t.appId===e.id),n=$E(e.id),r=eD(e.title,e.titleI18n)??e.id;return(0,K.jsxs)(`button`,{type:`button`,disabled:!t||D||!O.interactive,onClick:()=>t&&a({...t,title:r,description:eD(e.description,e.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:O.message??r,children:[(0,K.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-muted-foreground`,children:(0,K.jsx)(XE,{icon:e.icon,fallback:n})}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-foreground`,children:r}),(0,K.jsx)(nr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5`})]},e.id)})})}):null,(0,K.jsx)(li,{open:_,onOpenChange:v,children:(0,K.jsxs)(oi,{className:`max-w-md`,onCloseAutoFocus:e=>{e.preventDefault(),g.current?.focus()},onOpenAutoFocus:e=>{e.preventDefault(),x.current?.focus()},children:[(0,K.jsxs)(ei,{showClose:!1,children:[(0,K.jsx)(si,{children:U(`appPackagesUninstallTitle`)}),(0,K.jsx)(ci,{children:U(`appPackagesUninstallDescription`)})]}),(0,K.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,K.jsx)(ZS,{checked:!y,description:U(`appPackagesKeepDataDescription`),label:U(`appPackagesKeepData`),onClick:()=>b(!1)}),(0,K.jsx)(ZS,{checked:y,destructive:!0,description:U(`appPackagesDeleteDataDescription`),label:U(`appPackagesDeleteData`),onClick:()=>b(!0)})]}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(JE,{loading:d,storage:e.storage,usage:u,unavailable:f})}),(0,K.jsxs)(ii,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,K.jsx)(B,{ref:x,autoFocus:!0,type:`button`,variant:`outline`,onClick:()=>v(!1),children:U(`cancel`)}),(0,K.jsx)(B,{type:`button`,variant:`destructive`,onClick:()=>{s(y),v(!1)},children:U(`appPackagesUninstall`)})]})]})})]})}function JE({loading:e,storage:t,unavailable:n,usage:r}){return r?(0,K.jsx)(QS,{storage:t,usage:r}):(0,K.jsxs)(`div`,{className:`rounded-xl bg-muted/45 px-3 py-3 text-xs text-muted-foreground`,children:[e?(0,K.jsx)(Rr,{className:`mr-1.5 inline h-3.5 w-3.5 animate-spin`}):null,U(e?`appPackagesLoading`:n?`appPackagesDataUsageUnavailable`:`appPackagesNoDataYet`)]})}function YE({enabled:e,isPending:t,operation:n,operationActive:r}){return r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Rr,{className:`mr-1.5 h-3.5 w-3.5 animate-spin`}),n?QE(n):U(`appPackagesWorking`)]}):U(t?`appPackagesWorking`:e?`appPackagesDisable`:`appPackagesEnable`)}function XE({fallback:e,icon:t}){return t&&(t.startsWith(`data:`)||t.startsWith(`/`)||t.startsWith(`http://`)||t.startsWith(`https://`))?(0,K.jsx)(`img`,{src:t,alt:``,className:`h-4 w-4 rounded object-cover`}):t?(0,K.jsx)(`span`,{className:`text-sm leading-none`,children:t}):(0,K.jsx)(e,{className:`h-3.5 w-3.5`})}function ZE({operation:e}){let t=e.status===`failed`||e.status===`interrupted`,n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,K.jsxs)(`div`,{className:`border-t border-border/50 px-4 py-2.5`,role:t?`alert`:`status`,"aria-live":`polite`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px]`,children:[t?(0,K.jsx)(ur,{className:`h-3.5 w-3.5 text-destructive`}):(0,K.jsx)(Rr,{className:`h-3.5 w-3.5 animate-spin text-primary`}),(0,K.jsx)(`span`,{className:t?`text-destructive`:`text-muted-foreground`,children:t?e.error??U(`appPackagesActionFailed`):QE(e)})]}),(0,K.jsx)(`div`,{className:`mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,K.jsx)(`div`,{className:V(`h-full rounded-full transition-[width] duration-300`,t?`bg-destructive`:`bg-primary`),style:{width:t?`100%`:`${n}%`}})})]})}function QE(e){switch(e.status){case`queued`:return U(`appPackagesPreparing`);case`resolving`:return U(`appPackagesResolving`);case`downloading`:return U(`appPackagesDownloading`);case`verifying`:return U(`appPackagesVerifying`);case`installing`:return e.action===`rollback`?`${U(`appPackagesSwitchingVersion`)} ${e.targetVersion?`v${e.targetVersion}`:``}`.trim():e.action===`uninstall`?U(`appPackagesUninstalling`):U(`appPackagesInstalling`);case`finalizing`:return U(`appPackagesFinalizing`);case`succeeded`:return U(`appPackagesCompleted`);case`failed`:case`interrupted`:return U(`appPackagesActionFailed`)}}function $E(e){return e.endsWith(`-todos`)?ws:e.endsWith(`-notes`)?ts:e.endsWith(`-favorites`)?no:e.endsWith(`-calendar`)?oo:Ln}function eD(e,t){let n=Xr()===`zh`?`zh-CN`:`en-US`;return t?.[n]??e}function tD({focusedPackageId:e,marketplaceActive:t=!1,onBrowseMarketplace:n,onManagePackage:r,onOpenPanelApp:i}){let a=uC(),o=tC(),l=dC(),u=c(),d=mC(),p=s(),m=f(),h=$(),g=(0,G.useRef)(null),_=(0,G.useRef)(null),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(``),S=(0,G.useMemo)(()=>l.data?.entries??[],[l.data?.entries]);(0,G.useEffect)(()=>{if(!e||a.isLoading)return;let t=document.getElementById(`app-package-${e}`);t?.scrollIntoView({block:`nearest`}),t?.focus({preventScroll:!0})},[a.data,a.isLoading,e]),pC({isLoaded:!!l.data,operations:S,refetchPackages:a.refetch,refetchPanels:u.refetch,refetchAppData:o.refetch,settlementManager:h.appPackageOperationSettlementManager});let C=(e,t)=>{d.reset(),d.mutate(e,{onSuccess:t})},w=async e=>{if(e.clientDeclared&&!e.clientGranted){if(!await h.serviceActionAuthorizationManager.requestAuthorization({panelAppId:e.appId,actions:[{actionId:`nextclaw.client`,actionTitle:U(`panelAppsClientGrantTitle`),actionDescription:U(`panelAppsClientGrantDescription`),risk:`dangerous`}]}))return;await m.mutateAsync(e.appId)}try{i(await p.mutateAsync(e.id))}catch{i(e)}};return(0,K.jsxs)(`div`,{className:`[container-type:inline-size] flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,K.jsx)(`div`,{hidden:t,className:t?`hidden`:`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,children:(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-3 py-4 [@container(min-width:28rem)]:px-5`,children:[(0,K.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3 px-1`,children:[(0,K.jsx)(`h1`,{ref:g,tabIndex:-1,className:`text-base font-semibold tracking-tight text-foreground`,children:U(`appPackagesLibraryTitle`)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(W,{icon:(0,K.jsx)(qr,{className:`h-3.5 w-3.5`}),label:U(`appPackagesRefresh`),onClick:()=>{a.refetch(),l.refetch(),u.refetch(),o.refetch()}}),(0,K.jsxs)(B,{type:`button`,size:`sm`,onClick:n,children:[(0,K.jsx)(rs,{className:`mr-1.5 h-3.5 w-3.5`}),U(`appPackagesBrowse`)]})]})]}),d.isError?(0,K.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:d.error instanceof Error?d.error.message:U(`appPackagesActionFailed`)}):null,(0,K.jsx)(nD,{appDataEntries:o.data?.entries??[],appDataLoading:o.isLoading,appDataUnavailable:o.isError,error:aD(a.error,u.error),focusedPackageId:e,isLoading:a.isLoading||u.isLoading,isPending:d.isPending,mutationAppId:`appId`in(d.variables??{})?d.variables.appId:void 0,packages:a.data?.entries??[],panelApps:u.data?.entries??[],unavailablePackages:u.data?.unavailablePackages??[],operations:S,onInstall:n,onMutate:C,onOpenPanelApp:e=>void w(e)}),(0,K.jsx)(rC,{diagnostics:o.data?.diagnostics??[],entries:o.data?.entries??[],error:o.error,isLoading:o.isLoading,onDeletionFocusReturn:()=>g.current?.focus()})]})}),(0,K.jsx)(`div`,{hidden:!t,className:t?`flex min-h-0 flex-1 flex-col`:`hidden`,children:(0,K.jsx)(HE,{sourceButtonRef:_,onCustomInstall:()=>{d.reset(),y(!0)},onManagePackage:r,error:d.error instanceof Error?d.error:null,hostTarget:a.data?.hostTarget,installedPackages:a.data?.entries??[],startingSource:d.variables?.action===`install`?d.variables.source:void 0,isStarting:d.isPending,operations:S,active:t,onInstall:(e,t)=>C({action:`install`,source:e,registryUrl:t}),onUpdate:e=>C({action:`update`,appId:e})})}),(0,K.jsx)(li,{open:v,onOpenChange:y,children:(0,K.jsx)(oi,{className:`max-w-md`,onCloseAutoFocus:e=>{e.preventDefault(),_.current?.focus()},children:(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let t=b.trim();t&&C({action:`install`,source:t},()=>{y(!1),x(``)})},children:[(0,K.jsxs)(ei,{showClose:!1,children:[(0,K.jsx)(si,{children:U(`appPackagesInstallTitle`)}),(0,K.jsx)(ci,{children:U(`appPackagesInstallDescription`)})]}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,K.jsx)(F,{autoFocus:!0,value:b,onChange:e=>x(e.target.value),placeholder:U(`appPackagesInstallPlaceholder`),"aria-label":U(`appPackagesInstallSource`)}),(0,K.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,K.jsx)(xs,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:U(`appPackagesInstallTrustHint`)})]}),d.isError?(0,K.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:d.error instanceof Error?d.error.message:U(`appPackagesActionFailed`)}):null]}),(0,K.jsxs)(ii,{className:`mt-5 gap-2 sm:gap-0`,children:[(0,K.jsx)(B,{type:`button`,variant:`outline`,onClick:()=>y(!1),children:U(`cancel`)}),(0,K.jsx)(B,{type:`submit`,disabled:!b.trim()||d.isPending,children:d.isPending?U(`appPackagesInstalling`):U(`appPackagesInstall`)})]})]})})})]})}function nD({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,K.jsxs)(`div`,{className:`divide-y divide-border/50`,role:`status`,"aria-label":U(`appPackagesLoading`),children:[(0,K.jsx)(Hi,{}),(0,K.jsx)(Hi,{})]});if(r)return(0,K.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`&&fC(e.status));return e.length>0?(0,K.jsx)(`div`,{className:`divide-y divide-border/50`,children:e.map(e=>(0,K.jsx)(rD,{operation:e},e.id))}):(0,K.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-border px-6 py-10 text-center`,children:[(0,K.jsx)(rs,{className:`h-7 w-7 text-muted-foreground`}),(0,K.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-foreground`,children:U(`appPackagesEmptyTitle`)}),(0,K.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-muted-foreground`,children:U(`appPackagesEmptyDescription`)}),(0,K.jsx)(B,{type:`button`,size:`sm`,className:`mt-4`,onClick:c,children:U(`appPackagesBrowse`)})]})}return(0,K.jsxs)(`div`,{className:`divide-y divide-border/50`,children:[m.filter(e=>e.action===`install`&&fC(e.status)&&!d.some(t=>t.id===e.appId)).map(e=>(0,K.jsx)(rD,{operation:e},e.id)),d.map(r=>{let a=m.find(e=>e.appId===r.id),c=a&&(fC(a.status)||a.status===`failed`||a.status===`interrupted`)?a:void 0;return(0,K.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`:`outline-none`,children:(0,K.jsx)(qE,{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 rD({operation:e}){let t=e.appId??e.source??U(`appPackagesInstall`),n=Math.max(4,Math.round(e.completedSteps/e.totalSteps*100));return(0,K.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,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(RS,{name:t}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-semibold text-foreground`,children:t}),(0,K.jsxs)(`p`,{className:`mt-0.5 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(Rr,{className:`h-3.5 w-3.5 animate-spin`}),iD(e)]})]})]}),(0,K.jsx)(`div`,{className:`ml-14 mt-2 h-1 overflow-hidden rounded-full bg-muted`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full bg-primary transition-[width] duration-300`,style:{width:`${n}%`}})})]})}function iD(e){switch(e.status){case`queued`:return U(`appPackagesPreparing`);case`resolving`:return U(`appPackagesResolving`);case`downloading`:return U(`appPackagesDownloading`);case`verifying`:return U(`appPackagesVerifying`);case`installing`:return U(`appPackagesInstalling`);case`finalizing`:return U(`appPackagesFinalizing`);case`succeeded`:return U(`appPackagesCompleted`);case`failed`:case`interrupted`:return e.error??U(`appPackagesActionFailed`)}}function aD(...e){return e.find(e=>e instanceof Error)?.message||(e.some(Boolean)?U(`appPackagesLoadFailed`):void 0)}async function oD(){return await un(()=>import(`./service-apps-panel-BReYr_ni.js`),__vite__mapDeps([4,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]))}var sD=(0,G.lazy)(async()=>({default:(await oD()).ServiceAppsPanel}));function cD({activeTab:e,onActiveTabChange:t,onOpenPanelApp:r,serviceResourceId:i}){let[a,o]=(0,G.useState)(),s=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>{let t=e.querySelector(`[aria-selected="true"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.right>n.right?e.scrollLeft+=r.right-n.right+12:r.left<n.left&&(e.scrollLeft-=n.left-r.left+12)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[e]);let c=e=>{o(void 0),t(e)},l=e=>{o(e),t(`apps`)};return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-card text-card-foreground`,children:[(0,K.jsx)(`nav`,{ref:s,className:`custom-scrollbar shrink-0 overflow-x-auto border-b border-border/60 px-3 py-2`,"aria-label":U(`appsTitle`),children:(0,K.jsx)(Ti,{value:e,onValueChange:e=>c(e),children:(0,K.jsxs)(wi,{className:`flex h-auto w-max flex-nowrap rounded-lg bg-transparent p-0.5 [&>button]:shrink-0`,children:[(0,K.jsxs)(Ci,{value:`apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,K.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:U(`appPackagesLibraryTitle`)})]}),(0,K.jsxs)(Ci,{value:`panel-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,K.jsx)(Ln,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:U(`panelAppsTitle`)})]}),(0,K.jsxs)(Ci,{value:`service-apps`,className:`min-w-0 gap-1.5 px-2 py-1.5 text-xs`,children:[(0,K.jsx)(bs,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:U(`serviceAppsTitle`)})]}),(0,K.jsxs)(Ci,{value:`marketplace`,className:`gap-1.5 px-2 py-1.5 text-xs`,children:[(0,K.jsx)(Os,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:U(`appPackagesMarketplaceTitle`)})]})]})})}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{hidden:e!==`apps`&&e!==`marketplace`,className:e===`apps`||e===`marketplace`?`h-full`:`hidden`,children:(0,K.jsx)(tD,{focusedPackageId:a,onOpenPanelApp:r,marketplaceActive:e===`marketplace`,onBrowseMarketplace:()=>c(`marketplace`),onManagePackage:l})}),e===`panel-apps`?(0,K.jsx)(FS,{onOpenPanelApp:r}):e===`service-apps`?(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(sD,{resourceId:i,onManagePackage:l})}):null]})]})}var lD=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=>!fC(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`){z.success(uD(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(),z.error(e.error??U(`appPackagesActionFailed`)))}}};function uD(e){switch(e.action){case`install`:return U(`appPackagesInstallCompleted`);case`update`:return e.result?.changed===!1?U(`appPackagesAlreadyCurrent`):U(`appPackagesUpdateCompleted`);case`rollback`:return e.result?.changed===!1?U(`appPackagesAlreadyOnVersion`):U(`appPackagesRollbackCompleted`);case`uninstall`:return U(`appPackagesUninstallCompleted`)}}function dD({appTitle:e,entry:t,onRefresh:n}){let[r,i]=(0,G.useState)(!1);return(0,K.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,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-muted-foreground`,title:e,children:e}),(0,K.jsx)(W,{icon:(0,K.jsx)(qr,{className:`h-3.5 w-3.5`}),label:U(`panelAppsRefreshCurrent`),onClick:n,size:`sm`}),t?(0,K.jsxs)(_i,{open:r,onOpenChange:i,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(W,{icon:(0,K.jsx)(wr,{className:`h-3.5 w-3.5`}),label:U(`panelAppsMoreActions`),size:`sm`})}),(0,K.jsxs)(hi,{align:`end`,variant:`menu`,children:[(0,K.jsx)(CS,{entry:t,onSelect:()=>i(!1)}),(0,K.jsx)(SS,{entry:t,onSelect:()=>i(!1)})]})]}):null]})}function fD({appTitle:e,currentUrl:t,onRefresh:n,resourceUri:r}){let i=c(),a=Ja({currentUrl:t,resourceUri:r}),o=(0,G.useMemo)(()=>i.data?.entries.find(e=>e.appId===a),[a,i.data?.entries]);return(0,K.jsx)(dD,{appTitle:o?.title??e,entry:o,onRefresh:n})}var pD=Na,mD=La,hD=Ha,gD=Ua;function _D(e){e.open(hD(),{kind:pD,title:U(`appsTitle`),dedupeKey:`apps`})}var vD={[ja]:{getTitle:()=>U(`docBrowserHomeTitle`),renderContent:({open:e})=>(0,K.jsx)(sz,{open:e})},[pD]:{getTitle:()=>U(`appsTitle`),renderIcon:()=>(0,K.jsx)(n,{className:`w-4 h-4 text-primary shrink-0`}),renderContent:({currentUrl:e,open:t,openTarget:n})=>(0,K.jsx)(cD,{activeTab:gD(e),onActiveTabChange:e=>t(hD(e),{activate:!1,kind:pD,title:U(`appsTitle`),dedupeKey:`apps`}),onOpenPanelApp:e=>n(Za(e))})},[mD]:{getIframeSandbox:()=>l,getTitle:e=>e.title||U(`panelAppsTitle`),onIframeMessage:e=>iV().panelAppBridgeManager.handleIframeMessage(e),onIframePointerOver:e=>m(e.currentTarget),renderIcon:()=>(0,K.jsx)(Ln,{className:`w-4 h-4 text-primary shrink-0`}),renderToolbar:({refreshIframe:e,tab:t})=>(0,K.jsx)(fD,{appTitle:t.title||U(`panelAppsTitle`),currentUrl:t.currentUrl,onRefresh:e,resourceUri:t.resourceUri}),supportsScrollRestoration:!0}};function yD(){let{appId:e=``}=pn(),t=Xi();return(0,K.jsx)(p,{appId:e,restorationScope:`main`,unavailableAction:{label:U(`panelAppsOpenApps`),onAction:()=>_D(t)}})}function bD(e,t){let n=t.trim();return[e.id,e.appId,e.fileName,e.title].some(e=>e.trim()===n)}function xD(e,t){let n=t.trim();return n?e.find(e=>bD(e,n))??null:null}function SD(e,t){return Ga(e,t)}function CD(e){return`${e}${e.includes(`?`)?`&`:`?`}${new URLSearchParams({[D.displayModeSearchParam]:D.displayMode,[D.placementSearchParam]:D.placement}).toString()}`}function wD(e){if(!e||typeof e!=`object`)return null;let t=e;return t.type===D.contentHeightMessageType&&typeof t.height==`number`&&Number.isFinite(t.height)&&t.height>0?Math.ceil(t.height):null}function TD(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:La,navVersion:0,resourceUri:wt(t,r),title:i}}function ED({panelApp:e,showExpandAction:t=!0}){let n=Xi(),r=(0,G.useRef)(null),i=(0,G.useId)(),[a,o]=(0,G.useState)(null),s=c(),u=(0,G.useMemo)(()=>e.path?void 0:xD(s.data?.entries??[],e.appId),[e.appId,e.path,s.data?.entries]),d=u?Za(u):null,f=e.title??d?.title??e.appId,p=e.path?SD(e.appId,e.path):s.isLoading?``:d?.url??SD(e.appId),h=(0,G.useMemo)(()=>p?CD(p):``,[p]),g=(0,G.useMemo)(()=>TD({appId:u?.id??e.appId,params:e.params,path:e.path,title:f,url:p}),[u?.id,e.appId,e.params,e.path,f,p]),_=be(e.params),v=`${g.id}:${g.navVersion}:${i}:${_??``}`;return(0,G.useEffect)(()=>{if(!p)return;let e=e=>{if(e.source!==r.current?.contentWindow)return;let t=wD(e.data);if(t!==null){o(t);return}iV().panelAppBridgeManager.handleIframeMessage({event:e,iframe:r.current})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[p]),p?(0,K.jsx)(vS,{actions:t?(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(Go,{className:`h-3.5 w-3.5`}),label:U(`chatPanelCardExpand`),tooltipSide:`top`,onClick:()=>{if(d){n.openTarget({...d,contentParams:e.params});return}n.open(p,{dedupeKey:g.dedupeKey,kind:g.kind,contentParams:e.params,title:f})}}):void 0,contentHeight:a,children:(0,K.jsx)(`iframe`,{ref:r,src:h,name:_,title:f,sandbox:l,tabIndex:0,onPointerOver:()=>m(r.current),className:`h-full w-full border-0 bg-card`},v)}):(0,K.jsx)(vS,{isLoading:!0,children:(0,K.jsx)(`span`,{className:`sr-only`,children:f})})}function DD({checkpoint:e,inline:t=!1}){let n=!e||e.status===`compressing`,r=e?.status===`failed`,i=e?.status===`cancelled`,a=e?[`${U(`chatContextCompactionCoveredMessages`)}: ${e.coveredSessionMessageCount}`,`${U(`chatContextCompactionOriginalTokens`)}: ${e.originalEstimatedTokens}`,`${U(`chatContextCompactionProjectedTokens`)}: ${e.projectedEstimatedTokens}`].join(`
|
|
22
|
+
`):void 0;return(0,K.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,K.jsx)(`div`,{className:`h-px flex-1 bg-border`}),(0,K.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-border bg-muted px-3 py-1`,children:[n?(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground`}):(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-muted-foreground/45`}),(0,K.jsx)(`span`,{children:U(n?`chatContextCompactionCompressing`:i?`chatContextCompactionCancelled`:r?`chatContextCompactionFailed`:`chatContextCompactionCompressed`)})]}),(0,K.jsx)(`div`,{className:`h-px flex-1 bg-border`})]})}function OD({inheritance:e}){return(0,K.jsxs)(`div`,{className:`my-4 flex items-center gap-3 text-[11px] text-emerald-700`,title:[`${U(`chatContextInheritanceSourceSession`)}: ${e.sourceSessionId}`,`${U(`chatContextInheritanceMessages`)}: ${e.inheritedMessageCount}`].join(`
|
|
23
|
+
`),children:[(0,K.jsx)(`div`,{className:`h-px flex-1 bg-emerald-100`}),(0,K.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-emerald-200 bg-emerald-50 px-3 py-1`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-emerald-400`}),(0,K.jsx)(`span`,{children:U(`chatContextInheritanceInherited`)})]}),(0,K.jsx)(`div`,{className:`h-px flex-1 bg-emerald-100`})]})}function kD(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 AD(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 jD(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var MD=(e,t)=>Math.abs(e-t)<1.01,ND=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},PD,FD=()=>{if(PD!==void 0)return PD;if(typeof navigator>`u`)return PD=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return PD=!0;let e=navigator.maxTouchPoints;return PD=navigator.platform===`MacIntel`&&e!==void 0&&e>0},ID=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},LD=e=>e,RD=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},zD=(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(ID(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(ID(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},BD={passive:!0},VD=typeof window>`u`?!0:`onscrollend`in window,HD=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&VD,o=0,s=a?null:ND(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,BD),a&&r.addEventListener(`scrollend`,u,BD),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},UD=(e,t)=>HD(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),WD=(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`]},GD=(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})},KD=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:LD,rangeExtractor:RD,onChange:()=>{},measureElement:WD,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=AD(()=>(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,!(!FD()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,BD),e.addEventListener(`touchend`,n,BD),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&&(FD()&&(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=AD(()=>[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=AD(()=>[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=kD(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=AD(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=YD(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=AD(()=>{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=AD(()=>[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 jD(t[qD(0,t.length-1,r?e=>n[e*2]:e=>jD(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&&(FD()&&(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&&MD(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()}},qD=(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 JD(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 YD(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=JD(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=qD(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 XD=e(Ze(),1),ZD=typeof document<`u`?G.useLayoutEffect:G.useEffect;function QD({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=G.useReducer(e=>e+1,0)[1],a=G.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,XD.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=G.useState(()=>{let e=new KD(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),ZD(()=>c._didMount(),[]),ZD(()=>c._willUpdate()),ZD(()=>{o(c)}),c}function $D(e){return QD({observeElementRect:zD,observeElementOffset:UD,scrollToFn:GD,...e})}var eO=180;function tO(e){let{activeRowKey:t,focusedRowKey:n,anchorRowKey:r,rows:i,scrollRef:a}=e,o=(0,G.useMemo)(()=>i.flatMap((e,i)=>e.key===t||e.key===n||e.key===r?[i]:[]),[t,n,r,i]),s=(0,G.useCallback)(e=>[...new Set([...RD(e),...o])].sort((e,t)=>e-t),[o]),c=(0,G.useRef)(null),l=$D({anchorTo:`end`,scrollEndThreshold:-1,count:i.length,directDomUpdates:!0,estimateSize:()=>eO,getItemKey:e=>i[e]?.key??e,getScrollElement:()=>a.current,initialOffset:()=>i.length*eO,initialRect:{width:0,height:800},overscan:8,rangeExtractor:s,scrollToFn:(e,t,n)=>{let r=c.current;r&&(r.style.height=`${n.getTotalSize()}px`),GD(e,t,n)}});return l.shouldAdjustScrollPositionOnItemSizeChange=e=>e.end<=(l.scrollOffset??0),{containerRef:(0,G.useCallback)(e=>{c.current=e,l.containerRef(e)},[l]),virtualizer:l}}function nO(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 rO(e){return e?.type===`token`&&!!g_(e)}function iO(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)||rO(i),s=a?.type===`text`&&/^\S/.test(a.text)||rO(a);return`${o?` `:``}${r}${s?` `:``}`}function aO(e){return jn(e)}function oO(e){return In(e)}function sO(e){return Tn(e,`skill`)}function cO(e){return Tn(e,`file`)}function lO(e,t,n){let r=new Set(t),i=An(e,e=>e.tokenKind===`skill`&&!r.has(e.tokenKey)),a=Tn(i,`skill`),o=new Map(n.map(e=>[e.ref,e])),s=t.filter(e=>!a.includes(e)).map(e=>Pn({tokenKind:`skill`,tokenKey:e,label:o.get(e)?.name||e}));return s.length===0?i:Dn([...i,...s])}function uO(e,t){let n=new Set(cO(e));return t.filter(e=>n.has(e.id))}function dO(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=nO(r,i.text);continue}let a=g_(i);if(a){r=nO(r,iO({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 fO(e,t){return e?Object.fromEntries(t.map(t=>[t,e])):{}}function pO(e){let t=Pc(e.projectRoot),n={...fO(e.model?.trim(),[`model`,`preferred_model`]),...fO(e.thinkingLevel?.trim(),[`thinkingEffort`,`thinking`,`preferred_thinking`]),...fO(e.sessionType?.trim(),[`agentRuntimeId`,`session_type`,`runtime`]),...fO(e.agentId?.trim(),[`agentId`,`agent_id`]),...fO(t??void 0,[`projectRoot`,`project_root`])},r=e.composerNodes?S_(e.composerNodes,e.skillRecords):[];return r.length>0&&(n[fe]=U_(r)),e.sessionMaterialization&&(n[ue]=e.sessionMaterialization),n}function mO(e){return e.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function hO({disabled:e,messageId:t,onCancel:n,onChange:r,onSave:i,snapshot:a}){let o=(0,G.useRef)(null),s=(0,G.useRef)([...a.nodes]),c=dO([...a.nodes],a.attachments),l=(0,G.useCallback)(e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())},[n]);return(0,G.useLayoutEffect)(()=>{o.current?.focusComposerAtEnd(s.current)},[t]),(0,K.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,K.jsx)(lr,{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:uO(t,a.attachments),nodes:t,selectedSkills:sO(t),text:oO(t)})},placeholder:U(`chatEditMessagePlaceholder`)},t),(0,K.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border/70 px-3 py-2`,children:[(0,K.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:U(`chatEditMessageCancel`)}),(0,K.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||!mO(c),onClick:()=>void i(),children:U(`chatEditMessageSubmit`)})]})]})}function gO(e){let t=Yy(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 _O(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(Mn(e.slice(r))),n;i.index>r&&n.push(Mn(e.slice(r,i.index))),n.push(Pn({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 vO(e){let{attachmentIdPrefix:t,availableSkills:n,message:r}=e,i=R_(e.metadata??r.metadata??{}),a=[],o=[];r.parts.forEach((e,n)=>{if(e.type===`text`||e.type===`rich-text`||e.type===`reasoning`){a.push(..._O(e.text,L_(e.text,i)));return}if(e.type!==`file`)return;let r=`${t}-${n}`,s={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};o.push(s),a.push(Pn({tokenKind:`file`,tokenKey:r,label:s.name,previewUrl:s.mimeType.startsWith(`image/`)?s.url:void 0}))});let s=Dn(a),c=i.filter(e=>e.kind===`skill`),l=[...new Set(c.map(e=>e.ref))],u=new Map(n.map(({ref:e,name:t})=>[e,t]));for(let e of c)u.has(e.ref)||u.set(e.ref,e.name);return{text:oO(s),nodes:s,selectedSkills:l,skillRecords:l.map(e=>({ref:e,name:u.get(e)??e})),attachments:o}}function yO(){return`edited-message-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function bO(e){return e.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function xO(e,t){let n={...e.metadata};delete n[fe];let r=R_(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,pO({composerNodes:[...t.nodes],skillRecords:r})),Object.keys(n).length>0?n:void 0}function SO({adaptedMessages:e,canContinue:t,disabled:n,onContinueRun:r,onEditMessage:i,rawMessages:a}){let o=(0,G.useMemo)(()=>gO({canContinue:t,isBusy:n,messages:a}),[t,n,a]),s=(0,G.useMemo)(()=>e.map(e=>{let t=[];return i&&e.id===o.editableUserMessageId&&t.push({disabled:n,icon:`edit`,key:`edit-message`,label:U(`chatEditMessage`)}),r&&e.id===o.continuationAssistantMessageId&&t.push({disabled:n,icon:`continue`,key:`continue-run`,label:U(`chatContinueRun`)}),t.length>0?{...e,actions:t}:e}),[o,e,n,r,i]),[c,l]=(0,G.useState)(null),u=(0,G.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:vO({attachmentIdPrefix:`edited-attachment-${n.id}`,availableSkills:[],message:n})})},[r,i,a]),d=(0,G.useCallback)(async()=>{if(!c||!i)return;let e=dO([...c.snapshot.nodes],c.snapshot.attachments);bO(e)&&(await i({messageId:c.message.id,message:{...c.message,id:yO(),metadata:xO(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,G.useCallback)(e=>c?.message.id===e.id?(0,K.jsx)(hO,{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 CO(e){let{selectedSession:t,sessionKey:n}=e,r=q(),i=fn(),a=$(),o=t?.projectRoot??t?.workingDir,s=(0,G.useCallback)(e=>{let s=(e.kind===`ui_resource`||e.kind===`system_object`)&&`key`in e?e.key:e.kind===`workspace_excerpt`&&`excerpt`in e&&e.path.startsWith(`nextclaw://`)?e.path:null;if(s){let e=a.pageResourceManager.resolve(s);e&&a.pageResourceManager.open(e,`default`,i);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:A_({projectRoot:o,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=A_({projectRoot:o,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 c=e.path?.trim();if(c){r.chatThreadManager.openFilePreview({path:c,label:e.label||e.name,viewMode:`preview`,previewViewer:`rendered`});return}if(!n){z.error(U(`chatSkillPreviewUnavailable`));return}re(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){z.error(U(`chatSkillPreviewUnavailable`));return}r.chatThreadManager.openFilePreview({path:o,label:e.label||a.name,viewMode:`preview`,previewViewer:`rendered`})}).catch(()=>z.error(U(`chatSkillPreviewUnavailable`)))},[a,i,r,o,t?.projectRoot,n]);return{handleAttachmentOpen:(0,G.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:s}}function wO({event:e}){let{language:t}=d(),n=zy(e.payload);return(0,K.jsxs)(`details`,{"aria-label":U(`chatObservationEventLabel`,t),"data-testid":`chat-observation-event`,className:`group my-3 min-w-0 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`summary`,{"aria-label":`${U(`chatObservationEventLabel`,t)}: ${e.eventType}. ${U(`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,K.jsx)(`span`,{className:`h-px min-w-4 flex-1 bg-border/70`}),(0,K.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,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/50`}),(0,K.jsx)(`span`,{className:`shrink-0`,children:U(`chatObservationEventLabel`,t)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/60`,children:`·`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:e.eventType}),(0,K.jsx)(Mr,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`,"aria-hidden":`true`})]}),(0,K.jsx)(`span`,{className:`h-px min-w-4 flex-1 bg-border/70`})]}),(0,K.jsxs)(`div`,{className:`mx-auto mt-3 max-w-2xl overflow-hidden rounded-xl border border-border/70 bg-card shadow-sm`,children:[(0,K.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,K.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/55`}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs font-medium text-foreground/85`,children:U(`chatObservationEventDetailsTitle`,t)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/50`,children:`·`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-foreground`,children:e.eventType})]}),(0,K.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,K.jsx)(`dt`,{className:`text-muted-foreground`,children:U(`chatObservationEventExtension`,t)}),(0,K.jsx)(`dd`,{className:`min-w-0 truncate text-foreground/80`,children:e.extensionId}),(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:U(`chatObservationEventId`,t)}),(0,K.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[11px] text-foreground/75`,children:e.eventId}),(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:U(`chatObservationEventTime`,t)}),(0,K.jsx)(`dd`,{className:`text-foreground/80`,children:(0,K.jsx)(`time`,{dateTime:e.occurredAt,children:Zr(e.occurredAt,t)})})]}),(0,K.jsxs)(`div`,{className:`border-t border-border/60 px-3 py-3`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 text-[11px] font-medium text-muted-foreground`,children:U(`chatObservationEventPayloadLabel`,t)}),(0,K.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||U(`chatObservationEventPayloadEmpty`,t)})]})]})]})}var TO=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 Yy(o,{continuationRunning:t}).map(e=>{let t=bb({message:e,processedLabel:a,language:i}),o=t?.label??null,c=wb({message:e,labels:n}),l=c?.cacheKey??null,u=Ob({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=Tb(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=fl(e),h=hb({id:m.id,role:m.role,meta:{timestamp:m.meta?.timestamp,status:m.meta?.status,inlineTokens:R_(e.metadata),processSummary:t,executionSummaryLabel:c?.summaryLabel,moreActions:f,userQuestionReply:db(e)??void 0},parts:ul(e.parts)},{formatTimestamp:e=>Zr(e,i),texts:s});return this.cache.set(e,{language:i,processSummaryLabel:o,executionPresentationKey:l,triggerDetailsKey:d,viewModel:h}),h})}}};function EO(e){if(e.target.type===`panel_app`)return(0,K.jsx)(ED,{panelApp:{appId:e.target.payload.appId,params:e.target.payload.params,path:e.target.payload.path,title:e.title}})}var DO=e=>(0,K.jsx)(Ad,{agentId:e,className:`h-4 w-4 shrink-0`}),OO=e=>(0,K.jsx)(ED,{panelApp:e}),kO=8e3;function AO(e){let t=e.commonAncestorContainer;return(t instanceof Element?t:t.parentElement)?.closest(`[data-chat-message-selectable="true"]`)??null}function jO(e,t){return e.kind===`typing`||e.key===t}function MO(e,t,n){return e.kind===`message`&&e.message.id===t?n:void 0}function NO({canContinue:e=!1,messages:t,messageDetailStates:n,isSending:r,messageActionsDisabled:i=!1,onContinueRun:a,onEditMessage:o,onLoadMessageDetails:s,scrollRef:c,turnAnchorRef:l,sessionKey:u,className:f}){let p=q(),{language:m}=d(),h=hg(e=>e.layout),g=Lu(u),_=J(e=>e.snapshot.selectedAgentId),v=_u(e=>e.snapshot.sessionTypesQuery?.data??null),y=ql(g?.sessionType??v?.defaultType),b=y!==`native`||(g?.agentId??_).trim().toLowerCase()!==`main`,x=Xl(v?.options??[]).find(e=>e.value===y),S=x?.icon?.src?.trim()?(0,K.jsx)(lu,{icon:{kind:`runtime-image`,src:x.icon.src,alt:x.icon.alt??null,name:x.label},className:`h-[65%] w-[65%]`}):void 0,C=g?.workingDir??g?.projectRoot??null,w=(0,G.useCallback)(e=>{let t=EO(e);if(t)return t;if(e.target.type===`file`)return(0,K.jsx)(yS,{display:e,parentSessionKey:u,sessionProjectRoot:g?.projectRoot??null,sessionWorkingDir:C,onFileOpen:p.chatThreadManager.openFilePreview})},[C,p.chatThreadManager,g?.projectRoot,u]),T=(0,G.useCallback)(e=>qt(e.path,C),[C]),E=(0,G.useMemo)(()=>kb(m),[m]),D=(0,G.useMemo)(()=>jb(m),[m]),O=(0,G.useMemo)(()=>Mb(m),[m]),{handleMessageAction:k,messages:A,renderMessageContent:j}=SO({adaptedMessages:(0,G.useMemo)(()=>TO.adapt({continuationRunning:r,executionLabels:D,triggerLabels:O,language:m,processedLabel:U(`chatProcessSummaryProcessed`),rawMessages:t,texts:E}),[D,r,m,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,G.useMemo)(()=>Nb(m),[m]),ee=(0,G.useCallback)(({range:e})=>!!AO(e),[]),te=(0,G.useCallback)(({range:e,text:t})=>{let n=AO(e),r=n?.dataset.chatMessageId?.trim(),i=n?.dataset.chatMessageRole,a=n?.dataset.chatMessageRoleLabel?.trim();!r||!a||i!==`assistant`&&i!==`user`||p.chatComposerIntentManager.requestConversationExcerptReference({targetSessionKey:u,messageId:r,role:i,label:a,excerpt:t})},[p.chatComposerIntentManager,u]),F=(0,G.useMemo)(()=>Qy({rawMessages:t,messages:A}),[A,t]),ne=(0,G.useMemo)(()=>r&&!N?[...F,{kind:`typing`,key:`typing`}]:F,[N,r,F]),[I,re]=(0,G.useState)(null),ie=M?`message:${M.id}`:null,ae=A.findLast(e=>e.role===`user`)?.id,{containerRef:oe,virtualizer:se}=tO({rows:ne,scrollRef:c,activeRowKey:ie,focusedRowKey:I,anchorRowKey:l&&ae?`message:${ae}`:null}),{handleAttachmentOpen:ce,handleInlineTokenClick:le}=CO({selectedSession:g,sessionKey:u}),ue=(0,G.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||re(null)},[]),de=(0,G.useCallback)(e=>{if(e.customType===`nextclaw.user-question`)return(0,K.jsx)(Wg,{data:e.data});if(e.customType===`nextclaw.user-question-reply`)return(0,K.jsx)(Gg,{data:e.data});if(Fy(e.customType)){let t=Ry(e.data);return t?(0,K.jsx)(wO,{event:t}):void 0}if(e.customType!==`nextclaw.context-compaction`)return;let t=e.data;return(0,K.jsx)(DD,{checkpoint:t.checkpoint,inline:!0})},[]);return(0,K.jsx)(Wn,{actionLabel:P.addSelectionToChatLabel??U(`chatWorkspaceAddToChat`),isSelectionAllowed:ee,maxCharacters:kO,onAddToChat:te,selectionTooLongLabel:P.selectionTooLongLabel??U(`chatWorkspaceExcerptSelectionTooLong`),children:(0,K.jsx)(`div`,{className:V(`relative`,f),ref:oe,children:se.getVirtualItems().map(e=>{let t=ne[e.index];return t?(0,K.jsx)(`div`,{"data-index":e.index,ref:se.measureElement,onBlurCapture:ue,onFocusCapture:()=>re(t.key),className:`absolute left-0 top-0 w-full`,children:t.kind===`compaction`?(0,K.jsx)(DD,{checkpoint:t.checkpoint}):t.kind===`context-inheritance`?(0,K.jsx)(OD,{inheritance:t.inheritance}):t.kind===`observation-event`?(0,K.jsx)(wO,{event:t.event}):(0,K.jsx)(`div`,{className:t.kind===`message`?`pb-5`:void 0,ref:MO(t,ae,l),children:(0,K.jsx)(pr,{assistantAvatarIcon:S,showAssistantHeader:b,layout:h,messages:t.kind===`message`?[t.message]:[],isSending:jO(t,ie),hasAssistantDraft:N,texts:P,onToolAction:p.chatThreadManager.handleToolAction,onFileOpen:p.chatThreadManager.openFilePreview,onAttachmentOpen:ce,onInlineTokenClick:le,onMessageAction:k,resolveMessageToolPayloadState:e=>n?.[e],onMessageToolPayloadRequest:s,resolveFileContentUrl:T,renderCustomPart:de,renderInlineDisplay:w,renderMessageContent:j,renderToolAgent:DO,renderPanelAppCard:OO})})},t.key):null})})})}function PO(e,t){return e&&!t?`chat-conversation:${e}`:null}function FO({historyError:e,isLoadingPreviousMessages:t,onLoadPreviousMessages:n}){return(0,K.jsx)(K.Fragment,{children:e?(0,K.jsx)(`div`,{role:`alert`,className:`flex h-8 justify-center`,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":U(`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 n(),children:[U(`chatHistoryLoadFailed`),` · `,U(`chatHistoryRetry`)]})}):t?(0,K.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})}function IO({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,resourceWorkingDir:f,showWelcome:p,onLoadPreviousMessages:m,onLoadMessageDetails:h,onContinueRun:g,onEditMessage:_,welcomeSlot:v}){let y=(0,G.useRef)(null),b=(0,G.useRef)(null),x=(0,G.useRef)(null),S=(0,G.useRef)(null),C=l.findLast(e=>e.role===`user`)?.id??null,w=l.length>0||s,T=PO(d,p),E=(0,G.useMemo)(()=>T?Ni.read(T):null,[T]),{onScroll:D}=aS({restorationKey:T,scrollRef:y,isEnabled:!p&&!n}),{isAtBottom:O,onScroll:k,scrollToBottom:A}=qn({contentRef:b,scrollRef:y,resetKey:d,initialScrollTop:E?.y,isLoading:n,hasContent:w,contentVersion:l[l.length-1]??s,stickyThresholdPx:80,turnSpace:{key:C,anchorRef:x,frameRef:S}}),j=l.length>0;return(0,K.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{ref:y,onScroll:(0,G.useCallback)(e=>{D(e),k(),e.currentTarget.scrollTop<=320&&r&&!a&&m()},[r,a,m,k,D]),"data-chat-scroll-container":`true`,"data-resource-session":d??void 0,"data-resource-working-dir":f??void 0,className:p?`h-full overflow-y-auto custom-scrollbar`:`h-full overflow-y-auto custom-scrollbar ${rc}`,style:{overflowAnchor:`none`},children:p?v??null:(0,K.jsx)(`div`,{ref:S,children:(0,K.jsxs)(`div`,{ref:b,className:`pb-7`,children:[w?(0,K.jsxs)(gg,{className:`relative py-4 sm:py-5`,children:[(0,K.jsx)(FO,{historyError:i,isLoadingPreviousMessages:a,onLoadPreviousMessages:m}),(0,K.jsx)(NO,{canContinue:t,messages:l,messageDetailStates:u,isSending:s,messageActionsDisabled:c,onContinueRun:g,onEditMessage:_,onLoadMessageDetails:h,scrollRef:y,sessionKey:d,turnAnchorRef:x}),o?(0,K.jsx)(DD,{}):null]}):null,e?(0,K.jsx)(gg,{className:`pb-4 sm:pb-5`,children:e}):null]})})}),j&&!p&&!O?(0,K.jsx)(W,{icon:(0,K.jsx)(eo,{className:`h-4 w-4`}),label:U(`chatScrollToBottom`),onClick:A,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 LO(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(`
|
|
24
|
+
`)}}async function*RO(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}=zO(i);i=s;for(let e of o)yield e}i+=r.decode();let{frames:e}=zO(i,!0);for(let t of e)yield t}finally{n.releaseLock()}}function zO(e,t=!1){let n=e.split(/\r?\n\r?\n/),r=n.pop()??``,i=[];for(let e of n){let t=LO(e);t&&i.push(t)}if(t&&r.trim()){let e=LO(r);return e&&i.push(e),{frames:i,rest:``}}return{frames:i,rest:r}}var BO=`/ncp/agent`,VO=class extends Error{ncpError;alreadyPublished;constructor(e,t=!1){super(e.message),this.name=`NcpHttpAgentClientError(${e.code})`,this.ncpError=e,this.alreadyPublished=t}};function HO(e){let t=e.trim();if(!t)throw Error(`NcpHttpAgentClient requires a non-empty baseUrl.`);return new URL(t)}function UO(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 WO(e){let t=(e??`/ncp/agent`).trim();if(!t)return BO;let n=t.startsWith(`/`)?t:`/${t}`;return n.endsWith(`/`)?n.slice(0,-1):n}async function GO(e){try{return(await e.text()).trim()}catch{return``}}function KO(e){if(XO(e))return e.ncpError;if(JO(e))return e;let t=e instanceof Error?e.message:String(e??`Unknown error`);return{code:QO(void 0),message:t,...e instanceof Error&&e.stack?{details:{stack:e.stack}}:{}}}function qO(e,t={}){return new VO(e,t.alreadyPublished??!1)}function JO(e){return YO(e)&&typeof e.code==`string`&&typeof e.message==`string`}function YO(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function XO(e){return e instanceof VO}var ZO={"config-error":`config-error`,"auth-error":`auth-error`,"runtime-error":`runtime-error`,"timeout-error":`timeout-error`,"abort-error":`abort-error`};function QO(e){if(!e)return`runtime-error`;let t=ZO[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 $O(e){let t=tk(e);return!t||typeof t.type!=`string`||!t.type.trim()?null:t}function ek(e){let t=tk(e);if(!t)return{code:`runtime-error`,message:e||`Unknown stream error.`};let n=typeof t.code==`string`?t.code:void 0,r=QO(n),i=YO(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 tk(e){try{let t=JSON.parse(e);return YO(t)?t:null}catch{return null}}var nk=[`text`,`file`,`source`,`step-start`,`reasoning`,`tool-invocation`,`card`,`rich-text`,`action`,`extension`];function rk(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.trunc(e):null}var ik=class extends VO{sendRejected;constructor(e,t){super(KO(Error(e))),this.sendRejected=t}},ak=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=HO(n),this.basePath=WO(t),this.fetchImpl=UO(i),this.defaultHeaders=a??{},this.streamOpenTimeoutMs=rk(s),this.streamIdleTimeoutMs=rk(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:nk,expectedLatency:`seconds`,metadata:{transport:`http+sse`,scope:`agent`}}}start=async()=>{this.started||(this.started=!0,this.publish(Eg({type:X.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 new ik(`NCP send command failed with HTTP ${n.status}: ${await GO(n)}`,n.status<500&&n.status!==408);let r=await n.json();if(!r.ok||!r.data)throw new ik(r.error?.message??`NCP send command returned an invalid handle.`,r.ok===!1);return r.data}catch(e){if(t.signal.aborted)throw Error(`NCP send command was cancelled.`);if(XO(e))throw this.publish(Eg({type:X.EndpointError,payload:e.ncpError})),e;let n=KO(e);throw this.publish(Eg({type:X.EndpointError,payload:n})),qO(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 GO(n)}`)}catch(e){if(t.signal.aborted)return;let n=KO(e);throw this.publish(Eg({type:X.EndpointError,payload:n})),qO(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 GO(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 RO(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 XO(e)?e:qO(s??KO(e))}finally{c(),this.activeControllers.delete(a)}};handleSseFrame=e=>{if(e.event===`ncp-event`){let t=$O(e.data);if(!t){this.publish(Eg({type:X.EndpointError,payload:{code:`runtime-error`,message:`Received malformed ncp-event frame.`}}));return}this.publish(t);return}if(e.event===`error`){let t=ek(e.data);throw this.publish(Eg({type:X.EndpointError,payload:t})),qO(t,{alreadyPublished:!0})}}};function ok(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 sk(e){return ok(Lg(e))}var ck=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=Tg(e.metadata);t&&(!e.runId||e.runId===t.runId)&&(this.execution=structuredClone(t));let n=Mg(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?{[bg]:structuredClone(n)}:{},...r?{[Dg]:structuredClone(r)}:{}}}}},lk=`__nextclaw_aborted_tool_call__`;function uk(e,t){switch(t.type){case X.MessageSent:e.handleMessageSent(t.payload);break;case X.MessageCompleted:e.handleMessageCompleted(t.payload);break;case X.MessageAbort:e.handleMessageAbort(t.payload,t.occurredAt);break;case X.MessageFailed:e.handleMessageFailed(t.payload,t.occurredAt);break;case X.MessageTextStart:e.handleMessageTextStart(t.payload);break;case X.MessageTextDelta:e.handleMessageTextDelta(t.payload);break;case X.MessageTextEnd:e.handleMessageTextEnd(t.payload);break;case X.MessageReasoningStart:e.handleMessageReasoningStart(t.payload);break;case X.MessageReasoningDelta:e.handleMessageReasoningDelta(t.payload);break;case X.MessageReasoningEnd:e.handleMessageReasoningEnd(t.payload);break;case X.MessageToolCallStart:e.handleMessageToolCallStart(t.payload);break;case X.MessageToolCallArgs:e.handleMessageToolCallArgs(t.payload);break;case X.MessageToolCallArgsDelta:e.handleMessageToolCallArgsDelta(t.payload);break;case X.MessageToolCallEnd:e.handleMessageToolCallEnd(t.payload);break;case X.MessageToolExecutionStarted:e.handleMessageToolExecutionStarted(t.payload,t.occurredAt);break;case X.MessageToolCallResult:e.handleMessageToolCallResult(t.payload,t.occurredAt);break;case X.RunStarted:e.handleRunStarted(t.payload,t.occurredAt);break;case X.RunFinished:e.handleRunFinished(t.payload,t.occurredAt);break;case X.RunError:e.handleRunError(t.payload,t.occurredAt);break;case X.RunMetadata:e.handleRunMetadata(t.payload);break;case X.ContextWindowUpdated:e.handleContextWindowUpdated(t.payload);break;case X.EndpointError:e.handleEndpointError(t.payload,t.occurredAt);break;default:break}}function dk(e,t){let n=fk(e?.startedAt),r=fk(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 fk(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():void 0}function pk(e,t){if(!e)return t;if(!t)return e;let n=dk(e),r=dk(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 mk(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 hk(e){if(!(!e.startedAt&&!e.endedAt))return{startedAt:e.startedAt,endedAt:e.endedAt}}function gk(e,t,n){return!n||t?.id===n?t:e.find(e=>e.id===n&&e.role===`assistant`)}function _k(e,t,n){let r=t===`error`||n?.endedAt?Dk(e.parts,n?.endedAt).parts:e.parts;return n?{...e,status:t,parts:r,lifecycle:n}:{...e,status:t,parts:r}}function vk(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 yk(e,t){let n=[...e];return n.splice(vk(e,t),0,t),n}function bk(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 xk(e,t,n,r){let i=sk(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)}if(i.role===`assistant`&&(i.status===`pending`||i.status===`streaming`)&&(!t||a)){let e=s.findIndex(e=>e.id===i.id);return s.splice(e,1),{messages:s,streamingMessage:i,streamingMessageIndex:e}}return{messages:s,streamingMessage:a?null:t,streamingMessageIndex:a?null:n}}function Sk(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=yk(i,sk(e)));return i}function Ck(e,t){return t.trim()?e.id.startsWith(`tool-`)?!0:e.parts.some(e=>e.type===`tool-invocation`):!1}function wk(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 Tk(e,t){return wk(e,t)?.toolName??null}function Ek(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 Dk(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 Ok(e){return e.state===`result`||e.state===`cancelled`||!!e.execution?.endedAt||typeof e.execution?.durationMs==`number`}var kk=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,lk))};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:Ek(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:Ek(t.parts,{type:`tool-invocation`,toolCallId:e.toolCallId,toolName:Tk(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=fk(t);if(!n||this.port.updateMessageContainingToolCall(e.toolCallId,(e,t)=>{if(Ok(t))return e.parts;let r=fk(t.execution?.startedAt),i=r&&Date.parse(r)<=Date.parse(n)?r:n;return Ek(e.parts,{...t,execution:{...t.execution,startedAt:i}})}))return;let r=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId,e.messageId);this.port.replaceStreamingMessage({...r,parts:Ek(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=dk(e.execution,n?t:void 0);if(this.port.updateMessageContainingToolCall(e.toolCallId,(t,i)=>i.state===`cancelled`||!n&&Ok(i)?t.parts:Ek(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:pk(i.execution,r)}:{}})))return;let i=this.resolveToolCallTargetMessage(e.sessionId,e.toolCallId);this.port.replaceStreamingMessage({...i,parts:Ek(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=Tk(i.parts,t)??`unknown`;this.port.replaceStreamingMessage({...i,parts:Ek(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`)}},Ak=`assistant`,jk=class{messages=[];streamingMessage=null;streamingMessageIndex=null;error=null;activeRun=null;contextWindow=null;listeners=new Set;runExecution=new ck;toolCalls;lastSettledRunId=null;snapshotCache=null;snapshotVersion=-1;stateVersion=0;constructor(){this.toolCalls=new kk({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,sk(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=Sk(this.messages,this.streamingMessage,e);n!==t&&(this.messages=n,this.streamingMessageIndex!==null&&(this.streamingMessageIndex=bk(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=>uk(this,e)),this.stateVersion!==t&&this.notifyListeners()};handleMessageSent=e=>{this.upsertMessage(e.message),this.setError(null)};handleMessageCompleted=e=>{let t=this.runExecution.attach(sk({...e.message,status:`final`}),this.runExecution.take(this.activeRun?.runId));this.streamingMessage?.id===t.id&&this.toolCalls.clearByMessageId(t.id),this.upsertMessage(t)};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}=Dk(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.settleRunMessage(`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.settleRunMessage(`final`,hk({...e,endedAt:e.endedAt??t}),e.runId??this.activeRun?.runId,e.messageId),this.setError(null),this.clearActiveRun()};handleRunError=(e,t)=>{this.markRunAsSettled(e.runId??this.activeRun?.runId??null),this.settleRunMessage(`error`,hk({...e,endedAt:e.endedAt??t}),e.runId??this.activeRun?.runId,e.messageId),this.setError(mk(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.settleRunMessage(`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=ok(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&&Ck(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:Ak,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=wk(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=wk(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=xk(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?sk(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};settleRunMessage=(e,t,n,r)=>{let i=this.runExecution.take(n),a=gk(this.messages,this.streamingMessage,r);if(!a)return;let o=this.runExecution.attach(_k(a,e,t),i);this.upsertMessage(o),this.toolCalls.clearByMessageId(o.id)};notifyListeners=()=>{let e=this.getSnapshot();for(let t of this.listeners)t(e)}},Mk=16,Nk={code:`abort-error`,message:`User stopped the current run.`,details:{source:`chat-ui`}},Pk=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()},Mk))},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 Fk(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 Ik(e){return e.parts.some(e=>e.type===`text`||e.type===`rich-text`||e.type===`reasoning`?e.text.trim().length>0:!0)}function Lk(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(!Ik(e.message))return null;let n=e.sessionId||e.message.sessionId||t;return{...e,...n?{sessionId:n}:{},message:{...e.message,...n?{sessionId:n}:{}}}}function Rk(e,t){return{...e.message,sessionId:t}}function zk(e,t,n){let r=[...e];return r.splice(Math.min(Math.max(n,0),r.length),0,t),r}function Bk(e){let t=(0,G.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 jk}):t.current={sessionId:e??null,manager:new jk},t.current.manager}function Vk({sessionId:e,client:t,manager:n}){let r=(0,G.useRef)(e),i=(0,G.useSyncExternalStore)(e=>n.subscribe(()=>e()),()=>n.getSnapshot(),()=>n.getSnapshot()),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{r.current=e},[e]),(0,G.useEffect)(()=>{let e=new Pk(n.dispatchBatch),i=t.subscribe(t=>{Fk(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=zk(i.messages,i.streamingMessage,e)}let u=s&&(!e||s.sessionId===e)&&!i.messages.some(e=>e.id===s.id)?yk(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:X.MessageSent,payload:{sessionId:e.sessionId,message:t}}]:[],{type:X.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=Lk(r,e);if(!i)return null;n.clearError(),o(e);let a=i.sessionId?Rk(i,i.sessionId):null,s=async()=>{c(null),a&&await n.dispatch({type:X.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,Rk(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:Nk})},streamRun:async()=>{e&&(await t.stop(),await t.stream({sessionId:e}))}}}var Hk=500,Uk=1e4,Wk=3;function Gk(e){return e instanceof Error?e:Error(String(e))}function Kk(e,t){let n=e.getSnapshot();return n.activeRun?.sessionId===t||n.streamingMessage?.sessionId===t||n.messages.some(e=>e.sessionId===t)}function qk(){return new Promise(e=>window.setTimeout(e,Hk))}function Jk(e,t,n){let r=e.consecutiveFailures+1;return n(!e.hasHydrated||r>=Wk?Gk(t):null),{...e,consecutiveFailures:r}}function Yk(e,t,n){return t.stable?(n(null),{...e,consecutiveFailures:0}):Jk(e,t.error,n)}function Xk(e){return[...e.messages,...e.streamingMessage?[e.streamingMessage]:[]]}function Zk(e){let{current:t,messages:n,activeRun:r}=e,i=Xk(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 Qk(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?$k(o,s):o.messages,u=c?s.activeRun:o.status===`running`?{runId:null,sessionId:i,abortDisabledReason:null}:null;Zk({current:s,messages:l,activeRun:u})||n.hydrate({sessionId:i,messages:l,activeRun:u})}function $k(e,t){let n=Xk(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 eA(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>=Uk}}async function tA(e,t,n){t.reset(),n(null),await e.stop()}function nA({sessionId:e,client:t,loadSeed:n}){let r=Bk(e),i=Vk({sessionId:e,client:t,manager:r}),[a,o]=(0,G.useState)({sessionId:null,error:null});(0,G.useEffect)(()=>{let i=new AbortController,{signal:a}=i,s=t=>{o({sessionId:e??null,error:t})};return(async()=>{if(!e){await tA(t,r,s);return}let i=!Kk(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 Qk({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=Jk(c,e,s),await qk();continue}let o=Promise.resolve(),l=await eA({client:t,sessionId:e,signal:a,onOpen:()=>{o=Qk({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=Jk(c,e,s))})}});if(await o,!l)return;c=Yk(c,l,s),i=!0,await qk()}})().catch(e=>{a.aborted||s(Gk(e))}),()=>{i.abort()}},[t,n,r,e]);let s=(0,G.useCallback)(e=>r.prependHistory(e),[r]),c=(0,G.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 rA=200*1024*1024,iA=`application/octet-stream`;function aA(e){let t=e.type.trim().toLowerCase();return t.length>0?t:iA}function oA(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=aA(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 sA(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 cA(e,t){let n=[],r=[];for(let i of e){let e=oA(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:aA(e),sizeBytes:e.size,reason:`read-failed`}))),{attachments:[],rejected:r}}}function lA(e){return typeof e==`string`?e:e instanceof URL?e.toString():e.url}function uA(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 dA(e,t){let n=Error(e);return t!==void 0&&(n.cause=t),n}function fA(){return async(e,t)=>{try{return await fetch(e,{credentials:`include`,...t})}catch(n){throw rt.reportTransportFailure(uA(n)),dA(`NCP fetch failed for ${(t?.method||`GET`).toUpperCase()} ${lA(e)}: ${uA(n)}`,n)}}}function pA(e){return e instanceof Error&&e.message.includes(`ncp session not found:`)}function mA(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}async function hA(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 gA(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 hA(i.promise,r);if(r.throwIfAborted(),!a?.responseOk||!mA(a.payload))return null;let{payload:o}=a;if(o.ok!==!0||!mA(o.data))return null;let{data:s}=o;return s.sessionId!==n||!Array.isArray(s.messages)||!mA(s.pageInfo)?null:s}async function _A(e,t,n=20,r=`compact`){t.throwIfAborted();try{let i=(r===`compact`?await gA({sessionId:e,messageLimit:n,signal:t}):null)??await ye(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(),!pA(e))throw e;return{messages:[],status:`idle`,total:0,deferredToolPayloads:{},pageInfo:{startCursor:null,hasPreviousPage:!1}}}}function vA(e){let{hydrationRetryVersion:t,messageLimit:n,onSeedLoaded:r}=e,i=(0,G.useRef)(new Set);return(0,G.useCallback)(async(e,t)=>{let a=await _A(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 yA={sessionId:null,contextWindow:null,total:0,cursor:null,hasPreviousPage:!1,isLoading:!1,error:null,deferredToolPayloads:{},messageDetails:{},messageDetailStates:{}};function bA(e){let{historyStateRef:t,sessionId:n,updateHistoryState:r}=e,i=(0,G.useRef)(new Map);return(0,G.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,G.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 he(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 xA(e){let{hydrationRetryVersion:t,messageLimit:n,sessionId:r}=e,[i,a]=(0,G.useState)(yA),o=(0,G.useRef)(yA),s=(0,G.useRef)(null),c=(0,G.useCallback)((e,t)=>{let n=t(o.current.sessionId===e?o.current:{...yA,sessionId:e});o.current=n,a(n)},[]);(0,G.useEffect)(()=>(s.current?.abort(),s.current=null,()=>{s.current?.abort()}),[r]);let l=bA({historyStateRef:o,sessionId:r,updateHistoryState:c});return{loadSeed:vA({hydrationRetryVersion:t,messageLimit:n,onSeedLoaded:(0,G.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,G.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 ye(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:yA}}var SA=`ncp agent unavailable during startup`,CA=15e3,wA=7e4;function TA(e){return e?.trim().toLowerCase().includes(SA)??!1}function EA(){return new ak({baseUrl:kt,basePath:`/api/ncp/agent`,fetchImpl:fA(),streamOpenTimeoutMs:CA,streamIdleTimeoutMs:wA})}function DA(e,t){let n=(0,G.useRef)(null),r=(0,G.useCallback)(e=>{if(!e){n.current=null;return}n.current!==e&&(n.current=e,t())},[t]);(0,G.useEffect)(()=>{r(e)},[e,r])}function OA(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 kA(e,t={}){let[n]=(0,G.useState)(()=>EA()),r=Et(),[i,a]=(0,G.useState)(0),[o,s]=(0,G.useState)(null),c=(0,G.useRef)(null),{loadSeed:l,loadMessageDetails:u,loadPreviousMessages:d,state:f}=xA({sessionId:e,messageLimit:t.messageLimit??20,hydrationRetryVersion:i}),p=nA({sessionId:e,client:n,loadSeed:l}),{acceptRun:m}=p,h=(0,G.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,G.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 L.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,G.useCallback)(async e=>await h(e.sessionId,()=>L.agentRuns.continue(e)),[h]),v=(0,G.useCallback)(async()=>await d(p.prependHistory),[p.prependHistory,d]),y=p.hydrateError?.message??p.snapshot.error?.message??null;DA(e&&r.phase===`ready`&&TA(y)?`${e}:${r.lastReadyAt??0}`:null,()=>{a(e=>e+1)});let b=(0,G.useMemo)(()=>OA(p.visibleMessages,f.messageDetails),[p.visibleMessages,f.messageDetails]);return(0,G.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 AA(e){return e.bootstrapStatus?.ncpAgent.state!==`ready`}function jA(e){return e.activeSystemAction?.message?.trim()||(e.lifecyclePhase===`cold-starting`?U(`chatRuntimeInitializing`):e.lifecyclePhase===`startup-failed`?e.bootstrapStatus?.ncpAgent.error?.trim()||e.bootstrapStatus?.lastError?.trim()||e.lastError?.trim()||U(`chatRuntimeInitializationFailed`):null)}function MA(e){let{message:t,status:n}=e,r=t?.trim();if(!r)return jA(n);let i=n.activeSystemAction?.message?.trim();if(n.phase===`service-transitioning`&&i)return i;let a=Ee(r);return n.phase===`recovering`&&a?U(`runtimeControlRecoveringHelp`):n.phase===`stalled`&&a?null:r}function NA(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 PA(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:U(`chatContextWindowUsed`),value:NA(e.usedContextTokens)}];return e.triggerContextTokens!==void 0&&o.push({label:U(`chatContextWindowTrigger`),value:NA(e.triggerContextTokens)}),o.push(e.availableBeforeCompactionTokens===void 0?{label:U(`chatContextWindowAvailable`),value:NA(e.availableContextTokens)}:{label:U(`chatContextWindowAvailableBeforeCompaction`),value:NA(e.availableBeforeCompactionTokens)}),e.fixedInputTokens!==void 0&&o.push({label:U(`chatContextWindowFixed`),value:NA(e.fixedInputTokens),dividerBefore:!0}),e.dynamicInputTokens!==void 0&&o.push({label:U(`chatContextWindowDynamic`),value:NA(e.dynamicInputTokens)}),e.reservedContextTokens!==void 0&&o.push({label:U(`chatContextWindowReserve`),value:NA(e.reservedContextTokens)}),o.push({label:U(`chatContextWindowTotal`),value:NA(e.totalContextTokens)}),e.prunedUsedContextTokens!==e.usedContextTokens&&o.push({label:U(`chatContextWindowPruned`),value:NA(e.prunedUsedContextTokens)}),e.droppedHistoryCount>0&&o.push({label:U(`chatContextWindowDroppedHistory`),value:String(e.droppedHistoryCount)}),e.truncatedToolResultCount>0&&o.push({label:U(`chatContextWindowTruncatedTools`),value:String(e.truncatedToolResultCount)}),{label:U(`chatContextWindow`),percentLabel:i,ratio:r,tone:a,details:o}}var FA=da(`18rem`);function IA({agents:e,selectedAgent:t,selectedAgentId:n,onSelectAgent:r}){return(0,K.jsxs)(pa,{value:n,onValueChange:r,children:[(0,K.jsxs)(la,{"aria-label":U(`chatDraftAgentTitle`),className:`h-9 w-auto min-w-0 gap-1.5 rounded-lg border-0 bg-transparent px-2 py-1.5 text-sm font-medium text-foreground/80 shadow-none hover:bg-[var(--interaction-hover)] hover:text-foreground focus:ring-1 focus:ring-border`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:U(`chatDraftAgentTitle`)}),(0,K.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(wd,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,K.jsx)(`span`,{className:`max-w-28 truncate text-sm font-medium`,children:t.displayName?.trim()||t.id})]}):null})]}),(0,K.jsx)(ua,{style:{maxHeight:FA},children:e.map(e=>(0,K.jsx)(fa,{value:e.id,className:`rounded-lg pr-10`,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(wd,{agentId:e.id,displayName:e.displayName,avatarUrl:e.avatarUrl,className:`h-5 w-5 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.displayName?.trim()||e.id})]})},e.id))})]})}var LA=[{labelKey:`chatWelcomeOpenStartLabel`,promptKey:`chatWelcomeOpenStartPrompt`},{labelKey:`chatWelcomeSuggestion2Label`,promptKey:`chatWelcomeSuggestion2Prompt`},{labelKey:`chatWelcomeSuggestion3Label`,promptKey:`chatWelcomeSuggestion3Prompt`}];function RA({onSelectPrompt:e,hasDraftContent:t=!1,hasProject:n=!1,continuation:r}){let[i,a]=(0,G.useState)(null),o=r&&r.sessionKey!==i;return(0,K.jsxs)(`div`,{className:`mt-3 min-h-32 ${t?`invisible`:``}`,"aria-hidden":t||void 0,children:[(0,K.jsx)(`div`,{className:`flex flex-wrap justify-center gap-x-2 gap-y-1`,children:LA.map((t,r)=>{let i=r===2&&n;return(0,K.jsx)(`button`,{type:`button`,onClick:()=>e(U(i?`chatWelcomeSuggestion1Prompt`:t.promptKey)),className:`rounded-lg bg-muted/70 px-3 py-1.5 text-[13px] font-normal leading-5 text-foreground/80 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:U(i?`chatWelcomeSuggestion1Label`:t.labelKey)},t.labelKey)})}),r?(0,K.jsxs)(`div`,{className:`mx-auto mt-5 flex min-w-0 max-w-lg items-center gap-1 border-t border-border/50 pt-3 ${o?``:`invisible`}`,"aria-hidden":!o||void 0,children:[(0,K.jsxs)(gn,{to:Vs(r.sessionKey),title:U(`chatWelcomeContinueHint`),className:`flex min-w-0 flex-1 items-center gap-3 rounded-lg px-2 py-2 transition-colors hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,K.jsx)(No,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:U(`chatWelcomeContinueLabel`)}),(0,K.jsx)(`span`,{className:`mt-1 block truncate text-sm text-foreground`,children:r.title})]}),(0,K.jsx)(Er,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-muted-foreground`})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":U(`chatWelcomeDismissContinue`),title:U(`chatWelcomeDismissContinue`),onClick:()=>a(r.sessionKey),className:`mr-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,K.jsx)(Vr,{"aria-hidden":`true`,className:`h-3.5 w-3.5`})})]}):null]})}var zA=di(`20rem`);function BA({isSaving:e,projectOptions:t,projectRoot:n,selectable:r,onOpenProjectDialog:i,onSelectProjectRoot:a}){let[o,s]=(0,G.useState)(!1),c=Fc(n)??U(`chatWelcomeProjectPickerPlaceholder`),l=async e=>{s(!1),await a(e)};return(0,K.jsxs)(_i,{open:o,onOpenChange:s,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`inline-flex h-9 min-w-0 max-w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-sm font-medium text-foreground/80 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,title:n??void 0,"aria-label":U(`chatWelcomeProjectPickerLabel`),disabled:!r||e,children:[(0,K.jsx)(Co,{className:`h-4 w-4 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:c}),(0,K.jsx)(Mr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,K.jsxs)(hi,{align:`start`,className:`flex w-[min(20rem,calc(100vw-1rem))] flex-col overflow-hidden p-0`,style:{maxHeight:zA},children:[(0,K.jsx)(`div`,{className:`shrink-0 px-3 pb-2 pt-3 text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground`,children:U(`chatWelcomeProjectRecentTitle`)}),(0,K.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,K.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,K.jsx)(Co,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`truncate text-[13px] font-semibold text-foreground`,children:e.projectName}),e.isDefault?(0,K.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground`,children:U(`chatWelcomeProjectDefaultBadge`)}):null]}),(0,K.jsx)(`span`,{className:`block truncate text-[11px] leading-4 text-muted-foreground`,children:e.projectRoot})]}),e.sessionCount>0?(0,K.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,K.jsx)(`div`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:U(`chatWelcomeProjectNoRecent`)})}),(0,K.jsx)(`div`,{className:`shrink-0 border-t border-border p-1.5`,children:(0,K.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,K.jsx)(Co,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,K.jsx)(`span`,{children:U(`chatWelcomeProjectOpenFolder`)})]})})]})]})}function VA(e){let{disabled:t=!1,option:n,onSelect:r,selected:i=!1}=e,a=n.ready===!1?n.reasonMessage?.trim()||U(`statusSetup`):null;return(0,K.jsx)(`button`,{type:`button`,"aria-pressed":i,disabled:t,onClick:r,className:V(`w-full rounded-2xl px-3 py-2.5 text-left transition-colors`,i?`bg-[var(--interaction-selection)]`:`hover:bg-[var(--interaction-hover)]`,t?`cursor-not-allowed opacity-70`:null),children:(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-2.5`,children:[n.icon?.src?(0,K.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5`,children:(0,K.jsx)(lu,{icon:{kind:`runtime-image`,src:n.icon.src,alt:n.icon.alt??null,name:n.label}})}):(0,K.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center pt-0.5 text-muted-foreground`,children:(0,K.jsx)(Dr,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`div`,{className:`truncate text-[13px] font-semibold text-gray-900`,children:n.label}),(0,K.jsx)(Ai,{status:n.ready===!1?`warning`:`ready`,label:n.ready===!1?U(`statusSetup`):U(`statusReady`),className:`bg-transparent px-0`})]}),a?(0,K.jsx)(`div`,{className:`mt-1 pr-4 text-[11px] leading-4 text-gray-500`,children:a}):null]})]}),i?(0,K.jsx)(jr,{className:`mt-1 h-3.5 w-3.5 shrink-0 text-primary`}):null]})})}var HA=di(`18rem`);function UA({options:e,selectedSessionType:t,onSelectSessionType:n}){let[r,i]=(0,G.useState)(!1),a=e.find(e=>e.value===t)??e[0]??null;return a?(0,K.jsxs)(_i,{open:r,onOpenChange:i,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`inline-flex h-9 min-w-0 max-w-full items-center gap-1.5 rounded-lg px-2 py-1.5 text-left text-sm font-medium text-foreground/80 transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-label":U(`chatWelcomeSessionTypePickerLabel`),children:[a.icon?.src?(0,K.jsx)(lu,{icon:{kind:`runtime-image`,src:a.icon.src,alt:a.icon.alt??null,name:a.label},className:`h-4 w-4`}):(0,K.jsx)(yo,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:a.label}),(0,K.jsx)(Mr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/70`})]})}),(0,K.jsx)(hi,{align:`start`,className:`flex w-[min(16rem,calc(100vw-1rem))] flex-col overflow-hidden p-1.5`,style:{maxHeight:HA},children:(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:e.map(e=>(0,K.jsx)(VA,{option:e,onSelect:()=>{n(e.value),i(!1)}},e.value))})})]}):null}function WA({agents:e,defaultProjectRoot:t,inputSlot:n,hasDraftContent:r=!1,continuation:i,projectOptions:a,selectedAgentId:o,selectedProjectRoot:s,selectedSessionType:c,sessionTypeOptions:l,onSelectAgent:u,onSelectPrompt:d,onSelectProjectRoot:f,onSelectSessionType:p}){let m=e.find(e=>e.id===o)??null,[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(!1),y=s??t??null,b=async e=>{if(f){v(!0);try{await f(e),g(!1)}finally{v(!1)}}},x=!!f;return(0,K.jsxs)(`div`,{className:`flex min-h-full items-center justify-center px-4 py-10 sm:p-8`,children:[(0,K.jsxs)(`div`,{className:`w-full min-w-0 max-w-[min(680px,100%)]`,children:[(0,K.jsx)(`div`,{className:`text-center`,children:(0,K.jsx)(`h2`,{className:`text-2xl font-[number:var(--welcome-title-weight)] leading-tight text-[hsl(var(--welcome-title-foreground))] sm:text-[1.75rem]`,children:U(`chatWelcomeTitle`)})}),n?(0,K.jsx)(`div`,{className:`mt-6`,children:n}):null,(0,K.jsx)(`div`,{className:`mt-1.5 flex justify-center px-1`,children:(0,K.jsxs)(`div`,{role:`group`,"aria-label":U(`chatWelcomeContextLabel`),className:`flex min-w-0 max-w-full flex-wrap items-center justify-center gap-x-1 gap-y-0.5 text-xs text-muted-foreground`,children:[f?(0,K.jsx)(BA,{isSaving:_,projectOptions:a,projectRoot:y,selectable:x,onOpenProjectDialog:()=>g(!0),onSelectProjectRoot:b}):null,(0,K.jsx)(IA,{agents:e,selectedAgent:m,selectedAgentId:o,onSelectAgent:u}),(0,K.jsx)(UA,{options:l,selectedSessionType:c,onSelectSessionType:p})]})}),(0,K.jsx)(RA,{hasDraftContent:r,hasProject:!!s,continuation:i,onSelectPrompt:d})]}),f?(0,K.jsx)(gc,{open:h,currentProjectRoot:y,defaultWorkspacePath:t,isSaving:_,onOpenChange:g,onSave:b}):null]})}function GA(e){let{agents:t,fallbackAgentId:n}=e;return(t?.length??0)>0?t??[]:[{id:n}]}function KA(e){return e.agents.find(t=>t.id===e.agentId)??null}function qA(e,t){if(typeof e!=`string`||e.trim().length===0)return null;let n=ql(e);return t.some(e=>e.value===n)?n:null}function JA(e){let{agentId:t,agents:n,defaultSessionType:r,pendingSessionType:i,selectedSessionType:a,sessionTypeOptions:o}=e;return(qA(a,o)??qA(i,o))||((n&&t?qA(Jl(KA({agents:n,agentId:t}),r),o):null)??qA(r,o)??o[0]?.value??ql(r))}function YA(e){return new Date(e.lastMessageAt??e.createdAt).getTime()}function XA(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 ml([...r])){let n=e.projectRoot?.trim();if(!n||n===t)continue;let r=i.get(n),a=YA(e);if(r){r.sessionCount+=1,r.latestUpdatedAt=Math.max(r.latestUpdatedAt,a);continue}i.set(n,{projectRoot:n,projectName:e.projectName?.trim()||Fc(n)||n,sessionCount:1,isDefault:!1,latestUpdatedAt:a})}return t&&i.set(t,{projectRoot:t,projectName:Fc(t)||t,sessionCount:0,isDefault:!0,latestUpdatedAt:1/0}),[...i.values()].sort((e,t)=>t.latestUpdatedAt-e.latestUpdatedAt).map(({latestUpdatedAt:e,...t})=>t)}function ZA(e){let t=ml([...e.sessions]).filter(t=>!t.isChildSession&&t.messageCount>0&&t.label?.trim()&&(t.agentId??`main`)===e.agentId&&(t.projectRoot??t.workingDir??e.defaultProjectRoot)===e.projectRoot),n=e=>Date.parse(e.lastMessageAt??e.updatedAt)||0,r=t.sort((e,t)=>n(t)-n(e))[0];return r?{sessionKey:r.key,title:r.label.trim()}:null}var QA=[];function $A({inputSlot:e,hasDraftContent:t=!1,pendingProjectRoot:n,pendingSessionType:r,selectedSessionTypeValue:i,onSelectProjectRoot:a,onSelectPrompt:o,onSelectSessionType:s}){let c=q(),l=J(e=>e.snapshot.selectedAgentId),u=Y(e=>e.snapshot),d=_u(e=>e.snapshot.configQuery?.data??null),f=_u(e=>e.snapshot.sessionsQuery?.isSuccess?e.snapshot.sessionsQuery.data?.sessions??QA:QA),p=_u(e=>e.snapshot.sessionTypesQuery?.data??null),m=Td(),h=yu(),g=u.agentId??l,_=GA({agents:m.data?.agents,fallbackAgentId:g}),v=Pc(d?.agents.defaults.workspace),y=Pc(n),b=Xl(p?.options??[]),x=ql(p?.defaultType??`native`),S=JA({defaultSessionType:x,pendingSessionType:r,selectedSessionType:i,sessionTypeOptions:b}),C=XA({defaultProjectRoot:v,projects:h.data?.projects??[],sessionSummaries:f});return(0,K.jsx)(WA,{agents:_,defaultProjectRoot:v,inputSlot:e,hasDraftContent:t,continuation:ZA({sessions:f,projectRoot:y??v,defaultProjectRoot:v,agentId:g}),projectOptions:C,selectedAgentId:g,selectedProjectRoot:y,selectedSessionType:S,sessionTypeOptions:b,onSelectAgent:e=>{c.chatSessionListManager.setSelectedAgentId(e),s(JA({agents:_,agentId:e,defaultSessionType:x,pendingSessionType:null,selectedSessionType:null,sessionTypeOptions:b}))},onSelectPrompt:o,onSelectProjectRoot:a,onSelectSessionType:s})}function ej(e){return e.modelOptions.length>0}function tj(e){return!e.isProviderStateResolved&&!ej(e)}function nj(e){return e.isProviderStateResolved&&!ej(e)}function rj(e){return!1}function ij(e){return!e.hasSendableDraft}function aj(e){return{...e.metadata,...e.message.metadata}}function oj(e){let t=R_(aj(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 sj(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?Ne(r):void 0}function cj(e){return{attachments:e.message.parts.flatMap((e,t)=>{if(e.type!==`file`)return[];let n=e.mimeType??`application/octet-stream`,r=sj(e);return[{mimeType:n,name:e.name?.trim()||`attachment-${t+1}`,...r?{previewUrl:r}:{}}]}),preview:oj(e)}}function lj(e,t){return vO({attachmentIdPrefix:`queued-attachment-${e.id}`,availableSkills:t,message:e.message,metadata:aj(e)})}function uj(e){return e instanceof ht&&e.status===404&&e.code===`NOT_FOUND`}function dj(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=cj(n);return{attachments:r.attachments,id:n.id,preview:r.preview,sessionId:t,userMessageId:n.message.id}}function fj(e,t){let[n,r]=(0,G.useState)(null),i=(0,G.useCallback)(e=>{let t=dj(e);return t&&r(t),t},[]);return{clearSubmittingInput:(0,G.useCallback)(e=>{r(t=>t?.userMessageId===e.userMessageId?null:t)},[]),queuedInputs:(0,G.useMemo)(()=>{let r=e.map(e=>({...cj(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 pj(e){let{availableSkills:t,hasComposerContent:n,restoreComposer:r,runQueue:i,setSendError:a}=e,o=(0,G.useCallback)(e=>{if(n){a(U(`chatQueuedEditComposerNotEmpty`));return}i.inputs.some(t=>t.id===e)&&i.removeQueuedInput(e).then(e=>{e&&(r(lj(e,t)),a(null))}).catch(e=>{a(e instanceof Error?e.message:String(e))})},[t,n,r,i,a]);return{deleteQueuedInput:(0,G.useCallback)(e=>{i.removeQueuedInput(e).then(()=>a(null)).catch(e=>{a(e instanceof Error?e.message:String(e))})},[i,a]),editQueuedInput:o,steerQueuedInput:(0,G.useCallback)(e=>{i.steerQueuedInput(e).then(e=>{e&&a(null)}).catch(async e=>{if(uj(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 mj({agent:e,sessionKey:t,setSendError:n}){return{continueRun:(0,G.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,G.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])}}async function hj(e){let t=e.envelope.sessionId?.trim();if(!t)return!1;try{return(await ye(t,{limit:100})).messages.some(t=>t.id===e.envelope.message.id)}catch{return!1}}function gj(e){let{agent:t,submission:n,sessionKey:r,onSessionMaterialized:i,acceptSubmission:a,failSubmission:o,restoreSubmission:s,discardSubmission:c,setSendError:l}=e,u=(0,G.useCallback)(async()=>{if(!n||n.status!==`uncertain`)return;let{envelope:e}=n;if(await hj(n)){a(e.message.id),!r&&e.sessionId&&i?.(e.sessionId);return}if(!e.sessionId){l(U(`chatSendResultUnknownChild`));return}try{let n=await t.send(e);if(!n)throw Error(U(`chatSendFailed`));a(e.message.id),r||i?.(n.sessionId)}catch(t){let n=t instanceof Error?t.message:String(t);o(e.message.id,t instanceof ik&&t.sendRejected?`rejected`:`uncertain`,n)}},[a,t,o,i,r,l,n]),d=(0,G.useRef)(null);return(0,G.useEffect)(()=>{!n||n.status!==`uncertain`||d.current===n.envelope.message.id||(d.current=n.envelope.message.id,hj(n).then(e=>{e&&(a(n.envelope.message.id),!r&&n.envelope.sessionId&&i?.(n.envelope.sessionId))}))},[a,i,r,n]),{retryPendingSubmission:u,restorePendingSubmission:()=>{n&&s(n.envelope.message.id)},discardPendingSubmission:()=>{n?.status===`rejected`&&c(n.envelope.message.id)}}}var _j=e=>e.some(e=>e.type!==`text`||e.text.trim().length>0),vj=e=>e?.trim()||void 0;function yj(e){let{agentIsSending:t,composerSnapshot:n,inputQuery:r,inputSnapshot:i,materializationContext:a,selectedAgentId:o,sessionKey:s}=e,c=n??{text:i.text,nodes:[...i.nodes],selectedSkills:[...i.selectedSkills],skillRecords:[...i.skillRecords],attachments:[...i.attachments]},l=dO([...c.nodes],c.attachments);return i.pendingSubmission||ij({hasSendableDraft:_j(l)})||t?null:{composerSnapshot:c,metadata:pO({agentId:a?void 0:r.selectedSession?.agentId?.trim()||o,model:vj(a?i.selectedModel:i.selectedModel??r.fallbackPreferredModel??r.defaultModel),thinkingLevel:a?i.selectedThinkingLevel??void 0:i.selectedThinkingLevel??r.fallbackPreferredThinking??void 0,sessionType:a?void 0:r.sessionTypeState.selectedSessionType,projectRoot:a?i.pendingProjectRoot:s?r.selectedSession?.projectRoot??null:i.pendingProjectRoot,skillRecords:r.skillRecords.filter(e=>c.selectedSkills.includes(e.ref)),composerNodes:[...c.nodes],sessionMaterialization:a?{kind:a.kind,parentSessionId:a.parentSessionKey,inheritContext:a.inheritContext}:null})}}function bj(e,t,n=`queue`){let r=crypto.getRandomValues(new Uint8Array(16)),i=`user-${Array.from(r,e=>e.toString(16).padStart(2,`0`)).join(``)}`,a=sA({sessionId:t??void 0,messageId:i,text:e.composerSnapshot.text.trim(),attachments:[...e.composerSnapshot.attachments],parts:dO([...e.composerSnapshot.nodes],e.composerSnapshot.attachments),metadata:e.metadata});return a?{...a,delivery:n,idempotencyKey:a.message.id}:null}function xj(e){let{agent:t,clearSubmittingInput:n,materializationContext:r,onSessionMaterialized:i,beginSubmission:a,acceptSubmission:o,failSubmission:s,runQueue:c,sessionKey:l,setSendError:u,stageSubmittingInput:d}=e;return(0,G.useCallback)(async(e,f,p=`queue`)=>{let m=bj(e,l??(r?null:hl()),p);if(!m)return;let h=t.isRunning&&p===`queue`?d(m):null;f===`reset-and-restore`&&a(m,e.composerSnapshot),u(null);let g=!1;try{let e=await t.send(m);if(!e)throw g=!0,Error(U(`chatSendFailed`));f===`reset-and-restore`&&o(m.message.id),e?.delivery===`steered`?await c.refreshPendingInputs().catch(()=>void 0):e?.delivery===`queued`&&await c.refreshQueuedInputs().catch(()=>void 0),h&&n(h);let r=e?.sessionId?.trim()||t.snapshot.activeRun?.sessionId?.trim()||null;!l&&r&&i?.(r)}catch(e){h&&n(h);let t=e instanceof Error?e.message:String(e);throw f===`reset-and-restore`?s(m.message.id,g||e instanceof ik&&e.sendRejected?`rejected`:`uncertain`,t):u(t),e}},[t,n,r,i,a,o,s,c,l,u,d])}function Sj(e){let{agent:t,inputQuery:n,inputSnapshot:r,materializationContext:i,selectedAgentId:a,sessionKey:o,submitDraft:s}=e;return(0,G.useCallback)(async()=>{let e=yj({agentIsSending:t.isSending,inputSnapshot:r,inputQuery:n,materializationContext:i,selectedAgentId:a,sessionKey:o});e&&await s(e,`reset-and-restore`,`prefer-steer`)},[t.isSending,n,r,i,a,o,s])}function Cj(e){let{agent:t,continueRun:n,inputQuery:r,inputSnapshot:i,materializationContext:a,primaryAction:o,selectedAgentId:s,sessionKey:c,submitDraft:l}=e;return(0,G.useCallback)(async()=>{if(o===`continue`)return await n();let e=yj({agentIsSending:t.isSending,inputSnapshot:i,inputQuery:r,materializationContext:a,selectedAgentId:s,sessionKey:c});e&&await l(e,`reset-and-restore`)},[t.isSending,n,r,i,a,o,s,c,l])}function wj(e){let{agent:t,inputSnapshot:n,inputQuery:r,materializationContext:i,selectedAgentId:a,sessionKey:o,submitDraft:s}=e;return(0,G.useCallback)(async e=>{let c=e.trim();if(!c)return;let l=yj({agentIsSending:t.isSending,composerSnapshot:{text:c,nodes:aO(c),selectedSkills:[],skillRecords:[],attachments:[]},inputSnapshot:n,inputQuery:r,materializationContext:i,selectedAgentId:a,sessionKey:o});l&&await s(l,`preserve`)},[t.isSending,r,n,i,a,o,s])}function Tj(e){let{agent:t,inputSnapshot:n,inputQuery:r,isRuntimeBlocked:i,materializationContext:a,runQueue:o,selectedAgentId:s,sessionKey:c,onSessionMaterialized:l,restoreComposer:u,beginSubmission:d,acceptSubmission:f,failSubmission:p,restoreSubmission:m,discardSubmission:h,setSendError:g}=e,{clearSubmittingInput:_,queuedInputs:v,stageSubmittingInput:y}=fj(o.inputs,c),b=_j((0,G.useMemo)(()=>dO([...n.nodes],n.attachments),[n.attachments,n.nodes])),{deleteQueuedInput:x,editQueuedInput:S,steerQueuedInput:C}=pj({availableSkills:r.skillRecords,hasComposerContent:b,restoreComposer:u,runQueue:o,setSendError:g}),w=t.isSending||t.isRunning,T=r.selectedSession?.activityPreview?.state,E=!!(c&&!w&&!i&&(T===`cancelled`||T===`failed`)),D=E&&!b?`continue`:`send`,O=n.pendingSubmission?!0:D===`continue`?!1:ij({hasSendableDraft:b})||t.isSending,{continueRun:k,editMessage:A}=mj({agent:t,sessionKey:c,setSendError:g}),j=xj({agent:t,clearSubmittingInput:_,materializationContext:a,onSessionMaterialized:l,beginSubmission:d,acceptSubmission:f,failSubmission:p,runQueue:o,sessionKey:c,setSendError:g,stageSubmittingInput:y}),M=Cj({agent:t,continueRun:k,inputQuery:r,inputSnapshot:n,materializationContext:a,primaryAction:D,selectedAgentId:s,sessionKey:c,submitDraft:j}),N=Sj({agent:t,inputQuery:r,inputSnapshot:n,materializationContext:a,selectedAgentId:s,sessionKey:c,submitDraft:j}),P=wj({agent:t,inputSnapshot:n,inputQuery:r,materializationContext:a,selectedAgentId:s,sessionKey:c,submitDraft:j}),ee=(0,G.useCallback)(async()=>{await t.abort()},[t]),te=gj({agent:t,submission:n.pendingSubmission,sessionKey:c,onSessionMaterialized:l,acceptSubmission:f,failSubmission:p,restoreSubmission:m,discardSubmission:h,setSendError:g});return{canContinue:E,canStopGeneration:t.isRunning,continueRun:k,deleteQueuedInput:x,editMessage:A,editQueuedInput:S,canEditQueuedInput:!b,hasSendableDraft:b,isSending:w,queuedInputs:v,send:M,sendSteering:N,sendPresetMessage:P,...te,sendDisabled:O,primaryAction:D,stop:ee,stopDisabled:!t.isRunning,steerQueuedInput:C}}function Ej(e,t){return{value:je,modelLabel:e,providerLabel:``,isRuntimeDefault:!0,thinkingCapability:t??null}}function Dj(e){let t=new Set;return gi({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=vi(e.prefix,n);return!r||t.has(r)?null:(t.add(r),{value:r,modelLabel:n,providerLabel:e.displayName,thinkingCapability:bi(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 Oj(e){let{catalogView:t,config:n,providersView:r,templatesView:i}=e,a=t?.providers??{},o=new Set;return gi({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=pi(n,e.aliases),i=vi(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:bi(e.modelThinking,r,e.aliases)})}).filter(e=>e!==null)})}function kj(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 Aj(e){let{modelOptions:t,modelSelectionMode:n,runtimeDefaultThinkingCapability:r,runtimeDefaultModelLabel:i=`Runtime default`,supportedModels:a}=e,o=Ej(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 jj(e){return e?.trim().toLowerCase()||`native`}function Mj(e,t){if(typeof t!=`string`)return!1;let n=t.trim();return n?e.some(e=>e.value===n):!1}function Nj(e,t){return typeof t==`string`&&e.includes(t)}function Pj(e){return e.length===0?null:e.includes(`off`)?`off`:e[0]??null}function Fj(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 Ij(e){let{modelOptions:t,currentSelectedModel:n,selectedSessionPreferredModel:r,fallbackPreferredModel:i,defaultModel:a,preferSessionPreferredModel:o,preserveCurrentSelectedModelOnSessionChange:s}=e;return t.length===0?``:Fj({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>Mj(t,e),firstAvailableValue:t[0]?.value??``,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function Lj(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=fi(t);return Fj({currentValue:n,selectedSessionPreferredValue:r,fallbackPreferredValue:i,defaultValue:a,isValueSupported:e=>Nj(c,e),firstAvailableValue:Pj(c)??`off`,preferSessionPreferredValue:o,preserveCurrentValueOnSessionChange:s})}function Rj(e){let{sessions:t,selectedSessionKey:n,sessionType:r}=e,i=jj(r),a,o=-1/0;for(let e of t){if(e.key===n||jj(e.sessionType)!==i)continue;let t=e.preferredModel?.trim()||void 0,r=e.preferredThinking??void 0;if(t===void 0)continue;let s=Date.parse(e.updatedAt),c=Number.isFinite(s)?s:-1/0;(a===void 0||c>o)&&(a={model:t,...r?{thinking:r}:{}},o=c)}return a}function zj(e){let{selectedSession:t,pendingSessionType:n,setPendingSessionType:r,sessionTypesData:i}=e,a=(0,G.useMemo)(()=>Xl(i?.options??[]),[i?.options]),o=(0,G.useMemo)(()=>{let e=[...a],n=ql(t?.sessionType);return e.some(e=>e.value===n)||e.push({value:n,label:Yl(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,G.useMemo)(()=>ql(i?.defaultType??`native`),[i?.defaultType]),c=(0,G.useRef)(null),l=typeof n==`string`&&n.trim().length>0?n:void 0,u=(0,G.useMemo)(()=>ql(t?.sessionType??l??s),[s,l,t?.sessionType]),d=(0,G.useMemo)(()=>o.find(e=>e.value===u)??null,[u,o]);(0,G.useEffect)(()=>{if(t)return;let e=typeof n==`string`?n.trim():``,i=ql(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,G.useMemo)(()=>new Set(a.map(e=>e.value)),[a]),m=(0,G.useMemo)(()=>t&&!p.has(ql(t.sessionType))?!0:d?.ready===!1,[p,t,d?.ready]),h=(0,G.useMemo)(()=>t&&!p.has(ql(t.sessionType))?`${Yl(u)} ${U(`chatSessionTypeUnavailableSuffix`)}`:d?.ready===!1?d.reasonMessage?.trim()||`${d.label} setup required`:null,[p,t,u,d]);return(0,G.useMemo)(()=>({sessionTypeOptions:o,selectedSessionTypeOption:d,defaultSessionType:s,selectedSessionType:u,canEditSessionType:f,sessionTypeUnavailable:m,sessionTypeUnavailableMessage:h}),[f,s,u,d,o,m,h])}var Bj=`nextclaw.chat.recent-selection.store`;function Vj(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Hj(e,t){return Array.isArray(e)?Array.from(new Set(e.map(Vj).filter(e=>!!e))).slice(0,t):[]}function Uj(e,t){let n=Vj(t?.namespace);return n?`${e.storageKey}.${encodeURIComponent(n.toLowerCase())}`:e.storageKey}function Wj(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){let e=Vj(n);if(!e)continue;let i=Hj(r,1/0);i.length>0&&(t[e]=i)}return t}var Gj=ct()(xi(e=>({entriesByKey:{},setEntries:(t,n)=>e(e=>({entriesByKey:{...e.entriesByKey,[t]:Hj(n,1/0)}}))}),{name:Bj,storage:Si(()=>window.localStorage),partialize:e=>({entriesByKey:e.entriesByKey}),merge:(e,t)=>({...t,entriesByKey:Wj(e?.entriesByKey)})})),Kj=class{constructor(e){this.options=e,this.read=(e={})=>{let t=Uj(this.options,e);return Hj(Gj.getState().entriesByKey[t],this.options.limit)},this.remember=(e,t={})=>{let n=Vj(e);if(!n)return this.read(t);let r=Uj(this.options,t),i=[n,...this.read(t).filter(e=>e!==n)].slice(0,this.options.limit);return Gj.getState().setEntries(r,i),i},this.resolveVisible=e=>{let t=Hj(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}}},qj=new Kj({storageKey:`nextclaw.chat.recent-models`,limit:3}),Jj=`nextclaw.chat.provider-model-catalog-notices`,Yj=1,Xj={version:Yj,acknowledgedModelsByProvider:{}};function Zj(){return typeof window>`u`?null:window.localStorage}function Qj(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 $j=new class{constructor(){this.read=()=>{let e=Zj();if(!e)return Xj;try{let t=JSON.parse(e.getItem(Jj)??`null`);return t?.version===Yj&&t.acknowledgedModelsByProvider?{version:Yj,acknowledgedModelsByProvider:t.acknowledgedModelsByProvider}:Xj}catch{return Xj}},this.write=e=>{let t=Zj();if(!t)return!1;try{return t.setItem(Jj,JSON.stringify(e)),!0}catch{return!1}},this.initializeLargeCatalogs=e=>{let t={...this.read().acknowledgedModelsByProvider},n=!1;for(let[r,i]of Qj(e))i.length>50&&!Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=i,n=!0);return n&&this.write({version:Yj,acknowledgedModelsByProvider:t})},this.filterUnseen=e=>{let t=this.read().acknowledgedModelsByProvider,n=Qj(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 Qj(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:Yj,acknowledgedModelsByProvider:t})}}},eM=`__nextclaw-preview__`,tM=[{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 nM(e){return!e.enabled||new URLSearchParams(e.search).get(`preview`)!==`model-discovery`?[]:tM.flatMap(e=>e.models.map(t=>({value:`${eM}${e.providerId}/${t}`,providerId:`${eM}${e.providerId}`,providerModel:t,modelLabel:t,providerLabel:e.providerLabel,thinkingCapability:null})))}function rM(e){return e.providerId.startsWith(eM)}function iM(e){let{config:t,modelSelectionMode:n,providersView:r,supportedModels:i,templatesView:a}=e,o=ha(),{mutateAsync:s}=ya(),[c,l]=(0,G.useState)(0),[u,d]=(0,G.useState)(!1),f=(0,G.useMemo)(()=>nM({enabled:!1,search:typeof window>`u`?``:window.location.search}),[]),p=(0,G.useMemo)(()=>Oj({catalogView:o.data??null,config:t,providersView:r,templatesView:a}),[o.data,t,r,a]);(0,G.useEffect)(()=>{$j.initializeLargeCatalogs(p)},[p]);let m=(0,G.useMemo)(()=>f.length>0&&!u?f:kj({modelOptions:$j.filterUnseen(p),modelSelectionMode:n,supportedModels:i}),[p,n,c,u,f,i]);return{addDiscoveredModel:(0,G.useCallback)(async e=>{let t=m.find(t=>t.value===e);if(t&&rM(t))return t;let n=t?r?.providers[t.providerId]:void 0;return!t||!n?null:(await s({provider:t.providerId,data:{models:yi([...n.models??[],t.providerModel])},silentSuccess:!0}),$j.acknowledge([t]),l(e=>e+1),t)},[m,r,s]),dismissDiscoveredModels:(0,G.useCallback)(()=>{if(m.some(rM)){d(!0);return}$j.acknowledge(m)&&l(e=>e+1)},[m]),discoveredModelOptions:m,refreshProviderModelCatalog:o.refetch}}var aM=[],oM=[];function sM(e){let{sessionKey:t,inputSnapshot:n,setPendingSessionType:r}=e,i=t??null,a=Iu(),o=_u(e=>e.snapshot),s=o.configQuery?.data??null,c=o.providersQuery?.data??null,l=o.providerTemplatesQuery?.data??null,u=o.sessionsQuery?.data?.sessions??oM,d=Al({sessionId:i?.trim()||`draft-session`,projectRoot:Pc(n.pendingProjectRoot)}),f=d.data?.records??aM,p=!!(d.isLoading||d.isFetching),m=(0,G.useMemo)(()=>ml(u),[u]),h=(0,G.useMemo)(()=>m.find(e=>e.key===i)??null,[i,m]),g=zj({selectedSession:h,pendingSessionType:n.pendingSessionType,setPendingSessionType:r,sessionTypesData:o.sessionTypesQuery?.data??null}),_=(0,G.useMemo)(()=>Dj({config:s,providersView:c,templatesView:l}),[s,c,l]),v=(0,G.useMemo)(()=>Aj({modelOptions:_,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,runtimeDefaultThinkingCapability:g.selectedSessionTypeOption?.runtimeDefaultThinking??null,runtimeDefaultModelLabel:U(`chatRuntimeDefaultModel`),supportedModels:g.selectedSessionTypeOption?.supportedModels}),[_,g.selectedSessionTypeOption?.modelSelectionMode,g.selectedSessionTypeOption?.runtimeDefaultThinking,g.selectedSessionTypeOption?.supportedModels]),{addDiscoveredModel:y,dismissDiscoveredModels:b,discoveredModelOptions:x,refreshProviderModelCatalog:S}=iM({config:s,providersView:c,templatesView:l,modelSelectionMode:g.selectedSessionTypeOption?.modelSelectionMode,supportedModels:g.selectedSessionTypeOption?.supportedModels}),C=(0,G.useMemo)(()=>new Set(v.map(e=>e.value)),[v]),w=qj.read({namespace:g.selectedSessionType}).find(e=>C.has(e)),T=(0,G.useMemo)(()=>Rj({sessions:m,selectedSessionKey:i,sessionType:g.selectedSessionType}),[i,g.selectedSessionType,m]),E=T?.model??w,D=T?.thinking,O=Pc(s?.agents.defaults.workspace);return(0,G.useMemo)(()=>({addDiscoveredModel:y,defaultModel:g.selectedSessionTypeOption?.recommendedModel??s?.agents.defaults.model,defaultProjectRoot:O,dismissDiscoveredModels:b,discoveredModelOptions:x,fallbackPreferredModel:E,fallbackPreferredThinking:D,isProviderStateResolved:a,isSkillsLoading:p,modelOptions:v,providersView:c,refreshProviderModelCatalog:S,selectedSession:h,selectedSessionKey:i,sessionTypeState:g,skillRecords:f}),[s?.agents.defaults.model,O,E,D,a,p,v,y,b,x,S,c,h,i,g,f])}var cM=`new-session`,lM=`nextclaw.chat.composer-drafts`,uM=1,dM=e=>e.attachments.length===0&&e.selectedSkills.length===0&&!e.text.trim(),fM=(e,t)=>({...e,...t.composer});function pM(e){let t=e?.trim();return t?`session:${t}`:cM}var mM=class{constructor(e){this.set=e,this.ensureDraft=(e,t)=>{this.set(n=>n.drafts[e]?n:{drafts:{...n.drafts,[e]:t}})},this.updateDraft=(e,t,n)=>{this.set(r=>{let i=r.drafts[e]??t,a=n(i),o=r.recentSubmittedNodes[e];return o&&dM(i)&&!dM(a)&&JSON.stringify(a.nodes)===o?r:{drafts:{...r.drafts,[e]:a},recentSubmittedNodes:o&&!dM(a)?Object.fromEntries(Object.entries(r.recentSubmittedNodes).filter(([t])=>t!==e)):r.recentSubmittedNodes}})},this.beginSubmission=(e,t,n)=>{this.set(r=>({drafts:{...r.drafts,[e]:{...r.drafts[e]??t,text:``,nodes:[],selectedSkills:[],skillRecords:[],attachments:[],sendError:null}},submissions:{...r.submissions,[e]:n},recentSubmittedNodes:{...r.recentSubmittedNodes,[e]:JSON.stringify(n.composer.nodes)}}))},this.acceptSubmission=(e,t)=>{this.set(n=>{if(n.submissions[e]?.envelope.message.id!==t)return n;let r={...n.submissions};return delete r[e],{submissions:r}})},this.failSubmission=(e,t,n,r)=>{this.set(i=>{let a=i.submissions[e];if(!a||a.envelope.message.id!==t)return i;let o=i.drafts[e];if(!o)return i;let s=n===`rejected`&&dM(o),c={...i.submissions};s?delete c[e]:c[e]={...a,status:n};let l={...i.recentSubmittedNodes};return s&&delete l[e],{submissions:c,recentSubmittedNodes:l,drafts:{...i.drafts,[e]:{...s?fM(o,a):o,sendError:r}}}})},this.restoreSubmission=(e,t)=>{this.set(n=>{let r=n.submissions[e],i=n.drafts[e];if(!r||r.status!==`rejected`||r.envelope.message.id!==t||!i||!dM(i))return n;let a={...n.submissions};delete a[e];let o={...n.recentSubmittedNodes};return delete o[e],{submissions:a,recentSubmittedNodes:o,drafts:{...n.drafts,[e]:fM(i,r)}}})},this.discardSubmission=(e,t)=>{this.set(n=>{if(n.submissions[e]?.envelope.message.id!==t)return n;let r={...n.submissions};return delete r[e],{submissions:r}})}}},hM=ct()(xi(e=>({drafts:{},submissions:{},recentSubmittedNodes:{},...new mM(e)}),{name:lM,version:uM,storage:Si(()=>window.localStorage),partialize:e=>({drafts:Object.fromEntries(Object.entries(e.drafts).map(([e,t])=>[e,{...t,composerFocusRequestId:0,sendError:null}])),submissions:Object.fromEntries(Object.entries(e.submissions).map(([e,t])=>[e,{...t,status:t.status===`sending`?`uncertain`:t.status}]))})})),gM=({preferenceOwnerKey:e,selectedModel:t,selectedThinkingLevel:n,updatePreferences:r})=>{let i=(0,G.useRef)(void 0),a=(0,G.useRef)(null),o=(0,G.useCallback)(t=>{a.current={ownerKey:e,value:t},r({selectedThinkingLevel:t})},[e,r]),s=(0,G.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=Ij({currentSelectedModel:t??void 0,modelOptions:l,selectedSessionPreferredModel:p,fallbackPreferredModel:s,defaultModel:o,preferSessionPreferredModel:_,preserveCurrentSelectedModelOnSessionChange:v}),C=l.find(e=>e.value===S),w=Lj({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,G.useMemo)(()=>({setSelectedThinkingLevel:o,syncSessionPreferences:s}),[o,s])},_M={text:``,nodes:[],selectedSkills:[],skillRecords:[]},vM=e=>{let t=e?.trim()??``;return{...t?{..._M,text:t,nodes:aO(t)}:_M,attachments:[],selectedModel:void 0,selectedThinkingLevel:null,pendingSessionType:Kl,selectedSessionType:Kl,composerFocusRequestId:t?1:0,sendError:null}},yM=e=>e?.trim()||Kl,bM=e=>[e.assetUri??``,e.url??``,e.name,e.mimeType,String(e.sizeBytes),e.contentBase64??``].join(`:`),xM=(e,t)=>{let n=new Set(e.map(bM)),r=[...e];return t.forEach(e=>{let t=bM(e);n.has(t)||(n.add(t),r.push(e))}),r};function SM(e){let{attachments:t,update:n}=e,r=(0,G.useCallback)(e=>{n({attachments:e})},[n]);return{addAttachments:(0,G.useCallback)(e=>{if(e.length===0)return[];let r=new Set(t.map(bM)),i=xM(t,e),a=i.filter(e=>!r.has(bM(e)));return a.length>0&&n({attachments:i}),a},[t,n]),removeAttachment:(0,G.useCallback)(e=>{n(t=>({attachments:t.attachments.filter(t=>t.id!==e)}))},[n]),setAttachments:r}}function CM(e,t){let n=pM(t),r=(0,G.useMemo)(()=>vM(e),[e]),i=hM(e=>e.drafts[n]??r),a=hM(e=>e.submissions[n]??null);return(0,G.useEffect)(()=>{hM.getState().ensureDraft(n,r)},[n,r]),{draftKey:n,snapshot:i,pendingSubmission:a,update:(0,G.useCallback)(e=>{hM.getState().updateDraft(n,r,t=>{let n=typeof e==`function`?e({...t,pendingProjectRoot:Y.getState().snapshot.draftProjectRoot}):e;return{...t,...n}})},[n,r]),beginSubmission:(0,G.useCallback)((e,t)=>{hM.getState().beginSubmission(n,i,{envelope:e,composer:t,status:`sending`})},[n,i]),acceptSubmission:(0,G.useCallback)(e=>{hM.getState().acceptSubmission(n,e)},[n]),failSubmission:(0,G.useCallback)((e,t,r)=>{hM.getState().failSubmission(n,e,t,r)},[n]),restoreSubmission:(0,G.useCallback)(e=>{hM.getState().restoreSubmission(n,e)},[n]),discardSubmission:(0,G.useCallback)(e=>{hM.getState().discardSubmission(n,e)},[n])}}var wM=(e,t=null)=>{let n=Y(e=>e.snapshot.draftProjectRoot),{draftKey:r,snapshot:i,pendingSubmission:a,update:o,beginSubmission:s,acceptSubmission:c,failSubmission:l,restoreSubmission:u,discardSubmission:d}=CM(e,t),f=(0,G.useCallback)(e=>{o({text:e.text,nodes:e.nodes,selectedSkills:e.selectedSkills,skillRecords:e.skillRecords,sendError:null})},[o]),p=(0,G.useCallback)(e=>{o({...e})},[o]),m=(0,G.useCallback)(e=>{o({text:e,nodes:aO(e),selectedSkills:[],skillRecords:[],sendError:null,composerFocusRequestId:Date.now()})},[o]),h=(0,G.useCallback)(()=>{o(e=>({composerFocusRequestId:e.composerFocusRequestId+1}))},[o]),g=(0,G.useCallback)(()=>{o({composerFocusRequestId:0})},[o]),{addAttachments:_,removeAttachment:v,setAttachments:y}=SM({attachments:i.attachments,update:o}),b=gM({preferenceOwnerKey:r,selectedModel:i.selectedModel,selectedThinkingLevel:i.selectedThinkingLevel,updatePreferences:o}),x=(0,G.useCallback)(e=>{o(t=>{let n=yM(typeof e==`function`?e(t.pendingSessionType):e);return{pendingSessionType:n,selectedSessionType:n}})},[o]),S=(0,G.useCallback)(e=>{Y.getState().setSnapshot({draftProjectRoot:e})},[]),C=(0,G.useCallback)((e,t)=>{o({selectedSkills:e,skillRecords:t,sendError:null})},[o]),w=(0,G.useCallback)(e=>{o({sendError:e})},[o]),T=(0,G.useMemo)(()=>({update:o,syncComposer:f,beginSubmission:s,acceptSubmission:c,failSubmission:l,restoreSubmission:u,discardSubmission:d,restoreComposer:p,applyPromptSuggestion:m,requestComposerFocusAtEnd:h,consumeComposerFocusRequest:g,setAttachments:y,addAttachments:_,removeAttachment:v,...b,setPendingSessionType:x,setPendingProjectRoot:S,setSelectedSkills:C,setSendError:w}),[o,f,s,c,l,u,d,p,m,h,g,y,_,v,b,x,S,C,w]);return{inputSnapshot:{...i,pendingProjectRoot:n,pendingSubmission:a},inputActions:T}},TM=`ncp-session-run-queue`;function EM(e){let t=Dt(),n=e?.trim()||null,{data:r,isLoading:i,refetch:a}=R({queryKey:[TM,n],queryFn:()=>L.sessions.listPendingInputs(n),enabled:!!n,retry:!1,staleTime:5e3});(0,G.useEffect)(()=>{if(n)return L.eventBus.on(Vt.sessionRunQueueUpdated,async({sessionKey:e})=>{if(e!==n)return;let r=[TM,n];await t.cancelQueries({queryKey:r,exact:!0}),await t.invalidateQueries({queryKey:r,exact:!0})})},[n,t]);let o=(0,G.useCallback)(async e=>n?await L.sessions.deleteQueuedInput(n,e):null,[n]),s=(0,G.useCallback)(async()=>n?(await a()).data?.inputs??[]:[],[n,a]),c=(0,G.useCallback)(async()=>(await s()).filter(({placement:e})=>e===`queued`),[s]),l=(0,G.useCallback)(async e=>n?await L.sessions.steerQueuedInput(n,e):null,[n]),u=r?.inputs??[];return{inputs:u.filter(({placement:e})=>e===`queued`),pendingInputs:u,isLoading:i,refreshPendingInputs:s,refreshQueuedInputs:c,removeQueuedInput:o,steerQueuedInput:l}}function DM(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.ctrl===!1&&t.meta===!1&&t.alt===!1&&t.shift===!1;return typeof t.code==`string`&&(/^Key[A-Z]$/.test(t.code)||/^F(?:[6-9]|10)$/.test(t.code))&&typeof t.ctrl==`boolean`&&typeof t.meta==`boolean`&&typeof t.alt==`boolean`&&typeof t.shift==`boolean`&&(n||t.alt&&t.ctrl!==t.meta)}var OM=ct()(xi(e=>({shortcut:null,setShortcut:t=>e({shortcut:t})}),{name:`nextclaw.chat.voice-shortcut`,version:1,storage:Si(()=>window.localStorage),partialize:e=>({shortcut:e.shortcut}),merge:(e,t)=>{let n=e?.shortcut;return{...t,shortcut:DM(n)?n:null}}}));function kM(e){return[e.ctrl&&`Ctrl`,e.meta&&`⌘`,e.alt&&`Alt/⌥`,e.shift&&`Shift`,e.code.replace(/^Key/,``)].filter(Boolean).join(` + `)}function AM(){let{shortcut:e,setShortcut:t}=OM(),[n,r]=(0,G.useState)(!1),[i,a]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{className:`mt-3 border-t border-border/60 pt-3 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(B,{variant:`ghost`,size:`sm`,"aria-label":U(`chatInputVoiceBind`),onClick:()=>{r(!0),a(null)},onBlur:()=>r(!1),onKeyDown:e=>{if(!n||e.nativeEvent.isComposing)return;if(e.key===`Escape`){e.stopPropagation(),r(!1);return}if(e.key===`Tab`)return;e.preventDefault(),e.stopPropagation();let i={code:e.code,ctrl:e.ctrlKey,meta:e.metaKey,alt:e.altKey,shift:e.shiftKey};if(!DM(i)){a(`chatInputVoiceBindInvalid`);return}try{t(i),r(!1),a(null)}catch{a(`chatInputVoiceSaveFailed`)}},children:n?U(`chatInputVoiceCapture`):e?kM(e):U(`chatInputVoiceBind`)}),e?(0,K.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{try{t(null),a(null)}catch{a(`chatInputVoiceSaveFailed`)}},children:U(`chatInputVoiceUnbind`)}):null]}),(0,K.jsx)(`p`,{role:n?`status`:void 0,className:`mt-1 leading-5`,children:U(n?`chatInputVoiceCaptureHelp`:`chatInputVoiceShortcutHelp`)}),i?(0,K.jsx)(`p`,{role:`alert`,className:`mt-1 text-destructive`,children:U(i)}):null]})}function jM(){return globalThis.isSecureContext!==!1}function MM(e){let t=e instanceof DOMException||e instanceof Error?e.name:``;return t===`NotSupportedError`?`unsupported`:t===`NotAllowedError`||t===`SecurityError`?`permission`:t===`NotFoundError`||t===`DevicesNotFoundError`?`no-device`:t===`NotReadableError`||t===`AbortError`?`device-busy`:`failed`}async function NM(){if(!jM())return`insecure-context`;if(!navigator.mediaDevices?.getUserMedia)return`unsupported`;try{return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),null}catch(e){return MM(e)}}function PM(e){let t=/iPhone|iPad|iPod/i.test(e)?`chatInputVoicePermissionIos`:/Android/i.test(e)?`chatInputVoicePermissionAndroid`:/Macintosh|Mac OS X/i.test(e)?`chatInputVoicePermissionMac`:/Windows/i.test(e)?`chatInputVoicePermissionWindows`:`chatInputVoicePermissionSystem`;return[/Electron/i.test(e)?`chatInputVoicePermissionDesktop`:`chatInputVoicePermissionBrowser`,t]}var FM={"insecure-context":`chatInputVoiceInsecureContext`,unsupported:`chatInputVoiceUnsupported`,permission:`chatInputVoicePermissionDenied`,"service-denied":`chatInputVoiceServiceDenied`,"no-device":`chatInputVoiceNoDevice`,"device-busy":`chatInputVoiceDeviceBusy`,network:`chatInputVoiceNetwork`,"audio-capture":`chatInputVoiceDevice`,"no-speech":`chatInputVoiceNoSpeech`,interrupted:`chatInputVoiceInterrupted`,timeout:`chatInputVoiceTimeout`,failed:`chatInputVoiceFailed`};function IM({manager:e,snapshot:t,onStart:n,desktop:r}){let{phase:i,error:a,seconds:o}=t;if(i===`ready`)return r?(0,K.jsx)(RM,{onClose:e.cancel}):null;let s=i===`starting`||i===`stopping`,c=[`permission`,`audio-capture`,`no-device`,`device-busy`].includes(a??``),l={idle:`chatInputVoice`,ready:`chatInputVoiceShortcut`,starting:`chatInputVoiceStarting`,recording:`chatInputVoiceRecording`,stopping:`chatInputVoiceFinishing`,error:`chatInputVoiceFailed`}[i];return(0,K.jsxs)(`div`,{role:`region`,"aria-label":U(`chatInputVoice`),className:`flex max-h-[var(--radix-popover-content-available-height,24rem)] max-w-full flex-col overflow-hidden border border-border bg-popover text-popover-foreground shadow-lg `+(i===`error`?`w-80 rounded-xl p-3`:`w-fit rounded-full px-3 py-1.5`),onKeyDown:t=>{t.key===`Escape`&&!t.nativeEvent.isComposing&&(t.stopPropagation(),e.saveAndClose())},children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[s?(0,K.jsx)(Rr,{className:`h-4 w-4 shrink-0 motion-safe:animate-spin text-muted-foreground`}):(0,K.jsx)(Xo,{className:`h-4 w-4 shrink-0 `+(i===`recording`?`text-destructive`:``)}),(0,K.jsxs)(`span`,{role:`status`,className:`grid min-w-0 flex-1 text-xs font-medium`,title:i===`starting`?U(`chatInputVoicePermissionPurpose`):void 0,children:[(0,K.jsx)(`span`,{className:`col-start-1 row-start-1 truncate`,children:U(l)}),i===`error`?null:[`chatInputVoiceStarting`,`chatInputVoiceRecording`,`chatInputVoiceFinishing`].map(e=>(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1`,children:U(e)},e))]}),i===`error`?null:(0,K.jsxs)(`span`,{"aria-hidden":i!==`recording`,"data-recording":i===`recording`,className:`w-7 text-right text-xs tabular-nums text-muted-foreground data-[recording=false]:invisible`,children:[o,`s`]}),i===`error`?null:(0,K.jsx)(W,{icon:(0,K.jsx)(Ds,{className:`h-3 w-3`}),label:U(`chatInputVoiceSaveAndClose`),tooltip:U(`chatInputVoiceEscapeHint`),disabled:i===`stopping`,onClick:e.saveAndClose}),r?(0,K.jsx)(W,{icon:(0,K.jsx)(zr,{className:`h-4 w-4`}),label:U(`chatInputVoiceShortcut`),disabled:s,onClick:e.openSettings}):null]}),(0,K.jsxs)(`div`,{className:`min-h-0 overflow-y-auto`,children:[i===`starting`?(0,K.jsx)(`p`,{className:`sr-only`,children:U(`chatInputVoicePermissionPurpose`)}):null,a?(0,K.jsx)(LM,{error:a,microphoneError:c,text:t.text}):null]}),a?(0,K.jsx)(B,{className:`mt-2 shrink-0 self-start`,size:`sm`,disabled:a===`unsupported`||a===`insecure-context`,onClick:n,children:U(c?`chatInputVoiceCheckAndRetry`:`chatInputVoiceRetry`)}):null,i===`error`?(0,K.jsx)(B,{className:`mt-2 shrink-0 self-start`,variant:`ghost`,size:`sm`,title:U(`chatInputVoiceEscapeHint`),onClick:e.saveAndClose,children:U(`chatInputVoiceSaveAndClose`)}):null]})}function LM({error:e,microphoneError:t,text:n}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs leading-5 text-destructive`,children:U(FM[e])}),t?(0,K.jsxs)(`ol`,{className:`mt-2 list-decimal space-y-1 pl-4 text-xs leading-5 text-muted-foreground`,children:[PM(navigator.userAgent).map(e=>(0,K.jsx)(`li`,{children:U(e)},e)),(0,K.jsx)(`li`,{children:U(`chatInputVoicePermissionRetryHint`)})]}):null,n?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:U(`chatInputVoiceReviewHint`)}):null]})}function RM({onClose:e}){return(0,K.jsxs)(`div`,{role:`region`,"aria-label":U(`chatInputVoiceShortcut`),className:`max-h-[var(--radix-popover-content-available-height,24rem)] w-80 max-w-full overflow-y-auto rounded-xl border border-border bg-popover p-3 text-popover-foreground shadow-lg`,onKeyDown:t=>{t.key===`Escape`&&!t.nativeEvent.isComposing&&(t.stopPropagation(),e())},children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(zr,{className:`h-4 w-4`}),(0,K.jsx)(`span`,{className:`flex-1 text-sm font-medium`,children:U(`chatInputVoiceShortcut`)}),(0,K.jsx)(W,{icon:(0,K.jsx)(Vr,{className:`h-4 w-4`}),label:U(`chatInputVoiceCloseSettings`),onClick:e})]}),(0,K.jsx)(AM,{})]})}function zM(e,t,n,r,i){let a=(0,G.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),o=OM(e=>e.shortcut);return(0,G.useEffect)(()=>{if(!r||!o)return;let a=!1,s=r=>{r.defaultPrevented||r.isComposing||r.repeat||r.code!==o.code||r.ctrlKey!==o.ctrl||r.metaKey!==o.meta||r.altKey!==o.alt||r.shiftKey!==o.shift||!document.hasFocus()||[`idle`,`ready`].includes(e.getSnapshot().phase)&&(r.target instanceof HTMLElement&&(r.target.isContentEditable||r.target.closest(`input, textarea, select, [contenteditable="true"], [role="textbox"]`))&&!o.ctrl&&!o.meta&&!o.alt||(r.preventDefault(),a=!0,e.start(n,t,i())))},c=t=>{a&&(t.code===o.code||[`Alt`,`Control`,`Meta`,`Shift`].includes(t.key))&&(a=!1,e.finish())};return window.addEventListener(`keydown`,s),window.addEventListener(`keyup`,c),()=>{window.removeEventListener(`keydown`,s),window.removeEventListener(`keyup`,c),a&&e.cancel()}},[e,t,n,r,i,o]),(0,G.useEffect)(()=>{let t=t=>{t.key!==`Escape`||t.isComposing||[`idle`,`ready`].includes(e.getSnapshot().phase)||(t.preventDefault(),t.stopPropagation(),e.saveAndClose())};return window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`keydown`,t,!0)}},[e]),(0,G.useEffect)(()=>{let t=()=>{document.hidden&&e.interrupt()},n=()=>{e.getSnapshot().phase!==`starting`&&e.interrupt()};return window.addEventListener(`blur`,n),window.addEventListener(`pagehide`,e.cancel),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`blur`,n),window.removeEventListener(`pagehide`,e.cancel),document.removeEventListener(`visibilitychange`,t),e.cancel()}},[e,t]),a}var BM={exactId:1200,exactLabel:1150,prefixId:1e3,prefixLabel:950,prefixToken:900,containsId:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function VM(e){return(e??``).trim().toLowerCase()}function HM(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 UM(e,t){let n=VM(t);if(!n)return BM.fallback;let r=VM(e.id),i=VM(e.label||e.id),a=VM(e.description),o=(e.aliases??[]).map(VM).filter(Boolean),s=i.split(/[\s/_-]+/).filter(Boolean),c=[r,...o];return c.some(e=>e===n)?BM.exactId:i===n?BM.exactLabel:c.some(e=>e.startsWith(n))?BM.prefixId:i.startsWith(n)?BM.prefixLabel:s.some(e=>e.startsWith(n))?BM.prefixToken:c.some(e=>e.includes(n))?BM.containsId:i.includes(n)?BM.containsLabel:a.includes(n)?BM.containsDescription:HM(n,i)||c.some(e=>HM(n,e))?BM.subsequence:0}function WM(e){return e>=BM.exactLabel?4:e>=BM.prefixToken?3:e>=BM.containsLabel?2:e>0?1:0}var GM=`context-reference:navigate:files`,KM=`context-reference:navigate:folders`,qM=`context-reference:navigate:projects`,JM=`context-reference:navigate:root`,YM=`context-reference:navigate:system-object-group:`,XM=`context-reference:system-object:`,ZM=`workspace-files`,QM=`workspace-folders`,$M=`projects`;function eN(e,t){return e.translations?.[t]??e.default}function tN(e){return e.groups.map(t=>({key:`${YM}${t.objectType}`,icon:t.icon,title:eN(t.label,e.language),subtitle:e.texts.systemObjectSectionLabel,description:eN(t.description,e.language),detailLines:[],hintLabel:e.texts.systemObjectGroupHintLabel,sectionKey:`system-object-groups`,sectionLabel:e.texts.systemObjectSectionLabel,selectionBehavior:`navigate`,value:t.objectType}))}function nN(e){return e.groups.flatMap(t=>{let n=eN(t.label,e.language);return t.items.map(e=>({key:`${XM}${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 rN(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function iN(e){let{kind:t,projectRoot:n,relativePath:r}=e,i=r.split(`/`).filter(Boolean);return{rootLabel:rN(n),segments:i.map((e,n)=>({label:e,kind:n===i.length-1?t:`directory`}))}}function aN(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.projects.map((t,n)=>({order:n,project:t,score:UM({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=WM(e.score),i=WM(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:$M,sectionLabel:e.texts.projectSectionLabel,value:t.rootPath,tokenKind:Te,tokenKey:t.rootPath}))}function oN(e){let t=rN(e.projectRoot);return e.entries.map(n=>{let r=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:r?void 0:n.kind===`directory`?T:I,tokenKey:r?void 0:n.relativePath,selectionBehavior:r?`navigate`:void 0,pathPreview:iN({kind:n.kind,projectRoot:e.projectRoot,relativePath:n.relativePath})}})}function sN(e){let{projectRoot:t,referencePath:n,texts:r}=e,i=n.split(`/`).filter(Boolean).join(`/`),a=i||`.`,o=i.split(`/`).filter(Boolean).at(-1)??rN(t);return{key:`context-reference:current-directory:${a}`,icon:`folder`,title:r.currentDirectoryLabel,subtitle:o,description:r.directoryDescription,detailLines:[`${r.projectRootLabel}: ${t}`,a],sectionKey:QM,sectionLabel:r.foldersLabel,value:a,tokenKind:T,tokenKey:a,pathPreview:iN({kind:`directory`,projectRoot:t,relativePath:i})}}function cN(e){return{key:GM,icon:`files`,title:e.filesLabel,subtitle:e.filesSubtitle,description:e.filesDescription,detailLines:[],hintLabel:e.filesHintLabel,selectionBehavior:`navigate`}}function lN(e){return{key:KM,icon:`folder`,title:e.foldersLabel,subtitle:e.foldersSubtitle,description:e.foldersDescription,detailLines:[],hintLabel:e.foldersHintLabel,selectionBehavior:`navigate`}}function uN(e){return{key:qM,icon:`project`,title:e.projectsLabel,subtitle:e.projectsSubtitle,description:e.projectsDescription,detailLines:[],hintLabel:e.projectsHintLabel,selectionBehavior:`navigate`}}function dN(e){let t=e.split(`/`).filter(Boolean);return t.length===0?null:t.slice(0,-1).join(`/`)}function fN(e){let{location:t,texts:n}=e,r=t.view===`files`||t.view===`folders`,i=r?t.path:``,a=!r||!i;return{key:JM,icon:`back`,title:a?n.backLabel:n.parentLabel,subtitle:``,description:a?n.backDescription:n.parentDescription,detailLines:[],hintLabel:a?n.backHintLabel:n.parentHintLabel,value:dN(i)??``,selectionBehavior:`navigate`}}var pN=`panel-apps`;function mN(e){return Date.parse(e.lastOpenedAt??e.updatedAt)||0}function hN(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.entries.map((t,n)=>({entry:t,order:n,score:UM({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=WM(e.score),i=WM(n.score);if(i!==r)return i-r;if(e.entry.favorite!==n.entry.favorite)return e.entry.favorite?-1:1;let a=mN(n.entry),o=mN(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 gN(e){let t=e.keyPrefix??`panel-app`;return hN({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 _N(e){return gN(e).map(({item:e})=>e)}function vN(e){return gN(e).map(({entry:t,item:n})=>({...n,sectionKey:pN,sectionLabel:e.sectionLabel,tokenKind:`panel_app`,tokenKey:t.appId,value:t.appId}))}var yN={key:`context-reference`,marker:`@`};function bN(e){let{entries:t,isBrowsing:n,isFoldersMode:r,projectRoot:i,texts:a}=e,o=(e,t,n)=>oN({entries:e,navigateDirectories:n,projectRoot:i,sectionKey:t===`folders`?QM:ZM,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 xN(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 SN(e){return Hs({key:`context-reference`,trigger:yN,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}=bN({entries:t.serverPathEntries,isBrowsing:l,isFoldersMode:i,projectRoot:t.projectRoot,texts:e.itemTexts.context}),m=aN({projects:t.projects,query:n.query,texts:e.itemTexts.context}),h=i&&l?sN({projectRoot:t.projectRoot,referencePath:u,texts:e.itemTexts.context}):null,g=t.systemObjectGroups??[],_=nN({groups:g,language:e.language,texts:e.itemTexts.context}),v=r?[fN({location:t.referenceLocation,texts:e.itemTexts.context}),...l?d:f]:i?[fN({location:t.referenceLocation,texts:e.itemTexts.context}),...h?[h]:[],...l?d:p]:a?[fN({location:t.referenceLocation,texts:e.itemTexts.context}),...m]:o?[fN({location:t.referenceLocation,texts:e.itemTexts.context}),..._]:[cN(e.itemTexts.context),lN(e.itemTexts.context),uN(e.itemTexts.context),...c?f:[],...c?p:[],...c?m:[],...c?_:tN({groups:g,language:e.language,texts:e.itemTexts.context}),...vN({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=>xN({isFoldersMode:i,isWorkspaceMode:s,item:t,onNavigate:e.onNavigate,onSelectSystemObject:e.onSelectSystemObject,referencePath:u}),texts:e.menuTexts}}})}function CN(e){let t=e.modelLabel.trim(),n=e.providerLabel.trim();return n?`${n}/${t}`:t}function wN(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 TN(e,t){let n=new Map;for(let r of e){let e=r.value.indexOf(`/`),i=e>0?r.value.slice(0,e):`other`,a=n.get(i)??{key:`provider-${i}`,label:r.providerLabel.trim()||t,options:[]};a.options.push({value:r.value,label:r.modelLabel.trim()}),n.set(i,a)}return[...n.values()]}function EN(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 DN(e){let{isModelOptionsEmpty:t,onGoToProviders:n,texts:r}=e;return t?{tone:`warning`,text:r.noModelOptionsLabel,actionLabel:r.configureProviderLabel,onAction:n}:null}function ON(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:wN(r),onDismiss:t,onSelect:n}}function kN({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?[{key:`favorite-models`,label:f.favoriteModelsLabel,options:g.map(e=>({value:e.value,label:CN(e)}))}]:[],...v.length>0?[{key:`recent-models`,label:f.recentModelsLabel,options:v.map(e=>({value:e.value,label:CN(e)}))}]:[],...TN(b,f.allModelsLabel)].filter(e=>e.options.length>0),S=x.length>0?x:void 0,C=t??[];return{key:`model`,value:m,placeholder:f.modelSelectPlaceholder,selectedLabel:p?CN(p):void 0,icon:`sparkles`,options:e.map(e=>({value:e.value,label:CN(e)})),groups:S,disabled:!o&&C.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:ON({options:C,onDismiss:l,onSelect:c,texts:f}),manageLabel:f.manageModelsLabel,manageHref:`/providers`,onOpen:u,onValueChange:d}}function AN(e){let{defaultThinkingLevel:t,onValueChange:n,selectedThinkingLevel:r,supportedLevels:i,texts:a}=e;if(i.length===0)return null;let o=fi(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 jN={exactSpec:1200,exactLabel:1150,prefixSpec:1e3,prefixLabel:950,prefixToken:900,containsSpec:800,containsLabel:760,containsDescription:500,subsequence:300,fallback:1};function MN(e){return(e??``).trim().toLowerCase()}function NN(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 PN(e,t){let n=MN(t);if(!n)return jN.fallback;let r=MN(e.key),i=MN(e.label||e.key),a=MN(`${e.descriptionZh??``} ${e.description??``}`),o=i.split(/[\s/_-]+/).filter(Boolean);return r===n?jN.exactSpec:i===n?jN.exactLabel:r.startsWith(n)?jN.prefixSpec:i.startsWith(n)?jN.prefixLabel:o.some(e=>e.startsWith(n))?jN.prefixToken:r.includes(n)?jN.containsSpec:i.includes(n)?jN.containsLabel:a.includes(n)?jN.containsDescription:NN(n,i)||NN(n,r)?jN.subsequence:0}function FN(e){return e>=jN.exactLabel?4:e>=jN.prefixToken?3:e>=jN.containsLabel?2:e>0?1:0}function IN(e){return new Map(e.map((e,t)=>[e,t]))}function LN(e,t){let n=IN(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 RN(e,t,n,r=[]){let i=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),a=IN(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:PN(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=FN(e.score),c=FN(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 zN(e){return e.map(e=>({key:e.key,label:e.label,description:e.descriptionZh||e.description||``,badgeLabel:e.badgeLabel}))}function BN(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:zN(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:zN(a)}]:[],...s].filter(e=>e.options.length>0)}function VN(e){let{groupedRecentSkillValues:t,isLoading:n,onSelectedKeysChange:r,recentSkillValues:i,selectedSkills:a,skillRecords:o,texts:s}=e,c=LN(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:zN(c),groups:BN({skillRecords:c,recentKeySet:l,recentSkillsLabel:s.recentSkillsLabel,allSkillsLabel:s.allSkillsLabel}),selectedKeys:a,onSelectedKeysChange:r}}var HN=`commands`,UN=`panel-app-action`,WN=`panel-apps`,GN=`skills`;function KN(e){let t=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0});return e.commands.map((t,n)=>({command:t,order:n,score:UM({id:t.key,label:t.title,description:t.description,aliases:t.keywords},e.query)})).filter(e=>e.score>0).sort((e,n)=>{let r=WM(e.score),i=WM(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:HN,sectionLabel:e.texts.commandSectionLabel}))}function qN(e){let{data:t,itemTexts:n,query:r,skillHintLabel:i,skillSectionLabel:a}=e;return RN([...t.skillRecords],r,n,[...t.recentSkillValues]).map(e=>({...e,icon:`skill`,hintLabel:i,sectionKey:e.sectionKey?`${GN}:${e.sectionKey}`:GN,sectionLabel:e.sectionLabel||a}))}function JN(e){return _N({entries:e.data.panelApps,keyPrefix:UN,query:e.query,texts:e.itemTexts}).map(t=>({...t,icon:`panel-app`,hintLabel:e.panelAppHintLabel,sectionKey:WN,sectionLabel:e.panelAppSectionLabel}))}function YN(e){let t=`${UN}:`;return e.key.startsWith(t)?e.key.slice(t.length):null}function XN(e){return Hs({key:`slash-command`,trigger:ar,resolvePanel:t=>{let{data:n,trigger:r}=t,i=qN({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:HN,label:e.labels.filterCommandsLabel,sectionKeys:[HN]},{key:GN,label:e.labels.filterSkillsLabel,sectionKeys:a.length>0?a:[GN]},{key:WN,label:e.labels.filterPanelAppsLabel,sectionKeys:[WN]}],isLoading:n.isPanelAppsLoading||n.isSkillsLoading,items:[...KN({commands:e.commands,query:r.query,texts:{commandHintLabel:e.labels.commandHintLabel,commandSectionLabel:e.labels.commandSectionLabel,commandSubtitle:e.labels.commandSubtitle}}),...i,...JN({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=YN(t);if(n){e.onSelectPanelApp(n);return}let r=t.tokenKey??t.value;r&&e.onSelectSkill?.(r)},texts:e.menuTexts}}})}function ZN(e){let{commands:t,language:n,onNavigate:r,onSelectPanelApp:i,onSelectSkill:a,onSelectSystemObject:o,slashTexts:s}=e,c={appIdLabel:U(`chatPanelAppReferenceAppId`,n),fileLabel:U(`chatPanelAppReferenceFile`,n),noDescriptionLabel:U(`chatPanelAppReferenceNoDescription`,n),subtitle:U(`chatPanelAppReferenceType`,n)};return[XN({commands:t,itemTexts:{panelAppTexts:c,skillTexts:s},menuTexts:{loadingLabel:U(`chatSlashLoading`,n),sectionLabel:U(`chatSlashSection`,n),emptyLabel:U(`chatSlashNoResult`,n),hintLabel:U(`chatSlashHint`,n),itemHintLabel:U(`chatSlashSkillHint`,n)},labels:{commandHintLabel:U(`chatSlashCommandHint`,n),commandSectionLabel:U(`chatSlashSectionCommands`,n),commandSubtitle:U(`chatSlashTypeCommand`,n),filterAllLabel:U(`chatSlashFilterAll`,n),filterCommandsLabel:U(`chatSlashFilterCommands`,n),filterPanelAppsLabel:U(`chatSlashFilterPanelApps`,n),filterSkillsLabel:U(`chatSlashFilterSkills`,n),panelAppHintLabel:U(`chatSlashPanelAppHint`,n),panelAppSectionLabel:U(`chatPanelAppReferenceSection`,n),skillHintLabel:U(`chatSlashSkillHint`,n),skillSectionLabel:U(`chatSlashSectionSkills`,n)},onSelectPanelApp:i,onSelectSkill:a}),SN({itemTexts:{context:{backLabel:U(`chatContextReferenceBack`,n),backDescription:U(`chatContextReferenceBackDescription`,n),backHintLabel:U(`chatContextReferenceBackHint`,n),currentDirectoryLabel:U(`chatContextReferenceCurrentDirectory`,n),directoryDescription:U(`chatContextReferenceDirectoryDescription`,n),fileDescription:U(`chatContextReferenceFileDescription`,n),filesDescription:U(`chatContextReferenceFilesDescription`,n),filesHintLabel:U(`chatContextReferenceFilesHint`,n),filesLabel:U(`chatContextReferenceFilesLabel`,n),filesSubtitle:U(`chatContextReferenceFilesType`,n),foldersDescription:U(`chatContextReferenceFoldersDescription`,n),foldersHintLabel:U(`chatContextReferenceFoldersHint`,n),foldersLabel:U(`chatContextReferenceFoldersLabel`,n),foldersSubtitle:U(`chatContextReferenceFoldersType`,n),panelAppSectionLabel:U(`chatPanelAppReferenceSection`,n),parentLabel:U(`chatContextReferenceParent`,n),parentDescription:U(`chatContextReferenceParentDescription`,n),parentHintLabel:U(`chatContextReferenceParentHint`,n),projectDescription:U(`chatContextReferenceProjectDescription`,n),projectPathLabel:U(`chatContextReferenceProjectPath`,n),projectSectionLabel:U(`chatContextReferenceProjectSection`,n),projectSubtitle:U(`chatContextReferenceProjectType`,n),projectsDescription:U(`chatContextReferenceProjectsDescription`,n),projectsHintLabel:U(`chatContextReferenceProjectsHint`,n),projectsLabel:U(`chatContextReferenceProjectsLabel`,n),projectsLoadFailedLabel:U(`chatContextReferenceProjectsLoadFailed`,n),projectsSubtitle:U(`chatContextReferenceProjectsType`,n),projectRootLabel:U(`chatContextReferenceProjectRoot`,n),searchFailedLabel:U(`chatContextReferenceSearchFailed`,n),systemObjectGroupHintLabel:U(`chatSystemObjectGroupHint`,n),systemObjectSectionLabel:U(`chatSystemObjectSection`,n)},panelApp:c},menuTexts:{loadingLabel:U(`chatContextReferenceLoading`,n),sectionLabel:U(`chatContextReferenceSection`,n),emptyLabel:U(`chatContextReferenceNoResult`,n),hintLabel:U(`chatContextReferenceHint`,n),itemHintLabel:U(`chatContextReferenceItemHint`,n)},language:n,onNavigate:r,onSelectSystemObject:o})]}function QN(e){return[`server-path-search`,e.basePath.trim(),e.query?.trim()??``,e.limit??null]}function $N(e){let{enabled:t,limit:n}=e,r=e.basePath.trim(),i=e.query?.trim()??``;return R({queryKey:QN({basePath:r,query:i,limit:n}),queryFn:()=>Gt({basePath:r,query:i,limit:n}),enabled:(t??!0)&&!!r,staleTime:5e3})}function eP(e){let{enabled:t,limit:n,objectType:r}=e,i=e.query.trim();return R({queryKey:[`system-object-references`,r??null,i,n??null],queryFn:()=>L.systemObjectReferences.list({query:i||void 0,limit:n,objectType:r}),enabled:t,staleTime:1e4})}function tP(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 nP(e){let{inputSurfaceTrigger:t,isContextReferenceTrigger:n,query:r,referenceLocation:i}=e,a=c({enabled:n&&i.view===`root`||t?.key===ar.key}),o=yu({enabled:!!(n&&(i.view===`root`||i.view===`projects`))}),s=i.view===`system-objects`?i.objectType:void 0;return{panelApps:a,projects:o,systemObjects:eP({enabled:!!(n&&(i.view===`root`||i.view===`system-objects`)),query:r,limit:s?20:6,objectType:s})}}function rP(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,G.useState)({view:`root`}),[p,m]=(0,G.useState)(null),h=(0,G.useRef)(`null`),g=(0,G.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===yN.key,v=d.view===`files`||d.view===`folders`,y=v?d.path:``,b=(0,G.useDeferredValue)(_?p.query:``),x=!!(_&&s&&v&&!b.trim()),S=!!(_&&s&&(d.view===`root`||v)&&b.trim()),C=tc({path:y||`.`,basePath:s,includeFiles:d.view===`files`,enabled:x}),w=$N({basePath:s,query:b,enabled:S}),T=x?C:w,E=(0,G.useMemo)(()=>x?tP({entries:C.data?.entries??[],parentRelativePath:y}):w.data?.entries??[],[x,y,C.data?.entries,w.data?.entries]),{panelApps:D,projects:O,systemObjects:k}=nP({inputSurfaceTrigger:p,isContextReferenceTrigger:_,query:b,referenceLocation:d}),A=(0,G.useMemo)(()=>ZN({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,G.useMemo)(()=>Us({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 iP=en.chat.modelFavorites,aP=[`preference`,iP];function oP(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 sP(e){let t=Dt(),n=(0,G.useMemo)(()=>new Set(e),[e]),r=R({queryKey:aP,queryFn:()=>Oe(iP),staleTime:3e4}),i=(0,G.useMemo)(()=>oP(r.data?.value),[r.data?.value]),a=(0,G.useMemo)(()=>i.filter(e=>n.has(e)),[n,i]),o=He({mutationFn:async e=>await A(iP,e),onMutate:async e=>{await t.cancelQueries({queryKey:aP});let n=t.getQueryData(aP);return t.setQueryData(aP,{key:iP,value:e,updatedAt:new Date().toISOString()}),{previous:n}},onError:(e,n,r)=>{r?.previous&&t.setQueryData(aP,r.previous)},onSuccess:e=>{t.setQueryData(aP,e)}}),s=(0,G.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 cP=new Kj({storageKey:`nextclaw.chat.recent-skills`,limit:5});function lP(e){let{addAttachments:t,attachmentSupported:n,inputBarRef:r}=e,i=(0,G.useCallback)(e=>{if(e===`unsupported-type`){z.error(U(`chatInputAttachmentUnsupported`));return}if(e===`too-large`){z.error(U(`chatInputAttachmentTooLarge`).replace(`{maxMb}`,String(rA/(1024*1024))));return}z.error(U(`chatInputAttachmentReadFailed`))},[]),a=(0,G.useCallback)(async e=>{if(!n||e.length===0)return;let a=await cA(e,{uploadBatch:ne});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,G.useCallback)(async e=>{let t=Array.from(e.target.files??[]);e.currentTarget.value=``,await a(t)},[a])}}function uP(e){let{inputBarRef:t,intentManager:n,selectedSessionKey:r}=e;(0,G.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`||e.kind===`system_object`?{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 dP(e){return(0,G.useCallback)(t=>{let n=[...t];e.update(e=>({nodes:n,attachments:uO(n,e.attachments),text:oO(n),selectedSkills:sO(n),sendError:null}))},[e])}function fP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function pP(e){let{inputActions:t,selectedSessionKey:n}=e,r=Ks(),i=(0,G.useRef)(0),a=(0,G.useRef)(new Map),o=(0,G.useRef)(Promise.resolve());return(0,G.useCallback)((e,s,c)=>{let l=n?.trim();if(!l)return;let u=++i.current,d=`${l}:model`,f=`${l}:thinking`;fP(e,`preferredModel`)&&a.current.set(d,u),fP(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 fP(e,`preferredModel`)&&a.current.get(d)===u&&t.selectedModel===s.selectedModel&&fP(c,`selectedModel`)&&(n.selectedModel=c.selectedModel),fP(e,`preferredThinking`)&&a.current.get(f)===u&&t.selectedThinkingLevel===s.selectedThinkingLevel&&fP(c,`selectedThinkingLevel`)&&(n.selectedThinkingLevel=c.selectedThinkingLevel),n})})},[t,n,r])}function mP(e){let{language:t,onContextCompactingChange:n,onSendPresetMessage:r,selectedSessionKey:i}=e,a=q(),o=(0,G.useRef)(new Set),s=(0,G.useCallback)(async e=>{if(!o.current.has(e)){o.current.add(e),n?.(e,!0);try{await xt(e),z.success(U(`chatSlashCommandCompactContextSuccess`,t))}catch(e){let n=e instanceof Error?e.message:String(e);z.error(`${U(`chatSlashCommandCompactContextFailed`,t)}: ${n}`)}finally{o.current.delete(e),n?.(e,!1)}}},[t,n]);return(0,G.useMemo)(()=>{let e=i?.trim();return e?[{key:`side-chat`,icon:`message-square-plus`,title:U(`chatSlashCommandSideChatTitle`,t),description:U(`chatSlashCommandSideChatDescription`,t),detailLines:[U(`chatSlashCommandSideChatDetail`,t)],keywords:[`side`,`chat`,`child`,`branch`,`new`],onSelect:()=>a.chatThreadManager.openSideChatDraft(e)},{key:`update-session-title`,icon:`command`,title:U(`chatSlashCommandUpdateSessionTitleTitle`,t),description:U(`chatSlashCommandUpdateSessionTitleDescription`,t),detailLines:[U(`chatSlashCommandUpdateSessionTitleDetail`,t)],keywords:[`update`,`rename`,`title`,`session`,`更新`,`重命名`,`标题`,`会话`],onSelect:()=>void r(U(`chatSlashCommandUpdateSessionTitlePrompt`,t))},{key:`compact-context`,icon:`list-collapse`,title:U(`chatSlashCommandCompactContextTitle`,t),description:U(`chatSlashCommandCompactContextDescription`,t),detailLines:[U(`chatSlashCommandCompactContextDetail`,t)],keywords:[`compact`,`compress`,`context`,`summary`,`压缩`,`上下文`],onSelect:()=>void s(e)}]:[]},[s,t,r,a.chatThreadManager,i])}function hP(e){return(0,G.useCallback)(t=>{L.systemObjectReferences.resolve(t).then(t=>{e.current?.insertInputSurfaceToken({tokenKind:ln,tokenKey:t.uri,label:t.label,data:{reference:t}})}).catch(e=>{let t=e instanceof Error?e.message:U(`error`);z.error(`${U(`chatSystemObjectResolveFailed`)}: ${t}`)})},[e])}function gP(){return{off:U(`chatThinkingLevelOff`),minimal:U(`chatThinkingLevelMinimal`),low:U(`chatThinkingLevelLow`),medium:U(`chatThinkingLevelMedium`),high:U(`chatThinkingLevelHigh`),adaptive:U(`chatThinkingLevelAdaptive`),xhigh:U(`chatThinkingLevelXhigh`)}}function _P(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:b,thinkingDefaultLevel:x,thinkingSupportedLevels:S,unfavoriteModelLabel:C}=e;return[kN({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:U(`chatSelectModel`),modelNoOptionsLabel:U(`chatModelNoOptions`),modelSearchPlaceholder:u,modelSearchEmptyLabel:l,favoriteModelsLabel:i,favoriteModelLabel:n,unfavoriteModelLabel:C,manageModelsLabel:U(`chatManageModels`),discoveredModelsSummaryLabel:U(`chatDiscoveredModelsSummary`),discoveredModelsViewLabel:U(`chatDiscoveredModelsView`),discoveredModelsGroupLabel:U(`chatDiscoveredModelsGroup`),discoveredModelAddLabel:U(`chatDiscoveredModelAdd`),discoveredModelAddedLabel:U(`chatDiscoveredModelAddedShort`),discoveredModelsDismissLabel:U(`chatDiscoveredModelsDismiss`),discoveredModelsDoneLabel:U(`chatDiscoveredModelsDone`),discoveredModelsCloseLabel:U(`chatDiscoveredModelsClose`),recentModelsLabel:v,allModelsLabel:t}}),AN({supportedLevels:S,selectedThinkingLevel:b,defaultThinkingLevel:x,onValueChange:g,texts:{thinkingLabels:gP()}})].filter(e=>e!==null)}function vP(e){let{allSkillsLabel:t,isSkillsLoading:n,onSelectedKeysChange:r,recentSkillGroupValues:i,recentSkillValues:a,recentSkillsLabel:o,selectedSkills:s,skillRecords:c}=e;return VN({skillRecords:c,recentSkillValues:a,groupedRecentSkillValues:i,selectedSkills:[...s],isLoading:n,onSelectedKeysChange:r,texts:{title:U(`chatSkillsPickerTitle`),searchPlaceholder:U(`chatSkillsPickerSearchPlaceholder`),emptyLabel:U(`chatSkillsPickerEmpty`),loadingLabel:U(`sessionsLoading`),manageLabel:U(`chatSkillsPickerManage`),recentSkillsLabel:o,allSkillsLabel:t}})}function yP(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 bP({item:e}){let t=e.attachments??[],n=t.slice(0,3);return(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n.map((e,t)=>e.previewUrl?(0,K.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,K.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,K.jsx)(Fn,{className:`h-3 w-3 shrink-0`}),(0,K.jsx)(`span`,{className:`truncate`,children:e.name})]},`${e.name}-${t}`)),t.length>n.length?(0,K.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:[`+`,t.length-n.length]}):null,e.preview||t.length===0?(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground/80`,children:e.preview||U(`chatQueuedBannerAttachmentFallback`)}):null]})}function xP({children:e,disabled:t=!1,label:n,onClick:r}){return(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`span`,{className:`inline-flex`,children:(0,K.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-[var(--interaction-hover)] 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,K.jsx)(ui,{side:`top`,children:n})]})}function SP({controller:e}){return e.queuedInputs.length===0?null:(0,K.jsx)(ni,{delayDuration:120,children:(0,K.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.queuedInputs.map(t=>(0,K.jsxs)(`div`,{className:`flex min-h-8 min-w-0 items-center gap-2 text-sm`,children:[(0,K.jsx)(vo,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,K.jsx)(bP,{item:t}),t.isSubmitting?(0,K.jsxs)(`span`,{"aria-label":U(`chatQueuedSubmitting`),className:`inline-flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,K.jsx)(Rr,{className:`h-3.5 w-3.5 animate-spin`}),U(`chatQueuedSubmitting`)]}):(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,K.jsx)(xP,{disabled:!e.canEditQueuedInput,label:e.canEditQueuedInput?U(`chatQueuedEdit`):U(`chatQueuedEditComposerNotEmpty`),onClick:()=>e.editQueuedInput(t.id),children:(0,K.jsx)(Hn,{className:`h-4 w-4`})}),(0,K.jsx)(xP,{label:U(`chatQueuedSteer`),onClick:()=>e.steerQueuedInput(t.id),children:(0,K.jsx)(Do,{className:`h-4 w-4`})}),(0,K.jsx)(xP,{label:U(`chatQueuedDelete`),onClick:()=>e.deleteQueuedInput(t.id),children:(0,K.jsx)(Jr,{className:`h-4 w-4`})})]})]},t.id))})})}function CP({inputSnapshot:e,controller:t}){let n=e.pendingSubmission,r=n&&n.status!==`sending`;return!r&&t.queuedInputs.length===0?null:(0,K.jsxs)(K.Fragment,{children:[t.queuedInputs.length>0&&(0,K.jsx)(SP,{controller:t}),r&&(0,K.jsx)(wP,{submission:n,controller:t,hasComposerContent:!!(e.text.trim()||e.selectedSkills.length||e.attachments.length)})]})}function wP({submission:e,controller:t,hasComposerContent:n}){return(0,K.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm`,role:`status`,children:[(0,K.jsx)(`p`,{children:e.status===`rejected`?U(`chatSubmissionRejected`):U(e.envelope.sessionId?`chatSendResultUnknown`:`chatSendResultUnknownChild`)}),(0,K.jsx)(`p`,{className:`mt-1 max-h-16 overflow-auto whitespace-pre-wrap text-muted-foreground`,children:e.composer.text}),(0,K.jsxs)(`div`,{className:`mt-2 flex gap-3`,children:[e.status===`uncertain`&&e.envelope.sessionId&&(0,K.jsx)(`button`,{type:`button`,className:`text-primary underline`,onClick:t.retryPendingSubmission,children:U(`chatSubmissionRetry`)}),e.status===`rejected`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,className:`text-primary underline`,disabled:n,onClick:t.restorePendingSubmission,children:U(`chatSubmissionRestore`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-muted-foreground underline`,onClick:()=>{window.confirm(U(`chatSubmissionDiscardConfirm`))&&t.discardPendingSubmission()},children:U(`chatSubmissionDiscard`)})]})]})]})}function TP(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 EP(e){let{skillGroupLabels:t,skillScopeLabels:n}=(0,G.useMemo)(()=>({skillScopeLabels:{builtin:U(`chatSkillScopeBuiltin`),global:U(`chatSkillScopeGlobal`),project:U(`chatSkillScopeProject`),workspace:U(`chatSkillScopeWorkspace`)},skillGroupLabels:{builtin:U(`chatSkillGroupBuiltin`),global:U(`chatSkillGroupGlobal`),project:U(`chatSkillGroupProject`),workspace:U(`chatSkillGroupWorkspace`)}}),[e]);return{skillScopeLabels:n,skillGroupLabels:t,slashTexts:(0,G.useMemo)(()=>({slashSkillSubtitle:U(`chatSlashTypeSkill`),slashSkillSpecLabel:U(`chatSlashSkillSpec`),slashSkillScopeLabel:U(`chatSlashSkillScope`),noSkillDescription:U(`chatSkillsPickerNoDescription`)}),[e]),recentModelsLabel:U(`chatPickerRecentModels`),allModelsLabel:U(`chatPickerAllModels`),favoriteModelsLabel:U(`chatPickerFavoriteModels`),modelSearchPlaceholder:U(`chatModelSearchPlaceholder`),modelSearchEmptyLabel:U(`chatModelSearchEmpty`),favoriteModelLabel:U(`chatFavoriteModel`),unfavoriteModelLabel:U(`chatUnfavoriteModel`),recentSkillsLabel:U(`chatPickerRecent`),allSkillsLabel:U(`chatPickerAllSkills`)}}function DP(e){let{modelOptions:t,skillGroupLabels:n,skillRecords:r,skillScopeLabels:i}=e,a=(0,G.useMemo)(()=>TP(r,i,n),[n,i,r]),o=(0,G.useMemo)(()=>EN(t),[t]);return{skillRecords:a,modelRecords:o,recentModelValues:qj.resolveVisible({availableValues:o.map(e=>e.value),minAvailableCount:5}),recentSkillValues:cP.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:0}),recentSkillGroupValues:cP.resolveVisible({availableValues:a.map(e=>e.key),minAvailableCount:4})}}var OP=(0,G.memo)(function(e){let{contextWindow:t,controller:n,inputActions:r,inputQuery:i,inputSnapshot:a,onContextCompactingChange:o,placeholder:s,surface:c=`default`}=e,l=q(),{language:u}=d(),f=hg(e=>e.layout),{isMobile:p}=Gr(),m=(0,G.useRef)(null),h=(0,G.useRef)(null),g=EP(u),{skillRecords:_,modelRecords:v,recentModelValues:y,recentSkillValues:b,recentSkillGroupValues:x}=DP({modelOptions:i.modelOptions,skillRecords:i.skillRecords,skillGroupLabels:g.skillGroupLabels,skillScopeLabels:g.skillScopeLabels}),S=(0,G.useMemo)(()=>EN(i.discoveredModelOptions),[i.discoveredModelOptions]),C=mP({language:u,onContextCompactingChange:o,onSendPresetMessage:n.sendPresetMessage,selectedSessionKey:i.selectedSessionKey}),w=(0,G.useCallback)(e=>void l.chatUiManager.showContent({target:{type:`panel_app`,payload:{appId:e}}}),[l.chatUiManager]),T=i.selectedSessionKey?i.selectedSession?.projectRoot??i.defaultProjectRoot??``:a.pendingProjectRoot??i.defaultProjectRoot??``,E=hP(m),{inputSurfaceState:D,setInputSurfaceTrigger:O}=rP({commands:C,isSkillsLoading:i.isSkillsLoading,itemTexts:{slashTexts:g.slashTexts},language:u,onSelectPanelApp:w,onSelectSkill:cP.remember,onSelectSystemObject:E,projectRoot:T,recentSkillValues:b,skillRecords:_}),{favoriteModelValues:k,setModelFavorite:A}=sP((0,G.useMemo)(()=>v.map(e=>e.value),[v])),j=a.selectedModel??``,M=a.selectedThinkingLevel,N={isProviderStateResolved:i.isProviderStateResolved,modelOptions:i.modelOptions,sessionTypeUnavailable:i.sessionTypeState.sessionTypeUnavailable},P=ej(N),ee=tj(N),te=nj(N),F=rj(N),ne=te?U(`chatModelNoOptions`):s??U(p?`chatInputPlaceholderCompact`:`chatInputPlaceholder`),I=v.find(e=>e.value===j),re=I?.thinkingCapability?.supported??[],{handleFilesAdd:ie,handleFileInputChange:ae}=lP({attachmentSupported:!0,inputBarRef:m,addAttachments:r.addAttachments}),oe=pP({inputActions:r,selectedSessionKey:i.selectedSessionKey}),se=dP(r),ce=l.chatVoiceInputManager,le=JSON.stringify([i.selectedSessionKey,i.sessionTypeState.selectedSessionType,T,j,F]),ue=(0,G.useCallback)(()=>m.current?.beginDictation(ce.cancel)??null,[ce]),de=zM(ce,le,u,!p&&!F,ue),fe=()=>ce.start(u,le,ue()),L=()=>(ce.acceptDraft(),n.send()),pe=()=>(ce.acceptDraft(),n.sendSteering());uP({inputBarRef:m,intentManager:l.chatComposerIntentManager,selectedSessionKey:i.selectedSessionKey});let me=(0,G.useCallback)(e=>{let t=yP(v.find(t=>t.value===e)??S.find(t=>t.value===e),M);r.update({selectedModel:e,selectedThinkingLevel:t,sendError:null}),qj.remember(e,{namespace:i.sessionTypeState.selectedSessionType}),Ie(e)||qj.remember(e),oe({preferredModel:Ie(e)?null:e,preferredThinking:t},{selectedModel:e,selectedThinkingLevel:t},{selectedModel:j,selectedThinkingLevel:M})},[r,S,i.sessionTypeState.selectedSessionType,v,M,oe,j]),he=(0,G.useCallback)(async e=>{let t=await i.addDiscoveredModel(e);if(!t)throw z.error(U(`chatDiscoveredModelUnavailable`)),Error(`Discovered provider model is no longer available.`);z.success(U(`chatDiscoveredModelAdded`).replace(`{model}`,t.modelLabel))},[i]),ge=(0,G.useCallback)(e=>{r.setSelectedThinkingLevel(e),oe({preferredThinking:e},{selectedThinkingLevel:e},{selectedThinkingLevel:M})},[r,oe,M]),_e=(0,G.useCallback)(e=>{let t=a.selectedSkills;e.filter(e=>!t.includes(e)).forEach(e=>cP.remember(e)),se(lO([...a.nodes],e,i.skillRecords.map(e=>({ref:e.ref,name:e.name}))))},[se,i.skillRecords,a.nodes,a.selectedSkills]);(0,G.useEffect)(()=>{a.composerFocusRequestId&&(m.current?.focusComposerAtEnd([...a.nodes]),r.consumeComposerFocusRequest())},[r,a.composerFocusRequestId,a.nodes]);let ve=_P({allModelsLabel:g.allModelsLabel,favoriteModelLabel:g.favoriteModelLabel,favoriteModelValues:k,favoriteModelsLabel:g.favoriteModelsLabel,hasModelOptions:P,isModelOptionsLoading:ee,discoveredModelRecords:S,modelRecords:v,modelSearchEmptyLabel:g.modelSearchEmptyLabel,modelSearchPlaceholder:g.modelSearchPlaceholder,onFavoriteModelToggle:A,onDiscoveredModelSelect:he,onDiscoveredModelsDismiss:i.dismissDiscoveredModels,onModelSelectOpen:()=>{i.refreshProviderModelCatalog()},onModelChange:me,onThinkingChange:ge,recentModelValues:y,recentModelsLabel:g.recentModelsLabel,selectedModel:j,selectedThinkingLevel:M,thinkingSupportedLevels:re,thinkingDefaultLevel:I?.thinkingCapability?.default??null,unfavoriteModelLabel:g.unfavoriteModelLabel}),ye=vP({allSkillsLabel:g.allSkillsLabel,onSelectedKeysChange:_e,recentSkillGroupValues:x,recentSkillValues:b,recentSkillsLabel:g.recentSkillsLabel,isSkillsLoading:i.isSkillsLoading,skillRecords:_,selectedSkills:a.selectedSkills}),be=(0,G.useMemo)(()=>[...a.nodes],[a.nodes]),xe=c===`default`&&f===`flat`,Se=(0,K.jsx)(hr,{ref:m,surface:xe?`embedded`:c,topSlot:(0,K.jsx)(CP,{inputSnapshot:a,controller:n}),floatingSlot:de.phase===`idle`?null:(0,K.jsx)(IM,{manager:ce,snapshot:de,desktop:!p,onStart:fe}),composer:{nodes:be,placeholder:ne,excerptCharacterCountTemplate:U(`chatWorkspaceExcerptCharacterCount`),removeTokenLabel:U(`chatInputRemoveReference`),disabled:F,onNodesChange:se,onFilesAdd:ie,inputSurfaceTriggerSpecs:D.triggerSpecs,onInputSurfaceTriggerChange:O},inputSurface:D.panel??void 0,hint:DN({isModelOptionsEmpty:te,onGoToProviders:l.chatUiManager.goToProviders,texts:{noModelOptionsLabel:U(`chatModelNoOptions`),configureProviderLabel:U(`chatGoConfigureProvider`)}}),toolbar:{addMenuLabel:U(`chatInputAdd`),leadingSlot:(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(W,{icon:de.phase===`recording`?(0,K.jsx)(Ds,{className:`h-4 w-4`}):(0,K.jsx)(Xo,{className:`h-4 w-4`}),label:U(de.phase===`recording`?`chatInputVoiceSaveAndClose`:`chatInputVoice`),tooltip:de.phase===`recording`?U(`chatInputVoiceEscapeHint`):void 0,size:`lg`,disabled:F||de.phase===`stopping`,"aria-pressed":de.phase===`recording`,onClick:()=>de.phase===`recording`||de.phase===`starting`?ce.saveAndClose():fe()})}),selects:[],trailingSelects:ve,accessories:[{key:`attach`,label:U(`chatInputAttach`),icon:`paperclip`,disabled:F,onClick:()=>h.current?.click()}],skillPicker:ye,actions:{isSending:n.isSending,canStopGeneration:n.canStopGeneration,sendDisabled:n.sendDisabled,stopDisabled:n.stopDisabled,stopHint:U(`chatStopUnavailable`),sendButtonLabel:n.primaryAction===`continue`?U(`chatContinueRun`):U(`chatSend`),sendIcon:n.primaryAction,stopButtonLabel:U(`chatStop`),contextWindow:t,onSend:L,onAlternateSend:pe,onStop:n.stop}}});return(0,K.jsxs)(K.Fragment,{children:[xe?(0,K.jsx)(gg,{className:`pb-4 pt-2`,width:`composer`,children:Se}):Se,(0,K.jsx)(`input`,{ref:h,type:`file`,multiple:!0,className:`hidden`,onChange:ae})]})});function kP(e){let{applyPromptSuggestion:t,applySystemObjectReference:n,consumeDraftIntent:r}=e,i=$(),a=q();(0,G.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 AP(e){if(!e||typeof e!=`object`)return null;let t=e.chatDraft;return!t||typeof t!=`object`?null:t}function jP(e){let{applyPromptSuggestion:t,sessionKey:n,setPendingProjectRoot:r,setPendingSessionType:i}=e,a=mn(),o=(0,G.useRef)(null);(0,G.useEffect)(()=>{if(n)return;let e=AP(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 MP({inputQuery:e}){let t=q(),n=e.isProviderStateResolved&&e.modelOptions.length===0,r=e.sessionTypeState.sessionTypeUnavailableMessage?.trim()||null;return(0,K.jsxs)(K.Fragment,{children:[n?(0,K.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,K.jsx)(`span`,{className:`text-xs text-amber-800`,children:U(`chatModelNoOptions`)}),(0,K.jsx)(`button`,{type:`button`,onClick:t.chatUiManager.goToProviders,className:`text-xs font-semibold text-amber-900 underline-offset-2 hover:underline`,children:U(`chatGoConfigureProvider`)})]}):null,e.sessionTypeState.sessionTypeUnavailable&&r?(0,K.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,K.jsx)(`span`,{className:`text-xs text-amber-800`,children:r})}):null]})}function NP(e){let{consumeDraftIntent:t=!1,materializationContext:n=null,onSessionMaterialized:r,sessionKey:i,showWelcomeForDraft:a=!0}=e,o=mn(),s=i?null:AP(o.state),c=typeof s?.prompt==`string`?s.prompt:null,l=Et(),u=J(e=>e.snapshot.selectedAgentId),d=kA(i??void 0),f=EM(i),{inputActions:p,inputSnapshot:m}=wM(c,i),h=(0,G.useCallback)(e=>{p.update(t=>{let n=o_(t.nodes,e);return{nodes:n,text:oO(n),composerFocusRequestId:Date.now(),sendError:null}})},[p]),g=sM({sessionKey:i,inputSnapshot:m,setPendingSessionType:p.setPendingSessionType}),[_,v]=(0,G.useState)(()=>new Set),y=(0,G.useCallback)((e,t)=>{v(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,G.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]),jP({applyPromptSuggestion:p.applyPromptSuggestion,sessionKey:i,setPendingProjectRoot:p.setPendingProjectRoot,setPendingSessionType:p.setPendingSessionType});let b=AA(l),x=d.snapshot.error,S=d.hydrateError?.message??(x?.code===`run-interrupted`?null:x?.message)??null,C=l.phase===`ready`&&TA(S)?null:S,w=b?null:l.phase===`ready`?C:MA({message:C,status:l}),T=Tj({agent:d,inputSnapshot:m,inputQuery:g,isRuntimeBlocked:b,materializationContext:n,runQueue:f,selectedAgentId:u,sessionKey:i,onSessionMaterialized:r,restoreComposer:p.restoreComposer,beginSubmission:p.beginSubmission,acceptSubmission:p.acceptSubmission,failSubmission:p.failSubmission,restoreSubmission:p.restoreSubmission,discardSubmission:p.discardSubmission,setSendError:p.setSendError}),E=(0,G.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]),D=(0,G.useRef)(T);(0,G.useEffect)(()=>{D.current=T},[T]);let O=(0,G.useMemo)(()=>({canEditQueuedInput:T.canEditQueuedInput,canStopGeneration:T.canStopGeneration,deleteQueuedInput:e=>D.current.deleteQueuedInput(e),editQueuedInput:e=>D.current.editQueuedInput(e),isSending:T.isSending,primaryAction:T.primaryAction,queuedInputs:T.queuedInputs,send:()=>D.current.send(),sendSteering:()=>D.current.sendSteering(),sendPresetMessage:e=>D.current.sendPresetMessage(e).catch(()=>void 0),retryPendingSubmission:()=>D.current.retryPendingSubmission(),restorePendingSubmission:()=>D.current.restorePendingSubmission(),discardPendingSubmission:()=>D.current.discardPendingSubmission(),sendDisabled:T.sendDisabled,stop:()=>D.current.stop(),stopDisabled:T.stopDisabled,steerQueuedInput:e=>D.current.steerQueuedInput(e)}),[T.canStopGeneration,T.canEditQueuedInput,T.isSending,T.primaryAction,T.queuedInputs,T.sendDisabled,T.stopDisabled]),k=(0,G.useMemo)(()=>PA(Ay(d.snapshot.contextWindow)),[d.snapshot.contextWindow]),{selectedSession:A}=g,j=m.sendError?.trim()||w?.trim()||(A?.activityPreview?.state===`failed`&&A.activityPreview.statusKind!==`run-interrupted`?A.activityPreview.statusText?.trim():null)||null,M=j?(0,K.jsx)(`div`,{className:`rounded-lg border-l-2 border-destructive/40 bg-muted/45 px-3 py-2.5`,role:`status`,children:(0,K.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:j})}):null;kP({consumeDraftIntent:t,applyPromptSuggestion:p.applyPromptSuggestion,applySystemObjectReference:h});let N=(0,G.useCallback)((e,t)=>(0,K.jsx)(OP,{contextWindow:k,controller:O,inputActions:p,inputQuery:g,inputSnapshot:m,onContextCompactingChange:y,placeholder:t,surface:e}),[k,O,p,g,m,y]),P=a&&!i&&E.length===0&&!d.isHydrating&&!T.isSending;return(0,K.jsxs)(Ug,{sessionId:i,disabled:b,onResolved:async e=>{await d.acceptRun(e)},children:[(0,K.jsx)(MP,{inputQuery:g}),(0,K.jsx)(IO,{resourceWorkingDir:A?.workingDir??A?.projectRoot??null,hasPreviousMessages:d.hasPreviousMessages,historyError:d.historyError,isHistoryLoading:d.isHydrating,isLoadingPreviousMessages:d.isLoadingPreviousMessages,isSending:T.isSending,canContinue:T.canContinue,messageActionsDisabled:T.isSending||b,isContextCompacting:!!(i&&_.has(i)),bottomSlot:P?null:M,messages:E,messageDetailStates:d.messageDetailStates,sessionKey:i,showWelcome:P,onLoadPreviousMessages:d.loadPreviousMessages,onLoadMessageDetails:d.loadMessageDetails,onContinueRun:()=>D.current.continueRun(),onEditMessage:e=>D.current.editMessage(e),welcomeSlot:(0,K.jsx)($A,{hasDraftContent:!!(m.text.trim()||m.attachments.length||m.selectedSkills.length),inputSlot:(0,K.jsxs)(`div`,{className:`space-y-2`,children:[N(`embedded`,U(`chatWelcomeInputPlaceholder`)),M]}),pendingProjectRoot:m.pendingProjectRoot,pendingSessionType:m.pendingSessionType,selectedSessionTypeValue:m.selectedSessionType,onSelectProjectRoot:p.setPendingProjectRoot,onSelectPrompt:p.applyPromptSuggestion,onSelectSessionType:p.setPendingSessionType})}),P?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qg,{}),N(`default`)]})]})}function PP(e){return Zr(e??void 0)}function FP(e){if(!e)return`-`;let t=new Date(e);if(Number.isNaN(t.getTime()))return`-`;let n=Date.now(),r=t.getTime()-n,i=Xr(),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 IP(e){return typeof e!=`number`||!Number.isFinite(e)?`-`:Zr(new Date(e))}function LP(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 RP=[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],zP=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function BP(e){return e.padStart(2,`0`)}function VP(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=`${BP(i)}:${BP(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?RP[e]:zP[e];return t?`${t} ${l}`:null}return r!==`*`&&i!==`*`&&a!==`*`&&o===`*`&&s===`*`?c?`每月 ${a} 日 ${l}`:`monthly ${a} ${l}`:null}function HP(e){let t=Xr(),n=t===`zh`,{schedule:r}=e;if(r.kind===`cron`)return r.expr?VP(r.expr,t)??`cron ${r.expr}`:`cron`;if(r.kind===`every`){let e=LP(r.everyMs);return n?`每 ${e}`:`every ${e}`}return r.kind===`at`?`${n?`定时`:`at`} ${IP(r.atMs)}`:`-`}function UP(e){return e.payload.sessionId?.trim()||`cron:${e.id}`}function WP(e){return!!(e.payload.sessionId?.trim()||e.state.lastRunAt)}function GP(e,t){let n=t?.trim();return!!(n&&e.payload.sessionId?.trim()===n)}function KP({job:e}){let t=e.state.lastStatus===`error`,n=t?U(`cronNeedsAttention`):e.enabled?U(`cronRunningNormally`):U(`cronPaused`);return(0,K.jsxs)(`span`,{className:V(`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,K.jsx)(`span`,{className:V(`h-1.5 w-1.5 rounded-full`,t?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-muted-foreground/50`)}),n]})}function qP({expanded:e,job:t,onDelete:n,onEdit:r,onRun:i,onToggleExpanded:a,onToggle:o}){let[s,c]=(0,G.useState)(!1),l=!!t.payload.sessionId?.trim(),u=t.state.lastStatus===`error`,d=u?En:jr,f=t.name||t.id,p=`cron-job-preview-${t.id}`,m=UP(t),h=WP(t)?Vs(m):null;return(0,K.jsxs)(`div`,{className:V(`group relative rounded-xl border-b border-border/55 transition-colors duration-150 last:border-b-0 hover:bg-[var(--interaction-hover)] focus-within:bg-[var(--interaction-hover)]`,e&&`bg-muted/35`),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 px-1 py-3.5`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`grid min-w-0 flex-1 max-md:basis-full grid-cols-[36px_minmax(0,1fr)] items-center gap-3 rounded-lg md:pr-16 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-controls":p,"aria-expanded":e,"aria-label":`${U(e?`cronCollapseTask`:`cronExpandTask`)} ${f}`,onClick:()=>a(t),children:[(0,K.jsx)(`span`,{className:V(`flex h-9 w-9 items-center justify-center rounded-xl`,u?`bg-amber-50 text-amber-600`:`bg-emerald-50 text-emerald-600`),children:(0,K.jsx)(d,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`strong`,{className:`truncate text-[13px] font-semibold text-foreground`,children:f}),(0,K.jsx)(KP,{job:t}),(0,K.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:U(l?`cronBoundSession`:`cronDedicatedSession`)}),t.deleteAfterRun?(0,K.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:U(`cronOneShot`)}):null]}),(0,K.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(Un,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),HP(t)]}),t.state.nextRunAt?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(ho,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),U(`cronNextRun`),` `,FP(t.state.nextRunAt)]}):null]})]})]}),(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(`div`,{className:`relative flex shrink-0 items-center gap-1 max-md:ml-auto`,children:[(0,K.jsx)(Me,{checked:t.enabled,onCheckedChange:e=>o(t,e),"aria-label":t.enabled?U(`cronDisable`):U(`cronEnable`)}),(0,K.jsxs)(`div`,{className:`flex items-center gap-0.5 opacity-100 transition-opacity duration-150 md:[@media(hover:hover)]:pointer-events-none md:[@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,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(B,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t),"aria-label":`${U(`cronEditDetails`)} ${f}`,children:(0,K.jsx)(Hn,{className:`h-3.5 w-3.5`})})}),(0,K.jsx)(ui,{children:U(`cronEditDetails`)})]}),(0,K.jsxs)(_i,{open:s,onOpenChange:c,children:[(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(B,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":`${U(`cronMoreActions`)} ${f}`,children:(0,K.jsx)(wr,{className:`h-4 w-4`})})})}),(0,K.jsx)(ui,{children:U(`cronMoreActions`)})]}),(0,K.jsxs)(hi,{align:`end`,sideOffset:4,variant:`menu`,children:[(0,K.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{c(!1),i(t)},className:`${$n} text-foreground ${tr.item}`,children:[(0,K.jsx)(Bn,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),U(`cronRunNow`)]}),(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{c(!1),n(t)},className:`${$n} ${tr.destructive}`,children:[(0,K.jsx)(Jr,{className:`h-4 w-4 shrink-0`}),U(`delete`)]}),(0,K.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,K.jsx)(Mz,{page:Ez(`cron-job`,t.id,f),onSelect:()=>c(!1)})]})]})]})]})})]}),(0,K.jsx)(`div`,{id:p,"aria-hidden":!e,className:V(`grid transition-[grid-template-rows,opacity] duration-200 ease-out`,e?`grid-rows-[1fr] opacity-100`:`grid-rows-[0fr] opacity-0`),children:(0,K.jsx)(`div`,{className:`overflow-hidden`,children:(0,K.jsxs)(`div`,{className:`mb-3 ml-12 mr-1 rounded-xl bg-background/70 px-4 py-3`,children:[(0,K.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-[0.1em] text-muted-foreground`,children:U(`cronTaskPrompt`)}),(0,K.jsx)(`p`,{className:`mt-1.5 line-clamp-4 text-xs leading-5 text-foreground`,children:t.payload.message}),(0,K.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,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:U(`cronAgentLabel`)}),(0,K.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:t.payload.agentId?.trim()||`main`})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:U(`cronSessionLabel`)}),(0,K.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:h?(0,K.jsx)(_n,{href:h,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:m}):m})]}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`dt`,{className:`text-muted-foreground`,children:U(`cronLastRun`)}),(0,K.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-foreground`,children:PP(t.state.lastRunAt)})]})]}),t.state.lastError?(0,K.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 JP=[{titleKey:`cronTemplateAiNewsTitle`,descriptionKey:`cronTemplateAiNewsDescription`,promptKey:`cronTemplateAiNewsPrompt`,icon:es},{titleKey:`cronTemplateWeeklyReviewTitle`,descriptionKey:`cronTemplateWeeklyReviewDescription`,promptKey:`cronTemplateWeeklyReviewPrompt`,icon:so},{titleKey:`cronTemplateMeetingPrepTitle`,descriptionKey:`cronTemplateMeetingPrepDescription`,promptKey:`cronTemplateMeetingPrepPrompt`,icon:oo},{titleKey:`cronTemplateLearningTitle`,descriptionKey:`cronTemplateLearningDescription`,promptKey:`cronTemplateLearningPrompt`,icon:Ar},{titleKey:`cronTemplateCompetitorTitle`,descriptionKey:`cronTemplateCompetitorDescription`,promptKey:`cronTemplateCompetitorPrompt`,icon:Vo},{titleKey:`cronTemplateFamilyTitle`,descriptionKey:`cronTemplateFamilyDescription`,promptKey:`cronTemplateFamilyPrompt`,icon:Mo}],YP=(0,G.forwardRef)(function({prominent:e=!1,value:t,onChange:n,onSubmit:r},i){return(0,K.jsxs)(`form`,{className:V(`relative w-full`,e&&`mx-auto max-w-3xl`),onSubmit:e=>{e.preventDefault(),r()},children:[(0,K.jsx)(_r,{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,K.jsx)(F,{ref:i,value:t,onChange:e=>n(e.target.value),className:`pl-9 pr-11`,placeholder:U(`cronComposerPlaceholder`),"aria-label":U(`cronComposerLabel`)}),(0,K.jsx)(B,{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":U(`cronComposerSubmit`),children:(0,K.jsx)(Kn,{className:`h-4 w-4`})})]})});function XP({compact:e=!1,onSelect:t}){return(0,K.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,17.5rem),1fr))] gap-3`,children:(e?JP.slice(0,4):JP).map(e=>{let n=e.icon;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>t(U(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,K.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-[var(--interaction-hover)] group-hover:text-primary`,children:(0,K.jsx)(n,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`strong`,{className:`block text-sm font-medium text-foreground`,children:U(e.titleKey)}),(0,K.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-muted-foreground`,children:U(e.descriptionKey)})]})]},e.titleKey)})})}function ZP(e={all:!0}){return R({queryKey:[`cron`,e],queryFn:()=>ut(e),placeholderData:e=>e,staleTime:1e4})}function QP(){let e=Dt();return{onSuccess:()=>{e.invalidateQueries({queryKey:[`cron`]}),z.success(U(`configSavedApplied`))},onError:e=>{z.error(U(`configSaveFailed`)+`: `+e.message)}}}function $P(){return He({mutationFn:({id:e})=>bt(e),...QP()})}function eF(){return He({mutationFn:({id:e,enabled:t})=>an(e,{enabled:t}),...QP()})}function tF(){return He({mutationFn:({id:e,force:t})=>Qe(e,{force:t}),...QP()})}function nF(e){return e.name?`${e.name} (${e.id})`:e.id}function rF(){let e=$P(),t=tF(),n=eF(),{confirm:r,ConfirmDialog:i}=xx(),[a,o]=(0,G.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:`${U(`cronDeleteConfirm`)}?`,description:nF(t),confirmLabel:U(`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:`${U(`cronRunForceConfirm`)}?`,description:nF(e),confirmLabel:U(`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 iF=10;function aF({summary:e}){let{attention:t,disabled:n,enabled:r,total:i}=e,a=[{label:U(`cronSummaryTotal`),value:i},{label:U(`cronSummaryEnabled`),value:r},{label:U(`cronSummaryPaused`),value:n}],o=t>0?ur:uo;return(0,K.jsxs)(`section`,{"aria-label":U(`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,K.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,K.jsx)(`span`,{className:V(`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,K.jsx)(o,{className:`h-4 w-4`,"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`min-w-0`,children:[(0,K.jsx)(`strong`,{className:`block truncate text-xs font-semibold text-foreground`,children:t>0?`${t} ${U(`cronAttentionSummary`)}`:U(`cronAllHealthy`)}),(0,K.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:U(t>0?`cronAttentionSummaryHint`:`cronAllHealthyHint`)})]})]}),a.map(e=>(0,K.jsxs)(`div`,{className:`bg-muted/40 px-4 py-3.5 sm:px-5`,children:[(0,K.jsx)(`div`,{className:`text-lg font-semibold tabular-nums text-foreground`,children:e.value}),(0,K.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.label})]},e.label))]})}function oF({page:e,total:t,disabled:n,onPageChange:r}){let i=Math.ceil(t/iF);if(i<=1)return null;let a=e*iF+1,o=Math.min(t,a+iF-1);return(0,K.jsxs)(`nav`,{"aria-label":U(`cronPaginationLabel`),className:`flex items-center justify-between gap-3 border-b border-border/60 py-3 text-xs text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`tabular-nums`,children:[a,`–`,o,` / `,t]}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e===0,onClick:()=>r(e-1),"aria-label":U(`cronPreviousPage`),children:(0,K.jsx)(er,{className:`h-4 w-4`})}),(0,K.jsxs)(`span`,{className:`min-w-14 text-center tabular-nums text-foreground`,children:[e+1,` / `,i]}),(0,K.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8`,disabled:n||e>=i-1,onClick:()=>r(e+1),"aria-label":U(`cronNextPage`),children:(0,K.jsx)(nr,{className:`h-4 w-4`})})]})]})}function sF(){let e=$(),t=fn(),[n,r]=(0,G.useState)(``),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(`all`),[c,l]=(0,G.useState)(0),[u,d]=(0,G.useState)(null),f=(0,G.useDeferredValue)(i.trim()),p=(0,G.useRef)(null),m=q(),h=ZP({all:!0,limit:iF,offset:c*iF,query:f,status:o}),g=rF(),_=h.data?.jobs??[],v=h.data?.total??0,y=h.data?.summary,b=()=>{let e=n.trim();if(!e){p.current?.focus();return}m.chatSessionListManager.createSession({prompt:e})},S=e=>{r(e),p.current?.focus()},C=e=>{g.deleteJob(e,()=>{d(null),_.length===1&&c>0&&l(c-1)})},w=(e,t)=>{g.toggleJob(e,t,()=>{(o===`enabled`&&!t||o===`disabled`&&t)&&_.length===1&&c>0&&l(c-1)})},T=e=>{g.runJob(e)},E=e=>{d(null),l(e)},D=e=>{d(t=>t===e.id?null:e.id)},O=(y?.total??0)>0;return(0,K.jsxs)(x,{className:`space-y-6`,children:[(0,K.jsx)(Ce,{mobileTitleInShell:!0,headingLevel:1,title:U(`cronPageTitle`),description:U(`cronPageDescription`),actions:(0,K.jsx)(W,{size:`lg`,label:U(`refresh`),icon:(0,K.jsx)(qr,{className:V(`h-4 w-4`,h.isFetching&&`animate-spin`)}),onClick:()=>{c===0?(d(null),h.refetch()):E(0)}})}),O?(0,K.jsx)(YP,{ref:p,value:n,onChange:r,onSubmit:b}):null,h.isLoading?(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-20 text-muted-foreground`,children:[(0,K.jsx)(qr,{className:`mb-3 h-5 w-5 animate-spin`}),(0,K.jsx)(`span`,{className:`text-sm`,children:U(`cronLoading`)})]}):O?(0,K.jsxs)(K.Fragment,{children:[y?(0,K.jsx)(aF,{summary:y}):null,(0,K.jsxs)(`section`,{className:`pt-1`,children:[(0,K.jsx)(`div`,{className:`mb-3 flex items-end justify-between gap-4`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:U(`cronMyTasks`)}),(0,K.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:[v,` `,U(`cronTaskCountUnit`)]})]})}),(0,K.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2.5`,children:[(0,K.jsxs)(`div`,{className:`relative min-w-[220px] flex-1`,children:[(0,K.jsx)(kr,{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,K.jsx)(F,{value:i,onChange:e=>{a(e.target.value),E(0)},placeholder:U(`cronSearchPlaceholder`),className:`pl-9`})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,"aria-label":U(`cronStatusLabel`),children:[[`all`,`cronStatusAll`],[`enabled`,`cronStatusEnabled`],[`disabled`,`cronStatusDisabled`],[`attention`,`cronStatusAttention`]].map(([e,t])=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>{s(e),E(0)},className:V(`rounded-lg px-2.5 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-[var(--interaction-hover)] hover:text-foreground`,o===e&&`bg-[var(--interaction-selection)] hover:bg-[var(--interaction-selection)] text-foreground`),children:U(t)},e))})]}),_.length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{"aria-busy":h.isFetching,className:V(`border-y border-border/60 transition-opacity`,h.isFetching&&`opacity-60`),children:_.map(n=>(0,K.jsx)(qP,{expanded:u===n.id,job:n,onDelete:C,onEdit:n=>e.pageResourceManager.open(Ez(`cron-job`,n.id,n.name||n.id),`default`,t),onRun:T,onToggleExpanded:D,onToggle:w},n.id))}),(0,K.jsx)(oF,{page:c,total:v,disabled:h.isFetching,onPageChange:E})]}):(0,K.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center text-muted-foreground`,children:[(0,K.jsx)(kr,{className:`mb-3 h-5 w-5`}),(0,K.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:U(`cronNoMatchingTasks`)}),(0,K.jsx)(`span`,{className:`mt-1 text-xs`,children:U(`cronNoMatchingTasksHint`)})]})]}),(0,K.jsxs)(`section`,{className:`pt-2`,children:[(0,K.jsxs)(`div`,{className:`mb-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:U(`cronNeedInspiration`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:U(`cronTemplateSelectionHint`)})]}),(0,K.jsx)(XP,{compact:!0,onSelect:S})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.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,K.jsx)(`span`,{className:`mb-4 flex h-11 w-11 items-center justify-center rounded-2xl bg-card shadow-sm`,children:(0,K.jsx)(fr,{className:`h-5 w-5 text-primary`})}),(0,K.jsx)(`h2`,{className:`text-xl font-semibold text-foreground`,children:U(`cronEmptyHeroTitle`)}),(0,K.jsx)(`p`,{className:`mb-6 mt-2 max-w-2xl text-sm leading-6 text-muted-foreground`,children:U(`cronEmptyHeroDescription`)}),(0,K.jsx)(YP,{ref:p,prominent:!0,value:n,onChange:r,onSubmit:b}),(0,K.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:U(`cronComposerHint`)})]}),(0,K.jsxs)(`section`,{children:[(0,K.jsxs)(`div`,{className:`mb-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:U(`cronStartFromResult`)}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:U(`cronTemplateSelectionHint`)})]}),(0,K.jsx)(XP,{onSelect:S})]})]}),(0,K.jsx)(g.ConfirmDialog,{})]})}function cF({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border/50 py-3 last:border-b-0`,children:[(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,K.jsx)(`span`,{className:`max-w-[65%] break-words text-right text-xs font-medium text-foreground`,children:t})]})}function lF({embedded:e=!1,job:t,open:n,onDelete:r,onOpenChange:i,onRun:a,onToggle:o}){if(!t)return null;let s=UP(t),c=!!t.payload.sessionId?.trim(),l=WP(t)?Vs(s):null,u=t.state.lastStatus?U(`cronLastStatus${t.state.lastStatus[0].toUpperCase()}${t.state.lastStatus.slice(1)}`):U(`cronNeverRun`),d=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(KT,{className:`shrink-0 border-b border-border/60 px-5 pb-5 pt-6 pr-14 sm:px-7 sm:pt-7`,children:[(0,K.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`span`,{children:HP(t)}),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`span`,{children:U(c?`cronBoundSession`:`cronDedicatedSession`)})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(JT,{children:t.name||t.id}),(0,K.jsx)(jz,{page:Ez(`cron-job`,t.id,t.name||t.id)})]}),(0,K.jsx)(YT,{children:U(`cronDetailDescription`)})]}),(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-6 sm:px-7`,children:[(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:U(`cronTaskPrompt`)}),(0,K.jsx)(`div`,{className:`rounded-2xl bg-muted/55 px-4 py-3 text-sm leading-6 text-foreground`,children:t.payload.message})]}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(`h3`,{className:`mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:U(`cronTaskDetails`)}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(cF,{label:U(`cronScheduleLabel`),value:HP(t)}),(0,K.jsx)(cF,{label:U(`cronNextRun`),value:PP(t.state.nextRunAt)}),(0,K.jsx)(cF,{label:U(`cronAgentLabel`),value:t.payload.agentId?.trim()||`main`}),(0,K.jsx)(cF,{label:U(`cronSessionLabel`),value:l?(0,K.jsx)(_n,{href:l,size:`xs`,className:`text-[hsl(var(--link-foreground))] underline decoration-[1.2px] underline-offset-2 hover:text-[hsl(var(--link-foreground-hover))]`,children:s}):s}),(0,K.jsx)(cF,{label:U(`cronCreatedAt`),value:PP(t.createdAt)})]})]}),(0,K.jsxs)(`section`,{children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:U(`cronLatestRun`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:U(`cronLatestRunHint`)})]}),(0,K.jsx)(`span`,{className:V(`rounded-full px-2.5 py-1 text-xs font-medium`,t.state.lastStatus===`error`?`bg-red-50 text-red-700`:t.state.lastStatus===`ok`?`bg-emerald-50 text-emerald-700`:`bg-muted text-muted-foreground`),children:u})]}),(0,K.jsxs)(`div`,{className:`rounded-2xl border border-border/60 px-4 py-1`,children:[(0,K.jsx)(cF,{label:U(`cronLastRun`),value:PP(t.state.lastRunAt)}),t.state.lastError?(0,K.jsx)(cF,{label:U(`cronLastError`),value:t.state.lastError}):null]})]}),(0,K.jsxs)(`section`,{className:`flex items-center justify-between rounded-2xl border border-border/60 px-4 py-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:t.enabled?U(`cronEnabledState`):U(`cronPaused`)}),(0,K.jsx)(`div`,{className:`mt-0.5 text-xs text-muted-foreground`,children:U(`cronToggleHint`)})]}),(0,K.jsx)(Me,{checked:t.enabled,onCheckedChange:e=>o(t,e),"aria-label":t.enabled?U(`cronDisable`):U(`cronEnable`)})]}),l?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:U(`cronSessionAvailableAfterRun`)})]}),(0,K.jsxs)(qT,{className:`shrink-0 border-t border-border/60 bg-background px-5 py-4 sm:px-7`,children:[(0,K.jsxs)(B,{variant:`ghost`,className:`text-red-600 hover:bg-destructive/10 hover:text-red-700`,onClick:()=>r(t),children:[(0,K.jsx)(Jr,{className:`mr-2 h-4 w-4`}),U(`delete`)]}),l?(0,K.jsx)(_n,{href:l,className:V(ze({variant:`outline`}),`hover:no-underline`),children:U(`cronOpenSession`)}):(0,K.jsx)(B,{variant:`outline`,disabled:!0,children:U(`cronOpenSession`)}),(0,K.jsxs)(B,{onClick:()=>a(t),children:[(0,K.jsx)(Bn,{className:`mr-2 h-4 w-4`}),U(`cronRunNow`)]})]})]});return(0,K.jsx)(VT,{open:!e&&n,onOpenChange:i,children:e?(0,K.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`cron-job-detail`,children:d}):(0,K.jsx)(GT,{side:`right`,closeLabel:U(`cronCloseDetails`),className:`flex w-full flex-col overflow-hidden p-0 sm:max-w-[510px]`,children:d})})}function uF({jobId:e}){let t=ZP({all:!0}),n=rF(),r=t.data?.jobs.find(t=>t.id===e);return t.isPending?(0,K.jsx)(`p`,{role:`status`,className:`p-4`,children:U(`loading`)}):t.isError?(0,K.jsxs)(`div`,{className:`p-4`,children:[(0,K.jsx)(`p`,{role:`alert`,children:U(`resourceLoadFailed`)}),(0,K.jsx)(`button`,{onClick:()=>void t.refetch(),children:U(`resourceRetry`)})]}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(lF,{embedded:!0,job:r,open:!0,onOpenChange:()=>{},onDelete:e=>{n.deleteJob(e)},onRun:e=>{n.runJob(e)},onToggle:(e,t)=>{n.toggleJob(e,t)}}),(0,K.jsx)(n.ConfirmDialog,{})]}):(0,K.jsx)(`p`,{role:`alert`,className:`p-4`,children:U(`resourceNotFound`)})}function dF({job:e}){let t=e.state.lastStatus===`error`,n=t?U(`cronNeedsAttention`):e.enabled?U(`cronRunningNormally`):U(`cronPaused`);return(0,K.jsxs)(`span`,{className:V(`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,K.jsx)(`span`,{className:V(`h-1.5 w-1.5 rounded-full`,t?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-muted-foreground/50`)}),n]})}function fF({cronActions:e,job:t,onOpenDetails:n}){let[r,i]=(0,G.useState)(!1),a=e.isPending(t),o=t.state.lastStatus===`error`,s=o?En:jr,c=t.name||t.id;return(0,K.jsxs)(`article`,{className:`rounded-2xl border border-border/60 bg-background px-3.5 py-3 shadow-sm transition-colors hover:bg-[var(--interaction-hover)] focus-within:bg-[var(--interaction-hover)]`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(`span`,{className:V(`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,K.jsx)(s,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-foreground`,children:c}),(0,K.jsx)(dF,{job:t})]}),(0,K.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(Un,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),HP(t)]}),t.enabled&&t.state.nextRunAt?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(ho,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),U(`cronNextRun`),` `,FP(t.state.nextRunAt)]}):null]})]}),(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`span`,{children:(0,K.jsx)(Me,{checked:t.enabled,disabled:a,onCheckedChange:n=>{e.toggleJob(t,n)},"aria-label":t.enabled?U(`cronDisable`):U(`cronEnable`)})})}),(0,K.jsx)(ui,{children:t.enabled?U(`cronDisable`):U(`cronEnable`)})]})})]}),(0,K.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-muted-foreground`,children:t.payload.message}),t.enabled?null:(0,K.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:U(`cronToggleHint`)}),t.state.lastError?(0,K.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[11px] leading-5 text-red-700`,children:t.state.lastError}):null,(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-between border-t border-border/50 pt-2.5`,children:[(0,K.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,onClick:()=>n(t),children:U(`cronEditDetails`)}),(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(_i,{open:r,onOpenChange:i,children:[(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`h-7 w-7`,disabled:a,"aria-label":`${U(`cronMoreActions`)} ${c}`,children:(0,K.jsx)(wr,{className:`h-4 w-4`})})})}),(0,K.jsx)(ui,{children:U(`cronMoreActions`)})]}),(0,K.jsxs)(hi,{align:`end`,sideOffset:4,variant:`menu`,children:[(0,K.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{i(!1),e.runJob(t)},className:`${$n} text-foreground ${tr.item}`,children:[(0,K.jsx)(Bn,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),U(`cronRunNow`)]}),(0,K.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{i(!1),e.deleteJob(t)},className:`${$n} ${tr.destructive}`,children:[(0,K.jsx)(Jr,{className:`h-4 w-4 shrink-0`}),U(`delete`)]})]})]})})]})]})}function pF({jobs:e,isError:t=!1,isLoading:n=!1,onRetry:r}){let i=$(),a=fn(),o=rF();return(0,K.jsxs)(`div`,{className:`h-full overflow-y-auto custom-scrollbar px-4 py-4`,children:[(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:U(`chatWorkspaceSessionCronJobs`)}),(0,K.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[U(`cronTotalLabel`),`: `,e.length]})]}),n?(0,K.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:U(`cronLoading`)}):t?(0,K.jsxs)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:[(0,K.jsx)(`p`,{children:U(`cronLoadFailed`)}),r?(0,K.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-2`,onClick:r,children:U(`cronRetry`)}):null]}):e.length===0?(0,K.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:U(`chatWorkspaceCronJobEmpty`)}):(0,K.jsx)(`div`,{className:`space-y-2.5`,children:e.map(e=>(0,K.jsx)(fF,{cronActions:o,job:e,onOpenDetails:e=>i.pageResourceManager.open(Ez(`cron-job`,e.id,e.name||e.id),`default`,a)},e.id))}),(0,K.jsx)(o.ConfirmDialog,{})]})}function mF({childSessionTabs:e,sessionKey:t}){let n=q();return(0,K.jsx)(`div`,{className:`h-full overflow-auto bg-gray-50/45 px-4 py-5 custom-scrollbar`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`h2`,{className:`truncate text-base font-semibold text-gray-900`,children:U(`chatWorkspaceChildSessions`)}),(0,K.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,K.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-[hsl(var(--primary-hover))] 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,K.jsx)(Sr,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{children:U(`chatWorkspaceCreateChildSession`)})]})]}),e.length===0?(0,K.jsx)(`div`,{className:`py-10 text-center text-sm text-gray-500`,children:U(`chatWorkspaceChildSessionsEmpty`)}):(0,K.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>(0,K.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-[var(--interaction-hover)]`,children:[(0,K.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,K.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,K.jsx)(Oo,{className:`h-4 w-4`})}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 text-sm font-medium text-gray-900`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:e.title}),e.runStatus?(0,K.jsx)(du,{status:e.runStatus}):null]}),e.projectName||e.sessionTypeLabel?(0,K.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-gray-500`,children:[e.sessionTypeLabel,e.projectName].filter(Boolean).join(` · `)}):null]}),(0,K.jsx)(nr,{className:`h-4 w-4 shrink-0 text-gray-300 transition-transform group-hover:translate-x-0.5 group-hover:text-gray-500`})]}),(0,K.jsx)(Zs,{sessionKey:e.sessionKey,sessionTitle:e.title,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 hF(e){return e===null?`—`:new Intl.NumberFormat().format(e)}function gF(e){return e===null?`—`:new Intl.NumberFormat().format(e)}function _F(e){return e===null?`—`:new Intl.NumberFormat(void 0,{style:`percent`,maximumFractionDigits:1}).format(e)}function vF({status:e}){return(0,K.jsx)(`span`,{className:V(`inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[10px] font-medium`,e===`reported`?`text-muted-foreground`:e===`partial`?`bg-amber-50 text-amber-700`:`bg-gray-100 text-gray-500`),children:U(e===`reported`?`chatWorkspaceTokenUsageReported`:e===`partial`?`chatWorkspaceTokenUsagePartial`:`chatWorkspaceTokenUsageUnavailable`)})}function yF({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`min-w-0 rounded-md bg-muted/60 px-2.5 py-2 first:bg-muted first:[&>div:last-child]:font-semibold`,children:[(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 break-words text-sm font-medium tabular-nums text-foreground`,children:t})]})}function bF({sessionKey:e}){let t=jl(e),n=t.data;return(0,K.jsxs)(`section`,{"aria-labelledby":`chat-workspace-token-usage-title`,className:`mt-4 rounded-lg border border-border p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center text-muted-foreground`,children:(0,K.jsx)(co,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`h3`,{id:`chat-workspace-token-usage-title`,className:`text-sm font-semibold text-gray-900`,children:U(`chatWorkspaceTokenUsage`)}),n?(0,K.jsx)(vF,{status:n.status}):null]}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-gray-500`,children:U(`chatWorkspaceTokenUsageDescription`)})]})]}),t.isLoading?(0,K.jsx)(`p`,{className:`py-5 text-center text-xs text-gray-500`,"aria-live":`polite`,children:U(`chatWorkspaceTokenUsageLoading`)}):t.isError?(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-4 text-xs text-rose-600`,role:`alert`,children:[(0,K.jsx)(`span`,{children:U(`chatWorkspaceTokenUsageLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,className:`shrink-0 rounded px-1.5 py-1 font-semibold text-gray-700 hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25`,onClick:()=>void t.refetch(),children:U(`chatWorkspaceTokenUsageRetry`)})]}):n&&n.runCount>0?(0,K.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageTotal`),value:hF(n.totals.totalTokens)}),(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageInput`),value:hF(n.totals.inputTokens)}),(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageOutput`),value:hF(n.totals.outputTokens)}),(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageCachedInput`),value:hF(n.totals.cachedInputTokens)}),(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageCacheHitRate`),value:_F(n.totals.cacheHitRate)}),(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageRuns`),value:String(n.runCount)}),(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageModelCalls`),value:gF(n.modelCallCount)}),(0,K.jsx)(yF,{label:U(`chatWorkspaceTokenUsageReportedModelCalls`),value:gF(n.reportedModelCallCount)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 text-[11px] font-medium text-gray-700`,children:U(`chatWorkspaceTokenUsageByModel`)}),(0,K.jsx)(`div`,{className:`space-y-2`,children:n.models.map(e=>(0,K.jsxs)(`div`,{className:`rounded-md border border-border bg-muted/30 px-2.5 py-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate text-xs font-semibold text-gray-900`,title:e.model,children:e.model}),(0,K.jsx)(vF,{status:e.status})]}),(0,K.jsxs)(`div`,{className:`mt-1 text-[10px] text-gray-500`,children:[U(`chatWorkspaceTokenUsageModelRunCount`).replace(`{count}`,String(e.runCount)),` · `,U(`chatWorkspaceTokenUsageModelCallCount`).replace(`{count}`,gF(e.modelCallCount)),` · `,U(`chatWorkspaceTokenUsageModelCacheHitRate`).replace(`{rate}`,_F(e.cacheHitRate))]}),(0,K.jsx)(`dl`,{className:`mt-2 grid grid-cols-2 gap-x-3 gap-y-2 text-[11px]`,children:[[U(`chatWorkspaceTokenUsageInput`),e.inputTokens],[U(`chatWorkspaceTokenUsageOutput`),e.outputTokens],[U(`chatWorkspaceTokenUsageCachedInput`),e.cachedInputTokens],[U(`chatWorkspaceTokenUsageTotal`),e.totalTokens]].map(([e,t])=>(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`dt`,{className:`truncate text-gray-500`,children:e}),(0,K.jsx)(`dd`,{className:`mt-0.5 break-words font-medium tabular-nums text-gray-800`,children:hF(t)})]},String(e)))})]},e.model))})]})]}):(0,K.jsx)(`p`,{className:`py-5 text-center text-xs leading-5 text-gray-500`,children:U(`chatWorkspaceTokenUsageEmpty`)})]})}var xF={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 SF(e,t){return e.replace(`{count}`,String(t))}function CF(e){return U(`chatWorkspaceContinuousAttentionStatus${e[0].toUpperCase()}${e.slice(1)}`)}function wF(e){return U(e===`context`?`chatWorkspaceContinuousAttentionState`:`chatWorkspaceContinuousAttentionEvents`)}function TF({item:e,isPending:t,onAction:n}){let r=e.status===`active`||e.status===`paused`,i=e.status===`active`?`pause`:`resume`,a=U(i===`pause`?`chatWorkspaceContinuousAttentionPause`:`chatWorkspaceContinuousAttentionResume`);return(0,K.jsxs)(`article`,{className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,K.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,K.jsx)(Fr,{className:`h-4 w-4`}):(0,K.jsx)(Ir,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`h3`,{className:`truncate text-sm font-semibold text-gray-900`,children:e.title}),(0,K.jsx)(`span`,{className:V(`rounded-full border px-1.5 py-0.5 text-[10px] font-medium`,xF[e.status]),children:CF(e.status)})]}),(0,K.jsxs)(`p`,{className:`mt-0.5 truncate text-[11px] text-gray-400`,children:[e.extensionId,` · `,wF(e.kind)]}),e.description?(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-gray-600`,children:e.description}):null,e.statusReason?(0,K.jsxs)(`p`,{className:`mt-2 flex gap-1.5 text-xs leading-5 text-orange-700`,children:[(0,K.jsx)(En,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:e.statusReason})]}):null,e.safeConfigPreview?(0,K.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,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-gray-400`,children:[(0,K.jsxs)(`span`,{children:[U(`chatWorkspaceContinuousAttentionCreated`),`: `,Zr(e.createdAt)]}),e.expiresAt?(0,K.jsxs)(`span`,{children:[U(`chatWorkspaceContinuousAttentionExpires`),`: `,Zr(e.expiresAt)]}):null,e.lastReadAt?(0,K.jsxs)(`span`,{children:[U(`chatWorkspaceContinuousAttentionLastRead`),`: `,Zr(e.lastReadAt)]}):null,e.kind===`events`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{children:SF(U(`chatWorkspaceContinuousAttentionPending`),e.pendingCount??0)}),e.suppressedCount?(0,K.jsx)(`span`,{children:SF(U(`chatWorkspaceContinuousAttentionSuppressed`),e.suppressedCount)}):null,e.deliveryFailureCount?(0,K.jsx)(`span`,{className:`text-rose-600`,children:SF(U(`chatWorkspaceContinuousAttentionFailures`),e.deliveryFailureCount)}):null]}):null]})]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-2 border-t border-gray-100 pt-2`,children:[r?(0,K.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-[var(--interaction-hover)] disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>n(i),children:[i===`pause`?(0,K.jsx)(ps,{className:`h-3.5 w-3.5`}):(0,K.jsx)(Bn,{className:`h-3.5 w-3.5`}),t?U(`chatWorkspaceContinuousAttentionUpdating`):a]}):null,(0,K.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-destructive/10 disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>n(`remove`),children:[(0,K.jsx)(Jr,{className:`h-3.5 w-3.5`}),U(`chatWorkspaceContinuousAttentionRemove`)]})]})]})}function EF({sessionKey:e}){let[t,n]=(0,G.useState)(`context`),[r,i]=(0,G.useState)(!1),a=Nl(e),o=Pl(e),{confirm:s,ConfirmDialog:c}=xx();if(!e)return null;let l=a.data,u=t===`context`?l?.bindings??[]:l?.subscriptions??[],d=async(e,t)=>{if(!(t===`remove`&&!await s({title:U(`chatWorkspaceContinuousAttentionRemoveTitle`),description:U(`chatWorkspaceContinuousAttentionRemoveDescription`),confirmLabel:U(`chatWorkspaceContinuousAttentionRemove`),variant:`destructive`}))){i(!1);try{await o.mutateAsync({kind:e.kind,id:e.id,action:t})}catch{i(!0)}}};return(0,K.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5 custom-scrollbar`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,K.jsx)(c,{}),(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(`span`,{className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:(0,K.jsx)(Fr,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:U(`chatWorkspaceContinuousAttention`)}),(0,K.jsxs)(`p`,{className:`mt-1 break-all text-xs leading-5 text-gray-500`,children:[U(`chatWorkspaceContinuousAttentionDescription`),` · `,e]})]})]}),l?(0,K.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-1.5 rounded-lg border border-border p-2`,children:[(0,K.jsx)(DF,{label:U(`chatWorkspaceContinuousAttentionTotal`),value:l.counts.total}),(0,K.jsx)(DF,{label:U(`chatWorkspaceContinuousAttentionState`),value:l.counts.context}),(0,K.jsx)(DF,{label:U(`chatWorkspaceContinuousAttentionEvents`),value:l.counts.events}),(0,K.jsx)(DF,{label:U(`chatWorkspaceContinuousAttentionNeedsAttention`),value:l.counts.needsAttention})]}):null,(0,K.jsx)(`div`,{className:`mt-3 flex rounded-lg border border-border bg-muted/40 p-1`,role:`tablist`,children:[`context`,`events`].map(e=>{let r=e===`context`?l?.counts.context??0:l?.counts.events??0;return(0,K.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":t===e,className:V(`flex-1 rounded-md px-3 py-2 text-xs font-medium transition-colors`,t===e?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),onClick:()=>n(e),children:[wF(e),` `,(0,K.jsx)(`span`,{className:`ml-1 tabular-nums text-gray-400`,children:r})]},e)})}),r?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-rose-600`,children:U(`chatWorkspaceContinuousAttentionActionFailed`)}):null,a.isPending?(0,K.jsx)(`div`,{className:`mt-3 space-y-2`,"aria-label":U(`chatWorkspaceContinuousAttentionLoading`),children:[0,1].map(e=>(0,K.jsx)(`div`,{className:`h-28 animate-pulse rounded-lg border border-border bg-muted/40`},e))}):a.isError?(0,K.jsxs)(`div`,{className:`mt-4 rounded-xl border border-rose-200 bg-rose-50 px-4 py-5 text-center`,children:[(0,K.jsx)(`p`,{className:`text-sm font-medium text-rose-800`,children:U(`chatWorkspaceContinuousAttentionLoadFailed`)}),(0,K.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,K.jsx)(qr,{className:`h-3.5 w-3.5`}),U(`chatWorkspaceContinuousAttentionRetry`)]})]}):u.length===0?(0,K.jsxs)(`div`,{className:`mt-3 rounded-lg border border-border bg-muted/30 px-4 py-6 text-center`,children:[(0,K.jsx)(mo,{className:`mx-auto h-5 w-5 text-muted-foreground`}),(0,K.jsx)(`p`,{className:`mt-2 text-sm font-medium text-gray-700`,children:U(`chatWorkspaceContinuousAttentionEmpty`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:U(`chatWorkspaceContinuousAttentionEmptyDescription`)})]}):(0,K.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.map(e=>(0,K.jsx)(TF,{item:e,isPending:o.isPending&&o.variables?.id===e.id,onAction:t=>void d(e,t)},`${e.kind}:${e.id}`))})]})})}function DF({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`rounded-md bg-muted/60 px-2.5 py-2`,children:[(0,K.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 text-base font-medium tabular-nums text-foreground`,children:t})]})}function OF({fileActive:e,projectFilesActive:t}){let n=q(),r=(0,G.useRef)(null),i=(0,G.useRef)(null),a=Y(e=>e.snapshot.workspaceExplorerOpen),o=Y(e=>e.snapshot.workspaceExplorerWidth),s=Y(e=>e.setSnapshot),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),f=u??o,p=(0,G.useCallback)(e=>s({workspaceExplorerOpen:e}),[s]);return(0,G.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,G.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=Ju(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 kF({count:e,description:t,icon:n,onClick:r,runStatus:i,title:a}){return(0,K.jsxs)(`button`,{type:`button`,className:`group flex w-full items-center gap-3 px-3 py-2.5 text-left transition-colors first:rounded-t-lg last:rounded-b-lg hover:bg-[var(--interaction-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/25`,onClick:r,children:[(0,K.jsx)(`span`,{className:`inline-flex h-7 w-7 shrink-0 items-center justify-center text-muted-foreground`,children:n}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[(0,K.jsx)(`span`,{className:`truncate`,children:a}),typeof e==`number`?(0,K.jsx)(`span`,{className:`min-w-5 rounded bg-background px-1.5 py-0.5 text-center text-[11px] font-medium tabular-nums text-muted-foreground`,children:e}):null,i?(0,K.jsx)(du,{status:i}):null]}),(0,K.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-gray-500`,children:t})]}),(0,K.jsx)(nr,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground/60 group-hover:text-muted-foreground`})]})}function AF({childSessionTabs:e,sessionCronJobs:t,sessionKey:n}){let r=q(),i=Nl(n);return(0,K.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5 custom-scrollbar`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-xl`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-gray-900`,children:U(`chatWorkspaceOverview`)}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:U(`chatWorkspaceOverviewDescription`)}),(0,K.jsxs)(`div`,{className:`mt-3 divide-y divide-border rounded-lg border border-border bg-muted/40`,children:[(0,K.jsx)(kF,{description:U(`chatWorkspaceProjectFilesDescription`),icon:(0,K.jsx)(Gn,{className:`h-4 w-4`}),title:U(`chatWorkspaceProjectFiles`),onClick:()=>{n&&r.chatThreadManager.openProjectFiles(n)}}),(0,K.jsx)(kF,{count:t.length,description:U(`chatWorkspaceSessionCronJobsDescription`),icon:(0,K.jsx)(Qa,{className:`h-4 w-4`}),title:U(`chatWorkspaceSessionCronJobs`),onClick:()=>{n&&r.chatThreadManager.openSessionCronPanel(n)}}),(0,K.jsx)(kF,{count:e.length,description:U(`chatWorkspaceChildSessionsDescription`),icon:(0,K.jsx)(Oo,{className:`h-4 w-4`}),runStatus:e.some(e=>e.runStatus===`running`)?`running`:void 0,title:U(`chatWorkspaceChildSessions`),onClick:()=>{n&&r.chatThreadManager.openChildSessions(n)}}),(0,K.jsx)(kF,{count:i.data?.counts.total??0,description:U(`chatWorkspaceContinuousAttentionDescription`),icon:(0,K.jsx)(Fr,{className:`h-4 w-4`}),title:U(`chatWorkspaceContinuousAttention`),onClick:()=>{n&&r.chatThreadManager.openContinuousAttention(n)}})]}),(0,K.jsx)(bF,{sessionKey:n})]})})}function jF({activePath:e,onFileOpen:t,projectRoot:n,sessionKey:r,workingDir:i}){let a=q(),o=n??i,s=tc({path:o,includeFiles:!0,enabled:!!o});return o?(0,K.jsx)(kx,{activeRelativePath:e?Hc({path:e,sessionProjectRoot:o}):null,browseQuery:s,onFileOpen:t??a.chatThreadManager.openFilePreview,sessionKey:r,renderStatus:({text:e,tone:t=`muted`})=>(0,K.jsx)(`div`,{className:V(`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,K.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-gray-500`,children:U(`chatWorkspaceProjectFilesUnavailable`)})}function MF(){return(0,K.jsxs)(`div`,{className:`border-b border-gray-200/70 px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 text-sm font-semibold text-gray-900`,children:[(0,K.jsx)(Sr,{className:`h-4 w-4 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`truncate`,children:U(`chatWorkspaceSideChatDraftTitle`)})]}),(0,K.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:U(`chatWorkspaceSideChatDraftSubtitle`)})]})}function NF({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=q();return e.kind===`overview`?(0,K.jsx)(AF,{childSessionTabs:t,sessionCronJobs:i,sessionKey:r}):e.kind===`child-sessions`?(0,K.jsx)(mF,{childSessionTabs:t,sessionKey:r}):e.kind===`continuous-attention`?(0,K.jsx)(EF,{sessionKey:r}):e.kind===`side-chat-draft`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(MF,{}),(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,K.jsx)(NP,{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,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,K.jsx)(NP,{sessionKey:e.tab.sessionKey})}):e.kind===`file`?(0,K.jsx)(gS,{breadcrumbLeading:(0,K.jsx)(W,{"data-testid":`workspace-explorer-toggle`,icon:u?.open?(0,K.jsx)(os,{className:`h-4 w-4`}):(0,K.jsx)(ss,{className:`h-4 w-4`}),label:U(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,K.jsx)(pF,{jobs:i,isError:a,isLoading:o,onRetry:l})}function PF({activeSelection:e,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r,...i}){let a=e.kind===`project-files`,o=e.kind===`file`,s=q(),{compact:c,containerRef:l,explorerOpen:u,explorerOverlay:d,explorerWidth:f,onResizeStart:p,setExplorerOpen:m,showExplorer:h}=OF({fileActive:o,projectFilesActive:a});return(0,K.jsxs)(`div`,{ref:l,"data-testid":`workspace-shared-explorer-layout`,className:`relative flex h-full min-h-0 flex-1 overflow-hidden`,children:[d?(0,K.jsx)(`button`,{"data-testid":`workspace-explorer-scrim`,type:`button`,"aria-label":U(`chatWorkspaceHideProjectFiles`),className:`absolute inset-0 z-10 bg-black/15`,onClick:()=>m(!1)}):null,(0,K.jsxs)(`div`,{"data-testid":`workspace-shared-explorer`,"data-theme-surface":`workspace-explorer`,"data-mode":a?`full`:d?`overlay`:`side`,className:V(`relative min-h-0 shrink-0 flex-col border-r border-border bg-background`,h?`flex`:`hidden`,a?`flex-1 border-r-0`:null,d?`absolute inset-y-0 left-0 z-20 w-[min(320px,86%)] shadow-xl`:null),style:!a&&!d?{width:f}:void 0,"aria-hidden":!h,children:[(0,K.jsx)(jF,{activePath:o?e.file.path:null,onFileOpen:e=>{c&&m(!1),s.chatThreadManager.openFilePreview(e)},projectRoot:n,sessionKey:t,workingDir:r}),o&&!c?(0,K.jsx)(`div`,{"data-testid":`workspace-explorer-resize-handle`,"aria-label":U(`chatWorkspaceResizeProjectFiles`),"aria-orientation":`vertical`,"aria-valuemax":400,"aria-valuemin":192,"aria-valuenow":f,role:`separator`,className:`absolute inset-y-0 right-[-4px] z-20 w-2 cursor-ew-resize hover:bg-primary/10`,onPointerDown:p}):null]}),a?null:(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,K.jsx)(NF,{...i,activeSelection:e,explorerControl:o?{open:u,onToggle:()=>m(!u)}:void 0,sessionKey:t,sessionProjectRoot:n,sessionWorkingDir:r})})]})}function FF({sessionKey:e,hidden:t=!1,childSessionTabs:n,activeChildSessionKey:r,activeSideChatDraft:i,workspaceFileTabs:a,activeWorkspaceFileKey:o,closedWorkspaceTabEntries:s,workspaceNavigationHistory:c=[],workspaceNavigationHistoryIndex:l=0,activePanelKind:u,sessionCronJobs:d=[],sessionCronJobsError:f=!1,sessionCronJobsLoading:p=!1,onRetrySessionCronJobs:m,sessionProjectRoot:h,sessionWorkingDir:g,workspacePanelWidth:_=480,displayMode:v=`docked`}){let y=q(),b=kz(),x=Dt(),[S,C]=(0,G.useState)(0),w=Gd(n),T=J(e=>e.optimisticReadAtBySessionKey),E=qd({activeChildSessionKey:r,activeSideChatDraft:i,activeWorkspaceFileKey:o,activePanelKind:u,childSessionTabs:w,workspaceFileTabs:a}),D={entries:c,index:l};(0,G.useEffect)(()=>{y.chatThreadManager.syncVisibleWorkspaceSelection(E)},[E,y]);let O=(0,G.useMemo)(()=>Yd({hasSession:!!e,resolvedChildTabs:w,activeSideChatDraft:i,closedWorkspaceTabEntries:s,workspaceFileTabs:a,activeSelection:E,optimisticReadAtBySessionKey:T,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)}}),[E,i,s,T,y.chatThreadManager,y.chatComposerIntentManager,w,e,h,g,a]);if(!E)return null;let k=E.kind===`file`&&E.file.viewMode===`preview`?E.file:null,A=k?()=>{x.invalidateQueries({queryKey:Qx({path:k.path,basePath:g})}),x.invalidateQueries({queryKey:ec({path:k.path,basePath:g,includeFiles:!0})}),C(e=>e+1)}:void 0;return(0,K.jsx)(xT,{id:`session-workspace:${e??`draft`}`,manager:rV().workbenchSurfaceManager,title:U(`workbenchSessionGroup`),testId:`chat-session-workspace-panel`,hidden:t,width:_,minWidth:360,maxWidth:860,onWidthCommit:y.chatThreadManager.setWorkspacePanelWidth,fullscreen:v===`overlay`,onClose:y.chatThreadManager.closeWorkspacePanel,closeLabel:U(`workbenchHideGroup`),navigation:(0,K.jsx)(ug,{tabs:O.map(t=>({...t,menuGroups:(()=>{let n=a.find(e=>`file:${e.key}`===t.key),r=n?Pd(n,{workingDir:g,projectRoot:h}):t.sessionKey?{kind:`chat-session`,title:t.title,url:Ps(t.sessionKey),resourceUri:Ps(t.sessionKey),historyPolicy:`none`}:t.kind===`side-chat-draft`?null:{kind:`workspace`,title:t.title,url:`nextclaw://workspace?${new URLSearchParams({session:e??``,page:t.kind})}`,historyPolicy:`none`};return r?[...t.menuGroups??[],...b(Cz(r),`workspace`)]:t.menuGroups})(),onMoveGlobal:t.kind===`file`?()=>y.chatThreadManager.moveFileToGlobal(t.key.slice(5),{workingDir:g,projectRoot:h},rV().docBrowserManager):t.kind===`child-session`&&t.sessionKey?()=>{Ud.dock({sessionKey:t.sessionKey,title:t.title},rV().docBrowserManager),t.onClose?.()}:void 0,onFloat:t.kind===`child-session`&&t.sessionKey?()=>{Ud.open({sessionKey:t.sessionKey,title:t.title}),t.onClose?.()}:void 0})),canGoBack:Fi(D),canGoForward:Mi(D),onGoBack:y.chatThreadManager.goBackWorkspacePanel,onGoForward:y.chatThreadManager.goForwardWorkspacePanel,onRefreshFile:A}),children:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col bg-card`,children:(0,K.jsx)(PF,{activeSelection:E,childSessionTabs:w,filePreviewRefreshVersion:S,sessionKey:e,sessionCronJobs:d,sessionCronJobsError:f,sessionCronJobsLoading:p,onRetrySessionCronJobs:m,sessionProjectRoot:h,sessionWorkingDir:g})})})}var IF=[];function LF(e,t){let n=_u(e=>e.snapshot.sessionsQuery?.data?.sessions??IF),r=(0,G.useMemo)(()=>{let r=e.childSessionTabs.filter(e=>e.parentSessionKey===t),i=new Set(r.map(e=>e.sessionKey));return[...r,...ml(n).filter(e=>e.parentSessionId===t&&!i.has(e.key)).map(e=>({sessionKey:e.key,parentSessionKey:t}))]},[t,n,e.childSessionTabs]),i=(0,G.useMemo)(()=>e.workspaceFileTabs.filter(e=>e.parentSessionKey===t),[t,e.workspaceFileTabs]),a=e.activeSideChatDraft?.parentSessionKey===t?e.activeSideChatDraft:null,o=ZP({all:!0});return{childSessionTabs:r,activeSideChatDraft:a,workspaceFileTabs:i,sessionCronJobs:(0,G.useMemo)(()=>(o.data?.jobs??[]).filter(e=>GP(e,t)),[o.data?.jobs,t]),sessionCronJobsError:o.isError,sessionCronJobsLoading:o.isLoading,retrySessionCronJobs:()=>{o.refetch()},showWorkspacePanel:e.workspacePanelParentKey===t&&e.activeWorkspacePanelKind!=null}}function RF({layoutMode:e,sessionKey:t,projectRoot:n}){let r=Y(e=>e.snapshot),i=_u(e=>Pc(e.snapshot.configQuery?.data?.agents.defaults.workspace)),a=Lu(t),o=n??(t?null:r.draftProjectRoot??i),{childSessionTabs:s,activeSideChatDraft:c,workspaceFileTabs:l,sessionCronJobs:u,sessionCronJobsError:d,sessionCronJobsLoading:f,retrySessionCronJobs:p,showWorkspacePanel:m}=LF(r,t);return m?(0,K.jsx)(FF,{sessionKey:t,hidden:r.workspacePanelHidden===!0,childSessionTabs:t?s:[],activeChildSessionKey:r.activeChildSessionKey??null,activeSideChatDraft:c,workspaceFileTabs:l,activeWorkspaceFileKey:r.activeWorkspaceFileKey??null,closedWorkspaceTabEntries:r.closedWorkspaceTabEntries,workspaceNavigationHistory:r.workspaceNavigationHistory,workspaceNavigationHistoryIndex:r.workspaceNavigationHistoryIndex,activePanelKind:r.activeWorkspacePanelKind??null,sessionCronJobs:t?u:[],sessionCronJobsError:t?d:!1,sessionCronJobsLoading:t?f:!1,onRetrySessionCronJobs:p,sessionProjectRoot:a?.projectRoot??o,sessionWorkingDir:a?.workingDir??a?.projectRoot??o,workspacePanelWidth:r.workspacePanelWidth,displayMode:e===`mobile`?`overlay`:`docked`}):null}function zF({layoutMode:e=`desktop`,onBackToList:t}){let n=q(),r=J(e=>e.snapshot.selectedSessionKey);return(0,K.jsxs)(`section`,{"data-theme-surface":`workspace`,className:`relative flex-1 min-h-0 min-w-0 flex overflow-hidden bg-background`,children:[(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[(0,K.jsx)(Md,{}),(0,K.jsx)(jd,{layoutMode:e,onBackToList:t}),(0,K.jsx)(NP,{consumeDraftIntent:!0,sessionKey:r,onSessionMaterialized:n.chatThreadManager.materializeRootDraftSession})]}),(0,K.jsx)(RF,{layoutMode:e,sessionKey:r})]})}function BF(){let e=qs(),[t,n]=(0,G.useState)(null),[r,i]=(0,G.useState)(``),[a,o]=(0,G.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 VF=`w-[56px]`,HF=`px-2`,UF=`h-9 w-9 rounded-xl`,WF=`h-4 w-4`,GF=`space-y-1`,KF=`gap-1`,qF=`rounded-xl text-muted-foreground transition-colors duration-base hover:bg-[var(--sidebar-interaction-hover)] hover:text-foreground focus-within:bg-[var(--sidebar-interaction-hover)] has-[[data-context-menu-open]]:bg-[var(--sidebar-interaction-hover)]`,JF=`${qF} active:bg-[var(--sidebar-interaction-selection)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,YF=[`bg-blue-100 text-blue-800 [html[data-theme-appearance=dark]_&]:bg-blue-950 [html[data-theme-appearance=dark]_&]:text-blue-200`,`bg-emerald-100 text-emerald-800 [html[data-theme-appearance=dark]_&]:bg-emerald-950 [html[data-theme-appearance=dark]_&]:text-emerald-200`,`bg-violet-100 text-violet-800 [html[data-theme-appearance=dark]_&]:bg-violet-950 [html[data-theme-appearance=dark]_&]:text-violet-200`,`bg-amber-100 text-amber-800 [html[data-theme-appearance=dark]_&]:bg-amber-950 [html[data-theme-appearance=dark]_&]:text-amber-200`,`bg-rose-100 text-rose-800 [html[data-theme-appearance=dark]_&]:bg-rose-950 [html[data-theme-appearance=dark]_&]:text-rose-200`];function XF(e){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)|0;return YF[Math.abs(t)%YF.length]}function ZF(e){let{sessionKey:t,title:n,previewText:r,trailingText:i,agentId:a,agentLabel:o,agentAvatarUrl:s,showUnreadDot:c,runStatus:l,isPinned:u,onSelect:d,onStartEditing:f,onTogglePinned:p,onDelete:m}=e;return(0,K.jsxs)(`div`,{className:`relative flex min-w-0 items-center`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:d,className:`flex min-h-[76px] min-w-0 flex-1 items-center gap-3 py-3 pl-4 pr-1 text-left active:bg-[var(--interaction-hover)]`,children:[(0,K.jsxs)(`span`,{className:`relative shrink-0`,children:[s||a&&a.toLowerCase()!==`main`?(0,K.jsx)(wd,{agentId:a||`main`,displayName:o,avatarUrl:s,className:`h-12 w-12 rounded-xl text-lg`}):(0,K.jsx)(`span`,{"aria-hidden":`true`,className:V(`flex h-12 w-12 items-center justify-center rounded-xl text-base font-medium`,XF(t)),children:Array.from(n.trim()).slice(0,2).join(``)}),c?(0,K.jsx)(`span`,{"aria-label":U(`chatSessionUnread`),className:`absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-background bg-primary`}):null]}),(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[16px] font-medium leading-6 text-foreground`,children:n}),(0,K.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:i})]}),(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[l?(0,K.jsx)(du,{status:l}):null,u?(0,K.jsx)(_s,{"aria-label":U(`chatSidebarUnpinSession`),className:`h-3 w-3 shrink-0 text-muted-foreground`}):null,(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[13px] leading-5 text-muted-foreground`,children:r})]})]})]}),(0,K.jsxs)(Zs,{sessionKey:t,sessionTitle:n,children:[(0,K.jsx)(Ys,{icon:_s,label:U(u?`chatSidebarUnpinSession`:`chatSidebarPinSession`),onClick:p}),(0,K.jsx)(Ys,{icon:Hn,label:U(`edit`),onClick:f}),(0,K.jsx)(Ys,{icon:Jr,label:U(`delete`),onClick:m,destructive:!0})]})]})}function QF({children:e,metrics:t,title:n}){return(0,K.jsx)(ni,{delayDuration:350,skipDelayDuration:100,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:e}),(0,K.jsxs)(ui,{side:`right`,align:`start`,sideOffset:10,collisionPadding:12,className:`pointer-events-none w-64 p-3`,children:[(0,K.jsx)(`div`,{className:`truncate text-sm font-semibold leading-5`,children:n}),(0,K.jsx)(`div`,{className:`mt-2 space-y-0.5`,children:t.map(e=>(0,K.jsxs)(`div`,{className:`flex h-5 min-w-0 items-center gap-2 text-xs leading-5`,children:[(0,K.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground`,children:e.icon}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-muted-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`min-w-0 max-w-40 truncate tabular-nums text-foreground/80`,children:e.value})]},e.label))})]})]})})}function $F({sessionKey:e,draftLabel:t,isSaving:n,onDraftLabelChange:r,onSave:i,onCancel:a}){return(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(F,{density:`compact`,value:t,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i()):e.key===`Escape`&&(e.preventDefault(),a())},placeholder:U(`sessionsLabelPlaceholder`),className:`h-8 rounded-lg border-border bg-background`,autoFocus:!0,disabled:n}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`div`,{className:`min-w-0 truncate text-[11px] text-muted-foreground/65`,children:e}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(W,{icon:(0,K.jsx)(jr,{className:`h-3.5 w-3.5`}),label:U(`save`),tooltip:!1,onClick:()=>void i(),disabled:n}),(0,K.jsx)(W,{icon:(0,K.jsx)(Vr,{className:`h-3.5 w-3.5`}),label:U(`cancel`),tooltip:!1,onClick:a,disabled:n})]})]})]})}function eI({sessionKey:e,active:t,showUnreadDot:n,runStatus:r,context:i,isPinned:a,title:o,previewText:s,trailingText:c,agentId:l,agentLabel:u,agentAvatarUrl:d,childSessionCount:f=0,cronJobCount:p=0,projectName:m,onSelect:h,onStartEditing:g,onTogglePinned:_,onDelete:v}){return(0,K.jsxs)(`div`,{className:`group/session relative`,children:[(0,K.jsx)(QF,{title:o,metrics:[{icon:(0,K.jsx)(ir,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarContextProject`),value:m},{icon:(0,K.jsx)(Oo,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarContextChildSessions`),value:f},{icon:(0,K.jsx)(Qa,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarContextScheduledTasks`),value:p}],children:(0,K.jsxs)(`button`,{type:`button`,onClick:h,className:`w-full text-left`,children:[(0,K.jsx)(`div`,{className:V(`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,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[l?.trim()&&l.trim().toLowerCase()!==`main`?(0,K.jsx)(wd,{agentId:l,displayName:u,avatarUrl:d,className:`h-5 w-5 shrink-0`}):null,(0,K.jsx)(`span`,{className:`truncate leading-6 font-medium`,children:o}),i.label?(0,K.jsx)(`span`,{className:V(`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,K.jsx)(`span`,{className:`inline-flex h-4 w-4 shrink-0 items-center justify-center`,children:(0,K.jsx)(lu,{icon:i.icon,className:V(`h-[13px] w-[13px]`,t?`text-foreground/75`:`text-muted-foreground`)})}):null]})}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground/65`,children:[(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:s}),n?(0,K.jsx)(`span`,{"aria-label":U(`chatSessionUnread`),className:`ml-auto h-2 w-2 shrink-0 rounded-full bg-primary`}):(0,K.jsx)(`span`,{className:`ml-auto shrink-0`,children:c})]})]})}),r?(0,K.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,K.jsx)(du,{status:r})}):null,(0,K.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,K.jsx)(W,{size:`sm`,tone:`strong`,icon:(0,K.jsx)(_s,{className:V(`h-3.5 w-3.5`,a&&`fill-current text-foreground`)}),label:U(a?`chatSidebarUnpinSession`:`chatSidebarPinSession`),tooltipSide:`top`,onClick:e=>{e.stopPropagation(),_()}}),(0,K.jsx)(W,{size:`sm`,tone:`strong`,icon:(0,K.jsx)(Hn,{className:`h-3.5 w-3.5`}),label:U(`edit`),tooltipSide:`top`,onClick:e=>{e.stopPropagation(),g()}}),(0,K.jsx)(Zs,{sessionKey:e,sessionTitle:o,triggerSize:`sm`,triggerTone:`strong`,triggerTooltipSide:`top`,children:(0,K.jsx)(Ys,{icon:Jr,label:U(`chatDeleteSession`),onClick:v,destructive:!0})})]})]})}function tI(e){let{sessionKey:t,active:n,showUnreadDot:r,runStatus:i,context:a,isPinned:o,title:s,previewText:c,trailingText:l,agentId:u,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,variant:E}=e;return(0,K.jsx)(`div`,{className:V(E===`mobile`?`w-full border-b border-border/50 bg-background text-left`:V(`w-full px-3 py-2 text-left text-[13px]`,qF,n&&`bg-[var(--sidebar-interaction-selection)] text-foreground hover:bg-[var(--sidebar-interaction-selection)] focus-within:bg-[var(--sidebar-interaction-selection)] has-[[data-context-menu-open]]:bg-[var(--sidebar-interaction-selection)]`),E===`mobile`&&(n?`bg-[var(--session-interaction-selection)] font-medium text-foreground`:`text-foreground/80 hover:bg-[var(--session-interaction-hover)] hover:text-foreground`),n&&`font-medium`),children:g?(0,K.jsx)(`div`,{className:E===`mobile`?`p-4`:void 0,children:(0,K.jsx)($F,{sessionKey:t,draftLabel:_,isSaving:v,onDraftLabelChange:x,onSave:S,onCancel:C})}):E===`mobile`?(0,K.jsx)(ZF,{...e}):(0,K.jsx)(eI,{sessionKey:t,active:n,showUnreadDot:r,runStatus:i,context:a,isPinned:o,title:s,previewText:c,trailingText:l,agentId:u,agentLabel:d,agentAvatarUrl:f,onSelect:y,childSessionCount:p,cronJobCount:m,projectName:h,onStartEditing:b,onTogglePinned:w,onDelete:T})})}function nI(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:b,runStatus:x}=t,S=n===b.key,C=r[b.key],w=C&&b.readAt?C.localeCompare(b.readAt)>0?C:b.readAt:C??b.readAt,T=a.get(b.key)??[],E=b.agentId?i.get(b.agentId)?.displayName??b.agentId:null,D=Tc(b)??`${E?.trim()?`${E} · `:``}${b.messageCount}`;return(0,K.jsx)(tI,{variant:e.variant,sessionKey:b.key,active:S,showUnreadDot:Sl({active:S,lastMessageAt:b.lastMessageAt,readAt:w,runStatus:x}),runStatus:x,context:au(b,u),isPinned:d,title:f(b),previewText:D,trailingText:kc(b.lastMessageAt??b.createdAt),agentId:b.agentId??null,agentLabel:E,agentAvatarUrl:b.agentId?i.get(b.agentId)?.avatarUrl??null:null,childSessionCount:T.length,cronJobCount:o,projectName:b.projectName?.trim()||b.projectRoot?.trim().split(/[\\/]/).filter(Boolean).at(-1)||U(`chatSidebarContextNoProject`),isEditing:s===b.key,draftLabel:c,isSaving:l===b.key,onSelect:()=>p(b.key),onStartEditing:()=>m(b),onDraftLabelChange:h,onSave:()=>g(b),onCancel:_,onTogglePinned:v,onDelete:()=>y(b.key)})}function rI({onCreateSession:e,collapsed:t}){return t?(0,K.jsx)(`div`,{className:`px-2 pb-2`,children:(0,K.jsx)(W,{icon:(0,K.jsx)(Kr,{className:WF}),label:U(`chatSidebarNewTask`),className:V(UF,JF),onClick:e})}):(0,K.jsx)(K.Fragment,{children:(0,K.jsx)(`div`,{className:`px-4 pb-2`,children:(0,K.jsxs)(B,{variant:`ghost`,className:`w-full rounded-[var(--sidebar-create-radius)] [box-shadow:var(--sidebar-create-shadow)] bg-[var(--sidebar-create-background)] font-[number:var(--sidebar-create-weight)] text-[var(--sidebar-create-foreground)] hover:bg-[var(--sidebar-create-hover)] hover:text-[var(--sidebar-create-hover-foreground)]`,onClick:e,children:[(0,K.jsx)(Kr,{className:`mr-1.5 h-4 w-4`}),U(`chatSidebarNewTask`)]})})})}function iI({query:e,onQueryChange:t,isProjectFirstView:n,onSelectMode:r,onAddProject:i}){let[a,o]=(0,G.useState)(!!e),s=(0,G.useRef)(null),c=(0,G.useId)(),l=()=>{t(``),o(!1),s.current?.focus()};return(0,K.jsxs)(`div`,{className:`shrink-0 px-3`,children:[(0,K.jsxs)(`div`,{className:`flex h-8 items-center justify-between gap-1`,children:[(0,K.jsx)(Gl,{isProjectFirstView:n,onSelectMode:r}),(0,K.jsxs)(ti,{children:[n?(0,K.jsx)(W,{icon:(0,K.jsx)(wo,{className:`h-3.5 w-3.5`}),label:U(`chatProjectAdd`),onClick:i}):null,(0,K.jsx)(W,{ref:s,icon:(0,K.jsx)(kr,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarSearchPlaceholder`),"aria-expanded":a,"aria-controls":c,onClick:()=>{a?l():o(!0)}})]})]}),a?(0,K.jsx)(`div`,{id:c,className:`pb-2 pt-1`,children:(0,K.jsxs)(`div`,{className:`relative`,children:[(0,K.jsx)(kr,{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,K.jsx)(F,{autoFocus:!0,"data-theme-control":`chat-search`,density:`compact`,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),l())},"aria-label":U(`chatSidebarSearchPlaceholder`),placeholder:U(`chatSidebarSearchPlaceholder`),className:`h-8 rounded-lg border-0 bg-background/55 pl-8 pr-9 shadow-none hover:bg-[var(--interaction-hover)]`}),(0,K.jsx)(W,{icon:(0,K.jsx)(Vr,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarCloseSearch`),size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2`,onClick:l})]})}):null]})}function aI(e){let{query:t,onQueryChange:n,onCreateSession:r,isProjectFirstView:i,onSelectMode:a,onAddProject:o}=e,[s,c]=(0,G.useState)(!!t),[l,u]=(0,G.useState)(!1);return(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-border/50 bg-background px-3 text-foreground`,style:{paddingTop:`env(safe-area-inset-top, 0px)`},children:[(0,K.jsxs)(`div`,{className:`flex h-[var(--mobile-header-height)] items-center gap-1`,children:[(0,K.jsxs)(_i,{open:l,onOpenChange:u,children:[(0,K.jsx)(`h1`,{children:(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":U(`chatSidebarViewMode`),className:`flex h-11 min-w-0 items-center gap-1.5 rounded-lg px-1 text-[18px] font-semibold text-foreground`,children:[U(`chat`),i?(0,K.jsx)(ir,{className:`h-4 w-4`}):null,(0,K.jsx)(Mr,{className:`h-4 w-4 text-muted-foreground`})]})})}),(0,K.jsx)(hi,{align:`start`,variant:`menu`,children:(0,K.jsxs)(`div`,{onClick:()=>u(!1),children:[(0,K.jsx)(Ys,{icon:mo,label:U(`chatSidebarViewTime`),onClick:()=>a(`time-first`)}),(0,K.jsx)(Ys,{icon:ir,label:U(`chatSidebarViewProject`),onClick:()=>a(`project-first`)}),(0,K.jsx)(Ys,{icon:wo,label:U(`chatProjectAdd`),onClick:o}),(0,K.jsxs)(gn,{to:`/cron`,className:`${$n} text-foreground ${tr.item}`,children:[(0,K.jsx)(Qa,{className:`h-4 w-4 text-muted-foreground`}),U(`cron`)]})]})})]}),(0,K.jsx)(`div`,{className:`flex-1`}),(0,K.jsxs)(ti,{children:[(0,K.jsx)(W,{icon:s?(0,K.jsx)(Vr,{className:`h-5 w-5`}):(0,K.jsx)(kr,{className:`h-5 w-5`}),label:U(s?`chatSidebarCloseSearch`:`chatSidebarSearchPlaceholder`),tooltip:!1,onClick:()=>{c(!s),s&&n(``)}}),(0,K.jsx)(W,{icon:(0,K.jsx)(Kr,{className:`h-5 w-5`}),label:U(`chatSidebarNewTask`),tooltip:!1,onClick:r})]})]}),s?(0,K.jsx)(`div`,{className:`pb-2`,children:(0,K.jsx)(F,{autoFocus:!0,value:t,onChange:e=>n(e.target.value),placeholder:U(`chatSidebarSearchPlaceholder`),"aria-label":U(`chatSidebarSearchPlaceholder`),className:`h-10 rounded-lg border-0 bg-muted px-3 text-base shadow-none`})}):null]})}function oI(){return R({queryKey:[`app-meta`],queryFn:tt,staleTime:1/0})}var sI={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 cI(){let e=et(),t=e.actionLabel===U(`runtimeStatusRestartAction`),n=()=>{e.tone!==`healthy`&&rt.requestRuntimeBootstrapProbeNow()},r=async()=>{if(t)try{let e=await rt.runRuntimeControlAction(`restart-service`);z.success(e.message)}catch(e){let t=e instanceof Error?e.message:U(`runtimeControlActionFailed`);z.error(`${U(`runtimeControlActionFailed`)}: ${t}`)}};return(0,K.jsxs)(_i,{children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.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,K.jsx)(`span`,{className:V(`h-2.5 w-2.5 rounded-full`,sI[e.tone])})})}),(0,K.jsxs)(hi,{align:`start`,sideOffset:10,className:`w-[290px] space-y-3 rounded-2xl border border-border bg-popover p-4 text-popover-foreground`,children:[(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`div`,{className:`text-sm font-semibold text-foreground`,children:e.title}),(0,K.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:e.description})]}),e.reasonLines.length>0?(0,K.jsx)(`div`,{className:`space-y-2`,children:e.reasonLines.map(e=>(0,K.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,K.jsxs)(`div`,{className:`flex items-center justify-between border-t border-border/70 pt-1`,children:[(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:U(`runtimeStatusActionHint`)}),(0,K.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?U(`runtimeStatusRestartingAction`):e.actionLabel})]}):null]})]})}function lI({className:e,density:t=`sidebar`,suffix:n}){let{data:r}=oI(),{supported:i,busyAction:a,snapshot:o}=Ft(),s=r?.name??`NextClaw`,c=r?.productVersion?.trim(),l=c?`v${c}`:null,u=at(c),d=n??(0,K.jsx)(cI,{}),f=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`,p=t===`chrome`;return(0,K.jsxs)(`div`,{className:V(e??`flex min-w-0 items-center gap-2`,f&&`pl-[58px]`),children:[(0,K.jsx)(`div`,{className:V(`flex shrink-0 items-center justify-center overflow-hidden`,`h-6 w-6 rounded-md`),children:(0,K.jsx)(`img`,{src:`/logo.svg`,alt:s,className:`h-full w-full object-contain`})}),(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-baseline gap-1.5`,children:[(0,K.jsx)(`span`,{className:V(`shrink-0 font-semibold text-gray-800`,p?`text-[15px]`:`text-[14px]`),children:s}),l?(0,K.jsx)(uI,{versionLabel:l,density:t,releaseNotesLink:u}):null]}),(0,K.jsx)(dI,{supported:i,busyAction:a,snapshot:o}),d?(0,K.jsx)(`span`,{className:`inline-flex items-center shrink-0`,children:d}):null]})]})}function uI({versionLabel:e,density:t,releaseNotesLink:n}){let r=V(`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?[U(`desktopUpdatesVersionTooltipCurrent`).replace(`{version}`,e),U(`desktopUpdatesVersionTooltipReleaseNotes`).replace(`{version}`,n.versionLabel)].join(`
|
|
25
|
+
`):e;return(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:n?(0,K.jsx)(_n,{href:n.url,external:!0,icon:null,"aria-label":U(`desktopUpdatesVersionReleaseNotesLabel`).replace(`{currentVersion}`,e).replace(`{releaseVersion}`,n.versionLabel),className:V(r,`p-0 text-left`),children:e}):(0,K.jsx)(`span`,{tabIndex:0,"aria-label":e,className:r,children:e})}),(0,K.jsx)(ui,{side:`bottom`,className:`max-w-72 whitespace-pre-line text-xs leading-relaxed`,children:i})]})})}function dI({supported:e,busyAction:t,snapshot:n}){if(!e||!n)return null;let r=vt(n);return n.status===`downloading`?(0,K.jsx)(pI,{snapshot:n,releaseNotesLink:r}):n.status===`blocked`||n.status===`failed`?(0,K.jsx)(pI,{snapshot:n}):n.status===`downloaded`?(0,K.jsx)(fI,{link:r,children:(0,K.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 qe.applyDownloadedUpdate(),children:U(t===`applying`?`desktopUpdatesInlineApplying`:`desktopUpdatesInlineReady`)})}):n.status===`update-available`?(0,K.jsx)(fI,{link:r,children:(0,K.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 qe.downloadUpdate(),children:U(t===`downloading`?`desktopUpdatesInlineDownloading`:`desktopUpdatesInlineDownload`)})}):null}function fI({children:e,link:t}){if(!t)return e;let n=U(`desktopUpdatesUpdateReleaseNotesLabel`).replace(`{version}`,t.versionLabel);return(0,K.jsxs)(`span`,{className:`group/update-release-notes relative inline-flex shrink-0`,children:[e,(0,K.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,K.jsx)(_n,{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-[var(--interaction-hover)] focus-visible:ring-2 focus-visible:ring-gray-300`,children:n})})]})}function pI({snapshot:e,releaseNotesLink:t}){if(e.status===`blocked`||e.status===`failed`)return(0,K.jsx)(mI,{snapshot:e});let n=e.status===`downloading`?gI(e):null;return n?(0,K.jsx)(fI,{link:t??null,children:(0,K.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 mI({snapshot:e}){let t=hI(e),n=e.recoveryCommand?.trim()||null,r=e.diagnosticCommand?.trim()?U(`desktopUpdatesDiagnosticCommand`).replace(`{command}`,e.diagnosticCommand.trim()):null,i=e.errorMessage?.trim()||e.blockReason?.trim()||null,a=[t,e.status===`blocked`&&e.blockReason?U(`desktopUpdatesBlockedRootCause.${e.blockReason}`):null,i,n,r].filter(Boolean).join(`
|
|
26
|
+
`);return(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.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,K.jsx)(ui,{side:`bottom`,className:`max-w-80 whitespace-pre-line break-words text-xs leading-relaxed`,children:a})]})})}function hI(e){return e.status===`blocked`?U(`desktopUpdatesStatusBlocked`):U(e.failureStage?`desktopUpdatesFailureStage.${e.failureStage}`:`desktopUpdatesStatusFailed`)}function gI(e){let t=e.progress?.percent;return t==null?U(`desktopUpdatesInlineDownloading`):U(`desktopUpdatesInlineDownloadingPercent`).replace(`{percent}`,String(t))}var _I={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 vI({status:e,className:t}){let n=_I[e],r=U(e===`connected`?`connected`:e===`disconnected`?`disconnected`:`connecting`);return(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`span`,{role:`status`,"aria-label":r,className:V(`inline-flex h-5 w-5 items-center justify-center`,t),children:e===`connecting`?(0,K.jsx)(Rr,{className:V(`h-3 w-3 animate-spin`,n.dotClass)}):(0,K.jsx)(`span`,{className:V(e===`connected`?`h-2 w-2 rounded-full`:``,n.dotClass)})})}),(0,K.jsx)(ui,{side:`bottom`,className:`text-xs`,children:r})]})})}var yI={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 bI(e){return yI[e]}function xI(e){return bI(e).stack}function SI(e,t,n){let r=e.toLowerCase(),[i,a]=n.split(`?`),o=i.toLowerCase(),s=new URLSearchParams(t);return[...new URLSearchParams(a)].some(([e,t])=>s.get(e)!==t)?!1:r===o||r.startsWith(`${o}/`)}function CI({children:e,label:t,side:n=`right`}){return(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:e}),(0,K.jsx)(ui,{side:n,className:`text-xs`,children:t})]})})}function wI({collapsed:e,icon:t,iconNode:n,indicator:r,isActive:i,tone:a}){let o=V(e?WF:a.icon,`transition-colors`,i?`text-gray-700`:`text-muted-foreground group-hover:text-gray-700`);return(0,K.jsxs)(`span`,{className:`relative shrink-0`,children:[n?(0,K.jsx)(`span`,{className:V(o,`flex items-center justify-center overflow-hidden`),children:n}):t?(0,K.jsx)(t,{className:V(o,`block`)}):null,r?(0,K.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-2 ring-background`}):null]})}function TI({to:e,label:t,icon:n,iconNode:r,density:i=`default`,collapsed:a=!1,indicator:o=!1,trailing:s,actions:c,onNavigate:l}){let u=bI(i),{pathname:d,search:f}=mn(),p=SI(d,f,e),m=(0,K.jsxs)(`div`,{"data-sidebar-item":``,"data-active":p||void 0,className:V(`group group/sidebar-item relative flex items-center`,a?UF:`w-full`,qF,p&&`bg-[var(--sidebar-interaction-selection)] text-foreground hover:bg-[var(--sidebar-interaction-selection)] focus-within:bg-[var(--sidebar-interaction-selection)] has-[[data-context-menu-open]]:bg-[var(--sidebar-interaction-selection)]`),children:[(0,K.jsxs)(gn,{to:e,onClick:l,"aria-label":t,"aria-current":p?`page`:void 0,className:V(`flex min-w-0 flex-1 items-center rounded-xl font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,a?V(UF,`justify-center px-0 py-0`):u.row,c&&!a&&`pr-9`),children:[(0,K.jsx)(wI,{collapsed:a,icon:n,iconNode:r,indicator:o,isActive:p,tone:u}),(0,K.jsx)(`span`,{className:a?`sr-only`:`min-w-0 flex-1 truncate text-left`,children:t}),!a&&s?(0,K.jsx)(`span`,{className:V(`shrink-0 text-muted-foreground`,u.value),children:s}):null]}),!a&&c?(0,K.jsx)(`span`,{className:`absolute right-1 flex items-center`,children:c}):null]});return a?(0,K.jsx)(CI,{label:t,children:m}):m}function EI({isCollapsed:e,items:t,density:n,className:r}){return(0,K.jsx)(`ul`,{className:V(xI(n),r),children:t.map(t=>(0,K.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,K.jsx)(TI,{to:t.target,label:t.label,icon:t.icon,density:n,collapsed:e})},t.target))})}function DI({label:e,icon:t,onClick:n,density:r=`default`,className:i,labelClassName:a,trailing:o,trailingClassName:s,testId:c,trailingTestId:l,collapsed:u=!1}){let d=bI(r),f=(0,K.jsxs)(`button`,{type:`button`,onClick:n,"aria-label":e,className:V(`group flex w-full items-center font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,qF,u?V(UF,`justify-center px-0 py-0`,JF):d.row,i),"data-testid":c,children:[(0,K.jsx)(t,{className:V(u?WF:d.icon,`shrink-0 text-muted-foreground transition-colors group-hover:text-gray-700`)}),(0,K.jsx)(`span`,{className:V(u?`sr-only`:`min-w-0 flex-1 text-left`,a),children:e}),!u&&o?(0,K.jsx)(`span`,{className:V(`shrink-0 text-muted-foreground`,d.value,s),"data-testid":l,children:o}):null]});return u?(0,K.jsx)(CI,{label:e,children:f}):f}var OI=[`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 kI(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`,OI),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(`
|
|
27
|
+
`),n.after(r),`<!doctype html>${t.documentElement.outerHTML}`}function AI({content:e,fillHeight:t,title:n}){let r=(0,G.useMemo)(()=>kI(e),[e]);return(0,K.jsx)(`iframe`,{className:V(`w-full md: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 jI({className:e,content:t,contentType:n,fillHeight:r=!1,title:i}){return(0,K.jsx)(`div`,{className:V(`inbox-delivery-content`,e),children:n===`html`?(0,K.jsx)(AI,{content:t,fillHeight:r,title:i}):(0,K.jsx)(sr,{text:t,role:`assistant`,texts:{copyCodeLabel:U(`chatCodeCopy`),copiedCodeLabel:U(`chatCodeCopied`)}})})}var MI={readerOpen:!1,activeDeliveryId:null},NI=ct(e=>({snapshot:MI,setSnapshot:t=>e(e=>({snapshot:{...e.snapshot,...t}}))})),PI=[`inbox-deliveries`];function FI(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 II=class{constructor(e=se){this.queryClient=e,this.cleanups=[],this.offerPromise=null,this.started=!1,this.start=()=>{this.started||(this.started=!0,this.cleanups.push(L.eventBus.on(Vt.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=()=>{NI.getState().setSnapshot({readerOpen:!1})},this.selectInReader=async e=>{let t=await this.updateState(e,`present`);return NI.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 L.inboxDeliveries.delete(e);if(t){this.queryClient.setQueryData(PI,t=>t&&FI(t.deliveries.filter(({id:t})=>t!==e)));let{snapshot:t}=NI.getState();t.activeDeliveryId===e&&NI.getState().setSnapshot({activeDeliveryId:null,readerOpen:!1})}return t},this.prepareChatReference=async e=>{let[t,n]=await Promise.all([L.systemObjectReferences.resolve(ke(tn,e)),L.inboxDeliveries.get(e)]),r=n.source.sessionId?.trim()||null;if(r)try{await L.sessions.get(r)}catch(e){if(!(e instanceof ht)||e.status!==404)throw e;r=null}let i=await this.updateState(e,`read`);return this.closeReader(),{delivery:i,reference:t,targetSessionKey:r}},this.updateState=async(e,t)=>{let n=await L.inboxDeliveries.updateState(e,t);return this.replaceCachedDelivery(n),n},this.replaceCachedDelivery=e=>{this.queryClient.setQueryData(PI,t=>t&&FI(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:PI}),this.offerPendingDelivery()},this.handleVisibilityChange=()=>{document.visibilityState===`visible`&&this.offerPendingDelivery()},this.offerPendingDelivery=()=>{this.offerPromise||!this.isVisible()||NI.getState().snapshot.readerOpen||(this.offerPromise=this.openOldestPendingDelivery().catch(()=>void 0).finally(()=>{this.offerPromise=null}))},this.openOldestPendingDelivery=async()=>{let e=(await this.queryClient.fetchQuery({queryKey:PI,queryFn:()=>L.inboxDeliveries.list(),staleTime:0})).deliveries.filter(e=>!e.presentedAt&&!e.readAt&&!e.archivedAt),t=e[e.length-1];!t||!this.isVisible()||NI.getState().snapshot.readerOpen||await this.selectInReader(t.id)},this.isVisible=()=>typeof document>`u`||document.visibilityState===`visible`}};function LI(){return R({queryKey:PI,queryFn:()=>L.inboxDeliveries.list()})}function RI(){return LI().data?.unreadCount??0}function zI(e,t){return U(`inboxReaderPosition`).replace(`{current}`,String(e)).replace(`{total}`,String(t))}function BI(){let e=(0,G.useRef)(null),t=fn(),{chatComposerIntentManager:n,docBrowserManager:r,inboxManager:i}=$(),{isMobile:a}=Gr(),{data:o}=LI(),{activeDeliveryId:s,readerOpen:c}=NI(e=>e.snapshot),[l,u]=(0,G.useState)(null),[d,f]=(0,G.useState)(null),p=(o?.deliveries??[]).filter(e=>!e.readAt&&!e.archivedAt),m=p.findIndex(({id:e})=>e===s),h=m>=0?p[m]:null,g=h?.contentType===`html`,_=async(e,t)=>{u(e),f(null);try{await t()}catch{f(U(`inboxActionError`))}finally{u(null)}},v=e=>{let t=p[e];t&&_(`select`,async()=>{await i.selectInReader(t.id)})},y=()=>{h&&_(`open`,async()=>{await i.markRead(h.id),i.closeReader(),t(`/inbox/${encodeURIComponent(h.id)}`)})},b=()=>{h&&_(`continue`,async()=>{let{reference:e,targetSessionKey:o}=await i.prepareChatReference(h.id);n.requestSystemObjectReference({targetSessionKey:o,reference:e}),a&&r.close(),t(o?Vs(o):Is)})},x=()=>{h&&_(`read`,async()=>{await i.markRead(h.id),i.closeReader()})},S=p.length>1?(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 pr-1`,children:[(0,K.jsxs)(`span`,{className:`mr-1 text-[11px] tabular-nums text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`hidden md:inline`,children:zI(m+1,p.length)}),(0,K.jsxs)(`span`,{className:`md:hidden`,"aria-label":zI(m+1,p.length),children:[m+1,`/`,p.length]})]}),(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(er,{className:`h-4 w-4`}),label:U(`inboxPrevious`),disabled:m<=0||l===`select`,onClick:()=>v(m-1)}),(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(nr,{className:`h-4 w-4`}),label:U(`inboxNext`),disabled:m>=p.length-1||l===`select`,onClick:()=>v(m+1)})]}):null;return(0,K.jsx)(li,{open:c&&!!h,onOpenChange:e=>{e||i.closeReader()},children:(0,K.jsx)(oi,{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-md:h-[100dvh] max-md:max-h-[100dvh] max-md:w-screen max-md:max-w-none max-md:rounded-none max-md:border-0 max-md:pt-[env(safe-area-inset-top,0px)] max-md:pb-[env(safe-area-inset-bottom,0px)]`,onOpenAutoFocus:t=>{t.preventDefault(),e.current?.focus()},children:h?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(ei,{className:`items-center gap-1 border-b border-border/50 px-3 py-2 md:gap-3 md:px-6 md:py-3`,actions:(0,K.jsxs)(K.Fragment,{children:[S,(0,K.jsx)(jz,{page:Ez(`inbox-delivery`,h.id,h.title)})]}),children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`hidden h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-muted/70 text-muted-foreground md:flex`,children:(0,K.jsx)(Ir,{className:`h-3.5 w-3.5`})}),(0,K.jsx)(si,{ref:e,tabIndex:-1,title:h.title,className:`min-w-0 truncate text-sm font-medium text-foreground outline-none`,children:h.title}),(0,K.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground md:inline`,"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground md:block`,dateTime:h.createdAt,children:Zr(h.createdAt)})]}),(0,K.jsx)(ci,{className:`sr-only`,children:h.summary??U(`inboxNoSummary`)})]}),(0,K.jsx)(`div`,{className:V(`min-h-0 flex-1`,g?`p-0 md:p-4`:`custom-scrollbar overflow-y-auto overscroll-contain px-4 py-3 md:px-8 md:py-6`),children:(0,K.jsx)(jI,{className:g?`h-full`:void 0,content:h.content,contentType:h.contentType,fillHeight:g,title:h.title})}),(0,K.jsxs)(`footer`,{className:`shrink-0 border-t border-border/50 bg-background px-3 py-2 md:px-6 md:py-3`,children:[d?(0,K.jsx)(`p`,{role:`alert`,className:`mb-3 text-sm text-destructive`,children:d}):null,(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2 [--control-touch-size:2rem]`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(B,{size:`sm`,className:`px-2 md:px-3`,variant:`ghost`,onClick:i.closeReader,children:U(`inboxReadLater`)}),(0,K.jsx)(B,{size:`sm`,className:`px-2 md:px-3`,variant:`outline`,disabled:l!==null,onClick:x,children:U(`inboxMarkRead`)}),(0,K.jsxs)(B,{size:`sm`,className:`px-2 md:px-3`,variant:`ghost`,"aria-label":U(`inboxOpenInbox`),disabled:l!==null,onClick:y,children:[(0,K.jsx)(`span`,{className:`md:hidden`,children:U(`inboxTitle`)}),(0,K.jsx)(`span`,{className:`hidden md:inline`,children:U(`inboxOpenInbox`)})]})]}),(0,K.jsxs)(B,{size:`sm`,className:`px-2 md:px-3`,"aria-label":U(`inboxContinueChat`),disabled:l!==null,onClick:b,children:[(0,K.jsx)(`span`,{className:`md:hidden`,children:U(`inboxContinueChatCompact`)}),(0,K.jsx)(`span`,{className:`hidden md:inline`,children:U(`inboxContinueChat`)})]})]})]})]}):null})})}function VI(){let{inboxManager:e}=$();return(0,G.useEffect)(()=>(e.start(),()=>e.stop()),[e]),(0,K.jsx)(BI,{})}function HI(e,t){return t||(e.some(e=>!e.readAt&&!e.archivedAt)?`unread`:`all`)}function UI(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 WI({selection:e=!1}){return(0,K.jsxs)(`div`,{className:`flex h-full min-h-56 flex-col items-center justify-center px-8 text-center`,children:[(0,K.jsx)(`span`,{className:`mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-muted text-muted-foreground`,children:(0,K.jsx)(Ir,{className:`h-5 w-5`})}),(0,K.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:U(e?`inboxSelectTitle`:`inboxEmptyTitle`)}),(0,K.jsx)(`p`,{className:`mt-2 max-w-sm text-sm leading-6 text-muted-foreground`,children:U(e?`inboxSelectDescription`:`inboxEmptyDescription`)})]})}function GI({activeDeliveryId:e,deliveries:t,filter:n,onFilterChange:r}){let{onScroll:i,scrollRef:a}=aS({restorationKey:`inbox:list`}),o=[{id:`unread`,label:U(`inboxUnread`),count:UI(t,`unread`).length},{id:`all`,label:U(`inboxAll`),count:UI(t,`all`).length},{id:`archived`,label:U(`inboxArchived`),count:UI(t,`archived`).length}],s=UI(t,n);return(0,K.jsxs)(`aside`,{className:`flex min-h-0 flex-col border-border/60 bg-muted/20 md:border-r`,children:[(0,K.jsx)(`div`,{className:`flex shrink-0 gap-1 border-b border-border/50 px-3 py-2`,children:o.map(e=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),"aria-pressed":n===e.id,className:V(`inline-flex min-h-11 items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border md:min-h-0 md:px-2.5 md:text-xs`,n===e.id?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[e.label,(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] font-normal tabular-nums opacity-60`,children:e.count})]},e.id))}),(0,K.jsx)(`div`,{ref:a,onScroll:i,className:`custom-scrollbar min-h-0 flex-1 overflow-y-auto p-2`,children:s.length>0?(0,K.jsx)(`ul`,{className:`space-y-0.5`,children:s.map(t=>(0,K.jsxs)(`li`,{className:V(`group/page-row relative rounded-lg hover:bg-[var(--interaction-hover)] focus-within:bg-[var(--interaction-hover)] has-[[data-context-menu-open]]:bg-[var(--interaction-hover)]`,e===t.id&&`bg-[var(--interaction-selection)] hover:bg-[var(--interaction-selection)] focus-within:bg-[var(--interaction-selection)] has-[[data-context-menu-open]]:bg-[var(--interaction-selection)]`),children:[(0,K.jsxs)(gn,{to:`/inbox/${encodeURIComponent(t.id)}`,className:V(`block rounded-lg px-2.5 py-3 pr-12 text-sm md:py-2 md:pr-10 md:text-[13px] transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,e===t.id?`text-foreground`:`text-foreground/80 hover:text-foreground`),children:[(0,K.jsx)(`h2`,{className:V(`truncate font-medium leading-5`,!t.readAt&&`font-semibold text-foreground`),children:t.title}),(0,K.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-[11px] leading-4 text-muted-foreground/65`,children:[(0,K.jsx)(`p`,{className:`min-w-0 flex-1 truncate`,children:t.summary??U(`inboxNoSummary`)}),t.readAt?(0,K.jsx)(`time`,{className:`shrink-0 tabular-nums`,dateTime:t.createdAt,children:Qr(t.createdAt)}):(0,K.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-primary`,"aria-label":U(`inboxUnread`)})]})]}),(0,K.jsx)(`span`,{className:`absolute right-1 top-1.5`,children:(0,K.jsx)(jz,{revealOnHover:!0,page:Ez(`inbox-delivery`,t.id,t.title)})})]},t.id))}):(0,K.jsx)(WI,{})})]})}function KI({delivery:e,isMobile:t,error:n,pending:r,onArchiveToggle:i,onContinue:a,onDelete:o,onReadToggle:s}){let c=fn(),l=(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(Or,{className:`h-4 w-4`}),label:U(`inboxTitle`),onClick:()=>c(`/inbox`)}),{onScroll:u,scrollRef:d}=aS({restorationKey:e?`inbox:delivery:${e.id}`:null});if(!e)return(0,K.jsxs)(`main`,{className:`flex min-h-0 flex-col`,children:[(0,K.jsx)(`div`,{className:`md:hidden`,children:l}),(0,K.jsx)(WI,{selection:!0})]});let f=e.contentType===`html`;return(0,K.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-col max-md:pt-[env(safe-area-inset-top,0px)] max-md:pb-[env(safe-area-inset-bottom,0px)]`,children:[(0,K.jsx)(`div`,{className:`shrink-0 border-b border-border/50 px-2 py-2 md:px-6 md:py-3`,children:(0,K.jsxs)(`div`,{className:`flex min-h-7 min-w-0 items-center gap-1`,children:[(0,K.jsx)(`div`,{className:`md:hidden`,children:l}),(0,K.jsx)(`h2`,{title:e.title,className:`min-w-0 flex-1 truncate text-sm font-medium text-foreground md:flex-none`,children:e.title}),(0,K.jsx)(`span`,{className:`hidden shrink-0 text-muted-foreground md:inline`,"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`time`,{className:`hidden shrink-0 text-[11px] tabular-nums text-muted-foreground md:block`,dateTime:e.createdAt,children:Zr(e.createdAt)}),t?(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(qo,{className:`h-4 w-4`}),label:U(`inboxContinueChat`),disabled:r,onClick:a}),(0,K.jsx)(xr,{label:U(`inboxTitle`),groups:[{key:`delivery`,items:[{key:`read`,label:e.readAt?U(`inboxMarkUnread`):U(`inboxMarkRead`),disabled:r,onSelect:s},{key:`archive`,label:e.archivedAt?U(`inboxRestore`):U(`inboxArchive`),icon:(0,K.jsx)($a,{className:`h-4 w-4`}),disabled:r,onSelect:i},{key:`delete`,label:U(`inboxDelete`),icon:(0,K.jsx)(Jr,{className:`h-4 w-4`}),destructive:!0,disabled:r,onSelect:o}]}],children:(0,K.jsx)(`div`,{children:(0,K.jsx)(dr,{children:(0,K.jsx)(W,{size:`sm`,icon:(0,K.jsx)(wr,{className:`h-4 w-4`}),label:U(`more`)})})})})]}):null]})}),n?(0,K.jsx)(`p`,{role:`alert`,className:`shrink-0 px-4 py-2 text-sm text-destructive`,children:n}):null,(0,K.jsx)(`div`,{className:V(`min-h-0 flex-1`,f?`p-0 md:p-4`:`custom-scrollbar overflow-y-auto overscroll-contain px-4 py-4 sm:px-6 sm:py-6`),ref:d,onScroll:u,children:(0,K.jsx)(`div`,{className:V(`mx-auto max-w-5xl`,f&&`h-full`),children:(0,K.jsx)(jI,{className:f?`h-full`:void 0,content:e.content,contentType:e.contentType,fillHeight:f,title:e.title})})}),t?null:(0,K.jsx)(`div`,{className:`shrink-0 border-t border-border/50 px-6 py-3`,children:(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`hidden md:flex flex-wrap items-center gap-1`,children:[(0,K.jsx)(B,{size:`sm`,variant:`outline`,disabled:r,onClick:s,children:e.readAt?U(`inboxMarkUnread`):U(`inboxMarkRead`)}),(0,K.jsxs)(B,{size:`sm`,variant:`ghost`,disabled:r,onClick:i,children:[e.archivedAt?(0,K.jsx)(On,{className:`mr-2 h-4 w-4`}):(0,K.jsx)($a,{className:`mr-2 h-4 w-4`}),e.archivedAt?U(`inboxRestore`):U(`inboxArchive`)]}),(0,K.jsxs)(B,{size:`sm`,variant:`ghost`,disabled:r,onClick:o,children:[(0,K.jsx)(Jr,{className:`mr-2 h-4 w-4`}),U(`inboxDelete`)]})]}),(0,K.jsxs)(B,{size:`sm`,disabled:r,onClick:a,children:[(0,K.jsx)(qo,{className:`mr-2 h-4 w-4`}),U(`inboxContinueChat`)]})]})})]})}function qI({resourceId:e}={}){let t=fn(),{deliveryId:n}=pn(),r=e??n,{isMobile:i}=Gr(),{chatComposerIntentManager:a,docBrowserManager:o,inboxManager:s}=$(),c=LI(),{confirm:l,ConfirmDialog:u}=xx(),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(null),[h,g]=(0,G.useState)(null),_=(0,G.useMemo)(()=>c.data?.deliveries??[],[c.data?.deliveries]),v=(0,G.useMemo)(()=>r?_.find(({id:e})=>e===r)??null:null,[_,r]),y=HI(_,d);(0,G.useEffect)(()=>{v&&!v.readAt&&s.markRead(v.id).catch(()=>g(U(`inboxActionError`)))},[v,s]);let b=async(e,t)=>{m(e),g(null);try{await t()}catch{g(U(`inboxActionError`))}finally{m(null)}},x=()=>{v&&b(`continue`,async()=>{let{reference:e,targetSessionKey:n}=await s.prepareChatReference(v.id);a.requestSystemObjectReference({targetSessionKey:n,reference:e}),i&&o.close(),t(n?Vs(n):Is)})},S=async()=>{!v||!await l({title:U(`inboxDeleteTitle`),description:U(`inboxDeleteDescription`),confirmLabel:U(`inboxDeleteConfirm`),variant:`destructive`})||b(`delete`,async()=>{await s.delete(v.id),t(`/inbox`,{replace:!0})})},C=()=>{v&&b(`read`,async()=>{if(v.readAt){await s.markUnread(v.id),t(`/inbox`,{replace:!0});return}await s.markRead(v.id)})},w=()=>{v&&b(`archive`,async()=>{if(v.archivedAt){await s.restore(v.id);return}await s.archive(v.id),t(`/inbox`,{replace:!0})})},T=!e&&(!i||!r),E=!i||!!r;return e&&c.isPending?(0,K.jsx)(`p`,{role:`status`,className:`p-4`,children:U(`loading`)}):e&&!c.isError&&!v?(0,K.jsx)(`p`,{role:`alert`,className:`p-4`,children:U(`resourceNotFound`)}):(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col md:gap-6`,children:[!i&&!e?(0,K.jsx)(Ce,{headingLevel:1,title:U(`inboxTitle`),className:`px-4 sm:px-0`}):null,(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden bg-background md:rounded-2xl md:border md:border-border/60`,children:c.isError?(0,K.jsxs)(`div`,{className:`p-4`,children:[i&&r?(0,K.jsx)(W,{icon:(0,K.jsx)(Or,{className:`h-4 w-4`}),label:U(`inboxTitle`),onClick:()=>t(`/inbox`)}):null,(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:U(`inboxLoadError`)})]}):(0,K.jsxs)(`div`,{className:V(`grid h-full min-h-0 grid-cols-1`,!e&&`md:grid-cols-[300px_minmax(0,1fr)]`),children:[T?(0,K.jsx)(GI,{activeDeliveryId:v?.id??null,deliveries:_,filter:y,onFilterChange:f}):null,E?(0,K.jsx)(KI,{delivery:v,isMobile:i,error:h,pending:p!==null,onArchiveToggle:w,onContinue:x,onDelete:()=>void S(),onReadToggle:C}):null]})}),(0,K.jsx)(u,{})]})}function JI(e,t){return t.some(t=>t.value===e)?e:t[0]?.value??e}function YI(e){let{groups:t,defaultSessionType:n,sessionTypeOptions:r,renderSessionItem:i,projectCronJobCountByRoot:a}=e,o=q(),s=mn(),c=fn(),l=Su(),{confirm:u,ConfirmDialog:d}=xx(),f=J(e=>e.snapshot.collapsedProjectRoots),[p,m]=(0,G.useState)(null),h=(0,G.useMemo)(()=>JI(n,r),[n,r]),g=async e=>{if(e.projectId&&(m(null),await u({title:`${U(`projectsRemoveConfirmTitle`)} “${e.projectName}”`,description:U(`projectsRemoveConfirmDescription`),confirmLabel:U(`projectsRemoveConfirmAction`),variant:`default`})))try{await l.mutateAsync(e.projectId),s.pathname.startsWith(`/projects/${e.projectId}/`)&&c(`/projects`)}catch{}};return(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[t.map(e=>{let t=`${U(`chatSidebarNewTask`)} · ${e.projectName}`,n=f.includes(e.projectRoot),r=n&&e.items.some(e=>e.runStatus===`running`),c=!!e.projectId&&s.pathname.startsWith(`/projects/${e.projectId}/`),u=U(e.isPinned?`chatSidebarUnpinProject`:`chatSidebarPinProject`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:V(`group/project relative h-8 px-1`,qF,c&&`bg-[var(--sidebar-interaction-selection)] text-foreground hover:bg-[var(--sidebar-interaction-selection)] focus-within:bg-[var(--sidebar-interaction-selection)] has-[[data-context-menu-open]]:bg-[var(--sidebar-interaction-selection)]`),children:[(0,K.jsx)(QF,{title:e.projectName,metrics:[{icon:(0,K.jsx)(ir,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarContextPath`),value:e.projectRoot},{icon:(0,K.jsx)(Jo,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarContextSessions`),value:e.items.length},{icon:(0,K.jsx)(Qa,{className:`h-3.5 w-3.5`}),label:U(`chatSidebarContextScheduledTasks`),value:a.get(e.projectRoot)??0}],children:(0,K.jsxs)(`div`,{className:V(`flex h-full w-full min-w-0 items-center group-hover/project:pr-20 group-has-[[data-project-actions]:focus-within]/project:pr-20`,r&&`pr-7`),children:[(0,K.jsx)(W,{icon:n?(0,K.jsx)(nr,{className:`h-3.5 w-3.5`}):(0,K.jsx)(Mr,{className:`h-3.5 w-3.5`}),label:U(n?`chatSidebarExpandProject`:`chatSidebarCollapseProject`),"aria-expanded":!n,size:`sm`,tone:`surface`,tooltip:!1,onClick:()=>o.chatSessionListManager.toggleProjectCollapsed(e.projectRoot)}),e.projectId?(0,K.jsxs)(gn,{to:`/projects/${encodeURIComponent(e.projectId)}/overview`,state:{returnTo:`${s.pathname}${s.search}`},className:`flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-md px-1 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,"aria-current":c?`page`:void 0,title:e.projectRoot,children:[(0,K.jsx)(ir,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.projectName})]}):(0,K.jsxs)(`span`,{className:`flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-md px-1 text-left`,title:e.projectRoot,children:[(0,K.jsx)(ir,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.projectName})]})]})}),r?(0,K.jsx)(`span`,{className:`absolute right-2 top-1/2 inline-flex -translate-y-1/2 transition-opacity group-hover/project:opacity-0 group-has-[[data-project-actions]:focus-within]/project:opacity-0`,children:(0,K.jsx)(du,{status:`running`})}):null,(0,K.jsxs)(`div`,{"data-project-actions":!0,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:[(0,K.jsx)(W,{icon:(0,K.jsx)(Kr,{className:`h-3.5 w-3.5`}),label:t,onClick:()=>o.chatSessionListManager.createSession({projectRoot:e.projectRoot,sessionType:h})}),(0,K.jsx)(W,{icon:(0,K.jsx)(_s,{className:e.isPinned?`h-3.5 w-3.5 fill-current text-foreground`:`h-3.5 w-3.5`}),label:u,tooltipSide:`top`,onClick:()=>o.chatSessionListManager.toggleProjectPinned(e.projectRoot)}),e.projectId?(0,K.jsxs)(_i,{open:p===e.projectRoot,onOpenChange:t=>m(t?e.projectRoot:null),children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(W,{icon:(0,K.jsx)(wr,{className:`h-3.5 w-3.5`}),label:U(`projectsMoreActions`).replace(`{name}`,e.projectName),tooltip:!1,disabled:l.isPending,onClick:e=>e.stopPropagation()})}),(0,K.jsx)(hi,{align:`end`,variant:`menu`,children:(0,K.jsx)(Ys,{icon:So,label:U(`projectsRemoveFromList`),disabled:l.isPending,onClick:()=>void g(e)})})]}):null]})]}),n?null:(0,K.jsx)(`div`,{className:`mt-0.5 space-y-0.5 pl-2`,children:e.items.map(i)})]},e.projectRoot)}),(0,K.jsx)(d,{},`project-remove-confirm-dialog`)]})}function XI({label:e}){return(0,K.jsxs)(`div`,{className:`p-4 text-center`,children:[(0,K.jsx)(Jo,{className:`mx-auto mb-2 h-6 w-6 text-muted-foreground/45`}),(0,K.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:e})]})}function ZI({group:e,variant:t,renderSessionItem:n}){let[r,i]=(0,G.useState)(!0);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":r,onClick:()=>i(e=>!e),className:V(`group/session-heading flex w-full cursor-pointer items-center justify-between gap-2 rounded-xl text-left text-xs font-medium text-muted-foreground outline-none transition-colors duration-base hover:bg-[var(--interaction-hover)] hover:text-foreground`,t===`mobile`?`min-h-9 px-4`:`min-h-7 px-2`),children:[(0,K.jsx)(`span`,{className:`truncate`,children:e.label}),(0,K.jsx)(nr,{"aria-hidden":`true`,className:V(`h-3 w-3 shrink-0 opacity-0 transition-[opacity,transform] duration-200 group-hover/session-heading:opacity-100 motion-reduce:transition-none`,r&&`rotate-90`)})]}),(0,K.jsx)(Yn,{open:r,children:()=>(0,K.jsx)(`div`,{className:t===`mobile`?void 0:`space-y-0.5`,children:e.items.map(n)})})]})}function QI({variant:e=`desktop`,defaultSessionType:t,groups:n,isLoading:r,isProjectFirstView:i,projectGroups:a,projectCronJobCountByRoot:o,renderSessionItem:s,sessionTypeOptions:c}){return r?(0,K.jsx)(`div`,{className:`p-3 text-xs text-muted-foreground`,children:U(`sessionsLoading`)}):i?a.length===0?(0,K.jsx)(XI,{label:U(`chatSidebarProjectViewEmpty`)}):(0,K.jsx)(YI,{groups:a,projectCronJobCountByRoot:o,defaultSessionType:t,sessionTypeOptions:c,renderSessionItem:s}):n.length===0?(0,K.jsx)(XI,{label:U(`sessionsEmpty`)}):(0,K.jsx)(`div`,{className:e===`mobile`?void 0:`space-y-2`,children:n.map(t=>(0,K.jsx)(ZI,{group:t,variant:e,renderSessionItem:s},t.label))})}function $I({isOpen:e,onOpenChange:t,currentTheme:r,currentThemeLabel:i,themeOptions:a,onSelectTheme:o,currentLanguage:s,currentLanguageLabel:c,languageOptions:l,onSelectLanguage:u,onOpenDocs:d,onOpenApps:f,collapsed:p=!1}){return(0,K.jsxs)(_i,{open:e,onOpenChange:t,children:[p?(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":U(`settingsMenu`),className:V(`flex items-center justify-center`,UF,JF),children:(0,K.jsx)(zr,{className:V(WF,`shrink-0 text-muted-foreground`)})})})}),(0,K.jsx)(ui,{side:`right`,className:`text-xs`,children:U(`settingsMenu`)})]})}):(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"aria-label":U(`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-[var(--interaction-hover)] hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:[(0,K.jsx)(zr,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 text-left`,children:U(`settings`)})]})}),(0,K.jsxs)(hi,{side:p?`right`:`top`,align:p?`end`:`start`,variant:`menu`,matchTriggerWidth:!p,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(dn,{to:`/settings`,onClick:()=>t(!1),className:`${$n} text-foreground ${tr.item}`,children:[(0,K.jsx)(zr,{className:`h-4 w-4 text-muted-foreground/70`}),(0,K.jsx)(`span`,{className:`flex-1 text-left`,children:U(`settings`)})]}),[{key:`docs`,icon:Ar,label:U(`docBrowserHelp`),action:d},{key:`apps`,icon:n,label:U(`appsTitle`),action:f}].map(({key:e,icon:n,label:r,action:i})=>(0,K.jsxs)(`button`,{type:`button`,onClick:()=>{i(),t(!1)},className:`${$n} text-foreground ${tr.item}`,children:[(0,K.jsx)(n,{className:`h-4 w-4 text-muted-foreground/70`}),(0,K.jsx)(`span`,{className:`flex-1 text-left`,children:r})]},e))]}),(0,K.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,K.jsx)(eL,{icon:as,label:U(`theme`),options:a,value:r,valueLabel:i,onSelect:o,onCloseMenu:()=>t(!1)}),(0,K.jsx)(eL,{icon:Lo,label:U(`language`),options:l,value:s,valueLabel:c,onSelect:u,onCloseMenu:()=>t(!1)})]})]})}function eL({icon:e,label:t,options:n,value:r,valueLabel:i,onSelect:a,onCloseMenu:o}){return(0,K.jsxs)(pa,{value:r,onOpenChange:e=>{e||o()},onValueChange:e=>a(e),children:[(0,K.jsxs)(la,{"aria-label":t,className:`${$n} h-auto border-0 bg-transparent text-foreground shadow-none focus:ring-0 ${tr.item}`,indicator:(0,K.jsx)(nr,{className:`h-4 w-4 text-muted-foreground/70`}),children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(e,{className:`h-4 w-4 shrink-0 text-muted-foreground/70`}),(0,K.jsx)(`span`,{className:`text-left`,children:t})]}),(0,K.jsx)(`span`,{className:`ml-auto max-w-[96px] truncate text-[13px] text-muted-foreground`,children:i})]}),(0,K.jsx)(ua,{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,K.jsx)(fa,{value:e.value,className:`text-[13px]`,children:e.label},e.value))})]})}var tL=ct(()=>({supported:!1,initialized:!1,busyAction:null,snapshot:null})),nL=new class{constructor(){this.start=async()=>{let e=this.getDesktopApi();if(!e){this.markUnsupported();return}tL.setState({supported:!0,initialized:!1,busyAction:`loading`});try{let t=await e.getPresenceState();tL.setState({supported:!0,initialized:!0,busyAction:null,snapshot:t})}catch(e){tL.setState({supported:!0,initialized:!0,busyAction:null}),z.error(`${U(`runtimePresenceLoadFailed`)}: ${this.getErrorMessage(e)}`)}},this.markUnsupported=()=>{tL.setState({supported:!1,initialized:!0,busyAction:null,snapshot:null})},this.updatePreferences=async e=>{let t=this.getDesktopApi();if(!t)throw Error(U(`runtimePresenceLaunchAtLoginUnavailable`));tL.setState({busyAction:`saving-preferences`});try{let n=await t.updatePresencePreferences(e);return tL.setState({supported:!0,initialized:!0,snapshot:n}),z.success(U(`runtimePresenceSaved`)),n}catch(e){throw z.error(`${U(`runtimePresenceSaveFailed`)}: ${this.getErrorMessage(e)}`),e}finally{tL.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:U(`error`)}},rL=ct(()=>({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){rL.setState({supported:!1,initialized:!0,snapshot:null});return}this.unsubscribe||=e.onUpdateStateChanged(e=>{rL.setState({supported:!0,initialized:!0,snapshot:e})}),rL.setState({supported:!0,initialized:!1});try{let t=await e.getUpdateState();rL.setState({supported:!0,initialized:!0,snapshot:t})}catch(e){rL.setState({supported:!0,initialized:!0}),z.error(`${U(`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`,U(`desktopUpdatesCheckFailed`),async e=>await e.checkForUpdates())}catch{return}if(e.status===`up-to-date`){z.success(U(`desktopUpdatesAlreadyLatest`));return}if(e.status===`update-available`){z.success(U(`desktopUpdatesAvailable`).replace(`{version}`,e.availableVersion??U(`desktopUpdatesUnknownVersion`)));return}if(e.status===`downloaded`){z.success(U(`desktopUpdatesReadyToApply`));return}e.status===`failed`&&e.errorMessage&&z.error(e.errorMessage)},this.downloadUpdate=async()=>{let e;try{e=await this.runSnapshotCommand(`downloading`,U(`desktopUpdatesDownloadFailed`),async e=>await e.downloadUpdate())}catch{return}e.status===`downloaded`&&z.success(U(`desktopUpdatesReadyToApply`))},this.applyDownloadedUpdate=async()=>{try{await this.runSnapshotCommand(`applying`,U(`desktopUpdatesApplyFailed`),async e=>await e.applyDownloadedUpdate())}catch{return}},this.updateChannel=async e=>{if(rL.getState().snapshot?.channel===e)return;let t;try{t=await this.runSnapshotCommand(`switching-channel`,U(`desktopUpdatesChannelChangeFailed`),async t=>await t.updateChannel(e))}catch{return}if(t.status===`update-available`&&t.availableVersion){z.success(U(`desktopUpdatesChannelChangedWithUpdate`).replace(`{channel}`,this.getChannelLabel(e)).replace(`{version}`,t.availableVersion));return}z.success(U(`desktopUpdatesChannelChanged`).replace(`{channel}`,this.getChannelLabel(e)))},this.runSnapshotCommand=async(e,t,n)=>{let r=this.getDesktopApi();if(!r)throw Error(U(`desktopUpdatesDesktopOnlyDescription`));rL.setState({busyAction:e});try{let e=await n(r);return rL.setState({snapshot:e}),e}catch(e){throw z.error(`${t}: ${this.getErrorMessage(e)}`),e}finally{rL.setState({busyAction:null})}},this.getDesktopApi=()=>typeof window>`u`?null:window.nextclawDesktop??null,this.getErrorMessage=e=>e instanceof Error?e.message:U(`error`),this.getChannelLabel=e=>U(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}};function iL(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return n===r||n.startsWith(`${r}/`)}function aL(e){let t=e.toLowerCase();return t===`/resource`||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===`/projects`||t.startsWith(`/projects/`)||t.startsWith(`/apps/panel/`)}function oL(e){let t=e.toLowerCase();return t.startsWith(`/chat/`)&&t!==`/chat`}function sL(e){return/^\/inbox\/[^/]+\/?$/i.test(e)}function cL(e){return[{target:`/chat`,label:e(`chat`),icon:qo},{target:`/inbox`,label:e(`inboxTitle`),icon:Ir},{target:`/skills`,label:e(`marketplaceFilterSkills`),icon:io},{target:`/agents`,label:e(`agentsPageTitle`),icon:Dr},{target:`/settings`,label:e(`settings`),icon:zr}]}function lL(e,t={}){return[{label:e(`settingsGroupBasic`),items:[{target:`/model`,label:e(`model`),icon:yo},{target:`/providers`,label:e(`providers`),icon:_r},{target:`/channels`,label:e(`channels`),icon:Br}]},{label:e(`settingsGroupCommon`),items:[{target:`/appearance`,label:e(`appearance`),icon:as},{target:`/updates`,label:e(`updates`),icon:Nr},{target:`/search`,label:e(`searchChannels`),icon:kr},{target:`/keyboard-shortcuts`,label:e(`keyboardShortcuts`),icon:Io}]},{label:e(`settingsGroupSecurity`),items:[{target:`/security`,label:e(`security`),icon:Ss},{target:`/privacy`,label:e(`privacy`),icon:yn},{target:`/secrets`,label:e(`secrets`),icon:Hr},{target:`/desktop-capabilities`,label:e(`desktopCapabilities`),icon:Qo}]},{label:e(`settingsGroupSystem`),items:[{target:`/remote`,label:e(`remote`),icon:As},{target:`/runtime`,label:e(`runtime`),icon:yo},{target:`/marketplace/mcp`,label:e(`marketplaceFilterMcp`),icon:zn},{target:`/extensions`,label:e(`extensions`),icon:bn}]}].map(e=>({...e,items:e.items.filter(e=>(t.includeDesktopCapabilities!==!1||e.target!==`/desktop-capabilities`)&&(t.includeKeyboardShortcuts!==!1||e.target!==`/keyboard-shortcuts`))})).filter(e=>e.items.length>0)}function uL(e,t={}){return lL(e,t).flatMap(e=>e.items)}function dL(e){let t=e.toLowerCase();return t===`/settings`?!0:uL(e=>e).some(e=>iL(t,e.target))}function fL(e,t,n){let r=e.toLowerCase(),i=uL(t);if(r===`/resource`)return{title:t(`resourcePageTitle`),backTarget:null,backLabel:null};if(oL(r))return{title:t(`chat`),backTarget:`/chat`,backLabel:t(`chat`)};if(r===`/chat`)return{title:t(`chat`),backTarget:null,backLabel:null};if(r===`/inbox`||r.startsWith(`/inbox/`))return{title:t(`inboxTitle`),backTarget:r===`/inbox`?null:`/inbox`,backLabel:t(`inboxTitle`)};if(r===`/skills`||r.startsWith(`/skills/`))return{title:t(`marketplaceFilterSkills`),backTarget:null,backLabel:null};if(r===`/agents`||r.startsWith(`/agents/`))return{title:t(`agentsPageTitle`),backTarget:null,backLabel:null};if(r===`/projects`||r.startsWith(`/projects/`))return{title:t(`projectsTitle`),backTarget:n&&/^\/chat(?:[/?]|$)/.test(n)?n:`/chat`,backLabel:t(`chat`)};if(r.startsWith(`/apps/panel/`))return{title:t(`panelAppsTitle`),backTarget:`/chat`,backLabel:t(`chat`)};if(r===`/settings`)return{title:t(`settings`),backTarget:null,backLabel:null};if(r===`/cron`||r.startsWith(`/cron/`))return{title:t(`cron`),backTarget:`/chat`,backLabel:t(`chat`)};for(let e of i)if(iL(r,e.target))return{title:e.label,backTarget:`/settings`,backLabel:t(`settings`)};return{title:t(`settings`),backTarget:null,backLabel:null}}function pL(){return R({queryKey:gL,queryFn:mt,staleTime:5e3,refetchOnWindowFocus:!0})}function mL(e){let{label:t,muted:n,value:r}=e;return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 py-2 text-sm`,children:[(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:t}),(0,K.jsx)(`span`,{className:n?`text-right text-muted-foreground`:`text-right text-foreground`,children:r==null||r===``?`-`:String(r)})]})}function hL(){let e=$(),t=pL(),n=t.data,r=wL(e=>e.actionLabel),i=(0,G.useMemo)(()=>AL(n),[n]),a=!!r,o=n?.runtime?.deviceName?.trim()||n?.settings.deviceName?.trim()||U(`remoteDeviceNameAuto`),s=!!(n?.account.loggedIn&&CL(n)),{hero:c,issueHint:l}=i;return(0,G.useEffect)(()=>{e.remoteAccessManager.syncStatus(n)},[e,n]),t.isLoading&&!n?(0,K.jsx)(Ue,{title:U(`remotePageTitle`),description:U(`remotePageDescription`),children:(0,K.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:U(`remoteLoading`)})}):(0,K.jsx)(Ue,{title:U(`remotePageTitle`),description:U(`remotePageDescription`),children:(0,K.jsxs)(`div`,{className:`grid gap-7 xl:grid-cols-[1.2fr_0.8fr]`,children:[(0,K.jsx)(ce,{title:c.title,description:c.description,actions:(0,K.jsx)(Ai,{status:c.badgeStatus,label:c.badgeLabel}),children:(0,K.jsx)(Ht,{children:(0,K.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,K.jsxs)(iE,{tone:`neutral`,children:[(0,K.jsx)(mL,{label:U(`remoteSignedInAccount`),value:n?.account.email}),(0,K.jsx)(mL,{label:U(`remoteDeviceName`),value:o}),(0,K.jsx)(mL,{label:U(`remoteConnectionStatus`),value:c.badgeLabel}),(0,K.jsx)(mL,{label:U(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?Zr(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[i.primaryAction?(0,K.jsxs)(B,{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,K.jsx)(ys,{className:`mr-2 h-4 w-4`}):null,r||i.primaryAction.label]}):null,(0,K.jsxs)(B,{variant:`outline`,onClick:()=>void e.accountManager.openNextClawWeb(),disabled:a||!s,children:[(0,K.jsx)(Cs,{className:`mr-2 h-4 w-4`}),U(`remoteOpenDeviceList`)]}),n?.settings.enabled?(0,K.jsx)(B,{variant:`outline`,onClick:()=>void e.remoteAccessManager.disableRemoteAccess(n),disabled:a,children:U(`remoteDisable`)}):null]}),i.shouldShowIssueHint&&l?(0,K.jsx)(iE,{tone:`warning`,title:l.title,description:l.body}):null,(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:U(`remoteOpenWebHint`)})]})})}),(0,K.jsx)(ce,{title:(0,K.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(Ro,{className:`h-4 w-4 text-primary`}),U(`remoteDeviceSectionTitle`)]}),description:U(`remoteDeviceSectionDescription`),children:(0,K.jsx)(Ht,{children:(0,K.jsxs)(`div`,{className:`space-y-5 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(Ai,{status:n?.account.loggedIn?`ready`:`inactive`,label:n?.account.loggedIn?U(`remoteAccountConnected`):U(`remoteAccountNotConnected`)}),(0,K.jsx)(Ai,{status:n?.settings.enabled?`active`:`inactive`,label:n?.settings.enabled?U(`remoteEnabled`):U(`remoteStateDisabled`)}),(0,K.jsx)(Ai,{status:n?.service.running?`active`:`inactive`,label:n?.service.running?U(`remoteServiceRunning`):U(`remoteServiceStopped`)})]}),(0,K.jsxs)(iE,{tone:`neutral`,children:[(0,K.jsx)(mL,{label:U(`remoteDeviceName`),value:o}),(0,K.jsx)(mL,{label:U(`remoteConnectionStatus`),value:c.badgeLabel}),(0,K.jsx)(mL,{label:U(`remoteLastConnectedAt`),value:n?.runtime?.lastConnectedAt?Zr(n.runtime.lastConnectedAt):`-`,muted:!0})]}),(0,K.jsx)(iE,{tone:`neutral`,borderStyle:`dashed`,description:n?.account.loggedIn?U(`remoteOpenWebHint`):U(`remoteStatusNeedsSignInDescription`),className:`text-sm`})]})})})]})})}var gL=[`remote-status`],_L=`https://platform.nextclaw.io`,vL=`https://nextclaw-platform-console.pages.dev`,yL=async()=>await se.fetchQuery({queryKey:gL,queryFn:mt,staleTime:5e3}),bL=async()=>(await se.invalidateQueries({queryKey:gL}),await yL()),xL=(e,t)=>t?.trim()||e?.settings.platformApiBase?.trim()||e?.account.apiBase?.trim()||void 0;function SL(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 _L;if(n.hostname.includes(`nextclaw-provider-gateway-api`)&&n.hostname.endsWith(`.workers.dev`))return vL}var CL=e=>SL(e?.account.apiBase)||SL(e?.settings.platformApiBase)||SL(e?.platformBase)||SL(e?.account.platformBase)||void 0,wL=ct(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})})),TL=class{constructor(e){this.params=e,this.syncStatus=e=>{if(!e)return;let t=wL.getState();t.draftTouched||t.actionLabel||this.hydrateDraftFromStatus(e)},this.setEnabled=e=>{wL.getState().setEnabled(e)},this.setDeviceName=e=>{wL.getState().setDeviceName(e)},this.setPlatformApiBase=e=>{wL.getState().setPlatformApiBase(e)},this.setAdvancedOpen=e=>{wL.getState().setAdvancedOpen(e)},this.enableRemoteAccess=async e=>{let t=e??await bL(),n=wL.getState(),r=await this.ensureRemoteAccount(t,n.platformApiBase);await this.applyEnabledState(!0,r)},this.disableRemoteAccess=async e=>{let t=e??await bL();await this.applyEnabledState(!1,t)},this.repairRemoteAccess=async e=>{let t=e??await bL(),n=(await this.ensureRemoteAccount(t)).service.running?`restart`:`start`;await this.runManagedAction({actionLabel:U(n===`restart`?`remoteActionRestarting`:`remoteActionStarting`),job:async()=>{await Lt(n);let e=await bL();this.hydrateDraftFromStatus(e)},successMessage:U(`remoteServiceRecovered`)})},this.reauthorizeRemoteAccess=async e=>{let t=e??await bL(),n=await this.params.accountManager.startBrowserSignInAndWait({status:t,apiBase:wL.getState().platformApiBase});await this.repairRemoteAccess(n)},this.saveAdvancedSettings=async e=>{let t=e??await bL(),n=wL.getState();await this.runManagedAction({actionLabel:U(`remoteActionSavingAdvanced`),job:async()=>{await Ye({enabled:n.enabled,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let e=await bL();this.hydrateDraftFromStatus(e)},successMessage:t.settings.enabled===n.enabled?U(`remoteSettingsSaved`):U(`remoteAdvancedSaved`)})},this.runDoctor=async()=>{await this.runManagedAction({actionLabel:U(`remoteDoctorRunning`),job:async()=>{let e=await Ot();wL.getState().setDoctor(e)},successMessage:U(`remoteDoctorCompleted`)})},this.startService=async()=>{await this.runServiceAction(`start`,U(`remoteActionStarting`))},this.restartService=async()=>{await this.runServiceAction(`restart`,U(`remoteActionRestarting`))},this.stopService=async()=>{await this.runServiceAction(`stop`,U(`remoteActionStopping`))},this.applyEnabledState=async(e,t)=>{let n=wL.getState();await this.runManagedAction({actionLabel:U(e?`remoteActionEnabling`:`remoteActionDisabling`),job:async()=>{await Ye({enabled:e,deviceName:n.deviceName.trim(),platformApiBase:n.platformApiBase.trim()});let r=await bL();this.hydrateDraftFromStatus(r),e?await Lt(r.service.running?`restart`:`start`):t.service.running&&await Lt(`restart`);let i=await bL();this.hydrateDraftFromStatus(i)},successMessage:U(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 Lt(e),n=await bL();this.hydrateDraftFromStatus(n),z.success(t.message)}})},this.hydrateDraftFromStatus=e=>{wL.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;wL.getState().beginAction(t);try{await n(),r&&z.success(r)}catch(e){let t=e instanceof Error?e.message:U(`error`);throw z.error(t),e}finally{wL.getState().finishAction()}}}},EL=[/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 DL(e){return e?.runtime?.lastError?.trim()||``}function OL(e){let t=U(`remoteStatusIssueDetailGeneric`),n=DL(e);return n?`${t} (${n})`:t}function kL(e){if(!e?.settings.enabled)return!1;let t=DL(e);return EL.some(e=>e.test(t))}function AL(e){return kL(e)?{hero:{badgeStatus:`warning`,badgeLabel:U(`remoteStateReauthorizationRequired`),title:U(`remoteStatusReauthorizationTitle`),description:U(`remoteStatusReauthorizationDescription`)},primaryAction:{kind:`reauthorize`,label:U(`remoteReauthorizeNow`),showRefreshIcon:!1},issueHint:{title:U(`remoteStatusRecoveryTitle`),body:U(`remoteStatusReauthorizationHint`)},shouldShowIssueHint:!0,requiresReauthorization:!0}:e?.account.loggedIn?e.settings.enabled?e.service.running?e.runtime?.state===`connected`?{hero:{badgeStatus:`ready`,badgeLabel:U(`statusReady`),title:U(`remoteStatusReadyTitle`),description:U(`remoteStatusReadyDescription`)},primaryAction:{kind:`repair`,label:U(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:e.runtime?.state===`connecting`?{hero:{badgeStatus:`active`,badgeLabel:U(`connecting`),title:U(`remoteStatusConnectingTitle`),description:U(`remoteStatusConnectingDescription`)},primaryAction:{kind:`repair`,label:U(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:U(`remoteStateDisconnected`),title:U(`remoteStatusIssueTitle`),description:U(`remoteStatusIssueDescription`)},primaryAction:{kind:`repair`,label:U(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:U(`remoteStatusRecoveryTitle`),body:OL(e)},shouldShowIssueHint:!!(e.settings.enabled&&e.account.loggedIn),requiresReauthorization:!1}:{hero:{badgeStatus:`warning`,badgeLabel:U(`remoteServiceStopped`),title:U(`remoteStatusNeedsServiceTitle`),description:U(`remoteStatusNeedsServiceDescription`)},primaryAction:{kind:`repair`,label:U(`remoteReconnectNow`),showRefreshIcon:!0},issueHint:{title:U(`remoteStatusRecoveryTitle`),body:U(`remoteStatusIssueDetailServiceStopped`)},shouldShowIssueHint:!0,requiresReauthorization:!1}:{hero:{badgeStatus:`inactive`,badgeLabel:U(`statusInactive`),title:U(`remoteStatusNeedsEnable`),description:U(`remoteStatusNeedsEnableDescription`)},primaryAction:{kind:`enable`,label:U(`remoteEnableNow`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}:{hero:{badgeStatus:`setup`,badgeLabel:U(`statusSetup`),title:U(`remoteStatusNeedsSignIn`),description:U(`remoteStatusNeedsSignInDescription`)},primaryAction:{kind:`sign-in-enable`,label:U(`remoteSignInAndEnable`),showRefreshIcon:!1},issueHint:null,shouldShowIssueHint:!1,requiresReauthorization:!1}}var jL=ct(e=>({pending:null,present:t=>e({pending:t}),clear:()=>e({pending:null})})),ML=`desktop.authorization.required`;function NL(){let e=jL(e=>e.pending),t=jL(e=>e.present),n=jL(e=>e.clear),[r,i]=(0,G.useState)(!1);(0,G.useEffect)(()=>L.eventBus.subscribeAll(e=>{if(e.type!==ML)return;let n=FL(e.payload);n&&t(n)}),[t]);let a=async()=>{if(!(!e||r)){i(!0);try{await ba.grantAccess(e.request),await se.invalidateQueries({queryKey:[`desktop-capability`,`grants`]}),n(),z.success(U(`desktopAuthorizationAllowed`))}catch(e){z.error(e instanceof Error?e.message:U(`desktopAuthorizationFailed`))}finally{i(!1)}}};return(0,K.jsx)(li,{open:!!e,onOpenChange:e=>{!e&&!r&&n()},children:(0,K.jsxs)(oi,{children:[(0,K.jsxs)(ei,{showClose:!1,children:[(0,K.jsxs)(si,{className:`flex items-center gap-2`,children:[(0,K.jsx)(_,{className:`h-4 w-4 text-amber-600`}),U(`desktopAuthorizationTitle`)]}),(0,K.jsx)(ci,{children:U(`desktopAuthorizationDescription`)})]}),e?(0,K.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-muted/55 p-4 text-sm`,children:[(0,K.jsx)(PL,{label:U(`desktopAuthorizationCaller`),value:IL(e)}),(0,K.jsx)(PL,{label:U(`desktopAuthorizationApplication`),value:e.applicationId}),(0,K.jsx)(PL,{label:U(`desktopAuthorizationAccess`),value:e.request.access.map(LL).join(`, `)}),(0,K.jsx)(`p`,{className:`text-xs leading-5 text-muted-foreground`,children:RL(e.request.access)})]}):null,(0,K.jsxs)(ii,{className:`gap-2 sm:gap-0`,children:[(0,K.jsx)(B,{type:`button`,variant:`outline`,disabled:r,onClick:n,children:U(`desktopAuthorizationReject`)}),(0,K.jsx)(B,{type:`button`,disabled:r,onClick:()=>void a(),children:U(r?`desktopAuthorizationAllowing`:`desktopAuthorizationAllow`)})]})]})})}function PL({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`grid grid-cols-[5rem_minmax(0,1fr)] gap-3`,children:[(0,K.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:e}),(0,K.jsx)(`div`,{className:`min-w-0 break-words text-xs text-foreground`,children:t})]})}function FL(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 IL(e){let{subject:t}=e.request;return`${t.type===`agent`?U(`desktopCapabilitiesAgent`):U(`desktopCapabilitiesExtension`)} · ${t.id}`}function LL(e){return e===`ui.read`?U(`desktopAuthorizationRead`):e===`ui.observe`?U(`desktopAuthorizationObserve`):e===`ui.write`?U(`desktopAuthorizationWrite`):e===`screen.capture-window`?U(`desktopAuthorizationScreenCapture`):e===`input.pointer`?U(`desktopAuthorizationPointerInput`):e}function RL(e){return e.includes(`ui.write`)?U(`desktopAuthorizationWriteRisk`):e.includes(`screen.capture-window`)?U(`desktopAuthorizationScreenCaptureRisk`):e.includes(`input.pointer`)?U(`desktopAuthorizationPointerInputRisk`):U(`desktopAuthorizationReadRisk`)}function zL({isCollapsed:e,onToggle:t}){let n=U(e?`sidebarExpand`:`sidebarCollapse`);return(0,K.jsx)(W,{icon:(0,K.jsx)(e?ss:os,{className:WF}),label:n,className:V(JF,e&&`h-9 w-9 rounded-xl`),onClick:t})}function BL({isCollapsed:e,onToggle:t}){return(0,K.jsx)(`div`,{className:V(`shrink-0`,e?`px-0 py-1.5`:`px-2 py-2`),children:(0,K.jsxs)(`div`,{className:V(`flex items-center py-1`,e?V(`flex-col px-0`,KF):`gap-2 px-1`),"data-testid":`settings-sidebar-header`,children:[e?(0,K.jsx)(zL,{isCollapsed:e,onToggle:t}):null,(0,K.jsxs)(dn,{to:`/chat`,"aria-label":U(`backToMain`),className:V(`group inline-flex min-w-0 items-center text-[12px] font-medium`,JF,e?V(UF,JF,`justify-center p-0`):`gap-1.5 px-1 py-1`),children:[(0,K.jsx)(Or,{className:V(e?WF:`h-3.5 w-3.5`,`shrink-0 text-muted-foreground/75 group-hover:text-gray-700`)}),(0,K.jsx)(`span`,{className:e?`sr-only`:`truncate`,children:U(`backToMain`)})]}),e?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`h-4 w-px shrink-0 bg-border`,"aria-hidden":`true`}),(0,K.jsx)(`h1`,{className:`truncate text-[15px] font-semibold tracking-[-0.01em] text-foreground`,children:U(`settings`)}),(0,K.jsx)(`div`,{className:`ml-auto`,children:(0,K.jsx)(zL,{isCollapsed:e,onToggle:t})})]})]})})}function VL({isCollapsed:e,sections:t}){let{onScroll:n,scrollRef:r}=aS({restorationKey:`settings-sidebar:navigation`});return(0,K.jsx)(`nav`,{ref:r,onScroll:n,className:V(`custom-scrollbar min-h-0 flex-1 overflow-y-auto`,e?`pr-0`:`pr-1`,rc),children:e?(0,K.jsx)(EI,{isCollapsed:e,items:t.flatMap(e=>e.items),density:`compact`,className:V(GF,`pb-3`)}):(0,K.jsx)(`div`,{className:`space-y-3 pb-3`,children:t.map(t=>(0,K.jsxs)(`section`,{"aria-label":t.label,className:`space-y-1`,children:[(0,K.jsx)(`h2`,{className:`px-3 text-[11px] font-semibold text-muted-foreground/70`,children:t.label}),(0,K.jsx)(EI,{isCollapsed:e,items:t.items,density:`compact`})]},t.label))})})}function HL(){let e=$(),t=Xi(),n=pL(),r=xa(),i=Wr(e=>e.isSidebarCollapsed),a=Ur.toggleSidebarCollapsed,o=n.data?.account.email?.trim(),s=!!n.data?.account.loggedIn,c=lL(U,{includeDesktopCapabilities:r}),l=i?GF:xI(`compact`);return(0,K.jsxs)(`aside`,{"data-theme-surface":`navigation`,className:V(`shrink-0 flex h-full min-h-0 flex-col overflow-hidden bg-secondary pb-6 transition-[width] duration-200 ease-out`,i?V(VF,HF):`w-[240px] px-4`),"data-sidebar-collapsed":i?`true`:`false`,children:[(0,K.jsx)(BL,{isCollapsed:i,onToggle:a}),(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(VL,{isCollapsed:i,sections:c}),(0,K.jsxs)(`div`,{className:V(`shrink-0 bg-secondary`,i?`mt-2 flex flex-col items-center pt-2`:`mt-2 pt-3`,l),children:[(0,K.jsx)(DI,{onClick:()=>t.open(void 0,{kind:`docs`,title:U(`docBrowserHelp`)}),icon:Ar,label:U(`docBrowserHelp`),density:`compact`,collapsed:i}),(0,K.jsx)(DI,{onClick:()=>e.accountManager.openAccountPanel(),icon:Hr,label:U(`remoteAccountEntryManage`),density:`compact`,trailing:s?o||U(`remoteAccountEntryConnected`):U(`remoteAccountEntryDisconnected`),trailingClassName:`max-w-[92px] truncate text-right`,testId:`settings-sidebar-account-entry`,trailingTestId:`settings-sidebar-account-status`,collapsed:i})]})]})]})}var UL=[{action:`minimize`,label:`Minimize`,icon:xn},{action:`close`,label:`Close`,icon:Vr,variant:`danger`}];function WL({sidebarCollapsed:e=!1}){let t=KL()?{action:`toggle-maximize`,label:`Restore`,icon:Qn}:{action:`toggle-maximize`,label:`Maximize`,icon:Ds};return(0,K.jsxs)(`header`,{"data-theme-surface":`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,K.jsx)(`div`,{className:`desktop-window-no-drag absolute left-0 right-0 top-0 h-1`,"data-testid":`desktop-window-chrome-resize-strip`}),(0,K.jsx)(`div`,{className:V(`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,K.jsx)(`img`,{src:`/logo.svg`,alt:`NextClaw`,className:`h-6 w-6 shrink-0 object-contain`}):(0,K.jsx)(lI,{className:`flex min-w-0 shrink-0 items-center gap-2.5`,density:`chrome`})}),(0,K.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:[UL[0],t,UL[1]].map(e=>(0,K.jsx)(GL,{control:e},e.action))})]})}function GL({control:e}){let t=e.icon;return(0,K.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-[var(--interaction-hover)]`,onClick:()=>{window.nextclawDesktop?.controlWindow?.(e.action)},children:(0,K.jsx)(t,{className:`h-3.5 w-3.5`})})}function KL(){let[e,t]=(0,G.useState)(!1);return(0,G.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 qL(){return typeof window>`u`?null:YL()??window.nextclawDesktop?.platform??null}function JL(){return qL()===`win32`}function YL(){return null}function XL(){let{pathname:e}=mn(),t=Xi(),r=RI();return(0,K.jsx)(`nav`,{"data-testid":`mobile-bottom-nav`,"aria-label":U(`mobileNavigation`),className:`shrink-0 border-t border-border/60 bg-background text-foreground`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.25rem)`},children:(0,K.jsxs)(`ul`,{className:`grid grid-cols-6 gap-0.5 px-1 pt-1`,children:[cL(U).map(t=>{let n=t.target===`/settings`?dL(e):iL(e,t.target);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(gn,{to:t.target,"aria-label":t.label,"aria-current":n?`page`:void 0,"data-testid":n?`mobile-nav-active-indicator`:void 0,className:V(`group flex min-h-12 flex-col items-center justify-center gap-1 rounded-xl px-0.5 py-1 text-[11px] font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,n?`bg-[var(--interaction-selection)] text-foreground`:`text-muted-foreground hover:bg-[var(--interaction-hover)] hover:text-foreground`),children:[(0,K.jsxs)(`span`,{className:`relative`,children:[(0,K.jsx)(t.icon,{className:V(`h-5 w-5`,n?`text-foreground`:`text-muted-foreground`)}),t.target===`/inbox`&&r>0?(0,K.jsx)(`span`,{className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary ring-1 ring-background`}):null]}),(0,K.jsx)(`span`,{className:`max-w-full truncate`,children:t.target===`/agents`?U(`mobileAgents`):t.label})]})},t.target)}),(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>_D(t),className:`group flex min-h-12 w-full flex-col items-center justify-center gap-1 rounded-xl px-0.5 py-1 text-[11px] 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,K.jsx)(n,{className:`h-5 w-5 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`max-w-full truncate`,children:U(`appsTitle`)})]})})]})})}function ZL({leadingInset:e}){let t=fn(),{pathname:n,state:r}=mn(),i=fL(n,U,typeof r?.returnTo==`string`?r.returnTo:void 0);return(0,K.jsx)(`header`,{"data-testid":`mobile-topbar`,className:`shrink-0 border-b border-border/60 bg-background text-foreground`,style:{paddingTop:`env(safe-area-inset-top, 0px)`},children:(0,K.jsxs)(`div`,{className:`flex h-[var(--mobile-header-height)] items-center gap-2 pl-3 pr-3`,style:{paddingLeft:e?`calc(${e} + 0.75rem)`:void 0},children:[i.backTarget?(0,K.jsx)(W,{size:`lg`,onClick:()=>t(i.backTarget),label:i.backLabel??U(`backToMain`),icon:(0,K.jsx)(Or,{className:`h-4 w-4`})}):null,(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(`h1`,{className:`truncate text-center text-[17px] font-semibold text-foreground`,children:i.title})}),i.backTarget?(0,K.jsx)(`div`,{className:`w-[var(--icon-control-size)] shrink-0`,"aria-hidden":`true`}):null]})})}var QL=(0,G.lazy)(async()=>({default:(await un(async()=>{let{DocBrowser:e}=await import(`./doc-browser-2VjSkax1.js`);return{DocBrowser:e}},[])).DocBrowser}));function $L({pathname:e,docBrowserDockControls:t,docBrowserRenderers:n={},docBrowserTabMenuGroups:r,topbarLeadingInset:i,children:a}){let o=aL(e),s=oL(e)||sL(e);return(0,K.jsxs)(`div`,{className:`flex h-[100svh] flex-col bg-background font-sans text-foreground supports-[height:100dvh]:h-[100dvh]`,children:[e!==`/chat`&&!s?(0,K.jsx)(ZL,{leadingInset:i}):null,(0,K.jsx)(`div`,{className:`relative flex-1 min-h-0 overflow-hidden`,children:o?(0,K.jsx)(`div`,{className:`h-full min-h-0 overflow-hidden`,children:a}):(0,K.jsx)(`main`,{className:`h-full overflow-auto overscroll-contain px-4 py-4 custom-scrollbar`,children:(0,K.jsx)(`div`,{className:`mx-auto max-w-3xl animate-fade-in`,children:a})})}),s?null:(0,K.jsx)(XL,{}),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(QL,{customTabRenderers:n,displayMode:`fullscreen`,dockControls:t,getTabMenuGroups:r})})]})}function eR(){let e=lL(U,{includeKeyboardShortcuts:!1,includeDesktopCapabilities:xa()});return(0,K.jsx)(`div`,{"data-testid":`mobile-settings-shell`,className:`space-y-3 pb-4`,children:e.map(e=>(0,K.jsxs)(`section`,{className:`space-y-2`,children:[(0,K.jsx)(`h2`,{className:`px-1 pt-2 text-xs font-medium text-muted-foreground`,children:e.label}),(0,K.jsx)(Ht,{children:e.items.map(e=>(0,K.jsxs)(dn,{to:e.target,className:({isActive:e})=>V(`flex min-h-14 items-center gap-3 px-4 py-3 transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border`,e?`bg-[var(--interaction-selection)]`:`hover:bg-[var(--interaction-hover)] active:bg-[var(--interaction-hover)]`),children:[(0,K.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center text-muted-foreground`,children:(0,K.jsx)(e.icon,{className:`h-5 w-5`})}),(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(`p`,{className:`text-[15px] font-medium text-foreground`,children:e.label})}),(0,K.jsx)(nr,{className:`h-4 w-4 shrink-0 text-muted-foreground/60`,"aria-hidden":`true`})]},e.target))})]},e.label))})}function tR(){let{pathname:e}=mn(),t=fn();return oL(e)?(0,K.jsx)(zF,{layoutMode:`mobile`,onBackToList:()=>t(`/chat`)}):(0,K.jsx)(mR,{variant:`mobile`})}var nR=(0,G.lazy)(async()=>({default:(await un(async()=>{let{DocBrowser:e}=await import(`./doc-browser-2VjSkax1.js`);return{DocBrowser:e}},[])).DocBrowser}));function rR({pathname:e,isMobileLayout:t=!1,docBrowserDockControls:n,docBrowserRenderers:r={},docBrowserTabMenuGroups:i,sideDock:a,children:o}){let s=aL(e),c=Wr(e=>e.isSidebarCollapsed),l=t&&!oL(e),u=JL(),d=c?`56px`:s?`280px`:`240px`,{onScroll:f,scrollRef:p}=aS({restorationKey:s?null:`settings-page:${e}`});return(0,K.jsxs)(`div`,{"data-theme-surface":`app-shell`,className:V(`h-screen flex flex-col overflow-hidden bg-background font-sans text-foreground`,u?`rounded-[10px]`:null),style:u?{"--desktop-titlebar-height":`40px`,"--desktop-caption-safe-right":`140px`,"--desktop-sidebar-width":d}:void 0,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,"data-theme-decoration":`island-paper`}),(0,K.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute h-0 w-0`,focusable:`false`,children:(0,K.jsx)(`defs`,{children:(0,K.jsxs)(`filter`,{id:`island-wind-filter`,x:`-8%`,y:`-8%`,width:`116%`,height:`116%`,colorInterpolationFilters:`sRGB`,children:[(0,K.jsx)(`feTurbulence`,{type:`turbulence`,baseFrequency:`0.0025 0.011`,numOctaves:`2`,seed:`7`,result:`island-wind-noise`,children:(0,K.jsx)(`animate`,{attributeName:`baseFrequency`,dur:`8.5s`,values:`0.0025 0.011;0.0038 0.015;0.0028 0.009;0.0025 0.011`,keyTimes:`0;0.38;0.72;1`,calcMode:`spline`,keySplines:`0.42 0 0.25 1;0.45 0 0.2 1;0.4 0 0.3 1`,repeatCount:`indefinite`})}),(0,K.jsx)(`feDisplacementMap`,{in:`SourceGraphic`,in2:`island-wind-noise`,scale:`5`,xChannelSelector:`R`,yChannelSelector:`G`,children:(0,K.jsx)(`animate`,{attributeName:`scale`,dur:`8.5s`,values:`5;17;9;14;5`,keyTimes:`0;0.34;0.58;0.78;1`,calcMode:`spline`,keySplines:`0.42 0 0.25 1;0.45 0 0.2 1;0.4 0 0.3 1;0.42 0 0.3 1`,repeatCount:`indefinite`})})]})})}),(0,K.jsx)(`div`,{"aria-hidden":`true`,"data-theme-decoration":`island-palm`,children:(0,K.jsx)(`span`,{"data-island-palm-part":`frond-wind`})}),u?(0,K.jsx)(WL,{sidebarCollapsed:c}):null,(0,K.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 overflow-hidden`,children:[!s&&(0,K.jsx)(HL,{}),(0,K.jsxs)(`div`,{className:`flex-1 flex min-w-0 overflow-hidden relative`,children:[(0,K.jsx)(`div`,{className:`flex-1 flex flex-col min-w-0 overflow-hidden`,children:s?(0,K.jsx)(`div`,{className:`flex-1 h-full overflow-hidden`,children:o}):(0,K.jsx)(`main`,{"data-theme-surface":`settings-workspace`,ref:p,onScroll:f,className:`flex-1 overflow-auto p-8 pb-16 custom-scrollbar`,children:(0,K.jsx)(`div`,{className:`mx-auto h-full max-w-6xl animate-fade-in`,children:o})})}),(0,K.jsx)(G.Suspense,{fallback:null,children:(0,K.jsx)(nR,{customTabRenderers:r,dockControls:n,getTabMenuGroups:i})}),a]})]}),l?(0,K.jsx)(XL,{}):null]})}var iR=[{target:`/inbox`,label:()=>U(`inboxTitle`),icon:Ir},{target:`/cron`,label:()=>U(`chatSidebarScheduledTasks`),icon:Qa},{target:`/skills`,label:()=>U(`chatSidebarSkills`),icon:io},{target:`/agents`,label:()=>U(`agentsPageTitle`),icon:Dr}];function aR({isCollapsed:e}){let t=U(e?`sidebarExpand`:`sidebarCollapse`);return(0,K.jsx)(W,{icon:(0,K.jsx)(e?ss:os,{className:WF}),label:t,className:V(JF,e&&`h-9 w-9 rounded-xl`),onClick:Ur.toggleSidebarCollapsed})}function oR({connectionStatus:e,isCollapsed:t}){let n=JL(),r=typeof window<`u`&&window.nextclawDesktop?.platform===`darwin`;return(0,K.jsxs)(`div`,{className:V(`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,K.jsx)(lI,{className:`flex min-w-0 flex-1 items-center gap-2`,suffix:(0,K.jsx)(vI,{status:e})}),(0,K.jsx)(aR,{isCollapsed:t})]})}function sR({isCollapsed:e}){let t=RI();return(0,K.jsxs)(`div`,{className:`pb-1`,children:[(0,K.jsx)(`div`,{className:e?`px-0`:`px-3`,children:(0,K.jsx)(`ul`,{className:e?GF:`space-y-0.5`,children:iR.map(n=>(0,K.jsx)(`li`,{className:e?`flex justify-center`:void 0,children:(0,K.jsx)(TI,{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})},n.target))})}),(0,K.jsx)(Pz,{isCollapsed:e})]})}function cR({query:e,onQueryChange:t,variant:n=`desktop`,defaultSessionType:r,groups:i,isCollapsed:a,isLoading:o,isProjectFirstView:s,onAddProject:c,onScrollNearEnd:l=()=>void 0,onSelectMode:u,projectGroups:d,projectCronJobCountByRoot:f,renderSessionItem:p,sessionTypeOptions:m}){let{onScroll:h,scrollRef:g}=aS({restorationKey:`chat-sidebar:sessions`,isEnabled:!a});return a?(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,"aria-hidden":`true`}):(0,K.jsxs)(K.Fragment,{children:[n===`desktop`?(0,K.jsx)(iI,{query:e,onQueryChange:t,isProjectFirstView:s,onSelectMode:u,onAddProject:c}):null,(0,K.jsx)(`div`,{ref:g,onScroll:e=>{h(e);let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<600&&l()},className:V(`custom-scrollbar min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain`,n===`mobile`?`bg-background`:`px-3 pb-4 pt-1`,rc),children:(0,K.jsx)(QI,{variant:n,isLoading:o,isProjectFirstView:s,groups:i,projectGroups:d,projectCronJobCountByRoot:f,defaultSessionType:r,sessionTypeOptions:m,renderSessionItem:p})})]})}function lR({currentLanguage:e,currentLanguageLabel:t,currentTheme:n,currentThemeLabel:r,isCollapsed:i,isOpen:a,languageOptions:o,onOpenApps:s,onOpenChange:c,onOpenDocs:l,onSelectLanguage:u,onSelectTheme:d,themeOptions:f}){return(0,K.jsx)(`div`,{className:V(`py-2`,i?V(`flex justify-center`,HF):`px-3`),children:(0,K.jsx)($I,{isOpen:a,onOpenChange:c,currentTheme:n,currentThemeLabel:r,themeOptions:f,onSelectTheme:d,currentLanguage:e,currentLanguageLabel:t,languageOptions:o,onSelectLanguage:u,onOpenDocs:l,onOpenApps:s,collapsed:i})})}function uR(e){return U(e===`knowledge-base`?`chatProjectTemplateKnowledgeBase`:`chatProjectTemplateEmpty`)}function dR({open:e,defaultWorkspacePath:t,templates:n,isCreating:r,isAddingExisting:i,createErrorMessage:a,addExistingErrorMessage:o,onOpenChange:s,onCreate:c,onAddExisting:l}){let[u,d]=(0,G.useState)(`create`),[f,p]=(0,G.useState)(``),[m,h]=(0,G.useState)(``),[g,_]=(0,G.useState)(``),[v,y]=(0,G.useState)(!1),[b,x]=(0,G.useState)(`empty`),S=n.length>0?n.map(e=>e.id):[`empty`],C=f.trim(),w=m.trim(),T=g.trim(),E=r||i,D=E||(u===`create`?!C:!T),O=u===`create`?a:o,k=()=>{d(`create`),p(``),h(``),_(``),x(`empty`),y(!1)},A=()=>{E||(k(),s(!1))};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(li,{open:e,onOpenChange:e=>{if(e){s(!0);return}A()},children:(0,K.jsxs)(oi,{className:`sm:max-w-lg`,children:[(0,K.jsxs)(ei,{children:[(0,K.jsx)(si,{children:U(`chatProjectAddTitle`)}),(0,K.jsx)(ci,{children:U(`chatProjectAddDescription`)})]}),(0,K.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),!D&&(u===`create`?c({name:C,template:b,rootPath:w||void 0}):l({rootPath:T})).then(k).catch(()=>void 0)},children:[(0,K.jsxs)(Ti,{value:u,onValueChange:e=>{E||d(e===`existing`?`existing`:`create`)},children:[(0,K.jsxs)(wi,{className:`grid w-full grid-cols-2`,children:[(0,K.jsx)(Ci,{value:`create`,children:U(`chatProjectCreateMode`)}),(0,K.jsx)(Ci,{value:`existing`,children:U(`chatProjectExistingMode`)})]}),(0,K.jsxs)(Di,{value:`create`,className:`mt-4 space-y-4`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:U(`chatProjectCreateModeDescription`)}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(Le,{htmlFor:`chat-project-name`,children:U(`chatProjectNameLabel`)}),(0,K.jsx)(F,{id:`chat-project-name`,value:f,onChange:e=>p(e.target.value),placeholder:U(`chatProjectNamePlaceholder`),autoFocus:!0,disabled:E})]}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(Le,{htmlFor:`chat-project-template`,children:U(`chatProjectTemplateLabel`)}),(0,K.jsxs)(pa,{value:b,onValueChange:e=>x(e),disabled:E,children:[(0,K.jsx)(la,{id:`chat-project-template`,children:(0,K.jsx)(ca,{})}),(0,K.jsx)(ua,{children:S.map(e=>(0,K.jsx)(fa,{value:e,children:uR(e)},e))})]})]}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(Le,{htmlFor:`chat-project-create-root-path`,children:U(`chatProjectCreatePathLabel`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(F,{id:`chat-project-create-root-path`,value:m,onChange:e=>h(e.target.value),placeholder:U(`chatProjectCreatePathPlaceholder`),disabled:E}),(0,K.jsxs)(B,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:E,children:[(0,K.jsx)(Co,{className:`mr-2 h-4 w-4`}),U(`browse`)]})]}),(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:U(`chatProjectCreatePathHint`)})]})]}),(0,K.jsxs)(Di,{value:`existing`,className:`mt-4 space-y-4`,children:[(0,K.jsx)(`p`,{className:`text-sm leading-relaxed text-muted-foreground`,children:U(`chatProjectExistingModeDescription`)}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(Le,{htmlFor:`chat-project-existing-root-path`,children:U(`chatProjectExistingPathLabel`)}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(F,{id:`chat-project-existing-root-path`,value:g,onChange:e=>_(e.target.value),placeholder:U(`chatProjectExistingPathPlaceholder`),autoFocus:!0,disabled:E}),(0,K.jsxs)(B,{type:`button`,variant:`outline`,onClick:()=>y(!0),disabled:E,children:[(0,K.jsx)(Co,{className:`mr-2 h-4 w-4`}),U(`browse`)]})]}),(0,K.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:U(`chatProjectExistingPathHint`)})]})]})]}),O?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:O}):null,(0,K.jsxs)(ii,{children:[(0,K.jsx)(B,{type:`button`,variant:`outline`,onClick:A,disabled:E,children:U(`cancel`)}),(0,K.jsx)(B,{type:`submit`,disabled:D,children:U(E?`saving`:u===`create`?`chatProjectCreateAction`:`chatProjectExistingAction`)})]})]})]})}),(0,K.jsx)(mc,{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:U(u===`create`?`chatProjectCreatePathPickerTitle`:`chatProjectExistingPathPickerTitle`),description:U(u===`create`?`chatProjectCreatePathPickerDescription`:`chatProjectExistingPathPickerDescription`),pathLabel:U(u===`create`?`chatProjectCreatePathLabel`:`chatProjectExistingPathLabel`),pathPlaceholder:U(u===`create`?`chatProjectCreatePathPlaceholder`:`chatProjectExistingPathPlaceholder`),confirmLabel:U(`selectCurrentDirectory`),hint:U(u===`create`?`chatProjectCreatePathHint`:`chatProjectExistingPathHint`)})]})}function fR(e){let t=ZP({all:!0});return(0,G.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 pR(e,t,n){let r=J(e=>e.optimisticReadAtBySessionKey);return(0,G.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 mR({variant:e=`desktop`}){let t=e===`mobile`,n=q(),r=Xi(),i=Wr(e=>e.isSidebarCollapsed),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(!1),l=J(e=>e.snapshot),f=_u(e=>e.snapshot.sessionTypesQuery?.data??null),p=_u(e=>e.snapshot.configQuery?.data??null),m=Et(),h=Td(),_=yu(),v=bu(),y=xu(),{allItems:b,hasMore:x,isLoading:S,isLoadingMore:C,items:w,loadMore:T}=Ll(),{cronJobCountByProjectRoot:E,cronJobCountBySessionKey:D}=fR(b),{language:O,setLanguage:k}=d(),{theme:A,setTheme:j}=u(),M=U(g.find(e=>e.value===A)?.labelKey??`themeWork`),N=Yr.find(e=>e.value===O)?.label??O,P=(0,G.useMemo)(()=>g.map(e=>({value:e.value,label:U(e.labelKey)})),[]),ee=(0,G.useMemo)(()=>Yr.map(e=>({value:e.value,label:e.label})),[]),te=(0,G.useMemo)(()=>new Map((h.data?.agents??[]).map(e=>[e.id,e])),[h.data?.agents]),F=(0,G.useMemo)(()=>new Set(l.pinnedSessionKeys),[l.pinnedSessionKeys]),ne=(0,G.useMemo)(()=>new Set(l.pinnedProjectRoots),[l.pinnedProjectRoots]),I=(0,G.useMemo)(()=>zl(w),[w]),re=(0,G.useMemo)(()=>Ul(b),[b]),ie=(0,G.useMemo)(()=>Vl(I,F),[F,I]),ae=(0,G.useMemo)(()=>Hl(I,F,ne,_.data?.projects??[]),[ne,F,_.data?.projects,I]),oe=(0,G.useMemo)(()=>Xl(f?.options??[]),[f?.options]),se=Pu({defaultSessionType:(0,G.useMemo)(()=>ql(f?.defaultType??`native`),[f?.defaultType]),sessionTypeOptions:oe}),ce=l.listMode===`project-first`,le=!t&&i,ue=pR(w,l.selectedSessionKey,n.chatSessionListManager.markSessionRead),{editingSessionKey:de,draftLabel:fe,savingSessionKey:L,setDraftLabel:pe,startEditingSessionLabel:me,cancelEditingSessionLabel:he,saveSessionLabel:ge}=BF(),_e=e=>{O!==e&&(k(e),window.location.reload())},ve=t=>(0,K.jsx)(nI,{variant:e,item:t,selectedSessionKey:l.selectedSessionKey,optimisticReadAtBySessionKey:ue,agentsById:te,childSessionsByParentKey:re,cronJobCount:D.get(t.session.key)??0,editingSessionKey:de,draftLabel:fe,savingSessionKey:L,sessionTypeOptions:oe,isPinned:F.has(t.session.key),sessionTitle:Wl,onSelectSession:n.chatSessionListManager.selectSession,onStartEditingSessionLabel:me,onDraftLabelChange:pe,onSaveSessionLabel:ge,onCancelEditingSessionLabel:he,onTogglePinned:()=>n.chatSessionListManager.toggleSessionPinned(t.session.key),onDeleteSession:n.chatThreadManager.deleteSession},t.session.key),ye=()=>{n.chatSessionListManager.createSession({sessionType:se.selectedSessionType})},be=()=>{v.reset(),y.reset(),o(!0)},xe=async e=>{await v.mutateAsync(e),o(!1)},Se=async e=>{await y.mutateAsync(e),o(!1)};return(0,K.jsxs)(`aside`,{"data-theme-surface":`navigation`,className:V(`flex h-full min-h-0 flex-col bg-secondary transition-[width] duration-200 ease-out`,t?`flex-1 overflow-hidden bg-background`:le?V(VF,`shrink-0`):`w-[280px] shrink-0`),"data-sidebar-collapsed":le?`true`:`false`,children:[t?null:(0,K.jsx)(oR,{connectionStatus:m.connectionStatus,isCollapsed:le}),t?(0,K.jsx)(aI,{isProjectFirstView:ce,onSelectMode:n.chatSessionListManager.setListMode,onAddProject:be,query:l.query,onCreateSession:ye,onQueryChange:n.chatSessionListManager.setQuery}):(0,K.jsx)(rI,{onCreateSession:ye,collapsed:le}),t?null:(0,K.jsx)(sR,{isCollapsed:le}),(0,K.jsx)(cR,{query:l.query,onQueryChange:n.chatSessionListManager.setQuery,variant:e,defaultSessionType:se.selectedSessionType,groups:ie,isCollapsed:le,isLoading:S,isProjectFirstView:ce,onAddProject:be,onScrollNearEnd:()=>{x&&!C&&T()},onSelectMode:n.chatSessionListManager.setListMode,projectGroups:ae,projectCronJobCountByRoot:E,renderSessionItem:ve,sessionTypeOptions:oe}),t?null:(0,K.jsx)(lR,{currentLanguage:O,currentLanguageLabel:N,currentTheme:A,currentThemeLabel:M,isCollapsed:le,isOpen:s,languageOptions:ee,onOpenApps:()=>_D(r),onOpenChange:c,onOpenDocs:()=>r.open(void 0,{kind:`docs`,title:U(`docBrowserHelp`)}),onSelectLanguage:_e,onSelectTheme:j,themeOptions:P}),(0,K.jsx)(dR,{open:a,defaultWorkspacePath:Pc(p?.agents.defaults.workspace),templates:_.data?.templates??[],isCreating:v.isPending,isAddingExisting:y.isPending,createErrorMessage:v.error?.message,addExistingErrorMessage:y.error?.message,onOpenChange:o,onCreate:xe,onAddExisting:Se})]})}function hR(e,t){let n=t.trim();return n?e.includes(n)?e.filter(e=>e!==n):[n,...e]:e}var gR=class{constructor(e){this.uiManager=e,this.syncDraftThreadState=e=>{let t=Y.getState().snapshot.workspaceFileTabs.filter(e=>e.parentSessionKey!==null);Y.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=J.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=J.getState().snapshot.selectedAgentId,n=this.resolveUpdateValue(t,e);n!==t&&J.getState().setSnapshot({selectedAgentId:n})},this.syncSelectedSessionAgent=()=>{let e=Y.getState().snapshot.agentId?.trim();e&&this.setSelectedAgentId(e)},this.setSelectedSessionKey=e=>{e!==J.getState().snapshot.selectedSessionKey&&J.getState().setSnapshot({selectedSessionKey:e})},this.syncRouteSessionSelection=e=>{this.setSelectedSessionKey(e),e&&Y.getState().setSnapshot({draftProjectRoot:null})},this.setListMode=e=>{let t=J.getState().snapshot.listMode,n=this.resolveUpdateValue(t,e);n!==t&&J.getState().setSnapshot({listMode:n})},this.toggleSessionPinned=e=>{let{pinnedSessionKeys:t}=J.getState().snapshot;J.getState().setSnapshot({pinnedSessionKeys:hR(t,e)})},this.toggleProjectPinned=e=>{let{pinnedProjectRoots:t}=J.getState().snapshot;J.getState().setSnapshot({pinnedProjectRoots:hR(t,e)})},this.toggleProjectCollapsed=e=>{let{collapsedProjectRoots:t}=J.getState().snapshot;J.getState().setSnapshot({collapsedProjectRoots:hR(t,e)})},this.markSessionRead=(e,t,n)=>{let r=e?.trim(),i=t?.trim();!r||!i||this.shouldPersistReadAt(r,i,n)&&(J.getState().markSessionRead(r,i),cn(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=ql(r??`native`),a=Pc(t),o=n?.trim()||null;this.syncDraftThreadState(a),this.uiManager.navigateTo(Is,{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=J.getState().snapshot.query,n=this.resolveUpdateValue(t,e);n!==t&&J.getState().setSnapshot({query:n})}}},_R=async()=>!1,vR=class{constructor(e){this.docBrowserManager=e,this.state={pathname:``},this.actions={navigate:null,confirm:_R},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=()=>Ur.getSnapshot().mode===`mobile`,this.resolvePanelAppEntry=async e=>{let t=e.trim();if(!t)return null;try{return xD((await L.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(wt(r,a),{contentParams:i,title:n});return}let o=await this.resolvePanelAppEntry(r);if(o){this.docBrowserManager.openTarget({...Za(o),contentParams:i},{title:n});return}this.docBrowserManager.open(wt(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(Vs(e),t)}}};function yR(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 bR(e,t){return JSON.stringify(yR(e))!==JSON.stringify(yR({...e,...t}))}var xR=class{constructor(){this.syncSnapshot=e=>{let t=_u.getState();bR(t.snapshot,e)&&t.setSnapshot(e)}}};function SR(){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 CR(e,t,n){return e===t?n:e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?`${n}${e.slice(t.length)}`:null}function wR(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=CR(e.path,n,r);if(!a)return e;let o=td(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 TR(e,t){let n=t.trim();if(!n)return null;let r=e,i=e.workspaceFileTabs.filter(e=>CR(e.path,n,n)!==null).map(e=>e.key);for(let e of i){let t=sd(r,{kind:`file`,key:e});t&&(r={...r,...t})}return i.length>0?r:null}var ER=class{constructor(e,t,n){this.uiManager=e,this.sessionListManager=t,this.onWorkspacePanelOpened=n,this.handledUiShowContentEventIds=new Set,this.hasSnapshotChanges=e=>{let t=Y.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)&&Y.getState().setSnapshot(e)},this.clearDeletedSessionState=()=>{Y.getState().setSnapshot(SR())},this.resolveWorkspaceParentSessionKey=()=>J.getState().snapshot.selectedSessionKey?.trim()||Y.getState().snapshot.sessionKey?.trim()||(J.getState().snapshot.selectedSessionKey??null),this.activateWorkspaceFileTab=(e,t)=>{let{parentSessionKey:n}=e,{workspaceFileTabs:r}=Y.getState().snapshot;this.setWorkspaceSelection({workspacePanelParentKey:n,activeWorkspacePanelKind:`file`,workspaceFileTabs:ed(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}}=J.getState();t!==e&&this.uiManager.goToSession(e)},this.setWorkspaceSelection=(e,t)=>{let{snapshot:n}=Y.getState(),r=Pi({entries:n.workspaceNavigationHistory,index:n.workspaceNavigationHistoryIndex},t,id),i=e.workspacePanelParentKey&&e.workspacePanelParentKey!==n.workspacePanelParentKey?[]:n.closedWorkspaceTabEntries.filter(e=>!id(e,t));Y.getState().setSnapshot({...e,workspacePanelHidden:!1,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}=Y.getState();if(n.workspacePanelParentKey===t&&n.activeWorkspacePanelKind){n.workspacePanelHidden?(Y.getState().setSnapshot({workspacePanelHidden:!1}),this.onWorkspacePanelOpened?.()):this.closeWorkspacePanel();return}if(t){this.openWorkspaceOverview(t);return}this.openProjectFiles(null)},this.setWorkspacePanelWidth=e=>{this.syncSnapshot({workspacePanelWidth:qu(e)})},this.setWorkspaceExplorerWidth=e=>{this.syncSnapshot({workspaceExplorerWidth:Ju(e)})},this.renameWorkspacePath=e=>{let t=wR(Y.getState().snapshot,e);t&&this.syncSnapshot(t)},this.removeWorkspacePath=e=>{let t=TR(Y.getState().snapshot,e);t&&Y.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=ud(Y.getState().snapshot,t);n&&(this.sessionListManager.syncRouteSessionSelection(t),Y.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=ld(Y.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}):Y.getState().setSnapshot(o),this.ensureWorkspaceParentRoute(i),this.onWorkspacePanelOpened?.()},this.openSideChatDraft=e=>{let t=e?.trim()||this.resolveWorkspaceParentSessionKey()?.trim();if(!t)return;let n=cd(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=dd({snapshot:Y.getState().snapshot,...e});t&&(Y.getState().setSnapshot(t.patch),this.ensureWorkspaceParentRoute(t.parentSessionKey))},this.openFilePreview=e=>{let t=$u(e,this.resolveWorkspaceParentSessionKey());t&&this.activateWorkspaceFileTab(t)},this.moveFileToGlobal=(e,t,n)=>{let r=Y.getState().snapshot.workspaceFileTabs.find(t=>t.key===e);r&&(n.openTarget(Pd(r,t),{newTab:!0,placement:`docked`}),this.closeWorkspaceTab({kind:`file`,key:r.key}))},this.openWorkspaceFileViewer=(e,t)=>{let n=Y.getState().snapshot.workspaceFileTabs.find(t=>t.key===e.trim());if(!n||n.viewMode!==`preview`)return;let r=t??Qu(n.path,n.previewViewer);if(!r)return;let i=rd(n,r);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()||J.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}=Y.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}=Y.getState(),n=sd(t,e);n&&Y.getState().setSnapshot(n)},this.closeWorkspacePanel=()=>{Y.getState().setSnapshot({workspacePanelHidden:!0})},this.openSessionCronPanel=e=>{this.openWorkspacePage(e,`cron`)},this.goBackWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`back`)},this.goForwardWorkspacePanel=()=>{this.restoreWorkspaceNavigationStep(`forward`)},this.restoreWorkspaceNavigationStep=e=>{let{snapshot:t}=Y.getState(),n=Ii({entries:t.workspaceNavigationHistory,index:t.workspaceNavigationHistoryIndex},e);if(!n)return;let r=od(n.entry,t);r&&Y.getState().setSnapshot({...r,workspaceNavigationHistory:[...n.history.entries],workspaceNavigationHistoryIndex:n.history.index})},this.goToParentSession=()=>{let{parentSessionKey:e,activeSideChatDraft:t,childSessionTabs:n,activeChildSessionKey:r}=Y.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}}=J.getState(),n=e?.trim()||t;if(n&&await this.uiManager.confirm({title:U(`chatDeleteSessionConfirm`),variant:`destructive`,confirmLabel:U(`delete`)})){Y.getState().setSnapshot({isDeletePending:!0});try{await pe(n),De(se,n),se.removeQueries({queryKey:[`ncp-session-messages`,n]}),z.success(U(`chatDeleteSessionSucceeded`)),n===t&&(this.clearDeletedSessionState(),this.uiManager.goToChatRoot({replace:!0}))}catch(e){let t=e instanceof Error?e.message:String(e);z.error(`${U(`chatDeleteSessionFailed`)}: ${t}`)}finally{Y.getState().setSnapshot({isDeletePending:!1})}}}}},DR=()=>{let e=window,t=e.SpeechRecognition??e.webkitSpeechRecognition;return t?new t:null},OR=()=>({phase:`idle`,text:``,interim:``,seconds:0,error:null}),kR=e=>[`starting`,`recording`,`stopping`].includes(e),AR=class{constructor(e=DR,t=NM,n=jM){this.createRecognition=e,this.checkMicrophone=t,this.isSecureContext=n,this.snapshot=OR(),this.listeners=new Set,this.recognition=null,this.context=``,this.settingsRequested=!1,this.exitRequested=!1,this.draft=null,this.getSnapshot=()=>this.snapshot,this.subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}),this.update=e=>{this.snapshot={...this.snapshot,...e},this.listeners.forEach(e=>e())},this.open=e=>{this.snapshot.phase===`idle`&&(this.context=e,this.update({...OR(),phase:`ready`}))},this.openSettings=()=>{if(this.settingsRequested=!0,this.snapshot.phase===`recording`){this.finish();return}if(this.snapshot.phase===`stopping`)return;let{context:e}=this;this.acceptDraft(),this.open(e)},this.start=(e,t,n)=>{if(!kR(this.snapshot.phase)&&n){this.release(),this.context=t,this.draft=n,this.update({...OR(),phase:`starting`});try{if(!this.isSecureContext()){this.fail(`insecure-context`);return}let t=this.createRecognition();if(!t){this.fail(`unsupported`);return}this.recognition=t,t.lang=e===`zh`?`zh-CN`:`en-US`,t.continuous=!0,t.interimResults=!0,this.connect(t),this.checkAndStart(t)}catch(e){this.fail(MM(e))}}},this.checkAndStart=async e=>{try{let t=await this.checkMicrophone();if(this.recognition!==e||this.snapshot.phase!==`starting`)return;if(t){this.fail(t);return}this.setDeadline(15e3),e.start()}catch(t){this.recognition===e&&this.fail(MM(t))}},this.connect=e=>{e.onstart=()=>{if(this.recognition!==e||this.snapshot.phase!==`starting`)return;clearTimeout(this.deadline),this.update({phase:`recording`});let t=Date.now();this.ticker=setInterval(()=>{let e=Math.floor((Date.now()-t)/1e3);this.update({seconds:e}),e>=60&&this.finish()},1e3)},e.onresult=t=>{if(this.recognition!==e)return;let n=[],r=[];for(let e=0;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript?.trim();a&&(i.isFinal?n:r).push(a)}this.update({text:n.join(` `),interim:r.join(` `)}),this.draft?.update(this.snapshot.text,this.snapshot.interim)},e.onerror=({error:t})=>{if(this.recognition!==e)return;let n=t===`service-not-allowed`?`service-denied`:t===`not-allowed`?`permission`:t===`network`||t===`audio-capture`||t===`no-speech`?t:`failed`;this.fail(n)},e.onend=()=>{if(this.recognition!==e)return;if(this.exitRequested){this.release(!1),this.acceptDraft();return}let t=this.snapshot.text.trim();if(this.release(!1),!t){this.fail(`no-speech`);return}this.draft?.commit(t),this.draft=null;let{settingsRequested:n,context:r}=this;this.cancel(),n&&this.open(r)}},this.finish=()=>{if(this.snapshot.phase===`starting`){this.cancel();return}if(!(this.snapshot.phase!==`recording`||!this.recognition)){clearInterval(this.ticker),this.update({phase:`stopping`}),this.setDeadline(8e3);try{this.recognition.stop()}catch{this.fail(`failed`)}}},this.saveAndClose=()=>{if(this.exitRequested=!0,this.snapshot.phase===`recording`){this.finish();return}this.snapshot.phase!==`stopping`&&this.acceptDraft()},this.interrupt=()=>{kR(this.snapshot.phase)&&this.fail(`interrupted`)},this.acceptDraft=()=>{this.draft?.commit(),this.draft=null,this.cancel()},this.cancel=()=>{this.settingsRequested=!1,this.exitRequested=!1,this.release(),this.context=``,this.draft?.cancel(),this.draft=null,this.update(OR())},this.fail=e=>{if(this.exitRequested){this.acceptDraft();return}this.release(),this.snapshot.text?this.draft?.commit(this.snapshot.text):this.draft?.cancel(),this.draft=null,this.update(this.settingsRequested?{...OR(),phase:`ready`}:{phase:`error`,error:e,interim:``}),this.settingsRequested=!1},this.setDeadline=e=>{clearTimeout(this.deadline),this.deadline=setTimeout(()=>this.fail(`timeout`),e)},this.release=(e=!0)=>{clearTimeout(this.deadline),clearInterval(this.ticker);let{recognition:t}=this;if(this.recognition=null,t&&(t.onstart=null,t.onend=null,t.onerror=null,t.onresult=null,e))try{t.abort()}catch{}}}},jR=class{constructor(e){this.chatVoiceInputManager=new AR,this.chatUiManager=new vR(e.docBrowserManager),this.chatSessionListManager=new gR(this.chatUiManager),this.chatQueryManager=new xR,this.chatComposerIntentManager=e.chatComposerIntentManager,this.chatThreadManager=new ER(this.chatUiManager,this.chatSessionListManager,e.notifyWorkspacePanelOpened),e.pageResourceManager.bindWorkspace(this.chatThreadManager)}};function MR(){return R({queryKey:[`ncp-session-types`],queryFn:zt,staleTime:1e4,retry:!1})}function NR(e){let t=q(),n=va(),r=_a(),i=ga(),a=Ol({limit:200}),o=MR(),s=e.sessionKey?.trim()||`draft-session`,c=Al({sessionId:s});(0,G.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 PR(){let e=Hd(e=>e.session),t=fn(),n=rV();return e?(0,K.jsx)(xT,{id:ra,manager:n.workbenchSurfaceManager,title:e.title,testId:`floating-session-conversation`,focusOnOpen:!0,moreActions:(0,K.jsx)(jz,{page:Cz({kind:`chat-session`,title:e.title,url:Ps(e.sessionKey),resourceUri:Ps(e.sessionKey),historyPolicy:`none`})}),onClose:Ud.close,onPlace:()=>Ud.dock(e,n.docBrowserManager),onOpenMain:()=>{t(Vs(e.sessionKey)),Ud.close()},children:(0,K.jsx)(NP,{sessionKey:e.sessionKey},e.sessionKey)}):null}function FR({children:e}){let t=q(),n=$(),r=mn(),i=fn(),{confirm:a,ConfirmDialog:o}=xx(),s=Bs(vn(`/chat/:sessionId`)?r.pathname.slice(6):void 0),c=ia(e=>e.surfaces[`session-workspace:${s??`draft`}`]?.minimized??!1),l=Y(({snapshot:e})=>e.workspacePanelParentKey===s&&s&&!e.workspacePanelHidden&&!c&&e.activeWorkspacePanelKind===`child-session`?e.activeChildSessionKey:null),u=ia(e=>e.surfaces[`floating-conversation`]?.minimized??!1),d=ia(e=>e.surfaces[`global-resources`]?.minimized??!1),f=Hd(e=>u?null:e.session?.sessionKey),p=$i(({snapshot:e})=>{let t=e.tabs.find(t=>t.id===e.activeTabId);return e.isOpen&&!d&&t?.kind===`chat-session`?Fs(t.currentUrl):null});return NR({sessionKey:s}),(0,G.useEffect)(()=>{t.chatUiManager.syncState({pathname:r.pathname}),t.chatUiManager.bindActions({navigate:i,confirm:a})},[a,r.pathname,i,t]),(0,G.useEffect)(()=>(n.chatCompletionNotificationManager.syncVisibleSessions([s,l,f,p]),()=>n.chatCompletionNotificationManager.syncVisibleSessions([])),[n,s,l,f,p]),(0,K.jsxs)(K.Fragment,{children:[e,(0,K.jsx)(PR,{}),(0,K.jsx)(o,{})]})}function IR({children:e}){let t=$();return(0,K.jsx)(xc,{presenter:(0,G.useMemo)(()=>new jR(t),[t]),children:(0,K.jsx)(FR,{children:e})})}function LR({tab:e}){let t=Fs(e.currentUrl);return(0,K.jsx)(`div`,{"data-testid":`session-conversation-panel-tab`,className:`flex h-full min-h-0 min-w-0 flex-col bg-background text-foreground`,children:t?(0,K.jsx)(NP,{sessionKey:t},t):(0,K.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:U(`chatPanelUnavailable`)})})}var RR={[Ns]:{getTitle:e=>e.title,renderIcon:()=>(0,K.jsx)(Br,{className:`h-4 w-4`}),renderContent:({tab:e})=>(0,K.jsx)(LR,{tab:e})}},zR=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 BR(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 VR=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:I,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:T,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:Pe,targetSessionKey:o,tokenKey:BR(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:ie,targetSessionKey:t,tokenKey:BR(o,`${o}:${c}`),messageId:o,role:r,label:s,excerpt:c})},this.requestSystemObjectReference=e=>{let t=k(e.reference);t&&this.publish({kind:ln,targetSessionKey:e.targetSessionKey,tokenKey:t.uri,label:t.label,reference:t})},this.requestUiResourceReference=e=>{let t=me(e.reference);if(!t)return;let n=t.uri.trim(),r=t.title.trim();this.publish({kind:ve,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)}}}},HR=120,UR=200;function WR(e){return[e?.parent_session_id,e?.parentSessionId].some(e=>typeof e==`string`&&e.trim().length>0)}function GR(e){let t=e.replace(/\r\n?/gu,`
|
|
28
|
+
`).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<=HR?t:`${n.slice(0,HR-1).join(``)}…`}function KR(e){return GR(e.parts.filter(e=>e.type===`text`||e.type===`rich-text`).map(e=>e.text).join(` `))}var qR=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(L.eventBus.on(Vt.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!==X.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`||yg(t)||(this.rememberHandledMessage(t.id),this.visibleSessionIds.has(n)))return;let r=this.resolveSessionSummary(n),i=Mg(t.metadata);if(i&&i.actor!==`human`||!i&&r&&WR(r.metadata))return;let a=r?Cc(pl(r)):U(`chatBackgroundReplyFallbackTitle`),o=KR(t);this.notificationManager.show({id:`chat-reply:${t.id}`,title:a,description:o||U(`chatBackgroundReplyFallbackPreview`),href:Vs(n),action:{label:U(`chatFloatingExpand`),onClick:()=>Ud.open({sessionKey:n,title:a})},ariaLabel:U(`chatBackgroundReplyOpenAriaLabel`).replace(`{title}`,a)})},this.resolveSessionSummary=e=>(_u.getState().snapshot.sessionsQuery?.data?.sessions??[]).find(t=>t.sessionId===e),this.rememberHandledMessage=e=>{if(this.handledMessageIds.add(e),this.handledMessageIds.size<=UR)return;let t=this.handledMessageIds.values().next().value;t&&this.handledMessageIds.delete(t)}}};function JR(e,t){return e===t||e.startsWith(`${t}?`)||e.startsWith(`${t}/`)}function YR(e){let t=e.pathSegments.join(`/`),n=t?`/${t}`:`/`,r=new URL(e.raw);return na(`${n}${r.search}${r.hash}`,`docs`)}function XR(e){let t=e.filter(e=>e.trim().length>0).map(e=>encodeURIComponent(decodeURIComponent(e))).join(`/`);return t?`nextclaw://docs/${t}`:`nextclaw://docs`}function ZR(e){let t=new URL(e);return`${XR(t.pathname.replace(/\.html$/,``).replace(/\/$/,``).split(`/`))}${t.search}${t.hash}`}function QR(e){return Ka(e)!==null}function $R(e){let t=Ka(e);if(!t)return`nextclaw://panel-app`;let n=e.searchParams.get(`path`)?.trim();return Ga(t,n)}function ez(e){let t=Ka(e);return t?wt(t,e.searchParams.get(`path`)??void 0):`nextclaw://panel-app`}function tz(e,t){let n=ka(e),r=ka(t),i=Ka(n),a=Ka(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 nz=[{id:`system-object`,kind:`system-object`,defaultUrl:()=>`nextclaw://objects`,match:e=>!Fs(e.raw)&&!!j(e.raw),resolve:e=>({kind:`system-object`,title:j(e.raw).objectId,url:e.raw,resourceUri:e.raw,historyPolicy:`none`}),areEquivalent:(e,t)=>e===t},{id:`marketplace-detail`,kind:`marketplace-detail`,defaultUrl:()=>`nextclaw://marketplace-detail`,match:e=>e.scheme===`nextclaw`&&e.authority===`marketplace-detail`&&e.pathSegments.length===1,resolve:e=>({kind:`marketplace-detail`,title:decodeURIComponent(e.pathSegments[0]),url:e.raw,resourceUri:e.raw,historyPolicy:`managed`}),areEquivalent:(e,t)=>e===t},{id:`marketplace`,kind:`route`,defaultUrl:()=>`nextclaw://marketplace`,match:e=>e.scheme===`nextclaw`&&e.authority===`marketplace`&&e.pathSegments.length===0,resolve:e=>({kind:`route`,title:U(`marketplaceTypeSkill`),url:`/skills`,resourceUri:e.raw,historyPolicy:`none`}),areEquivalent:(e,t)=>e===t},{id:`workspace-file`,kind:`workspace-file`,defaultUrl:()=>`nextclaw://workspace-file`,match:e=>e.scheme===`nextclaw`&&e.authority===`workspace-file`,resolve:e=>({kind:`workspace-file`,title:U(`chatWorkspaceProjectFiles`),url:e.raw,resourceUri:e.raw,dedupeKey:e.raw,historyPolicy:`none`}),areEquivalent:(e,t)=>e===t},{defaultUrl:()=>`nextclaw://sessions/`,id:Ns,kind:Ns,match:e=>Fs(e.raw)!==null,resolve:e=>{let t=Fs(e.raw),n=t?Ps(t):e.raw;return{kind:Ns,title:U(`chatFloatingConversation`),url:n,resourceUri:n,dedupeKey:n,historyPolicy:`none`}},areEquivalent:(e,t)=>Fs(e)===Fs(t)},{defaultUrl:()=>Ma,id:`home`,kind:ja,match:e=>e.raw===Ma,resolve:()=>({historyPolicy:`managed`,kind:ja,resourceUri:Ma,title:U(`docBrowserHomeTitle`),url:Ma}),areEquivalent:(e,t)=>e===t},{defaultUrl:Qi,id:`docs-url`,kind:`docs`,match:e=>Gi(e.raw),resolve:e=>{let t=na(e.raw,`docs`);return{historyPolicy:`managed`,kind:`docs`,resourceUri:ZR(t),title:U(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Bi(e)===Bi(t)},{defaultUrl:Qi,id:`nextclaw-docs`,kind:`docs`,match:e=>e.scheme===`nextclaw`&&e.authority===`docs`,resolve:e=>{let t=YR(e);return{historyPolicy:`managed`,kind:`docs`,resourceUri:`${XR(e.pathSegments)}${new URL(e.raw).search}${new URL(e.raw).hash}`,title:U(`docBrowserHelp`),url:t}},areEquivalent:(e,t)=>Bi(e)===Bi(t)},{defaultUrl:()=>Pa,id:`apps`,kind:Na,match:e=>JR(e.raw,Pa),resolve:e=>{let t=Wa(e.raw);return{dedupeKey:`apps`,historyPolicy:`managed`,kind:Na,resourceUri:t,title:U(new URL(t).searchParams.get(`tab`)===`service-apps`?`serviceAppsTitle`:`appsTitle`),url:t}},areEquivalent:(e,t)=>Wa(e)===Wa(t)},{defaultUrl:()=>`nextclaw://panel-app`,id:`panel-app`,kind:La,match:e=>e.scheme===`nextclaw`&&e.authority===`panel-app`||QR(e),resolve:e=>{let t=$R(e),n=Ka(e);return{dedupeKey:n?`panel-app:${e.searchParams.get(`path`)?.trim()||n}`:void 0,historyPolicy:`managed`,kind:La,resourceUri:ez(e),title:U(`panelAppsTitle`),url:t}},areEquivalent:tz},{defaultUrl:()=>`about:blank`,id:`content`,kind:`content`,match:()=>!0,resolve:e=>({historyPolicy:`managed`,kind:`content`,resourceUri:e.raw||`about:blank`,title:Ki(e.raw,`content`,`Detail`),url:e.raw||`about:blank`}),areEquivalent:(e,t)=>e===t}],rz=nz.map(e=>({areEquivalent:e.areEquivalent,id:e.id,match:e.match,resolve:e.resolve}));function iz(){return[{id:`apps`,label:U(`appsTitle`),target:{type:`right-panel-resource`,uri:Pa}},{id:`service-apps`,label:U(`serviceAppsTitle`),target:{type:`right-panel-resource`,uri:Ia}},{id:`docs`,label:U(`docBrowserHelp`),target:{options:{newTab:!0},type:`right-panel-resource`,uri:Qi()}},{id:`skill-marketplace`,label:U(`marketplaceSkillsPageTitle`),target:{path:`/marketplace/skills`,type:`app-route`}}]}var az={apps:{accentClassName:`bg-emerald-50 text-emerald-700`,hoverAccentClassName:`group-hover:bg-emerald-100`,icon:(0,K.jsx)(n,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700`,hoverAccentClassName:`group-hover:bg-sky-100`,icon:(0,K.jsx)(Ao,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700`,hoverAccentClassName:`group-hover:bg-amber-100`,icon:(0,K.jsx)(Ar,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700`,hoverAccentClassName:`group-hover:bg-rose-100`,icon:(0,K.jsx)(io,{className:`h-5 w-5`})}};function oz(e){return az[e.id]??{accentClassName:`bg-gray-50 text-gray-700`,hoverAccentClassName:`group-hover:bg-[var(--interaction-hover)]`,icon:(0,K.jsx)(n,{className:`h-5 w-5`})}}function sz({open:e}){let t=fn(),n=iz(),r=n=>{if(n.type===`app-route`){t(n.path);return}e(n.uri,n.options)};return(0,K.jsx)(`div`,{className:`h-full overflow-auto bg-background px-4 py-5`,children:(0,K.jsx)(`div`,{className:`mx-auto w-full max-w-[520px]`,children:(0,K.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(76px,1fr))] gap-x-2 gap-y-4`,children:n.map(e=>{let t=oz(e);return(0,K.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,K.jsx)(`span`,{className:V(`flex h-10 w-10 shrink-0 items-center justify-center rounded-md transition-colors`,t.accentClassName,t.hoverAccentClassName),children:t.icon}),(0,K.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 cz(e){return e&&Gi(e)?`docs`:`content`}var lz=class{constructor(){this.resourceUriResolver=new Aa(rz,{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(ka(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(ka(e.currentUrl)).historyPolicy===`managed`,this.resolveRouteDefinition=(e,t,n)=>{let r=t??(e?void 0:n?.kind),i=r?nz.find(e=>e.kind===r):void 0;if(i)return i;let a=e?ka(e):null,o=a?nz.find(e=>e.match(a)):void 0;if(o)return o;let s=t??n?.kind??cz(e);return nz.find(e=>e.kind===s)??nz[nz.length-1]}}},uz={mcp:Vn,work:fr,agent:Dr,project:ir,skill:_r,inbox:Ir,session:Br,file:br,app:Ln,docs:Ar,website:Lr,generic:null,page:fs,overview:zo,"child-sessions":Oo,"project-files":Gn,cron:Qa,"continuous-attention":Fr},dz={agent:`agent`,project:`project`,skill:`skill`,"cron-job":`cron`,"inbox-delivery":`inbox`,"service-app":`app`,"panel-app":`app`,"mcp-server":`mcp`,"project-work":`work`},fz={apps:n,docs:Ar,github:ko,"new-tab":Kr,"panel-app":Ln,"service-apps":Ln};function pz(e,t){if(e.startsWith(`nextclaw://workspace?`)){let t=new URL(e).searchParams.get(`page`);return t&&Object.hasOwn(uz,t)?t:`page`}if(Fs(e))return`session`;let n=j(e);return n?dz[n.objectType]??`generic`:e.startsWith(`nextclaw://skill/`)||e.startsWith(`nextclaw://marketplace-detail/skill`)?`skill`:e.startsWith(`nextclaw://page?`)?`page`:e.startsWith(`nextclaw://workspace-file`)||e.startsWith(`file:`)||e.startsWith(`nextclaw://file/`)||!/^[a-z][a-z0-9+.-]*:/i.test(e.replace(/:\d+(?::\d+)?$/,``))&&/\.[a-z0-9]{1,16}(?::\d+(?::\d+)?)?(?:[?#]|$)/i.test(e)?`file`:t||e.startsWith(`nextclaw://apps`)||e.startsWith(`nextclaw://marketplace`)?`app`:e.startsWith(`nextclaw://docs`)?`docs`:`generic`}function mz(e){if(e)return/^(https?:|data:image\/|\/)/.test(e)?{type:`url`,url:e}:{type:`text`,value:e}}function hz({uri:e,appId:t}){return(0,K.jsx)(yz,{uri:e,specific:mz(c().data?.entries.find(e=>e.appId===t||e.id===t)?.icon)})}function gz({uri:e,sessionKey:t}){let n=kl({pageSize:100}).data?.pages.flatMap(e=>e.sessions).find(e=>e.sessionId===t),r=kd(n?.agentId);return(0,K.jsx)(yz,{uri:e,specific:r?.avatarUrl?{type:`url`,url:r.avatarUrl}:void 0})}function _z({uri:e,agentId:t}){let n=kd(t);return(0,K.jsx)(yz,{uri:e,specific:n?.avatarUrl?{type:`url`,url:n.avatarUrl}:void 0})}function vz({uri:e,icon:t}){let n=Ka(ka(e)),r=Fs(e),i=j(e);return i?.objectType===`panel-app`&&!t?(0,K.jsx)(hz,{uri:e,appId:i.objectId}):i?.objectType===`agent`&&!t?(0,K.jsx)(_z,{uri:e,agentId:i.objectId}):r&&!t?(0,K.jsx)(gz,{uri:e,sessionKey:r}):n&&!t?(0,K.jsx)(hz,{uri:e,appId:n}):(0,K.jsx)(yz,{uri:e,specific:t})}function yz({uri:e,specific:t}){let n=Ka(ka(e)),[r,i]=(0,G.useState)(null);if(t?.type===`url`&&t.url!==r&&/^(https?:\/\/|data:image\/|\/)/.test(t.url))return(0,K.jsx)(`img`,{src:t.url,alt:``,referrerPolicy:`no-referrer`,className:`shrink-0 rounded-sm object-contain align-[-0.12em]`,style:{display:`inline-block`,width:`1em`,height:`1em`,maxWidth:`1em`,margin:0},onError:()=>i(t.url)});if(t?.type===`text`)return(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block h-[1em] w-[1em] shrink-0 overflow-hidden text-center leading-none`,children:t.value});let a=e.replace(/:\d+(?::\d+)?$/,``);try{let e=new URL(a);a=e.searchParams.get(`path`)??e.pathname}catch{}a=a.split(/[?#]/,1)[0].replace(/:\d+(?::\d+)?$/,``);try{a=decodeURIComponent(a)}catch{}if(pz(e,n)===`file`&&/\.[a-z0-9]{1,16}$/i.test(a))return(0,K.jsx)(Zh,{fileName:a,size:`compact`});let o=t?.type===`builtin`&&fz[t.name]||uz[pz(e,n)];return o?(0,K.jsx)(o,{"aria-hidden":`true`,className:`inline-block h-[1em] w-[1em] shrink-0 align-[-0.12em]`}):null}function bz(e){if(/^\/(?!\/)/.test(e)&&!e.includes(`\\`))return!0;try{return[`nextclaw:`,`http:`,`https:`].includes(new URL(e).protocol)}catch{return!1}}function xz(e){return!e||typeof e!=`object`||!(`pinned`in e)||!Array.isArray(e.pinned)?[]:e.pinned.filter(e=>!e||typeof e!=`object`?!1:typeof e.uri==`string`&&/^(nextclaw:\/\/|https?:\/\/)/.test(e.uri)&&typeof e.title==`string`&&typeof e.target?.url==`string`&&bz(e.target.url)&&(e.mainPath===void 0||typeof e.mainPath==`string`&&/^\/(?!\/)/.test(e.mainPath)&&!e.mainPath.includes(`\\`))&&typeof e.target?.kind==`string`&&typeof e.target?.title==`string`&&[`managed`,`none`].includes(e.target.historyPolicy)).filter((e,t,n)=>n.findIndex(t=>t.uri===e.uri)===t).slice(-64)}var Sz=ct()(xi(()=>({pinned:[]}),{name:`nextclaw.page-navigation`,version:1,storage:Si(()=>new Li),merge:(e,t)=>({...t,pinned:xz(e)})}));function Cz(e){let t=e.resourceUri??e.url,n=Fs(t),r=Ja({resourceUri:t,currentUrl:e.url});return{uri:t,title:e.title,target:e,...e.kind===`route`?{mainPath:e.url}:n?{mainPath:Vs(n)}:r?{mainPath:`/apps/panel/${encodeURIComponent(r)}`}:{}}}function wz(e){return Cz({...e,url:e.currentUrl,historyPolicy:`managed`})}function Tz(e){return e.mainPath??`/resource?uri=${encodeURIComponent(e.uri)}`}function Ez(e,t,n){let r=ke(e,t);return Cz({kind:`system-object`,title:n,url:r,resourceUri:r,historyPolicy:`none`})}function Dz(e){return{...e.target,id:e.uri,currentUrl:e.target.url,history:[e.target.url],historyIndex:0,navVersion:0}}var Oz=class{constructor(e){this.app=e,this.remembered=new Map,this.bindWorkspace=e=>{this.workspace=e},this.remember=e=>{for(this.remembered.delete(e.uri),this.remembered.set(e.uri,e);this.remembered.size>100;)this.remembered.delete(this.remembered.keys().next().value)},this.resolve=(e,t)=>{if(!/^(nextclaw:\/\/|https?:\/\/)/i.test(e))return null;try{let n=this.app.rightPanelResourceRouteResolver.normalize(e);if(n.startsWith(`nextclaw://file/`)){let e=Id(n,t);return e?Cz(e):null}let r=this.remembered.get(n)??Sz.getState().pinned.find(e=>e.uri===n);if(r)return r;let i=$i.getState().snapshot.tabs.find(e=>(e.resourceUri??e.currentUrl)===n);if(i)return wz(i);if(n.startsWith(`nextclaw://page?`)){let e=new URL(n).searchParams.get(`path`);return!e?.startsWith(`/`)||e.startsWith(`//`)||e.startsWith(`/resource`)||e.includes(`\\`)?null:{uri:n,title:e,mainPath:e,target:{kind:`route`,title:e,url:e,resourceUri:n,historyPolicy:`none`}}}if(n.startsWith(`nextclaw://workspace?`)){let e=new URL(n).searchParams.get(`page`);return[`overview`,`child-sessions`,`project-files`,`cron`,`continuous-attention`].includes(e??``)?{uri:n,title:e,target:{kind:`workspace`,title:e,url:n,resourceUri:n,historyPolicy:`none`}}:null}if(n.startsWith(`nextclaw://workspace-file?`)){let e=new URL(n).searchParams,t=Y.getState().snapshot.workspaceFileTabs.find(t=>t.key===e.get(`key`));if(t)return Cz(Pd(t,{workingDir:e.get(`base`)||null,projectRoot:null}))}let a=this.app.rightPanelResourceRouteResolver.resolve(n);return n.startsWith(`nextclaw://`)&&a.kind===`content`?null:Cz(a)}catch{return null}},this.pin=e=>{this.remember(e),Sz.setState(({pinned:t})=>({pinned:[...t.filter(t=>t.uri!==e.uri),e].slice(-64)}))},this.unpin=e=>{Sz.setState(({pinned:t})=>({pinned:t.filter(t=>t.uri!==e)}))},this.open=(e,t,n)=>{if(this.remember(e),e.target.kind===`workspace`){let r=new URL(e.uri).searchParams,i=r.get(`page`),a=r.get(`session`);n(a?Vs(a):`/chat`),this.workspace?.openWorkspacePage(a,i);let o=Y.getState().snapshot.workspacePanelParentKey;this.app.workbenchSurfaceManager.place(`session-workspace:${o??`draft`}`,t===`floating`?`floating`:`docked`),t===`main`&&this.app.workbenchSurfaceManager.toggleMaximize(`session-workspace:${o??`draft`}`);return}let r=Fs(e.uri);if(t===`default`){if(r&&Hd.getState().session?.sessionKey===r){Ud.restore();return}if(this.reuseWorkspace(e,r))return;let t=$i.getState().snapshot,n=t.tabs.find(t=>(t.resourceUri??t.currentUrl)===e.uri);if(t.isOpen&&n){this.app.docBrowserManager.setActiveTab(n.id),this.app.workbenchSurfaceManager.restore(Ri);return}}t===`main`||e.target.kind===`route`||t===`default`&&e.mainPath&&e.target.kind!==`panel-app`?n(Tz(e)):t===`floating`&&r?Ud.open({sessionKey:r,title:e.title}):this.app.docBrowserManager.openTarget(e.target,{newTab:!0,placement:t===`floating`?`floating`:`docked`})},this.reuseWorkspace=(e,t)=>{let{snapshot:n}=Y.getState(),r=`session-workspace:${n.workspacePanelParentKey??`draft`}`;if(!this.workspace||n.workspacePanelHidden||!this.app.workbenchSurfaceManager.isVisible(r))return!1;let i=Fd(Dz(e))?.file;if(i&&n.workspaceFileTabs.some(e=>e.key===i.key))this.workspace.selectWorkspaceFile(i.key);else if(t&&n.childSessionTabs.some(e=>e.sessionKey===t))this.workspace.selectChildSessionDetail(t);else return!1;return this.app.workbenchSurfaceManager.restore(r),!0},this.openFileViewer=(e,t,n,r)=>{let i=Fd(Dz(e));if(!i)return;let a=Y.getState().snapshot;if(n!==`main`&&n!==`global`&&!a.workspacePanelHidden&&a.workspaceFileTabs.some(e=>e.key===i.file.key)&&this.workspace){this.workspace.openWorkspaceFileViewer(i.file.key,t);return}let o=rd(i.file,t);if(!o)return;let s=Cz(Pd(o,i));if(this.remember(s),n===`main`){r(Tz(s));return}let c=$i.getState().snapshot.tabs.find(t=>t.resourceUri===e.uri);c?(this.app.docBrowserManager.setActiveTab(c.id),this.app.docBrowserManager.openTarget(s.target)):this.open(s,`default`,r)},this.addExcerptToChat=(e,t,n)=>{let r=t===`/chat`||t.startsWith(`/chat/`);this.app.chatComposerIntentManager.requestExcerptReference({...e,targetSessionKey:r?Bs(t.slice(6)):null}),r||n(`/chat`)},this.addToChat=(e,t,n)=>{let r=t===`/chat`||t.startsWith(`/chat/`),i=r?Bs(t.slice(6)):null;if(j(e.uri)){L.systemObjectReferences.resolve(e.uri).then(e=>{this.app.chatComposerIntentManager.requestSystemObjectReference({targetSessionKey:i,reference:e}),r||n(`/chat`)}).catch(()=>z.error(U(`pageUnavailable`)));return}let a=Dz(e),o=Fd(a);if(o){let t=o.file.path.startsWith(`/`)||!o.workingDir?o.file.path:`${o.workingDir.replace(/\/$/,``)}/${o.file.path}`;this.app.chatComposerIntentManager.requestFileReference({targetSessionKey:i,tokenKey:t,label:e.title})}else{let e=za(a);if(!e)return;this.app.chatComposerIntentManager.requestUiResourceReference({targetSessionKey:i,reference:e})}r||n(`/chat`)}}};function kz(){let e=$(),t=fn(),{pathname:n,search:i}=mn(),a=Sz(e=>e.pinned),o=c(),s=r();return(r,c)=>{let l=Dz(r),u=Fd(l)?.file,d=u?.viewMode===`preview`?Qu(u.path,u.previewViewer):null,f=Ja(l),p=o.data?.entries.find(e=>e.appId===f),m=p?p.mainSidebar:a.some(e=>e.uri===r.uri),h=n=>e.pageResourceManager.open(r,n,t),g=[{key:`open-main`,icon:(0,G.createElement)(fs,{className:`h-4 w-4`}),label:U(r.target.kind===`workspace`?`workbenchMaximize`:`workbenchOpenMain`),onSelect:()=>h(`main`)},...r.target.kind===`route`?[]:[{key:`open-sidebar`,icon:(0,G.createElement)(cs,{className:`h-4 w-4`}),label:U(`workbenchDock`),onSelect:()=>h(`sidebar`)},{key:`open-floating`,icon:(0,G.createElement)(fs,{className:`h-4 w-4`}),label:U(`workbenchFloatView`),onSelect:()=>h(`floating`)}],{key:`pin-left`,icon:(0,G.createElement)(_s,{className:`h-4 w-4`}),pressed:m,label:U(m?`pageUnpinLeft`:`pagePinLeft`),disabled:!!(p&&s.isPending),onSelect:()=>{p?s.mutate({id:p.id,preferences:{mainSidebar:!m}}):m?e.pageResourceManager.unpin(r.uri):e.pageResourceManager.pin(r),m||Ur.setMainSidebarAppGroupCollapsed(!1)}},...za(l)?[{key:`add-to-chat`,icon:(0,G.createElement)(Sr,{className:`h-4 w-4`}),label:U(`docBrowserAddToChat`),restoreFocus:!1,onSelect:()=>e.pageResourceManager.addToChat(r,n,t)}]:[],{key:`copy-uri`,icon:(0,G.createElement)(Ho,{className:`h-4 w-4`}),label:U(`pageCopyUri`),onSelect:()=>{navigator.clipboard.writeText(r.uri).catch(()=>z.error(U(`pageCopyFailed`)))}}];return[...d?[{key:`file-view`,items:[{key:`viewer:${d}`,label:U(d===`rendered`?`chatWorkspaceOpenPreview`:`chatWorkspaceOpenSource`),onSelect:()=>e.pageResourceManager.openFileViewer(r,d,c??(n===`/resource`&&new URLSearchParams(i).get(`uri`)===r.uri?`main`:void 0),t)}]}]:[],...Az(g)]}}function Az(e){return[{key:`page-reference`,items:e.filter(e=>e.key===`add-to-chat`||e.key===`copy-uri`)},{key:`page-layout`,items:[{key:`layout`,label:U(`pageLayoutActions`),icon:(0,G.createElement)(Bo,{className:`h-4 w-4`}),children:[{key:`placement`,items:e.filter(e=>e.key!==`add-to-chat`&&e.key!==`copy-uri`)}]}]}]}function jz({page:e,revealOnHover:t=!1}){return(0,K.jsx)(xr,{groups:kz()(e),label:U(`pageActions`),children:(0,K.jsx)(`span`,{className:V(`inline-flex shrink-0`,t&&`pointer-events-none opacity-0 transition-opacity group-hover/sidebar-item:pointer-events-auto group-hover/sidebar-item:opacity-100 group-focus-within/sidebar-item:pointer-events-auto group-focus-within/sidebar-item:opacity-100 data-[context-menu-open]:pointer-events-auto data-[context-menu-open]:opacity-100 [@media(hover:none)]:pointer-events-auto [@media(hover:none)]:opacity-100`),children:(0,K.jsx)(dr,{children:(0,K.jsx)(W,{icon:(0,K.jsx)(wr,{className:`h-4 w-4`}),label:U(`pageActions`),size:`sm`})})})})}function Mz({page:e,onSelect:t}){return(0,K.jsx)(rr,{groups:kz()(e),onClose:()=>t?.()})}function Nz({pages:e,onNavigate:t}){let n=$();return(0,K.jsx)(`ul`,{className:`space-y-0.5`,children:e.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsx)(TI,{to:Tz(e),label:e.title,density:`compact`,iconNode:(0,K.jsx)(vz,{uri:e.uri,icon:e.target.dockIcon}),actions:(0,K.jsx)(jz,{page:e,revealOnHover:!0}),onNavigate:()=>{n.pageResourceManager.remember(e),t?.()}})},e.uri))})}function Pz({isCollapsed:e}){let t=c(),n=Sz(e=>e.pinned),r=Wr(e=>e.isMainSidebarAppGroupCollapsed),[i,a]=(0,G.useState)(!1),o=(t.data?.entries??[]).filter(e=>e.mainSidebar).sort((e,t)=>(e.mainSidebarOrder??0)-(t.mainSidebarOrder??0)).map(e=>Cz(Za(e))),s=[...o,...n.filter(e=>!o.some(t=>t.uri===e.uri))];return s.length?e?(0,K.jsxs)(_i,{open:i,onOpenChange:a,children:[(0,K.jsx)(mi,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":U(`pageSidebar`),className:`mx-auto my-1 flex items-center justify-center ${UF} ${JF}`,children:(0,K.jsx)(fs,{className:`h-4 w-4`})})}),(0,K.jsx)(hi,{side:`right`,className:`w-64 p-2`,children:(0,K.jsx)(Nz,{pages:s,onNavigate:()=>a(!1)})})]}):(0,K.jsxs)(`nav`,{"aria-label":U(`pageSidebar`),className:`mt-1 border-t border-border/50 px-3 pt-1`,"data-testid":`page-resource-sidebar-nav`,children:[(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":!r,onClick:Ur.toggleMainSidebarAppGroupCollapsed,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-[13px] ${JF}`,children:[(0,K.jsx)(Mr,{className:`h-3.5 w-3.5 ${r?`-rotate-90`:``}`}),(0,K.jsx)(`span`,{className:`flex-1 text-left`,children:U(`pageSidebar`)}),(0,K.jsx)(`span`,{children:s.length})]}),!r&&(0,K.jsx)(Nz,{pages:s})]}):null}var Fz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{AgentsPage:e}=await import(`./agents-p_wcGhC3.js`);return{AgentsPage:e}},__vite__mapDeps([25,26,1,5,6,7,8,9,10,11,12,13,14,15,16,17,27,24,28,29,23,30,31,32,19,33,34]))).AgentsPage})),Iz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{CronJobResource:e}=await import(`./cron-UqsFT41c.js`);return{CronJobResource:e}},[])).CronJobResource})),Lz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{ProjectsPage:e}=await import(`./projects-fPTOn2Wz.js`);return{ProjectsPage:e}},__vite__mapDeps([35,1,5,6,7,8,9,10,11,12,13,14,15,16,17,21,36,37,29,23,30,31,32,19,33,38,28]))).ProjectsPage})),Rz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{InboxPage:e}=await import(`./inbox-D62apR2j.js`);return{InboxPage:e}},[])).InboxPage})),zz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{AppsPanel:e}=await import(`./apps-CKFrWb00.js`);return{AppsPanel:e}},[])).AppsPanel})),Bz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{McpMarketplacePage:e}=await import(`./marketplace-BTDWnHP7.js`);return{McpMarketplacePage:e}},__vite__mapDeps([39,6,1,7,8]))).McpMarketplacePage})),Vz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{PanelAppRuntimeSurface:e}=await import(`./panel-apps-CniMi7QW.js`);return{PanelAppRuntimeSurface:e}},__vite__mapDeps([40,18,1,10,8,5,6,7,9,11,12,13,14,15,16,17,19,20]))).PanelAppRuntimeSurface})),Hz=(0,G.lazy)(async()=>({default:(await un(async()=>{let{PanelAppHostProvider:e}=await import(`./panel-apps-CniMi7QW.js`);return{PanelAppHostProvider:e}},__vite__mapDeps([40,18,1,10,8,5,6,7,9,11,12,13,14,15,16,17,19,20]))).PanelAppHostProvider}));function Uz({objectId:e,openTarget:t}){let[n,r]=(0,G.useState)(`service-apps`);return(0,K.jsx)(zz,{serviceResourceId:e,activeTab:n,onActiveTabChange:r,onOpenPanelApp:e=>t(Za(e))})}function Wz({objectType:e,objectId:t,openTarget:n}){let r;switch(e){case`agent`:r=(0,K.jsx)(Fz,{resourceId:t});break;case`cron-job`:r=(0,K.jsx)(Iz,{jobId:t});break;case`project`:r=(0,K.jsx)(Lz,{resourceId:t});break;case`project-work`:{let e;try{e=JSON.parse(t)}catch{e=null}if(!Array.isArray(e)||e.length!==2||e.some(e=>typeof e!=`string`||!e))break;r=(0,K.jsx)(Lz,{resourceId:e[0],resourceWorkId:e[1]});break}case`inbox-delivery`:r=(0,K.jsx)(Rz,{resourceId:t});break;case`mcp-server`:r=(0,K.jsx)(Bz,{resourceId:t});break;case`service-app`:r=(0,K.jsx)(Uz,{objectId:t,openTarget:n});break;case`panel-app`:r=(0,K.jsx)(Hz,{children:(0,K.jsx)(Vz,{appId:t,restorationScope:`main`})});break}return(0,K.jsx)(G.Suspense,{fallback:(0,K.jsx)(`p`,{role:`status`,className:`p-4`,children:U(`loading`)}),children:r??(0,K.jsx)(`p`,{role:`alert`,className:`p-4`,children:U(`resourceInvalid`)})})}function Gz({tab:e,openTarget:t}){let n=$(),{pathname:r}=mn(),i=fn(),a=e.resourceUri??e.currentUrl,o=j(a);return o?o.objectType===`skill`?(0,K.jsx)(Kz,{tab:e,openTarget:t}):(0,K.jsx)(Wn,{actionLabel:U(`chatWorkspaceAddToChat`),className:`h-full min-h-0`,maxCharacters:Fx,selectionTooLongLabel:U(`chatWorkspaceExcerptSelectionTooLong`),onAddToChat:({text:t})=>n.pageResourceManager.addExcerptToChat({path:a,label:e.title,excerpt:t,startLine:null,endLine:null},r,i),children:(0,K.jsx)(Wz,{...o,openTarget:t},a)}):(0,K.jsx)(`p`,{role:`alert`,className:`p-4`,children:U(`resourceInvalid`)})}function Kz({tab:e,openTarget:t}){let n=$(),{pathname:r}=mn(),i=fn(),a=e.resourceUri??e.currentUrl,o=R({queryKey:[`resource-object-snapshot`,a],queryFn:async({signal:e})=>{let t=await L.systemObjectReferences.resolve(a),n=await fetch(Ne(t.assetUri),{signal:AbortSignal.any([e,AbortSignal.timeout(3e4)])});if(!n.ok)throw Error(`Unable to read resource (${n.status})`);return{reference:t,content:await n.text()}},retry:!1});if(o.isPending)return(0,K.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:U(`loading`)});if(!o.data){let e=o.error instanceof ht?o.error.code:void 0;return(0,K.jsxs)(`div`,{className:`space-y-2 p-4`,children:[(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:U(e===`SYSTEM_OBJECT_NOT_FOUND`?`resourceNotFound`:e===`SYSTEM_OBJECT_INVALID_REFERENCE`?`resourceInvalid`:`resourceLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,className:`text-sm underline`,onClick:()=>void o.refetch(),children:U(`resourceRetry`)})]})}let{reference:s,content:c}=o.data;return(0,K.jsx)(gS,{file:{...$u({path:s.fileName,label:s.label,viewMode:`preview`,previewViewer:`rendered`,rawText:c,mimeType:s.mimeType},null),key:a},sessionWorkingDir:null,sessionProjectRoot:null,onTextExcerptAdd:e=>n.pageResourceManager.addExcerptToChat({...e,path:a,label:s.label,startLine:null,endLine:null},r,i),onFileOpen:e=>{let n=$u(e,null);n&&t(Pd(n,{workingDir:null,projectRoot:null}),{newTab:!0})}})}var qz={"system-object":{getTitle:e=>e.title,renderContent:e=>(0,K.jsx)(Gz,{...e})}};function Jz({tab:e,openTarget:t}){let n=$(),{pathname:r}=mn(),i=fn(),a=Fd(e);return a?(0,K.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`workspace-file-panel-tab`,children:(0,K.jsx)(gS,{file:a.file,sessionWorkingDir:a.workingDir,sessionProjectRoot:a.projectRoot,onTextExcerptAdd:t=>n.pageResourceManager.addExcerptToChat({...t,path:e.resourceUri??e.currentUrl},r,i),onFileOpen:e=>{let n=$u(e,a.file.parentSessionKey);n&&t(Pd(n,a),{newTab:!0})}})}):(0,K.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:U(`workbenchFileUnavailable`)})}var Yz={[Nd]:{getTitle:e=>e.title,renderIcon:()=>(0,K.jsx)(Jn,{className:`h-4 w-4`}),renderContent:e=>(0,K.jsx)(Jz,{...e})}},Xz={...qz,...Yz,...RR,...vD,...bw};function Zz({page:e}){let t=$(),n=fn(),r=(0,G.useRef)(null),[i,a]=(0,G.useState)(0),o=(0,G.useMemo)(()=>Dz(e),[e]),s=Xz[o.kind],c=`main:${e.uri}:${i}`,l=uT({currentTab:o,iframeRef:r,isEnabled:!!s?.supportsScrollRestoration});(0,G.useEffect)(()=>{let e=e=>{if(e.source===r.current?.contentWindow){if(o.kind===`docs`&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`&&Gi(e.data.url)&&Bi(e.data.url)!==Bi(o.currentUrl)){let r=t.pageResourceManager.resolve(e.data.url);r&&t.pageResourceManager.open(r,`main`,n)}s?.onIframeMessage?.({event:e,iframe:r.current,iframeInstanceId:c,tab:o})}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[t,n,c,s,o]);let u={tab:o,currentUrl:o.currentUrl,refreshIframe:()=>a(e=>e+1),open:e=>{let r=e?t.pageResourceManager.resolve(e):null;r&&t.pageResourceManager.open(r,`main`,n)},openTarget:e=>t.pageResourceManager.open(Cz(e),`main`,n)};return(0,K.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,"data-testid":`resource-main-page`,children:[(0,K.jsxs)(`header`,{className:`flex min-h-10 shrink-0 items-center gap-2 border-b border-border/60 px-3`,children:[(0,K.jsx)(vz,{uri:e.uri,icon:e.target.dockIcon}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:e.title}),(0,K.jsx)(jz,{page:e})]}),s?.renderToolbar?.(u),(0,K.jsx)(fT,{currentTab:o,currentUrl:o.currentUrl,customContent:s?.renderContent?.(u),iframeRef:r,iframeInstanceId:c,iframeSandbox:s?.getIframeSandbox?.(o),isDragging:!1,isResizing:!1,onIframeLoad:l,onIframePointerOver:s?.onIframePointerOver})]})}function Qz(){let e=$(),[t]=hn(),n=fn(),r=t.get(`uri`)??``,i=(0,G.useMemo)(()=>e.pageResourceManager.resolve(r),[e,r]);return(0,G.useEffect)(()=>{i?.target.kind===`workspace`&&e.pageResourceManager.open(i,`main`,n)},[e,n,i]),i?.target.kind===`workspace`?null:i?(0,K.jsx)(Zz,{page:i},i.uri):(0,K.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:U(`pageUnavailable`)})}var $z=ct(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})})),eB=class{constructor(){this.authPollTimerId=null,this.browserSignInCompletion=null,this.openAccountPanel=()=>{$z.getState().openPanel()},this.closeAccountPanel=()=>{$z.getState().closePanel()},this.syncRemoteStatus=e=>{e?.account.loggedIn&&(this.clearPollTimer(),this.resolveBrowserSignIn(e),$z.getState().clearBrowserAuth())},this.ensureSignedIn=async e=>{let t=e?.status??await yL();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 Qt({apiBase:xL(e?.status??await yL(),t)});$z.getState().beginBrowserAuth({sessionId:n.sessionId,verificationUri:n.verificationUri,expiresAt:n.expiresAt,intervalMs:n.intervalMs,statusMessage:U(`remoteBrowserAuthWaiting`)}),(await sa.openExternalUrl(n.verificationUri)).opened||$z.getState().setAuthStatusMessage(U(`remoteBrowserAuthPopupBlocked`)),this.scheduleBrowserAuthPoll()}catch(e){let t=e instanceof Error?e.message:U(`remoteBrowserAuthStartFailed`);this.rejectBrowserSignIn(e),z.error(`${U(`remoteBrowserAuthStartFailed`)}: ${t}`)}},this.resumeBrowserSignIn=async()=>{let e=$z.getState().authVerificationUri;e&&await sa.openExternalUrl(e)},this.logout=async()=>{try{await dt(),this.rejectBrowserSignIn(Error(`Signed out before browser sign-in completed.`)),$z.getState().clearBrowserAuth(),await bL(),z.success(U(`remoteLogoutSuccess`))}catch(e){let t=e instanceof Error?e.message:U(`remoteLogoutFailed`);z.error(`${U(`remoteLogoutFailed`)}: ${t}`)}},this.updateUsername=async e=>{try{await on({username:e.trim()}),await bL(),z.success(U(`remoteAccountUsernameSetSuccess`))}catch(e){let t=e instanceof Error?e.message:U(`remoteAccountUsernameSetFailed`);z.error(`${U(`remoteAccountUsernameSetFailed`)}: ${t}`)}},this.openNextClawWeb=async(e=`/`)=>{let t=CL(await yL());if(!t){z.error(U(`remoteOpenWebUnavailable`));return}let n=new URL(e,`${t.replace(/\/+$/,``)}/`).toString();await sa.openExternalUrl(n)},this.scheduleBrowserAuthPoll=()=>{this.clearPollTimer();let{authSessionId:e,authPollIntervalMs:t}=$z.getState();e&&(this.authPollTimerId=window.setTimeout(async()=>{await this.pollBrowserSignIn()},t))},this.pollBrowserSignIn=async()=>{let e=$z.getState();if(e.authSessionId)try{let t=await yL(),n=await We({sessionId:e.authSessionId,apiBase:xL(t)});if(n.status===`pending`){$z.getState().updateBrowserAuth({statusMessage:U(`remoteBrowserAuthWaiting`),intervalMs:n.nextPollMs??1500}),this.scheduleBrowserAuthPoll();return}if(n.status===`expired`){this.clearPollTimer(),this.rejectBrowserSignIn(Error(n.message||U(`remoteBrowserAuthExpired`))),$z.getState().clearBrowserAuth(),z.error(n.message||U(`remoteBrowserAuthExpired`));return}$z.getState().setAuthStatusMessage(U(`remoteBrowserAuthCompleted`));let r=await bL();this.clearPollTimer(),this.resolveBrowserSignIn(r),$z.getState().clearBrowserAuth(),z.success(U(`remoteLoginSuccess`))}catch(e){this.clearPollTimer(),this.rejectBrowserSignIn(e),$z.getState().clearBrowserAuth();let t=e instanceof Error?e.message:U(`remoteBrowserAuthPollFailed`);z.error(`${U(`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=$z.getState();return{sessionId:e.authSessionId,expiresAt:e.authExpiresAt?Zr(e.authExpiresAt):`-`}}}};async function tB(){return await un(()=>import(`./account-panel-Cfx3ocPY.js`),__vite__mapDeps([41,1,6,7,8,9,36,37,19,10,5,11,12,13,14,15,16,17]))}var nB=`relative ml-auto flex min-h-[68px] w-[360px] max-w-[calc(100vw-2rem)] items-center rounded-2xl 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)]`,rB=`flex min-h-[66px] min-w-0 flex-1 items-center gap-2.5 rounded-[inherit] py-3 pl-3.5 pr-1`;function iB({title:e,description:t,iconSrc:n}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.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,K.jsx)(`img`,{"aria-hidden":`true`,alt:``,src:n??`/logo.svg`,className:`h-full w-full object-contain`})}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-[15px] font-semibold leading-5 tracking-[-0.01em]`,children:e}),t?(0,K.jsx)(`span`,{className:`mt-0.5 block truncate text-[14px] leading-5 text-muted-foreground`,children:t}):null]})]})}function aB({dismissLabel:e,onDismiss:t,action:n}){return(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 pr-2`,children:[n?(0,K.jsx)(W,{icon:(0,K.jsx)(Go,{className:`h-4 w-4`,"aria-hidden":`true`}),label:n.label,className:`h-9 w-9`,size:`lg`,onClick:()=>{n.onClick(),t()}}):null,(0,K.jsx)(W,{icon:(0,K.jsx)(Vr,{className:`h-4 w-4`,"aria-hidden":`true`}),label:e,onClick:t,className:`h-9 w-9`,size:`lg`})]})}function oB({title:e,description:t,href:n,iconSrc:r,ariaLabel:i,dismissLabel:a,onDismiss:o,action:s}){let c=i??[e,t].filter(Boolean).join(`: `);return n?(0,K.jsxs)(`div`,{className:nB,children:[(0,K.jsx)(gn,{to:n,"aria-label":c,className:`${rB} focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50`,onClick:o,children:(0,K.jsx)(iB,{title:e,description:t,iconSrc:r})}),(0,K.jsx)(aB,{action:s,dismissLabel:a,onDismiss:o})]}):(0,K.jsxs)(`div`,{className:nB,children:[(0,K.jsx)(`div`,{role:`status`,"aria-label":c,className:rB,children:(0,K.jsx)(iB,{title:e,description:t,iconSrc:r})}),(0,K.jsx)(aB,{action:s,dismissLabel:a,onDismiss:o})]})}var sB=8e3,cB=class{constructor(){this.show=e=>z.custom(t=>(0,G.createElement)(oB,{title:e.title,description:e.description,href:e.href,iconSrc:e.iconSrc,ariaLabel:e.ariaLabel,action:e.action,dismissLabel:e.dismissLabel??U(`notificationDismiss`),onDismiss:()=>{z.dismiss(t)}}),{id:e.id,duration:e.durationMs??sB,unstyled:!0}),this.dismiss=e=>{z.dismiss(e)}}},lB=`nextclaw://docs`,uB=`github-project`,dB=`https://github.com/Peiiii/nextclaw`;function fB(){return[{builtIn:!0,icon:{type:`builtin`,name:`apps`},id:`apps`,label:U(`appsTitle`),removable:!1,target:{type:`right-panel-resource`,uri:Pa}},{builtIn:!0,icon:{type:`builtin`,name:`docs`},id:`docs`,label:U(`docBrowserHelp`),removable:!1,target:{type:`right-panel-resource`,uri:lB}},{builtIn:!0,icon:{type:`builtin`,name:`new-tab`},id:`new-tab`,label:U(`docBrowserHomeTitle`),removable:!1,target:{type:`right-panel-resource`,uri:Ma}},{builtIn:!0,icon:{type:`builtin`,name:`github`},id:uB,label:U(`sideDockGitHubProject`),removable:!1,target:{type:`external-url`,url:dB}}]}var pB=[`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`];function mB(e){return!!e&&typeof e==`object`}function hB(e){return pB.includes(e)}function gB(e){return!mB(e)||typeof e.type!=`string`?null:e.type===`builtin`&&hB(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 _B(e){if(!mB(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||!mB(e.target)||e.target.type!==`right-panel-resource`||typeof e.target.uri!=`string`||e.target.uri.trim().length===0)return null;let t=gB(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 vB(e){if(!Array.isArray(e))return[];let t=new Map;return e.forEach(e=>{let n=_B(e);n&&t.set(n.id,n)}),Array.from(t.values())}function yB(e,t){return{createdAt:t,icon:e.icon,id:e.id,label:e.label,target:e.target}}function bB(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function xB(e){return{builtIn:!1,icon:e.icon,id:e.id,label:e.label,removable:!0,target:e.target}}function SB(e,t){let n=new Set(e.map(e=>e.id)),r=new Set(e.map(bB).filter(e=>e!==null)),i=t.filter(e=>!n.has(e.id)&&!r.has(e.target.uri)).map(xB);return[...e,...i]}var CB=`nextclaw.side-dock.state`,wB=1;function TB(e){return!!e&&typeof e==`object`}var EB=ct()(xi(e=>({isVisible:!0,pinnedItems:[],setVisible:t=>e({isVisible:t}),setPinnedItems:t=>e({pinnedItems:vB(t)})}),{name:CB,version:wB,storage:Si(()=>window.localStorage),partialize:e=>({isVisible:e.isVisible,pinnedItems:e.pinnedItems}),merge:(e,t)=>{let n=TB(e)?vB(e.pinnedItems):[],r=TB(e)&&typeof e.isVisible==`boolean`?e.isVisible:!0;return{...t,isVisible:r,pinnedItems:n}}}));function DB({active:e,item:t,onOpen:n,onUnpin:r,menuGroups:i=[]}){let{label:a}=t;return(0,K.jsxs)(ai,{children:[(0,K.jsx)(xr,{groups:i,label:U(`pageActions`),children:(0,K.jsxs)(`div`,{className:`group relative`,children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":a,title:a,"data-side-dock-item-id":t.id,onClick:()=>n(t),className:V(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg 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`,e?`bg-[var(--interaction-selection)] text-foreground hover:bg-[var(--interaction-selection)]`:`bg-transparent`),children:(0,K.jsx)(`span`,{className:`flex items-center text-xl`,children:(0,K.jsx)(vz,{uri:AB(t)??``,icon:t.icon})})})}),t.removable?(0,K.jsx)(`button`,{type:`button`,"aria-label":U(`sideDockUnpinItem`),title:U(`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-[var(--interaction-hover)] hover:text-foreground group-hover:flex focus-visible:flex focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border`,children:(0,K.jsx)(Vr,{className:`h-3 w-3`,"aria-hidden":`true`})}):null]})}),(0,K.jsx)(ui,{side:`left`,children:a})]})}function OB({icon:e,label:t,onClick:n}){return(0,K.jsxs)(ai,{children:[(0,K.jsx)(ri,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":t,title:t,"data-side-dock-action":`hide`,onClick:n,className:V(`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg 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,K.jsx)(e,{className:`h-5 w-5`,"aria-hidden":`true`})})}),(0,K.jsx)(ui,{side:`left`,children:t})]})}function kB(e){return e?.trim()??``}function AB(e){return e.target.type===`right-panel-resource`?e.target.uri:null}function jB(e,t,n,r=!1){if(!t||!n)return!1;let i=kB(AB(e)??void 0);if(!i)return!1;let a=kB(n.resourceUri);return a&&a===i||kB(n.currentUrl)===i?!0:r?!1:e.id===`docs`&&n.kind===`docs`}function MB(e,t){if(!t)return!1;let n=kB(t.resourceUri),r=kB(t.currentUrl);return e.some(e=>{let t=kB(AB(e)??void 0);return t===n||t===r})}function NB(e){return e.id===uB}function PB({manager:e,getItemMenuGroups:t}){let n=EB(e=>e.pinnedItems),r=EB(e=>e.setVisible),{currentTab:i,isOpen:a}=Xi(),{confirm:o,ConfirmDialog:s}=xx(),c=SB(fB(),n),l=c.filter(e=>!NB(e)),u=c.filter(NB),d=MB(c,i),f=async()=>{await o({title:U(`sideDockHideConfirmTitle`),description:U(`sideDockHideConfirmDescription`),confirmLabel:U(`sideDockHideConfirmAction`),cancelLabel:U(`cancel`)})&&r(!1)};return(0,K.jsx)(ni,{delayDuration:250,children:(0,K.jsxs)(`aside`,{"data-testid":`side-dock`,"data-theme-surface":`utility-rail`,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,K.jsx)(`div`,{className:`flex w-full flex-col items-center gap-1`,children:l.map(n=>(0,K.jsx)(DB,{menuGroups:t?.(n),active:jB(n,a,i,d),item:n,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},n.id))}),u.length>0?(0,K.jsxs)(`div`,{"data-testid":`side-dock-utility`,className:`mt-auto flex w-full flex-col items-center gap-1`,children:[u.map(n=>(0,K.jsx)(DB,{menuGroups:t?.(n),active:jB(n,a,i,d),item:n,onOpen:e.openItem,onUnpin:t=>e.unpinItem(t.id)},n.id)),(0,K.jsx)(OB,{icon:ls,label:U(`sideDockHide`),onClick:()=>{f()}})]}):null,(0,K.jsx)(s,{})]})})}var FB=`pinned`,IB=new Set([`apps`,`docs`,`github`,`new-tab`,`panel-app`,`service-apps`]);function LB(e){return e.trim()}function RB(e){let t=0;return Array.from(LB(e)).forEach(e=>{t=t*31+e.charCodeAt(0)>>>0}),`${FB}-${LB(e).replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-+|-+$/g,``).toLowerCase()||`resource`}-${t.toString(36)}`}function zB(e){return e?.type===`builtin`&&IB.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 BB(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 VB=class{constructor(e){this.docBrowserManager=e,this.getItems=()=>SB(fB(),EB.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 sa.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:zB(e.dockIcon)??{type:`builtin`,name:BB(e)},id:RB(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=LB(e.target.uri),r={...e,target:{type:`right-panel-resource`,uri:n}};this.setPinnedItems(i=>i.some(t=>t.id===e.id||LB(t.target.uri)===n)?i:[...i,yB(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}=EB.getState();n(e(t))},this.getTabResourceUri=e=>{if(e?.viewState!=null)return null;let t=e?.resourceUri??e?.currentUrl,n=t?LB(t):``;return n.length>0?n:null},this.findItemByUri=e=>{let t=LB(e);return this.getItems().find(e=>e.target.type===`right-panel-resource`&&LB(e.target.uri)===t)}}},HB=new class{constructor(){this.resolveOpenTarget=e=>{let{activeTab:t,kind:n,url:r}=e,i=n??(r?void 0:t?.kind)??(r&&Gi(r)?`docs`:`home`),a=r?.trim()||(!n&&t&&t.kind!==`docs`?t.currentUrl:i===`home`?`nextclaw://new-tab`:i===`docs`?Qi():`about:blank`),o=i===`docs`?na(a,`docs`):a;return{historyPolicy:`managed`,kind:i,title:i===`home`?U(`docBrowserHomeTitle`):Ki(o,i,i===`docs`?U(`docBrowserHelp`):`Detail`),url:o}},this.areUrlsEquivalent=(e,t,n,r)=>n===r?n===`docs`?Bi(e)===Bi(t):e===t:!1,this.usesManagedHistory=e=>e.currentUrl!==ta}};function UB(e,t,n){return{...e,tabs:e.tabs.map(e=>e.id===t?n(e):e)}}function WB(e,t){return UB(e,e.activeTabId,t)}function GB(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 KB(e,t){return{kind:t.kind,resourceUri:t.resourceUri??t.url,tabId:e,url:t.url}}function qB(e,t,n){let r=Pi({entries:t.activeHistory,index:t.activeHistoryIndex},n,(t,n)=>GB(e,t,n));return{...t,activeHistory:[...r.entries],activeHistoryIndex:r.index}}function JB(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 YB(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=JB(e,r,a.url),s=n.resourceUri!==void 0&&n.resourceUri===r.resourceUri;return UB({...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 XB(e,t){return!e.isOpen&&e.tabs.length===1&&t?.kind===`home`&&t.currentUrl===`nextclaw://new-tab`}function ZB(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=UB(t,u.id,t=>Ji(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?qB(e,l,KB(u.id,n)):l}if(o||c||!l||l.kind!==n.kind){let i=ea(n.url,n.kind,s??n.title,c,n.resourceUri??n.url,r?.dockIcon??n.dockIcon,n.contentParams,r?.viewState??n.viewState);return XB(t,l)?{...t,isOpen:!0,tabs:[i],activeTabId:i.id,activeHistory:[Zi(i)],activeHistoryIndex:0}:qB(e,{...t,isOpen:!0,tabs:[...t.tabs,i],activeTabId:i.id},Zi(i))}return qB(e,{...WB(t,t=>Ji(e,t,n,r,c)),isOpen:!0},KB(t.activeTabId,n))}function QB(e,t,n,r){let i=t.tabs.find(e=>e.id===t.activeTabId)??t.tabs[0];return ZB(e,t,{...e.resolveOpenTarget({activeTab:i,kind:r?.kind,url:n}),contentParams:r?.contentParams},r)}var $B=class{constructor(e,t=HB,n){this.surfaces=e,this.routeResolver=t,this.onRightPanelOpened=n,this.setSnapshot=e=>{$i.getState().setSnapshot(e)},this.open=(e,t)=>{this.setSnapshot(n=>QB(this.routeResolver,n,e,t)),t?.placement&&this.surfaces.place(Ri,t.placement),this.surfaces.restore(Ri),this.onRightPanelOpened?.()},this.openTarget=(e,t)=>{this.setSnapshot(n=>ZB(this.routeResolver,n,e,{...t,dedupeKey:t?.dedupeKey??e.dedupeKey,kind:t?.kind??e.kind,title:t?.title??e.title})),t?.placement&&this.surfaces.place(Ri,t.placement),this.surfaces.restore(Ri),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:Wi,newTab:!0})},this.close=()=>{this.setSnapshot(e=>({...e,isOpen:!1}))},this.toggleMode=()=>{let{surfaces:e}=this;e.place(Ri,e.get(`global-resources`).placement===`floating`?`docked`:`floating`),this.surfaces.restore(Ri),this.onRightPanelOpened?.()},this.setDockedWidth=e=>{this.setSnapshot(t=>({...t,dockedWidth:Ui(e)}))},this.navigate=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=ea(Qi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id,isOpen:!0}}let n=WB(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,...qi(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?qB(this.routeResolver,n,Zi(r)):n})},this.syncUrl=e=>{this.setSnapshot(t=>{if(!t.tabs.length){let e=ea(Qi(),`docs`,`Docs`);return{...t,tabs:[e],activeTabId:e.id}}let n=WB(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,...qi(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?qB(this.routeResolver,n,Zi(r)):n})},this.goBack=()=>{this.setSnapshot(e=>{let t=Ii({entries:e.activeHistory,index:e.activeHistoryIndex},`back`);return t?YB(this.routeResolver,{...e,activeHistory:[...t.history.entries],activeHistoryIndex:t.history.index},t.entry):e})},this.goForward=()=>{this.setSnapshot(e=>{let t=Ii({entries:e.activeHistory,index:e.activeHistoryIndex},`forward`);return t?YB(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{...Vi(),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=ji({entries:a.activeHistory,index:a.activeHistoryIndex},t=>t.tabId!==e,Zi(o)),c={...a,activeHistory:[...s.entries],activeHistoryIndex:s.index};return t.activeTabId===e?qB(this.routeResolver,c,Zi(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?qB(this.routeResolver,{...t,activeTabId:e,isOpen:!0},Zi(n)):t})}}};function eV(e){return e.activeWorkspacePanelKind!=null&&!e.workspacePanelHidden}var tV=class{constructor(){this.workbenchSurfaceManager=Vd,this.notificationManager=new cB,this.inboxManager=new II,this.chatCompletionNotificationManager=new qR(this.notificationManager),this.accountManager=new eB,this.rightPanelResourceRouteResolver=new lz,this.notifyRightPanelOpened=()=>{let e=$i.getState().snapshot,t=Y.getState().snapshot;Ur.collapseSidebarForDenseRightPanels({isDocBrowserDocked:this.workbenchSurfaceManager.get(Ri).placement===`docked`,isDocBrowserOpen:e.isOpen,isWorkspacePanelOpen:eV(t)})},this.notifyWorkspacePanelOpened=()=>{let e=Y.getState().snapshot.workspacePanelParentKey;this.workbenchSurfaceManager.restore(`session-workspace:${e??`draft`}`),this.notifyRightPanelOpened()},this.docBrowserManager=new $B(this.workbenchSurfaceManager,this.rightPanelResourceRouteResolver,this.notifyRightPanelOpened),this.pageResourceManager=new Oz(this),this.appPackageOperationSettlementManager=new lD(this.docBrowserManager),this.sideDockManager=new VB(this.docBrowserManager),this.chatComposerIntentManager=new VR,this.chatDraftIntentManager=new zR,this.panelAppHostPresenter=new v,this.serviceActionAuthorizationManager=this.panelAppHostPresenter.serviceActionAuthorizationManager,this.panelAppBridgeManager=this.panelAppHostPresenter.panelAppBridgeManager,this.remoteAccessManager=new TL({accountManager:this.accountManager})}},nV=null;function rV(){return nV??=new tV,nV}function iV(){return rV()}var aV=globalThis,oV=aV.__NEXTCLAW_APP_PRESENTER_CONTEXT__??(0,G.createContext)(null);aV.__NEXTCLAW_APP_PRESENTER_CONTEXT__=oV;function sV({children:e}){let t=(0,G.useMemo)(()=>rV(),[]);return(0,K.jsx)(oV.Provider,{value:t,children:(0,K.jsx)(h,{presenter:t.panelAppHostPresenter,children:e})})}function $(){let e=(0,G.useContext)(oV);if(!e)throw Error(`useAppPresenter must be used inside AppPresenterProvider`);return e}export{eF as $,xs as $t,gL as A,EC as At,VI as B,Dd as Bt,$L as C,bw as Ct,kL as D,IC as Dt,AL as E,FC as Et,hL as F,ZS as Ft,RF as G,ql as Gt,RI as H,wd as Ht,pL as I,FS as It,sF as J,J as Jt,uF as K,Jl as Kt,nL as L,aS as Lt,bL as M,TC as Mt,xL as N,tC as Nt,TL as O,PC as Ot,CL as P,QS as Pt,tF as Q,Cs as Qt,tL as R,hg as Rt,eR as S,ET as St,NL as T,HC as Tt,II as U,yu as Ut,LI as V,Ed as Vt,zF as W,Xl as Wt,ZP as X,Bs as Xt,rF as Y,q as Yt,$P as Z,Ds as Zt,IR as _,qT as _t,PB as a,lD as at,rR as b,PT as bt,$z as c,uE as ct,Mz as d,cE as dt,bs as en,AM as et,jz as f,iE as ft,vz as g,YT as gt,wz as h,GT as ht,iV as i,Da as in,_D as it,yL as j,wC as jt,wL as k,kC as kt,Qz as l,dE as lt,Ez as m,VT as mt,$ as n,Po as nn,yD as nt,EB as o,cD as ot,kz as p,XT as pt,lF as q,Yl as qt,rV as r,uo as rn,vD as rt,tB as s,pE as st,sV as t,qo as tn,xD as tt,Xz as u,lE as ut,MR as v,KT as vt,qL as w,BC as wt,tR as x,DT as xt,mR as y,JT as yt,qI as z,Td as zt};
|