local-operator-ui 0.46.3 → 0.46.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main/index.js +834 -40
- package/out/preload/index.js +14 -0
- package/out/renderer/assets/{_basePickBy-2VAMpEMo.js → _basePickBy-B_YChRKS.js} +1 -1
- package/out/renderer/assets/{_baseUniq-D2OgfD57.js → _baseUniq-B3GZNf1Q.js} +1 -1
- package/out/renderer/assets/{agent-details-page-BE0Eywy0.js → agent-details-page-DMl53cco.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-B2nahc5i.js → agent-hub-page-uZ_i6ydJ.js} +1 -1
- package/out/renderer/assets/{agents-page-QTvYjHqD.js → agents-page-CJPkFRo3.js} +3 -3
- package/out/renderer/assets/{approvalsOverlay-CbhP-8G2.js → approvalsOverlay-CxjN3jh2.js} +1 -1
- package/out/renderer/assets/{arc-CIhgQwCO.js → arc-DFaaUzFE.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-KSnYF6ar.js → architectureDiagram-IEHRJDOE-BpAsTfqS.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-Bdcjhm_b.js → blockDiagram-JOT3LUYC-r4jr-rzt.js} +1 -1
- package/out/renderer/assets/{book-open-kiV9WBO2.js → book-open-1VNA4GN7.js} +1 -1
- package/out/renderer/assets/browser-page-O-nLXNWr.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-CV0Z5rTF.js → browser-webauthn-prompt-DEA6XqZ-.js} +1 -1
- package/out/renderer/assets/{building-2-Bvx8v_1I.js → building-2-COzJXz8G.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-szZkD43r.js → c4Diagram-VJAJSXHY-2sgIH6MW.js} +1 -1
- package/out/renderer/assets/channel-Bil6Tup6.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-BRWGrX9N.js → chunk-4BMEZGHF-DxY5FoVK.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-B0j_5FM7.js → chunk-A2AXSNBT-BkPG_PS_.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-DpYuMMvI.js → chunk-AEK57VVT-CwX46cqu.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-CEQFcyc2.js → chunk-D6G4REZN-2XxQOq7M.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-CFY0Oxw1.js → chunk-RZ5BOZE2-aq2FC9Se.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-CgJZN1aD.js → chunk-XZIHB7SX-CA0daOr4.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-CavF1Wr6.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-CavF1Wr6.js +1 -0
- package/out/renderer/assets/clone--k_VbBud.js +1 -0
- package/out/renderer/assets/{console-mirror-DfhNBriI.js → console-mirror-DsJ4AMz-.js} +1 -1
- package/out/renderer/assets/{consoleCapture-BZJy2OFK.js → consoleCapture-DJhULMRM.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-B0Mq-tKd.js → conversation-input-sync-D5JW5sYw.js} +252 -252
- package/out/renderer/assets/{dagre-OKDRZEBW-zRwS64cR.js → dagre-OKDRZEBW-CCEkGBb5.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-BOcLk_oH.js → diagram-SSKATNLV-BLsujOGl.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-DkCWJjPr.js → diagram-VNBRO52H-BdWReIg6.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-BLBvPIYe.js → erDiagram-Q7BY3M3F-DLk7B73M.js} +1 -1
- package/out/renderer/assets/{error-boundary-Bz2Pk9pw.js → error-boundary-DI9TecMi.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-jKiXQ27T.js → flowDiagram-4HSFHLVR-Dwi1xRJX.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-dbbKFiit.js → ganttDiagram-APWFNJXF-C8ucMmzB.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-rcjfC4iz.js → gitGraphDiagram-7IBYFJ6S-jpI8UNjN.js} +1 -1
- package/out/renderer/assets/{graph-Dk-DB8SJ.js → graph-DOw3Yeio.js} +1 -1
- package/out/renderer/assets/{hash-BbpSmhjK.js → hash-CDWbW7kn.js} +1 -1
- package/out/renderer/assets/{heart-6uX5W0rm.js → heart-Cp6TtrTt.js} +1 -1
- package/out/renderer/assets/{index-TheJFnyy.js → index-B2z9grrU.js} +205 -200
- package/out/renderer/assets/{index-B9Y_yNHL.js → index-BThrUQfU.js} +1 -1
- package/out/renderer/assets/{index-BXEsKMjO.js → index-BiJMMhkh.js} +1 -1
- package/out/renderer/assets/{index-DasG9wWz.js → index-CPY0nFO2.js} +1 -1
- package/out/renderer/assets/index-DL-hSdfu.css +1 -0
- package/out/renderer/assets/infoDiagram-PH2N3AL5-Bp7P0FGP.js +2 -0
- package/out/renderer/assets/{installer-CmFCXNM9.js → installer-23a8JYv3.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-u--ZVjZj.js → journeyDiagram-U35MCT3I-DMwUX2uA.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-DqFOSYbb.js → kanban-definition-NDS4AKOZ-D_NC746J.js} +1 -1
- package/out/renderer/assets/{layout-ppJHPzb5.js → layout-BCocznw0.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-DPMbCQFf.js → legacy-agents-page-CqAi_r5E.js} +1 -1
- package/out/renderer/assets/{library-page-ZV5C8-64.js → library-page-CfM_Rc9v.js} +3 -3
- package/out/renderer/assets/{mermaid.core-DIOsgGJD.js → mermaid.core-DA6cIkM1.js} +5 -5
- package/out/renderer/assets/{mesh-page-CnSYWYKv.js → mesh-page-OofEXbCo.js} +1 -1
- package/out/renderer/assets/{messages-t0PiFhDs.js → messages-YfGNuiat.js} +9 -9
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-B-Fvzmvg.js → mindmap-definition-ALO5MXBD-D_EtGzVD.js} +1 -1
- package/out/renderer/assets/{mini-C9o_TJ_Q.js → mini-XOT-xfJP.js} +1 -1
- package/out/renderer/assets/{notebook-pen-u33-WHsR.js → notebook-pen-CF9Nc-n_.js} +1 -1
- package/out/renderer/assets/{notifications-page-C02v7-l9.js → notifications-page-DWy-rC2b.js} +1 -1
- package/out/renderer/assets/{org-access-BPVKafW3.js → org-access-CczmQbYD.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-02nRE3pm.js → org-surface-gate-CpjJCC6H.js} +1 -1
- package/out/renderer/assets/{page-header-Cvhkxa0E.js → page-header-B4Fs33_S.js} +1 -1
- package/out/renderer/assets/{path-utils-DGh24yEj.js → path-utils-p1aIOt-j.js} +2 -2
- package/out/renderer/assets/{pieDiagram-IB7DONF6-B-gje72L.js → pieDiagram-IB7DONF6-B33Cx8fO.js} +1 -1
- package/out/renderer/assets/{project-markdown-DSgXKItF.js → project-markdown-CJUpoO5T.js} +1 -1
- package/out/renderer/assets/{projects-page-CE47tbAV.js → projects-page-D_oXKgM5.js} +1 -1
- package/out/renderer/assets/{publication-validation-BKMCHfo5.js → publication-validation-AhKDHiOm.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DWkvugsh.js → quadrantDiagram-7GDLP6J5-DWdt8HjB.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-oPPp3jMp.js → radar-MK3ICKWK-Ca-eTh3L.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-T3Y6krrT.js → radient-auth-buttons-CUfgng9w.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-CRpxME4f.js → requirementDiagram-KVF5MWMF-DtkShP8E.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-Do8H4oUH.js → sankeyDiagram-QLVOVGJD-DZLfCJg9.js} +1 -1
- package/out/renderer/assets/{schedules-page-S53qXHE1.js → schedules-page-qgXydSqf.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-eyfh_Cy-.js → sequenceDiagram-X6HHIX6F-DrmT98zN.js} +1 -1
- package/out/renderer/assets/settings-page-VdBjjfbE.js +287 -0
- package/out/renderer/assets/{smartart-C9r5oCW_.js → smartart-CNNJDGet.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-Cv2aAshk.js → stateDiagram-DGXRK772-ll16vKCd.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-D-aIl4WR.js +1 -0
- package/out/renderer/assets/team-bridge-page-C-tllBef.js +21 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-C2VNAqkv.js → timeline-definition-BDJGKUSR-DY1dBCXx.js} +1 -1
- package/out/renderer/assets/{use-default-on-banner-C-oPKEE5.js → use-default-on-banner-CKV2X33S.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-DXp2AbvB.js → use-download-agent-mutation-C0XI3fkh.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-DF5pok5c.js → use-session-snapshot-DDBCHAaV.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-4DxcTL_i.js → xychartDiagram-VJFVF3MP-B5aiNSI5.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-COdwEp7k.js +0 -1
- package/out/renderer/assets/channel-BTHuvCce.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-B2PHFxpc.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-B2PHFxpc.js +0 -1
- package/out/renderer/assets/clone-DrGU-HSJ.js +0 -1
- package/out/renderer/assets/index-B71X_Kxp.css +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-ZphutEES.js +0 -2
- package/out/renderer/assets/settings-page-DcHKSQu_.js +0 -287
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CpFVnwLX.js +0 -1
- package/out/renderer/assets/team-bridge-page-CSNJn90C.js +0 -16
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import{r as l,j as t,c as me,t as Hs}from"./index-BiJMMhkh.js";import{o as qs}from"./console-mirror-DsJ4AMz-.js";import{d1 as $t,d2 as Gs,d3 as yn,d4 as Pe,c8 as Qs,a6 as Zn,a7 as en,W as Jn,ba as Ys,aZ as Ws,d5 as Zs,d6 as Js,d7 as Xs,d8 as ea,d9 as Xn,da as tn,a4 as es,db as ta,dc as na,bc as Pt,dd as vn,de as sa,df as pt,dg as Ut,bJ as ts,dh as nn,cC as ft,bU as aa,di as ns,dj as ia,dk as oa,V as ss,be as Kt,bf as Bt,aA as ra,a_ as Vt,dl as la,dm as ca,dn as Ht,dp as da,dq as ua,dr as ga,ds as as,dt as ma,du as _a,dv as pa,b9 as fa,dw as is,bd as os,dx as rs,dy as ha,dz as xa,dA as ya,dB as va,dC as ba,dD as ka,dE as ja,dF as wa,bO as ls,bQ as Na,dG as Xe,dH as bn,dI as Sa,dJ as Ma,dK as Ca,c3 as Aa,dL as Ea,dM as Ia,ca as Ra,dN as Ta,dO as Oa,dP as La,dQ as kn,dR as Fa,ct as Da,dS as za,dT as $a,az as Pa}from"./conversation-input-sync-D5JW5sYw.js";import{i as Ie,u as sn,ai as Ua,a9 as Ka,aj as Ba,ak as qe,a as an,c as kt,al as Va,a3 as Ha,am as qa,an as Ga,ao as Qa,ap as Ya,d as _e,G as on,aq as Wa,q as st,ar as Za,B as cs,r as Ja,C as Xa,as as qt,x as nt,at as ei,au as ds,$ as ti}from"./path-utils-p1aIOt-j.js";import{dg as us,dh as ni,di as si,dj as gs,dk as ai,bR as ii,dl as Ee,N as oi,S as ms,bs as rt,bt as ge,dm as de,dn as At,dp as ri,R as li,b4 as jn,dq as ci,dr as di,ds as dt,br as ui,d1 as gi,dt as mi,du as _i,dv as pi,dw as fi,bh as wn,dx as hi,b7 as xi,bo as Nn,db as yi,bp as vi,bq as bi,dy as ki,dz as ji,bg as wi,dA as Ni}from"./index-B2z9grrU.js";import{P as Si}from"./page-header-B4Fs33_S.js";import{c as R,u as ie,B as D,S as ye,Y as _s,w as Ze,M as jt,N as wt,O as Ye,A as se,a as Nt,x as Ne,g as xe,Q as rn,R as ln,U as cn,V as dn,W as We,L as Fe,K as Ue,a5 as St,Z as Mi,j as it,i as Gt,ah as Ci,C as ps,ak as Sn,T as fs,D as Ai,d as Ei,e as Ii,I as Ri,f as Mn,G as Ti,E as Oi,al as Li,a9 as Fi}from"./error-boundary-DI9TecMi.js";import{t as n,L as Di}from"./messages-YfGNuiat.js";import{u as zi,a as $i,D as Pi}from"./use-default-on-banner-CKV2X33S.js";import{R as Ui}from"./radient-auth-buttons-CUfgng9w.js";import{N as Ki}from"./notebook-pen-CF9Nc-n_.js";import{B as Bi}from"./book-open-1VNA4GN7.js";import{i as Vi,a as He,b as Hi,p as Et,f as qi}from"./parseISO-CxPiCKvF.js";import{t as Gi}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 Qi=[["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"}]],Yi=R("aperture",Qi);/**
|
|
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 Wi=[["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"}]],Zi=R("atom",Wi);/**
|
|
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 Ji=[["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"}]],Xi=R("audio-waveform",Ji);/**
|
|
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 eo=[["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"}]],to=R("binary",eo);/**
|
|
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 no=[["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"}]],so=R("candy",no);/**
|
|
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 ao=[["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"}]],io=R("car-front",ao);/**
|
|
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 oo=[["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"}]],ro=R("cassette-tape",oo);/**
|
|
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 lo=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],co=R("chart-line",lo);/**
|
|
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 uo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],go=R("circle-plus",uo);/**
|
|
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 mo=[["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"}]],_o=R("circuit-board",mo);/**
|
|
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 po=[["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"}]],fo=R("cloud-lightning",po);/**
|
|
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 ho=[["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"}]],xo=R("cloud-moon",ho);/**
|
|
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 yo=[["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"}]],vo=R("cloud-snow",yo);/**
|
|
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 bo=[["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"}]],ko=R("cloud-sun",bo);/**
|
|
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 jo=[["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"}]],wo=R("coffee",jo);/**
|
|
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 No=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],hs=R("contrast",No);/**
|
|
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 So=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Mo=R("credit-card",So);/**
|
|
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 Co=[["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"}]],Ao=R("cup-soda",Co);/**
|
|
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 Eo=[["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"}]],Io=R("disc-3",Eo);/**
|
|
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 Ro=[["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"}]],To=R("droplet",Ro);/**
|
|
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 Oo=[["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"}]],Lo=R("droplets",Oo);/**
|
|
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 Fo=[["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"}]],Do=R("fish",Fo);/**
|
|
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 zo=[["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"}]],$o=R("flame",zo);/**
|
|
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 Po=[["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"}]],Uo=R("flower-2",Po);/**
|
|
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 Ko=[["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"}]],Bo=R("flower",Ko);/**
|
|
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 Vo=[["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"}]],Ho=R("ghost",Vo);/**
|
|
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 qo=[["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"}]],Go=R("github",qo);/**
|
|
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 Qo=[["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"}]],Yo=R("guitar",Qo);/**
|
|
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 Wo=[["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"}]],Zo=R("hexagon",Wo);/**
|
|
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 Jo=[["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"}]],Xo=R("ice-cream-bowl",Jo);/**
|
|
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 er=[["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"}]],tr=R("joystick",er);/**
|
|
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 nr=[["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"}]],sr=R("leaf",nr);/**
|
|
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 ar=[["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"}]],ir=R("lightbulb",ar);/**
|
|
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 or=[["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"}]],rr=R("milk",or);/**
|
|
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 lr=[["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"}]],cr=R("moon-star",lr);/**
|
|
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 dr=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],ur=R("moon",dr);/**
|
|
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 gr=[["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"}]],mr=R("mountain-snow",gr);/**
|
|
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 _r=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],pr=R("mountain",_r);/**
|
|
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 fr=[["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"}]],hr=R("radio",fr);/**
|
|
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 xr=[["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"}]],yr=R("sailboat",xr);/**
|
|
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 vr=[["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"}]],br=R("shirt",vr);/**
|
|
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 kr=[["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"}]],jr=R("skull",kr);/**
|
|
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 wr=[["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"}]],Nr=R("snowflake",wr);/**
|
|
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 Sr=[["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"}]],Mr=R("sparkle",Sr);/**
|
|
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 Cr=[["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"}]],Ar=R("sun-dim",Cr);/**
|
|
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 Er=[["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"}]],Ir=R("sun",Er);/**
|
|
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 Rr=[["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"}]],Tr=R("sunrise",Rr);/**
|
|
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 Or=[["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"}]],Lr=R("sunset",Or);/**
|
|
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 Fr=[["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"}]],Dr=R("tent",Fr);/**
|
|
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 zr=[["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"}]],$r=R("tree-deciduous",zr);/**
|
|
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 Pr=[["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"}]],Ur=R("tree-palm",Pr);/**
|
|
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 Kr=[["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"}]],Br=R("tree-pine",Kr);/**
|
|
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 Vr=[["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"}]],Hr=R("trees",Vr);/**
|
|
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 qr=[["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"}]],Gr=R("umbrella",qr);/**
|
|
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 Qr=[["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"}]],Yr=R("waves",Qr);/**
|
|
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 Wr=[["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"}]],Zr=R("wheat",Wr);/**
|
|
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 Jr=[["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"}]],Xr=R("wind",Jr),el=({appVersion:e=null,slowWaitHintMs:s})=>{ie();const a="https://local-operator.com/download",[i,o]=l.useState(!1),r=us(i,s??ni),[u,m]=l.useState(!1),[c,d]=l.useState(null),[x,f]=l.useState("info"),[h,_]=l.useState(null),[y,b]=l.useState(null),w=e?.trim()?e.trim():null,z=l.useRef(!1),S=$t(U=>U.openDetail),I=l.useRef(!1),v=l.useRef(0),N=l.useRef(!1),k=l.useCallback((U,K)=>{I.current=!1,d(U),f(K),m(!0)},[]),$=l.useCallback(U=>{I.current=!0,d(U),f("success"),m(!0)},[]),W=l.useCallback(()=>{I.current&&(I.current=!1,m(!1),d(null))},[]),{clearDeferredUpdate:Q}=Gs();l.useEffect(()=>{const U=window.api.updater.onUpdateError(g=>{z.current&&g.includes("manually")&&(_({message:n("ui.common.updates.check_for_updates_button.the_server_is_installed_outside_the_app_so_use_the_tool_you_insta"),command:""}),I.current=!1,d(null),f("warning"),m(!0))}),K=window.api.updater.onBackendUpdateDevMode(g=>{z.current&&k(g,"info")}),V=()=>{N.current=!0,W()},B=window.api.updater.onUpdateAvailable(V),M=window.api.updater.onUpdateNpxAvailable(V),E=window.api.updater.onBackendUpdateAvailable(V);return()=>{U(),K(),B(),M(),E()}},[W,k]),l.useEffect(()=>{let U=!1;const K=()=>{window.api.updater.getLastInstallAttempt().then(B=>{U||b(B)}).catch(()=>{})};K();const V=window.api.updater.onUpdateInstallFailed(()=>K());return()=>{U=!0,V()}},[]);const P=async()=>{const U=++v.current;W(),N.current=!1;try{o(!0),z.current=!0,Q(Pe.UI),Q(Pe.BACKEND);const K=await window.api.updater.checkForAllUpdates({manual:!0});if(U!==v.current)return;K.app==="available"&&S(Pe.UI),K.server==="available"&&S(Pe.BACKEND),K?.affirmation&&!N.current?$(K.affirmation):W()}catch(K){if(U!==v.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${si(K)}`)}finally{U===v.current&&o(!1),setTimeout(()=>{z.current=!1},2e3)}},Y=()=>{I.current=!1,m(!1),d(null)};return t.jsxs(t.Fragment,{children:[y&&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"),y.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),y.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:y.attempts,attemptsText:String(y.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")," ",y.detectedAt?new Date(y.detectedAt).toLocaleString():n("ui.common.updates.check_for_updates_button.at_an_unknown_time"),". ",y.detail]}),t.jsx(D,{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(D,{variant:"outline",onClick:()=>void P(),disabled:i,children:[i?t.jsx(ye,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),r&&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")}),h&&t.jsxs(yn,{open:u,autoHideDuration:1e4,onClose:Y,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:h.message}),h.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:h.command})]}),c&&x!=="danger"&&t.jsx(yn,{open:u,autoHideDuration:6e3,onClose:Y,variant:x,children:c})]})},ht=["system-prompt"],tl=()=>{const{shouldEnableQuery:e}=Qs();return Ie({enabled:e({bypassInternetCheck:!0}),queryKey:ht,queryFn:async()=>{try{const a=await Zn(en.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 Jn(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},nl=()=>{const e=sn(),s=Zn(en.baseUrl);return Ys({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 o=i instanceof Error?i.message:n("ui.common.errors.system_prompt_update_unknown");throw Jn(o),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:ht,refetchType:"none"}),e.setQueryData(ht,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:ht,type:"all"}),Ws(n("ui.notices.settings.system_prompt_updated"))},onError:a=>{console.error("Error updating system prompt:",a)}})},xs=({value:e,label:s,description:a,onChange:i,icon:o,isSaving:r=!1,disabled:u=!1})=>{ie();const[m,c]=l.useState(e),d=l.useId(),x=`${d}-label`,f=`${d}-description`,h=async _=>{if(!(r||u)){c(_);try{await i(_)}catch(y){c(!_),console.error("Error toggling setting:",y)}}};return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("span",{id:x,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"}),s]}),a&&t.jsx("p",{id:f,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:a})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:r?t.jsx(ye,{size:"md",label:n("ui.common.forms.toggle_setting.saving",{label:s})}):t.jsx(_s,{checked:m,onCheckedChange:h,disabled:u,"aria-labelledby":x,"aria-describedby":a?f:void 0})})]})};function Cn(e,s){const a=Gi(e,s?.in);if(!Vi(a))throw new RangeError("Invalid time value");const i=He(a.getDate(),2),o=He(a.getMonth()+1,2),r=a.getFullYear(),u=He(a.getHours(),2),m=He(a.getMinutes(),2),c=He(a.getSeconds(),2);let d="",x="";const f=a.getTimezoneOffset();if(f!==0){const h=Math.abs(f),_=He(Math.trunc(h/60),2),y=He(h%60,2);x=`${f<0?"+":"-"}${_}:${y}`}else x="Z";return`${r}-${o}-${i}T${u}:${m}:${c}${d}${x}`}function sl(e,s,a){return Hi(e,-30,a)}var al=Zs({chartName:"LineChart",GraphicalChild:Xn,axisComponents:[{axisType:"xAxis",AxisComp:Js},{axisType:"yAxis",AxisComp:Xs}],formatAxisMap:ea});const il=["radient","creditBalance"],ol=e=>{const{user:s,isAuthenticated:a}=tn(),i=s?.account?.tenant_id,o=a&&!!i&&e?.enabled;return Ie({queryKey:[il,i],queryFn:async()=>{if(!i)throw new Error(n("ui.common.errors.tenant_missing"));const r=await es({operation:"credits",tenantId:i});if(!r||typeof r.balance!="number")throw new Error(n("ui.common.errors.credit_balance_invalid"));return r},enabled:o,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},rl=["radient","usageRollup"],ll=(e,s)=>{const{user:a,isAuthenticated:i}=tn(),o=a?.account?.tenant_id,r=i&&!!o&&s?.enabled;return Ie({queryKey:[...rl,o,e],queryFn:async()=>{if(!o)throw new Error(n("ui.common.errors.tenant_missing"));const u={};for(const[c,d]of Object.entries(e))d!=null&&(u[c]=String(d));const m=await es({operation:"usage",tenantId:o,query:u});if(!m)throw new Error(n("ui.common.errors.usage_rollup_invalid"));return m},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},cl=e=>e==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),dl=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")}},ul=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")}},An=({label:e,description:s,value:a,onValueChange:i,options:o})=>{const r=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:r,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(jt,{value:a,onValueChange:i,children:t.jsx(wt,{"aria-labelledby":r,children:o.map(u=>t.jsx(Ye,{value:u.value,children:u.label},u.value))})})})]})},gl=({state:e,onChange:s})=>{ie();const a=l.useId(),i=`${a}-description`,[o,r]=l.useState(null),u=l.useRef(!1),m=l.useRef(null),c=e?.settings.intensity??0;if(!e)return null;const d=!e.capability.supported,x=d?ul(e.capability.reason):null,f=async y=>{if(u.current){m.current=y;return}u.current=!0;try{await s({intensity:y})}finally{u.current=!1;const b=m.current;m.current=null,b!==null&&b!==y?f(b):r(null)}},h=e.settings.enabled,_=o??c;return t.jsxs("div",{className:"flex flex-col gap-4","data-window-glass":"","data-glass-gate":e.capability.reason,children:[t.jsx(Ze,{content:x,disabled:!d,children:t.jsx("div",{className:d?"opacity-60":void 0,children:t.jsx(xs,{value:d?!1:h,disabled:d,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async y=>s({enabled:y})},d?"unavailable":"available")})}),x&&t.jsx("p",{"data-glass-unsupported":e.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:x}),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&&!d&&t.jsxs(t.Fragment,{children:[t.jsx(An,{label:n("ui.settings.appearance.window_glass.coverage_label"),description:n("ui.settings.appearance.window_glass.coverage_description"),value:e.settings.coverage,onValueChange:y=>void s({coverage:y}),options:ta.map(y=>({value:y,label:cl(y)}))}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[t.jsx("label",{htmlFor:a,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(_)})})]}),t.jsx("p",{id:i,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:a,type:"range",min:0,max:100,step:5,value:_,"aria-describedby":i,"aria-valuetext":n("ui.settings.appearance.window_glass.intensity_value",{value:String(_)}),onChange:y=>{const b=Number(y.target.value);r(b),f(b)},style:{"--fill":`${_}%`},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(An,{label:n("ui.settings.appearance.window_glass.material_label"),description:n("ui.settings.appearance.window_glass.material_description"),value:e.settings.material,onValueChange:y=>void s({material:y}),options:e.capability.materials.map(y=>({value:y,label:dl(y)}))})]})]})},ml=new Set(["B","C","D","E","F"]);function _l(e){const{status:s,refused:a,everVisible:i,checking:o=!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&&ml.has(s.surface_state)?"visible":"absent":o&&i?"visible":a&&i?"error":"absent"}function pl(e,s){return e!=="absent"}function et(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 fl="open_chief_of_staff";function hl(e){const s=e?.delivery_hold;if(!s||s.code!==fl||s.count<=0)return null;const a=s.session||e?.local.session||null;return{count:s.count,sessionId:a}}function ys(e){return Ua(e)}function xl(e){return e.target.endpoint_id?{kind:"endpoint",id:e.target.endpoint_id}:{kind:"account",id:e.target.account_id??""}}function Qt(e){return e.map((s,a)=>{const i=xl(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 Yt(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,o)=>i.direction.localeCompare(o.direction)||i.effect.localeCompare(o.effect)||JSON.stringify(i.target).localeCompare(JSON.stringify(o.target)))}function vs(e){return JSON.stringify(e)}function yl(e){return e.saving?{disabled:!0,reason:"saving"}:["send","receive"].some(i=>e.modes[i]==="listed_only"&&!e.entries.some(o=>o.direction===i&&o.effect==="allow"))?{disabled:!0,reason:"needs_entry"}:vs(Yt(e.entries,e.modes))===e.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const vl=/^[^\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"):vl.test(e)?null:n("ui.agentMessages.settings.allowlist.identifier_invalid")}function xt(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 kl=['[data-agent-messages-action="turn_on_again"]','[role="switch"]','[data-agent-messages-action="enable"]'],It="__none__";function jl({availability:e,status:s,accountId:a,refusal:i=null,api:o=ii,onRefreshStatus:r,sessions:u=[],onOpenSession:m,focus:c=!1}){ie();const[d,x]=l.useState({kind:"loading"}),[f,h]=l.useState(0),[_,y]=l.useState(null),[b,w]=l.useState(null),[z,S]=l.useState(s?.local.enabled??!1),[I,v]=l.useState(s?.local.session??""),N=s?.tenant_id??void 0,k=e==="visible",$=s?.account_id??null,W=$!==null&&$===a;l.useEffect(()=>{if(!k)return;let M=!1;return x({kind:"loading"}),w(null),(async()=>{try{const E=await o.settings(N);if(M)return;if(!E){x({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let g=null;if(E.endpoint){if(g=await o.allowlist(E.settings.tenant_id),M)return;if(!g){x({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}x({kind:"ready",settings:E,allowlist:g})}catch(E){if(M)return;x({kind:"error",refusal:Ee(E)})}})(),()=>{M=!0}},[k,a,$,N,f,o]),l.useEffect(()=>{if(!k||d.kind!=="ready"||!d.settings.endpoint||d.allowlist)return;let M=!1;return(async()=>{try{const E=await o.allowlist(d.settings.settings.tenant_id);if(M||!E)return;x(g=>g.kind==="ready"&&!g.allowlist?{...g,allowlist:E}:g)}catch(E){M||w(Ee(E))}})(),()=>{M=!0}},[k,d,o]),l.useEffect(()=>{s&&(S(s.local.enabled),v(s.local.session))},[s]);const Q=()=>h(M=>M+1),P=d.kind==="ready"?d.settings:null,Y=zi(s,P,$),U=$i({api:o,accountId:W?$:null,tenantId:P?.settings.tenant_id??null,markerTenantId:s?.tenant_id??null,onSettings:M=>x(E=>E.kind==="ready"?{...E,settings:M}:E),onChanged:()=>r(!0)}),K=l.useRef(null),V=l.useRef(!1);if(l.useEffect(()=>{if(!c){V.current=!1;return}if(V.current||d.kind!=="ready"||_!==null)return;const M=K.current,E=kl.map(g=>M?.querySelector(`${g}:not(:disabled)`)).find(g=>g!=null);E&&(E.focus(),V.current=!0)},[c,d,_,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(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ne,{children:[i?xt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(D,{className:"mt-3",variant:"secondary",onClick:()=>{Q(),r(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})});if(!s||!a)return null;const B=hl(s);return t.jsxs("div",{ref:K,"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[B&&t.jsx(Nl,{count:B.count,onMessage:B.sessionId&&m?()=>m(B.sessionId):void 0}),Y&&t.jsx(Pi,{consentText:Ka(s,P),pending:U.pending,failure:U.failure,onTurnOff:()=>void U.turnOff(),onDismiss:()=>void U.dismiss()}),b&&t.jsx(se,{variant:"warning",children:t.jsx(Ne,{children:xt(b)})}),d.kind==="loading"&&t.jsx(wl,{}),d.kind==="error"&&t.jsxs(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ne,{children:[d.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:xt(d.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(D,{className:"mt-3",variant:"secondary",onClick:Q,children:n("ui.agentMessages.settings.error.retry")})]})]}),d.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(Cl,{state:et(s,d.settings),status:s,settings:d.settings,accountId:$??a,accountMatches:W,api:o,pending:_,localEnabled:z,onActionRefusal:w,onSettings:M=>x(E=>E.kind==="ready"?{...E,settings:M}:E),onLocalEnabled:S,onRefreshStatus:r,setPending:y}),t.jsx(El,{value:I,sessions:u,pending:_==="session",disabled:_!==null,onSave:async M=>{y("session"),w(null);try{await o.localSetting("team_bridge.session",M),v(M),await r(!0)}catch(E){w(Ee(E))}finally{y(null)}}}),d.allowlist&&(et(s,d.settings)==="C"||et(s,d.settings)==="D"||et(s,d.settings)==="F")&&t.jsx(Il,{allowlist:d.allowlist,accountId:$??a,accountMatches:W,readOnly:s.read_only===!0&&et(s,d.settings)==="F",pending:_!==null,onSaving:M=>y(M?"allowlist":null),onRefusal:w,onSaved:M=>x(E=>E.kind==="ready"?{...E,allowlist:M}:E),api:o},d.allowlist.view.tenant_id??"tenant")]})]})}function wl(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(xe,{className:"h-5 w-40"}),t.jsx(xe,{className:"h-4 w-full max-w-xl"}),t.jsx(xe,{className:"h-9 w-36"}),t.jsx(xe,{className:"h-4 w-64"})]})}const Nl=({count:e,onMessage:s})=>t.jsx("output",{className:"block","data-agent-messages-hold":"open_chief_of_staff",children:t.jsx(se,{variant:"info",className:me(oi,"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(D,{variant:"ghost",size:"sm",className:"shrink-0 text-ink",onClick:s,children:n("ui.agentMessages.settings.hold.open")})]})})}),En=({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})}),bs={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"},ks={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 Sl(e){return e==="B"?"ui.agentMessages.settings.default_on.b_title":bs[e]}function Ml(e){return e==="B"?"ui.agentMessages.settings.default_on.b_body":e==="E"?"ui.agentMessages.settings.default_on.e_body":ks[e]}const Cl=({state:e,status:s,settings:a,accountId:i,accountMatches:o,api:r,pending:u,localEnabled:m,onActionRefusal:c,onSettings:d,onLocalEnabled:x,onRefreshStatus:f,setPending:h})=>{const _=ys(s),y=a.settings.tenant_id,b=u!==null||!o,w=Ba(s);async function z(k,$={}){if(!o)return null;h(k),c(null);try{const W=await r.updateSettings({expected_account_id:i,tenant_id:y,state:k,...$});if(d(W),k==="disabled"&&!w)try{await r.localSetting("team_bridge.enabled",!1),x(!1)}catch(Q){c(Ee(Q))}return W}catch(W){const Q=Ee(W);return c(Q),Q.code==="consent_version_unknown"&&await f(!0),null}finally{h(null)}}async function S(){if(!(!_||!o||!await z("active",{consent_version:_.version,consented_via:"settings"}))){h("local");try{await r.localSetting("team_bridge.enabled",!0),x(!0),await f(!0)}catch($){c(Ee($))}finally{h(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(Rt,{settings:a,status:s,readOnly:!0}),t.jsx(Tt,{value:m,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{h("local"),c(null);try{await r.localSetting("team_bridge.enabled",k),x(k),await f(!0)}catch($){c(Ee($))}finally{h(null)}}})]});const I=a.endpoint?.label?.trim(),v=a.endpoint?.consent??null,N=v!==null&&!v.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?Sl(e):bs[e])}),I&&t.jsx("span",{className:"text-body-sm text-ink-muted",children:I})]}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n(w?Ml(e):ks[e])}),w&&e==="E"&&t.jsxs("div",{className:"flex flex-col gap-3",children:[_?t.jsx(En,{text:_.text}):t.jsx(se,{variant:"warning",children:t.jsx(Ne,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsx("div",{className:"flex flex-wrap items-center gap-3",children:t.jsx(D,{"data-agent-messages-action":"turn_on_again",onClick:()=>void S(),disabled:b||!_,children:n("ui.agentMessages.settings.action.turn_on_again")})})]}),!w&&(e==="B"||e==="E")&&t.jsxs("div",{className:"flex flex-col gap-3",children:[_?t.jsx(En,{text:_.text}):t.jsx(se,{variant:"warning",children:t.jsx(Ne,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(D,{"data-agent-messages-action":"enable",onClick:()=>void S(),disabled:b||!_,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(D,{"data-agent-messages-action":"pause",variant:"secondary",disabled:b,onClick:()=>void z("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(D,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:b,onClick:()=>void z("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(Rt,{settings:a,status:s}),N&&!w&&t.jsx(In,{onRenew:()=>void S(),disabled:b||!_}),t.jsx(Tt,{value:m,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{h("local"),c(null);try{await r.localSetting("team_bridge.enabled",k),x(k),await f(!0)}catch($){c(Ee($))}finally{h(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(D,{"data-agent-messages-action":"resume",disabled:b||a.settings.consent_required&&_===null,onClick:()=>void z("active",a.settings.consent_required&&_?{consent_version:_.version,consented_via:"settings"}:{}),children:n("ui.agentMessages.settings.action.resume")}),t.jsx(D,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:b,onClick:()=>void z("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),a.settings.consent_required&&!_&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.unavailable")}),t.jsx(Rt,{settings:a,status:s}),N&&!w&&t.jsx(In,{onRenew:()=>void S(),disabled:b||!_}),t.jsx(Tt,{value:m,disabled:b,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async k=>{h("local"),c(null);try{await r.localSetting("team_bridge.enabled",k),x(k),await f(!0)}catch($){c(Ee($))}finally{h(null)}}})]})]})},In=({onRenew:e,disabled:s})=>t.jsx(se,{variant:"warning",children:t.jsxs(Ne,{children:[n("ui.agentMessages.settings.consent.renew"),t.jsx(D,{"data-agent-messages-action":"enable",className:"mt-3",variant:"secondary",disabled:s,onClick:e,children:n("ui.agentMessages.settings.action.enable_again")})]})});function Al(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 Rt=({settings:e,status:s,readOnly:a=!1})=>{const i=e.endpoint?.consent??null,o=ys(s);return i?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs(rt,{children:[t.jsx(ge,{label:n("ui.agentMessages.settings.consent.version"),value:i.version}),t.jsx(ge,{label:n("ui.agentMessages.settings.consent.via"),value:Al(i.consented_via)}),t.jsx(ge,{label:n("ui.agentMessages.settings.consent.at"),value:i.consented_at})]}),!a&&o&&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:o.text})]})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.no_record")})},Tt=({value:e,disabled:s,description:a,onChange:i})=>{const o=l.useId();return t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{id:o,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(_s,{"aria-labelledby":o,checked:e,disabled:s,onCheckedChange:r=>void i(r)})]})},El=({value:e,sessions:s,pending:a,disabled:i,onSave:o})=>{const r=s.some(u=>u.session_id===e);return t.jsxs("div",{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(rn,{value:e===""?It:e,disabled:i,onValueChange:u=>void o(u===It?"":u),children:[t.jsx(ln,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(cn,{})}),t.jsxs(dn,{children:[t.jsx(We,{value:It,children:n("ui.agentMessages.settings.session.none")}),s.map(u=>t.jsx(We,{value:u.session_id,children:u.title?.trim()||u.session_id},u.session_id)),e!==""&&!r&&t.jsx(We,{value:e,children:e})]})]}),e!==""&&!r&&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")})]})},Il=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:o,api:r,onSaving:u,onRefusal:m,onSaved:c})=>{const[d,x]=l.useState(()=>Qt(e.allowlist.entries)),[f,h]=l.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),_=o||i||!a,y=vs(Yt(Rl(e),Tl(e))),b=yl({entries:d,modes:f,savedSignature:y,saving:o}),w=l.useRef(0),z=v=>x(N=>[...N,{...v,key:`${v.direction}:${v.effect}:${w.current++}`}]),S=v=>x(N=>N.filter(k=>k.key!==v)),I=async()=>{if(!_){u(!0),m(null);try{const v=await r.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:Yt(d,f)}),N=Qt(v.allowlist.entries);x(N),h({send:v.view.directions.send.mode,receive:v.view.directions.receive.mode}),c(v)}catch(v){m(Ee(v))}finally{u(!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(Rn,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:f.receive,cues:e.view.cues,entries:d.filter(v=>v.direction==="receive"),disabled:_,onMode:v=>h(N=>({...N,receive:v})),onAdd:v=>z({...v,direction:"receive"}),onRemove:S}),t.jsx(Rn,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:f.send,cues:e.view.cues,entries:d.filter(v=>v.direction==="send"),disabled:_,onMode:v=>h(N=>({...N,send:v})),onAdd:v=>z({...v,direction:"send"}),onRemove:S}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(D,{onClick:()=>void I(),disabled:b.disabled||_,children:[t.jsx(ms,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),b.disabled&&b.reason==="needs_entry"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),b.disabled&&b.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")}),o&&t.jsx("span",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})]})};function Rl(e){return Qt(e.allowlist.entries)}function Tl(e){return{send:e.view.directions.send.mode,receive:e.view.directions.receive.mode}}const Rn=({direction:e,title:s,mode:a,cues:i,entries:o,disabled:r,onMode:u,onAdd:m,onRemove:c})=>{const d=o.filter(f=>f.effect==="allow"),x=o.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(Ol,{mode:a,disabled:r,onMode:u}),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")}),d.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.allowed_empty")}),d.map(f=>t.jsx(Tn,{entry:f,disabled:r,onRemove:()=>c(f.key)},f.key)),t.jsx(On,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:r,onAdd:f=>m({...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")}),x.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),x.map(f=>t.jsx(Tn,{entry:f,disabled:r,onRemove:()=>c(f.key)},f.key)),t.jsx(On,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:r,onAdd:f=>m({...f,effect:"deny"})})]})]})},Ol=({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(o=>t.jsx(D,{variant:"ghost",size:"sm","aria-pressed":e===o.value,disabled:s,onClick:()=>a(o.value),className:me(e===o.value&&"bg-surface text-ink hover:bg-surface"),children:o.label},o.value))})]})},Tn=({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(D,{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")})]}),On=({label:e,disabled:s,onAdd:a})=>{const[i,o]=l.useState("endpoint"),[r,u]=l.useState(""),[m,c]=l.useState(null),d=l.useId(),x=`${d}-help`,f=()=>{const h=bl(r.trim());c(h),!h&&(a({kind:i,id:r.trim()}),u(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Fe,{htmlFor:d,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(rn,{value:i,disabled:s,onValueChange:h=>o(h),children:[t.jsx(ln,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(cn,{})}),t.jsxs(dn,{children:[t.jsx(We,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(We,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(Ue,{id:d,"aria-describedby":x,className:"max-w-xs",value:r,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:h=>u(h.target.value),onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),f())}}),t.jsx(D,{variant:"secondary",size:"sm",disabled:s,onClick:f,children:n("ui.agentMessages.settings.allowlist.add")})]}),t.jsx("p",{id:x,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")}),m&&t.jsx("p",{className:"text-meta text-danger",children:m})]})};function Ll(){const{snapshot:e}=gs(),[s,a]=l.useState(!1),i=_l({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return l.useEffect(()=>{i!=="absent"&&a(!0)},[i]),l.useEffect(()=>{ai()},[]),i}const Ln={get[Pe.UI](){return n("ui.settings.updates.update_following.application_updates")},get[Pe.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},ut={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")}}},Fn=({type:e})=>{ie();const s=$t(i=>i.followed[e]),a=$t(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:Ln[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:ut[s].description})]}),t.jsxs(rn,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(ln,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:Ln[e],choice:ut[s].label}),className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(cn,{})}),t.jsx(dn,{children:na.map(i=>t.jsx(We,{value:i,title:ut[i].description,children:ut[i].label},i))})]})]})},Fl=()=>(ie(),t.jsxs("div",{className:me("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(Fn,{type:Pe.UI}),t.jsx(Fn,{type:Pe.BACKEND})]})]})),Dl=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Fl,{}),t.jsx(el,{appVersion:e})]}),zl=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}},$l=()=>{ie();const[e,s]=l.useState(null),[a,i]=l.useState({value:"Loading...",detail:null,degraded:!1}),[o,r]=l.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});l.useEffect(()=>{let m=!0;const c=_=>{if(!m)return;const y=zl(_.url);if(_.state==="connecting"){i({value:"Loading...",detail:null,degraded:!1});return}if(_.state==="detached"){i({value:"Not connected",detail:_.detail||null,degraded:!1});return}if(_.state==="wedged"){i({value:"Not attached",detail:_.detail||null,degraded:!1});return}const b=_.version||"Version unknown";i({value:y?`${b} · ${y}`:b,detail:_.detail||null,degraded:_.state==="degraded"})};let d=!1;const x=window.api?.backend?.onStatusChange(_=>{d=!0,c(_)}),f=async()=>{try{const[_,y]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);m&&(s(_),r(y))}catch(_){console.error("Error fetching app information:",_)}},h=async()=>{try{const _=window.api?.backend;if(_){const w=await _.getStatus();d||c(w);return}const y=await vn.healthCheck(en.baseUrl),b=vn.getServerVersion(y);m&&i({value:b,detail:null,degraded:!1})}catch(_){console.error("Error fetching server version:",_),m&&i({value:"Unavailable",detail:null,degraded:!1})}};return f(),h(),()=>{m=!1,x?.()}},[]);const u=(m,c,d,x={})=>t.jsx(ge,{label:t.jsx(Ze,{content:d,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(St,{size:12,className:"shrink-0"}),m]})}),valueClassName:x.valueClassName,value:t.jsxs(t.Fragment,{children:[x.valueTooltip?t.jsx(Ze,{content:x.valueTooltip,children:t.jsx("span",{"data-backend-version":x.valueHoverTarget?"":void 0,children:c})}):c,x.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:x.statusNote}):null]})});return t.jsx(de,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:Pt,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(rt,{children:[u(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")),u(n("ui.settings.updates.app_updates_section.server_version"),At(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}),u(n("ui.settings.updates.app_updates_section.platform"),`${o.platform} (${o.arch})`,n("ui.settings.updates.app_updates_section.the_operating_system_and_architecture_your_application_is_running")),u(n("ui.settings.updates.app_updates_section.node_js_version"),At(o.nodeVersion),n("ui.settings.updates.app_updates_section.the_javascript_runtime_environment_version")),u(n("ui.settings.updates.app_updates_section.electron_version"),At(o.electronVersion),n("ui.settings.updates.app_updates_section.the_framework_version_enabling_this_desktop_application"))]}),t.jsx(Dl,{appVersion:e})]})})};function js(e){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return e.resolvedLevel&&e.stored.trim()===""&&un(e.resolvedLevel,e.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:qe(e.resolvedLevel)})),[s,...ws(e.ladder,e.storable)]}function un(e,s){const a=e.trim().toLowerCase();return a===""?null:s.find(i=>i.trim().toLowerCase()===a)??null}function ws(e,s){return e.flatMap(a=>{const i=un(a,s);return i===null?[]:[{id:i,name:qe(a)}]})}function Pl(e,s){const a=e.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function Ul(e){if(!e.resolved||e.ladder===null)return null;const s=e.stored.trim().toLowerCase();if(s===""||e.ladder.some(o=>o.toLowerCase()===s))return null;const a=(e.resolvedLevel??"").trim(),i=a===""?"":un(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const yt="\0unread";function gt(e){return e.trim()===""?"":yt}function Kl(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return $e("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return $e("no-model",n("ui.settings.model.default_effort.no_model"),yt);if(e.settings==="loading")return $e("settings-loading",n("ui.settings.model.default_effort.settings_loading"),yt);if(e.settings==="error")return $e("settings-error",n("ui.settings.model.default_effort.settings_error"),yt);if(e.preview==="loading")return $e("loading",n("ui.settings.model.default_effort.loading"),gt(e.stored));if(e.preview==="error")return $e("error",n("ui.settings.model.default_effort.error"),gt(e.stored));if(e.ladder===null||!e.specResolved)return $e("unresolved",n("ui.settings.model.default_effort.unresolved"),gt(e.stored));const s=e.ladder;if(s.length===0)return $e("empty",n("ui.settings.model.default_effort.empty"),gt(e.stored));const a=ws(s,e.storable);if(a.length===0){const i=qe(s[0]),o=s.length===1&&s[0].trim().toLowerCase()==="auto";return{kind:"one-level",options:[{id:"",name:i}],selectedId:"",disabled:!0,helper:o?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:js({ladder:s,resolvedLevel:e.resolvedLevel,stored:e.stored,storable:e.storable}),selectedId:Pl(e.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function $e(e,s,a=""){return{kind:e,options:js({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const Bl=({hosting:e,modelName:s,focus:a=!1})=>{ie();const i=an(),o=kt(i.data,"draft_preview"),r=sa(),u=e!==""&&s!=="",m=Ie({queryKey:Ut.all,queryFn:()=>_e({op:"settings.list"}),enabled:o,staleTime:1e4}),c=m.data?.settings.find(G=>G.key===pt),d=typeof c?.value=="string"?c.value:"",x=(c?.choices??[]).map(G=>G.value).filter(G=>typeof G=="string"),f={cwd:r??"",model:u?{provider:e,model_id:s,reasoning_effort:null}:null},h=m.isSuccess?d:null,_=Ie({...Ha(f,kt(i.data,"draft_fast")),queryKey:[...Va(f),"model_effort",h],enabled:o&&!!r&&u}),y=_.isSuccess&&!_.isPlaceholderData,b=y?qa(_.data?.snapshot,null).effort:null,w=y&&Array.isArray(b?.reasoning_efforts)?Ga(b):null,z=y?Qa(b):null,S=b!==null&&!Ya(b),[I,v]=l.useState(!1),[N,k]=l.useState(!1),[$,W]=l.useState(null),[Q,P]=l.useState(null),Y=`${e}\0${s}`,U=sn(),K=l.useRef(null),V=l.useRef(!1),B=l.useCallback(async(G,X)=>{v(!0),W(G),k(!1),X===null&&P(null);try{await _e({op:"settings.edit",key:pt,value:G}),await U.invalidateQueries({queryKey:Ut.all}),X!==null&&P(X)}catch{k(!0)}finally{v(!1),W(null)}},[U]),M=typeof b?.display_name=="string"&&b.display_name.trim()||s,E=Kl({supported:o,hasHome:!!r,hasModel:u,settings:m.isError?"error":m.isSuccess?"ready":"loading",preview:_.isError?"error":y?"ready":"loading",ladder:w,specResolved:S,stored:d,resolvedLevel:z,storable:x}),g=Ul({stored:d,ladder:w,resolvedLevel:z,resolved:y&&S&&m.isSuccess,storable:x}),T=l.useRef(null);l.useEffect(()=>{if(g===null||I)return;const G=`${e}\0${s}\0${d}\0${g}`;if(T.current===G)return;T.current=G;const X=g===""?n("ui.settings.model.default_effort.clamped_unset",{level:qe(d),model:M}):n("ui.settings.model.default_effort.clamped",{level:qe(d),model:M,resolved:qe(g)});B(g,{text:X,model:Y})},[g,d,I,B,e,s,M,Y]);const A=l.useMemo(()=>E.options.map(Vl),[E.options]);l.useEffect(()=>{if(!a){V.current=!1;return}E.disabled||V.current||(K.current?.querySelector("[role=combobox]")?.focus(),V.current=!0)},[a,E.disabled]);const Z=$??E.selectedId,J=A.find(G=>G.id===Z)??($!==null?{id:$,name:qe($)}:null),ee=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:E.helper}),N&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:Q?.model===Y?Q.text:""})]});return E.kind==="unsupported"?null:t.jsx("div",{ref:K,"data-setting-key":pt,children:t.jsx(Mi,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(ri,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:A,selected:J,onSelect:G=>{B(G.id,null)},helperText:ee,busy:I,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:E.disabled||I})})};function Vl(e){return{id:e.id,name:e.name,description:e.description}}const Hl=e=>e.replace(/[\p{Co}\p{Cc}]/gu," ").replace(/\s+/g," ").trim(),Ns=(e,s)=>{const a=s.trim().toLocaleLowerCase();return a?e.filter(i=>`${i.title} ${i.cwd} ${i.sourceId}`.toLocaleLowerCase().includes(a)):e},ql=(e,s)=>`${e??""}\0${[...s].sort().join("\0")}`,Ss=5e3,Gl=(e,s,a,i=Ss)=>{const o=new Set(a);let r=!1;for(const u of Ns(e,s))if(!o.has(u.sourceId)){if(o.size>=i){r=!0;break}o.add(u.sourceId)}return{selected:o,capped:r}},Ql=/cancel/i,Yl=new Set(["done","failed","cancelled"]),Dn=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"}},Ot=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"}},Wl=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"}},Zl=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"}},Jl=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",Wt=e=>Hl(e.title)||e.sourceId,zn=({path:e,label:s,onCopyPath:a})=>{const[i,o]=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(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(e).then(r=>{r&&(o(!0),window.setTimeout(()=>o(!1),1500))})},children:[i?t.jsx(ps,{size:14}):t.jsx(ns,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},Xl=({progress:e,sessions:s,selected:a})=>{const i=new Map(e.results.map(m=>[m.sourceId,m])),o=e.sessionId,r=Math.max(0,e.total-e.completed-(o&&!i.has(o)?1:0)),u=s.filter(m=>a.has(m.sourceId));return t.jsxs("div",{className:"flex flex-col gap-2",children:[e.results.map(m=>t.jsx(Ms,{row:m,jobCancelled:e.state==="cancelled"},`${m.source}:${m.sourceId}`)),u.filter(m=>!i.has(m.sourceId)&&m.sourceId!==o).map(m=>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:Wt(m)}),t.jsx(it,{variant:"neutral",children:n("ui.settings.imports.session_pending")})]},m.sourceId)),o&&!i.has(o)&&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(ft,{size:14,className:"animate-spin"}),t.jsx("span",{children:n("ui.settings.imports.session_importing")}),t.jsx("span",{className:"min-w-0 truncate",children:o})]}),r>0&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:r})}),e.warnings.map(m=>t.jsx("p",{className:"text-meta text-warning",children:m.message},`${m.code}:${m.sessionId}:${m.message}`))]})},Ms=({row:e,jobCancelled:s=!1})=>{const i=s&&e.outcome==="failed"&&e.warnings.some(o=>Ql.test(o))?"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:Jl(i),children:n(Zl(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(o=>t.jsx("p",{className:"mt-1 text-meta text-warning",children:o},o))]})},ec=({sources:e,activeSource:s,sessions:a,query:i,selected:o,preview:r,previewStale:u,previewError:m,confirmed:c,busy:d,error:x,progress:f,result:h,cancelling:_,onSelectSource:y,onQueryChange:b,onToggleSession:w,onSelectAll:z,onClearSelection:S,onConfirmChange:I,onImport:v,onCancel:N,onRetry:k,onImportAnother:$,onRefresh:W,selectionNotice:Q,onCopyPath:P})=>{ie();const Y=e.find(g=>g.source===s),U=f!==null&&!Yl.has(f.state),K=f?.total??o.size,V=l.useMemo(()=>Ns(a,i),[i,a]),B=V.length>0&&V.every(g=>o.has(g.sourceId)),M=o.size,E=M>0&&r!==null&&!u&&c&&!d&&!f&&!h;return t.jsx(de,{title:n("ui.settings.imports.title"),icon:Pt,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[x&&t.jsxs(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.settings.imports.title")}),t.jsx(Ne,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:x}),t.jsx(D,{variant:"secondary",size:"sm",onClick:k,children:n("ui.settings.imports.retry")})]})})]}),d==="sources"&&e.length===0?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(xe,{className:"h-20 w-full"}),t.jsx(xe,{className:"h-20 w-full"}),t.jsx(xe,{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(D,{variant:"ghost",size:"sm",onClick:W,disabled:U||d==="sources"||d==="sessions",children:[t.jsx(li,{size:14,className:me(d==="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 T=g.source===s,A=g.detected?n(Dn(g.availability)):n("ui.settings.imports.source_not_found");return t.jsxs("button",{type:"button","aria-pressed":T,disabled:U,onClick:()=>y(g.source),className:me("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",T?"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:A})]}),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)})})]}),Y&&!f&&!h&&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")," · ",Y.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(D,{variant:"secondary",size:"sm",onClick:B?S:z,disabled:V.length===0,children:B?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:M})})]})]}),Q&&t.jsx("output",{className:"text-meta text-warning",children:Q}),t.jsxs("div",{className:"relative",children:[t.jsx(ts,{size:15,className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),t.jsx(Ue,{value:i,onChange:g=>b(g.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"ps-9"})]}),d==="sessions"?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(xe,{className:"h-12 w-full"}),t.jsx(xe,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:Y.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:Y.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 T=`import-session-${g.source}-${g.sourceId}`;return t.jsxs("div",{className:me("flex items-start gap-3 rounded-md border p-3",o.has(g.sourceId)?"border-accent bg-row-selected":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsx(Gt,{id:T,checked:o.has(g.sourceId),onCheckedChange:()=>w(g.sourceId),"aria-label":Wt(g),className:"mt-0.5"}),t.jsxs("label",{htmlFor:T,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:Wt(g)}),t.jsx(it,{variant:g.availability==="full"?"neutral":"warning",children:n(Dn(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:nn(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)})})]}),Y&&M>0&&!f&&!h&&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")}),(d==="preview"||u||r===null&&!m)&&t.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[t.jsx(ft,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),r&&!u&&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:r.totalSessions,messages:r.totalMessages,compactions:r.totalCompactions})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:r.totalMemoryRecords,tokens:r.projectedMemoryTokens.toLocaleString()})}),r.warnings.slice(0,4).map((g,T)=>t.jsx("p",{className:"text-meta text-warning",children:g.message},`${g.code}:${g.sessionId}:${T}`)),r.warnings.length>4&&t.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:r.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:[m&&t.jsx(se,{variant:"warning",children:t.jsx(Ne,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:m}),t.jsx(D,{variant:"secondary",size:"sm",onClick:k,children:n("ui.settings.imports.retry")})]})})}),t.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[t.jsx(Gt,{checked:c,onCheckedChange:g=>I(g===!0),disabled:!r||u,"aria-label":n("ui.settings.imports.confirm_label"),className:"mt-0.5"}),t.jsx("span",{children:n("ui.settings.imports.confirm_label")})]}),t.jsxs(D,{variant:"primary",onClick:v,disabled:!E,className:"self-start",children:[d==="start"?t.jsx(ft,{size:14,className:"animate-spin"}):t.jsx(Pt,{size:14}),n("ui.settings.imports.import_button",{count:M})]})]})]}),f&&!h&&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(D,{variant:"secondary",size:"sm",onClick:N,disabled:_||f.state==="done"||f.state==="cancelled"||f.state==="failed",children:[t.jsx(aa,{size:12}),_?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(Ot(f.state))})," · ",n(Wl(f.phase))]}),t.jsx(Ci,{value:f.total?f.completed/f.total*100:0,className:"h-1.5"}),t.jsx(Xl,{progress:f,sessions:a,selected:o})]}),h&&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(D,{variant:"secondary",size:"sm",onClick:$,children:n("ui.settings.imports.import_another")})]}),t.jsx("p",{className:"text-body-sm text-ink",children:h.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n(Ot(h.state)),sessions:h.sessions.length,total:K,messages:h.messages}):n("ui.settings.imports.result_summary",{state:n(Ot(h.state)),sessions:h.sessions.length,messages:h.messages})}),h.sessions.map(g=>t.jsx(Ms,{row:g,jobCancelled:h.state==="cancelled"},`${g.source}:${g.sourceId}:${g.targetSessionId}`)),(h.instructionReviewPath||h.memoryReviewPath)&&t.jsxs("div",{className:"flex flex-col gap-2",children:[h.instructionReviewPath&&t.jsx(zn,{path:h.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:P}),h.memoryReviewPath&&t.jsx(zn,{path:h.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:P})]}),h.warnings.length>0&&t.jsx(se,{variant:"warning",children:t.jsx(Ne,{children:t.jsxs("span",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:h.warnings.length})}),h.warnings.slice(0,4).map((g,T)=>t.jsx("span",{children:g.message},`${g.code}:${T}`))]})})}),h.error&&t.jsx(se,{variant:"danger",children:t.jsx(Ne,{children:h.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),d==="start"&&!f&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ft,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},gn=e=>({source:e.source,sessionId:e.session_id,code:e.code,message:e.message}),Cs=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}),tc=e=>({jobId:e.job_id,state:e.state,sessions:e.sessions.map(Cs),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(gn),error:e.error});async function nc(){return(await _e({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 sc(e,s=!1){return(await _e({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 ac(e){const s=await _e({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(gn),instructionReviewPaths:s.instruction_review_paths}}async function ic(e){return(await _e({op:"imports.start",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0})).job_id}async function oc(e){const s=await _e({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(Cs),warnings:s.warnings.map(gn),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?tc(s.result):void 0}}async function rc(e){await _e({op:"imports.cancel",jobId:e})}const mt=new Set(["done","failed","cancelled"]),Qe=e=>e instanceof Error?e.message:String(e),lc=()=>{ie();const[e,s]=l.useState([]),[a,i]=l.useState(null),[o,r]=l.useState([]),[u,m]=l.useState(""),[c,d]=l.useState(new Set),[x,f]=l.useState(null),[h,_]=l.useState(null),[y,b]=l.useState(!1),[w,z]=l.useState(null),[S,I]=l.useState(null),[v,N]=l.useState(null),[k,$]=l.useState(null),[W,Q]=l.useState(!1),[P,Y]=l.useState(null),[U,K]=l.useState(0),V=l.useRef(0),B=l.useRef(0),[M,E]=l.useState(null),[g,T]=l.useState(null),A=l.useRef(null),Z=v!==null&&!mt.has(v.state),J=l.useCallback(async()=>{z("sources"),I(null);try{const q=await nc();s(q),i(ne=>q.some(ce=>ce.source===ne&&ce.detected)?ne:q.find(ce=>ce.detected)?.source??null)}catch(q){I(n("ui.settings.imports.error_sources",{reason:Qe(q)}))}finally{z(null)}},[]);l.useEffect(()=>{J()},[J]);const ee=l.useCallback(async q=>{const ne=++V.current;z("sessions"),I(null);try{const ue=await sc(q);if(ne!==V.current)return;r(ue)}catch(ue){if(ne!==V.current)return;r([]),I(n("ui.settings.imports.error_sessions",{source:q,reason:Qe(ue)}))}finally{ne===V.current&&z(null)}},[]);l.useEffect(()=>{if(!a){r([]);return}r([]),d(new Set),f(null),_(null),E(null),T(null),b(!1),$(null),N(null),ee(a)},[a,ee]);const G=l.useCallback(q=>{d(q),b(!1),E(null),T(null),Y(null)},[]),X=l.useCallback(q=>{Z||(i(q),m(""))},[Z]),Re=l.useCallback(q=>{const ne=new Set(c);ne.has(q)?ne.delete(q):ne.add(q),G(ne)},[G,c]),Se=l.useCallback(()=>{const q=Gl(o,u,c);G(q.selected),q.capped&&Y(n("ui.settings.imports.selection_limit",{max:Ss}))},[u,G,c,o]),ke=l.useCallback(()=>{G(new Set)},[G]),pe=l.useMemo(()=>ql(a,c),[a,c]),C=x!==null&&h!==pe,H=l.useCallback(async()=>{if(!a||c.size===0)return;const q=++B.current,ne=pe;z("preview"),I(null),T(null);try{const ue=await ac({sources:[a],sessionIds:{[a]:[...c].sort()}});if(q!==B.current)return;f(ue),_(ne)}catch(ue){if(q!==B.current)return;f(null),_(null),E(ne),T(n("ui.settings.imports.error_preview",{reason:Qe(ue)}))}finally{q===B.current&&z(null)}},[a,pe,c]);l.useEffect(()=>{if(!a||c.size===0||v||k||x&&h===pe||!x&&M===pe)return;const q=setTimeout(()=>{H()},250);return()=>clearTimeout(q)},[a,c,pe,x,h,M,v,k,H]);const O=l.useCallback(async()=>{if(!(!a||c.size===0||!x||C||!y||v)){z("start"),I(null),$(null);try{const q=await ic({sources:[a],sessionIds:{[a]:[...c].sort()}}),ne=Date.now()/1e3;N({jobId:q,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:c.size,results:[],warnings:[],error:"",startedAt:ne,updatedAt:ne})}catch(q){I(n("ui.settings.imports.error_start",{reason:Qe(q)}))}finally{z(null)}}},[a,y,x,C,v,c]),ae=v?.jobId??null,oe=v?.state??null;l.useEffect(()=>{if(!ae||!oe||mt.has(oe))return;let q=!0,ne;const ue=async()=>{try{const ce=await oc(ae);if(!q)return;if(A.current){const L=A.current;A.current=null,I(re=>re===L?null:re)}N(ce),ce.result&&$({...ce.result,jobId:ce.jobId}),mt.has(ce.state)||(ne=setTimeout(ue,900))}catch(ce){if(!q)return;const L=n("ui.settings.imports.error_job",{reason:Qe(ce)});A.current=L,I(L),ne=setTimeout(ue,2e3)}};return ne=setTimeout(ue,U>0?0:700),()=>{q=!1,ne&&clearTimeout(ne)}},[ae,oe,U]);const Ke=l.useCallback(async()=>{if(!(!v||mt.has(v.state))){Q(!0),I(null);try{await rc(v.jobId)}catch(q){I(n("ui.settings.imports.error_cancel",{reason:Qe(q)}))}finally{Q(!1)}}},[v]),he=l.useCallback(()=>{d(new Set),f(null),_(null),E(null),T(null),b(!1),Y(null),$(null),N(null),I(null),a&&ee(a)},[a,ee]),Me=l.useCallback(async q=>{try{return await navigator.clipboard.writeText(q),!0}catch{return!1}},[]),Te=l.useCallback(async()=>{Z||(Y(null),E(null),T(null),await J(),a&&await ee(a))},[a,Z,ee,J]),Be=l.useCallback(()=>{if(Z){I(null),K(q=>q+1);return}E(null),T(null),Te()},[Z,Te]);return t.jsx(ec,{sources:e,activeSource:a,sessions:o,query:u,selected:c,preview:x,previewStale:C,previewError:g,confirmed:y,busy:w,error:S,progress:v,result:k,cancelling:W,onSelectSource:X,onQueryChange:m,onToggleSession:Re,onSelectAll:Se,onClearSelection:ke,onConfirmChange:b,onImport:()=>void O(),onCancel:()=>void Ke(),onRetry:Be,onImportAnother:he,onRefresh:Te,selectionNotice:P,onCopyPath:Me})},cc=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function As(e){if(!e)return null;const s=e.split("\\").join("/").split("/").filter(Boolean);for(const[a,i]of cc)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const vt=e=>n("ui.settings.integrations.integration_model.tool_count",{count:e}),dc=e=>n("ui.settings.integrations.integration_model.integration_count",{count:e}),uc=["connected","needs_sign_in","not_started","connecting","error"],Es=e=>uc.includes(e),Je=(e,s)=>[...s].filter(a=>a.name===e&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,gc={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},mc=1e12,_c=1e9,pc=60*60*1e3,Is=(e,s=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const a=e>=mc?e:e<_c?null:e*1e3;return a===null||a>s+pc?null:Math.min(a,s)},Ge=(e,s)=>e?.[s]??gc,lt=(e,s,a)=>xc(e,s)??a?.lastDecisive??null,fc=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}:{}}),mn=(e,s)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(s.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),hc=(e,s)=>[...s].filter(a=>a.name===e).sort((a,i)=>i.created_at-a.created_at)[0]??null,xc=(e,s)=>hc(e,s.filter(a=>a.status!=="cancelled")),Mt=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function yc(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 o=Math.round(i/60);return o<24?n("ui.settings.integrations.integration_model.hours_h_ago",{hours:o}):n("ui.settings.integrations.integration_model.days_ago",{days:Math.round(o/24)})}function Lt(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 o=a.replace(/^(?:connection (?:closed|error|refused)|error|closed|failed)\s*:\s*/i,"").trim();if(o===a)break;a=o}return a=a.replace(/\s*\(\s*\d{3}\s*\)/g,"").replace(/\s+([.,;])/g,"$1").replace(/\s{2,}/g," ").trim(),a||null}function vc(e,s=[],a,i=Date.now()){const o=Ge(a,e.name),r=Je(e.name,s);if(r){if(r.action==="login"||r.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(r.action==="logout")return{label:n("ui.settings.integrations.integration_model.signing_out"),tone:"info",detail:null,busy:!0}}if(!Es(e.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const u=lt(e.name,s,o),m=Ct(u)&&e.status!=="connected",c=mn(e,o),d=fn(u)&&e.status!=="connected",x=(u?.action==="login"||u?.action==="reauth")&&u.status==="failed";if(o.disconnectedAt!==null)return{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1,explanation:n($n)};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?n("ui.settings.integrations.integration_model.connected_with_tools",{tools:String(vt(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"||at(e,s,o)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Lt(e.status_reason),busy:!1};case"error":return{label:n("ui.settings.integrations.integration_model.couldn_t_start"),tone:"danger",detail:Lt(e.status_reason)??n("ui.settings.integrations.integration_model.no_reason_was_given"),busy:!1};default:if(m)return{label:n("ui.settings.integrations.integration_model.signed_out"),tone:"warning",detail:null,busy:!1};if(d)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(at(e,s,o))return{label:n("ui.settings.integrations.integration_model.needs_a_key"),tone:"warning",detail:null,busy:!1};if(x)return{label:n("ui.settings.integrations.integration_model.sign_in_didn_t_finish"),tone:"warning",detail:null,busy:!1};if(o.needsSignIn)return{label:e.auth.kind==="api_key"||at(e,s,o)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:Lt(e.status_reason),busy:!1};if(e.status_basis==="stored"&&c&&o.disconnectedAt===null){const f=o.connectedAt??Is(e.last_seen_at,i);return{label:f!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(yc(i,f)),tools:String(vt(e.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String(vt(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($n)}:{label:n("ui.settings.integrations.integration_model.ready"),tone:"neutral",detail:null,busy:!1,explanation:n(jc)}}}const Rs=e=>n("ui.settings.integrations.integration_model.replace_keys",{count:e}),bc=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function kc(e,s){const a=e?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(bc,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const jc="ui.settings.integrations.integration_model.copy_ready_explanation",$n="ui.settings.integrations.integration_model.copy_not_connected_explanation",wc=e=>e.transport==="local_command"?n("ui.settings.integrations.integration_model.local_command"):n("ui.settings.integrations.integration_model.remote_url");function Ts(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 As(e.source.path)}}function Nc(e,s){const a=[{text:wc(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(vt(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=Ts(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 _n=(e,s)=>s.disconnectedAt!==null?"not_started":e.status;function pn(e,s=[],a){const i=Ge(a,e.name),o=Je(e.name,s);if(o)return o.action==="login"||o.action==="reauth"?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.continue_sign_in")}:null;const r=x=>e.actions.includes(x),u=Mt(e),m=at(e,s,i);if(!Es(e.status))return r("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const c=lt(e.name,s,i),d=c?.status==="failed"&&ct(c);switch(_n(e,i)){case"connected":case"connecting":return null;case"needs_sign_in":return m?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:r("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}:u?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:r("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 r("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:r("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.retry")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};default:{if(Ct(c)&&r("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(fn(c)&&r("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&r("connect"))return{kind:"connect",label:n("ui.settings.integrations.integration_model.connect")};if(i.needsSignIn){if(m&&u)return{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")};if(r("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}}return m&&u?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:d&&r("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:mn(e,i)&&!r("connect")?null:r("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:r("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",Ct=e=>!!(e&&e.action==="logout"&&e.status==="complete"),fn=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),Os=/no oauth authorization server/i;function at(e,s,a){if(!Mt(e))return!1;const i=lt(e.name,s,a);return i&&ct(i)&&i.status==="failed"&&Os.test(i.message??"")?!0:a.needsKey}function Sc(e,s=[],a){const i=pn(e,s,a)?.kind,o=_n(e,Ge(a,e.name)),r=c=>e.actions.includes(c),u=[],m=Je(e.name,s);if(m&&u.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!m&&r("test")&&i!=="test"&&u.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),r("connect")&&i!=="connect"&&o!=="connected"&&u.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!m&&r("sign_in")&&i!=="sign_in"&&o!=="connected"&&u.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),r("reload")&&u.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!m&&r("reauth")&&i!=="reauth"&&u.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),Mt(e)&&i!=="set_key"&&u.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")}),r("sign_out")&&u.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),r("disconnect")&&o==="connected"&&u.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),r("copy_setup")&&e.setup_prompt&&u.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&u.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),r("remove"))u.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!e.source.editable){const c=Ts(e);u.push({kind:"remove_elsewhere",label:c?n("ui.settings.integrations.integration_model.remove_in_origin",{origin:String(c)}):n("ui.settings.integrations.integration_model.remove_in_its_own_file"),hint:c?n("ui.settings.integrations.integration_model.defined_in_origin_s_config_remove_it_there",{origin:String(c)}):n("ui.settings.integrations.integration_model.defined_in_a_file_this_app_doesn_t_write_remove_it_there")})}return u}const Mc={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 Ls(e,s=[],a){const i=Ge(a,e.name),o=Je(e.name,s),r=_n(e,i);if(o&&i.pinnedGroup&&i.pinnedOperationId===o.id)return i.pinnedGroup;if(r==="needs_sign_in"||r==="error")return"attention";const u=lt(e.name,s,i);return Ct(u)&&r!=="connected"||fn(u)&&r!=="connected"?"attention":i.disconnectedAt!==null?"ready":at(e,s,i)||i.needsSignIn&&r!=="connected"||u?.status==="failed"&&ct(u)&&r!=="connected"?"attention":r==="connected"||e.status_basis==="stored"&&mn(e,i)?"connected":o&&o.action!=="test"?"attention":"ready"}function Cc(e,s=[],a){return["attention","connected","ready"].map(o=>({id:o,title:Mc[o],rows:e.filter(r=>Ls(r,s,a)===o)})).filter(o=>o.rows.length>0)}function Ac(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const o of s.servers){const r=Ge(e,o.name),u=Je(o.name,s.operations),m=lt(o.name,s.operations,r),c=Ct(m),d=o.status==="connected"&&(o.status_basis==="probe"||o.status_basis==="live"),x=r.holdUntil!==null&&a<r.holdUntil,f=!x&&!c&&r.connectedAt===null&&o.status_basis==="stored"&&o.tool_count_basis==="last_seen"?Is(o.last_seen_at,a):null,h=!c,_=m?.status==="failed"&&ct(m)&&Os.test(m.message??""),y={connectedAt:d&&!x?a:f!==null?f:h?r.connectedAt:null,connectedToolCount:d&&!x||f!==null?o.tool_count??r.connectedToolCount:h?r.connectedToolCount:null,settledGroup:r.settledGroup,pinnedGroup:u&&r.pinnedOperationId===u.id?r.pinnedGroup:u?r.settledGroup:null,pinnedOperationId:u?u.id:null,needsKey:d?!1:r.needsKey||_,needsSignIn:d||c?!1:r.needsSignIn||o.status==="needs_sign_in",disconnectedAt:d&&!x?null:r.disconnectedAt,holdUntil:x?r.holdUntil:null,lastDecisive:m?fc(m):null};u||(y.settledGroup=Ls(o,s.operations,{...i,[o.name]:y})),i[o.name]=y}return i}const Ec=(e,s)=>e!==null&&s===e,Zt="local-operator.settings.integrations.row-memory",Fs=(e,s)=>`${e}#${s}`;function Ic(e,s){const a={};if(!s)return a;for(const i of s.servers){const o=e[i.name];o&&(a[Fs(i.source.path,i.name)]=o)}return a}function Rc(e,s,a){if(!s)return e;let i=null;for(const o of s.servers){if(Object.prototype.hasOwnProperty.call(e,o.name))continue;const r=Lc(a[Fs(o.source.path,o.name)]);r&&(i=i??{...e},i[o.name]=r)}return i??e}const Tc=["attention","connected","ready"],Ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),hn=e=>typeof e=="number"&&Number.isFinite(e)?e:null,Pn=e=>Tc.includes(e)?e:null,Ft=e=>{const s=hn(e);return s!==null&&s>=1e12?s:null};function Oc(e){if(!Ds(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:hn(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function Lc(e){if(!Ds(e))return null;const s=Ft(e.connectedAt),a=Ft(e.disconnectedAt),i=e.needsKey===!0,o=e.needsSignIn===!0,r=Oc(e.lastDecisive);return s===null&&a===null&&!i&&!o&&!r?null:{connectedAt:s,connectedToolCount:hn(e.connectedToolCount),settledGroup:Pn(e.settledGroup),pinnedGroup:Pn(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:i,needsSignIn:o,disconnectedAt:a,holdUntil:Ft(e.holdUntil),lastDecisive:r}}const zs=2e3,Un=8e3;function Fc(e){return e&&(e.servers.some(a=>a.status==="connecting")||e.operations.some(a=>a.status==="running"))?zs:!1}const Dc=/^[A-Za-z0-9_.:-]{1,100}$/,zc=/:\/\//;function $c(e,s){const a=e.trim();return a?Dc.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 Pc(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"):zc.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 Uc=e=>e.split(`
|
|
287
|
+
`).map(s=>s.trim()).filter(Boolean);function Jt(e,s){const a=!!e?.cold,i=(e?.servers??[]).map(o=>{const r=o.transport==="http",u=o.secret_refs??[],m=o.status==="connected"?"connected":o.status==="connecting"?"connecting":o.status==="auth-required"?"needs_sign_in":"not_started",c=[];m!=="connected"&&c.push("connect"),m==="connected"&&c.push("disconnect"),a||c.push("reload"),r&&o.transport_oauth_supported!==!1&&c.push("sign_in"),u.length>0&&c.push("set_key"),o.owned_scope&&c.push("remove"),o.setup?.text&&c.push("copy_setup");const d=As(o.source);return{id:o.name,name:o.name,scope:o.owned_scope??"global",project_cwd:null,source:{kind:Kc(o.source,d,o.owned_scope),path:o.source??"",editable:o.owned_scope!==null,owned_scope:o.owned_scope},transport:r?"remote_url":"local_command",endpoint:{command:null,url:null,endpoint_redacted:!1},status:m,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:a?"stored":"live",auth:{kind:u.length?"api_key":r?"unknown":"none",signed_in:null,secret_refs:u.map(x=>({id:x.id,state:"missing"}))},tool_count:typeof o.tool_count=="number"?o.tool_count:null,tool_count_basis:typeof o.tool_count=="number"?"live":null,actions:c,setup_prompt:o.setup?.text??null}});return{cwd:"",project_scope_available:i.some(o=>o.source.owned_scope==="project"),global_path:"",project_path:null,status_source:a?"config":"live",session_id:s,servers:i,operations:(e?.operations??[]).map(o=>({...o}))}}const Kc=(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",Kn={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")}},Bc="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function _t(e,s,a){if(s instanceof on&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(Kn,s.code)?Kn[s.code]:n(Bc);return`${ia[e]}. ${i}`}return oa(e,s,a).message}const Vc="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",Hc="ui.settings.integrations.add_integration_form.copy_transport_hint",qc=({existingNames:e,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:o,initial:r})=>{ie();const[u,m]=l.useState(r?.name??""),[c,d]=l.useState(r?.mode??"command"),[x,f]=l.useState(r?.command??""),[h,_]=l.useState(r?.args??""),[y,b]=l.useState(r?.url??""),[w,z]=l.useState("global"),[S,I]=l.useState(r?.touched?{name:!0,command:!0,url:!0}:{}),[v,N]=l.useState(!!r?.touched),[k,$]=l.useState(!1),[W,Q]=l.useState(null),P=l.useRef(null),Y=l.useRef(null),U=l.useRef(null);l.useEffect(()=>{P.current?.focus()},[]);const K=$c(u,e),V=c==="command"&&!x.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,B=c==="url"?Pc(y):null,M=A=>v||S[A],E=async A=>{if(A.preventDefault(),N(!0),K||V||B){K?P.current?.focus():V?Y.current?.focus():U.current?.focus();return}$(!0),Q(null);const Z=s?w:"global",J=c==="command"?{name:u.trim(),scope:Z,mode:c,command:x.trim(),args:Uc(h)}:{name:u.trim(),scope:Z,mode:c,url:y.trim()},ee=await i(J);$(!1),Q(ee)},g=(A,Z,J)=>Z&&M(J)?t.jsx("p",{id:A,className:"text-body-sm text-danger",children:Z}):null,T=A=>A.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:A=>void E(A),onKeyDown:A=>{A.key==="Escape"&&(A.stopPropagation(),o())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Fe,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(Ue,{ref:P,id:"integration-add-name",value:u,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(K&&M("name")),"aria-describedby":K&&M("name")?"integration-add-name-error":void 0,onChange:A=>m(A.target.value),onBlur:()=>I(A=>({...A,name:!0}))}),g("integration-add-name-error",K,"name")]}),t.jsxs(jt,{value:c,onValueChange:A=>d(A==="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(wt,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(Ye,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),t.jsx(Ye,{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(Hc)}),t.jsxs(Sn,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Fe,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(Ue,{ref:Y,id:"integration-add-command",value:x,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(V&&M("command")),"aria-describedby":V&&M("command")?"integration-add-command-error":void 0,onChange:A=>f(A.target.value),onBlur:()=>I(A=>({...A,command:!0}))}),g("integration-add-command-error",V,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Fe,{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(fs,{id:"integration-add-args",value:h,rows:2,className:"font-mono",onChange:A=>_(A.target.value)})]})]}),t.jsx(Sn,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Fe,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(Ue,{ref:U,id:"integration-add-url",type:"url",value:y,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(B&&M("url")),"aria-describedby":B&&M("url")?"integration-add-url-error":"integration-add-url-help",onChange:A=>b(A.target.value),onBlur:()=>I(A=>({...A,url:!0}))}),g("integration-add-url-error",B,"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(jt,{value:w,onValueChange:A=>z(A==="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(wt,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(Ye,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),t.jsx(Ye,{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,W?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:W}):null,t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("p",{className:me("text-body-sm text-ink-dim"),children:n(Vc)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(D,{type:"button",variant:"ghost",size:"md",onMouseDown:T,onClick:o,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(D,{type:"submit",variant:"primary",size:"md",disabled:k,onMouseDown:T,children:[k?t.jsx(ye,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},Gc=4;function Qc(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function Yc(e){return e.now>e.hold.until||e.hold.reanchors>=Gc?"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 Wc(e){const s=Qc({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 o=Yc({hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},candidate:i,active:e.active,body:e.body,now:e.now});if(o==="settled")return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(o==="drop")return{hold:null,land:null};const r=!a.isConnected;return{hold:{until:r?e.now+e.windowMs:s,reanchors:r?e.hold.reanchors+1:e.hold.reanchors,landedOn:i},land:i}}function Zc(e){const{row:s,target:a}=e;return!s||!a||typeof a.nodeType!="number"?!1:!s.contains(a)}const Bn=250;function Vn(e){return e?!e.disabled:!1}function Jc(e){return Vn(e.primary)?e.primary??null:Vn(e.overflow)?e.overflow??null:null}function Xc(e){return e.verdict==="finished"?null:e.watchMs}const $s="key";function ed(e){const{name:s,keyless:a,freeName:i,names:o,values:r,replace:u,canReplace:m}=e;if(a){const c=Xt(s,i);return{values:{[c]:(r[$s]??"").trim()},confirmedReplace:u&&m?[c]:[],header:i.trim()}}return{values:Object.fromEntries(o.map(c=>[c,(r[c]??"").trim()])),confirmedReplace:u&&m?o:[],header:void 0}}function Xt(e,s){const a=Hn(e),i=Hn(s);if(!i)return"";const o=[a,i].filter(Boolean).join("_"),r=/^[A-Za-z_]/.test(o)?o:`K_${o}`;if(r.length<=Dt)return r;const u=td(a),m=Dt-i.length-u.length-2,c=[a.slice(0,Math.max(m,0)),u,i].filter(Boolean).join("_");return c.length<=Dt?c:c.slice(-128)}const Dt=128,Hn=e=>e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),td=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)},nd=({name:e,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:o,failure:r,onSave:u,onClose:m})=>{ie();const[c,d]=l.useState({}),[x,f]=l.useState(!1),[h,_]=l.useState(""),y=a?[Xt(e,h)]:[...s],b=a?[$s]:y,w=(a?Xt(e,h).length>0:!0)&&b.every(S=>(c[S]??"").trim()),z=y.some(S=>i.includes(S));return t.jsx(ss,{open:!0,onClose:m,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(Kt,{onClick:m,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),t.jsx(Bt,{disabled:!w||o,onClick:()=>{const S=ed({name:e,keyless:a,freeName:h,names:y,values:c,replace:x,canReplace:z});u(S.values,S.confirmedReplace,S.header)},children:o?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(Fe,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),t.jsx(Ue,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:h,onChange:S=>_(S.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,b.filter(S=>a!==!0||S.trim().length>0).map(S=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Fe,{htmlFor:`integration-key-${S}`,className:"font-mono",children:a?"Key":S}),t.jsx(Ue,{id:`integration-key-${S}`,type:"password",autoComplete:"off",value:c[S]??"",onChange:I=>d(v=>({...v,[S]:I.target.value}))})]},S)),z?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(Gt,{id:"integration-key-replace",checked:x,onCheckedChange:S=>f(S===!0)}),t.jsx(Fe,{htmlFor:"integration-key-replace",className:"font-normal",children:Rs(y.length)})]}):null,r?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:r}):null]})})},sd={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},ad={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"},id=({row:e,operations:s,memories:a,now:i,projectScopeAvailable:o,highlighted:r=!1,rowRef:u,primaryRef:m,overflowRef:c,pending:d,failure:x,confirm:f,onPrimary:h,onOverflow:_,onConfirm:y,onCancelConfirm:b})=>{ie();const w=vc(e,s,a,i),z=r&&w.tone==="danger"?"text-ink":ad[w.tone],S=pn(e,s,a),I=Sc(e,s,a),v=Nc(e,o),N=I.findIndex(k=>k.kind==="remove"||k.kind==="remove_elsewhere");return t.jsxs("li",{ref:u,"data-integration":e.name,"data-status":e.status,className:me("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",r&&"bg-row-selected"),onKeyDown:k=>{!f||k.key!=="Escape"||(k.stopPropagation(),b())},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(ye,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":w.tone,className:me("size-2 rounded-full",sd[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:v.map((k,$)=>t.jsxs("span",{children:[$>0?" · ":null,k.importSource&&e.source.path?t.jsx(Ze,{content:Wa(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:k.text})}):k.text]},k.text))})]}),w.explanation?t.jsx(Ze,{content:w.explanation,children:t.jsx("span",{className:me("shrink-0 text-body-sm",z),children:w.label})}):t.jsx("span",{className:me("shrink-0 text-body-sm",z),children:w.label}),S?t.jsxs(D,{ref:m,variant:S.variant??"secondary",size:"sm","aria-label":`${S.label} ${e.name}`,disabled:d,"data-integration-action":S.kind,onClick:()=>h(S),children:[d?t.jsx(ye,{size:"xs"}):null,S.label]}):null,t.jsxs(Ai,{children:[t.jsx(Ei,{asChild:!0,children:t.jsx(D,{ref:c,variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_row.more_actions_for_name",{name:String(e.name)}),disabled:d,children:t.jsx(ra,{"aria-hidden":"true"})})}),t.jsx(Ii,{align:"end",className:"min-w-48",children:I.map((k,$)=>t.jsx(od,{item:k,separated:$===N&&$>0,onSelect:()=>_(k)},k.kind))})]})]}),w.detail?t.jsx("p",{className:me("ps-7 text-body-sm",w.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:w.detail}):null,x?t.jsx("p",{className:me("ps-7 text-body-sm",r?"text-ink":"text-danger"),role:"alert",children:x}):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(D,{variant:"danger",size:"sm",onClick:y,"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(D,{variant:"ghost",size:"sm",onClick:b,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},od=({item:e,separated:s,onSelect:a})=>(ie(),t.jsxs(t.Fragment,{children:[s?t.jsx(Ri,{}):null,e.kind==="remove_elsewhere"?t.jsxs(Mn,{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(Mn,{destructive:e.kind==="remove",onSelect:a,"data-integration-menu":e.kind,children:e.label})]}));function rd(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:kc(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:ld(s.message??null,a)}}function ld(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 cd(e,s){return e.kind==="ready"?"ready":e.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const dd=({name:e,action:s,keyRoute:a,phase:i,onStart:o,onCancel:r,onOpenLink:u,onClose:m})=>{ie();const c=i.kind==="running"?i.operation:null,d=i.kind==="running"?rd(e,c,a):null,x=i.kind==="starting"||i.kind==="running"&&d?.tone==="progress",f=d&&d.tone!=="progress",h=l.useRef(null),_=l.useRef(!1),y=cd(i,d);l.useEffect(()=>{if(!_.current){_.current=!0;return}y&&h.current?.focus()},[y]);const b=()=>m(d?.tone==="success"?"signed-in":"dismissed");return t.jsx(ss,{open:!0,onClose:b,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(),h.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[x&&c?t.jsx(Kt,{ref:h,onClick:()=>r(c.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(Kt,{ref:i.kind==="ready"?void 0:h,onClick:b,children:d?.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(Bt,{ref:h,onClick:o,children:n("ui.settings.integrations.integration_sign_in_dialog.continue_in_browser")}):null,i.kind==="refused"||d?.tone==="failure"?t.jsx(Bt,{ref:d?.tone==="failure"?h:void 0,onClick:o,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(ye,{size:"xs"}),n("ui.settings.integrations.integration_sign_in_dialog.starting_sign_in")]}):null,d?t.jsxs("div",{className:"flex flex-col gap-1",role:f?"status":void 0,children:[t.jsxs("p",{className:(d.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[d.tone==="progress"?t.jsx(ye,{size:"xs",className:"mt-0.5"}):null,d.tone==="failure"?t.jsx(Ti,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,t.jsx("span",{children:d.message})]}),d.reason?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:d.reason}):null,d.nextStep?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:d.nextStep}):null]}):null,d?.link&&d.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:d.link,children:d.link}),t.jsx(D,{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(d.link??"").then(()=>Vt(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:t.jsx(ns,{"aria-hidden":"true"})})]}),t.jsx(D,{variant:"link",size:"sm",onClick:()=>u(d.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]})})},ud=e=>e.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),gd=/^[A-Za-z]:[\\/]/,bt=e=>{const s=e?.trim();return s&&(s.startsWith("/")||gd.test(s))?s:null};function md(e){const o=e?.payload?.frontend?.snapshot?.cwd;return typeof o=="string"&&o.trim()?o:null}const ot="local-operator.settings.integrations.last-cwd";function _d(e,s,a=typeof localStorage>"u"?null:localStorage){const i=bt(s);if(!(!e||!i||!a))try{const o=a.getItem(ot),r=o?JSON.parse(o):{};if(r[e]===i)return;a.setItem(ot,JSON.stringify({...r,[e]:i}))}catch{}}const Ps=()=>typeof localStorage>"u"?null:localStorage;function Us(e=Ps()){if(!e)return{};try{const s=e.getItem(Zt);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const qn=256;function pd(e,s=Ps()){if(s)try{const a={...Us(s),...e},i=Object.keys(a);if(i.length>qn){const o={};for(const r of i.slice(-qn))o[r]=a[r];s.setItem(Zt,JSON.stringify(o));return}s.setItem(Zt,JSON.stringify(a))}catch{}}function Gn(e,s,a){if(e==="saved")return null;if(e==="replace_confirmation_required"){const o=Rs(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(o)})}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 fd(e,s=typeof localStorage>"u"?null:localStorage){if(!(!e||!s))try{const a=s.getItem(ot);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const o={...i};delete o[e],s.setItem(ot,JSON.stringify(o))}catch{}}const hd=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),xd=(e,s)=>s!==null&&e===s?null:e;function yd(e,s=typeof localStorage>"u"?null:localStorage){if(!e||!s)return null;try{const a=s.getItem(ot);if(!a)return null;const o=JSON.parse(a)[e];return typeof o=="string"?o:null}catch{return null}}const vd=e=>e.action==="disconnect"?"disconnected":"connected";function bd(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 kd(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 jd({sessionId:e}){const s=an(),a=kt(s.data,"mcp_catalog"),i=kt(s.data,"mcp"),o=a?"catalog":i?"session":null,[r,u]=l.useState(null),m=sn(),c=st(C=>C.sessions),d=st(C=>C.fetchSessions),x=st(C=>C.loading),f=l.useMemo(()=>c.find(C=>C.session_id===e)??null,[c,e]),h=l.useMemo(()=>o==="session"&&!e?ud(c):null,[o,e,c]),_=o==="session"?e??h?.session_id??null:null;l.useEffect(()=>{o!=="session"||e||c.length>0||d(Za)},[o,e,c.length,d]);const y=o==="catalog"?bt(f?.cwd):null,b=o==="catalog"&&!!e&&y===null,w=Ie({queryKey:["desktop","session-cwd",e??""],queryFn:()=>_e({op:"sessions.get",sessionId:e??""}),enabled:b,staleTime:Number.POSITIVE_INFINITY,retry:!1}),z=b&&!w.isFetched,S=y??bt(md(w.data))??(w.isFetched?bt(yd(e)):null),I=xd(S,r),v=o==="catalog"?I:null,N=o==="catalog"?e??null:null,k=la.catalog(v,N);l.useEffect(()=>{o!=="catalog"||!e||!v||_d(e,v)},[o,e,v]);const $=l.useRef(0),[W,Q]=l.useState(0),P=l.useRef(null),Y=l.useCallback((C,H)=>{const O=Date.now()+Un;$.current=O,P.current={name:C,expect:H},Q(O)},[]),U=l.useCallback(C=>Date.now()<$.current?zs:Fc(C),[]),K=Ie({queryKey:k,queryFn:()=>ua(v,N),enabled:o==="catalog"&&!z,staleTime:1e4,refetchInterval:C=>U(C.state.data)}),V=hd(K.error);l.useEffect(()=>{!V||!S||r===S||(u(S),fd(e))},[V,S,r,e]);const B=Ie({queryKey:Ht.list(_??""),queryFn:()=>ga(_??""),enabled:o==="session"&&!!_,staleTime:1e4,refetchInterval:C=>U(C.state.data?Jt(C.state.data,_??""):void 0)}),M=l.useMemo(()=>{if(o==="catalog")return K.data;if(o==="session"&&B.data&&_)return Jt(B.data,_)},[o,K.data,B.data,_]),E=l.useCallback(()=>wd({queryClient:m,route:o,catalogKey:k,sessionId:_}),[o,k,m,_]);l.useEffect(()=>{if(!W)return;const C=P.current;if(!C)return;const H=M?.servers.find(ae=>ae.name===C.name);!H||!(C.expect==="connected"?H.status==="connected":H.status_basis==="live"&&H.status!=="connected")||($.current=0,P.current=null,Q(0))},[M,W]);const g=l.useRef({}),[T,A]=l.useState(0),Z=l.useMemo(()=>(g.current=Ac(Rc(g.current,M,Us()),M),g.current),[M,T]),J=l.useRef("");l.useEffect(()=>{const C=Ic(Z,M);if(!Object.keys(C).length)return;const H=JSON.stringify(C);H!==J.current&&(J.current=H,pd(C))},[Z,M]);const ee=l.useCallback(C=>{const H=Ge(g.current,C);H.needsKey||(g.current={...g.current,[C]:{...H,needsKey:!0}},A(O=>O+1))},[]),G=l.useCallback(C=>{if(C.action!=="disconnect"&&C.action!=="connect"&&C.action!=="reload")return;const H=Ge(g.current,C.name),O=Date.now()+Un,ae=C.action==="disconnect"?{...H,connectedAt:null,disconnectedAt:Date.now(),holdUntil:O}:{...H,disconnectedAt:null,holdUntil:O};g.current={...g.current,[C.name]:ae},Y(C.name,vd(C)),A(oe=>oe+1)},[Y]),X=l.useCallback(async C=>{if(o==="catalog"){const H=bd(C);if(!H)return null;try{const O=await ca(v,H);return m.setQueryData(k,O),G(C),O.operation?.id??null}catch(O){throw O instanceof on&&O.status===409&&m.invalidateQueries({queryKey:k}),O}}if(o==="session"&&_){const H=await _e({op:"mcp.control",sessionId:_,control:kd(C)});G(C);const O=Ht.list(_),ae=H?.data;return ae&&"servers"in ae&&Array.isArray(ae.servers)?(m.setQueryData(O,ae),null):(m.invalidateQueries({queryKey:O}),ae&&"id"in ae&&typeof ae.id=="string"?ae.id:null)}return null},[o,v,k,m,_,G]),Re=l.useCallback(async C=>{if(o==="catalog"&&N&&(C.action==="connect"||C.action==="disconnect"||C.action==="reload")){try{await _e({op:"mcp.control",sessionId:N,control:{action:C.action,name:C.name,...C.action==="disconnect"?{confirmed:!0}:{}}})}catch(H){throw m.invalidateQueries({queryKey:k}),H}return G(C),await m.invalidateQueries({queryKey:k}),null}return X(C)},[o,N,m,k,X,G]),Se=l.useCallback(async(C,H,O,ae)=>{if(o==="catalog"){const oe=await da(v,C,H,O,ae);if(oe.catalog&&m.setQueryData(k,oe.catalog),oe.code!=="saved")return{saved:!1,message:Gn(oe.code,oe.failed_ids,H)};try{await X({action:"test",name:C})}catch{}return{saved:!0,message:null}}if(o==="session"&&_){const oe=await _e({op:"mcp.credentials.store",sessionId:_,name:C,values:H,confirmedReplace:O});if(oe.data?.code!=="saved")return{saved:!1,message:Gn(oe.data?.code,oe.data?.failed_ids??[],H)};try{await X({action:"connect",name:C})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[o,v,k,m,X,_]),ke=o==="catalog"?K:B,pe=l.useCallback(()=>{ke.refetch()},[ke]);return{enabled:o!==null,route:o,sessionId:o==="catalog"?N:_,borrowed:h,noConversation:o==="session"&&!_&&!x,document:M,isLoading:s.isLoading||o==="catalog"&&(z||K.isLoading)||o==="session"&&(_?B.isLoading:x),isError:ke.isError,folderUnavailable:Ec(r,S),refetch:pe,readDocument:E,control:Re,storeKeys:Se,memories:Z,markNeedsKey:ee}}function wd(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const s=e.queryClient.getQueryData(Ht.list(e.sessionId));return s?Jt(s,e.sessionId):void 0}}const Nd=(e,s)=>{const a=e?.trim();if(!a)return null;const i=_a(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},Sd=6,zt="ui.settings.integrations.mcp_management_section.copy_section_title",Md="ui.settings.integrations.mcp_management_section.copy_section_description",Cd={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},Ad=({sessionId:e,sectionRef:s,highlightServer:a})=>{ie();const i=jd({sessionId:e}),{document:o,control:r,readDocument:u}=i,m=cs(),c=o?.servers??[],d=o?.operations??[],x=o?.project_scope_available??!1,[f,h]=l.useState(!1),[_,y]=l.useState(""),[b,w]=l.useState(null),[z,S]=l.useState({}),[I,v]=l.useState(null),[N,k]=l.useState(null),[$,W]=l.useState({kind:"ready"}),[Q,P]=l.useState(null),[Y,U]=l.useState(null),[K,V]=l.useState(!1),B=l.useRef({}),M=l.useRef({}),E=l.useRef({}),g=l.useRef(0),T=l.useRef(null),A=l.useRef(null),Z=l.useRef(null),[J,ee]=l.useState(null),[G,X]=l.useState(null),[Re,Se]=l.useState(null),ke=l.useCallback(()=>{const p=Z.current;Z.current=null,k(null),P(null),window.setTimeout(()=>{p?.isConnected&&p.focus()},0)},[]),pe=l.useCallback(p=>{const j=window.document.activeElement;Z.current=j instanceof HTMLElement?j:null,k(p)},[]),C=l.useCallback((p,j)=>{X({name:p,waitForSignIn:j==="signed-in",until:Date.now()+tt,reanchors:0}),ke()},[ke]),H=l.useMemo(()=>Nd(a,c.map(p=>p.name)),[a,c]),O=H?.kind==="matched"?H.name:null,ae=l.useRef(null),oe=l.useRef(null),Ke=_.trim().toLowerCase(),he=l.useMemo(()=>Ke?c.filter(p=>p.name.toLowerCase().includes(Ke)):c,[c,Ke]),Me=Cc(he,d,i.memories),Te=N?.kind==="sign_in"?c.find(p=>p.name===N.name)??null:null;l.useEffect(()=>{!O||oe.current===O||!_||y("")},[O,_]),l.useEffect(()=>{!O||oe.current===O||he.some(p=>p.name===O)&&(oe.current=O,ae.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[O,he]),l.useEffect(()=>{if(!Q)return;const p=d.find(j=>j.id===Q)??null;W({kind:"running",operation:p})},[d,Q]);const Be=d.some(p=>p.status==="running"),q=p=>{const j=window.document.activeElement;j&&j!==window.document.body&&j.isConnected||X({name:p,waitForSignIn:!1,until:Date.now()+tt,reanchors:0})},ne=async(p,j,F)=>{w(p),S(({[p]:ze,...Ae})=>Ae);let te=null,be=!1;try{te=await F()}catch(ze){be=!0,S(Ae=>({...Ae,[p]:_t(Cd[j]??"status",ze,Be)}))}finally{w(null),j!=="sign_out"&&(j!=="remove"||be)&&q(p)}return{operationId:te,failed:be}},ue=p=>c.find(j=>j.name===p),ce=p=>{p.source.path&&pa(p.source.path)},L=async(p,j)=>{W({kind:"starting"}),P(null);try{const F=await r({action:j,name:p});F?P(F):W({kind:"running",operation:null})}catch(F){F instanceof on&&F.code==="oauth_unsupported"&&i.markNeedsKey(p),W({kind:"refused",message:_t("grant",F,Be)})}},re=(p,j)=>{switch(j.kind){case"sign_in":case"reauth":{const F=d.find(te=>te.name===p.name&&te.status==="running");F&&ct(F)?(W({kind:"running",operation:F}),P(F.id)):(W({kind:"ready"}),P(null)),pe({kind:"sign_in",name:p.name,action:j.kind==="reauth"?"reauth":"login"});return}case"set_key":U(null),pe({kind:"key",name:p.name,keyNames:p.auth.secret_refs.map(F=>F.id)});return;case"fix":ce(p);return;case"sign_out":v({name:p.name,kind:"sign_out"});return;default:{const F=j.kind;ne(p.name,F,()=>r({action:F,name:p.name}))}}},le=(p,j)=>{switch(j.kind){case"remove":case"sign_out":v({name:p.name,kind:j.kind});return;case"sign_in":case"reauth":case"set_key":re(p,{kind:j.kind,label:j.label});return;case"open_config":ce(p);return;case"copy_setup":navigator.clipboard.writeText(p.setup_prompt??"").then(()=>Vt(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const F=d.find(te=>te.name===p.name&&te.status==="running");F&&ne(p.name,"cancel",()=>r({action:"cancel",operationId:F.id}));return}case"test":case"connect":case"disconnect":case"reload":{const F=j.kind;ne(p.name,F,()=>r({action:F,name:p.name}));return}default:return}},ve=(p,j)=>{if(v(null),j==="remove"){const F=p.source.owned_scope;if(!F)return;const te=he.findIndex(be=>be.name===p.name);ne(p.name,"remove",()=>r({action:"remove",name:p.name,scope:F})).then(({operationId:be,failed:ze})=>{ze||be!==null||(Vt(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(p.name)})),te>=0&&Se({index:te}))});return}ne(p.name,"sign_out",()=>r({action:"logout",name:p.name})).then(()=>{X({name:p.name,waitForSignIn:!1,until:Date.now()+tt,reanchors:0})})},Oe=async p=>{try{return await r({action:"add",name:p.name,scope:p.scope,...p.mode==="command"?{command:p.command,args:p.args}:{url:p.url}}),h(!1),ee(p.name),null}catch(j){return _t("add",j,!1)}},fe=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(zt)}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(Md)})]}),i.enabled&&c.length>0&&!f?t.jsxs(D,{ref:T,variant:"secondary",size:"sm",onClick:()=>h(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(jn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(de,{title:n(zt),titleComponent:fe,sectionRef:s,children:t.jsx(se,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const De=t.jsx(qc,{existingNames:c.map(p=>p.name),projectScopeAvailable:x,projectLabel:o?.cwd?Id(o.cwd):null,onSubmit:Oe,onCancel:()=>{h(!1),window.setTimeout(()=>T.current?.focus(),0)}}),je=N?ue(N.name):void 0,Ve=Object.entries(z).filter(([p])=>!c.some(j=>j.name===p)),Ce=p=>S(({[p]:j,...F})=>F);l.useEffect(()=>{if(!J)return;const p=B.current[J];if(!p){c.some(j=>j.name===J)&&(M.current[J]?.focus(),ee(null));return}p.focus(),ee(null)},[J,c]),l.useEffect(()=>{if(!Re)return;const j=he[Math.min(Re.index,he.length-1)]??he.at(-1);if(j){const F=B.current[j.name]??M.current[j.name];if(!F)return;F.focus()}else T.current?.focus();Se(null)},[Re,he]);const we=l.useCallback((p,j)=>{const F=u()??o,te=F?.servers.find(Vs=>Vs.name===p.name),be=F?.operations??[],ze=te?te.status==="connecting"||Je(te.name,be)!==null:!1;ze&&te&&(g.current=j);const Ae=te?pn(te,be,i.memories):null;if(te&&p.waitForSignIn&&(Ae?.kind==="sign_in"||Ae?.kind==="reauth"))return"kept";const Le=Wc({hold:p,now:j,windowMs:tt,rowMoving:ze,lastMovingAt:g.current,candidate:te?Jc({primary:Ae?B.current[te.name]:null,overflow:M.current[te.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Le.hold)return X(null),"finished";if(!Le.land)return"kept";X({name:p.name,waitForSignIn:!1,until:Le.hold.until,landedOn:Le.land,reanchors:Le.hold.reanchors});const xn=Le.land;return window.setTimeout(()=>{xn.isConnected&&xn.focus()},0),"landed"},[u,o,i.memories]);return l.useEffect(()=>{if(!G)return;we(G,Date.now());let p=0,j=!1;const F=()=>{if(j)return;const te=Xc({verdict:we(G,Date.now()),watchMs:Bn});te!==null&&(p=window.setTimeout(F,te))};return p=window.setTimeout(F,Bn),()=>{j=!0,window.clearTimeout(p)}},[G,we]),l.useEffect(()=>{if(!G)return;const p=j=>{Zc({target:j.target,row:E.current[G.name]})&&X(null)};return window.document.addEventListener("pointerdown",p,!0),()=>{window.document.removeEventListener("pointerdown",p,!0)}},[G]),t.jsxs(de,{title:n(zt),titleComponent:fe,sectionRef:s,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(D,{variant:"primary",size:"sm",onClick:()=>m("/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(ye,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?t.jsx(se,{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(se,{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(D,{variant:"secondary",size:"sm",onClick:i.refetch,children:n("ui.settings.integrations.mcp_management_section.retry")})]})}):null,Ve.map(([p,j])=>t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:j}),t.jsx(D,{variant:"ghost",size:"sm",onClick:()=>Ce(p),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},p)),f&&c.length>0?De:null,c.length>=Sd?t.jsxs("div",{className:"relative",children:[t.jsx(ts,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Ue,{ref:A,value:_,onChange:p=>y(p.target.value),onKeyDown:p=>{p.key!=="Escape"||!_||(p.preventDefault(),y(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:dc(c.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"ps-9"})]}):null,H?.kind==="miss"&&c.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(H.asked)})}):null,H?.kind==="matched"&&H.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(H.name),asked:String(H.unresolved)})}):null,o&&c.length===0&&!i.isLoading?f?De:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(as,{"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(D,{variant:"primary",size:"md",onClick:()=>h(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(jn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,c.length>0&&he.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(D,{variant:"secondary",size:"sm",onClick:()=>{y(""),window.setTimeout(()=>{(A.current??T.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,Me.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(id,{row:j,operations:d,memories:i.memories,projectScopeAvailable:x,highlighted:j.name===O,rowRef:F=>{E.current[j.name]=F,j.name===O&&(ae.current=F)},primaryRef:F=>{B.current[j.name]=F},overflowRef:F=>{M.current[j.name]=F},pending:b===j.name,failure:z[j.name]??null,confirm:I?.name===j.name?{kind:I.kind}:null,onPrimary:F=>re(j,F),onOverflow:F=>le(j,F),onConfirm:()=>I&&ve(j,I.kind),onCancelConfirm:()=>{v(null),window.setTimeout(()=>{M.current[j.name]?.focus()},0)}},j.id))})]},p.id))]}),N?.kind==="sign_in"?t.jsx(dd,{name:N.name,action:N.action,keyRoute:Te?Mt(Te):!1,phase:$,onStart:()=>void L(N.name,N.action),onCancel:p=>void r({action:"cancel",operationId:p}).catch(()=>{}),onOpenLink:p=>void ma(p),onClose:p=>C(N.name,p)}):null,N?.kind==="key"?t.jsx(nd,{name:N.name,keyNames:N.keyNames.length?N.keyNames:je?.auth.secret_refs.map(p=>p.id)??[],keyless:N.keyNames.length===0,savedKeys:je?.auth.secret_refs.filter(p=>p.state==="encrypted").map(p=>p.id),saving:K,failure:Y,onClose:ke,onSave:(p,j,F)=>{V(!0),U(null),i.storeKeys(N.name,p,j,F).then(te=>{if(!te.saved){U(te.message);return}k(null),X({name:N.name,waitForSignIn:!1,until:Date.now()+tt,reanchors:0})}).catch(te=>U(_t("key",te,!1))).finally(()=>V(!1))}}):null]})},tt=4e3,Ed=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,Id=e=>e.replace(Ed,"~"),Rd=({verification:e})=>{ie();const{prices:s}=ha(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:o}=xa(e.signup_grant,ya(a)),r=va(e.claim_url,ba);return t.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[t.jsx(St,{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(D,{variant:"secondary",size:"sm",onClick:()=>ka(r),children:o})]})]})},Td=({onAfterCredentialUpdate:e})=>{ie();const{isAuthenticated:s,user:a,isLoading:i,accountRead:o,signOut:r}=fa(),u=is(f=>f.isSigningOut),m=l.useCallback(async()=>{try{await r()}catch(f){console.error("Error signing out:",f)}},[r]),c=(()=>{if(!s||!a?.radientUser)return null;const{account:f,identity:h,verification:_}=a.radientUser,y=_!=null&&!_.email_verified&&_.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsxs(rt,{children:[t.jsx(ge,{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(ge,{label:n("ui.settings.account.radient_account_section.name"),value:f.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(ge,{label:n("ui.settings.account.radient_account_section.email"),value:f.email}),t.jsx(ge,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.id})}),t.jsx(ge,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.tenant_id})}),t.jsx(ge,{label:n("ui.settings.account.radient_account_section.provider"),value:t.jsx("span",{className:"capitalize",children:h.provider})}),t.jsx(ge,{label:n("ui.settings.account.radient_account_section.created"),value:os(f.created_at)})]}),y&&_?t.jsx(Rd,{verification:_}):null,t.jsx("div",{className:"mt-8",children:t.jsx(ci,{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(D,{variant:"danger",className:"mt-3",onClick:m,children:[t.jsx(di,{}),n("ui.settings.account.radient_account_section.sign_out_from_radient")]})]})]})})(),d=o==="refused"?n("ui.settings.account.radient_account_section.radient_refused_the_sign_in_this_app_is_holding_so_your_account_d"):rs(o)?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"),x=s&&a?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[d," ",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(Ui,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]});return i||u?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(ye,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!u&&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?c:t.jsx("div",{className:"flex flex-col gap-4",children:x})};function Od({metric:e,data:s}){return ie(),t.jsx(ja,{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)}`:wa(a),children:t.jsx(al,{data:s,children:t.jsx(Xn,{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 Ld={all:["desktop","tts-path-resolution"]};function Fd(e){return Ie({queryKey:Ld.all,queryFn:()=>_e({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:Ja})}const Dd=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function Qn(e){const s=new Map(e.map(o=>[o.key,o])),a=[],i=[];for(const o of Dd){const r=s.get(o);r?a.push(r):i.push(o)}return{rows:a,missing:i}}const zd=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Yn(e){return typeof e=="string"&&zd.includes(e)}function $d(e){if(e===null||typeof e!="object")return null;const s=e;if(!Yn(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 o=i;if(!Yn(o.path)||typeof o.available!="boolean"||typeof o.reason!="string")return null;a.push({path:o.path,available:o.available,reason:o.reason})}return{path:s.path,reason:s.reason,servable:s.servable,rungs:a}}const Pd={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 Ks(e){return Pd[e]}function Ud(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(s=>({path:s.path,name:Ks(s.path),available:s.available,reason:s.reason}))}}const Kd="ui.settings.speech.speech_section.copy_backend_older_sentence",Bs="ui.settings.speech.speech_section.copy_unavailable_sentence",Bd=({resetErrorBoundary:e})=>(ie(),t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:n(Bs)}),t.jsxs(D,{variant:"secondary",onClick:e,children:[t.jsx(Li,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function Vd(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const Hd=({sectionRef:e})=>{ie();const s=an(),a=ls(),i=Xa(s.data,"tts"),o=Vd(i),r=Ie({queryKey:Ut.all,queryFn:()=>_e({op:"settings.list"}),enabled:o==="ready",staleTime:1e4}),u=Fd(o==="ready"),{hasRadientApiKey:m,hasRadientSession:c,speechBlock:d}=Na(),x=`${c}:${m}`,f=l.useRef(x),h=u.refetch;l.useEffect(()=>{f.current!==x&&(f.current=x,h())},[x,h]);const _=r.data,y=l.useMemo(()=>Qn(_?.settings??[]),[_]),[b,w]=l.useState({}),[z,S]=l.useState({}),[I,v]=l.useState({});l.useEffect(()=>{_&&w(g=>{let T=!1;const A={...g};for(const Z of Qn(_.settings).rows){const J=g[Z.key];if(J&&J.value!==Xe(Z).value)continue;const ee=Xe(Z);J&&J.value===ee.value&&J.cascadeBase===ee.cascadeBase||(A[Z.key]=ee,T=!0)}return T?A:g})},[_]);const N=(g,T)=>S(A=>({...A,[g]:T})),k=(g,T)=>v(A=>({...A,[g]:T})),$=async g=>{const T=b[g.key];if(!T)return;const A=Ca(g,T);if(!A.ok){k(g.key,A.error);return}N(g.key,!0),k(g.key,null);try{await _e(A.request),N(g.key,!1);const J=(await r.refetch()).data?.settings.find(ee=>ee.key===g.key);J&&w(ee=>{const G=ee[g.key];return G&&G.value===T.value&&G.cascadeBase===T.cascadeBase?{...ee,[g.key]:Xe(J)}:ee})}catch(Z){N(g.key,!1),k(g.key,Z instanceof Error?Z.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},W=async g=>{N(g.key,!0),k(g.key,null);try{await _e({op:"settings.reset",key:g.key}),w(T=>({...T,[g.key]:Xe({...g,value:g.default,is_default:!0})})),N(g.key,!1),await r.refetch()}catch(T){N(g.key,!1),k(g.key,T instanceof Error?T.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},Q=l.useMemo(()=>$d(u.data),[u.data]),P=Q?Ud(Q):null,Y=u.isSuccess&&Q===null,U=(s.data?null:s.error)??null,K=r.error,V=n("ui.settings.speech.speech_section.speech_voicing"),B=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(o==="pairing"){const{sentence:g}=qt(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),U);return t.jsx(de,{title:V,icon:dt,description:B,sectionRef:e,children:t.jsx(se,{variant:"warning",children:g})})}if(o==="older")return t.jsx(de,{title:V,icon:dt,description:B,sectionRef:e,children:t.jsx(se,{variant:"warning",children:n(Kd)})});if(K||!_){const{sentence:g,remedy:T}=qt(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),K);return t.jsx(de,{title:V,icon:dt,description:B,sectionRef:e,children:t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:g}),T&&t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{r.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const M=P?!P.servable:d==="offline",E=P?P.rungs.find(g=>g.path===P.serving)??null:null;return t.jsx(de,{title:V,icon:dt,description:B,sectionRef:e,children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[u.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(ye,{}),bn("checking")]}),(u.isError||Y)&&!P&&d!=="offline"&&t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[n(Bs)," ",u.error instanceof Error?u.error.message:""]}),t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{u.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})}),t.jsx(Oi,{fallbackRender:Bd,resetKeys:[u.dataUpdatedAt],children:P&&t.jsxs(t.Fragment,{children:[t.jsxs(rt,{children:[t.jsx(ge,{label:n("ui.settings.speech.speech_section.speaks_through"),value:P.serving?Ks(P.serving):n("ui.settings.speech.speech_section.nothing_yet")}),t.jsx(ge,{label:n("ui.settings.speech.speech_section.availability"),value:P.servable?n("ui.settings.speech.speech_section.ready"):n("ui.settings.speech.speech_section.no_provider")})]}),P.reason&&P.reason!==E?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:P.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:P.rungs.map(g=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:g.path===P.serving?"text-ink":"text-ink-muted",children:[g.name,t.jsxs("span",{className:g.path===P.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))})]})})]}),M&&t.jsx(se,{variant:"warning",children:bn(d)}),t.jsx("div",{className:"flex flex-col gap-1",children:y.rows.map(g=>t.jsx(Sa,{setting:g,draft:b[g.key]??Xe(g),tier:Ma(g),saving:!!z[g.key],error:I[g.key]??null,onDraftChange:T=>w(A=>({...A,[g.key]:T})),onSave:()=>{$(g)},onReset:()=>{W(g)}},g.key))}),y.missing.length>0&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:y.missing.length,rows:y.missing.join(", ")})})]})})},qd=()=>{ie();const{data:e,isLoading:s,error:a,refetch:i}=tl(),o=nl(),[r,u]=l.useState(""),[m,c]=l.useState(!1);l.useEffect(()=>{u(e?.content??""),c(!1)},[e]);const d=y=>{const b=y.target.value;u(b),c(b!==(e?.content??""))},x=async()=>{if(!(!m||o.isPending))try{const y={content:r};await o.mutateAsync(y),await i(),c(!1)}catch(y){console.error("Error updating system prompt:",y)}},f=()=>{u(e?.content??""),c(!1)},h=o.isPending,_=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Fe,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(fs,{id:"app-system-prompt",name:"systemPrompt",value:r,onChange:d,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(D,{variant:"primary",onClick:x,disabled:!m||h,children:[h?t.jsx(ye,{size:"sm"}):t.jsx(ms,{}),h?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(D,{onClick:f,disabled:!m||h,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:nn(e.last_modified)})]})]});return t.jsx(de,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:Ki,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(ye,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a?t.jsx(se,{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")})}):_()})},Gd=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Qd=e=>Gd.includes(e),Yd=e=>{const s=[];let a=0;for(const i of e){const o=Math.max(0,Math.floor(i.count)),r=Math.max(1,Math.floor(i.columns));for(let u=0;u<o;u+=r)s.push({start:a+u,count:Math.min(r,o-u)});a+=o}return s},Wd=({index:e,key:s,groups:a})=>{const i=Yd(a),o=i.reduce((r,u)=>r+u.count,0);if(!Number.isInteger(e)||e<0||e>=o)return e;switch(s){case"Home":return 0;case"End":return o-1;case"ArrowLeft":return Math.max(0,e-1);case"ArrowRight":return Math.min(o-1,e+1);case"ArrowUp":case"ArrowDown":{const r=i.findIndex(c=>e>=c.start&&e<c.start+c.count),u=i[r+(s==="ArrowDown"?1:-1)];if(!u)return e;const m=e-i[r].start;return u.start+Math.min(m,u.count-1)}default:return e}},Zd={localOperatorDark:ur,localOperatorLight:Ir,dracula:jr,dune:$o,sage:sr,monokai:gi,tokyoNight:pr,iceberg:Nr,radient:Zo,neon:Ea,obsidian:hs,synth:Xi,catppuccinMocha:wo,catppuccinLatte:rr,tokyoNightStorm:fo,gruvbox:ro,nord:Xr,oneDark:Zi,solarizedDark:Ar,rosePine:Bo,rosePineMoon:cr,rosePineDawn:ko,alucard:Ho,gruvboxLight:Io,tokyoNightDay:mr,oneLight:ir,catppuccinFrappe:Ao,catppuccinMacchiato:Xo,palenight:Aa,everforest:Hr,everforestLight:Br,kanagawaWave:Yr,kanagawaLotus:Uo,ayuDark:To,ayuMirage:Lo,ayuLight:yr,nightfox:xo,duskfox:Lr,synthwave:hr,matrix:to,tron:_o,cyberpunk:ui,vaporwave:Ur,outrun:io,neonNoir:Gr,arcade:tr,forest:$r,ocean:Do,desert:Dr,autumn:Zr,lavender:Mr,arctic:vo,rosewood:Yo,solarizedLight:Tr,githubLight:Go,paper:Bi,linen:br,highContrastLight:Yi,mintLight:so},Wn="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",Jd=({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"})]})]})]}),Xd=({id:e,name:s,description:a,isSelected:i,isTabStop:o,onSelect:r,onFocusTile:u})=>{const m=Zd[e];return t.jsx(Ze,{side:"bottom",align:"start",content:a,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":i,tabIndex:o?0:-1,onFocus:u,onClick:r,className:me("relative flex flex-col gap-1.5 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart",i?Wn:"hover:bg-surface"),children:[t.jsxs("span",{className:me("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",i?"border-accent":"border-hairline"),children:[t.jsx(Jd,{id:e}),i&&t.jsx("span",{className:me("pointer-events-none absolute top-0.5 end-0.5 flex h-4 w-4 items-center justify-center rounded-full",Wn),children:t.jsx(ps,{size:12,className:"text-accent","aria-hidden":"true"})})]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(m,{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})]})]})})},eu=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(o=>Math.abs(o.getBoundingClientRect().top-i)<1).length)}}),tu=()=>{ie();const{themeName:e,setTheme:s}=nt(),a=Object.values(Hs),i=[{label:n("ui.settings.appearance.theme_selector.dark"),items:a.filter(c=>c.theme.palette.mode==="dark")},{label:n("ui.settings.appearance.theme_selector.light"),items:a.filter(c=>c.theme.palette.mode==="light")}].filter(c=>c.items.length>0),[o,r]=l.useState(null),u=l.useMemo(()=>{const c=i.flatMap(d=>d.items.map(x=>x.id));return o&&c.includes(o)?o:c.includes(e)?e:c[0]},[i,o,e]),m=c=>{if(!Qd(c.key))return;const d=[...c.currentTarget.querySelectorAll("[data-theme-tile]")],x=d.indexOf(c.target);if(x<0)return;c.preventDefault();const f=Wd({index:x,key:c.key,groups:eu(c.currentTarget)});f!==x&&d[f]?.focus()};return t.jsx(Fi,{children:t.jsx("div",{onKeyDown:m,className:"flex flex-col gap-6",children:i.map(c=>t.jsxs("div",{children:[t.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:c.label}),t.jsx("div",{"data-theme-grid":c.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:c.items.map(({id:d,name:x,description:f})=>t.jsx(Xd,{id:d,name:x,description:f,isSelected:d===e,isTabStop:d===u,onSelect:()=>s(d),onFocusTile:()=>r(d)},d))})]},c.label))})})},nu=({value:e,onChange:s})=>{ie();const a=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:a,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(jt,{value:e,onValueChange:i=>s(ds(i)),children:t.jsx(wt,{"aria-labelledby":a,children:ei.map(i=>t.jsx(Ye,{value:i.value,children:i.value==="by-turn"?n("ui.settings.appearance.transcript_display_mode_setting.by_turn"):n("ui.settings.appearance.transcript_display_mode_setting.by_response")},i.value))})})})]})},su=()=>{ie();const{data:e,isLoading:s,error:a}=ol({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(Mo,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(xe,{className:"h-6 w-36"}),a&&t.jsx(se,{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(D,{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(go,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},au=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],iu=()=>{ie();const[e,s]=l.useState("credits"),a=l.useMemo(()=>{const m=new Date,c=sl(m);return{start_date:Cn(c),end_date:Cn(m),rollup:"daily"}},[]),{data:i,isLoading:o,error:r}=ll(a,{enabled:!0}),u=l.useMemo(()=>i?.data_points?[...i.data_points].sort((c,d)=>Et(c.timestamp).getTime()-Et(d.timestamp).getTime()).map(c=>({bucket:$a(qi(Et(c.timestamp),"yyyy-MM-dd")),value:e==="credits"?Number.parseFloat(c.total_cost.toFixed(2)):c.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(co,{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:au.map(({id:m,label:c})=>t.jsx(D,{variant:"ghost",size:"sm","aria-pressed":e===m,onClick:()=>s(m),className:me(e===m&&"bg-surface text-ink hover:bg-surface"),children:c},m))})]})]}),o&&t.jsx(xe,{className:"h-62 w-full"}),r&&t.jsx(se,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:r.message})}),!o&&!r&&i&&u.length>0&&t.jsx(Od,{metric:e,data:u}),!o&&!r&&(!i||u.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")})]})},ou=()=>(ie(),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(Ni,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_account")]}),t.jsx(D,{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(Pa,{})]})})]})),bu=()=>{ie();const e=Ia(),s=nt(L=>L.showAgentReasoning),a=nt(L=>L.setShowAgentReasoning),i=nt(L=>L.transcriptDisplayMode),o=nt(L=>L.setTranscriptDisplayMode),{data:r,isLoading:u,isFetching:m,error:c,refetch:d}=Ra(),{needsProvider:x}=Ta(),f=ls(),{sentence:h,remedy:_}=qt(f??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),c),y=mi(),[b,w]=l.useState(null),z=is(),{isAuthenticated:S,accountRead:I,isFetching:v,isRefreshing:N,refreshUser:k}=tn(),$=st(L=>L.activeSessionId),W=st(L=>L.sessions),Q=Ll(),{accountId:P,snapshot:Y,model:U}=gs(),K=l.useRef(null);Y.status?K.current={accountId:P,status:Y.status}:Y.checking||(K.current=null);const V=Y.status??(K.current?.accountId===P?K.current.status:null),B=pl(Q),M=l.useMemo(()=>_i.filter(L=>L.id!=="agent-messages"||Q!=="absent"),[Q]),E=l.useCallback(()=>U.check("surface_open",!0),[U]),[g,T]=l.useState("general"),[A,Z]=l.useState(!1),J=l.useRef(null),ee=l.useRef(null),{startTour:G}=pi(),X=ti(),Re=cs(),{data:Se,refetch:ke}=Oa(),{refreshModels:pe}=La(),C=l.useMemo(()=>Se?.keys?[...Se.keys].sort():[],[Se?.keys]),H=l.useRef({keys:"",hosting:void 0});l.useEffect(()=>{const L=C.join(","),re=r?.values?.hosting;(H.current.keys!==L||H.current.hosting!==re)&&(H.current={keys:L,hosting:re},pe().catch(le=>{console.error("Failed to refresh models after credentials or hosting change:",le)}))},[C,r?.values?.hosting,pe]);const O=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,ae=l.useMemo(()=>new URLSearchParams(X.search).get("setting"),[X.search]),oe=l.useMemo(()=>new URLSearchParams(X.search).get("filter")??"",[X.search]),Ke=l.useMemo(()=>new URLSearchParams(X.search).get("mcp")??void 0,[X.search]),he=l.useMemo(()=>new URLSearchParams(X.search).get("provider"),[X.search]),Me=l.useCallback(L=>{T(L),Z(!0);const re=O[L],le=ee.current;if(re?.current&&le){const Oe=re.current.getBoundingClientRect().top-le.getBoundingClientRect().top;le.scrollHeight>le.clientHeight?le.scrollTo({top:Math.max(0,le.scrollTop+Oe-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,re.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(J.current??void 0),J.current=setTimeout(()=>{Z(!1),J.current=null},800)}else Z(!1)},[O]);l.useEffect(()=>{const L=setTimeout(()=>{const re=ee.current;if(!re)return;const le=()=>{if(A)return;const ve=re.getBoundingClientRect(),Oe=ve.height;let fe="",De=0;for(const[je,Ve]of Object.entries(O))if(Ve.current){const Ce=Ve.current.getBoundingClientRect(),we=ve.top,p=Ce.top-we,j=Ce.bottom-we,F=Ce.height,te=Math.max(0,p),be=Math.min(Oe,j),Ae=Math.max(0,be-te)/F,Le=Ae+(p<Oe*.3?.1:0);Le>De&&Ae>.1&&(De=Le,fe=je)}fe&&fe!==g&&T(fe)};return le(),re.addEventListener("scroll",le,{passive:!0}),()=>{re.removeEventListener("scroll",le),clearTimeout(J.current??void 0)}},100);return()=>clearTimeout(L)},[O,g,A]),l.useEffect(()=>{const L=new URLSearchParams(X.search),re=L.get("section"),le=L.get("setting"),ve=le?kn(le,"backend"):re;if(ve==="agent-messages"&&!B)return;const Oe=ve?O[ve]:void 0;if(!ve||!Oe)return;let fe=!1,De=Number.NaN,je=0;const Ve=window.setTimeout(()=>{fe||(fe=!0,we.disconnect(),Me(ve))},2e3),Ce=()=>{if(fe)return;const p=Oe.current;if(!p){je=requestAnimationFrame(Ce);return}const j=Math.round(p.getBoundingClientRect().top+window.scrollY);if(j===De&&j>0){fe=!0,we.disconnect(),window.clearTimeout(Ve),Me(ve);return}De=j,je=requestAnimationFrame(Ce)},we=new ResizeObserver(()=>{fe||(cancelAnimationFrame(je),je=requestAnimationFrame(Ce))});return ee.current&&we.observe(ee.current),je=requestAnimationFrame(Ce),()=>{fe=!0,cancelAnimationFrame(je),we.disconnect(),window.clearTimeout(Ve)}},[X.search,O,Me,B]);const Te=async(L,re)=>{w(L);try{await y.mutateAsync({[L]:re}),await d()}catch(le){console.error(`Error updating ${L}:`,le)}finally{w(null)}},Be=u,q=I==="checking",ne=rs(I),ue=I==="ready"||I==="checking"||v,ce=us(Be,4e3);return c?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(se,{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:h}),_&&t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void d(),disabled:m,children:m?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):Be?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(ye,{size:"lg",label:ce?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),ce&&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")})]}):r?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(fi,{activeSection:g,onSelectSection:Me,sections:M})}),t.jsx("div",{ref:ee,"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.jsx(Si,{title:n("ui.settings.page.title"),icon:wn}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:O.general,className:"flex flex-col gap-8",children:[t.jsx(hi,{focus:ae===Di}),t.jsxs(de,{title:n("ui.settings.profile.title"),icon:xi,description:n(S?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[q&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),ne&&t.jsx(se,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(I==="refused"?"ui.settings.profile.account_read_failed_refused":"ui.settings.profile.account_read_failed_retry")}),t.jsx(D,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>k(),disabled:N,children:N?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Nn,{value:z.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:b==="user_name",onSave:async L=>{w("user_name");try{z.updateName(L)}finally{w(null)}},readOnly:ue}),t.jsx(Nn,{value:z.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:b==="user_email",onSave:async L=>{w("user_email");try{z.updateEmail(L)}finally{w(null)}},readOnly:ue})]})]}),t.jsx(de,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:t.jsxs(D,{variant:"secondary",onClick:()=>{G({forceModalCompleted:!0})},children:[t.jsx(Fa,{}),n("ui.settings.tour.action")]})}),t.jsx(de,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:yi,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(vi,{value:r.values.hosting,isSaving:b==="hosting",onSave:L=>Te("hosting",L),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),t.jsx(bi,{value:r.values.model_name,hostingId:r.values.hosting,isSaving:b==="model_name",onSave:L=>Te("model_name",L),allowCustom:!0,allowDefault:!1}),t.jsx(Bl,{hosting:r.values.hosting,modelName:r.values.model_name,focus:ae===pt}),x&&t.jsx(se,{variant:"neutral",icon:t.jsx(St,{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:()=>{Me("providers"),O.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(qd,{}),t.jsx(de,{title:n("ui.settings.configuration.settings_page.configuration_information"),icon:St,description:n("ui.settings.configuration.settings_page.system_information_about_the_current_configuration"),children:t.jsxs(rt,{children:[t.jsx(ge,{label:n("ui.settings.configuration.settings_page.version"),value:t.jsx("span",{className:"text-mono-sm",children:r.version})}),t.jsx(ge,{label:n("ui.settings.configuration.settings_page.created"),value:os(r.metadata.created_at)}),t.jsx(ge,{label:n("ui.settings.configuration.settings_page.last_modified"),value:nn(r.metadata.last_modified)}),t.jsx(ge,{label:n("ui.settings.configuration.settings_page.description"),value:r.metadata.description||n("ui.settings.configuration.settings_page.no_description_available")})]})})]}),t.jsx(de,{title:n("ui.settings.appearance.settings_page.appearance"),icon:hs,description:n("ui.settings.appearance.settings_page.customize_the_look_and_feel_of_local_operator"),sectionRef:O.appearance,dataTourTag:"settings-appearance-section",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(tu,{}),t.jsx(xs,{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 L=>a(L)}),t.jsx(nu,{value:ds(i),onChange:L=>o(L)}),t.jsx(gl,{state:e.state,onChange:e.set})]})}),t.jsx(Hd,{sectionRef:O.speech}),t.jsx(ki,{sectionRef:O.keyboard}),t.jsx(de,{title:n("ui.settings.model.settings_page.model_providers"),icon:as,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:O.providers,id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(ji,{initialProviderId:he,onChangeModel:()=>Me("general")})}),t.jsx(Ad,{sessionId:$??void 0,sectionRef:O.integrations,highlightServer:Ke}),t.jsx(de,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:t.jsx(ou,{}),description:n("ui.settings.account.settings_page.your_radient_account_radient_pass_details_and_credits_to_use_radi"),sectionRef:O.radient,dataTourTag:"settings-radient-account-section",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(Td,{onAfterCredentialUpdate:()=>{pe(),ke()}}),S&&t.jsxs(t.Fragment,{children:[t.jsx(su,{}),t.jsx(iu,{})]})]})}),B&&t.jsx(de,{title:n("ui.agentMessages.settings.section"),icon:wi,description:n("ui.agentMessages.settings.description"),sectionRef:O["agent-messages"],id:"agent-messages",className:"border-b border-hairline pb-8",children:V?t.jsx(jl,{availability:Q,status:V,accountId:P,refusal:Y.refusal,onRefreshStatus:E,sessions:W,focus:ae===Da,onOpenSession:L=>{U.invalidateStatus(),qs(Re,L)}}):Y.refusal?t.jsxs(se,{variant:"warning",children:[t.jsx(Nt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ne,{children:[Y.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:xt(Y.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(D,{className:"mt-3",variant:"secondary",onClick:()=>void E(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(xe,{className:"h-5 w-40"}),t.jsx(xe,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(de,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:wn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:O.backend,children:t.jsx(za,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,hideStartRecording:!0,focusKey:ae&&kn(ae,"backend")==="backend"?ae:null,initialFilter:oe})}),t.jsx("div",{ref:O.imports,children:t.jsx(lc,{})}),t.jsx("div",{ref:O.updates,children:t.jsx($l,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(se,{variant:"warning",className:"w-full max-w-xl",children:n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded")})})};export{bu as SettingsPage};
|