local-operator-ui 0.46.4 → 0.46.6
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/out/main/index.js +527 -6
- package/out/preload/index.js +42 -2
- package/out/renderer/assets/{_basePickBy-B_YChRKS.js → _basePickBy-Do5pLlvO.js} +1 -1
- package/out/renderer/assets/{_baseUniq-B3GZNf1Q.js → _baseUniq-CYENlcn8.js} +1 -1
- package/out/renderer/assets/{agent-details-page-DMl53cco.js → agent-details-page-K289NUHT.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-uZ_i6ydJ.js → agent-hub-page-CSCc9Lee.js} +1 -1
- package/out/renderer/assets/{agents-page-CJPkFRo3.js → agents-page-D2CGjR5l.js} +3 -3
- package/out/renderer/assets/{approvalsOverlay-CxjN3jh2.js → approvalsOverlay-C68maBuQ.js} +1 -1
- package/out/renderer/assets/{arc-DFaaUzFE.js → arc-Bh6MAPn3.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BpAsTfqS.js → architectureDiagram-IEHRJDOE-BO0aJcKY.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-r4jr-rzt.js → blockDiagram-JOT3LUYC-BDwqIZKe.js} +1 -1
- package/out/renderer/assets/{book-open-1VNA4GN7.js → book-open-CjMQ2-CP.js} +1 -1
- package/out/renderer/assets/browser-page-Svij-U5I.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-DEA6XqZ-.js → browser-webauthn-prompt-9XHhkc9I.js} +1 -1
- package/out/renderer/assets/{building-2-COzJXz8G.js → building-2-DBR_Itgp.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-2sgIH6MW.js → c4Diagram-VJAJSXHY-xBsmj6Zh.js} +1 -1
- package/out/renderer/assets/channel-j53GQ0U7.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-DxY5FoVK.js → chunk-4BMEZGHF-CF9-FtSa.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-BkPG_PS_.js → chunk-A2AXSNBT-CdBfuMhS.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-CwX46cqu.js → chunk-AEK57VVT-CkmafBOT.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-2XxQOq7M.js → chunk-D6G4REZN-C0PQnMAX.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-aq2FC9Se.js → chunk-RZ5BOZE2-BybOaZxh.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-CA0daOr4.js → chunk-XZIHB7SX-XiQ960SS.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BOtIcaFx.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BOtIcaFx.js +1 -0
- package/out/renderer/assets/clone-CG_qLlUI.js +1 -0
- package/out/renderer/assets/{console-mirror-DsJ4AMz-.js → console-mirror-C-hKgNgn.js} +2 -2
- package/out/renderer/assets/{consoleCapture-DJhULMRM.js → consoleCapture-TS0oVXCE.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-D5JW5sYw.js → conversation-input-sync-BwcOsVjK.js} +256 -256
- package/out/renderer/assets/{dagre-OKDRZEBW-CCEkGBb5.js → dagre-OKDRZEBW-BGSLuM_h.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-BLsujOGl.js → diagram-SSKATNLV--4uXBchD.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-BdWReIg6.js → diagram-VNBRO52H-DDdPP20q.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-DLk7B73M.js → erDiagram-Q7BY3M3F-CN6_fhh5.js} +1 -1
- package/out/renderer/assets/{error-boundary-DI9TecMi.js → error-boundary-BcPKKbP5.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-Dwi1xRJX.js → flowDiagram-4HSFHLVR-Bz2Wai2B.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-C8ucMmzB.js → ganttDiagram-APWFNJXF-WJ9zzEdP.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-jpI8UNjN.js → gitGraphDiagram-7IBYFJ6S-C9Hn2gY9.js} +1 -1
- package/out/renderer/assets/{graph-DOw3Yeio.js → graph-BzNVcrHZ.js} +1 -1
- package/out/renderer/assets/{hash-CDWbW7kn.js → hash-D74BoaKE.js} +1 -1
- package/out/renderer/assets/{heart-Cp6TtrTt.js → heart-BitlL6xv.js} +1 -1
- package/out/renderer/assets/{index-BiJMMhkh.js → index-C4ae8MIc.js} +1 -1
- package/out/renderer/assets/index-D1lZASI6.css +1 -0
- package/out/renderer/assets/{index-B2z9grrU.js → index-D9MeD_9S.js} +171 -171
- package/out/renderer/assets/{index-CPY0nFO2.js → index-DJXsvTrg.js} +1 -1
- package/out/renderer/assets/{index-BThrUQfU.js → index-DKCm4Vhd.js} +1 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-CaSyc-3e.js +2 -0
- package/out/renderer/assets/{installer-23a8JYv3.js → installer-D12iBfVp.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-DMwUX2uA.js → journeyDiagram-U35MCT3I-BS2dZM9P.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-D_NC746J.js → kanban-definition-NDS4AKOZ-BdpVkX81.js} +1 -1
- package/out/renderer/assets/{layout-BCocznw0.js → layout-C3n_m4uD.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-CqAi_r5E.js → legacy-agents-page-nvsx5uoH.js} +1 -1
- package/out/renderer/assets/{library-page-CfM_Rc9v.js → library-page-CTLf85Ok.js} +3 -3
- package/out/renderer/assets/{mermaid.core-DA6cIkM1.js → mermaid.core-B12E4EqI.js} +5 -5
- package/out/renderer/assets/{mesh-page-OofEXbCo.js → mesh-page-DE_mrX94.js} +1 -1
- package/out/renderer/assets/{messages-YfGNuiat.js → messages-DoRCUI0R.js} +9 -9
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-D_EtGzVD.js → mindmap-definition-ALO5MXBD-BXt7_yrM.js} +1 -1
- package/out/renderer/assets/{mini-XOT-xfJP.js → mini-BhEwC0kz.js} +1 -1
- package/out/renderer/assets/{notebook-pen-CF9Nc-n_.js → notebook-pen-CRfFCxXf.js} +1 -1
- package/out/renderer/assets/{notifications-page-DWy-rC2b.js → notifications-page-CanxxkH0.js} +1 -1
- package/out/renderer/assets/{org-access-CczmQbYD.js → org-access-BkIFhKI0.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-CpjJCC6H.js → org-surface-gate-CAZA5kpm.js} +1 -1
- package/out/renderer/assets/{page-header-B4Fs33_S.js → page-header-BnTa4LRQ.js} +1 -1
- package/out/renderer/assets/{path-utils-p1aIOt-j.js → path-utils-BqTfmiT0.js} +4 -4
- package/out/renderer/assets/{pieDiagram-IB7DONF6-B33Cx8fO.js → pieDiagram-IB7DONF6-Bv8qFSgX.js} +1 -1
- package/out/renderer/assets/{project-markdown-CJUpoO5T.js → project-markdown-B-gfCIgA.js} +1 -1
- package/out/renderer/assets/{projects-page-D_oXKgM5.js → projects-page-DLiIT4z_.js} +7 -7
- package/out/renderer/assets/{publication-validation-AhKDHiOm.js → publication-validation-DAe6s6FK.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DWdt8HjB.js → quadrantDiagram-7GDLP6J5-Dh9ldfSS.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-Ca-eTh3L.js → radar-MK3ICKWK-C3QcA8aw.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-CUfgng9w.js → radient-auth-buttons-DYdBNC_-.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-DtkShP8E.js → requirementDiagram-KVF5MWMF-BU5pLB7L.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-DZLfCJg9.js → sankeyDiagram-QLVOVGJD-pkb2fJpW.js} +1 -1
- package/out/renderer/assets/{schedules-page-qgXydSqf.js → schedules-page-C8mqRXQe.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DrmT98zN.js → sequenceDiagram-X6HHIX6F-bJ0MNSq1.js} +1 -1
- package/out/renderer/assets/settings-page-BVO85tKx.js +287 -0
- package/out/renderer/assets/{smartart-CNNJDGet.js → smartart-x0vHjcLD.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-ll16vKCd.js → stateDiagram-DGXRK772-BkfwnsxK.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Y5fvVKXJ.js +1 -0
- package/out/renderer/assets/team-bridge-page-DK2oXcTp.js +36 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-DY1dBCXx.js → timeline-definition-BDJGKUSR-Ciofvs1H.js} +1 -1
- package/out/renderer/assets/{use-default-on-banner-CKV2X33S.js → use-default-on-banner-9GIy0N8O.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-C0XI3fkh.js → use-download-agent-mutation-CDplGp13.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-DDBCHAaV.js → use-session-snapshot-BIGyGyQQ.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-B5aiNSI5.js → xychartDiagram-VJFVF3MP-C4wSLo2w.js} +1 -1
- package/out/renderer/browser-approvals-overlay.html +2 -2
- package/out/renderer/console-capture.html +6 -6
- package/out/renderer/index.html +8 -8
- package/out/renderer/installer.html +5 -5
- package/out/renderer/mini.html +8 -8
- package/package.json +2 -2
- package/out/renderer/assets/browser-page-O-nLXNWr.js +0 -1
- package/out/renderer/assets/channel-Bil6Tup6.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-CavF1Wr6.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-CavF1Wr6.js +0 -1
- package/out/renderer/assets/clone--k_VbBud.js +0 -1
- package/out/renderer/assets/index-DL-hSdfu.css +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-Bp7P0FGP.js +0 -2
- package/out/renderer/assets/settings-page-VdBjjfbE.js +0 -287
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-D-aIl4WR.js +0 -1
- package/out/renderer/assets/team-bridge-page-C-tllBef.js +0 -21
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import{r as l,j as t,c as de,t as ua}from"./index-C4ae8MIc.js";import{o as ga}from"./console-mirror-C-hKgNgn.js";import{d3 as Zt,d4 as ma,d5 as Rn,d6 as De,c8 as _a,a6 as ms,a7 as gn,W as _s,ba as pa,aZ as fa,d7 as ha,d8 as xa,d9 as ya,da as ba,db as ps,dc as mn,a4 as fs,dd as va,de as ka,df as kt,dg as hs,dh as ja,bc as Jt,di as Tn,dj as wa,dk as qe,dl as Et,bJ as _n,dm as pn,cl as jt,bU as Na,dn as xs,dp as Sa,dq as Ma,V as ys,be as Xt,bf as en,aA as Ca,a_ as tn,dr as Ea,ds as Aa,dt as nn,du as Ia,dv as Ra,dw as Ta,dx as bs,dy as La,dz as Oa,dA as Fa,b9 as Da,dB as vs,bd as ks,dC as js,dD as za,dE as $a,dF as Pa,dG as Ka,dH as Ua,dI as Ba,a3 as qa,dJ as Ha,dK as Va,bO as ws,bQ as Ga,dL as Ze,dM as Ln,dN as Qa,dO as Wa,dP as Ya,c3 as Za,dQ as Ja,dR as Xa,ca as ei,dS as ti,dT as ni,dU as si,dV as ai,d2 as zt,dW as ii,dX as ri,az as oi}from"./conversation-input-sync-BwcOsVjK.js";import{i as Ce,u as fn,ak as li,ai as ci,al as di,am as Pe,a as Lt,c as st,an as ui,a3 as gi,ao as mi,ap as _i,aq as pi,ar as fi,d as pe,G as hn,as as hi,q as tt,at as xi,B as Ns,r as yi,C as bi,au as sn,x as et,av as vi,aw as Ss,$ as ki,a0 as ji}from"./path-utils-BqTfmiT0.js";import{dl as Ms,dm as wi,dn as Ni,dp as Cs,dq as Si,c5 as Mi,dr as Ee,N as Ci,S as Es,bs as ot,bt as _e,ds as at,dt as ge,du as $t,dv as Ei,R as Ai,b4 as On,dw as Ii,dx as Ri,dy as Ti,dz as ft,dA as ht,br as Li,bD as Oi,dB as Fi,dC as Di,dD as zi,dE as $i,bh as Fn,dF as Pi,b7 as Ki,bo as Dn,bN as Ui,bp as Bi,bq as qi,dG as Hi,dH as Vi,bg as Gi,dI as Qi}from"./index-D9MeD_9S.js";import{P as Wi}from"./page-header-BnTa4LRQ.js";import{c as F,u as se,B as z,S as ke,Y as As,w as Ve,M as At,N as It,O as Be,A as ae,a as Rt,x as Me,g as ve,Q as xn,R as yn,U as bn,V as vn,W as He,L as Te,K as Le,a5 as Tt,Z as Yi,j as it,i as an,ad as Zi,C as Is,al as zn,T as Rs,D as Ji,d as Xi,e as er,I as tr,f as $n,G as nr,E as sr,ai as ar,a9 as ir}from"./error-boundary-BcPKKbP5.js";import{t as n,L as Pt}from"./messages-DoRCUI0R.js";import{u as rr,a as or,D as lr}from"./use-default-on-banner-9GIy0N8O.js";import{R as cr}from"./radient-auth-buttons-DYdBNC_-.js";import{N as dr}from"./notebook-pen-CRfFCxXf.js";import{B as ur}from"./book-open-CjMQ2-CP.js";import{i as gr,a as $e,b as mr,p as Kt,f as _r}from"./parseISO-CxPiCKvF.js";import{t as pr}from"./en-US-CW_dDnkH.js";/**
|
|
2
|
+
* @license lucide-react v0.507.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const fr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]],hr=F("aperture",fr);/**
|
|
7
|
+
* @license lucide-react v0.507.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const xr=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]],yr=F("atom",xr);/**
|
|
12
|
+
* @license lucide-react v0.507.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const br=[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]],vr=F("audio-waveform",br);/**
|
|
17
|
+
* @license lucide-react v0.507.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const kr=[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]],jr=F("binary",kr);/**
|
|
22
|
+
* @license lucide-react v0.507.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const wr=[["path",{d:"M10 7v10.9",key:"1gynux"}],["path",{d:"M14 6.1V17",key:"116kdf"}],["path",{d:"M16 7V3a1 1 0 0 1 1.707-.707 2.5 2.5 0 0 0 2.152.717 1 1 0 0 1 1.131 1.131 2.5 2.5 0 0 0 .717 2.152A1 1 0 0 1 21 8h-4",key:"gpb6xx"}],["path",{d:"M16.536 7.465a5 5 0 0 0-7.072 0l-2 2a5 5 0 0 0 0 7.07 5 5 0 0 0 7.072 0l2-2a5 5 0 0 0 0-7.07",key:"1tsln4"}],["path",{d:"M8 17v4a1 1 0 0 1-1.707.707 2.5 2.5 0 0 0-2.152-.717 1 1 0 0 1-1.131-1.131 2.5 2.5 0 0 0-.717-2.152A1 1 0 0 1 3 16h4",key:"qexcha"}]],Nr=F("candy",wr);/**
|
|
27
|
+
* @license lucide-react v0.507.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Sr=[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]],Mr=F("car-front",Sr);/**
|
|
32
|
+
* @license lucide-react v0.507.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const Cr=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]],Er=F("cassette-tape",Cr);/**
|
|
37
|
+
* @license lucide-react v0.507.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const Ar=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Ir=F("chart-line",Ar);/**
|
|
42
|
+
* @license lucide-react v0.507.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const Rr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Tr=F("circle-plus",Rr);/**
|
|
47
|
+
* @license lucide-react v0.507.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const Lr=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]],Or=F("circuit-board",Lr);/**
|
|
52
|
+
* @license lucide-react v0.507.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const Fr=[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]],Dr=F("cloud-lightning",Fr);/**
|
|
57
|
+
* @license lucide-react v0.507.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const zr=[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]],$r=F("cloud-moon",zr);/**
|
|
62
|
+
* @license lucide-react v0.507.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const Pr=[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]],Kr=F("cloud-snow",Pr);/**
|
|
67
|
+
* @license lucide-react v0.507.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Ur=[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]],Br=F("cloud-sun",Ur);/**
|
|
72
|
+
* @license lucide-react v0.507.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const qr=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],Hr=F("coffee",qr);/**
|
|
77
|
+
* @license lucide-react v0.507.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const Vr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],Ts=F("contrast",Vr);/**
|
|
82
|
+
* @license lucide-react v0.507.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const Gr=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Qr=F("credit-card",Gr);/**
|
|
87
|
+
* @license lucide-react v0.507.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const Wr=[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]],Yr=F("cup-soda",Wr);/**
|
|
92
|
+
* @license lucide-react v0.507.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const Zr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]],Jr=F("disc-3",Zr);/**
|
|
97
|
+
* @license lucide-react v0.507.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const Xr=[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]],eo=F("droplet",Xr);/**
|
|
102
|
+
* @license lucide-react v0.507.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const to=[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]],no=F("droplets",to);/**
|
|
107
|
+
* @license lucide-react v0.507.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const so=[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]],ao=F("fish",so);/**
|
|
112
|
+
* @license lucide-react v0.507.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const io=[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]],ro=F("flame",io);/**
|
|
117
|
+
* @license lucide-react v0.507.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const oo=[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]],lo=F("flower-2",oo);/**
|
|
122
|
+
* @license lucide-react v0.507.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const co=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]],uo=F("flower",co);/**
|
|
127
|
+
* @license lucide-react v0.507.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const go=[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]],mo=F("ghost",go);/**
|
|
132
|
+
* @license lucide-react v0.507.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const _o=[["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"}]],po=F("github",_o);/**
|
|
137
|
+
* @license lucide-react v0.507.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const fo=[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.23 9.85A3 3 0 0 1 11 8a5 5 0 0 1 5 5 3 3 0 0 1-1.85 2.77l-.92.38A2 2 0 0 0 12 18a4 4 0 0 1-4 4 6 6 0 0 1-6-6 4 4 0 0 1 4-4 2 2 0 0 0 1.85-1.23z",key:"1de1vg"}]],ho=F("guitar",fo);/**
|
|
142
|
+
* @license lucide-react v0.507.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const xo=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]],yo=F("hexagon",xo);/**
|
|
147
|
+
* @license lucide-react v0.507.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const bo=[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]],vo=F("ice-cream-bowl",bo);/**
|
|
152
|
+
* @license lucide-react v0.507.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const ko=[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]],jo=F("joystick",ko);/**
|
|
157
|
+
* @license lucide-react v0.507.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const wo=[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]],No=F("leaf",wo);/**
|
|
162
|
+
* @license lucide-react v0.507.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const So=[["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"}]],Mo=F("lightbulb",So);/**
|
|
167
|
+
* @license lucide-react v0.507.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const Co=[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]],Eo=F("milk",Co);/**
|
|
172
|
+
* @license lucide-react v0.507.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const Ao=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]],Io=F("moon-star",Ao);/**
|
|
177
|
+
* @license lucide-react v0.507.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const Ro=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],To=F("moon",Ro);/**
|
|
182
|
+
* @license lucide-react v0.507.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const Lo=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]],Oo=F("mountain-snow",Lo);/**
|
|
187
|
+
* @license lucide-react v0.507.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/const Fo=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],Do=F("mountain",Fo);/**
|
|
192
|
+
* @license lucide-react v0.507.0 - ISC
|
|
193
|
+
*
|
|
194
|
+
* This source code is licensed under the ISC license.
|
|
195
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
+
*/const zo=[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]],$o=F("radio",zo);/**
|
|
197
|
+
* @license lucide-react v0.507.0 - ISC
|
|
198
|
+
*
|
|
199
|
+
* This source code is licensed under the ISC license.
|
|
200
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
+
*/const Po=[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]],Ko=F("sailboat",Po);/**
|
|
202
|
+
* @license lucide-react v0.507.0 - ISC
|
|
203
|
+
*
|
|
204
|
+
* This source code is licensed under the ISC license.
|
|
205
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
+
*/const Uo=[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]],Bo=F("shirt",Uo);/**
|
|
207
|
+
* @license lucide-react v0.507.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const qo=[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]],Ho=F("skull",qo);/**
|
|
212
|
+
* @license lucide-react v0.507.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const Vo=[["path",{d:"m10 20-1.25-2.5L6 18",key:"18frcb"}],["path",{d:"M10 4 8.75 6.5 6 6",key:"7mghy3"}],["path",{d:"m14 20 1.25-2.5L18 18",key:"1chtki"}],["path",{d:"m14 4 1.25 2.5L18 6",key:"1b4wsy"}],["path",{d:"m17 21-3-6h-4",key:"15hhxa"}],["path",{d:"m17 3-3 6 1.5 3",key:"11697g"}],["path",{d:"M2 12h6.5L10 9",key:"kv9z4n"}],["path",{d:"m20 10-1.5 2 1.5 2",key:"1swlpi"}],["path",{d:"M22 12h-6.5L14 15",key:"1mxi28"}],["path",{d:"m4 10 1.5 2L4 14",key:"k9enpj"}],["path",{d:"m7 21 3-6-1.5-3",key:"j8hb9u"}],["path",{d:"m7 3 3 6h4",key:"1otusx"}]],Go=F("snowflake",Vo);/**
|
|
217
|
+
* @license lucide-react v0.507.0 - ISC
|
|
218
|
+
*
|
|
219
|
+
* This source code is licensed under the ISC license.
|
|
220
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
221
|
+
*/const Qo=[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]],Wo=F("sparkle",Qo);/**
|
|
222
|
+
* @license lucide-react v0.507.0 - ISC
|
|
223
|
+
*
|
|
224
|
+
* This source code is licensed under the ISC license.
|
|
225
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
226
|
+
*/const Yo=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]],Zo=F("sun-dim",Yo);/**
|
|
227
|
+
* @license lucide-react v0.507.0 - ISC
|
|
228
|
+
*
|
|
229
|
+
* This source code is licensed under the ISC license.
|
|
230
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
+
*/const Jo=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Xo=F("sun",Jo);/**
|
|
232
|
+
* @license lucide-react v0.507.0 - ISC
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the ISC license.
|
|
235
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
236
|
+
*/const el=[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],tl=F("sunrise",el);/**
|
|
237
|
+
* @license lucide-react v0.507.0 - ISC
|
|
238
|
+
*
|
|
239
|
+
* This source code is licensed under the ISC license.
|
|
240
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
241
|
+
*/const nl=[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],sl=F("sunset",nl);/**
|
|
242
|
+
* @license lucide-react v0.507.0 - ISC
|
|
243
|
+
*
|
|
244
|
+
* This source code is licensed under the ISC license.
|
|
245
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
246
|
+
*/const al=[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]],il=F("tent",al);/**
|
|
247
|
+
* @license lucide-react v0.507.0 - ISC
|
|
248
|
+
*
|
|
249
|
+
* This source code is licensed under the ISC license.
|
|
250
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
251
|
+
*/const rl=[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]],ol=F("tree-deciduous",rl);/**
|
|
252
|
+
* @license lucide-react v0.507.0 - ISC
|
|
253
|
+
*
|
|
254
|
+
* This source code is licensed under the ISC license.
|
|
255
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
256
|
+
*/const ll=[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]],cl=F("tree-palm",ll);/**
|
|
257
|
+
* @license lucide-react v0.507.0 - ISC
|
|
258
|
+
*
|
|
259
|
+
* This source code is licensed under the ISC license.
|
|
260
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
261
|
+
*/const dl=[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]],ul=F("tree-pine",dl);/**
|
|
262
|
+
* @license lucide-react v0.507.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/const gl=[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]],ml=F("trees",gl);/**
|
|
267
|
+
* @license lucide-react v0.507.0 - ISC
|
|
268
|
+
*
|
|
269
|
+
* This source code is licensed under the ISC license.
|
|
270
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
271
|
+
*/const _l=[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]],pl=F("umbrella",_l);/**
|
|
272
|
+
* @license lucide-react v0.507.0 - ISC
|
|
273
|
+
*
|
|
274
|
+
* This source code is licensed under the ISC license.
|
|
275
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
276
|
+
*/const fl=[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]],hl=F("waves",fl);/**
|
|
277
|
+
* @license lucide-react v0.507.0 - ISC
|
|
278
|
+
*
|
|
279
|
+
* This source code is licensed under the ISC license.
|
|
280
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
281
|
+
*/const xl=[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]],yl=F("wheat",xl);/**
|
|
282
|
+
* @license lucide-react v0.507.0 - ISC
|
|
283
|
+
*
|
|
284
|
+
* This source code is licensed under the ISC license.
|
|
285
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
286
|
+
*/const bl=[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]],vl=F("wind",bl),kl=({appVersion:e=null,slowWaitHintMs:s})=>{se();const a="https://local-operator.com/download",[i,r]=l.useState(!1),o=Ms(i,s??wi),[c,u]=l.useState(!1),[d,m]=l.useState(null),[_,f]=l.useState("info"),[x,h]=l.useState(null),[b,v]=l.useState(null),w=e?.trim()?e.trim():null,L=l.useRef(!1),M=Zt(U=>U.openDetail),T=l.useRef(!1),N=l.useRef(0),C=l.useRef(!1),S=l.useCallback((U,P)=>{T.current=!1,m(U),f(P),u(!0)},[]),B=l.useCallback(U=>{T.current=!0,m(U),f("success"),u(!0)},[]),q=l.useCallback(()=>{T.current&&(T.current=!1,u(!1),m(null))},[]),{clearDeferredUpdate:O}=ma();l.useEffect(()=>{const U=window.api.updater.onUpdateError(g=>{L.current&&g.includes("manually")&&(h({message:n("ui.common.updates.check_for_updates_button.the_server_is_installed_outside_the_app_so_use_the_tool_you_insta"),command:""}),T.current=!1,m(null),f("warning"),u(!0))}),P=window.api.updater.onBackendUpdateDevMode(g=>{L.current&&S(g,"info")}),V=()=>{C.current=!0,q()},K=window.api.updater.onUpdateAvailable(V),H=window.api.updater.onUpdateNpxAvailable(V),X=window.api.updater.onBackendUpdateAvailable(V);return()=>{U(),P(),K(),H(),X()}},[q,S]),l.useEffect(()=>{let U=!1;const P=()=>{window.api.updater.getLastInstallAttempt().then(K=>{U||v(K)}).catch(()=>{})};P();const V=window.api.updater.onUpdateInstallFailed(()=>P());return()=>{U=!0,V()}},[]);const $=async()=>{const U=++N.current;q(),C.current=!1;try{r(!0),L.current=!0,O(De.UI),O(De.BACKEND);const P=await window.api.updater.checkForAllUpdates({manual:!0});if(U!==N.current)return;P.app==="available"&&M(De.UI),P.server==="available"&&M(De.BACKEND),P?.affirmation&&!C.current?B(P.affirmation):q()}catch(P){if(U!==N.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${Ni(P)}`)}finally{U===N.current&&r(!1),setTimeout(()=>{L.current=!1},2e3)}},W=()=>{T.current=!1,u(!1),m(null)};return t.jsxs(t.Fragment,{children:[b&&t.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[t.jsxs("p",{className:"text-body-sm text-ink",children:[n("ui.common.updates.check_for_updates_button.the_last_update_to_version"),b.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),b.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:b.attempts,attemptsText:String(b.attempts)}):"",".",w?n("ui.common.updates.check_for_updates_button.version",{liveversion:String(w)}):null]}),t.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:[n("ui.common.updates.check_for_updates_button.detected")," ",b.detectedAt?new Date(b.detectedAt).toLocaleString():n("ui.common.updates.check_for_updates_button.at_an_unknown_time"),". ",b.detail]}),t.jsx(z,{variant:"outline",size:"sm",className:"mt-2",onClick:()=>void window.api.openExternal(a),children:n("ui.common.updates.check_for_updates_button.download_a_fresh_copy")})]}),t.jsxs(z,{variant:"outline",onClick:()=>void $(),disabled:i,children:[i?t.jsx(ke,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),o&&t.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:n("ui.common.updates.check_for_updates_button.still_checking_a_slow_or_stalled_connection_can_hold_this_for_abo")}),x&&t.jsxs(Rn,{open:c,autoHideDuration:1e4,onClose:W,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:x.message}),x.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:x.command})]}),d&&_!=="danger"&&t.jsx(Rn,{open:c,autoHideDuration:6e3,onClose:W,variant:_,children:d})]})},wt=["system-prompt"],jl=()=>{const{shouldEnableQuery:e}=_a();return Ce({enabled:e({bypassInternetCheck:!0}),queryKey:wt,queryFn:async()=>{try{const a=await ms(gn.baseUrl).config.getSystemPrompt();if(a===null)return null;if(a.status>=400)throw new Error(a.message||n("ui.common.errors.system_prompt_fetch"));return a.result}catch(s){const a=s instanceof Error?s.message:n("ui.common.errors.system_prompt_fetch_unknown");throw _s(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},wl=()=>{const e=fn(),s=ms(gn.baseUrl);return pa({mutationFn:async a=>{try{const i=await s.config.updateSystemPrompt(a);if(i.status>=400)throw new Error(i.message||n("ui.common.errors.system_prompt_update"));return i.result}catch(i){const r=i instanceof Error?i.message:n("ui.common.errors.system_prompt_update_unknown");throw _s(r),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:wt,refetchType:"none"}),e.setQueryData(wt,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:wt,type:"all"}),fa(n("ui.notices.settings.system_prompt_updated"))},onError:a=>{console.error("Error updating system prompt:",a)}})},Ls=({searchRow:e,value:s,label:a,description:i,onChange:r,icon:o,isSaving:c=!1,disabled:u=!1})=>{se();const[d,m]=l.useState(s),_=l.useId(),f=`${_}-label`,x=`${_}-description`,h=async b=>{if(!(c||u)){m(b);try{await r(b)}catch(v){m(!b),console.error("Error toggling setting:",v)}}};return t.jsxs("div",{"data-search-row":e,"data-search-control":e?"":void 0,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("span",{id:f,"data-search-label":"",className:"flex min-h-6 items-center gap-2 text-body text-ink",children:[o&&t.jsx(o,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}),a]}),i&&t.jsx("p",{id:x,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:i})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:c?t.jsx(ke,{size:"md",label:n("ui.common.forms.toggle_setting.saving",{label:a})}):t.jsx(As,{checked:d,onCheckedChange:h,disabled:u,"aria-labelledby":f,"aria-describedby":i?x:void 0})})]})};function Pn(e,s){const a=pr(e,s?.in);if(!gr(a))throw new RangeError("Invalid time value");const i=$e(a.getDate(),2),r=$e(a.getMonth()+1,2),o=a.getFullYear(),c=$e(a.getHours(),2),u=$e(a.getMinutes(),2),d=$e(a.getSeconds(),2);let m="",_="";const f=a.getTimezoneOffset();if(f!==0){const x=Math.abs(f),h=$e(Math.trunc(x/60),2),b=$e(x%60,2);_=`${f<0?"+":"-"}${h}:${b}`}else _="Z";return`${o}-${r}-${i}T${c}:${u}:${d}${m}${_}`}function Nl(e,s,a){return mr(e,-30,a)}var Sl=ha({chartName:"LineChart",GraphicalChild:ps,axisComponents:[{axisType:"xAxis",AxisComp:xa},{axisType:"yAxis",AxisComp:ya}],formatAxisMap:ba});const Ml=["radient","creditBalance"],Cl=e=>{const{user:s,isAuthenticated:a}=mn(),i=s?.account?.tenant_id,r=a&&!!i&&e?.enabled;return Ce({queryKey:[Ml,i],queryFn:async()=>{if(!i)throw new Error(n("ui.common.errors.tenant_missing"));const o=await fs({operation:"credits",tenantId:i});if(!o||typeof o.balance!="number")throw new Error(n("ui.common.errors.credit_balance_invalid"));return o},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},El=["radient","usageRollup"],Al=(e,s)=>{const{user:a,isAuthenticated:i}=mn(),r=a?.account?.tenant_id,o=i&&!!r&&s?.enabled;return Ce({queryKey:[...El,r,e],queryFn:async()=>{if(!r)throw new Error(n("ui.common.errors.tenant_missing"));const c={};for(const[d,m]of Object.entries(e))m!=null&&(c[d]=String(m));const u=await fs({operation:"usage",tenantId:r,query:c});if(!u)throw new Error(n("ui.common.errors.usage_rollup_invalid"));return u},enabled:o,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},Il=e=>e==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),Rl=e=>{switch(e){case"window":return n("ui.settings.appearance.window_glass.material_window");case"menu":return n("ui.settings.appearance.window_glass.material_menu");case"popover":return n("ui.settings.appearance.window_glass.material_popover");case"mica":return n("ui.settings.appearance.window_glass.material_mica");case"acrylic":return n("ui.settings.appearance.window_glass.material_acrylic");case"tabbed":return n("ui.settings.appearance.window_glass.material_tabbed")}},Tl=e=>{switch(e){case"reduced-transparency":return n("ui.settings.appearance.window_glass.unsupported_reduced_transparency");case"windows-too-old":return n("ui.settings.appearance.window_glass.unsupported_windows_too_old");case"windows-unverified":return n("ui.settings.appearance.window_glass.unsupported_windows_unverified");case"linux-compositor-dependent":return n("ui.settings.appearance.window_glass.unsupported_linux");case"hardware-acceleration-disabled":return n("ui.settings.appearance.window_glass.unsupported_acceleration");case"gpu-unavailable":return n("ui.settings.appearance.window_glass.unsupported_gpu");case"backdrop-filter-unavailable":return n("ui.settings.appearance.window_glass.unsupported_backdrop_filter");default:return n("ui.settings.appearance.window_glass.unsupported_other")}},Kn=({label:e,description:s,value:a,onValueChange:i,options:r})=>{const o=l.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:o,className:"flex min-h-6 items-center text-body text-ink",children:e}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:s})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(At,{value:a,onValueChange:i,children:t.jsx(It,{"aria-labelledby":o,children:r.map(c=>t.jsx(Be,{value:c.value,children:c.label},c.value))})})})]})},Ll=({state:e,onChange:s,searchRow:a})=>{se();const i=l.useId(),r=`${i}-description`,[o,c]=l.useState(null),u=l.useRef(!1),d=l.useRef(null),m=e?.settings.intensity??0;if(!e)return null;const _=!e.capability.supported,f=_?Tl(e.capability.reason):null,x=async v=>{if(u.current){d.current=v;return}u.current=!0;try{await s({intensity:v})}finally{u.current=!1;const w=d.current;d.current=null,w!==null&&w!==v?x(w):c(null)}},h=e.settings.enabled,b=o??m;return t.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex flex-col gap-4","data-window-glass":"","data-glass-gate":e.capability.reason,children:[t.jsx(Ve,{content:f,disabled:!_,children:t.jsx("div",{className:_?"opacity-60":void 0,children:t.jsx(Ls,{value:_?!1:h,disabled:_,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async v=>s({enabled:v})},_?"unavailable":"available")})}),f&&t.jsx("p",{"data-glass-unsupported":e.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:f}),e.restartRequired&&t.jsx("output",{className:"block max-w-2xl text-body-sm text-ink","data-glass-restart":"",children:n("ui.settings.appearance.window_glass.restart_needed")}),h&&!_&&t.jsxs(t.Fragment,{children:[t.jsx(Kn,{label:n("ui.settings.appearance.window_glass.coverage_label"),description:n("ui.settings.appearance.window_glass.coverage_description"),value:e.settings.coverage,onValueChange:v=>void s({coverage:v}),options:va.map(v=>({value:v,label:Il(v)}))}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[t.jsx("label",{htmlFor:i,className:"text-body text-ink",children:n("ui.settings.appearance.window_glass.intensity_label")}),t.jsx("span",{"data-glass-readout":"",className:"shrink-0 text-meta text-ink-dim tabular-nums",children:n("ui.settings.appearance.window_glass.intensity_value",{value:String(b)})})]}),t.jsx("p",{id:r,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n("ui.settings.appearance.window_glass.intensity_description")}),t.jsx("input",{id:i,type:"range",min:0,max:100,step:5,value:b,"aria-describedby":r,"aria-valuetext":n("ui.settings.appearance.window_glass.intensity_value",{value:String(b)}),onChange:v=>{const w=Number(v.target.value);c(w),x(w)},style:{"--fill":`${b}%`},className:"mt-3 h-4 w-full cursor-pointer appearance-none bg-transparent bg-center bg-no-repeat bg-[length:100%_6px] bg-[linear-gradient(to_right,var(--color-accent)_0_var(--fill),var(--color-sunken)_var(--fill)_100%)] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-accent [&::-webkit-slider-thumb]:transition-colors [&::-webkit-slider-thumb]:duration-fast [&::-webkit-slider-thumb]:ease-out-quart [&::-webkit-slider-thumb]:hover:bg-accent-hover"}),t.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-meta text-ink-dim",children:[t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_start")}),t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_end")})]})]}),t.jsx(Kn,{label:n("ui.settings.appearance.window_glass.material_label"),description:n("ui.settings.appearance.window_glass.material_description"),value:e.settings.material,onValueChange:v=>void s({material:v}),options:e.capability.materials.map(v=>({value:v,label:Rl(v)}))})]})]})},Ol=new Set(["B","C","D","E","F"]);function Fl(e){const{status:s,refused:a,everVisible:i,checking:r=!1}=e;return s?s.update_required||s.state==="signed_out"?"absent":s.state==="unavailable"?s.error?.code==="messaging_unavailable"?"dark":i?"error":"absent":s.surface_state==="G"?s.error===null||s.error?.code==="messaging_unavailable"?"dark":"error":s.capability<1||s.state!=="ready"||!s.visibility.settings?"absent":s.surface_state&&Ol.has(s.surface_state)?"visible":"absent":r&&i?"visible":a&&i?"error":"absent"}function Dl(e,s){return e!=="absent"}function Je(e,s){if(e.surface_state==="F")return"F";const a=s.endpoint;return a?a.state==="paused"?"D":a.state==="disabled"?"E":"C":"B"}const zl="open_chief_of_staff";function $l(e){const s=e?.delivery_hold;if(!s||s.code!==zl||s.count<=0)return null;const a=s.session||e?.local.session||null;return{count:s.count,sessionId:a}}function Os(e){return li(e)}function Pl(e){return e.target.endpoint_id?{kind:"endpoint",id:e.target.endpoint_id}:{kind:"account",id:e.target.account_id??""}}function rn(e){return e.map((s,a)=>{const i=Pl(s);return{key:`${s.direction}:${s.effect}:${i.kind}:${i.id}:${a}`,direction:s.direction,effect:s.effect,kind:i.kind,id:i.id}})}function on(e,s){return e.filter(i=>i.effect==="deny"||s[i.direction]==="listed_only").map(i=>({direction:i.direction,effect:i.effect,target:i.kind==="endpoint"?{endpoint_id:i.id}:{account_id:i.id}})).sort((i,r)=>i.direction.localeCompare(r.direction)||i.effect.localeCompare(r.effect)||JSON.stringify(i.target).localeCompare(JSON.stringify(r.target)))}function Fs(e){return JSON.stringify(e)}function Kl(e){return e.saving?{disabled:!0,reason:"saving"}:["send","receive"].some(i=>e.modes[i]==="listed_only"&&!e.entries.some(r=>r.direction===i&&r.effect==="allow"))?{disabled:!0,reason:"needs_entry"}:Fs(on(e.entries,e.modes))===e.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const Ul=/^[^\s\p{Cc}]{1,128}$/u;function Bl(e){return e===""?n("ui.agentMessages.settings.allowlist.identifier_empty"):e.length>128?n("ui.agentMessages.settings.allowlist.identifier_long"):Ul.test(e)?null:n("ui.agentMessages.settings.allowlist.identifier_invalid")}function Nt(e){switch(e.code){case"bridge_signin_required":return n("ui.agentMessages.settings.refusal.sign_in");case"bridge_not_available":return n("ui.agentMessages.settings.refusal.not_available");case"bridge_disabled":return n("ui.agentMessages.settings.refusal.disabled");case"rate_limited":return n("ui.agentMessages.settings.refusal.rate_limited");case"invalid_request":return n("ui.agentMessages.settings.refusal.invalid_request");case"consent_version_unknown":return n("ui.agentMessages.settings.consent.changed");case"messaging_unavailable":return n("ui.agentMessages.settings.dark.body");default:return e.message||n("ui.agentMessages.settings.refusal.generic")}}const ql=['[data-agent-messages-action="turn_on_again"]','[role="switch"]','[data-agent-messages-action="enable"]'],Ut="__none__";function Hl({availability:e,status:s,accountId:a,refusal:i=null,api:r=Mi,onRefreshStatus:o,sessions:c=[],onOpenSession:u,focus:d=!1,focusNonce:m}){se();const[_,f]=l.useState({kind:"loading"}),[x,h]=l.useState(0),[b,v]=l.useState(null),[w,L]=l.useState(null),[M,T]=l.useState(s?.local.enabled??!1),[N,C]=l.useState(s?.local.session??""),S=s?.tenant_id??void 0,B=e==="visible",q=s?.account_id??null,O=q!==null&&q===a;l.useEffect(()=>{if(!B)return;let g=!1;return f({kind:"loading"}),L(null),(async()=>{try{const k=await r.settings(S);if(g)return;if(!k){f({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let y=null;if(k.endpoint){if(y=await r.allowlist(k.settings.tenant_id),g)return;if(!y){f({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}f({kind:"ready",settings:k,allowlist:y})}catch(k){if(g)return;f({kind:"error",refusal:Ee(k)})}})(),()=>{g=!0}},[B,a,q,S,x,r]),l.useEffect(()=>{if(!B||_.kind!=="ready"||!_.settings.endpoint||_.allowlist)return;let g=!1;return(async()=>{try{const k=await r.allowlist(_.settings.settings.tenant_id);if(g||!k)return;f(y=>y.kind==="ready"&&!y.allowlist?{...y,allowlist:k}:y)}catch(k){g||L(Ee(k))}})(),()=>{g=!0}},[B,_,r]),l.useEffect(()=>{s&&(T(s.local.enabled),C(s.local.session))},[s]);const $=()=>h(g=>g+1),W=_.kind==="ready"?_.settings:null,U=rr(s,W,q),P=or({api:r,accountId:O?q:null,tenantId:W?.settings.tenant_id??null,markerTenantId:s?.tenant_id??null,onSettings:g=>f(k=>k.kind==="ready"?{...k,settings:g}:k),onChanged:()=>o(!0)}),V=l.useRef(null),K=l.useRef(!1),H=l.useRef(m);if(l.useEffect(()=>{m!==H.current&&(H.current=m,K.current=!1)},[m]),l.useEffect(()=>{if(!d){K.current=!1;return}if(K.current||_.kind!=="ready"||b!==null)return;const g=V.current,k=ql.map(y=>g?.querySelector(`${y}:not(:disabled)`)).find(y=>y!=null);k&&(k.focus(),K.current=!0)},[d,m,_,b,s]),e==="absent")return null;if(e==="dark")return t.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.dark.title")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.body")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.nothing_enabled")})]});if(e==="error")return t.jsx("div",{"data-agent-messages-section":"",children:t.jsxs(ae,{variant:"warning",children:[t.jsx(Rt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Me,{children:[i?Nt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(z,{className:"mt-3",variant:"secondary",onClick:()=>{$(),o(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})});if(!s||!a)return null;const X=$l(s);return t.jsxs("div",{ref:V,"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[X&&t.jsx(Gl,{count:X.count,onMessage:X.sessionId&&u?()=>u(X.sessionId):void 0}),U&&t.jsx(lr,{consentText:ci(s,W),pending:P.pending,failure:P.failure,onTurnOff:()=>void P.turnOff(),onDismiss:()=>void P.dismiss()}),w&&t.jsx(ae,{variant:"warning",children:t.jsx(Me,{children:Nt(w)})}),_.kind==="loading"&&t.jsx(Vl,{}),_.kind==="error"&&t.jsxs(ae,{variant:"warning",children:[t.jsx(Rt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Me,{children:[_.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:Nt(_.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(z,{className:"mt-3",variant:"secondary",onClick:$,children:n("ui.agentMessages.settings.error.retry")})]})]}),_.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(Yl,{state:Je(s,_.settings),status:s,settings:_.settings,accountId:q??a,accountMatches:O,api:r,pending:b,localEnabled:M,onActionRefusal:L,onSettings:g=>f(k=>k.kind==="ready"?{...k,settings:g}:k),onLocalEnabled:T,onRefreshStatus:o,setPending:v}),t.jsx(Jl,{value:N,sessions:c,pending:b==="session",disabled:b!==null,onSave:async g=>{v("session"),L(null);try{await r.localSetting("team_bridge.session",g),C(g),await o(!0)}catch(k){L(Ee(k))}finally{v(null)}}}),_.allowlist&&(Je(s,_.settings)==="C"||Je(s,_.settings)==="D"||Je(s,_.settings)==="F")&&t.jsx(Xl,{allowlist:_.allowlist,accountId:q??a,accountMatches:O,readOnly:s.read_only===!0&&Je(s,_.settings)==="F",pending:b!==null,onSaving:g=>v(g?"allowlist":null),onRefusal:L,onSaved:g=>f(k=>k.kind==="ready"?{...k,allowlist:g}:k),api:r},_.allowlist.view.tenant_id??"tenant")]})]})}function Vl(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(ve,{className:"h-5 w-40"}),t.jsx(ve,{className:"h-4 w-full max-w-xl"}),t.jsx(ve,{className:"h-9 w-36"}),t.jsx(ve,{className:"h-4 w-64"})]})}const Gl=({count:e,onMessage:s})=>t.jsx("output",{className:"block","data-agent-messages-hold":"open_chief_of_staff",children:t.jsx(ae,{variant:"info",className:de(Ci,"border-transparent"),children:t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-3",children:[t.jsx("p",{className:"min-w-0 flex-1 text-body-sm text-ink",children:s?n("ui.agentMessages.settings.hold.chief_of_staff",{count:e}):n("ui.agentMessages.settings.hold.chief_of_staff_unlinked",{count:e})}),s&&t.jsx(z,{variant:"ghost",size:"sm",className:"shrink-0 text-ink",onClick:s,children:n("ui.agentMessages.settings.hold.open")})]})})}),Un=({text:e})=>t.jsx("div",{className:"rounded-md border border-hairline bg-sunken p-3",children:t.jsx("p",{className:"whitespace-pre-wrap text-body-sm text-ink-muted",children:e})}),Ds={B:"ui.agentMessages.settings.state.b_title",C:"ui.agentMessages.settings.state.c_title",D:"ui.agentMessages.settings.state.d_title",E:"ui.agentMessages.settings.state.e_title",F:"ui.agentMessages.settings.state.f_title"},zs={B:"ui.agentMessages.settings.state.b_body",C:"ui.agentMessages.settings.state.c_body",D:"ui.agentMessages.settings.state.d_body",E:"ui.agentMessages.settings.state.e_body",F:"ui.agentMessages.settings.state.f_body"};function Ql(e){return e==="B"?"ui.agentMessages.settings.default_on.b_title":Ds[e]}function Wl(e){return e==="B"?"ui.agentMessages.settings.default_on.b_body":e==="E"?"ui.agentMessages.settings.default_on.e_body":zs[e]}const Yl=({state:e,status:s,settings:a,accountId:i,accountMatches:r,api:o,pending:c,localEnabled:u,onActionRefusal:d,onSettings:m,onLocalEnabled:_,onRefreshStatus:f,setPending:x})=>{const h=Os(s),b=a.settings.tenant_id,v=c!==null||!r,w=di(s);async function L(S,B={}){if(!r)return null;x(S),d(null);try{const q=await o.updateSettings({expected_account_id:i,tenant_id:b,state:S,...B});if(m(q),S==="disabled"&&!w)try{await o.localSetting("team_bridge.enabled",!1),_(!1)}catch(O){d(Ee(O))}return q}catch(q){const O=Ee(q);return d(O),O.code==="consent_version_unknown"&&await f(!0),null}finally{x(null)}}async function M(){if(!(!h||!r||!await L("active",{consent_version:h.version,consented_via:"settings"}))){x("local");try{await o.localSetting("team_bridge.enabled",!0),_(!0),await f(!0)}catch(B){d(Ee(B))}finally{x(null)}}}if(e==="F")return t.jsxs("div",{"data-agent-messages-state":e,className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"rounded-md border border-hairline bg-sunken p-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:s.state_note?.trim()?s.state_note:n("ui.agentMessages.settings.state.turned_off_title")}),t.jsx("p",{className:"mt-1 text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.turned_off_org")})]}),t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.read_only")}),t.jsx(Bt,{settings:a,status:s,readOnly:!0}),t.jsx(qt,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:v,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async S=>{x("local"),d(null);try{await o.localSetting("team_bridge.enabled",S),_(S),await f(!0)}catch(B){d(Ee(B))}finally{x(null)}}})]});const T=a.endpoint?.label?.trim(),N=a.endpoint?.consent??null,C=N!==null&&!N.current;return t.jsxs("div",{"data-agent-messages-state":e,className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n(w?Ql(e):Ds[e])}),T&&t.jsx("span",{className:"text-body-sm text-ink-muted",children:T})]}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n(w?Wl(e):zs[e])}),w&&e==="E"&&t.jsxs("div",{className:"flex flex-col gap-3",children:[h?t.jsx(Un,{text:h.text}):t.jsx(ae,{variant:"warning",children:t.jsx(Me,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsx("div",{className:"flex flex-wrap items-center gap-3",children:t.jsx(z,{"data-agent-messages-action":"turn_on_again","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void M(),disabled:v||!h,children:n("ui.agentMessages.settings.action.turn_on_again")})})]}),!w&&(e==="B"||e==="E")&&t.jsxs("div",{className:"flex flex-col gap-3",children:[h?t.jsx(Un,{text:h.text}):t.jsx(ae,{variant:"warning",children:t.jsx(Me,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(z,{"data-agent-messages-action":"enable","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void M(),disabled:v||!h,children:e==="B"?n("ui.agentMessages.settings.action.enable"):n("ui.agentMessages.settings.action.enable_again")}),t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.off_by_default")})]})]}),e==="C"&&a.endpoint&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(z,{"data-agent-messages-action":"pause",variant:"secondary",disabled:v,onClick:()=>void L("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(z,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:v,onClick:()=>void L("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(Bt,{settings:a,status:s}),C&&!w&&t.jsx(Bn,{onRenew:()=>void M(),disabled:v||!h}),t.jsx(qt,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:v,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async S=>{x("local"),d(null);try{await o.localSetting("team_bridge.enabled",S),_(S),await f(!0)}catch(B){d(Ee(B))}finally{x(null)}}})]}),e==="D"&&a.endpoint&&t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(z,{"data-agent-messages-action":"resume",disabled:v||a.settings.consent_required&&h===null,onClick:()=>void L("active",a.settings.consent_required&&h?{consent_version:h.version,consented_via:"settings"}:{}),children:n("ui.agentMessages.settings.action.resume")}),t.jsx(z,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:v,onClick:()=>void L("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),a.settings.consent_required&&!h&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.unavailable")}),t.jsx(Bt,{settings:a,status:s}),C&&!w&&t.jsx(Bn,{onRenew:()=>void M(),disabled:v||!h}),t.jsx(qt,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:v,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async S=>{x("local"),d(null);try{await o.localSetting("team_bridge.enabled",S),_(S),await f(!0)}catch(B){d(Ee(B))}finally{x(null)}}})]})]})},Bn=({onRenew:e,disabled:s})=>t.jsx(ae,{variant:"warning",children:t.jsxs(Me,{children:[n("ui.agentMessages.settings.consent.renew"),t.jsx(z,{"data-agent-messages-action":"enable",className:"mt-3",variant:"secondary",disabled:s,onClick:e,children:n("ui.agentMessages.settings.action.enable_again")})]})});function Zl(e){switch(e){case"dialog":return n("ui.agentMessages.settings.consent.via_dialog");case"settings":return n("ui.agentMessages.settings.consent.via_settings");case"default_on":return n("ui.agentMessages.settings.consent.via_default_on");default:return e}}const Bt=({settings:e,status:s,readOnly:a=!1})=>{const i=e.endpoint?.consent??null,r=Os(s);return i?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs(ot,{children:[t.jsx(_e,{label:n("ui.agentMessages.settings.consent.version"),value:i.version}),t.jsx(_e,{label:n("ui.agentMessages.settings.consent.via"),value:Zl(i.consented_via)}),t.jsx(_e,{label:n("ui.agentMessages.settings.consent.at"),value:i.consented_at})]}),!a&&r&&t.jsxs("details",{children:[t.jsx("summary",{className:"cursor-pointer text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.show")}),t.jsx("p",{className:"mt-2 whitespace-pre-wrap text-body-sm text-ink-muted",children:r.text})]})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.no_record")})},qt=({value:e,disabled:s,description:a,onChange:i,searchRow:r,searchTerms:o})=>{const c=l.useId();return t.jsxs("div",{"data-search-row":r,"data-search-control":r?"":void 0,"data-search-terms":o,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{id:c,className:"text-body-sm text-ink",children:n("ui.agentMessages.settings.local.label")}),t.jsx("p",{className:"mt-0.5 text-meta text-ink-dim",children:a})]}),t.jsx(As,{"aria-labelledby":c,checked:e,disabled:s,onCheckedChange:u=>void i(u)})]})},Jl=({value:e,sessions:s,pending:a,disabled:i,onSave:r})=>{const o=s.some(c=>c.session_id===e);return t.jsxs("div",{"data-search-row":"agent-messages.session","data-search-control":!0,"data-search-terms":"team bridge team_bridge session",className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.session.title")}),t.jsx("p",{className:"max-w-2xl text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.help")}),t.jsxs(xn,{value:e===""?Ut:e,disabled:i,onValueChange:c=>void r(c===Ut?"":c),children:[t.jsx(yn,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(bn,{})}),t.jsxs(vn,{children:[t.jsx(He,{value:Ut,children:n("ui.agentMessages.settings.session.none")}),s.map(c=>t.jsx(He,{value:c.session_id,children:c.title?.trim()||c.session_id},c.session_id)),e!==""&&!o&&t.jsx(He,{value:e,children:e})]})]}),e!==""&&!o&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.unavailable")}),a&&t.jsx("p",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})},Xl=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:r,api:o,onSaving:c,onRefusal:u,onSaved:d})=>{const[m,_]=l.useState(()=>rn(e.allowlist.entries)),[f,x]=l.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),h=r||i||!a,b=Fs(on(ec(e),tc(e))),v=Kl({entries:m,modes:f,savedSignature:b,saving:r}),w=l.useRef(0),L=N=>_(C=>[...C,{...N,key:`${N.direction}:${N.effect}:${w.current++}`}]),M=N=>_(C=>C.filter(S=>S.key!==N)),T=async()=>{if(!h){c(!0),u(null);try{const N=await o.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:on(m,f)}),C=rn(N.allowlist.entries);_(C),x({send:N.view.directions.send.mode,receive:N.view.directions.receive.mode}),d(N)}catch(N){u(Ee(N))}finally{c(!1)}}};return t.jsxs("div",{"data-agent-messages-allowlist":"",className:"flex flex-col gap-5",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.allowlist.title")}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.description")})]}),t.jsx(qn,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:f.receive,cues:e.view.cues,entries:m.filter(N=>N.direction==="receive"),disabled:h,onMode:N=>x(C=>({...C,receive:N})),onAdd:N=>L({...N,direction:"receive"}),onRemove:M}),t.jsx(qn,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:f.send,cues:e.view.cues,entries:m.filter(N=>N.direction==="send"),disabled:h,onMode:N=>x(C=>({...C,send:N})),onAdd:N=>L({...N,direction:"send"}),onRemove:M}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(z,{onClick:()=>void T(),disabled:v.disabled||h,children:[t.jsx(Es,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),v.disabled&&v.reason==="needs_entry"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),v.disabled&&v.reason==="unchanged"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.unchanged")}),i&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.read_only")}),r&&t.jsx("span",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})]})};function ec(e){return rn(e.allowlist.entries)}function tc(e){return{send:e.view.directions.send.mode,receive:e.view.directions.receive.mode}}const qn=({direction:e,title:s,mode:a,cues:i,entries:r,disabled:o,onMode:c,onAdd:u,onRemove:d})=>{const m=r.filter(f=>f.effect==="allow"),_=r.filter(f=>f.effect==="deny");return t.jsxs("fieldset",{"data-agent-messages-direction":e,"data-agent-messages-level":a,className:"flex flex-col gap-3 rounded-md border border-hairline p-3",children:[t.jsx("legend",{className:"px-1 text-body-sm text-ink",children:s}),t.jsx(nc,{mode:a,disabled:o,onMode:c}),t.jsxs("div",{className:"flex flex-col gap-1 text-meta text-ink-dim",children:[i.allow_entry_switches_direction_to_listed_only&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_listed_only")}),i.removing_allow_does_not_stop_open_thread&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_remove")}),i.deny_stops_pair_both_directions&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_deny")})]}),a==="listed_only"&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.allowed_heading")}),m.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.allowed_empty")}),m.map(f=>t.jsx(Hn,{entry:f,disabled:o,onRemove:()=>d(f.key)},f.key)),t.jsx(Vn,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:o,onAdd:f=>u({...f,effect:"allow"})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.blocked_heading")}),_.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),_.map(f=>t.jsx(Hn,{entry:f,disabled:o,onRemove:()=>d(f.key)},f.key)),t.jsx(Vn,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:o,onAdd:f=>u({...f,effect:"deny"})})]})]})},nc=({mode:e,disabled:s,onMode:a})=>{const i=[{value:"class_default",label:n("ui.agentMessages.settings.allowlist.anyone")},{value:"listed_only",label:n("ui.agentMessages.settings.allowlist.listed_only")}];return t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.agentMessages.settings.allowlist.level")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:i.map(r=>t.jsx(z,{variant:"ghost",size:"sm","aria-pressed":e===r.value,disabled:s,onClick:()=>a(r.value),className:de(e===r.value&&"bg-surface text-ink hover:bg-surface"),children:r.label},r.value))})]})},Hn=({entry:e,disabled:s,onRemove:a})=>t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded border border-hairline px-2 py-1",children:[t.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[t.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:e.kind==="endpoint"?n("ui.agentMessages.settings.allowlist.agent_id"):n("ui.agentMessages.settings.allowlist.person_id")}),t.jsx("span",{className:"break-all font-mono text-body-sm text-ink",children:e.id})]}),t.jsx(z,{variant:"secondary",size:"sm",disabled:s,"aria-label":`${n("ui.agentMessages.settings.allowlist.remove")} ${e.id}`,onClick:a,children:n("ui.agentMessages.settings.allowlist.remove")})]}),Vn=({label:e,disabled:s,onAdd:a})=>{const[i,r]=l.useState("endpoint"),[o,c]=l.useState(""),[u,d]=l.useState(null),m=l.useId(),_=`${m}-help`,f=()=>{const x=Bl(o.trim());d(x),!x&&(a({kind:i,id:o.trim()}),c(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Te,{htmlFor:m,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(xn,{value:i,disabled:s,onValueChange:x=>r(x),children:[t.jsx(yn,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(bn,{})}),t.jsxs(vn,{children:[t.jsx(He,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(He,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(Le,{id:m,"aria-describedby":_,className:"max-w-xs",value:o,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),f())}}),t.jsx(z,{variant:"secondary",size:"sm",disabled:s,onClick:f,children:n("ui.agentMessages.settings.allowlist.add")})]}),t.jsx("p",{id:_,className:"text-meta text-ink-dim",children:i==="endpoint"?n("ui.agentMessages.settings.allowlist.identifier_help_agent"):n("ui.agentMessages.settings.allowlist.identifier_help_person")}),u&&t.jsx("p",{className:"text-meta text-danger",children:u})]})};function sc(){const{snapshot:e}=Cs(),[s,a]=l.useState(!1),i=Fl({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return l.useEffect(()=>{i!=="absent"&&a(!0)},[i]),l.useEffect(()=>{Si()},[]),i}function kn(e){const s=a=>typeof a=="string"?at(a):at((a??[]).join(" "));return{label:s(e.label),synonym:s(e.synonym),key:s(e.key),choice:s(e.choice),section:s(e.section),description:s(e.description)}}function ac(e){const s=new Map;for(const a of e??[])s.set(a.name,{label:a.title||a.name,folded:at([a.title,a.name].join(" "))});return s}function ic(e,s={}){if(!e)return[];const{startOrder:a=0,sections:i=[]}=s,r=ac(e.sections),o=new Map(i.map(c=>[c.id,c.label]));return e.settings.map((c,u)=>{const d=r.get(c.section),m=kt(c.key,"backend");return{id:`setting:${c.key}`,source:"registry",label:c.label||c.key,description:c.help??"",sectionId:m,sectionLabel:o.get(m)??"",detail:d?.label??c.section,order:a+u,settingKey:c.key,fields:kn({label:c.label,synonym:c.synonyms??[],key:c.key,choice:(c.choices??[]).flatMap(_=>[_.label,_.description??""]),section:d?.folded??c.section,description:c.help})}})}function rc(e,s=0){return e.map((a,i)=>({id:`section:${a.id}`,source:"section",label:a.label,sectionId:a.id,sectionLabel:a.label,order:s+i,fields:kn({label:a.label})}))}function oc(e){const s=e.getAttribute("data-search-label");if(s?.trim())return s.trim();const a=e.querySelector("[data-search-label]");if(a?.textContent?.trim())return a.textContent.trim();const i=e.querySelector("h2, h3, h4, legend");if(i?.textContent?.trim())return i.textContent.trim();const r=e.getAttribute("aria-label");return r?.trim()?r.trim():((e.firstElementChild??e).textContent??"").trim()}function lc(e){const s=e.replace(/\s+/g," ").trim();if(s.length<=80)return s;const a=s.slice(0,80),i=a.lastIndexOf(" ");return`${(i>40?a.slice(0,i):a).trimEnd()}…`}function cc(e){return e.closest("[data-search-section]")}function dc(e,s){const a=(e.textContent??"").trim();if(!s)return a;const i=a.indexOf(s);return i<0?a:`${a.slice(0,i)} ${a.slice(i+s.length)}`.trim()}function uc(e,s=0){return Array.from(e.querySelectorAll("[data-search-row]")).map((i,r)=>{const o=cc(i),c=o?.getAttribute("data-search-section")??"",d=(o?.getAttribute("data-search-section-label")?.trim()??"")||o?.querySelector("[data-search-section-label], h2")?.textContent?.trim()||"",m=oc(i),_=i.getAttribute("data-search-terms")??"",f=dc(i,m);return{id:`page:${i.getAttribute("data-search-row")??r}`,source:"page",label:lc(m),sectionId:c,sectionLabel:d,order:s+r,fields:kn({label:m,synonym:_,section:[d,c],description:f})}})}function gc(e){const s=ic(e.registry,{startOrder:0,sections:e.sections}).filter(i=>!(i.settingKey&&i.settingKey in ka)),a=[...e.rendered??[]].map((i,r)=>({...i,order:s.length+r}));return[...s,...a,...rc(e.sections??[],s.length+a.length)]}const mc=12,Gn="input, textarea, select, button, [role='switch'], [role='tab'], [role='combobox'], [tabindex]";function _c(e,s){return e.querySelector(`[data-search-row="${CSS.escape(s)}"]`)}function pc(e){const a=(e.matches("[data-search-control]")?e:null)??e.querySelector("[data-search-control]");return a?a.matches(Gn)?a:a.querySelector(Gn)??a:e}function $s(e){return e.isConnected&&e.closest("[hidden]")===null}function fc(e,s,a={}){const i=a.frames??mc,r=a.paint??hs;return new Promise(o=>{let c=0;const u=()=>{const d=_c(e,s);if(d&&$s(d)){const m=pc(d);m===d&&(d.tabIndex=-1),m.scrollIntoView({block:"center"}),m.focus(),r(d),o("landed");return}if(c+=1,c>=i){o("missing");return}requestAnimationFrame(u)};requestAnimationFrame(u)})}function hc(e,s,a={}){const i=e.querySelector(`[data-search-section="${CSS.escape(s)}"]`);return!i||!$s(i)?"missing":(i.scrollIntoView({block:"start"}),i.tabIndex<0&&(i.tabIndex=-1),i.focus(),(a.paint??hs)(i),"landed")}const Qn={get[De.UI](){return n("ui.settings.updates.update_following.application_updates")},get[De.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},xt={patch:{get label(){return n("ui.settings.updates.update_following.patch_label")},get description(){return n("ui.settings.updates.update_following.patch_help")}},minor:{get label(){return n("ui.settings.updates.update_following.minor_label")},get description(){return n("ui.settings.updates.update_following.minor_help")}},major:{get label(){return n("ui.settings.updates.update_following.major_label")},get description(){return n("ui.settings.updates.update_following.major_help")}}},Wn=({type:e})=>{se();const s=Zt(i=>i.followed[e]),a=Zt(i=>i.setFollowedSegment);return t.jsxs("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-body-sm text-ink",children:Qn[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:xt[s].description})]}),t.jsxs(xn,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(yn,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:Qn[e],choice:xt[s].label}),className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(bn,{})}),t.jsx(vn,{children:ja.map(i=>t.jsx(He,{value:i,title:xt[i].description,children:xt[i].label},i))})]})]})},xc=()=>(se(),t.jsxs("div",{className:de("flex flex-col gap-3"),children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.updates.update_following.update_notifications")}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.updates.update_following.how_much_of_a_version_change_shows_the_update_notice_at_the_botto")})]}),t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(Wn,{type:De.UI}),t.jsx(Wn,{type:De.BACKEND})]})]})),yc=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(xc,{}),t.jsx(kl,{appVersion:e})]}),bc=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}},vc=()=>{se();const[e,s]=l.useState(null),[a,i]=l.useState({value:"Loading...",detail:null,degraded:!1}),[r,o]=l.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});l.useEffect(()=>{let u=!0;const d=h=>{if(!u)return;const b=bc(h.url);if(h.state==="connecting"){i({value:"Loading...",detail:null,degraded:!1});return}if(h.state==="detached"){i({value:"Not connected",detail:h.detail||null,degraded:!1});return}if(h.state==="wedged"){i({value:"Not attached",detail:h.detail||null,degraded:!1});return}const v=h.version||"Version unknown";i({value:b?`${v} · ${b}`:v,detail:h.detail||null,degraded:h.state==="degraded"})};let m=!1;const _=window.api?.backend?.onStatusChange(h=>{m=!0,d(h)}),f=async()=>{try{const[h,b]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);u&&(s(h),o(b))}catch(h){console.error("Error fetching app information:",h)}},x=async()=>{try{const h=window.api?.backend;if(h){const w=await h.getStatus();m||d(w);return}const b=await Tn.healthCheck(gn.baseUrl),v=Tn.getServerVersion(b);u&&i({value:v,detail:null,degraded:!1})}catch(h){console.error("Error fetching server version:",h),u&&i({value:"Unavailable",detail:null,degraded:!1})}};return f(),x(),()=>{u=!1,_?.()}},[]);const c=(u,d,m,_={})=>t.jsx(_e,{label:t.jsx(Ve,{content:m,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(Tt,{size:12,className:"shrink-0"}),u]})}),valueClassName:_.valueClassName,value:t.jsxs(t.Fragment,{children:[_.valueTooltip?t.jsx(Ve,{content:_.valueTooltip,children:t.jsx("span",{"data-backend-version":_.valueHoverTarget?"":void 0,children:d})}):d,_.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:_.statusNote}):null]})});return t.jsx(ge,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:Jt,description:n("ui.settings.updates.app_updates_section.check_for_updates_and_view_information_about_your_local_operator_"),dataTourTag:"settings-app-updates-section",children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs(ot,{children:[c(n("ui.settings.updates.app_updates_section.application_version"),e??n("ui.settings.updates.app_updates_section.state_loading"),n("ui.settings.updates.app_updates_section.the_version_of_the_local_operator_user_interface_application")),c(n("ui.settings.updates.app_updates_section.server_version"),$t(a.value),n("ui.settings.updates.app_updates_section.the_version_of_the_local_operator_api_server_backend_and_the_addr"),{valueTooltip:a.detail,valueHoverTarget:!0,statusNote:a.degraded?n("ui.settings.updates.app_updates_section.not_answering"):void 0,valueClassName:a.degraded?"text-ink-muted":void 0}),c(n("ui.settings.updates.app_updates_section.platform"),`${r.platform} (${r.arch})`,n("ui.settings.updates.app_updates_section.the_operating_system_and_architecture_your_application_is_running")),c(n("ui.settings.updates.app_updates_section.node_js_version"),$t(r.nodeVersion),n("ui.settings.updates.app_updates_section.the_javascript_runtime_environment_version")),c(n("ui.settings.updates.app_updates_section.electron_version"),$t(r.electronVersion),n("ui.settings.updates.app_updates_section.the_framework_version_enabling_this_desktop_application"))]}),t.jsx(yc,{appVersion:e})]})})};function Ps(e){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return e.resolvedLevel&&e.stored.trim()===""&&jn(e.resolvedLevel,e.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:Pe(e.resolvedLevel)})),[s,...Ks(e.ladder,e.storable)]}function jn(e,s){const a=e.trim().toLowerCase();return a===""?null:s.find(i=>i.trim().toLowerCase()===a)??null}function Ks(e,s){return e.flatMap(a=>{const i=jn(a,s);return i===null?[]:[{id:i,name:Pe(a)}]})}function kc(e,s){const a=e.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function jc(e){if(!e.resolved||e.ladder===null)return null;const s=e.stored.trim().toLowerCase();if(s===""||e.ladder.some(r=>r.toLowerCase()===s))return null;const a=(e.resolvedLevel??"").trim(),i=a===""?"":jn(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const St="\0unread";function yt(e){return e.trim()===""?"":St}function wc(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return Fe("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return Fe("no-model",n("ui.settings.model.default_effort.no_model"),St);if(e.settings==="loading")return Fe("settings-loading",n("ui.settings.model.default_effort.settings_loading"),St);if(e.settings==="error")return Fe("settings-error",n("ui.settings.model.default_effort.settings_error"),St);if(e.preview==="loading")return Fe("loading",n("ui.settings.model.default_effort.loading"),yt(e.stored));if(e.preview==="error")return Fe("error",n("ui.settings.model.default_effort.error"),yt(e.stored));if(e.ladder===null||!e.specResolved)return Fe("unresolved",n("ui.settings.model.default_effort.unresolved"),yt(e.stored));const s=e.ladder;if(s.length===0)return Fe("empty",n("ui.settings.model.default_effort.empty"),yt(e.stored));const a=Ks(s,e.storable);if(a.length===0){const i=Pe(s[0]),r=s.length===1&&s[0].trim().toLowerCase()==="auto";return{kind:"one-level",options:[{id:"",name:i}],selectedId:"",disabled:!0,helper:r?n("ui.settings.model.default_effort.one_level_sentinel"):n("ui.settings.model.default_effort.one_level",{level:i})}}if(s.length===1){const[i]=a;return{kind:"one-level",options:[i],selectedId:i.id,disabled:!0,helper:n("ui.settings.model.default_effort.one_level",{level:i.name})}}return{kind:"ready",options:Ps({ladder:s,resolvedLevel:e.resolvedLevel,stored:e.stored,storable:e.storable}),selectedId:kc(e.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function Fe(e,s,a=""){return{kind:e,options:Ps({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const Nc=({hosting:e,modelName:s,focus:a=!1,focusNonce:i})=>{se();const r=Lt(),o=st(r.data,"draft_preview"),c=wa(),u=e!==""&&s!=="",d=Ce({queryKey:Et.all,queryFn:()=>pe({op:"settings.list"}),enabled:o,staleTime:1e4}),m=d.data?.settings.find(re=>re.key===qe),_=typeof m?.value=="string"?m.value:"",f=(m?.choices??[]).map(re=>re.value).filter(re=>typeof re=="string"),x={cwd:c??"",model:u?{provider:e,model_id:s,reasoning_effort:null}:null},h=d.isSuccess?_:null,b=Ce({...gi(x,st(r.data,"draft_fast")),queryKey:[...ui(x),"model_effort",h],enabled:o&&!!c&&u}),v=b.isSuccess&&!b.isPlaceholderData,w=v?mi(b.data?.snapshot,null).effort:null,L=v&&Array.isArray(w?.reasoning_efforts)?_i(w):null,M=v?pi(w):null,T=w!==null&&!fi(w),[N,C]=l.useState(!1),[S,B]=l.useState(!1),[q,O]=l.useState(null),[$,W]=l.useState(null),U=`${e}\0${s}`,P=fn(),V=l.useRef(null),K=l.useRef(!1),H=l.useRef(i);l.useEffect(()=>{i!==H.current&&(H.current=i,K.current=!1)},[i]);const X=l.useCallback(async(re,fe)=>{C(!0),O(re),B(!1),fe===null&&W(null);try{await pe({op:"settings.edit",key:qe,value:re}),await P.invalidateQueries({queryKey:Et.all}),fe!==null&&W(fe)}catch{B(!0)}finally{C(!1),O(null)}},[P]),g=typeof w?.display_name=="string"&&w.display_name.trim()||s,k=wc({supported:o,hasHome:!!c,hasModel:u,settings:d.isError?"error":d.isSuccess?"ready":"loading",preview:b.isError?"error":v?"ready":"loading",ladder:L,specResolved:T,stored:_,resolvedLevel:M,storable:f}),y=jc({stored:_,ladder:L,resolvedLevel:M,resolved:v&&T&&d.isSuccess,storable:f}),E=l.useRef(null);l.useEffect(()=>{if(y===null||N)return;const re=`${e}\0${s}\0${_}\0${y}`;if(E.current===re)return;E.current=re;const fe=y===""?n("ui.settings.model.default_effort.clamped_unset",{level:Pe(_),model:g}):n("ui.settings.model.default_effort.clamped",{level:Pe(_),model:g,resolved:Pe(y)});X(y,{text:fe,model:U})},[y,_,N,X,e,s,g,U]);const J=l.useMemo(()=>k.options.map(Sc),[k.options]);l.useEffect(()=>{if(!a){K.current=!1;return}k.disabled||K.current||(V.current?.querySelector("[role=combobox]")?.focus(),K.current=!0)},[a,i,k.disabled]);const Y=q??k.selectedId,te=J.find(re=>re.id===Y)??(q!==null?{id:q,name:Pe(q)}:null),ne=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:k.helper}),S&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:$?.model===U?$.text:""})]});return k.kind==="unsupported"?null:t.jsx("div",{ref:V,"data-setting-key":qe,children:t.jsx(Yi,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(Ei,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:J,selected:te,onSelect:re=>{X(re.id,null)},helperText:ne,busy:N,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:k.disabled||N})})};function Sc(e){return{id:e.id,name:e.name,description:e.description}}const Mc=e=>e.replace(/[\p{Co}\p{Cc}]/gu," ").replace(/\s+/g," ").trim(),Us=(e,s)=>{const a=s.trim().toLocaleLowerCase();return a?e.filter(i=>`${i.title} ${i.cwd} ${i.sourceId}`.toLocaleLowerCase().includes(a)):e},Cc=(e,s)=>`${e??""}\0${[...s].sort().join("\0")}`,Bs=5e3,Ec=(e,s,a,i=Bs)=>{const r=new Set(a);let o=!1;for(const c of Us(e,s))if(!r.has(c.sourceId)){if(r.size>=i){o=!0;break}r.add(c.sourceId)}return{selected:r,capped:o}},Ac=/cancel/i,Ic=new Set(["done","failed","cancelled"]),Yn=e=>{switch(e){case"metadata_only":return"ui.settings.imports.availability_metadata_only";case"unsupported":return"ui.settings.imports.availability_unsupported";default:return"ui.settings.imports.availability_full"}},Ht=e=>{switch(e){case"queued":return"ui.settings.imports.state_queued";case"done":return"ui.settings.imports.state_done";case"failed":return"ui.settings.imports.state_failed";case"cancelled":return"ui.settings.imports.state_cancelled";default:return"ui.settings.imports.state_running"}},Rc=e=>{switch(e){case"selecting":return"ui.settings.imports.phase_selecting";case"memory":return"ui.settings.imports.phase_memory";case"done":return"ui.settings.imports.phase_done";case"cancelled":return"ui.settings.imports.phase_cancelled";case"queued":return"ui.settings.imports.phase_queued";default:return"ui.settings.imports.phase_importing"}},Tc=e=>{switch(e){case"resumed":return"ui.settings.imports.outcome_resumed";case"skipped_already_imported":return"ui.settings.imports.outcome_skipped";case"metadata_only":return"ui.settings.imports.outcome_metadata";case"failed":return"ui.settings.imports.outcome_failed";case"cancelled":return"ui.settings.imports.outcome_cancelled";default:return"ui.settings.imports.outcome_imported"}},Lc=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",ln=e=>Mc(e.title)||e.sourceId,Zn=({path:e,label:s,onCopyPath:a})=>{const[i,r]=l.useState(!1);return t.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-body-sm text-ink",children:s}),t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:e})]}),t.jsxs(z,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(e).then(o=>{o&&(r(!0),window.setTimeout(()=>r(!1),1500))})},children:[i?t.jsx(Is,{size:14}):t.jsx(xs,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},Oc=({progress:e,sessions:s,selected:a})=>{const i=new Map(e.results.map(u=>[u.sourceId,u])),r=e.sessionId,o=Math.max(0,e.total-e.completed-(r&&!i.has(r)?1:0)),c=s.filter(u=>a.has(u.sourceId));return t.jsxs("div",{className:"flex flex-col gap-2",children:[e.results.map(u=>t.jsx(qs,{row:u,jobCancelled:e.state==="cancelled"},`${u.source}:${u.sourceId}`)),c.filter(u=>!i.has(u.sourceId)&&u.sourceId!==r).map(u=>t.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[t.jsx("span",{className:"min-w-0 truncate",children:ln(u)}),t.jsx(it,{variant:"neutral",children:n("ui.settings.imports.session_pending")})]},u.sourceId)),r&&!i.has(r)&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[t.jsx(jt,{size:14,className:"animate-spin"}),t.jsx("span",{children:n("ui.settings.imports.session_importing")}),t.jsx("span",{className:"min-w-0 truncate",children:r})]}),o>0&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:o})}),e.warnings.map(u=>t.jsx("p",{className:"text-meta text-warning",children:u.message},`${u.code}:${u.sessionId}:${u.message}`))]})},qs=({row:e,jobCancelled:s=!1})=>{const i=s&&e.outcome==="failed"&&e.warnings.some(r=>Ac.test(r))?"cancelled":e.outcome;return t.jsxs("div",{className:"rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:e.sourceId}),t.jsx(it,{variant:Lc(i),children:n(Tc(i))}),t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.session_meta",{messages:e.messages,compactions:e.compactions})})]}),e.targetSessionId&&(e.messages>0||e.outcome==="skipped_already_imported")&&t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:n("ui.settings.imports.result_target",{target:e.targetSessionId})}),e.warnings.map(r=>t.jsx("p",{className:"mt-1 text-meta text-warning",children:r},r))]})},Fc=({sources:e,activeSource:s,sessions:a,query:i,selected:r,preview:o,previewStale:c,previewError:u,confirmed:d,busy:m,error:_,progress:f,result:x,cancelling:h,onSelectSource:b,onQueryChange:v,onToggleSession:w,onSelectAll:L,onClearSelection:M,onConfirmChange:T,onImport:N,onCancel:C,onRetry:S,onImportAnother:B,onRefresh:q,selectionNotice:O,onCopyPath:$})=>{se();const W=e.find(g=>g.source===s),U=f!==null&&!Ic.has(f.state),P=f?.total??r.size,V=l.useMemo(()=>Us(a,i),[i,a]),K=V.length>0&&V.every(g=>r.has(g.sourceId)),H=r.size,X=H>0&&o!==null&&!c&&d&&!m&&!f&&!x;return t.jsx(ge,{title:n("ui.settings.imports.title"),icon:Jt,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[_&&t.jsxs(ae,{variant:"warning",children:[t.jsx(Rt,{children:n("ui.settings.imports.title")}),t.jsx(Me,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:_}),t.jsx(z,{variant:"secondary",size:"sm",onClick:S,children:n("ui.settings.imports.retry")})]})})]}),m==="sources"&&e.length===0?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(ve,{className:"h-20 w-full"}),t.jsx(ve,{className:"h-20 w-full"}),t.jsx(ve,{className:"h-20 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sources")})]}):e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}):t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.source_heading")}),t.jsxs(z,{variant:"ghost",size:"sm",onClick:q,disabled:U||m==="sources"||m==="sessions",children:[t.jsx(Ai,{size:14,className:de(m==="sources"&&"animate-spin")}),n("ui.settings.imports.refresh")]})]}),!e.some(g=>g.detected)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}),t.jsx("div",{className:"grid gap-2 lg:grid-cols-3",children:e.map(g=>{const k=g.source===s,y=g.detected?n(Yn(g.availability)):n("ui.settings.imports.source_not_found");return t.jsxs("button",{type:"button","aria-pressed":k,disabled:U,onClick:()=>b(g.source),className:de("rounded-lg border p-3 text-start transition-colors disabled:cursor-not-allowed disabled:opacity-60","focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",k?"border-accent bg-accent-wash":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-body-sm font-medium text-ink",children:g.label}),t.jsx(it,{variant:g.detected&&g.availability==="full"?"success":"neutral",children:y})]}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.imports.source_sessions",{count:g.sessionCount})}),t.jsx("p",{className:"mt-1 break-all text-meta text-ink-dim",children:g.detail||g.root})]},g.source)})})]}),W&&!f&&!x&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("h3",{className:"text-heading text-ink",children:[n("ui.settings.imports.source_heading")," · ",W.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{variant:"secondary",size:"sm",onClick:K?M:L,disabled:V.length===0,children:K?n("ui.settings.imports.clear_all"):n("ui.settings.imports.select_all")}),t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.selected",{count:H})})]})]}),O&&t.jsx("output",{className:"text-meta text-warning",children:O}),t.jsxs("div",{className:"relative",children:[t.jsx(_n,{size:15,className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),t.jsx(Le,{value:i,onChange:g=>v(g.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"ps-9"})]}),m==="sessions"?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(ve,{className:"h-12 w-full"}),t.jsx(ve,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:W.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:W.label})}):V.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_filter")}):t.jsx("div",{className:"flex max-h-80 flex-col gap-1 overflow-y-auto",children:V.map(g=>{const k=`import-session-${g.source}-${g.sourceId}`;return t.jsxs("div",{className:de("flex items-start gap-3 rounded-md border p-3",r.has(g.sourceId)?"border-accent bg-row-selected":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsx(an,{id:k,checked:r.has(g.sourceId),onCheckedChange:()=>w(g.sourceId),"aria-label":ln(g),className:"mt-0.5"}),t.jsxs("label",{htmlFor:k,className:"min-w-0 flex-1 cursor-pointer text-start",children:[t.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:ln(g)}),t.jsx(it,{variant:g.availability==="full"?"neutral":"warning",children:n(Yn(g.availability))})]}),t.jsxs("span",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-meta text-ink-muted",children:[t.jsx("span",{children:n("ui.settings.imports.session_meta",{messages:g.messageCount??0,compactions:g.compactionCount})}),t.jsx("span",{children:n("ui.settings.imports.session_updated",{date:pn(new Date((g.updatedTs||g.createdTs)*1e3))})})]}),g.cwd&&t.jsx("span",{className:"mt-1 block break-all font-mono text-meta text-ink-dim",children:g.cwd}),g.availability==="metadata_only"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.metadata_only_explain")}),g.availability==="unsupported"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.session_index_only")})]})]},g.sourceId)})})]}),W&&H>0&&!f&&!x&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.preview_heading")}),(m==="preview"||c||o===null&&!u)&&t.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[t.jsx(jt,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),o&&!c&&t.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-hairline bg-surface p-4",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.imports.preview_summary",{sessions:o.totalSessions,messages:o.totalMessages,compactions:o.totalCompactions})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:o.totalMemoryRecords,tokens:o.projectedMemoryTokens.toLocaleString()})}),o.warnings.slice(0,4).map((g,k)=>t.jsx("p",{className:"text-meta text-warning",children:g.message},`${g.code}:${g.sessionId}:${k}`)),o.warnings.length>4&&t.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:o.warnings.length})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_confirm")})]}),t.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-hairline bg-surface p-4",children:[u&&t.jsx(ae,{variant:"warning",children:t.jsx(Me,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:u}),t.jsx(z,{variant:"secondary",size:"sm",onClick:S,children:n("ui.settings.imports.retry")})]})})}),t.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[t.jsx(an,{checked:d,onCheckedChange:g=>T(g===!0),disabled:!o||c,"aria-label":n("ui.settings.imports.confirm_label"),className:"mt-0.5"}),t.jsx("span",{children:n("ui.settings.imports.confirm_label")})]}),t.jsxs(z,{variant:"primary",onClick:N,disabled:!X,className:"self-start",children:[m==="start"?t.jsx(jt,{size:14,className:"animate-spin"}):t.jsx(Jt,{size:14}),n("ui.settings.imports.import_button",{count:H})]})]})]}),f&&!x&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.progress_heading")}),t.jsxs(z,{variant:"secondary",size:"sm",onClick:C,disabled:h||f.state==="done"||f.state==="cancelled"||f.state==="failed",children:[t.jsx(Na,{size:12}),h?n("ui.settings.imports.cancelling"):n("ui.settings.imports.cancel")]})]}),t.jsxs("p",{className:"text-meta text-ink-muted",children:[n("ui.settings.imports.progress_job",{job:f.jobId,state:n(Ht(f.state))})," · ",n(Rc(f.phase))]}),t.jsx(Zi,{value:f.total?f.completed/f.total*100:0,className:"h-1.5"}),t.jsx(Oc,{progress:f,sessions:a,selected:r})]}),x&&t.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.result_heading")}),t.jsx(z,{variant:"secondary",size:"sm",onClick:B,children:n("ui.settings.imports.import_another")})]}),t.jsx("p",{className:"text-body-sm text-ink",children:x.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n(Ht(x.state)),sessions:x.sessions.length,total:P,messages:x.messages}):n("ui.settings.imports.result_summary",{state:n(Ht(x.state)),sessions:x.sessions.length,messages:x.messages})}),x.sessions.map(g=>t.jsx(qs,{row:g,jobCancelled:x.state==="cancelled"},`${g.source}:${g.sourceId}:${g.targetSessionId}`)),(x.instructionReviewPath||x.memoryReviewPath)&&t.jsxs("div",{className:"flex flex-col gap-2",children:[x.instructionReviewPath&&t.jsx(Zn,{path:x.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:$}),x.memoryReviewPath&&t.jsx(Zn,{path:x.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:$})]}),x.warnings.length>0&&t.jsx(ae,{variant:"warning",children:t.jsx(Me,{children:t.jsxs("span",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:x.warnings.length})}),x.warnings.slice(0,4).map((g,k)=>t.jsx("span",{children:g.message},`${g.code}:${k}`))]})})}),x.error&&t.jsx(ae,{variant:"danger",children:t.jsx(Me,{children:x.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),m==="start"&&!f&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(jt,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},wn=e=>({source:e.source,sessionId:e.session_id,code:e.code,message:e.message}),Hs=e=>({source:e.source,sourceId:e.source_id,targetSessionId:e.target_session_id,outcome:e.outcome,messages:e.messages,compactions:e.compactions,redactions:e.redactions,skipped:e.skipped,warnings:e.warnings}),Dc=e=>({jobId:e.job_id,state:e.state,sessions:e.sessions.map(Hs),messages:e.messages,compactions:e.compactions,memoryImported:e.memory_imported,memorySkipped:e.memory_skipped,memoryReviewPath:e.memory_review_path,instructionReviewPath:e.instruction_review_path,redactions:e.redactions,warnings:e.warnings.map(wn),error:e.error});async function zc(){return(await pe({op:"imports.sources"})).sources.map(s=>({source:s.source,label:s.label,root:s.root,detected:s.detected,sessionCount:s.session_count,availability:s.availability,detail:s.detail}))}async function $c(e,s=!1){return(await pe({op:"imports.sessions",source:e,includeSubagents:s})).sessions.map(i=>({source:i.source,sourceId:i.source_id,title:i.title??"",cwd:i.cwd??"",createdTs:i.created_ts,updatedTs:i.updated_ts,messageCount:i.message_count,compactionCount:i.compaction_count,kind:i.kind,availability:i.availability,parentSourceId:i.parent_source_id}))}async function Pc(e){const s=await pe({op:"imports.preview",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0});return{totalSessions:s.total_sessions,totalMessages:s.total_messages,messageCountsEstimated:s.message_counts_estimated,totalCompactions:s.total_compactions,totalMemoryRecords:s.total_memory_records,projectedMemoryTokens:s.projected_memory_tokens,projectedGlobalTokens:s.projected_global_tokens,warnings:s.warnings.map(wn),instructionReviewPaths:s.instruction_review_paths}}async function Kc(e){return(await pe({op:"imports.start",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0})).job_id}async function Uc(e){const s=await pe({op:"imports.status",jobId:e});return{jobId:s.job_id,state:s.state,phase:s.phase,source:s.source,sessionId:s.session_id,completed:s.completed,total:s.total,results:s.results.map(Hs),warnings:s.warnings.map(wn),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?Dc(s.result):void 0}}async function Bc(e){await pe({op:"imports.cancel",jobId:e})}const bt=new Set(["done","failed","cancelled"]),Ue=e=>e instanceof Error?e.message:String(e),qc=()=>{se();const[e,s]=l.useState([]),[a,i]=l.useState(null),[r,o]=l.useState([]),[c,u]=l.useState(""),[d,m]=l.useState(new Set),[_,f]=l.useState(null),[x,h]=l.useState(null),[b,v]=l.useState(!1),[w,L]=l.useState(null),[M,T]=l.useState(null),[N,C]=l.useState(null),[S,B]=l.useState(null),[q,O]=l.useState(!1),[$,W]=l.useState(null),[U,P]=l.useState(0),V=l.useRef(0),K=l.useRef(0),[H,X]=l.useState(null),[g,k]=l.useState(null),y=l.useRef(null),E=N!==null&&!bt.has(N.state),J=l.useCallback(async()=>{L("sources"),T(null);try{const Q=await zc();s(Q),i(ee=>Q.some(me=>me.source===ee&&me.detected)?ee:Q.find(me=>me.detected)?.source??null)}catch(Q){T(n("ui.settings.imports.error_sources",{reason:Ue(Q)}))}finally{L(null)}},[]);l.useEffect(()=>{J()},[J]);const Y=l.useCallback(async Q=>{const ee=++V.current;L("sessions"),T(null);try{const ce=await $c(Q);if(ee!==V.current)return;o(ce)}catch(ce){if(ee!==V.current)return;o([]),T(n("ui.settings.imports.error_sessions",{source:Q,reason:Ue(ce)}))}finally{ee===V.current&&L(null)}},[]);l.useEffect(()=>{if(!a){o([]);return}o([]),m(new Set),f(null),h(null),X(null),k(null),v(!1),B(null),C(null),Y(a)},[a,Y]);const te=l.useCallback(Q=>{m(Q),v(!1),X(null),k(null),W(null)},[]),ne=l.useCallback(Q=>{E||(i(Q),u(""))},[E]),re=l.useCallback(Q=>{const ee=new Set(d);ee.has(Q)?ee.delete(Q):ee.add(Q),te(ee)},[te,d]),fe=l.useCallback(()=>{const Q=Ec(r,c,d);te(Q.selected),Q.capped&&W(n("ui.settings.imports.selection_limit",{max:Bs}))},[c,te,d,r]),Ne=l.useCallback(()=>{te(new Set)},[te]),xe=l.useMemo(()=>Cc(a,d),[a,d]),I=_!==null&&x!==xe,G=l.useCallback(async()=>{if(!a||d.size===0)return;const Q=++K.current,ee=xe;L("preview"),T(null),k(null);try{const ce=await Pc({sources:[a],sessionIds:{[a]:[...d].sort()}});if(Q!==K.current)return;f(ce),h(ee)}catch(ce){if(Q!==K.current)return;f(null),h(null),X(ee),k(n("ui.settings.imports.error_preview",{reason:Ue(ce)}))}finally{Q===K.current&&L(null)}},[a,xe,d]);l.useEffect(()=>{if(!a||d.size===0||N||S||_&&x===xe||!_&&H===xe)return;const Q=setTimeout(()=>{G()},250);return()=>clearTimeout(Q)},[a,d,xe,_,x,H,N,S,G]);const D=l.useCallback(async()=>{if(!(!a||d.size===0||!_||I||!b||N)){L("start"),T(null),B(null);try{const Q=await Kc({sources:[a],sessionIds:{[a]:[...d].sort()}}),ee=Date.now()/1e3;C({jobId:Q,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:d.size,results:[],warnings:[],error:"",startedAt:ee,updatedAt:ee})}catch(Q){T(n("ui.settings.imports.error_start",{reason:Ue(Q)}))}finally{L(null)}}},[a,b,_,I,N,d]),ie=N?.jobId??null,le=N?.state??null;l.useEffect(()=>{if(!ie||!le||bt.has(le))return;let Q=!0,ee;const ce=async()=>{try{const me=await Uc(ie);if(!Q)return;if(y.current){const Oe=y.current;y.current=null,T(ue=>ue===Oe?null:ue)}C(me),me.result&&B({...me.result,jobId:me.jobId}),bt.has(me.state)||(ee=setTimeout(ce,900))}catch(me){if(!Q)return;const Oe=n("ui.settings.imports.error_job",{reason:Ue(me)});y.current=Oe,T(Oe),ee=setTimeout(ce,2e3)}};return ee=setTimeout(ce,U>0?0:700),()=>{Q=!1,ee&&clearTimeout(ee)}},[ie,le,U]);const ze=l.useCallback(async()=>{if(!(!N||bt.has(N.state))){O(!0),T(null);try{await Bc(N.jobId)}catch(Q){T(n("ui.settings.imports.error_cancel",{reason:Ue(Q)}))}finally{O(!1)}}},[N]),ye=l.useCallback(()=>{m(new Set),f(null),h(null),X(null),k(null),v(!1),W(null),B(null),C(null),T(null),a&&Y(a)},[a,Y]),je=l.useCallback(async Q=>{try{return await navigator.clipboard.writeText(Q),!0}catch{return!1}},[]),Ae=l.useCallback(async()=>{E||(W(null),X(null),k(null),await J(),a&&await Y(a))},[a,E,Y,J]),Ie=l.useCallback(()=>{if(E){T(null),P(Q=>Q+1);return}X(null),k(null),Ae()},[E,Ae]);return t.jsx(Fc,{sources:e,activeSource:a,sessions:r,query:c,selected:d,preview:_,previewStale:I,previewError:g,confirmed:b,busy:w,error:M,progress:N,result:S,cancelling:q,onSelectSource:ne,onQueryChange:u,onToggleSession:re,onSelectAll:fe,onClearSelection:Ne,onConfirmChange:v,onImport:()=>void D(),onCancel:()=>void ze(),onRetry:Ie,onImportAnother:ye,onRefresh:Ae,selectionNotice:$,onCopyPath:je})},Hc=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function Vs(e){if(!e)return null;const s=e.split("\\").join("/").split("/").filter(Boolean);for(const[a,i]of Hc)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const Mt=e=>n("ui.settings.integrations.integration_model.tool_count",{count:e}),Vc=e=>n("ui.settings.integrations.integration_model.integration_count",{count:e}),Gc=["connected","needs_sign_in","not_started","connecting","error"],Gs=e=>Gc.includes(e),Ge=(e,s)=>[...s].filter(a=>a.name===e&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,Qc={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},Wc=1e12,Yc=1e9,Zc=60*60*1e3,Qs=(e,s=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const a=e>=Wc?e:e<Yc?null:e*1e3;return a===null||a>s+Zc?null:Math.min(a,s)},Ke=(e,s)=>e?.[s]??Qc,lt=(e,s,a)=>ed(e,s)??a?.lastDecisive??null,Jc=e=>({id:e.id,name:e.name,action:e.action,status:e.status,created_at:e.created_at,credential_removed:e.credential_removed,...e.message?{message:e.message}:{}}),Nn=(e,s)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(s.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),Xc=(e,s)=>[...s].filter(a=>a.name===e).sort((a,i)=>i.created_at-a.created_at)[0]??null,ed=(e,s)=>Xc(e,s.filter(a=>a.status!=="cancelled")),Ot=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function td(e,s){const a=Math.max(0,Math.round((e-s)/1e3));if(a<60)return n("ui.settings.integrations.integration_model.just_now");const i=Math.round(a/60);if(i<60)return n("ui.settings.integrations.integration_model.minutes_min_ago",{minutes:i});const r=Math.round(i/60);return r<24?n("ui.settings.integrations.integration_model.hours_h_ago",{hours:r}):n("ui.settings.integrations.integration_model.days_ago",{days:Math.round(r/24)})}function Vt(e){if(!e)return null;const s=e.trim();if(!s||/^\/\w/.test(s)||/\/mcp\s+\w+/.test(s))return null;let a=s;for(let i=0;i<3;i+=1){const r=a.replace(/^(?:connection (?:closed|error|refused)|error|closed|failed)\s*:\s*/i,"").trim();if(r===a)break;a=r}return a=a.replace(/\s*\(\s*\d{3}\s*\)/g,"").replace(/\s+([.,;])/g,"$1").replace(/\s{2,}/g," ").trim(),a||null}function nd(e,s=[],a,i=Date.now()){const r=Ke(a,e.name),o=Ge(e.name,s);if(o){if(o.action==="login"||o.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(o.action==="logout")return{label:n("ui.settings.integrations.integration_model.signing_out"),tone:"info",detail:null,busy:!0}}if(!Gs(e.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const c=lt(e.name,s,r),u=Ft(c)&&e.status!=="connected",d=Nn(e,r),m=Cn(c)&&e.status!=="connected",_=(c?.action==="login"||c?.action==="reauth")&&c.status==="failed";if(r.disconnectedAt!==null)return{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1,explanation:n(Jn)};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?n("ui.settings.integrations.integration_model.connected_with_tools",{tools:String(Mt(e.tool_count))}):n("ui.settings.integrations.integration_model.connected"),tone:"success",detail:null,busy:!1};case"connecting":return{label:n("ui.settings.integrations.integration_model.connecting"),tone:"info",detail:null,busy:!0};case"needs_sign_in":return{label:e.auth.kind==="api_key"||nt(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Vt(e.status_reason),busy:!1};case"error":return{label:n("ui.settings.integrations.integration_model.couldn_t_start"),tone:"danger",detail:Vt(e.status_reason)??n("ui.settings.integrations.integration_model.no_reason_was_given"),busy:!1};default:if(u)return{label:n("ui.settings.integrations.integration_model.signed_out"),tone:"warning",detail:null,busy:!1};if(m)return{label:n("ui.settings.integrations.integration_model.sign_out_didn_t_finish"),tone:"warning",detail:n("ui.settings.integrations.integration_model.the_sign_in_is_still_saved"),busy:!1};if(nt(e,s,r))return{label:n("ui.settings.integrations.integration_model.needs_a_key"),tone:"warning",detail:null,busy:!1};if(_)return{label:n("ui.settings.integrations.integration_model.sign_in_didn_t_finish"),tone:"warning",detail:null,busy:!1};if(r.needsSignIn)return{label:e.auth.kind==="api_key"||nt(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Vt(e.status_reason),busy:!1};if(e.status_basis==="stored"&&d&&r.disconnectedAt===null){const f=r.connectedAt??Qs(e.last_seen_at,i);return{label:f!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(td(i,f)),tools:String(Mt(e.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String(Mt(e.tool_count))}),tone:"success",detail:null,busy:!1}}return e.status_basis==="live"?{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1,explanation:n(Jn)}:{label:n("ui.settings.integrations.integration_model.ready"),tone:"neutral",detail:null,busy:!1,explanation:n(id)}}}const Ws=e=>n("ui.settings.integrations.integration_model.replace_keys",{count:e}),sd=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function ad(e,s){const a=e?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(sd,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const id="ui.settings.integrations.integration_model.copy_ready_explanation",Jn="ui.settings.integrations.integration_model.copy_not_connected_explanation",rd=e=>e.transport==="local_command"?n("ui.settings.integrations.integration_model.local_command"):n("ui.settings.integrations.integration_model.remote_url");function Ys(e){switch(e.source.kind){case"local-operator":case"project-mcp-json":return null;case"claude-code":return n("ui.settings.integrations.integration_model.claude_code");case"cursor":return"Cursor";case"vscode":return n("ui.settings.integrations.integration_model.vs_code");case"codex":return n("ui.settings.integrations.integration_model.codex_cli");default:return Vs(e.source.path)}}function od(e,s){const a=[{text:rd(e),importSource:!1}];e.status!=="connected"&&e.tool_count_basis==="last_seen"&&typeof e.tool_count=="number"&&a.push({text:n("ui.settings.integrations.integration_model.tools_when_last_checked",{tools:String(Mt(e.tool_count))}),importSource:!1}),s&&a.push({text:e.scope==="project"?n("ui.settings.integrations.integration_model.this_project"):n("ui.settings.integrations.integration_model.global"),importSource:!1});const i=Ys(e);return i?a.push({text:n("ui.settings.integrations.integration_model.imported_from_origin",{origin:String(i)}),importSource:!0}):e.source.editable||a.push({text:n("ui.settings.integrations.integration_model.imported_from_a_project_file"),importSource:!0}),a}const Sn=(e,s)=>s.disconnectedAt!==null?"not_started":e.status;function Mn(e,s=[],a){const i=Ke(a,e.name),r=Ge(e.name,s);if(r)return r.action==="login"||r.action==="reauth"?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.continue_sign_in")}:null;const o=_=>e.actions.includes(_),c=Ot(e),u=nt(e,s,i);if(!Gs(e.status))return o("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const d=lt(e.name,s,i),m=d?.status==="failed"&&ct(d);switch(Sn(e,i)){case"connected":case"connecting":return null;case"needs_sign_in":return u?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:o("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}:c?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:o("reauth")?{kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};case"error":return o("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:o("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.retry")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};default:{if(Ft(d)&&o("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(Cn(d)&&o("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&o("connect"))return{kind:"connect",label:n("ui.settings.integrations.integration_model.connect")};if(i.needsSignIn){if(u&&c)return{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")};if(o("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}}return u&&c?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:m&&o("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:Nn(e,i)&&!o("connect")?null:o("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:o("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:n("ui.settings.integrations.integration_model.test"),variant:"ghost"}:null}}}const ct=e=>e.action==="login"||e.action==="reauth",Ft=e=>!!(e&&e.action==="logout"&&e.status==="complete"),Cn=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),Zs=/no oauth authorization server/i;function nt(e,s,a){if(!Ot(e))return!1;const i=lt(e.name,s,a);return i&&ct(i)&&i.status==="failed"&&Zs.test(i.message??"")?!0:a.needsKey}function ld(e,s=[],a){const i=Mn(e,s,a)?.kind,r=Sn(e,Ke(a,e.name)),o=d=>e.actions.includes(d),c=[],u=Ge(e.name,s);if(u&&c.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!u&&o("test")&&i!=="test"&&c.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),o("connect")&&i!=="connect"&&r!=="connected"&&c.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!u&&o("sign_in")&&i!=="sign_in"&&r!=="connected"&&c.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),o("reload")&&c.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!u&&o("reauth")&&i!=="reauth"&&c.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),Ot(e)&&i!=="set_key"&&c.push({kind:"set_key",label:e.auth.secret_refs.length>0?n("ui.settings.integrations.integration_model.update_key"):n("ui.settings.integrations.integration_model.add_key")}),o("sign_out")&&c.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),o("disconnect")&&r==="connected"&&c.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),o("copy_setup")&&e.setup_prompt&&c.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&c.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),o("remove"))c.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!e.source.editable){const d=Ys(e);c.push({kind:"remove_elsewhere",label:d?n("ui.settings.integrations.integration_model.remove_in_origin",{origin:String(d)}):n("ui.settings.integrations.integration_model.remove_in_its_own_file"),hint:d?n("ui.settings.integrations.integration_model.defined_in_origin_s_config_remove_it_there",{origin:String(d)}):n("ui.settings.integrations.integration_model.defined_in_a_file_this_app_doesn_t_write_remove_it_there")})}return c}const cd={get attention(){return n("ui.settings.integrations.integration_model.needs_attention")},get connected(){return n("ui.settings.integrations.integration_model.connected")},get ready(){return n("ui.settings.integrations.integration_model.available")}};function Js(e,s=[],a){const i=Ke(a,e.name),r=Ge(e.name,s),o=Sn(e,i);if(r&&i.pinnedGroup&&i.pinnedOperationId===r.id)return i.pinnedGroup;if(o==="needs_sign_in"||o==="error")return"attention";const c=lt(e.name,s,i);return Ft(c)&&o!=="connected"||Cn(c)&&o!=="connected"?"attention":i.disconnectedAt!==null?"ready":nt(e,s,i)||i.needsSignIn&&o!=="connected"||c?.status==="failed"&&ct(c)&&o!=="connected"?"attention":o==="connected"||e.status_basis==="stored"&&Nn(e,i)?"connected":r&&r.action!=="test"?"attention":"ready"}function dd(e,s=[],a){return["attention","connected","ready"].map(r=>({id:r,title:cd[r],rows:e.filter(o=>Js(o,s,a)===r)})).filter(r=>r.rows.length>0)}function ud(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const r of s.servers){const o=Ke(e,r.name),c=Ge(r.name,s.operations),u=lt(r.name,s.operations,o),d=Ft(u),m=r.status==="connected"&&(r.status_basis==="probe"||r.status_basis==="live"),_=o.holdUntil!==null&&a<o.holdUntil,f=!_&&!d&&o.connectedAt===null&&r.status_basis==="stored"&&r.tool_count_basis==="last_seen"?Qs(r.last_seen_at,a):null,x=!d,h=u?.status==="failed"&&ct(u)&&Zs.test(u.message??""),b={connectedAt:m&&!_?a:f!==null?f:x?o.connectedAt:null,connectedToolCount:m&&!_||f!==null?r.tool_count??o.connectedToolCount:x?o.connectedToolCount:null,settledGroup:o.settledGroup,pinnedGroup:c&&o.pinnedOperationId===c.id?o.pinnedGroup:c?o.settledGroup:null,pinnedOperationId:c?c.id:null,needsKey:m?!1:o.needsKey||h,needsSignIn:m||d?!1:o.needsSignIn||r.status==="needs_sign_in",disconnectedAt:m&&!_?null:o.disconnectedAt,holdUntil:_?o.holdUntil:null,lastDecisive:u?Jc(u):null};c||(b.settledGroup=Js(r,s.operations,{...i,[r.name]:b})),i[r.name]=b}return i}const gd=(e,s)=>e!==null&&s===e,cn="local-operator.settings.integrations.row-memory",Xs=(e,s)=>`${e}#${s}`;function md(e,s){const a={};if(!s)return a;for(const i of s.servers){const r=e[i.name];r&&(a[Xs(i.source.path,i.name)]=r)}return a}function _d(e,s,a){if(!s)return e;let i=null;for(const r of s.servers){if(Object.prototype.hasOwnProperty.call(e,r.name))continue;const o=hd(a[Xs(r.source.path,r.name)]);o&&(i=i??{...e},i[r.name]=o)}return i??e}const pd=["attention","connected","ready"],ea=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),En=e=>typeof e=="number"&&Number.isFinite(e)?e:null,Xn=e=>pd.includes(e)?e:null,Gt=e=>{const s=En(e);return s!==null&&s>=1e12?s:null};function fd(e){if(!ea(e)||typeof e.id!="string"||typeof e.name!="string")return null;const s=e.action,a=e.status;return s!=="login"&&s!=="logout"&&s!=="reauth"&&s!=="test"||a!=="running"&&a!=="complete"&&a!=="cancelled"&&a!=="failed"?null:{id:e.id,name:e.name,action:s,status:a,created_at:En(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function hd(e){if(!ea(e))return null;const s=Gt(e.connectedAt),a=Gt(e.disconnectedAt),i=e.needsKey===!0,r=e.needsSignIn===!0,o=fd(e.lastDecisive);return s===null&&a===null&&!i&&!r&&!o?null:{connectedAt:s,connectedToolCount:En(e.connectedToolCount),settledGroup:Xn(e.settledGroup),pinnedGroup:Xn(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:i,needsSignIn:r,disconnectedAt:a,holdUntil:Gt(e.holdUntil),lastDecisive:o}}const ta=2e3,es=8e3;function xd(e){return e&&(e.servers.some(a=>a.status==="connecting")||e.operations.some(a=>a.status==="running"))?ta:!1}const yd=/^[A-Za-z0-9_.:-]{1,100}$/,bd=/:\/\//;function vd(e,s){const a=e.trim();return a?yd.test(a)?s.includes(a)?n("ui.settings.integrations.integration_model.an_integration_named_trimmed_already_exists",{trimmed:String(a)}):null:n("ui.settings.integrations.integration_model.use_letters_numbers_dots_dashes_underscores_or_colons_with_no_spa"):n("ui.settings.integrations.integration_model.give_it_a_name")}function kd(e){const s=e.trim();if(!s)return n("ui.settings.integrations.integration_model.enter_the_server_s_url");let a;try{a=new URL(s)}catch{return n("ui.settings.integrations.integration_model.enter_a_full_url_like_https_mcp_example_com_mcp")}return a.protocol!=="https:"&&a.protocol!=="http:"?n("ui.settings.integrations.integration_model.the_url_must_start_with_https_or_http"):a.hostname?a.username||a.password?n("ui.settings.integrations.integration_model.remove_the_username_or_password_from_the_url_keys_are_added_after"):a.search||a.hash?n("ui.settings.integrations.integration_model.remove_the_or_part_of_the_url_keys_are_added_after_it_s_saved"):bd.test(s.slice(a.protocol.length+2))?n("ui.settings.integrations.integration_model.this_looks_like_two_urls_pasted_together_enter_just_one"):null:n("ui.settings.integrations.integration_model.the_url_needs_a_host_name")}const jd=e=>e.split(`
|
|
287
|
+
`).map(s=>s.trim()).filter(Boolean);function dn(e,s){const a=!!e?.cold,i=(e?.servers??[]).map(r=>{const o=r.transport==="http",c=r.secret_refs??[],u=r.status==="connected"?"connected":r.status==="connecting"?"connecting":r.status==="auth-required"?"needs_sign_in":"not_started",d=[];u!=="connected"&&d.push("connect"),u==="connected"&&d.push("disconnect"),a||d.push("reload"),o&&r.transport_oauth_supported!==!1&&d.push("sign_in"),c.length>0&&d.push("set_key"),r.owned_scope&&d.push("remove"),r.setup?.text&&d.push("copy_setup");const m=Vs(r.source);return{id:r.name,name:r.name,scope:r.owned_scope??"global",project_cwd:null,source:{kind:wd(r.source,m,r.owned_scope),path:r.source??"",editable:r.owned_scope!==null,owned_scope:r.owned_scope},transport:o?"remote_url":"local_command",endpoint:{command:null,url:null,endpoint_redacted:!1},status:u,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:a?"stored":"live",auth:{kind:c.length?"api_key":o?"unknown":"none",signed_in:null,secret_refs:c.map(_=>({id:_.id,state:"missing"}))},tool_count:typeof r.tool_count=="number"?r.tool_count:null,tool_count_basis:typeof r.tool_count=="number"?"live":null,actions:d,setup_prompt:r.setup?.text??null}});return{cwd:"",project_scope_available:i.some(r=>r.source.owned_scope==="project"),global_path:"",project_path:null,status_source:a?"config":"live",session_id:s,servers:i,operations:(e?.operations??[]).map(r=>({...r}))}}const wd=(e,s,a)=>s==="Claude Code"?"claude-code":s==="Cursor"?"cursor":s==="VS Code"?"vscode":s==="Codex CLI"?"codex":a?"local-operator":e?"project-mcp-json":"local-operator",ts={get invalid_config(){return n("ui.settings.integrations.integration_model.that_configuration_isn_t_valid_check_the_command_or_the_url_then_")},get operation_unavailable(){return n("ui.settings.integrations.integration_model.that_sign_in_or_test_isn_t_running_any_more_try_again")},get exists(){return n("ui.settings.integrations.integration_model.an_integration_with_this_name_already_exists_choose_another_name")},get not_owned(){return n("ui.settings.integrations.integration_model.it_s_defined_in_another_tool_s_config_so_it_can_t_be_changed_here")},get project_scope_unavailable(){return n("ui.settings.integrations.integration_model.there_s_no_separate_project_config_here_so_it_can_only_be_added_g")},get unknown_server(){return n("ui.settings.integrations.integration_model.it_no_longer_exists_the_list_has_been_refreshed")},get oauth_unsupported(){return n("ui.settings.integrations.integration_model.it_doesn_t_use_browser_sign_in")},get grant_running(){return n("ui.settings.integrations.integration_model.a_sign_in_or_test_is_already_running_wait_for_it_to_finish_or_can")},get too_many_operations(){return n("ui.settings.integrations.integration_model.too_many_sign_ins_and_tests_are_waiting_try_again_in_a_moment")},get write_failed(){return n("ui.settings.integrations.integration_model.the_config_file_couldn_t_be_written_check_that_it_isn_t_read_only")},get mcp_starting(){return n("ui.settings.integrations.integration_model.integrations_are_still_starting_try_again_in_a_moment")},get mcp_control_refused(){return n("ui.settings.integrations.integration_model.the_server_refused_it_so_nothing_was_changed")}},Nd="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function vt(e,s,a){if(s instanceof hn&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(ts,s.code)?ts[s.code]:n(Nd);return`${Sa[e]}. ${i}`}return Ma(e,s,a).message}const Sd="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",Md="ui.settings.integrations.add_integration_form.copy_transport_hint",Cd=({existingNames:e,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:r,initial:o})=>{se();const[c,u]=l.useState(o?.name??""),[d,m]=l.useState(o?.mode??"command"),[_,f]=l.useState(o?.command??""),[x,h]=l.useState(o?.args??""),[b,v]=l.useState(o?.url??""),[w,L]=l.useState("global"),[M,T]=l.useState(o?.touched?{name:!0,command:!0,url:!0}:{}),[N,C]=l.useState(!!o?.touched),[S,B]=l.useState(!1),[q,O]=l.useState(null),$=l.useRef(null),W=l.useRef(null),U=l.useRef(null);l.useEffect(()=>{$.current?.focus()},[]);const P=vd(c,e),V=d==="command"&&!_.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,K=d==="url"?kd(b):null,H=y=>N||M[y],X=async y=>{if(y.preventDefault(),C(!0),P||V||K){P?$.current?.focus():V?W.current?.focus():U.current?.focus();return}B(!0),O(null);const E=s?w:"global",J=d==="command"?{name:c.trim(),scope:E,mode:d,command:_.trim(),args:jd(x)}:{name:c.trim(),scope:E,mode:d,url:b.trim()},Y=await i(J);B(!1),O(Y)},g=(y,E,J)=>E&&H(J)?t.jsx("p",{id:y,className:"text-body-sm text-danger",children:E}):null,k=y=>y.preventDefault();return t.jsxs("form",{noValidate:!0,"aria-label":n("ui.settings.integrations.add_integration_form.add_integration"),className:"flex flex-col gap-4 rounded-lg bg-surface p-4",onSubmit:y=>void X(y),onKeyDown:y=>{y.key==="Escape"&&(y.stopPropagation(),r())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(Le,{ref:$,id:"integration-add-name",value:c,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(P&&H("name")),"aria-describedby":P&&H("name")?"integration-add-name-error":void 0,onChange:y=>u(y.target.value),onBlur:()=>T(y=>({...y,name:!0}))}),g("integration-add-name-error",P,"name")]}),t.jsxs(At,{value:d,onValueChange:y=>m(y==="url"?"url":"command"),className:"flex flex-col gap-1.5",children:[t.jsx("span",{id:"integration-add-transport-label",className:"font-medium text-body-sm text-ink",children:n("ui.settings.integrations.add_integration_form.how_it_runs")}),t.jsxs(It,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(Be,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),t.jsx(Be,{value:"url","data-integration-transport":"url",children:n("ui.settings.integrations.add_integration_form.remote_url")})]}),t.jsx("p",{className:"text-ink-dim text-meta",children:n(Md)}),t.jsxs(zn,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(Le,{ref:W,id:"integration-add-command",value:_,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(V&&H("command")),"aria-describedby":V&&H("command")?"integration-add-command-error":void 0,onChange:y=>f(y.target.value),onBlur:()=>T(y=>({...y,command:!0}))}),g("integration-add-command-error",V,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Te,{htmlFor:"integration-add-args",children:[n("ui.settings.integrations.add_integration_form.arguments")," ",t.jsx("span",{className:"font-normal text-ink-dim",children:n("ui.settings.integrations.add_integration_form.one_per_line")})]}),t.jsx(Rs,{id:"integration-add-args",value:x,rows:2,className:"font-mono",onChange:y=>h(y.target.value)})]})]}),t.jsx(zn,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(Le,{ref:U,id:"integration-add-url",type:"url",value:b,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(K&&H("url")),"aria-describedby":K&&H("url")?"integration-add-url-error":"integration-add-url-help",onChange:y=>v(y.target.value),onBlur:()=>T(y=>({...y,url:!0}))}),g("integration-add-url-error",K,"url")??t.jsx("p",{id:"integration-add-url-help",className:"text-ink-dim text-meta",children:n("ui.settings.integrations.add_integration_form.if_it_needs_a_sign_in_or_a_key_you_ll_be_asked_after_it_s_added")})]})})]}),s?t.jsxs(At,{value:w,onValueChange:y=>L(y==="project"?"project":"global"),className:"flex flex-col gap-1.5",children:[t.jsx("span",{id:"integration-add-scope-label",className:"font-medium text-body-sm text-ink",children:n("ui.settings.integrations.add_integration_form.available_in")}),t.jsxs(It,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(Be,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),t.jsx(Be,{value:"project","data-integration-scope":"project",children:n("ui.settings.integrations.add_integration_form.this_project")})]}),a?t.jsx("p",{className:"text-ink-dim text-meta",children:w==="project"?n("ui.settings.integrations.add_integration_form.only_chats_working_in_projectlabel",{projectLabel:String(a)}):n("ui.settings.integrations.add_integration_form.every_chat_in_any_folder")}):null]}):null,q?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:q}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:de("text-body-sm text-ink-dim"),children:n(Sd)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(z,{type:"button",variant:"ghost",size:"md",onMouseDown:k,onClick:r,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(z,{type:"submit",variant:"primary",size:"md",disabled:S,onMouseDown:k,children:[S?t.jsx(ke,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},Ed=4;function Ad(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function Id(e){return e.now>e.hold.until||e.hold.reanchors>=Ed?"drop":e.hold.landedOn.isConnected&&(!e.candidate||e.candidate===e.hold.landedOn)?"settled":e.active&&e.active!==e.body&&e.active!==e.hold.landedOn?"drop":e.candidate?.isConnected?"restore":"drop"}function Rd(e){const s=Ad({hold:e.hold,now:e.now,windowMs:e.windowMs,rowMoving:e.rowMoving,lastMovingAt:e.lastMovingAt});if(e.now>s)return{hold:null,land:null};const a=e.hold.landedOn??null,i=e.candidate;if(!i)return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(!a)return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:i},land:i};const r=Id({hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},candidate:i,active:e.active,body:e.body,now:e.now});if(r==="settled")return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(r==="drop")return{hold:null,land:null};const o=!a.isConnected;return{hold:{until:o?e.now+e.windowMs:s,reanchors:o?e.hold.reanchors+1:e.hold.reanchors,landedOn:i},land:i}}function Td(e){const{row:s,target:a}=e;return!s||!a||typeof a.nodeType!="number"?!1:!s.contains(a)}const ns=250;function ss(e){return e?!e.disabled:!1}function Ld(e){return ss(e.primary)?e.primary??null:ss(e.overflow)?e.overflow??null:null}function Od(e){return e.verdict==="finished"?null:e.watchMs}const na="key";function Fd(e){const{name:s,keyless:a,freeName:i,names:r,values:o,replace:c,canReplace:u}=e;if(a){const d=un(s,i);return{values:{[d]:(o[na]??"").trim()},confirmedReplace:c&&u?[d]:[],header:i.trim()}}return{values:Object.fromEntries(r.map(d=>[d,(o[d]??"").trim()])),confirmedReplace:c&&u?r:[],header:void 0}}function un(e,s){const a=as(e),i=as(s);if(!i)return"";const r=[a,i].filter(Boolean).join("_"),o=/^[A-Za-z_]/.test(r)?r:`K_${r}`;if(o.length<=Qt)return o;const c=Dd(a),u=Qt-i.length-c.length-2,d=[a.slice(0,Math.max(u,0)),c,i].filter(Boolean).join("_");return d.length<=Qt?d:d.slice(-128)}const Qt=128,as=e=>e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),Dd=e=>{let s=2166136261;for(let a=0;a<e.length;a+=1)s^=e.charCodeAt(a),s=Math.imul(s,16777619)>>>0;return s.toString(36).toUpperCase().slice(0,5)},zd=({name:e,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:r,failure:o,onSave:c,onClose:u})=>{se();const[d,m]=l.useState({}),[_,f]=l.useState(!1),[x,h]=l.useState(""),b=a?[un(e,x)]:[...s],v=a?[na]:b,w=(a?un(e,x).length>0:!0)&&v.every(M=>(d[M]??"").trim()),L=b.some(M=>i.includes(M));return t.jsx(ys,{open:!0,onClose:u,maxWidth:"xs",title:n("ui.settings.integrations.integration_key_dialog.add_keys_heading",{count:a?1:s.length,name:e}),actions:t.jsxs(t.Fragment,{children:[t.jsx(Xt,{onClick:u,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),t.jsx(en,{disabled:!w||r,onClick:()=>{const M=Fd({name:e,keyless:a,freeName:x,names:b,values:d,replace:_,canReplace:L});c(M.values,M.confirmedReplace,M.header)},children:r?n("ui.settings.integrations.integration_key_dialog.saving"):n("ui.settings.integrations.integration_key_dialog.save_and_test")})]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted",children:[t.jsx("p",{className:"-mx-1.5",children:a?n("ui.settings.integrations.integration_key_dialog.keys_are_saved_encrypted_on_this_computer_this_one_is_stored_unde"):n("ui.settings.integrations.integration_key_dialog.keys_are_saved_encrypted_on_this_computer_other_integrations_that")}),a?t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),t.jsx(Le,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:x,onChange:M=>h(M.target.value)}),t.jsx("p",{className:"-mx-1.5 text-ink-dim text-meta",children:n("ui.settings.integrations.integration_key_dialog.this_server_declares_no_key_of_its_own_so_local_operator_adds_one")})]}):null,v.filter(M=>a!==!0||M.trim().length>0).map(M=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Te,{htmlFor:`integration-key-${M}`,className:"font-mono",children:a?"Key":M}),t.jsx(Le,{id:`integration-key-${M}`,type:"password",autoComplete:"off",value:d[M]??"",onChange:T=>m(N=>({...N,[M]:T.target.value}))})]},M)),L?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(an,{id:"integration-key-replace",checked:_,onCheckedChange:M=>f(M===!0)}),t.jsx(Te,{htmlFor:"integration-key-replace",className:"font-normal",children:Ws(b.length)})]}):null,o?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:o}):null]})})},$d={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},Pd={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"},Kd=({row:e,operations:s,memories:a,now:i,projectScopeAvailable:r,highlighted:o=!1,rowRef:c,primaryRef:u,overflowRef:d,pending:m,failure:_,confirm:f,onPrimary:x,onOverflow:h,onConfirm:b,onCancelConfirm:v})=>{se();const w=nd(e,s,a,i),L=o&&w.tone==="danger"?"text-ink":Pd[w.tone],M=Mn(e,s,a),T=ld(e,s,a),N=od(e,r),C=T.findIndex(S=>S.kind==="remove"||S.kind==="remove_elsewhere");return t.jsxs("li",{ref:c,"data-integration":e.name,"data-search-row":`integration.${e.id}`,"data-search-control":!0,"data-status":e.status,className:de("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",o&&"bg-row-selected"),onKeyDown:S=>{!f||S.key!=="Escape"||(S.stopPropagation(),v())},children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:w.busy?t.jsx(ke,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":w.tone,className:de("size-2 rounded-full",$d[w.tone])})}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"truncate font-medium text-body text-ink",title:e.name,children:e.name}),t.jsx("span",{className:"truncate text-ink-dim text-meta",children:N.map((S,B)=>t.jsxs("span",{children:[B>0?" · ":null,S.importSource&&e.source.path?t.jsx(Ve,{content:hi(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:S.text})}):S.text]},S.text))})]}),w.explanation?t.jsx(Ve,{content:w.explanation,children:t.jsx("span",{className:de("shrink-0 text-body-sm",L),children:w.label})}):t.jsx("span",{className:de("shrink-0 text-body-sm",L),children:w.label}),M?t.jsxs(z,{ref:u,variant:M.variant??"secondary",size:"sm","aria-label":`${M.label} ${e.name}`,disabled:m,"data-integration-action":M.kind,onClick:()=>x(M),children:[m?t.jsx(ke,{size:"xs"}):null,M.label]}):null,t.jsxs(Ji,{children:[t.jsx(Xi,{asChild:!0,children:t.jsx(z,{ref:d,variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_row.more_actions_for_name",{name:String(e.name)}),disabled:m,children:t.jsx(Ca,{"aria-hidden":"true"})})}),t.jsx(er,{align:"end",className:"min-w-48",children:T.map((S,B)=>t.jsx(Ud,{item:S,separated:B===C&&B>0,onSelect:()=>h(S)},S.kind))})]})]}),w.detail?t.jsx("p",{className:de("ps-7 text-body-sm",w.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:w.detail}):null,_?t.jsx("p",{className:de("ps-7 text-body-sm",o?"text-ink":"text-danger"),role:"alert",children:_}):null,f?t.jsxs("div",{className:"flex flex-wrap items-center gap-2 ps-7",children:[t.jsx("span",{className:"text-body-sm text-ink",children:f.kind==="remove"?n("ui.settings.integrations.integration_row.remove_name",{name:String(e.name)}):n("ui.settings.integrations.integration_row.sign_out_of_name",{name:String(e.name)})}),t.jsx("span",{className:"text-body-sm text-ink-muted",children:f.kind==="remove"?n("ui.settings.integrations.integration_row.agents_in_every_chat_lose_access_to_name",{name:String(e.name)}):e.auth.kind==="oauth"?n("ui.settings.integrations.integration_row.the_saved_sign_in_is_removed_too"):n("ui.settings.integrations.integration_row.its_saved_credential_is_removed_too")}),t.jsx(z,{variant:"danger",size:"sm",onClick:b,"data-integration-confirm":f.kind,children:f.kind==="remove"?n("ui.settings.integrations.integration_row.remove"):n("ui.settings.integrations.integration_row.sign_out")}),t.jsx(z,{variant:"ghost",size:"sm",onClick:v,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},Ud=({item:e,separated:s,onSelect:a})=>(se(),t.jsxs(t.Fragment,{children:[s?t.jsx(tr,{}):null,e.kind==="remove_elsewhere"?t.jsxs($n,{disabled:!0,className:"flex-col items-start gap-0.5",children:[t.jsx("span",{children:e.label}),t.jsx("span",{className:"text-meta text-ink-dim",children:e.hint})]}):t.jsx($n,{destructive:e.kind==="remove",onSelect:a,"data-integration-menu":e.kind,children:e.label})]}));function Bd(e,s,a){return!s||s.status==="running"?s?.browser_opened===!0?{message:n("ui.settings.integrations.integration_sign_in_dialog.your_browser_opened_approve_access_to_name_there_then_come_back_h",{name:String(e)}),tone:"progress",link:s.authorization_url??null}:s?.browser_opened===!1?{message:s.authorization_url?n("ui.settings.integrations.integration_sign_in_dialog.your_browser_didn_t_open_open_this_link_to_approve_access"):n("ui.settings.integrations.integration_sign_in_dialog.your_browser_didn_t_open_and_no_link_was_provided_cancel_and_try_"),tone:"progress",link:s.authorization_url??null}:{message:n("ui.settings.integrations.integration_sign_in_dialog.waiting_for_you_to_approve_access_to_name",{name:String(e)}),tone:"progress",link:s?.authorization_url??null}:s.status==="complete"?{message:n("ui.settings.integrations.integration_sign_in_dialog.signed_in_to_name_agents_can_use_it_now",{name:String(e)}),tone:"success",link:null}:s.status==="cancelled"?{message:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_cancelled"),tone:"failure",link:null,reason:null,nextStep:n("ui.settings.integrations.integration_sign_in_dialog.press_try_again_when_you_are_ready")}:{message:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_didn_t_finish"),tone:"failure",link:null,reason:ad(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:qd(s.message??null,a)}}function qd(e,s){const a=(e??"").toLowerCase();return a.includes("redirect")?s?n("ui.settings.integrations.integration_sign_in_dialog.this_server_may_not_accept_sign_ins_from_local_operator_check_the"):n("ui.settings.integrations.integration_sign_in_dialog.this_server_may_not_accept_sign_ins_from_local_operator_check_the_2"):a.includes("no oauth")||a.includes("authorization server")?s?n("ui.settings.integrations.integration_sign_in_dialog.this_server_doesn_t_publish_a_browser_sign_in_add_its_key_instead"):n("ui.settings.integrations.integration_sign_in_dialog.this_server_doesn_t_publish_a_browser_sign_in_check_the_server_s_"):a.includes("network")||a.includes("connect")?n("ui.settings.integrations.integration_sign_in_dialog.check_the_server_s_url_and_your_network_then_try_again"):n("ui.settings.integrations.integration_sign_in_dialog.check_the_server_s_settings_then_try_again")}function Hd(e,s){return e.kind==="ready"?"ready":e.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const Vd=({name:e,action:s,keyRoute:a,phase:i,onStart:r,onCancel:o,onOpenLink:c,onClose:u})=>{se();const d=i.kind==="running"?i.operation:null,m=i.kind==="running"?Bd(e,d,a):null,_=i.kind==="starting"||i.kind==="running"&&m?.tone==="progress",f=m&&m.tone!=="progress",x=l.useRef(null),h=l.useRef(!1),b=Hd(i,m);l.useEffect(()=>{if(!h.current){h.current=!0;return}b&&x.current?.focus()},[b]);const v=()=>u(m?.tone==="success"?"signed-in":"dismissed");return t.jsx(ys,{open:!0,onClose:v,maxWidth:"xs",fullWidth:!0,title:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_to_name",{name:String(e)}),dialogProps:{onOpenAutoFocus:w=>{w.preventDefault(),x.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[_&&d?t.jsx(Xt,{ref:x,onClick:()=>o(d.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(Xt,{ref:i.kind==="ready"?void 0:x,onClick:v,children:m?.tone==="success"?n("ui.settings.integrations.integration_sign_in_dialog.done"):n("ui.settings.integrations.integration_sign_in_dialog.close")}),i.kind==="ready"?t.jsx(en,{ref:x,onClick:r,children:n("ui.settings.integrations.integration_sign_in_dialog.continue_in_browser")}):null,i.kind==="refused"||m?.tone==="failure"?t.jsx(en,{ref:m?.tone==="failure"?x:void 0,onClick:r,children:n("ui.settings.integrations.integration_sign_in_dialog.try_again")}):null]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted","aria-live":"polite",children:[i.kind==="ready"?t.jsx("p",{className:"-mx-1.5",children:n("ui.settings.integrations.integration_sign_in_dialog.browser_approval_notice",{name:e,replaces:s==="reauth"?"yes":"no"})}):null,i.kind==="starting"?t.jsxs("p",{className:"-mx-1.5 flex items-center gap-2",children:[t.jsx(ke,{size:"xs"}),n("ui.settings.integrations.integration_sign_in_dialog.starting_sign_in")]}):null,m?t.jsxs("div",{className:"flex flex-col gap-1",role:f?"status":void 0,children:[t.jsxs("p",{className:(m.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[m.tone==="progress"?t.jsx(ke,{size:"xs",className:"mt-0.5"}):null,m.tone==="failure"?t.jsx(nr,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,t.jsx("span",{children:m.message})]}),m.reason?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.reason}):null,m.nextStep?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.nextStep}):null]}):null,m?.link&&m.tone==="progress"?t.jsxs("div",{className:"flex flex-col items-start gap-1",children:[t.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[t.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-ink-dim text-mono-sm",title:m.link,children:m.link}),t.jsx(z,{variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_sign_in_dialog.copy_the_sign_in_link"),title:n("ui.settings.integrations.integration_sign_in_dialog.copy_the_sign_in_link"),onClick:()=>{navigator.clipboard.writeText(m.link??"").then(()=>tn(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:t.jsx(xs,{"aria-hidden":"true"})})]}),t.jsx(z,{variant:"link",size:"sm",onClick:()=>c(m.link??""),children:n("ui.settings.integrations.integration_sign_in_dialog.open_the_sign_in_page")})]}):null,i.kind==="refused"?t.jsx("p",{className:"text-danger",role:"alert",children:i.message}):null]})})},Gd=e=>e.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),Qd=/^[A-Za-z]:[\\/]/,Ct=e=>{const s=e?.trim();return s&&(s.startsWith("/")||Qd.test(s))?s:null};function Wd(e){const r=e?.payload?.frontend?.snapshot?.cwd;return typeof r=="string"&&r.trim()?r:null}const rt="local-operator.settings.integrations.last-cwd";function Yd(e,s,a=typeof localStorage>"u"?null:localStorage){const i=Ct(s);if(!(!e||!i||!a))try{const r=a.getItem(rt),o=r?JSON.parse(r):{};if(o[e]===i)return;a.setItem(rt,JSON.stringify({...o,[e]:i}))}catch{}}const sa=()=>typeof localStorage>"u"?null:localStorage;function aa(e=sa()){if(!e)return{};try{const s=e.getItem(cn);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const is=256;function Zd(e,s=sa()){if(s)try{const a={...aa(s),...e},i=Object.keys(a);if(i.length>is){const r={};for(const o of i.slice(-is))r[o]=a[o];s.setItem(cn,JSON.stringify(r));return}s.setItem(cn,JSON.stringify(a))}catch{}}function rs(e,s,a){if(e==="saved")return null;if(e==="replace_confirmation_required"){const r=Ws(Object.keys(a).length);return n("ui.settings.integrations.use_integrations.a_saved_value_already_exists_for_this_key_tick_label_to_overwrite",{label:String(r)})}if(e==="invalid_target")return n("ui.settings.integrations.use_integrations.that_header_can_t_carry_this_key_it_may_already_be_set_on_the_ser");const i=s.length?s:Object.keys(a);return n("ui.settings.integrations.use_integrations.keys_not_saved",{keys:String(i.join(", "))})}function Jd(e,s=typeof localStorage>"u"?null:localStorage){if(!(!e||!s))try{const a=s.getItem(rt);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const r={...i};delete r[e],s.setItem(rt,JSON.stringify(r))}catch{}}const Xd=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),eu=(e,s)=>s!==null&&e===s?null:e;function tu(e,s=typeof localStorage>"u"?null:localStorage){if(!e||!s)return null;try{const a=s.getItem(rt);if(!a)return null;const r=JSON.parse(a)[e];return typeof r=="string"?r:null}catch{return null}}const nu=e=>e.action==="disconnect"?"disconnected":"connected";function su(e){switch(e.action){case"cancel":return{action:"cancel",operation_id:e.operationId};case"connect":case"disconnect":case"reload":return null;case"test":return{action:"test",name:e.name};default:return{...e,confirmed:!0}}}function au(e){switch(e.action){case"cancel":return{action:"cancel",operation_id:e.operationId};case"test":case"connect":return{action:"connect",name:e.name};case"reload":return{action:"reload",name:e.name};case"add":return e;case"remove":return{...e,confirmed:!0};default:return{action:e.action,name:e.name,confirmed:!0}}}function iu({sessionId:e}){const s=Lt(),a=st(s.data,"mcp_catalog"),i=st(s.data,"mcp"),r=a?"catalog":i?"session":null,[o,c]=l.useState(null),u=fn(),d=tt(I=>I.sessions),m=tt(I=>I.fetchSessions),_=tt(I=>I.loading),f=l.useMemo(()=>d.find(I=>I.session_id===e)??null,[d,e]),x=l.useMemo(()=>r==="session"&&!e?Gd(d):null,[r,e,d]),h=r==="session"?e??x?.session_id??null:null;l.useEffect(()=>{r!=="session"||e||d.length>0||m(xi)},[r,e,d.length,m]);const b=r==="catalog"?Ct(f?.cwd):null,v=r==="catalog"&&!!e&&b===null,w=Ce({queryKey:["desktop","session-cwd",e??""],queryFn:()=>pe({op:"sessions.get",sessionId:e??""}),enabled:v,staleTime:Number.POSITIVE_INFINITY,retry:!1}),L=v&&!w.isFetched,M=b??Ct(Wd(w.data))??(w.isFetched?Ct(tu(e)):null),T=eu(M,o),N=r==="catalog"?T:null,C=r==="catalog"?e??null:null,S=Ea.catalog(N,C);l.useEffect(()=>{r!=="catalog"||!e||!N||Yd(e,N)},[r,e,N]);const B=l.useRef(0),[q,O]=l.useState(0),$=l.useRef(null),W=l.useCallback((I,G)=>{const D=Date.now()+es;B.current=D,$.current={name:I,expect:G},O(D)},[]),U=l.useCallback(I=>Date.now()<B.current?ta:xd(I),[]),P=Ce({queryKey:S,queryFn:()=>Ra(N,C),enabled:r==="catalog"&&!L,staleTime:1e4,refetchInterval:I=>U(I.state.data)}),V=Xd(P.error);l.useEffect(()=>{!V||!M||o===M||(c(M),Jd(e))},[V,M,o,e]);const K=Ce({queryKey:nn.list(h??""),queryFn:()=>Ta(h??""),enabled:r==="session"&&!!h,staleTime:1e4,refetchInterval:I=>U(I.state.data?dn(I.state.data,h??""):void 0)}),H=l.useMemo(()=>{if(r==="catalog")return P.data;if(r==="session"&&K.data&&h)return dn(K.data,h)},[r,P.data,K.data,h]),X=l.useCallback(()=>ru({queryClient:u,route:r,catalogKey:S,sessionId:h}),[r,S,u,h]);l.useEffect(()=>{if(!q)return;const I=$.current;if(!I)return;const G=H?.servers.find(ie=>ie.name===I.name);!G||!(I.expect==="connected"?G.status==="connected":G.status_basis==="live"&&G.status!=="connected")||(B.current=0,$.current=null,O(0))},[H,q]);const g=l.useRef({}),[k,y]=l.useState(0),E=l.useMemo(()=>(g.current=ud(_d(g.current,H,aa()),H),g.current),[H,k]),J=l.useRef("");l.useEffect(()=>{const I=md(E,H);if(!Object.keys(I).length)return;const G=JSON.stringify(I);G!==J.current&&(J.current=G,Zd(I))},[E,H]);const Y=l.useCallback(I=>{const G=Ke(g.current,I);G.needsKey||(g.current={...g.current,[I]:{...G,needsKey:!0}},y(D=>D+1))},[]),te=l.useCallback(I=>{if(I.action!=="disconnect"&&I.action!=="connect"&&I.action!=="reload")return;const G=Ke(g.current,I.name),D=Date.now()+es,ie=I.action==="disconnect"?{...G,connectedAt:null,disconnectedAt:Date.now(),holdUntil:D}:{...G,disconnectedAt:null,holdUntil:D};g.current={...g.current,[I.name]:ie},W(I.name,nu(I)),y(le=>le+1)},[W]),ne=l.useCallback(async I=>{if(r==="catalog"){const G=su(I);if(!G)return null;try{const D=await Aa(N,G);return u.setQueryData(S,D),te(I),D.operation?.id??null}catch(D){throw D instanceof hn&&D.status===409&&u.invalidateQueries({queryKey:S}),D}}if(r==="session"&&h){const G=await pe({op:"mcp.control",sessionId:h,control:au(I)});te(I);const D=nn.list(h),ie=G?.data;return ie&&"servers"in ie&&Array.isArray(ie.servers)?(u.setQueryData(D,ie),null):(u.invalidateQueries({queryKey:D}),ie&&"id"in ie&&typeof ie.id=="string"?ie.id:null)}return null},[r,N,S,u,h,te]),re=l.useCallback(async I=>{if(r==="catalog"&&C&&(I.action==="connect"||I.action==="disconnect"||I.action==="reload")){try{await pe({op:"mcp.control",sessionId:C,control:{action:I.action,name:I.name,...I.action==="disconnect"?{confirmed:!0}:{}}})}catch(G){throw u.invalidateQueries({queryKey:S}),G}return te(I),await u.invalidateQueries({queryKey:S}),null}return ne(I)},[r,C,u,S,ne,te]),fe=l.useCallback(async(I,G,D,ie)=>{if(r==="catalog"){const le=await Ia(N,I,G,D,ie);if(le.catalog&&u.setQueryData(S,le.catalog),le.code!=="saved")return{saved:!1,message:rs(le.code,le.failed_ids,G)};try{await ne({action:"test",name:I})}catch{}return{saved:!0,message:null}}if(r==="session"&&h){const le=await pe({op:"mcp.credentials.store",sessionId:h,name:I,values:G,confirmedReplace:D});if(le.data?.code!=="saved")return{saved:!1,message:rs(le.data?.code,le.data?.failed_ids??[],G)};try{await ne({action:"connect",name:I})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[r,N,S,u,ne,h]),Ne=r==="catalog"?P:K,xe=l.useCallback(()=>{Ne.refetch()},[Ne]);return{enabled:r!==null,route:r,sessionId:r==="catalog"?C:h,borrowed:x,noConversation:r==="session"&&!h&&!_,document:H,isLoading:s.isLoading||r==="catalog"&&(L||P.isLoading)||r==="session"&&(h?K.isLoading:_),isError:Ne.isError,folderUnavailable:gd(o,M),refetch:xe,readDocument:X,control:re,storeKeys:fe,memories:E,markNeedsKey:Y}}function ru(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const s=e.queryClient.getQueryData(nn.list(e.sessionId));return s?dn(s,e.sessionId):void 0}}const ou=(e,s)=>{const a=e?.trim();if(!a)return null;const i=Oa(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},lu=6,Wt="ui.settings.integrations.mcp_management_section.copy_section_title",cu="ui.settings.integrations.mcp_management_section.copy_section_description",du={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},uu=({sessionId:e,sectionRef:s,highlightServer:a})=>{se();const i=iu({sessionId:e}),{document:r,control:o,readDocument:c}=i,u=Ns(),d=r?.servers??[],m=r?.operations??[],_=r?.project_scope_available??!1,[f,x]=l.useState(!1),[h,b]=l.useState(""),[v,w]=l.useState(null),[L,M]=l.useState({}),[T,N]=l.useState(null),[C,S]=l.useState(null),[B,q]=l.useState({kind:"ready"}),[O,$]=l.useState(null),[W,U]=l.useState(null),[P,V]=l.useState(!1),K=l.useRef({}),H=l.useRef({}),X=l.useRef({}),g=l.useRef(0),k=l.useRef(null),y=l.useRef(null),E=l.useRef(null),[J,Y]=l.useState(null),[te,ne]=l.useState(null),[re,fe]=l.useState(null),Ne=l.useCallback(()=>{const p=E.current;E.current=null,S(null),$(null),window.setTimeout(()=>{p?.isConnected&&p.focus()},0)},[]),xe=l.useCallback(p=>{const j=window.document.activeElement;E.current=j instanceof HTMLElement?j:null,S(p)},[]),I=l.useCallback((p,j)=>{ne({name:p,waitForSignIn:j==="signed-in",until:Date.now()+Xe,reanchors:0}),Ne()},[Ne]),G=l.useMemo(()=>ou(a,d.map(p=>p.name)),[a,d]),D=G?.kind==="matched"?G.name:null,ie=l.useRef(null),le=l.useRef(null),ze=h.trim().toLowerCase(),ye=l.useMemo(()=>ze?d.filter(p=>p.name.toLowerCase().includes(ze)):d,[d,ze]),je=dd(ye,m,i.memories),Ae=C?.kind==="sign_in"?d.find(p=>p.name===C.name)??null:null;l.useEffect(()=>{!D||le.current===D||!h||b("")},[D,h]),l.useEffect(()=>{!D||le.current===D||ye.some(p=>p.name===D)&&(le.current=D,ie.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[D,ye]),l.useEffect(()=>{if(!O)return;const p=m.find(j=>j.id===O)??null;q({kind:"running",operation:p})},[m,O]);const Ie=m.some(p=>p.status==="running"),Q=p=>{const j=window.document.activeElement;j&&j!==window.document.body&&j.isConnected||ne({name:p,waitForSignIn:!1,until:Date.now()+Xe,reanchors:0})},ee=async(p,j,A)=>{w(p),M(({[p]:be,...he})=>he);let Z=null,oe=!1;try{Z=await A()}catch(be){oe=!0,M(he=>({...he,[p]:vt(du[j]??"status",be,Ie)}))}finally{w(null),j!=="sign_out"&&(j!=="remove"||oe)&&Q(p)}return{operationId:Z,failed:oe}},ce=p=>d.find(j=>j.name===p),me=p=>{p.source.path&&Fa(p.source.path)},Oe=async(p,j)=>{q({kind:"starting"}),$(null);try{const A=await o({action:j,name:p});A?$(A):q({kind:"running",operation:null})}catch(A){A instanceof hn&&A.code==="oauth_unsupported"&&i.markNeedsKey(p),q({kind:"refused",message:vt("grant",A,Ie)})}},ue=(p,j)=>{switch(j.kind){case"sign_in":case"reauth":{const A=m.find(Z=>Z.name===p.name&&Z.status==="running");A&&ct(A)?(q({kind:"running",operation:A}),$(A.id)):(q({kind:"ready"}),$(null)),xe({kind:"sign_in",name:p.name,action:j.kind==="reauth"?"reauth":"login"});return}case"set_key":U(null),xe({kind:"key",name:p.name,keyNames:p.auth.secret_refs.map(A=>A.id)});return;case"fix":me(p);return;case"sign_out":N({name:p.name,kind:"sign_out"});return;default:{const A=j.kind;ee(p.name,A,()=>o({action:A,name:p.name}))}}},dt=(p,j)=>{switch(j.kind){case"remove":case"sign_out":N({name:p.name,kind:j.kind});return;case"sign_in":case"reauth":case"set_key":ue(p,{kind:j.kind,label:j.label});return;case"open_config":me(p);return;case"copy_setup":navigator.clipboard.writeText(p.setup_prompt??"").then(()=>tn(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const A=m.find(Z=>Z.name===p.name&&Z.status==="running");A&&ee(p.name,"cancel",()=>o({action:"cancel",operationId:A.id}));return}case"test":case"connect":case"disconnect":case"reload":{const A=j.kind;ee(p.name,A,()=>o({action:A,name:p.name}));return}default:return}},Dt=(p,j)=>{if(N(null),j==="remove"){const A=p.source.owned_scope;if(!A)return;const Z=ye.findIndex(oe=>oe.name===p.name);ee(p.name,"remove",()=>o({action:"remove",name:p.name,scope:A})).then(({operationId:oe,failed:be})=>{be||oe!==null||(tn(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(p.name)})),Z>=0&&fe({index:Z}))});return}ee(p.name,"sign_out",()=>o({action:"logout",name:p.name})).then(()=>{ne({name:p.name,waitForSignIn:!1,until:Date.now()+Xe,reanchors:0})})},ut=async p=>{try{return await o({action:"add",name:p.name,scope:p.scope,...p.mode==="command"?{command:p.command,args:p.args}:{url:p.url}}),x(!1),Y(p.name),null}catch(j){return vt("add",j,!1)}},Qe=t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h2",{className:"text-heading text-ink",children:n(Wt)}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(cu)})]}),i.enabled&&d.length>0&&!f?t.jsxs(z,{ref:k,variant:"secondary",size:"sm",onClick:()=>x(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(On,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(ge,{title:n(Wt),titleComponent:Qe,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),children:t.jsx(ae,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const gt=t.jsx(Cd,{existingNames:d.map(p=>p.name),projectScopeAvailable:_,projectLabel:r?.cwd?mu(r.cwd):null,onSubmit:ut,onCancel:()=>{x(!1),window.setTimeout(()=>k.current?.focus(),0)}}),mt=C?ce(C.name):void 0,_t=Object.entries(L).filter(([p])=>!d.some(j=>j.name===p)),pt=p=>M(({[p]:j,...A})=>A);l.useEffect(()=>{if(!J)return;const p=K.current[J];if(!p){d.some(j=>j.name===J)&&(H.current[J]?.focus(),Y(null));return}p.focus(),Y(null)},[J,d]),l.useEffect(()=>{if(!re)return;const j=ye[Math.min(re.index,ye.length-1)]??ye.at(-1);if(j){const A=K.current[j.name]??H.current[j.name];if(!A)return;A.focus()}else k.current?.focus();fe(null)},[re,ye]);const R=l.useCallback((p,j)=>{const A=c()??r,Z=A?.servers.find(Re=>Re.name===p.name),oe=A?.operations??[],be=Z?Z.status==="connecting"||Ge(Z.name,oe)!==null:!1;be&&Z&&(g.current=j);const he=Z?Mn(Z,oe,i.memories):null;if(Z&&p.waitForSignIn&&(he?.kind==="sign_in"||he?.kind==="reauth"))return"kept";const we=Rd({hold:p,now:j,windowMs:Xe,rowMoving:be,lastMovingAt:g.current,candidate:Z?Ld({primary:he?K.current[Z.name]:null,overflow:H.current[Z.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!we.hold)return ne(null),"finished";if(!we.land)return"kept";ne({name:p.name,waitForSignIn:!1,until:we.hold.until,landedOn:we.land,reanchors:we.hold.reanchors});const Se=we.land;return window.setTimeout(()=>{Se.isConnected&&Se.focus()},0),"landed"},[c,r,i.memories]);return l.useEffect(()=>{if(!te)return;R(te,Date.now());let p=0,j=!1;const A=()=>{if(j)return;const Z=Od({verdict:R(te,Date.now()),watchMs:ns});Z!==null&&(p=window.setTimeout(A,Z))};return p=window.setTimeout(A,ns),()=>{j=!0,window.clearTimeout(p)}},[te,R]),l.useEffect(()=>{if(!te)return;const p=j=>{Td({target:j.target,row:X.current[te.name]})&&ne(null)};return window.document.addEventListener("pointerdown",p,!0),()=>{window.document.removeEventListener("pointerdown",p,!0)}},[te]),t.jsxs(ge,{title:n(Wt),titleComponent:Qe,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[i.route==="session"&&i.borrowed?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.borrowed_chat_notice",{chat:i.borrowed.title?.trim()||i.borrowed.session_id.slice(0,6)})}):null,i.noConversation?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_can_be_managed_here_once_a_chat_has_started")}),t.jsx(z,{variant:"primary",size:"sm",onClick:()=>u("/chat"),children:n("ui.settings.integrations.mcp_management_section.start_a_chat")}),t.jsx("p",{className:"text-ink-dim text-meta",children:n("ui.settings.integrations.mcp_management_section.updating_local_operator_removes_this_step")})]}):null,i.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(ke,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?t.jsx(ae,{variant:"warning",children:t.jsx("span",{children:n("ui.settings.integrations.mcp_management_section.this_chat_s_folder_no_longer_exists_so_only_global_integrations_a")})}):null,i.isError?t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n("ui.settings.integrations.mcp_management_section.integrations_couldn_t_be_loaded")}),t.jsx(z,{variant:"secondary",size:"sm",onClick:i.refetch,children:n("ui.settings.integrations.mcp_management_section.retry")})]})}):null,_t.map(([p,j])=>t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:j}),t.jsx(z,{variant:"ghost",size:"sm",onClick:()=>pt(p),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},p)),f&&d.length>0?gt:null,d.length>=lu?t.jsxs("div",{className:"relative",children:[t.jsx(_n,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Le,{ref:y,value:h,onChange:p=>b(p.target.value),onKeyDown:p=>{p.key!=="Escape"||!h||(p.preventDefault(),b(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:Vc(d.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"ps-9"})]}):null,G?.kind==="miss"&&d.length>0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.no_match_for_name",{asked:String(G.asked)})}):null,G?.kind==="matched"&&G.unresolved?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.showing_fallback_for_unknown",{shown:String(G.name),asked:String(G.unresolved)})}):null,r&&d.length===0&&!i.isLoading?f?gt:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(bs,{"aria-hidden":"true",className:"size-5 text-ink-muted"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.integrations.mcp_management_section.no_integrations_yet")}),t.jsx("p",{className:"max-w-xl text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_let_agents_read_and_act_in_your_other_tools_like_not")})]}),t.jsxs(z,{variant:"primary",size:"md",onClick:()=>x(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(On,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,d.length>0&&ye.length===0?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.no_integrations_match_this_search")}),t.jsx(z,{variant:"secondary",size:"sm",onClick:()=>{b(""),window.setTimeout(()=>{(y.current??k.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,je.map(p=>t.jsxs("section",{"aria-labelledby":`integrations-group-${p.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${p.id}`,className:"px-1 text-ink-dim text-meta",children:[p.title," · ",p.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:p.rows.map(j=>t.jsx(Kd,{row:j,operations:m,memories:i.memories,projectScopeAvailable:_,highlighted:j.name===D,rowRef:A=>{X.current[j.name]=A,j.name===D&&(ie.current=A)},primaryRef:A=>{K.current[j.name]=A},overflowRef:A=>{H.current[j.name]=A},pending:v===j.name,failure:L[j.name]??null,confirm:T?.name===j.name?{kind:T.kind}:null,onPrimary:A=>ue(j,A),onOverflow:A=>dt(j,A),onConfirm:()=>T&&Dt(j,T.kind),onCancelConfirm:()=>{N(null),window.setTimeout(()=>{H.current[j.name]?.focus()},0)}},j.id))})]},p.id))]}),C?.kind==="sign_in"?t.jsx(Vd,{name:C.name,action:C.action,keyRoute:Ae?Ot(Ae):!1,phase:B,onStart:()=>void Oe(C.name,C.action),onCancel:p=>void o({action:"cancel",operationId:p}).catch(()=>{}),onOpenLink:p=>void La(p),onClose:p=>I(C.name,p)}):null,C?.kind==="key"?t.jsx(zd,{name:C.name,keyNames:C.keyNames.length?C.keyNames:mt?.auth.secret_refs.map(p=>p.id)??[],keyless:C.keyNames.length===0,savedKeys:mt?.auth.secret_refs.filter(p=>p.state==="encrypted").map(p=>p.id),saving:P,failure:W,onClose:Ne,onSave:(p,j,A)=>{V(!0),U(null),i.storeKeys(C.name,p,j,A).then(Z=>{if(!Z.saved){U(Z.message);return}S(null),ne({name:C.name,waitForSignIn:!1,until:Date.now()+Xe,reanchors:0})}).catch(Z=>U(vt("key",Z,!1))).finally(()=>V(!1))}}):null]})},Xe=4e3,gu=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,mu=e=>e.replace(gu,"~"),_u=({verification:e})=>{se();const{prices:s}=za(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:r}=$a(e.signup_grant,Pa(a)),o=Ka(e.claim_url,Ua);return t.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[t.jsx(Tt,{className:"mt-0.5 size-4 shrink-0 text-ink-muted","aria-hidden":"true"}),t.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:i}),t.jsx(z,{variant:"secondary",size:"sm",onClick:()=>Ba(o),children:r})]})]})},pu=({onAfterCredentialUpdate:e})=>{se();const{isAuthenticated:s,user:a,isLoading:i,accountRead:r,signOut:o}=Da(),c=vs(f=>f.isSigningOut),u=l.useCallback(async()=>{try{await o()}catch(f){console.error("Error signing out:",f)}},[o]),d=(()=>{if(!s||!a?.radientUser)return null;const{account:f,identity:x,verification:h}=a.radientUser,b=h!=null&&!h.email_verified&&h.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsxs(ot,{children:[t.jsx(_e,{label:n("ui.settings.account.radient_account_section.status"),value:t.jsxs("span",{className:"inline-flex items-center gap-2",children:[n("ui.settings.account.radient_account_section.connected"),t.jsx(it,{variant:"success",className:"capitalize",children:f.status})]})}),t.jsx(_e,{label:n("ui.settings.account.radient_account_section.name"),value:f.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(_e,{label:n("ui.settings.account.radient_account_section.email"),value:f.email}),t.jsx(_e,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.id})}),t.jsx(_e,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.tenant_id})}),t.jsx(_e,{label:n("ui.settings.account.radient_account_section.provider"),value:t.jsx("span",{className:"capitalize",children:x.provider})}),t.jsx(_e,{label:n("ui.settings.account.radient_account_section.created"),value:ks(f.created_at)})]}),b&&h?t.jsx(_u,{verification:h}):null,t.jsx("div",{className:"mt-8",children:t.jsx(Ii,{offerSignIn:!0})}),t.jsxs("div",{className:"mt-8",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.radient_account_section.need_to_sign_out_or_switch_accounts")}),t.jsxs(z,{variant:"danger",className:"mt-3",onClick:u,children:[t.jsx(Ri,{}),n("ui.settings.account.radient_account_section.sign_out_from_radient")]})]})]})})(),m=r==="refused"?n("ui.settings.account.radient_account_section.radient_refused_the_sign_in_this_app_is_holding_so_your_account_d"):js(r)?n("ui.settings.account.radient_account_section.your_radient_account_could_not_be_read_so_this_app_cannot_show_yo"):n("ui.settings.account.radient_account_section.you_are_not_currently_signed_in_to_radient"),_=s&&a?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[m," ",n("ui.settings.account.radient_account_section.sign_in_to_access_your_account_details_or_sign_up_to_get_free_cre")]}),t.jsx("div",{className:"mt-6",children:t.jsx(cr,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]});return i||c?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(ke,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!c&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.account.radient_account_section.loading_your_radient_account_details")})]}):s&&a?.radientUser?d:t.jsx("div",{className:"flex flex-col gap-4",children:_})},Yt={label:1,synonym:.8,key:.75,choice:.7,section:.6,description:.4},fu={exact:1,prefix:.92,substring:.7,subsequence:.45};function ia(e){return e.length<4||!e.endsWith("s")?e:/(?:ch|sh|ss|x|z)es$/.test(e)?e.slice(0,-2):e.slice(0,-1)}function os(e){let s=!1;const a=e.split(" ").map(i=>{const r=ia(i);return r!==i&&(s=!0),r}).join(" ");return s?a:e}const ls=new WeakMap,cs={exact:3,prefix:2,substring:1};function hu(e,s,a){const i=ia(a),r=[ft(e,a)];i!==a&&r.push(ft(e,i)),s!==e&&(r.push(ft(s,a)),i!==a&&r.push(ft(s,i)));let o=null;for(const c of r)!c||c==="subsequence"||(!o||cs[c]>cs[o])&&(o=c);return o}const xu=12,yu=2;function bu(e,s){let a=0,i=-1,r=null,o=ls.get(e.fields);if(!o){o={};for(const c of Object.keys(Yt)){const u=e.fields[c];u&&(o[c]=os(u))}ls.set(e.fields,o)}for(const c of s){let u=-1,d=null;for(const m of Object.keys(Yt)){const _=e.fields[m];if(!_)continue;const f=hu(_,o[m]??os(_),c);if(!f)continue;const x=Yt[m]*fu[f];x>u&&(u=x,d=m)}if(d===null)return null;a+=u,u>i&&(i=u,r=d)}return r?{score:a,reason:r}:null}function vu(e,s,a=xu){const i=Ti(s);if(i.length===0)return{results:[],total:0};const r=at(s),o=[];for(const c of e){const u=bu(c,i);if(!u)continue;const d=c.fields.label!==""&&c.fields.label===r;o.push({entry:c,reason:u.reason,score:d?u.score+yu:u.score})}return o.sort((c,u)=>u.score-c.score||c.entry.fields.label.length-u.entry.fields.label.length||c.entry.order-u.entry.order),{results:o.slice(0,Math.max(0,a)).map(({entry:c,reason:u})=>({entry:c,reason:u})),total:o.length}}function ku(e){return at(e)===""}function ju(e){const s=new Map;for(const r of e){const o=r.entry.sectionId||"",c=s.get(o);if(c){c.results.push(r);continue}s.set(o,{sectionId:o,sectionLabel:r.entry.sectionLabel,results:[r]})}const a=[...s.values()],i=a.filter(r=>r.sectionId==="");return[...a.filter(r=>r.sectionId!==""),...i]}const wu={label:"ui.settings.search.reason.label",synonym:"ui.settings.search.reason.synonym",key:"ui.settings.search.reason.key",choice:"ui.settings.search.reason.choice",section:"ui.settings.search.reason.section",description:"ui.settings.search.reason.description"};function Nu(e){const{registry:s,sections:a,build:i=gc}=e,r=se();return l.useMemo(()=>i({registry:s,sections:a}),[i,s,a,r])}function Su(){return qa()==="mac"?"⌘F":"Ctrl+F"}const Mu=l.forwardRef(function({index:s,readRendered:a,onJump:i,onDismiss:r,className:o},c){se();const u=l.useRef(null),d=l.useRef(null),[m,_]=l.useState(null),[f,x]=l.useState(""),[h,b]=l.useState(!1),[v,w]=l.useState(-1),[L,M]=l.useState(""),T=l.useId();l.useImperativeHandle(c,()=>({focus:()=>{u.current?.focus(),b(!0)}}));const N=l.useCallback(()=>a?.()??[],[a]),C=l.useCallback(()=>{_(N())},[N]),S=l.useCallback(()=>{_(y=>y??N())},[N]),B=l.useCallback(()=>{const y=m;return y&&y.length>0?[...s,...y]:s},[s,m]),q=ku(f),{results:O,total:$}=l.useMemo(()=>vu(B(),f),[B,f]),W=l.useMemo(()=>ju(O),[O]),U=v<0||O.length===0?-1:Math.min(v,O.length-1),P=U>=0?O[U]:void 0,V=l.useMemo(()=>new Map(O.map((y,E)=>[y.entry.id,E])),[O]),K=l.useCallback(y=>{y!==void 0&&x(y),b(!1),w(-1),r?.()},[r]),H=l.useCallback(async y=>{if(await i(y)==="missing"){M(n("ui.settings.search.jump.missing"));return}M(""),b(!1),w(-1)},[i]),X=y=>`${T}-option-${y}`,g=y=>{switch(y.key){case"ArrowDown":y.preventDefault(),b(!0),w(E=>O.length===0?-1:E<0?0:(E+1)%O.length);return;case"ArrowUp":y.preventDefault(),b(!0),w(E=>O.length===0?-1:E<0?O.length-1:(E-1+O.length)%O.length);return;case"Home":if(!h)return;y.preventDefault(),w(0);return;case"End":if(!h)return;y.preventDefault(),w(Math.max(0,O.length-1));return;case"Enter":if(y.preventDefault(),!h){b(!0);return}{const E=P??O[0];E&&H(E.entry)}return;case"Escape":if(y.preventDefault(),f!==""){x(""),M(""),w(-1);return}K();return;default:return}},k=q?"":n("ui.settings.search.results.count",{count:$});return t.jsxs("div",{ref:d,className:de("relative @container w-full",o),onBlur:y=>{const E=y.relatedTarget;E&&d.current?.contains(E)||(b(!1),w(-1),r?.())},children:[t.jsxs("div",{className:"relative",children:[t.jsx(_n,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-ink-dim"}),t.jsx(Le,{ref:u,role:"combobox","aria-expanded":h,"aria-controls":h?T:void 0,"aria-activedescendant":h&&P?X(U):void 0,"aria-autocomplete":"list","aria-label":n("ui.settings.search.field.label"),placeholder:n("ui.settings.search.field.placeholder"),value:f,type:"text",className:"pl-8",onFocus:()=>{C(),b(!0)},onChange:y=>{S(),x(y.currentTarget.value),w(-1),M(""),b(!0)},onKeyDown:g})]}),h&&t.jsxs("div",{id:T,role:"listbox",tabIndex:-1,"aria-label":n("ui.settings.search.panel.label"),className:"absolute top-full right-0 z-40 mt-2 flex max-h-[min(24rem,60vh)] w-full min-w-80 flex-col overflow-y-auto rounded-md border border-hairline bg-elevated p-1 shadow-overlay",children:[L&&t.jsx("p",{"data-search-notice":"","aria-hidden":"true",className:"px-2 pt-2 pb-1 text-body-sm text-ink",children:L}),q?t.jsxs("div",{className:"flex flex-col gap-1 px-2 py-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.empty.summary")}),t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.search.empty.shortcut",{shortcut:Su()})})]}):O.length===0?t.jsxs("div",{className:"flex flex-col gap-2 px-2 py-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.no_results.title",{query:f})}),t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.search.no_results.hint")}),t.jsx("button",{type:"button",className:"min-h-6 w-fit rounded-sm px-1.5 py-1 text-body-sm text-accent underline-offset-2 hover:underline focus-visible:outline-2",onMouseDown:y=>y.preventDefault(),onClick:()=>{K(""),u.current?.focus()},children:n("ui.settings.search.no_results.clear")})]}):t.jsxs(t.Fragment,{children:[W.map(y=>t.jsxs("div",{role:y.sectionLabel?"group":void 0,"aria-label":y.sectionLabel||void 0,children:[y.sectionLabel&&t.jsx("p",{className:"px-2 pt-2 pb-1 font-medium text-ink-muted text-meta",children:y.sectionLabel}),y.results.map(E=>{const J=V.get(E.entry.id)??0,Y=J===U;return t.jsxs("div",{id:X(J),role:"option","aria-selected":Y,"data-search-result-id":E.entry.id,className:de("flex cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 @[40rem]:flex-row @[40rem]:items-baseline @[40rem]:justify-between @[40rem]:gap-4",Y?"bg-accent-wash outline-solid outline-1 -outline-offset-1 outline-control":"hover:bg-row-hover"),onMouseDown:te=>te.preventDefault(),onMouseEnter:()=>w(J),onClick:()=>H(E.entry),children:[t.jsx("span",{className:"min-w-0 text-body-sm text-ink",children:E.entry.label}),t.jsxs("span",{className:"@[40rem]:shrink-0 @[40rem]:text-right text-meta text-ink-dim",children:[E.entry.sectionLabel&&n("ui.settings.search.row.section_hint",{section:E.entry.sectionLabel}),E.entry.sectionLabel&&" · ",n(wu[E.reason]),E.entry.detail&&E.entry.detail!==E.entry.sectionLabel&&t.jsxs(t.Fragment,{children:[" · ",E.entry.detail]})]})]},E.entry.id)})]},y.sectionId||"no-section")),$>O.length&&t.jsx("p",{"data-search-more":"",className:"px-2 pt-1 pb-2 text-meta text-ink-dim",children:n("ui.settings.search.results.more",{count:$-O.length})})]})]}),t.jsx("output",{"aria-live":"polite",className:"sr-only",children:L||k})]})});function Cu({metric:e,data:s}){return se(),t.jsx(Ha,{title:"",heightClassName:"h-62",yAxisWidth:48,unit:e==="credits"?"credits":"tokens",srSummary:e==="credits"?n("ui.settings.account.settings_usage_chart.credits_summary",{days:s.length}):n("ui.settings.account.settings_usage_chart.tokens_summary",{days:s.length}),xTickFormatter:a=>a,yTickFormatter:a=>e==="credits"?`$${a.toFixed(2)}`:Va(a),children:t.jsx(Sl,{data:s,children:t.jsx(ps,{type:"monotone",dataKey:"value",strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:e==="credits"?n("ui.settings.account.settings_usage_chart.credits_consumed"):n("ui.settings.account.settings_usage_chart.tokens_used")})})})}const Eu={all:["desktop","tts-path-resolution"]};function Au(e){return Ce({queryKey:Eu.all,queryFn:()=>pe({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:yi})}const Iu=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function ds(e){const s=new Map(e.map(r=>[r.key,r])),a=[],i=[];for(const r of Iu){const o=s.get(r);o?a.push(o):i.push(r)}return{rows:a,missing:i}}const Ru=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function us(e){return typeof e=="string"&&Ru.includes(e)}function Tu(e){if(e===null||typeof e!="object")return null;const s=e;if(!us(s.path)||typeof s.reason!="string"||typeof s.servable!="boolean"||!Array.isArray(s.rungs))return null;const a=[];for(const i of s.rungs){if(i===null||typeof i!="object")return null;const r=i;if(!us(r.path)||typeof r.available!="boolean"||typeof r.reason!="string")return null;a.push({path:r.path,available:r.available,reason:r.reason})}return{path:s.path,reason:s.reason,servable:s.servable,rungs:a}}const Lu={get provider_tts_radient(){return n("ui.settings.speech.speech_settings_model.radient_pass")},provider_tts_elevenlabs:"ElevenLabs",provider_tts_openai:"OpenAI",get none(){return n("ui.settings.speech.speech_settings_model.no_provider")}};function ra(e){return Lu[e]}function Ou(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(s=>({path:s.path,name:ra(s.path),available:s.available,reason:s.reason}))}}const Fu="ui.settings.speech.speech_section.copy_backend_older_sentence",oa="ui.settings.speech.speech_section.copy_unavailable_sentence",Du=({resetErrorBoundary:e})=>(se(),t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:n(oa)}),t.jsxs(z,{variant:"secondary",onClick:e,children:[t.jsx(ar,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function zu(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const $u=({sectionRef:e})=>{se();const s=Lt(),a=ws(),i=bi(s.data,"tts"),r=zu(i),o=Ce({queryKey:Et.all,queryFn:()=>pe({op:"settings.list"}),enabled:r==="ready",staleTime:1e4}),c=Au(r==="ready"),{hasRadientApiKey:u,hasRadientSession:d,speechBlock:m}=Ga(),_=`${d}:${u}`,f=l.useRef(_),x=c.refetch;l.useEffect(()=>{f.current!==_&&(f.current=_,x())},[_,x]);const h=o.data,b=l.useMemo(()=>ds(h?.settings??[]),[h]),[v,w]=l.useState({}),[L,M]=l.useState({}),[T,N]=l.useState({});l.useEffect(()=>{h&&w(g=>{let k=!1;const y={...g};for(const E of ds(h.settings).rows){const J=g[E.key];if(J&&J.value!==Ze(E).value)continue;const Y=Ze(E);J&&J.value===Y.value&&J.cascadeBase===Y.cascadeBase||(y[E.key]=Y,k=!0)}return k?y:g})},[h]);const C=(g,k)=>M(y=>({...y,[g]:k})),S=(g,k)=>N(y=>({...y,[g]:k})),B=async g=>{const k=v[g.key];if(!k)return;const y=Ya(g,k);if(!y.ok){S(g.key,y.error);return}C(g.key,!0),S(g.key,null);try{await pe(y.request),C(g.key,!1);const J=(await o.refetch()).data?.settings.find(Y=>Y.key===g.key);J&&w(Y=>{const te=Y[g.key];return te&&te.value===k.value&&te.cascadeBase===k.cascadeBase?{...Y,[g.key]:Ze(J)}:Y})}catch(E){C(g.key,!1),S(g.key,E instanceof Error?E.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},q=async g=>{C(g.key,!0),S(g.key,null);try{await pe({op:"settings.reset",key:g.key}),w(k=>({...k,[g.key]:Ze({...g,value:g.default,is_default:!0})})),C(g.key,!1),await o.refetch()}catch(k){C(g.key,!1),S(g.key,k instanceof Error?k.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},O=l.useMemo(()=>Tu(c.data),[c.data]),$=O?Ou(O):null,W=c.isSuccess&&O===null,U=(s.data?null:s.error)??null,P=o.error,V=n("ui.settings.speech.speech_section.speech_voicing"),K=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(r==="pairing"){const{sentence:g}=sn(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),U);return t.jsx(ge,{title:V,icon:ht,description:K,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:g})})}if(r==="older")return t.jsx(ge,{title:V,icon:ht,description:K,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:n(Fu)})});if(P||!h){const{sentence:g,remedy:k}=sn(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),P);return t.jsx(ge,{title:V,icon:ht,description:K,sectionRef:e,children:t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:g}),k&&t.jsx(z,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{o.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const H=$?!$.servable:m==="offline",X=$?$.rungs.find(g=>g.path===$.serving)??null:null;return t.jsx(ge,{title:V,icon:ht,description:K,sectionRef:e,searchSection:"speech",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.speech_voicing"),searchIgnore:"speech rows are registry keys read from the daemon's own selection",children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[c.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ke,{}),Ln("checking")]}),(c.isError||W)&&!$&&m!=="offline"&&t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[n(oa)," ",c.error instanceof Error?c.error.message:""]}),t.jsx(z,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{c.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})}),t.jsx(sr,{fallbackRender:Du,resetKeys:[c.dataUpdatedAt],children:$&&t.jsxs(t.Fragment,{children:[t.jsxs(ot,{children:[t.jsx(_e,{label:n("ui.settings.speech.speech_section.speaks_through"),value:$.serving?ra($.serving):n("ui.settings.speech.speech_section.nothing_yet")}),t.jsx(_e,{label:n("ui.settings.speech.speech_section.availability"),value:$.servable?n("ui.settings.speech.speech_section.ready"):n("ui.settings.speech.speech_section.no_provider")})]}),$.reason&&$.reason!==X?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:$.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:$.rungs.map(g=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:g.path===$.serving?"text-ink":"text-ink-muted",children:[g.name,t.jsxs("span",{className:g.path===$.serving?"text-ink-muted":"text-ink-dim",children:[" ",g.available?n("ui.settings.speech.speech_section.available"):n("ui.settings.speech.speech_section.not_available")]})]}),t.jsx("span",{className:"text-meta text-ink-dim",children:g.reason})]},g.path))})]})})]}),H&&t.jsx(ae,{variant:"warning",children:Ln(m)}),t.jsx("div",{className:"flex flex-col gap-1",children:b.rows.map(g=>t.jsx(Qa,{setting:g,draft:v[g.key]??Ze(g),tier:Wa(g),saving:!!L[g.key],error:T[g.key]??null,onDraftChange:k=>w(y=>({...y,[g.key]:k})),onSave:()=>{B(g)},onReset:()=>{q(g)}},g.key))}),b.missing.length>0&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:b.missing.length,rows:b.missing.join(", ")})})]})})},Pu=()=>{se();const{data:e,isLoading:s,error:a,refetch:i}=jl(),r=wl(),[o,c]=l.useState(""),[u,d]=l.useState(!1);l.useEffect(()=>{c(e?.content??""),d(!1)},[e]);const m=b=>{const v=b.target.value;c(v),d(v!==(e?.content??""))},_=async()=>{if(!(!u||r.isPending))try{const b={content:o};await r.mutateAsync(b),await i(),d(!1)}catch(b){console.error("Error updating system prompt:",b)}},f=()=>{c(e?.content??""),d(!1)},x=r.isPending,h=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Te,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(Rs,{id:"app-system-prompt",name:"systemPrompt",value:o,onChange:m,placeholder:n("ui.settings.model.system_prompt.enter_instructions_for_how_all_agents_should_behave_and_respond_t"),className:"min-h-50"})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs(z,{variant:"primary",onClick:_,disabled:!u||x,children:[x?t.jsx(ke,{size:"sm"}):t.jsx(Es,{}),x?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(z,{onClick:f,disabled:!u||x,children:n("ui.settings.model.system_prompt.cancel")})]}),e?.last_modified&&t.jsxs("p",{className:"text-ink-dim text-meta",children:[n("ui.settings.model.system_prompt.last_modified")," ",t.jsx("span",{className:"font-mono text-mono-sm",children:pn(e.last_modified)})]})]});return t.jsx(ge,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:dr,description:n("ui.settings.model.system_prompt.every_local_operator_agent_receives_this_prompt_in_addition_to_it"),children:s?t.jsx("div",{className:"flex min-h-50 items-center justify-center",children:t.jsx(ke,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a?t.jsx(ae,{variant:"danger",children:n("ui.settings.model.system_prompt.load_failed",{reason:a instanceof Error?a.message:n("ui.settings.model.system_prompt.unknown_error")})}):h()})},Ku=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Uu=e=>Ku.includes(e),Bu=e=>{const s=[];let a=0;for(const i of e){const r=Math.max(0,Math.floor(i.count)),o=Math.max(1,Math.floor(i.columns));for(let c=0;c<r;c+=o)s.push({start:a+c,count:Math.min(o,r-c)});a+=r}return s},qu=({index:e,key:s,groups:a})=>{const i=Bu(a),r=i.reduce((o,c)=>o+c.count,0);if(!Number.isInteger(e)||e<0||e>=r)return e;switch(s){case"Home":return 0;case"End":return r-1;case"ArrowLeft":return Math.max(0,e-1);case"ArrowRight":return Math.min(r-1,e+1);case"ArrowUp":case"ArrowDown":{const o=i.findIndex(d=>e>=d.start&&e<d.start+d.count),c=i[o+(s==="ArrowDown"?1:-1)];if(!c)return e;const u=e-i[o].start;return c.start+Math.min(u,c.count-1)}default:return e}},Hu={localOperatorDark:To,localOperatorLight:Xo,dracula:Ho,dune:ro,sage:No,monokai:Oi,tokyoNight:Do,iceberg:Go,radient:yo,neon:Ja,obsidian:Ts,synth:vr,catppuccinMocha:Hr,catppuccinLatte:Eo,tokyoNightStorm:Dr,gruvbox:Er,nord:vl,oneDark:yr,solarizedDark:Zo,rosePine:uo,rosePineMoon:Io,rosePineDawn:Br,alucard:mo,gruvboxLight:Jr,tokyoNightDay:Oo,oneLight:Mo,catppuccinFrappe:Yr,catppuccinMacchiato:vo,palenight:Za,everforest:ml,everforestLight:ul,kanagawaWave:hl,kanagawaLotus:lo,ayuDark:eo,ayuMirage:no,ayuLight:Ko,nightfox:$r,duskfox:sl,synthwave:$o,matrix:jr,tron:Or,cyberpunk:Li,vaporwave:cl,outrun:Mr,neonNoir:pl,arcade:jo,forest:ol,ocean:ao,desert:il,autumn:yl,lavender:Wo,arctic:Kr,rosewood:ho,solarizedLight:tl,githubLight:po,paper:ur,linen:Bo,highContrastLight:hr,mintLight:Nr},gs="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",Vu=({id:e})=>t.jsxs("div",{"data-theme":e,"aria-hidden":"true",className:"flex h-full bg-canvas",children:[t.jsxs("div",{className:"flex w-1/4 flex-col gap-1 bg-sunken p-1",children:[t.jsx("span",{className:"flex h-2.5 items-center rounded-xs bg-accent-wash px-1",children:t.jsx("span",{className:"h-1 w-full rounded-xs bg-accent"})}),t.jsx("span",{className:"mx-1 h-1 w-2/3 rounded-xs bg-ink-dim"}),t.jsx("span",{className:"mx-1 h-1 w-1/2 rounded-xs bg-ink-dim"})]}),t.jsxs("div",{className:"flex flex-1 flex-col justify-between p-1",children:[t.jsxs("div",{className:"flex flex-col gap-1 rounded-xs bg-surface p-1",children:[t.jsx("span",{className:"h-1 w-3/5 rounded-xs bg-ink"}),t.jsx("span",{className:"h-1 w-full rounded-xs bg-ink-dim"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"h-2.5 w-6 rounded-xs bg-elevated"}),t.jsx("span",{className:"h-2.5 w-5 rounded-xs bg-accent"}),t.jsx("span",{className:"h-2.5 w-4 rounded-xs bg-accent-alt"}),t.jsx("span",{className:"h-2.5 w-4 rounded-xs border border-control"})]})]})]}),Gu=({id:e,name:s,description:a,isSelected:i,isTabStop:r,onSelect:o,onFocusTile:c})=>{const u=Hu[e];return t.jsx(Ve,{side:"bottom",align:"start",content:a,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":i,tabIndex:r?0:-1,onFocus:c,onClick:o,className:de("relative flex flex-col gap-1.5 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart",i?gs:"hover:bg-surface"),children:[t.jsxs("span",{className:de("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",i?"border-accent":"border-hairline"),children:[t.jsx(Vu,{id:e}),i&&t.jsx("span",{className:de("pointer-events-none absolute top-0.5 end-0.5 flex h-4 w-4 items-center justify-center rounded-full",gs),children:t.jsx(Is,{size:12,className:"text-accent","aria-hidden":"true"})})]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(u,{size:12,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink",children:s})]})]})})},Qu=e=>[...e.querySelectorAll("[data-theme-grid]")].map(s=>{const a=[...s.querySelectorAll("[data-theme-tile]")],i=a[0]?.getBoundingClientRect().top??0;return{count:a.length,columns:Math.max(1,a.filter(r=>Math.abs(r.getBoundingClientRect().top-i)<1).length)}}),Wu=()=>{se();const{themeName:e,setTheme:s}=et(),a=Object.values(ua),i=[{label:n("ui.settings.appearance.theme_selector.dark"),items:a.filter(d=>d.theme.palette.mode==="dark")},{label:n("ui.settings.appearance.theme_selector.light"),items:a.filter(d=>d.theme.palette.mode==="light")}].filter(d=>d.items.length>0),[r,o]=l.useState(null),c=l.useMemo(()=>{const d=i.flatMap(m=>m.items.map(_=>_.id));return r&&d.includes(r)?r:d.includes(e)?e:d[0]},[i,r,e]),u=d=>{if(!Uu(d.key))return;const m=[...d.currentTarget.querySelectorAll("[data-theme-tile]")],_=m.indexOf(d.target);if(_<0)return;d.preventDefault();const f=qu({index:_,key:d.key,groups:Qu(d.currentTarget)});f!==_&&m[f]?.focus()};return t.jsx(ir,{children:t.jsx("div",{onKeyDown:u,"data-search-ignore":"the theme picker is a grid of fifty-nine choices; the Appearance section result is its destination",className:"flex flex-col gap-6",children:i.map(d=>t.jsxs("div",{children:[t.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:d.label}),t.jsx("div",{"data-theme-grid":d.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:d.items.map(({id:m,name:_,description:f})=>t.jsx(Gu,{id:m,name:_,description:f,isSelected:m===e,isTabStop:m===c,onSelect:()=>s(m),onFocusTile:()=>o(m)},m))})]},d.label))})})},Yu=({value:e,onChange:s,searchRow:a})=>{se();const i=l.useId();return t.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:i,className:"flex min-h-6 items-center text-body text-ink",children:n("ui.settings.appearance.transcript_display_mode_setting.transcript_display")}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n("ui.settings.appearance.transcript_display_mode_setting.by_turn_condenses_each_turn_to_its_answer_by_response_keeps_every")})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(At,{value:e,onValueChange:r=>s(Ss(r)),children:t.jsx(It,{"aria-labelledby":i,children:vi.map(r=>t.jsx(Be,{value:r.value,children:r.value==="by-turn"?n("ui.settings.appearance.transcript_display_mode_setting.by_turn"):n("ui.settings.appearance.transcript_display_mode_setting.by_response")},r.value))})})})]})},Zu=()=>{se();const{data:e,isLoading:s,error:a}=Cl({enabled:!0});return t.jsxs("div",{children:[t.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-heading text-ink",children:[t.jsx(Qr,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(ve,{className:"h-6 w-36"}),a&&t.jsx(ae,{variant:"warning",children:n("ui.settings.account.settings_page.credit_balance_load_failed",{reason:a.message})}),e&&!s&&!a&&t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[t.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:[n("ui.settings.account.settings_page.available_credits")," ",t.jsx("span",{className:"font-medium text-ink",children:e.balance.toFixed(2)})]}),t.jsx(z,{variant:"secondary",size:"sm",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[t.jsx(Tr,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},Ju=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],Xu=()=>{se();const[e,s]=l.useState("credits"),a=l.useMemo(()=>{const u=new Date,d=Nl(u);return{start_date:Pn(d),end_date:Pn(u),rollup:"daily"}},[]),{data:i,isLoading:r,error:o}=Al(a,{enabled:!0}),c=l.useMemo(()=>i?.data_points?[...i.data_points].sort((d,m)=>Kt(d.timestamp).getTime()-Kt(m.timestamp).getTime()).map(d=>({bucket:ri(_r(Kt(d.timestamp),"yyyy-MM-dd")),value:e==="credits"?Number.parseFloat(d.total_cost.toFixed(2)):d.total_tokens})):[],[i,e]);return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(Ir,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.usage_last_30_days")]}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.settings.account.settings_page.usage_metric")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:Ju.map(({id:u,label:d})=>t.jsx(z,{variant:"ghost",size:"sm","aria-pressed":e===u,onClick:()=>s(u),className:de(e===u&&"bg-surface text-ink hover:bg-surface"),children:d},u))})]})]}),r&&t.jsx(ve,{className:"h-62 w-full"}),o&&t.jsx(ae,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:o.message})}),!r&&!o&&i&&c.length>0&&t.jsx(Cu,{metric:e,data:c}),!r&&!o&&(!i||c.length===0)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.settings_page.no_usage_recorded_in_the_last_30_days")})]})},eg=()=>(se(),t.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(Qi,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_account")]}),t.jsx(z,{variant:"secondary",size:"sm",className:"self-start sm:self-center",asChild:!0,children:t.jsxs("a",{href:"https://console.radienthq.com",target:"_blank",rel:"noopener noreferrer",children:[n("ui.settings.account.settings_page.go_to_radient_console"),t.jsx(oi,{})]})})]})),fg=()=>{se();const e=Xa(),s=et(R=>R.showAgentReasoning),a=et(R=>R.setShowAgentReasoning),i=et(R=>R.transcriptDisplayMode),r=et(R=>R.setTranscriptDisplayMode),{data:o,isLoading:c,isFetching:u,error:d,refetch:m}=ei(),{needsProvider:_}=ti(),f=ws(),{sentence:x,remedy:h}=sn(f??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),d),b=Fi(),[v,w]=l.useState(null),L=vs(),{isAuthenticated:M,accountRead:T,isFetching:N,isRefreshing:C,refreshUser:S}=mn(),B=tt(R=>R.activeSessionId),q=tt(R=>R.sessions),O=sc(),{accountId:$,snapshot:W,model:U}=Cs(),P=l.useRef(null);W.status?P.current={accountId:$,status:W.status}:W.checking||(P.current=null);const V=W.status??(P.current?.accountId===$?P.current.status:null),K=Dl(O),H=l.useMemo(()=>Di.filter(R=>R.id!=="agent-messages"||O!=="absent"),[O]),X=l.useCallback(()=>U.check("surface_open",!0),[U]),[g,k]=l.useState("general"),[y,E]=l.useState(!1),J=l.useRef(null),Y=l.useRef(null),{startTour:te}=zi(),ne=ki(),re=Ns(),{data:fe,refetch:Ne}=ni(),{refreshModels:xe}=si(),I=l.useMemo(()=>fe?.keys?[...fe.keys].sort():[],[fe?.keys]),G=l.useRef({keys:"",hosting:void 0});l.useEffect(()=>{const R=I.join(","),p=o?.values?.hosting;(G.current.keys!==R||G.current.hosting!==p)&&(G.current={keys:R,hosting:p},xe().catch(j=>{console.error("Failed to refresh models after credentials or hosting change:",j)}))},[I,o?.values?.hosting,xe]);const D=l.useRef({general:l.useRef(null),radient:l.useRef(null),integrations:l.useRef(null),appearance:l.useRef(null),speech:l.useRef(null),keyboard:l.useRef(null),providers:l.useRef(null),"agent-messages":l.useRef(null),backend:l.useRef(null),imports:l.useRef(null),updates:l.useRef(null)}).current,ie=l.useMemo(()=>new URLSearchParams(ne.search).get("setting"),[ne.search]),le=l.useMemo(()=>new URLSearchParams(ne.search).get("filter")??"",[ne.search]),ze=l.useMemo(()=>new URLSearchParams(ne.search).get("mcp")??void 0,[ne.search]),ye=l.useMemo(()=>new URLSearchParams(ne.search).get("provider"),[ne.search]),je=l.useCallback(R=>{k(R),E(!0);const p=D[R],j=Y.current;if(p?.current&&j){const Z=p.current.getBoundingClientRect().top-j.getBoundingClientRect().top;j.scrollHeight>j.clientHeight?j.scrollTo({top:Math.max(0,j.scrollTop+Z-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,p.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(J.current??void 0),J.current=setTimeout(()=>{E(!1),J.current=null},800)}else E(!1)},[D]),Ae=l.useRef(null),Ie=l.useRef(null),Q=Lt(),ee=st(Q.data,"settings"),ce=Ce({queryKey:Et.all,queryFn:()=>pe({op:"settings.list"}),enabled:ee,staleTime:1e4}),me=Nu({registry:ce.data,sections:H}),Oe=l.useCallback(()=>Y.current?uc(Y.current):[],[]),[ue,dt]=l.useState(null),Dt=l.useCallback(async R=>{Ie.current=null;const p=Y.current??document;if(R.source==="page")return fc(p,R.id.slice(5));if(R.source==="section")return hc(p,R.sectionId);const j=R.settingKey;if(!j)return"missing";const A=kt(j,"backend");return ce.data&&!ce.data.settings.some(Z=>Z.key===j)?"missing":(je(A),dt({key:j,nonce:Date.now()}),p.querySelector(`[data-search-section="${A}"]`)?"landed":"missing")},[je,ce.data]);l.useEffect(()=>{dt(null)},[ne.search]),l.useEffect(()=>{const R=p=>{!(p.metaKey||p.ctrlKey)||p.altKey||p.key.toLowerCase()==="f"&&(ji(p.target)||(p.preventDefault(),Ie.current=Y.current?.scrollTop??null,Ae.current?.focus()))};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[]),l.useEffect(()=>{const R=setTimeout(()=>{const p=Y.current;if(!p)return;const j=()=>{if(y)return;const A=p.getBoundingClientRect(),Z=A.height;let oe="",be=0;for(const[he,we]of Object.entries(D))if(we.current){const Se=we.current.getBoundingClientRect(),Re=A.top,We=Se.top-Re,Ye=Se.bottom-Re,la=Se.height,ca=Math.max(0,We),da=Math.min(Z,Ye),An=Math.max(0,da-ca)/la,In=An+(We<Z*.3?.1:0);In>be&&An>.1&&(be=In,oe=he)}oe&&oe!==g&&k(oe)};return j(),p.addEventListener("scroll",j,{passive:!0}),()=>{p.removeEventListener("scroll",j),clearTimeout(J.current??void 0)}},100);return()=>clearTimeout(R)},[D,g,y]),l.useEffect(()=>{const R=new URLSearchParams(ne.search),p=R.get("section"),j=R.get("setting"),A=j?kt(j,"backend"):p;if(A==="agent-messages"&&!K)return;const Z=A?D[A]:void 0;if(!A||!Z)return;let oe=!1,be=Number.NaN,he=0;const we=window.setTimeout(()=>{oe||(oe=!0,Re.disconnect(),je(A))},2e3),Se=()=>{if(oe)return;const We=Z.current;if(!We){he=requestAnimationFrame(Se);return}const Ye=Math.round(We.getBoundingClientRect().top+window.scrollY);if(Ye===be&&Ye>0){oe=!0,Re.disconnect(),window.clearTimeout(we),je(A);return}be=Ye,he=requestAnimationFrame(Se)},Re=new ResizeObserver(()=>{oe||(cancelAnimationFrame(he),he=requestAnimationFrame(Se))});return Y.current&&Re.observe(Y.current),he=requestAnimationFrame(Se),()=>{oe=!0,cancelAnimationFrame(he),Re.disconnect(),window.clearTimeout(we)}},[ne.search,D,je,K]);const ut=async(R,p)=>{w(R);try{await b.mutateAsync({[R]:p}),await m()}catch(j){console.error(`Error updating ${R}:`,j)}finally{w(null)}},Qe=c,gt=T==="checking",mt=js(T),_t=T==="ready"||T==="checking"||N,pt=Ms(Qe,4e3);return d?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ae,{variant:"warning",className:"w-full max-w-xl",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:x}),h&&t.jsx(z,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void m(),disabled:u,children:u?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):Qe?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(ke,{size:"lg",label:pt?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),pt&&t.jsx("p",{className:"max-w-sm text-center text-body-sm text-ink-muted",children:n("ui.settings.navigation.settings_page.the_local_operator_server_is_taking_longer_than_usual_to_answer_i")})]}):o?t.jsxs("div",{"data-glass-region":"canvas","data-glass-split":"",className:"panel-flush flex min-h-0 flex-1 overflow-hidden bg-canvas",children:[t.jsx("div",{className:"w-12 shrink-0 overflow-y-auto min-[1040px]:w-55",children:t.jsx($i,{activeSection:g,onSelectSection:je,sections:H})}),t.jsx("div",{ref:Y,"data-settings-content":!0,"data-glass-region":"canvas-content","data-tour-tag":"settings-general-section",className:"panel-scroll flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Wi,{title:n("ui.settings.page.title"),icon:Fn}),t.jsx(Mu,{onDismiss:()=>{const R=Ie.current;Ie.current=null,R!==null&&Y.current?.scrollTo({top:R})},ref:Ae,index:me,readRendered:Oe,onJump:Dt})]}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:D.general,"data-search-section":"general","data-search-section-label":n("ui.settings.navigation.settings_sidebar.general_settings"),className:"flex flex-col gap-8",children:[t.jsx(Pi,{focus:ie===Pt||ue?.key===Pt,focusNonce:ue?.key===Pt?ue.nonce:void 0}),t.jsxs(ge,{title:n("ui.settings.profile.title"),icon:Ki,description:n(M?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[gt&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),mt&&t.jsx(ae,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(T==="refused"?"ui.settings.profile.account_read_failed_refused":"ui.settings.profile.account_read_failed_retry")}),t.jsx(z,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>S(),disabled:C,children:C?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Dn,{searchRow:"general.profile.name",value:L.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:v==="user_name",onSave:async R=>{w("user_name");try{L.updateName(R)}finally{w(null)}},readOnly:_t}),t.jsx(Dn,{searchRow:"general.profile.email",value:L.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:v==="user_email",onSave:async R=>{w("user_email");try{L.updateEmail(R)}finally{w(null)}},readOnly:_t})]})]}),t.jsx(ge,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:t.jsxs(z,{variant:"secondary","data-search-row":"general.tour","data-search-control":!0,onClick:()=>{te({forceModalCompleted:!0})},children:[t.jsx(ai,{}),n("ui.settings.tour.action")]})}),t.jsx(ge,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:Ui,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:t.jsxs("div",{"data-search-row":"general.model","data-search-control":!0,"data-search-label":n("ui.settings.model.settings_page.model_settings"),"data-search-terms":[n("ui.common.models.hosting_select.hosting_provider"),n("ui.common.models.model_select.model"),n("ui.settings.model.default_effort.label")].join(" "),className:"flex flex-col gap-4",children:[t.jsx(Bi,{value:o.values.hosting,isSaving:v==="hosting",onSave:R=>ut("hosting",R),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),t.jsx(qi,{value:o.values.model_name,hostingId:o.values.hosting,isSaving:v==="model_name",onSave:R=>ut("model_name",R),allowCustom:!0,allowDefault:!1}),t.jsx(Nc,{hosting:o.values.hosting,modelName:o.values.model_name,focus:ie===qe||ue?.key===qe,focusNonce:ue?.key===qe?ue.nonce:void 0}),_&&t.jsx(ae,{variant:"neutral",icon:t.jsx(Tt,{className:"size-4","aria-hidden":"true"}),children:t.jsxs("span",{children:[n("ui.settings.model.provider_callout.sentence"),t.jsx("button",{type:"button",className:"text-accent underline underline-offset-2",onClick:()=>{je("providers"),D.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(Pu,{}),t.jsx(ge,{title:n("ui.settings.configuration.settings_page.configuration_information"),icon:Tt,description:n("ui.settings.configuration.settings_page.system_information_about_the_current_configuration"),children:t.jsxs(ot,{children:[t.jsx(_e,{label:n("ui.settings.configuration.settings_page.version"),value:t.jsx("span",{className:"text-mono-sm",children:o.version})}),t.jsx(_e,{label:n("ui.settings.configuration.settings_page.created"),value:ks(o.metadata.created_at)}),t.jsx(_e,{label:n("ui.settings.configuration.settings_page.last_modified"),value:pn(o.metadata.last_modified)}),t.jsx(_e,{label:n("ui.settings.configuration.settings_page.description"),value:o.metadata.description||n("ui.settings.configuration.settings_page.no_description_available")})]})})]}),t.jsx(ge,{title:n("ui.settings.appearance.settings_page.appearance"),icon:Ts,description:n("ui.settings.appearance.settings_page.customize_the_look_and_feel_of_local_operator"),sectionRef:D.appearance,dataTourTag:"settings-appearance-section",searchSection:"appearance",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.appearance"),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Wu,{}),t.jsx(Ls,{searchRow:"appearance.reasoning",value:s,label:n("ui.settings.appearance.settings_page.show_agent_reasoning"),description:n("ui.settings.appearance.settings_page.adds_the_agent_s_reasoning_and_thinking_rows_to_conversations_the"),onChange:async R=>a(R)}),t.jsx(Yu,{searchRow:"appearance.transcript",value:Ss(i),onChange:R=>r(R)}),t.jsx(Ll,{searchRow:"appearance.glass",state:e.state,onChange:e.set})]})}),t.jsx($u,{sectionRef:D.speech}),t.jsx(Hi,{sectionRef:D.keyboard}),t.jsx(ge,{title:n("ui.settings.model.settings_page.model_providers"),icon:bs,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:D.providers,searchSection:"providers",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.model_providers"),id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(Vi,{initialProviderId:ye,onChangeModel:()=>je("general")})}),t.jsx(uu,{sessionId:B??void 0,sectionRef:D.integrations,highlightServer:ze}),t.jsx(ge,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:t.jsx(eg,{}),description:n("ui.settings.account.settings_page.your_radient_account_radient_pass_details_and_credits_to_use_radi"),sectionRef:D.radient,dataTourTag:"settings-radient-account-section",searchSection:"radient",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.radient_account"),searchIgnore:"account, billing and usage are read-only or remote",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(pu,{onAfterCredentialUpdate:()=>{xe(),Ne()}}),M&&t.jsxs(t.Fragment,{children:[t.jsx(Zu,{}),t.jsx(Xu,{})]})]})}),K&&t.jsx(ge,{title:n("ui.agentMessages.settings.section"),icon:Gi,description:n("ui.agentMessages.settings.description"),sectionRef:D["agent-messages"],id:"agent-messages",searchSection:"agent-messages",searchSectionLabel:n("ui.agentMessages.settings.section"),searchIgnore:"agent messages is a consent state machine; its registry rows are searchable",className:"border-b border-hairline pb-8",children:V?t.jsx(Hl,{availability:O,status:V,accountId:$,refusal:W.refusal,onRefreshStatus:X,sessions:q,focus:ie===zt||ue?.key===zt,focusNonce:ue?.key===zt?ue.nonce:void 0,onOpenSession:R=>{U.invalidateStatus(),ga(re,R)}}):W.refusal?t.jsxs(ae,{variant:"warning",children:[t.jsx(Rt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Me,{children:[W.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:Nt(W.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(z,{className:"mt-3",variant:"secondary",onClick:()=>void X(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(ve,{className:"h-5 w-40"}),t.jsx(ve,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(ge,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:Fn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:D.backend,searchSection:"backend",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.backend_settings"),searchIgnore:"registry rows are searched by the Backend section's own filter",children:t.jsx(ii,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,hideStartRecording:!0,focusKey:ue?ue.key:ie&&kt(ie,"backend")==="backend"?ie:null,focusNonce:ue?.nonce,initialFilter:le})}),t.jsx("div",{ref:D.imports,"data-search-section":"imports","data-search-section-label":n("ui.settings.imports.title"),"data-search-ignore":"imports are a one-off task list, not a setting",children:t.jsx(qc,{})}),t.jsx("div",{ref:D.updates,"data-search-section":"updates","data-search-section-label":n("ui.settings.navigation.settings_sidebar.application_updates"),"data-search-ignore":"application updates are an action surface, not a setting",children:t.jsx(vc,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(ae,{variant:"warning",className:"w-full max-w-xl",children:n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded")})})};export{fg as SettingsPage};
|