local-operator-ui 0.48.12 → 0.48.14
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 +1620 -137
- package/out/preload/recording-encoder.js +18 -0
- package/out/renderer/assets/{_basePickBy-V9OaYcB-.js → _basePickBy-CqjnHpsV.js} +1 -1
- package/out/renderer/assets/{_baseUniq-8wB3Js4X.js → _baseUniq-CULkxOs9.js} +1 -1
- package/out/renderer/assets/{agent-details-page-BTl_-YEX.js → agent-details-page-lJZmiKX2.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-DTtPTc9w.js → agent-hub-page-CXOuZ3yB.js} +1 -1
- package/out/renderer/assets/{agents-page-Bu2x9OlH.js → agents-page-CnFoBt7k.js} +3 -3
- package/out/renderer/assets/{approvalsOverlay-SZio8Ofp.js → approvalsOverlay-GNG8MQGq.js} +1 -1
- package/out/renderer/assets/{arc-Cbb3dsAi.js → arc-oG0NKaKg.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DgaTU5dP.js → architectureDiagram-IEHRJDOE-aCa20cAA.js} +1 -1
- package/out/renderer/assets/{avatar-cropper-BFcwvqI6.js → avatar-cropper-BKB4pmro.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-DJCvCjpH.js → blockDiagram-JOT3LUYC-DoWnJlfb.js} +1 -1
- package/out/renderer/assets/{book-open-pRuf5Is_.js → book-open-_QnLjbGc.js} +1 -1
- package/out/renderer/assets/browser-page-n0j1N7Ab.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-DD_xVECS.js → browser-webauthn-prompt-2wnyPWXR.js} +1 -1
- package/out/renderer/assets/{building-2-DlFqaCQ3.js → building-2-CuIMWuHp.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-BFW_Pmyj.js → c4Diagram-VJAJSXHY-NhmXu-dk.js} +1 -1
- package/out/renderer/assets/channel-CiyaEias.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-C1dT2h3n.js → chunk-4BMEZGHF-WKw6LM2E.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-CwOEb50A.js → chunk-A2AXSNBT-VREyhp5G.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BjIII1gB.js → chunk-AEK57VVT-Dcq313P6.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-BKlGt3O8.js → chunk-D6G4REZN-BwmfGuQ0.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-CBIwKm85.js → chunk-RZ5BOZE2-B0i9CUvw.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-Dd5yyEcI.js → chunk-XZIHB7SX-Bb55_5Sx.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-D0er2Ls8.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-D0er2Ls8.js +1 -0
- package/out/renderer/assets/clone-CMoDXzY3.js +1 -0
- package/out/renderer/assets/{console-mirror-DkS5GNu7.js → console-mirror-wmAJUEAs.js} +1 -1
- package/out/renderer/assets/{consoleCapture-DxKC5eT4.js → consoleCapture-DkdTJX2Q.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-Cc-qTPXt.js → conversation-input-sync-Ljt2C84E.js} +267 -261
- package/out/renderer/assets/{dagre-OKDRZEBW-BKO9uMeH.js → dagre-OKDRZEBW-u2i5WhoT.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-CJmi-g4h.js → diagram-SSKATNLV-CujjPcjH.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-5GOk0Odf.js → diagram-VNBRO52H-2G42wb4l.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-CwFYC9OY.js → erDiagram-Q7BY3M3F-Bu73stew.js} +1 -1
- package/out/renderer/assets/{error-boundary-CNDQLahI.js → error-boundary-iAAsdMV6.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-BlZSGS3e.js → flowDiagram-4HSFHLVR-BSjvh_jr.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-BlzfkV0E.js → ganttDiagram-APWFNJXF-EJycAePi.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-D8yYVXgc.js → gitGraphDiagram-7IBYFJ6S-PB_m6UAq.js} +1 -1
- package/out/renderer/assets/{graph-CujHlOYc.js → graph-BxZlYsmw.js} +1 -1
- package/out/renderer/assets/{hash-DwXIY4Qy.js → hash-K40hVccW.js} +1 -1
- package/out/renderer/assets/{heart-DteLgKgY.js → heart-DzefdwPO.js} +1 -1
- package/out/renderer/assets/{image-plus-D_LIjrWn.js → image-plus-DVE8D9f4.js} +1 -1
- package/out/renderer/assets/{index-dUG4NGMr.js → index-BA3RZ8Br.js} +1 -1
- package/out/renderer/assets/{index-CNRyf6TH.js → index-CxREIho-.js} +1 -1
- package/out/renderer/assets/{index-Cpnczd2X.js → index-DbWHoxKa.js} +204 -204
- package/out/renderer/assets/index-LE17ehWa.css +1 -0
- package/out/renderer/assets/{index-BEwj3YQh.js → index-oOJJkr9e.js} +1 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-DXQeWslF.js +2 -0
- package/out/renderer/assets/{installer-By84PQn_.js → installer-B-eY61tX.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-3t-xjzS3.js → journeyDiagram-U35MCT3I-CyQtY9wm.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-D0Q_2Dn8.js → kanban-definition-NDS4AKOZ-tFIMwUpw.js} +1 -1
- package/out/renderer/assets/{layout-DkxReRsJ.js → layout-CTmVT6af.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-DfgBWM9T.js → legacy-agents-page--Rair6vP.js} +1 -1
- package/out/renderer/assets/{library-page-DdEXaPAq.js → library-page-uYpy37ZN.js} +3 -3
- package/out/renderer/assets/{mermaid.core-wEi2Xha0.js → mermaid.core-BvXogV1Z.js} +19 -19
- package/out/renderer/assets/{mesh-page-Cvik8kDZ.js → mesh-page-DoFh0sb0.js} +1 -1
- package/out/renderer/assets/{messages-BUgXrFuu.js → messages-th0c6S1e.js} +10 -10
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-Ckfeu4g8.js → mindmap-definition-ALO5MXBD-DZVFZ38w.js} +1 -1
- package/out/renderer/assets/{mini-BTwSkiUX.js → mini-1kvE_2tK.js} +1 -1
- package/out/renderer/assets/{notebook-pen-DaCDU6pT.js → notebook-pen-DjPosiuD.js} +1 -1
- package/out/renderer/assets/{notifications-page-gR6HfBzt.js → notifications-page-C6w6nMjb.js} +1 -1
- package/out/renderer/assets/{org-access-CgK50sRd.js → org-access-rMoT0u2l.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-Cj5TZEFY.js → org-surface-gate-B0nNR3Dz.js} +1 -1
- package/out/renderer/assets/{page-header-BxzHNbRL.js → page-header-DUmUT_Ad.js} +1 -1
- package/out/renderer/assets/{path-utils-WME2-1t6.js → path-utils-2YI9PZ0N.js} +33 -33
- package/out/renderer/assets/{pieDiagram-IB7DONF6-hQbISGxe.js → pieDiagram-IB7DONF6-BAs1yZaq.js} +1 -1
- package/out/renderer/assets/{project-markdown-GTsXHeR9.js → project-markdown-C8Uo14Aq.js} +1 -1
- package/out/renderer/assets/{projects-page-Maua55-d.js → projects-page-D_7oIEvX.js} +1 -1
- package/out/renderer/assets/{publication-validation-CEt8ujWM.js → publication-validation-DmYPLvRC.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DoZgXTb2.js → quadrantDiagram-7GDLP6J5-DG-wsRad.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-BBfDik4W.js → radar-MK3ICKWK-NF-imI4f.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-D-rNfHt_.js → radient-auth-buttons-nhpIQ5IS.js} +1 -1
- package/out/renderer/assets/recordingEncoder-vsQVVLgp.js +1 -0
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-PQXtpJrE.js → requirementDiagram-KVF5MWMF-DtKpbYlY.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-sazrDowy.js → sankeyDiagram-QLVOVGJD-D16V3y8g.js} +1 -1
- package/out/renderer/assets/{schedules-page-CysGzIAB.js → schedules-page-Cj3Uekqu.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-B_aEMcxw.js → sequenceDiagram-X6HHIX6F-CdouRiAc.js} +1 -1
- package/out/renderer/assets/settings-page-CLkD2Y91.js +288 -0
- package/out/renderer/assets/{smartart-CC6vc4y6.js → smartart-BJMtaIOY.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-CAtgbx5z.js → stateDiagram-DGXRK772-BqF42ITE.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-nsHrbQkw.js +1 -0
- package/out/renderer/assets/team-bridge-page-BcWOzonp.js +50 -0
- package/out/renderer/assets/{team-bridge-scope-preference-BF-iqyAj.js → team-bridge-scope-preference-BelhGFfv.js} +1 -1
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-CRv8lzqI.js → timeline-definition-BDJGKUSR-BjKsGQ4N.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-D5nyCqh7.js → use-download-agent-mutation-CiwSVQa5.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-DzP1uiH5.js → use-session-snapshot-De0MaqPb.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CjpCMwp7.js → xychartDiagram-VJFVF3MP-DBg47u_T.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/out/renderer/recording-encoder.html +23 -0
- package/package.json +1 -1
- package/out/renderer/assets/browser-page-DkW1hE9r.js +0 -1
- package/out/renderer/assets/channel-CenAtys0.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-CvdzoE0r.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-CvdzoE0r.js +0 -1
- package/out/renderer/assets/clone-Bt9QDldY.js +0 -1
- package/out/renderer/assets/index-4c2Ov0Zi.css +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-FQyDBbNh.js +0 -2
- package/out/renderer/assets/settings-page-Cwatgoy0.js +0 -288
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Be5VZUL8.js +0 -1
- package/out/renderer/assets/team-bridge-page-Y9vIMvkT.js +0 -50
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import{r as o,j as t,c as me,t as za}from"./index-BA3RZ8Br.js";import{h as Ae,u as xt,ap as $a,am as Pa,aq as Ua,ar as qe,a as yt,c as Je,as as Ka,a4 as Ba,at as qa,au as Va,av as Ha,aw as Ga,d as ye,ax as un,ay as Wa,az as Qa,aA as Ya,aB as Za,H as Sn,aC as Ja,w as ct,aD as Xa,o as Os,ad as ei,F as we,r as ti,q as ni,aE as gn,B as Be,aF as si,aG as Fs,a0 as ai,a1 as ii}from"./path-utils-2YI9PZ0N.js";import{o as ri}from"./console-mirror-wmAJUEAs.js";import{eM as mn,eN as oi,eO as Gn,eP as ze,cA as li,b6 as Ds,b7 as Mn,aH as zs,bu as ci,aA as di,eQ as ui,eR as gi,eS as mi,eT as pi,eU as $s,eV as Cn,b4 as Ps,eW as fi,eX as _i,eY as Lt,eZ as Us,e_ as hi,bw as pn,e$ as Wn,f0 as xi,f1 as Qe,f2 as Kt,c2 as An,f3 as En,cP as Ot,cg as yi,f4 as Ks,f5 as vi,f6 as bi,aW as Bs,by as fn,bz as _n,a2 as ki,aB as hn,f7 as ji,f8 as wi,f9 as xn,fa as Ni,fb as Si,fc as Mi,fd as qs,fe as Ci,ff as Ai,fg as Ei,dp as Ye,ei as Ii,dl as Vs,dq as Ri,b as Qn,fh as Ti,fi as In,a1 as Hs,bt as Li,fj as Gs,bx as Ws,fk as Qs,fl as Oi,fm as Fi,fn as Di,fo as zi,fp as $i,fq as Pi,dL as Ui,b3 as Ki,fr as Bi,fs as qi,c7 as Ys,cc as Vi,ft as rt,fu as Yn,fv as Hi,fw as Gi,fx as Wi,cx as Qi,fy as Yi,fz as Zi,cC as Ji,fA as Xi,fB as er,fC as tr,fD as nr,em as Qt,fE as sr,fF as ar}from"./conversation-input-sync-Ljt2C84E.js";import{d3 as Zs,d4 as ir,d5 as rr,d6 as Js,d7 as or,c8 as lr,d8 as Oe,N as cr,S as Xs,bE as vt,bF as xe,d9 as mt,da as _e,db as Yt,dc as dr,R as ur,b4 as ea,a as Zn,dd as gr,de as mr,df as pr,dg as fr,dh as Nt,di as St,bD as _r,bO as hr,dj as xr,dk as yr,dl as vr,dm as br,bt as Jn,dn as kr,bA as Xn,bY as jr,bB as wr,bC as Nr,dp as Sr,dq as Mr,bs as Cr,dr as Ar}from"./index-DbWHoxKa.js";import{P as Er}from"./page-header-DUmUT_Ad.js";import{c as $,u as ie,B as L,S as Me,_ as ta,w as Xe,N as pt,O as ft,P as Ve,A as oe,q as Bt,x as Ie,f as Se,R as Rn,U as Tn,V as Ln,W as On,Y as Ze,L as Re,K as Te,a6 as qt,$ as na,i as _t,h as yn,af as Ir,a as sa,Z as Rr,at as es,T as Fn,D as Tr,b as Lr,d as Or,I as Fr,e as ts,G as Dr,E as zr,al as $r,aa as Pr}from"./error-boundary-iAAsdMV6.js";import{t as n,L as Zt}from"./messages-th0c6S1e.js";import{u as Ur,a as Kr,D as Br,b as qr,d as Vr,S as Hr}from"./team-bridge-scope-preference-BelhGFfv.js";import{R as Gr}from"./radient-auth-buttons-nhpIQ5IS.js";import{u as Wr,A as Qr,d as Yr}from"./avatar-cropper-BKB4pmro.js";import{N as Zr}from"./notebook-pen-DjPosiuD.js";import{B as Jr}from"./book-open-_QnLjbGc.js";import{i as Xr,a as Ke,b as eo,p as Jt,f as to}from"./parseISO-CxPiCKvF.js";import{t as no}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 so=[["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"}]],ao=$("aperture",so);/**
|
|
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 io=[["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"}]],ro=$("atom",io);/**
|
|
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 oo=[["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"}]],lo=$("audio-waveform",oo);/**
|
|
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 co=[["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"}]],uo=$("binary",co);/**
|
|
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 go=[["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"}]],mo=$("candy",go);/**
|
|
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 po=[["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"}]],fo=$("car-front",po);/**
|
|
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 _o=[["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"}]],ho=$("cassette-tape",_o);/**
|
|
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 xo=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],yo=$("chart-line",xo);/**
|
|
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 vo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],bo=$("circle-plus",vo);/**
|
|
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 ko=[["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"}]],jo=$("circuit-board",ko);/**
|
|
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 wo=[["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"}]],No=$("cloud-lightning",wo);/**
|
|
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 So=[["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"}]],Mo=$("cloud-moon",So);/**
|
|
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 Co=[["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"}]],Ao=$("cloud-snow",Co);/**
|
|
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 Eo=[["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"}]],Io=$("cloud-sun",Eo);/**
|
|
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 Ro=[["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"}]],To=$("coffee",Ro);/**
|
|
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 Lo=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],aa=$("contrast",Lo);/**
|
|
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 Oo=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Fo=$("credit-card",Oo);/**
|
|
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 Do=[["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"}]],zo=$("cup-soda",Do);/**
|
|
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 $o=[["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"}]],Po=$("disc-3",$o);/**
|
|
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 Uo=[["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"}]],Ko=$("droplet",Uo);/**
|
|
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 Bo=[["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"}]],qo=$("droplets",Bo);/**
|
|
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 Vo=[["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"}]],Ho=$("fish",Vo);/**
|
|
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 Go=[["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"}]],Wo=$("flame",Go);/**
|
|
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 Qo=[["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"}]],Yo=$("flower-2",Qo);/**
|
|
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 Zo=[["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"}]],Jo=$("flower",Zo);/**
|
|
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 Xo=[["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"}]],el=$("ghost",Xo);/**
|
|
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 tl=[["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"}]],nl=$("github",tl);/**
|
|
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 sl=[["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"}]],al=$("guitar",sl);/**
|
|
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 il=[["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"}]],rl=$("hexagon",il);/**
|
|
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 ol=[["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"}]],ll=$("ice-cream-bowl",ol);/**
|
|
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 cl=[["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"}]],dl=$("joystick",cl);/**
|
|
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 ul=[["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"}]],gl=$("leaf",ul);/**
|
|
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 ml=[["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"}]],pl=$("lightbulb",ml);/**
|
|
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 fl=[["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"}]],_l=$("milk",fl);/**
|
|
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 hl=[["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"}]],xl=$("moon-star",hl);/**
|
|
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 yl=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],vl=$("moon",yl);/**
|
|
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 bl=[["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"}]],kl=$("mountain-snow",bl);/**
|
|
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 jl=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],wl=$("mountain",jl);/**
|
|
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 Nl=[["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"}]],Sl=$("radio",Nl);/**
|
|
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 Ml=[["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"}]],Cl=$("sailboat",Ml);/**
|
|
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 Al=[["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"}]],El=$("shirt",Al);/**
|
|
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 Il=[["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"}]],Rl=$("skull",Il);/**
|
|
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 Tl=[["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"}]],Ll=$("snowflake",Tl);/**
|
|
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 Ol=[["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"}]],Fl=$("sparkle",Ol);/**
|
|
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 Dl=[["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"}]],zl=$("sun-dim",Dl);/**
|
|
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 $l=[["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"}]],Pl=$("sun",$l);/**
|
|
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 Ul=[["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"}]],Kl=$("sunrise",Ul);/**
|
|
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 Bl=[["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"}]],ql=$("sunset",Bl);/**
|
|
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 Vl=[["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"}]],Hl=$("tent",Vl);/**
|
|
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 Gl=[["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"}]],Wl=$("tree-deciduous",Gl);/**
|
|
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 Ql=[["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"}]],Yl=$("tree-palm",Ql);/**
|
|
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 Zl=[["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"}]],Jl=$("tree-pine",Zl);/**
|
|
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 Xl=[["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"}]],ec=$("trees",Xl);/**
|
|
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 tc=[["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"}]],nc=$("umbrella",tc);/**
|
|
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 sc=[["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"}]],ac=$("waves",sc);/**
|
|
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 ic=[["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"}]],rc=$("wheat",ic);/**
|
|
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 oc=[["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"}]],lc=$("wind",oc),cc=({appVersion:e=null,slowWaitHintMs:s})=>{ie();const a="https://local-operator.com/download",[i,r]=o.useState(!1),l=Zs(i,s??ir),[c,u]=o.useState(!1),[d,g]=o.useState(null),[p,f]=o.useState("info"),[_,x]=o.useState(null),[b,k]=o.useState(null),N=e?.trim()?e.trim():null,T=o.useRef(!1),M=mn(D=>D.openDetail),R=o.useRef(!1),w=o.useRef(0),S=o.useRef(!1),A=o.useCallback((D,z)=>{R.current=!1,g(D),f(z),u(!0)},[]),K=o.useCallback(D=>{R.current=!0,g(D),f("success"),u(!0)},[]),V=o.useCallback(()=>{R.current&&(R.current=!1,u(!1),g(null))},[]),{clearDeferredUpdate:F}=oi();o.useEffect(()=>{const D=window.api.updater.onUpdateError(m=>{T.current&&m.includes("manually")&&(x({message:n("ui.common.updates.check_for_updates_button.the_server_is_installed_outside_the_app_so_use_the_tool_you_insta"),command:""}),R.current=!1,g(null),f("warning"),u(!0))}),z=window.api.updater.onBackendUpdateDevMode(m=>{T.current&&A(m,"info")}),W=()=>{S.current=!0,V()},P=window.api.updater.onUpdateAvailable(W),G=window.api.updater.onUpdateNpxAvailable(W),te=window.api.updater.onBackendUpdateAvailable(W);return()=>{D(),z(),P(),G(),te()}},[V,A]),o.useEffect(()=>{let D=!1;const z=()=>{window.api.updater.getLastInstallAttempt().then(P=>{D||k(P)}).catch(()=>{})};z();const W=window.api.updater.onUpdateInstallFailed(()=>z());return()=>{D=!0,W()}},[]);const B=async()=>{const D=++w.current;V(),S.current=!1;try{r(!0),T.current=!0,F(ze.UI),F(ze.BACKEND);const z=await window.api.updater.checkForAllUpdates({manual:!0});if(D!==w.current)return;z.app==="available"&&M(ze.UI),z.server==="available"&&M(ze.BACKEND),z?.affirmation&&!S.current?K(z.affirmation):V()}catch(z){if(D!==w.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${rr(z)}`)}finally{D===w.current&&r(!1),setTimeout(()=>{T.current=!1},2e3)}},H=()=>{R.current=!1,u(!1),g(null)};return t.jsxs(t.Fragment,{children:[b&&t.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[t.jsxs("p",{className:"text-body-sm text-ink",children:[n("ui.common.updates.check_for_updates_button.the_last_update_to_version"),b.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),b.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:b.attempts,attemptsText:String(b.attempts)}):"",".",N?n("ui.common.updates.check_for_updates_button.version",{liveversion:String(N)}):null]}),t.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:[n("ui.common.updates.check_for_updates_button.detected")," ",b.detectedAt?new Date(b.detectedAt).toLocaleString():n("ui.common.updates.check_for_updates_button.at_an_unknown_time"),". ",b.detail]}),t.jsx(L,{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(L,{variant:"outline",onClick:()=>void B(),disabled:i,children:[i?t.jsx(Me,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),l&&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")}),_&&t.jsxs(Gn,{open:c,autoHideDuration:1e4,onClose:H,variant:"warning",children:[t.jsx("p",{className:"text-body-sm",children:_.message}),_.command&&t.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:_.command})]}),d&&p!=="danger"&&t.jsx(Gn,{open:c,autoHideDuration:6e3,onClose:H,variant:p,children:d})]})},Ft=["system-prompt"],dc=()=>{const{shouldEnableQuery:e}=li();return Ae({enabled:e({bypassInternetCheck:!0}),queryKey:Ft,queryFn:async()=>{try{const a=await Ds(Mn.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 zs(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},uc=()=>{const e=xt(),s=Ds(Mn.baseUrl);return ci({mutationFn:async a=>{try{const i=await s.config.updateSystemPrompt(a);if(i.status>=400)throw new Error(i.message||n("ui.common.errors.system_prompt_update"));return i.result}catch(i){const r=i instanceof Error?i.message:n("ui.common.errors.system_prompt_update_unknown");throw zs(r),i}},onSuccess:async a=>{await e.invalidateQueries({queryKey:Ft,refetchType:"none"}),e.setQueryData(Ft,i=>i&&{...i,...a}),await e.refetchQueries({queryKey:Ft,type:"all"}),di(n("ui.notices.settings.system_prompt_updated"))},onError:a=>{console.error("Error updating system prompt:",a)}})},ia=({searchRow:e,value:s,label:a,description:i,onChange:r,icon:l,isSaving:c=!1,disabled:u=!1})=>{ie();const[d,g]=o.useState(s),p=o.useId(),f=`${p}-label`,_=`${p}-description`,x=async b=>{if(!(c||u)){g(b);try{await r(b)}catch(k){g(!b),console.error("Error toggling setting:",k)}}};return t.jsxs("div",{"data-search-row":e,"data-search-control":e?"":void 0,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsxs("span",{id:f,"data-search-label":"",className:"flex min-h-6 items-center gap-2 text-body text-ink",children:[l&&t.jsx(l,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}),a]}),i&&t.jsx("p",{id:_,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:i})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:c?t.jsx(Me,{size:"md",label:n("ui.common.forms.toggle_setting.saving",{label:a})}):t.jsx(ta,{checked:d,onCheckedChange:x,disabled:u,"aria-labelledby":f,"aria-describedby":i?_:void 0})})]})};function ns(e,s){const a=no(e,s?.in);if(!Xr(a))throw new RangeError("Invalid time value");const i=Ke(a.getDate(),2),r=Ke(a.getMonth()+1,2),l=a.getFullYear(),c=Ke(a.getHours(),2),u=Ke(a.getMinutes(),2),d=Ke(a.getSeconds(),2);let g="",p="";const f=a.getTimezoneOffset();if(f!==0){const _=Math.abs(f),x=Ke(Math.trunc(_/60),2),b=Ke(_%60,2);p=`${f<0?"+":"-"}${x}:${b}`}else p="Z";return`${l}-${r}-${i}T${c}:${u}:${d}${g}${p}`}function gc(e,s,a){return eo(e,-30,a)}var mc=ui({chartName:"LineChart",GraphicalChild:$s,axisComponents:[{axisType:"xAxis",AxisComp:gi},{axisType:"yAxis",AxisComp:mi}],formatAxisMap:pi});const pc=["radient","creditBalance"],fc=e=>{const{user:s,isAuthenticated:a}=Cn(),i=s?.account?.tenant_id,r=a&&!!i&&e?.enabled;return Ae({queryKey:[pc,i],queryFn:async()=>{if(!i)throw new Error(n("ui.common.errors.tenant_missing"));const l=await Ps({operation:"credits",tenantId:i});if(!l||typeof l.balance!="number")throw new Error(n("ui.common.errors.credit_balance_invalid"));return l},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},_c=["radient","usageRollup"],hc=(e,s)=>{const{user:a,isAuthenticated:i}=Cn(),r=a?.account?.tenant_id,l=i&&!!r&&s?.enabled;return Ae({queryKey:[..._c,r,e],queryFn:async()=>{if(!r)throw new Error(n("ui.common.errors.tenant_missing"));const c={};for(const[d,g]of Object.entries(e))g!=null&&(c[d]=String(g));const u=await Ps({operation:"usage",tenantId:r,query:c});if(!u)throw new Error(n("ui.common.errors.usage_rollup_invalid"));return u},enabled:l,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},xc=e=>e==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),yc=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")}},vc=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")}},ss=({label:e,description:s,value:a,onValueChange:i,options:r})=>{const l=o.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:l,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(pt,{value:a,onValueChange:i,children:t.jsx(ft,{"aria-labelledby":l,children:r.map(c=>t.jsx(Ve,{value:c.value,children:c.label},c.value))})})})]})},bc=({state:e,onChange:s,searchRow:a})=>{ie();const i=o.useId(),r=`${i}-description`,[l,c]=o.useState(null),u=o.useRef(!1),d=o.useRef(null),g=e?.settings.intensity??0;if(!e)return null;const p=!e.capability.supported,f=p?vc(e.capability.reason):null,_=async k=>{if(u.current){d.current=k;return}u.current=!0;try{await s({intensity:k})}finally{u.current=!1;const N=d.current;d.current=null,N!==null&&N!==k?_(N):c(null)}},x=e.settings.enabled,b=l??g;return t.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex flex-col gap-4","data-window-glass":"","data-glass-gate":e.capability.reason,children:[t.jsx(Xe,{content:f,disabled:!p,children:t.jsx("div",{className:p?"opacity-60":void 0,children:t.jsx(ia,{value:p?!1:x,disabled:p,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async k=>s({enabled:k})},p?"unavailable":"available")})}),f&&t.jsx("p",{"data-glass-unsupported":e.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:f}),e.restartRequired&&t.jsx("output",{className:"block max-w-2xl text-body-sm text-ink","data-glass-restart":"",children:n("ui.settings.appearance.window_glass.restart_needed")}),x&&!p&&t.jsxs(t.Fragment,{children:[t.jsx(ss,{label:n("ui.settings.appearance.window_glass.coverage_label"),description:n("ui.settings.appearance.window_glass.coverage_description"),value:e.settings.coverage,onValueChange:k=>void s({coverage:k}),options:fi.map(k=>({value:k,label:xc(k)}))}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[t.jsx("label",{htmlFor:i,className:"text-body text-ink",children:n("ui.settings.appearance.window_glass.intensity_label")}),t.jsx("span",{"data-glass-readout":"",className:"shrink-0 text-meta text-ink-dim tabular-nums",children:n("ui.settings.appearance.window_glass.intensity_value",{value:String(b)})})]}),t.jsx("p",{id:r,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n("ui.settings.appearance.window_glass.intensity_description")}),t.jsx("input",{id:i,type:"range",min:0,max:100,step:5,value:b,"aria-describedby":r,"aria-valuetext":n("ui.settings.appearance.window_glass.intensity_value",{value:String(b)}),onChange:k=>{const N=Number(k.target.value);c(N),_(N)},style:{"--fill":`${b}%`},className:"mt-3 h-4 w-full cursor-pointer appearance-none bg-transparent bg-center bg-no-repeat bg-[length:100%_6px] bg-[linear-gradient(to_right,var(--color-accent)_0_var(--fill),var(--color-sunken)_var(--fill)_100%)] [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-accent [&::-webkit-slider-thumb]:transition-colors [&::-webkit-slider-thumb]:duration-fast [&::-webkit-slider-thumb]:ease-out-quart [&::-webkit-slider-thumb]:hover:bg-accent-hover"}),t.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-meta text-ink-dim",children:[t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_start")}),t.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_end")})]})]}),t.jsx(ss,{label:n("ui.settings.appearance.window_glass.material_label"),description:n("ui.settings.appearance.window_glass.material_description"),value:e.settings.material,onValueChange:k=>void s({material:k}),options:e.capability.materials.map(k=>({value:k,label:yc(k)}))})]})]})},kc=new Set(["B","C","D","E","F"]);function jc(e){const{status:s,refused:a,everVisible:i,checking:r=!1}=e;return s?s.update_required||s.state==="signed_out"?"absent":s.state==="unavailable"?s.error?.code==="messaging_unavailable"?"dark":i?"error":"absent":s.surface_state==="G"?s.error===null||s.error?.code==="messaging_unavailable"?"dark":"error":s.capability<1||s.state!=="ready"||!s.visibility.settings?"absent":s.surface_state&&kc.has(s.surface_state)?"visible":"absent":r&&i?"visible":a&&i?"error":"absent"}function wc(e,s){return e!=="absent"}function ot(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 Nc="open_chief_of_staff";function Sc(e){const s=e?.delivery_hold;if(!s||s.code!==Nc||s.count<=0)return null;const a=s.session||e?.local.session||null;return{count:s.count,sessionId:a}}function ra(e){return $a(e)}function Mc(e){return e.target.endpoint_id?{kind:"endpoint",id:e.target.endpoint_id}:{kind:"account",id:e.target.account_id??""}}function vn(e){return e.map((s,a)=>{const i=Mc(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 bn(e,s){return e.filter(i=>i.effect==="deny"||s[i.direction]==="listed_only").map(i=>({direction:i.direction,effect:i.effect,target:i.kind==="endpoint"?{endpoint_id:i.id}:{account_id:i.id}})).sort((i,r)=>i.direction.localeCompare(r.direction)||i.effect.localeCompare(r.effect)||JSON.stringify(i.target).localeCompare(JSON.stringify(r.target)))}function oa(e){return JSON.stringify(e)}function Cc(e){return e.saving?{disabled:!0,reason:"saving"}:["send","receive"].some(i=>e.modes[i]==="listed_only"&&!e.entries.some(r=>r.direction===i&&r.effect==="allow"))?{disabled:!0,reason:"needs_entry"}:oa(bn(e.entries,e.modes))===e.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const Ac=/^[^\s\p{Cc}]{1,128}$/u;function Ec(e){return e===""?n("ui.agentMessages.settings.allowlist.identifier_empty"):e.length>128?n("ui.agentMessages.settings.allowlist.identifier_long"):Ac.test(e)?null:n("ui.agentMessages.settings.allowlist.identifier_invalid")}function Dt(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 Ic=['[data-agent-messages-action="turn_on_again"]','[role="switch"]','[data-agent-messages-action="enable"]'],Xt="__none__";function Rc({availability:e,status:s,accountId:a,refusal:i=null,api:r=lr,onRefreshStatus:l,sessions:c=[],onOpenSession:u,focus:d=!1,focusNonce:g}){ie();const[p,f]=o.useState({kind:"loading"}),[_,x]=o.useState(0),[b,k]=o.useState(null),[N,T]=o.useState(null),[M,R]=o.useState(s?.local.enabled??!1),[w,S]=o.useState(s?.local.session??""),A=s?.tenant_id??void 0,K=e==="visible",V=s?.account_id??null,F=V!==null&&V===a;o.useEffect(()=>{if(!K)return;let m=!1;return f({kind:"loading"}),T(null),(async()=>{try{const j=await r.settings(A);if(m)return;if(!j){f({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let v=null;if(j.endpoint){if(v=await r.allowlist(j.settings.tenant_id),m)return;if(!v){f({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}f({kind:"ready",settings:j,allowlist:v})}catch(j){if(m)return;f({kind:"error",refusal:Oe(j)})}})(),()=>{m=!0}},[K,a,V,A,_,r]),o.useEffect(()=>{if(!K||p.kind!=="ready"||!p.settings.endpoint||p.allowlist)return;let m=!1;return(async()=>{try{const j=await r.allowlist(p.settings.settings.tenant_id);if(m||!j)return;f(v=>v.kind==="ready"&&!v.allowlist?{...v,allowlist:j}:v)}catch(j){m||T(Oe(j))}})(),()=>{m=!0}},[K,p,r]),o.useEffect(()=>{s&&(R(s.local.enabled),S(s.local.session))},[s]);const B=()=>x(m=>m+1),H=p.kind==="ready"?p.settings:null,D=Ur(s,H,V),z=Kr({api:r,accountId:F?V:null,tenantId:H?.settings.tenant_id??null,markerTenantId:s?.tenant_id??null,onSettings:m=>f(j=>j.kind==="ready"?{...j,settings:m}:j),onChanged:()=>l(!0)}),W=o.useRef(null),P=o.useRef(!1),G=o.useRef(g);if(o.useEffect(()=>{g!==G.current&&(G.current=g,P.current=!1)},[g]),o.useEffect(()=>{if(!d){P.current=!1;return}if(P.current||p.kind!=="ready"||b!==null)return;const m=W.current,j=Ic.map(v=>m?.querySelector(`${v}:not(:disabled)`)).find(v=>v!=null);j&&(j.focus(),P.current=!0)},[d,g,p,b,s]),e==="absent")return null;if(e==="dark")return t.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.dark.title")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.body")}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.nothing_enabled")})]});if(e==="error")return t.jsx("div",{"data-agent-messages-section":"",children:t.jsxs(oe,{variant:"warning",children:[t.jsx(Bt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ie,{children:[i?Dt(i):n("ui.agentMessages.settings.refusal.generic"),t.jsx(L,{className:"mt-3",variant:"secondary",onClick:()=>{B(),l(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})});if(!s||!a)return null;const te=Sc(s);return t.jsxs("div",{ref:W,"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[te&&t.jsx(Lc,{count:te.count,onMessage:te.sessionId&&u?()=>u(te.sessionId):void 0}),D&&t.jsx(Br,{consentText:Pa(s,H),pending:z.pending,failure:z.failure,onTurnOff:()=>void z.turnOff(),onDismiss:()=>void z.dismiss()}),N&&t.jsx(oe,{variant:"warning",children:t.jsx(Ie,{children:Dt(N)})}),p.kind==="loading"&&t.jsx(Tc,{}),p.kind==="error"&&t.jsxs(oe,{variant:"warning",children:[t.jsx(Bt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ie,{children:[p.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:Dt(p.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(L,{className:"mt-3",variant:"secondary",onClick:B,children:n("ui.agentMessages.settings.error.retry")})]})]}),p.kind==="ready"&&t.jsxs(t.Fragment,{children:[t.jsx(Dc,{state:ot(s,p.settings),status:s,settings:p.settings,accountId:V??a,accountMatches:F,api:r,pending:b,localEnabled:M,onActionRefusal:T,onSettings:m=>f(j=>j.kind==="ready"?{...j,settings:m}:j),onLocalEnabled:R,onRefreshStatus:l,setPending:k}),t.jsx($c,{value:w,sessions:c,pending:b==="session",disabled:b!==null,onSave:async m=>{k("session"),T(null);try{await r.localSetting("team_bridge.session",m),S(m),await l(!0)}catch(j){T(Oe(j))}finally{k(null)}}}),p.allowlist&&(ot(s,p.settings)==="C"||ot(s,p.settings)==="D"||ot(s,p.settings)==="F")&&t.jsx(Pc,{allowlist:p.allowlist,accountId:V??a,accountMatches:F,readOnly:s.read_only===!0&&ot(s,p.settings)==="F",pending:b!==null,onSaving:m=>k(m?"allowlist":null),onRefusal:T,onSaved:m=>f(j=>j.kind==="ready"?{...j,allowlist:m}:j),api:r},p.allowlist.view.tenant_id??"tenant")]})]})}function Tc(){return t.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[t.jsx(Se,{className:"h-5 w-40"}),t.jsx(Se,{className:"h-4 w-full max-w-xl"}),t.jsx(Se,{className:"h-9 w-36"}),t.jsx(Se,{className:"h-4 w-64"})]})}const Lc=({count:e,onMessage:s})=>t.jsx("output",{className:"block","data-agent-messages-hold":"open_chief_of_staff",children:t.jsx(oe,{variant:"info",className:me(cr,"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(L,{variant:"ghost",size:"sm",className:"shrink-0 text-ink",onClick:s,children:n("ui.agentMessages.settings.hold.open")})]})})}),as=({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})}),la={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"},ca={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 Oc(e){return e==="B"?"ui.agentMessages.settings.default_on.b_title":la[e]}function Fc(e){return e==="B"?"ui.agentMessages.settings.default_on.b_body":e==="E"?"ui.agentMessages.settings.default_on.e_body":ca[e]}const Dc=({state:e,status:s,settings:a,accountId:i,accountMatches:r,api:l,pending:c,localEnabled:u,onActionRefusal:d,onSettings:g,onLocalEnabled:p,onRefreshStatus:f,setPending:_})=>{const x=ra(s),b=a.settings.tenant_id,k=c!==null||!r,N=Ua(s);async function T(A,K={}){if(!r)return null;_(A),d(null);try{const V=await l.updateSettings({expected_account_id:i,tenant_id:b,state:A,...K});if(g(V),A==="disabled"&&!N)try{await l.localSetting("team_bridge.enabled",!1),p(!1)}catch(F){d(Oe(F))}return V}catch(V){const F=Oe(V);return d(F),F.code==="consent_version_unknown"&&await f(!0),null}finally{_(null)}}async function M(){if(!(!x||!r||!await T("active",{consent_version:x.version,consented_via:"settings"}))){_("local");try{await l.localSetting("team_bridge.enabled",!0),p(!0),await f(!0)}catch(K){d(Oe(K))}finally{_(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(en,{settings:a,status:s,readOnly:!0}),t.jsx(tn,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:k,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async A=>{_("local"),d(null);try{await l.localSetting("team_bridge.enabled",A),p(A),await f(!0)}catch(K){d(Oe(K))}finally{_(null)}}})]});const R=a.endpoint?.label?.trim(),w=a.endpoint?.consent??null,S=w!==null&&!w.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(N?Oc(e):la[e])}),R&&t.jsx("span",{className:"text-body-sm text-ink-muted",children:R})]}),t.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n(N?Fc(e):ca[e])}),N&&e==="E"&&t.jsxs("div",{className:"flex flex-col gap-3",children:[x?t.jsx(as,{text:x.text}):t.jsx(oe,{variant:"warning",children:t.jsx(Ie,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsx("div",{className:"flex flex-wrap items-center gap-3",children:t.jsx(L,{"data-agent-messages-action":"turn_on_again","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void M(),disabled:k||!x,children:n("ui.agentMessages.settings.action.turn_on_again")})})]}),!N&&(e==="B"||e==="E")&&t.jsxs("div",{className:"flex flex-col gap-3",children:[x?t.jsx(as,{text:x.text}):t.jsx(oe,{variant:"warning",children:t.jsx(Ie,{children:n("ui.agentMessages.settings.consent.unavailable")})}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx(L,{"data-agent-messages-action":"enable","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void M(),disabled:k||!x,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(L,{"data-agent-messages-action":"pause",variant:"secondary",disabled:k,onClick:()=>void T("paused"),children:n("ui.agentMessages.settings.action.pause")}),t.jsx(L,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:k,onClick:()=>void T("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),t.jsx(en,{settings:a,status:s}),S&&!N&&t.jsx(is,{onRenew:()=>void M(),disabled:k||!x}),t.jsx(tn,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:k,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async A=>{_("local"),d(null);try{await l.localSetting("team_bridge.enabled",A),p(A),await f(!0)}catch(K){d(Oe(K))}finally{_(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(L,{"data-agent-messages-action":"resume",disabled:k||a.settings.consent_required&&x===null,onClick:()=>void T("active",a.settings.consent_required&&x?{consent_version:x.version,consented_via:"settings"}:{}),children:n("ui.agentMessages.settings.action.resume")}),t.jsx(L,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:k,onClick:()=>void T("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),a.settings.consent_required&&!x&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.unavailable")}),t.jsx(en,{settings:a,status:s}),S&&!N&&t.jsx(is,{onRenew:()=>void M(),disabled:k||!x}),t.jsx(tn,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:u,disabled:k,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async A=>{_("local"),d(null);try{await l.localSetting("team_bridge.enabled",A),p(A),await f(!0)}catch(K){d(Oe(K))}finally{_(null)}}})]})]})},is=({onRenew:e,disabled:s})=>t.jsx(oe,{variant:"warning",children:t.jsxs(Ie,{children:[n("ui.agentMessages.settings.consent.renew"),t.jsx(L,{"data-agent-messages-action":"enable",className:"mt-3",variant:"secondary",disabled:s,onClick:e,children:n("ui.agentMessages.settings.action.enable_again")})]})});function zc(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 en=({settings:e,status:s,readOnly:a=!1})=>{const i=e.endpoint?.consent??null,r=ra(s);return i?t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsxs(vt,{children:[t.jsx(xe,{label:n("ui.agentMessages.settings.consent.version"),value:i.version}),t.jsx(xe,{label:n("ui.agentMessages.settings.consent.via"),value:zc(i.consented_via)}),t.jsx(xe,{label:n("ui.agentMessages.settings.consent.at"),value:i.consented_at})]}),!a&&r&&t.jsxs("details",{children:[t.jsx("summary",{className:"cursor-pointer text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.show")}),t.jsx("p",{className:"mt-2 whitespace-pre-wrap text-body-sm text-ink-muted",children:r.text})]})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.no_record")})},tn=({value:e,disabled:s,description:a,onChange:i,searchRow:r,searchTerms:l})=>{const c=o.useId();return t.jsxs("div",{"data-search-row":r,"data-search-control":r?"":void 0,"data-search-terms":l,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{id:c,className:"text-body-sm text-ink",children:n("ui.agentMessages.settings.local.label")}),t.jsx("p",{className:"mt-0.5 text-meta text-ink-dim",children:a})]}),t.jsx(ta,{"aria-labelledby":c,checked:e,disabled:s,onCheckedChange:u=>void i(u)})]})},$c=({value:e,sessions:s,pending:a,disabled:i,onSave:r})=>{const l=s.some(c=>c.session_id===e);return t.jsxs("div",{"data-search-row":"agent-messages.session","data-search-control":!0,"data-search-terms":"team bridge team_bridge session",className:"flex flex-col gap-2",children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.session.title")}),t.jsx("p",{className:"max-w-2xl text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.help")}),t.jsxs(Rn,{value:e===""?Xt:e,disabled:i,onValueChange:c=>void r(c===Xt?"":c),children:[t.jsx(Tn,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:t.jsx(Ln,{})}),t.jsxs(On,{children:[t.jsx(Ze,{value:Xt,children:n("ui.agentMessages.settings.session.none")}),s.map(c=>t.jsx(Ze,{value:c.session_id,children:c.title?.trim()||c.session_id},c.session_id)),e!==""&&!l&&t.jsx(Ze,{value:e,children:e})]})]}),e!==""&&!l&&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")})]})},Pc=({allowlist:e,accountId:s,accountMatches:a,readOnly:i,pending:r,api:l,onSaving:c,onRefusal:u,onSaved:d})=>{const[g,p]=o.useState(()=>vn(e.allowlist.entries)),[f,_]=o.useState(()=>({send:e.view.directions.send.mode,receive:e.view.directions.receive.mode})),x=r||i||!a,b=oa(bn(Uc(e),Kc(e))),k=Cc({entries:g,modes:f,savedSignature:b,saving:r}),N=o.useRef(0),T=w=>p(S=>[...S,{...w,key:`${w.direction}:${w.effect}:${N.current++}`}]),M=w=>p(S=>S.filter(A=>A.key!==w)),R=async()=>{if(!x){c(!0),u(null);try{const w=await l.updateAllowlist({expected_account_id:s,tenant_id:e.allowlist.tenant_id,entries:bn(g,f)}),S=vn(w.allowlist.entries);p(S),_({send:w.view.directions.send.mode,receive:w.view.directions.receive.mode}),d(w)}catch(w){u(Oe(w))}finally{c(!1)}}};return t.jsxs("div",{"data-agent-messages-allowlist":"",className:"flex flex-col gap-5",children:[t.jsxs("div",{children:[t.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.allowlist.title")}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.description")})]}),t.jsx(rs,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:f.receive,cues:e.view.cues,entries:g.filter(w=>w.direction==="receive"),disabled:x,onMode:w=>_(S=>({...S,receive:w})),onAdd:w=>T({...w,direction:"receive"}),onRemove:M}),t.jsx(rs,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:f.send,cues:e.view.cues,entries:g.filter(w=>w.direction==="send"),disabled:x,onMode:w=>_(S=>({...S,send:w})),onAdd:w=>T({...w,direction:"send"}),onRemove:M}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsxs(L,{onClick:()=>void R(),disabled:k.disabled||x,children:[t.jsx(Xs,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),k.disabled&&k.reason==="needs_entry"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),k.disabled&&k.reason==="unchanged"&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.unchanged")}),i&&t.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.read_only")}),r&&t.jsx("span",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})]})};function Uc(e){return vn(e.allowlist.entries)}function Kc(e){return{send:e.view.directions.send.mode,receive:e.view.directions.receive.mode}}const rs=({direction:e,title:s,mode:a,cues:i,entries:r,disabled:l,onMode:c,onAdd:u,onRemove:d})=>{const g=r.filter(f=>f.effect==="allow"),p=r.filter(f=>f.effect==="deny");return t.jsxs("fieldset",{"data-agent-messages-direction":e,"data-agent-messages-level":a,className:"flex flex-col gap-3 rounded-md border border-hairline p-3",children:[t.jsx("legend",{className:"px-1 text-body-sm text-ink",children:s}),t.jsx(Bc,{mode:a,disabled:l,onMode:c}),t.jsxs("div",{className:"flex flex-col gap-1 text-meta text-ink-dim",children:[i.allow_entry_switches_direction_to_listed_only&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_listed_only")}),i.removing_allow_does_not_stop_open_thread&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_remove")}),i.deny_stops_pair_both_directions&&t.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_deny")})]}),a==="listed_only"&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.allowed_heading")}),g.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.allowed_empty")}),g.map(f=>t.jsx(os,{entry:f,disabled:l,onRemove:()=>d(f.key)},f.key)),t.jsx(ls,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:l,onAdd:f=>u({...f,effect:"allow"})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.blocked_heading")}),p.length===0&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),p.map(f=>t.jsx(os,{entry:f,disabled:l,onRemove:()=>d(f.key)},f.key)),t.jsx(ls,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:l,onAdd:f=>u({...f,effect:"deny"})})]})]})},Bc=({mode:e,disabled:s,onMode:a})=>{const i=[{value:"class_default",label:n("ui.agentMessages.settings.allowlist.anyone")},{value:"listed_only",label:n("ui.agentMessages.settings.allowlist.listed_only")}];return t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.agentMessages.settings.allowlist.level")}),t.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:i.map(r=>t.jsx(L,{variant:"ghost",size:"sm","aria-pressed":e===r.value,disabled:s,onClick:()=>a(r.value),className:me(e===r.value&&"bg-surface text-ink hover:bg-surface"),children:r.label},r.value))})]})},os=({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(L,{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")})]}),ls=({label:e,disabled:s,onAdd:a})=>{const[i,r]=o.useState("endpoint"),[l,c]=o.useState(""),[u,d]=o.useState(null),g=o.useId(),p=`${g}-help`,f=()=>{const _=Ec(l.trim());d(_),!_&&(a({kind:i,id:l.trim()}),c(""))};return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Re,{htmlFor:g,children:e}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(Rn,{value:i,disabled:s,onValueChange:_=>r(_),children:[t.jsx(Tn,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:t.jsx(Ln,{})}),t.jsxs(On,{children:[t.jsx(Ze,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),t.jsx(Ze,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),t.jsx(Te,{id:g,"aria-describedby":p,className:"max-w-xs",value:l,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:_=>c(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),f())}}),t.jsx(L,{variant:"secondary",size:"sm",disabled:s,onClick:f,children:n("ui.agentMessages.settings.allowlist.add")})]}),t.jsx("p",{id:p,className:"text-meta text-ink-dim",children:i==="endpoint"?n("ui.agentMessages.settings.allowlist.identifier_help_agent"):n("ui.agentMessages.settings.allowlist.identifier_help_person")}),u&&t.jsx("p",{className:"text-meta text-danger",children:u})]})};function qc(){const{snapshot:e}=Js(),[s,a]=o.useState(!1),i=jc({status:e.status,refused:e.refusal!==null,everVisible:s,checking:e.checking});return o.useEffect(()=>{i!=="absent"&&a(!0)},[i]),o.useEffect(()=>{or()},[]),i}function Dn(e){const s=a=>typeof a=="string"?mt(a):mt((a??[]).join(" "));return{label:s(e.label),synonym:s(e.synonym),key:s(e.key),choice:s(e.choice),section:s(e.section),description:s(e.description)}}function Vc(e){const s=new Map;for(const a of e??[])s.set(a.name,{label:a.title||a.name,folded:mt([a.title,a.name].join(" "))});return s}function Hc(e,s={}){if(!e)return[];const{startOrder:a=0,sections:i=[]}=s,r=Vc(e.sections),l=new Map(i.map(c=>[c.id,c.label]));return e.settings.map((c,u)=>{const d=r.get(c.section),g=Lt(c.key,"backend");return{id:`setting:${c.key}`,source:"registry",label:c.label||c.key,description:c.help??"",sectionId:g,sectionLabel:l.get(g)??"",detail:d?.label??c.section,order:a+u,settingKey:c.key,fields:Dn({label:c.label,synonym:c.synonyms??[],key:c.key,choice:(c.choices??[]).flatMap(p=>[p.label,p.description??""]),section:d?.folded??c.section,description:c.help})}})}function Gc(e,s=0){return e.map((a,i)=>({id:`section:${a.id}`,source:"section",label:a.label,sectionId:a.id,sectionLabel:a.label,order:s+i,fields:Dn({label:a.label})}))}function Wc(e){const s=e.getAttribute("data-search-label");if(s?.trim())return s.trim();const a=e.querySelector("[data-search-label]");if(a?.textContent?.trim())return a.textContent.trim();const i=e.querySelector("h2, h3, h4, legend");if(i?.textContent?.trim())return i.textContent.trim();const r=e.getAttribute("aria-label");return r?.trim()?r.trim():((e.firstElementChild??e).textContent??"").trim()}function Qc(e){const s=e.replace(/\s+/g," ").trim();if(s.length<=80)return s;const a=s.slice(0,80),i=a.lastIndexOf(" ");return`${(i>40?a.slice(0,i):a).trimEnd()}…`}function Yc(e){return e.closest("[data-search-section]")}function Zc(e,s){const a=(e.textContent??"").trim();if(!s)return a;const i=a.indexOf(s);return i<0?a:`${a.slice(0,i)} ${a.slice(i+s.length)}`.trim()}function Jc(e,s=0){return Array.from(e.querySelectorAll("[data-search-row]")).map((i,r)=>{const l=Yc(i),c=l?.getAttribute("data-search-section")??"",d=(l?.getAttribute("data-search-section-label")?.trim()??"")||l?.querySelector("[data-search-section-label], h2")?.textContent?.trim()||"",g=Wc(i),p=i.getAttribute("data-search-terms")??"",f=Zc(i,g);return{id:`page:${i.getAttribute("data-search-row")??r}`,source:"page",label:Qc(g),sectionId:c,sectionLabel:d,order:s+r,fields:Dn({label:g,synonym:p,section:[d,c],description:f})}})}function Xc(e){const s=Hc(e.registry,{startOrder:0,sections:e.sections}).filter(i=>!(i.settingKey&&i.settingKey in _i)),a=[...e.rendered??[]].map((i,r)=>({...i,order:s.length+r}));return[...s,...a,...Gc(e.sections??[],s.length+a.length)]}const ed=12,cs="input, textarea, select, button, [role='switch'], [role='tab'], [role='combobox'], [tabindex]";function td(e,s){return e.querySelector(`[data-search-row="${CSS.escape(s)}"]`)}function nd(e){const a=(e.matches("[data-search-control]")?e:null)??e.querySelector("[data-search-control]");return a?a.matches(cs)?a:a.querySelector(cs)??a:e}function da(e){return e.isConnected&&e.closest("[hidden]")===null}function sd(e,s,a={}){const i=a.frames??ed,r=a.paint??Us;return new Promise(l=>{let c=0;const u=()=>{const d=td(e,s);if(d&&da(d)){const g=nd(d);g===d&&(d.tabIndex=-1),g.scrollIntoView({block:"center"}),g.focus(),r(d),l("landed");return}if(c+=1,c>=i){l("missing");return}requestAnimationFrame(u)};requestAnimationFrame(u)})}function ad(e,s,a={}){const i=e.querySelector(`[data-search-section="${CSS.escape(s)}"]`);return!i||!da(i)?"missing":(i.scrollIntoView({block:"start"}),i.tabIndex<0&&(i.tabIndex=-1),i.focus(),(a.paint??Us)(i),"landed")}const ds={get[ze.UI](){return n("ui.settings.updates.update_following.application_updates")},get[ze.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},Mt={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")}}},us=({type:e})=>{ie();const s=mn(i=>i.followed[e]),a=mn(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:ds[e]}),t.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:Mt[s].description})]}),t.jsxs(Rn,{value:s,onValueChange:i=>a(e,i),children:[t.jsx(Tn,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:ds[e],choice:Mt[s].label}),className:"w-full sm:w-56","data-followed-segment":e,children:t.jsx(Ln,{})}),t.jsx(On,{children:hi.map(i=>t.jsx(Ze,{value:i,title:Mt[i].description,children:Mt[i].label},i))})]})]})},id=()=>(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(us,{type:ze.UI}),t.jsx(us,{type:ze.BACKEND})]})]})),rd=({appVersion:e})=>t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(id,{}),t.jsx(cc,{appVersion:e})]}),od=e=>{if(!e)return null;try{return new URL(e).host}catch{return null}},ld=()=>{ie();const[e,s]=o.useState(null),[a,i]=o.useState({value:"Loading...",detail:null,degraded:!1}),[r,l]=o.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});o.useEffect(()=>{let u=!0;const d=x=>{if(!u)return;const b=od(x.url);if(x.state==="connecting"){i({value:"Loading...",detail:null,degraded:!1});return}if(x.state==="detached"){i({value:"Not connected",detail:x.detail||null,degraded:!1});return}if(x.state==="wedged"){i({value:"Not attached",detail:x.detail||null,degraded:!1});return}const k=x.version||"Version unknown";i({value:b?`${k} · ${b}`:k,detail:x.detail||null,degraded:x.state==="degraded"})};let g=!1;const p=window.api?.backend?.onStatusChange(x=>{g=!0,d(x)}),f=async()=>{try{const[x,b]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);u&&(s(x),l(b))}catch(x){console.error("Error fetching app information:",x)}},_=async()=>{try{const x=window.api?.backend;if(x){const N=await x.getStatus();g||d(N);return}const b=await Wn.healthCheck(Mn.baseUrl),k=Wn.getServerVersion(b);u&&i({value:k,detail:null,degraded:!1})}catch(x){console.error("Error fetching server version:",x),u&&i({value:"Unavailable",detail:null,degraded:!1})}};return f(),_(),()=>{u=!1,p?.()}},[]);const c=(u,d,g,p={})=>t.jsx(xe,{label:t.jsx(Xe,{content:g,children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx(qt,{size:12,className:"shrink-0"}),u]})}),valueClassName:p.valueClassName,value:t.jsxs(t.Fragment,{children:[p.valueTooltip?t.jsx(Xe,{content:p.valueTooltip,children:t.jsx("span",{"data-backend-version":p.valueHoverTarget?"":void 0,children:d})}):d,p.statusNote?t.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:p.statusNote}):null]})});return t.jsx(_e,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:pn,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(vt,{children:[c(n("ui.settings.updates.app_updates_section.application_version"),e??n("ui.settings.updates.app_updates_section.state_loading"),n("ui.settings.updates.app_updates_section.the_version_of_the_local_operator_user_interface_application")),c(n("ui.settings.updates.app_updates_section.server_version"),Yt(a.value),n("ui.settings.updates.app_updates_section.the_version_of_the_local_operator_api_server_backend_and_the_addr"),{valueTooltip:a.detail,valueHoverTarget:!0,statusNote:a.degraded?n("ui.settings.updates.app_updates_section.not_answering"):void 0,valueClassName:a.degraded?"text-ink-muted":void 0}),c(n("ui.settings.updates.app_updates_section.platform"),`${r.platform} (${r.arch})`,n("ui.settings.updates.app_updates_section.the_operating_system_and_architecture_your_application_is_running")),c(n("ui.settings.updates.app_updates_section.node_js_version"),Yt(r.nodeVersion),n("ui.settings.updates.app_updates_section.the_javascript_runtime_environment_version")),c(n("ui.settings.updates.app_updates_section.electron_version"),Yt(r.electronVersion),n("ui.settings.updates.app_updates_section.the_framework_version_enabling_this_desktop_application"))]}),t.jsx(rd,{appVersion:e})]})})};function ua(e){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return e.resolvedLevel&&e.stored.trim()===""&&zn(e.resolvedLevel,e.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:qe(e.resolvedLevel)})),[s,...ga(e.ladder,e.storable)]}function zn(e,s){const a=e.trim().toLowerCase();return a===""?null:s.find(i=>i.trim().toLowerCase()===a)??null}function ga(e,s){return e.flatMap(a=>{const i=zn(a,s);return i===null?[]:[{id:i,name:qe(a)}]})}function cd(e,s){const a=e.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function dd(e){if(!e.resolved||e.ladder===null)return null;const s=e.stored.trim().toLowerCase();if(s===""||e.ladder.some(r=>r.toLowerCase()===s))return null;const a=(e.resolvedLevel??"").trim(),i=a===""?"":zn(a,e.storable)??"";return i.trim().toLowerCase()===s?null:i}const zt="\0unread";function Ct(e){return e.trim()===""?"":zt}function ud(e){if(!e.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!e.hasHome)return De("no-home",n("ui.settings.model.default_effort.no_home"));if(!e.hasModel)return De("no-model",n("ui.settings.model.default_effort.no_model"),zt);if(e.settings==="loading")return De("settings-loading",n("ui.settings.model.default_effort.settings_loading"),zt);if(e.settings==="error")return De("settings-error",n("ui.settings.model.default_effort.settings_error"),zt);if(e.preview==="loading")return De("loading",n("ui.settings.model.default_effort.loading"),Ct(e.stored));if(e.preview==="error")return De("error",n("ui.settings.model.default_effort.error"),Ct(e.stored));if(e.ladder===null||!e.specResolved)return De("unresolved",n("ui.settings.model.default_effort.unresolved"),Ct(e.stored));const s=e.ladder;if(s.length===0)return De("empty",n("ui.settings.model.default_effort.empty"),Ct(e.stored));const a=ga(s,e.storable);if(a.length===0){const i=qe(s[0]),r=s.length===1&&s[0].trim().toLowerCase()==="auto";return{kind:"one-level",options:[{id:"",name:i}],selectedId:"",disabled:!0,helper:r?n("ui.settings.model.default_effort.one_level_sentinel"):n("ui.settings.model.default_effort.one_level",{level:i})}}if(s.length===1){const[i]=a;return{kind:"one-level",options:[i],selectedId:i.id,disabled:!0,helper:n("ui.settings.model.default_effort.one_level",{level:i.name})}}return{kind:"ready",options:ua({ladder:s,resolvedLevel:e.resolvedLevel,stored:e.stored,storable:e.storable}),selectedId:cd(e.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function De(e,s,a=""){return{kind:e,options:ua({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const gd=({hosting:e,modelName:s,focus:a=!1,focusNonce:i})=>{ie();const r=yt(),l=Je(r.data,"draft_preview"),c=xi(),u=e!==""&&s!=="",d=Ae({queryKey:Kt.all,queryFn:()=>ye({op:"settings.list"}),enabled:l,staleTime:1e4}),g=d.data?.settings.find(le=>le.key===Qe),p=typeof g?.value=="string"?g.value:"",f=(g?.choices??[]).map(le=>le.value).filter(le=>typeof le=="string"),_={cwd:c??"",model:u?{provider:e,model_id:s,reasoning_effort:null}:null},x=d.isSuccess?p:null,b=Ae({...Ba(_,Je(r.data,"draft_fast")),queryKey:[...Ka(_),"model_effort",x],enabled:l&&!!c&&u}),k=b.isSuccess&&!b.isPlaceholderData,N=k?qa(b.data?.snapshot,null).effort:null,T=k&&Array.isArray(N?.reasoning_efforts)?Va(N):null,M=k?Ha(N):null,R=N!==null&&!Ga(N),[w,S]=o.useState(!1),[A,K]=o.useState(!1),[V,F]=o.useState(null),[B,H]=o.useState(null),D=`${e}\0${s}`,z=xt(),W=o.useRef(null),P=o.useRef(!1),G=o.useRef(i);o.useEffect(()=>{i!==G.current&&(G.current=i,P.current=!1)},[i]);const te=o.useCallback(async(le,ce)=>{S(!0),F(le),K(!1),ce===null&&H(null);try{await ye({op:"settings.edit",key:Qe,value:le}),await z.invalidateQueries({queryKey:Kt.all}),ce!==null&&H(ce)}catch{K(!0)}finally{S(!1),F(null)}},[z]),m=typeof N?.display_name=="string"&&N.display_name.trim()||s,j=ud({supported:l,hasHome:!!c,hasModel:u,settings:d.isError?"error":d.isSuccess?"ready":"loading",preview:b.isError?"error":k?"ready":"loading",ladder:T,specResolved:R,stored:p,resolvedLevel:M,storable:f}),v=dd({stored:p,ladder:T,resolvedLevel:M,resolved:k&&R&&d.isSuccess,storable:f}),E=o.useRef(null);o.useEffect(()=>{if(v===null||w)return;const le=`${e}\0${s}\0${p}\0${v}`;if(E.current===le)return;E.current=le;const ce=v===""?n("ui.settings.model.default_effort.clamped_unset",{level:qe(p),model:m}):n("ui.settings.model.default_effort.clamped",{level:qe(p),model:m,resolved:qe(v)});te(v,{text:ce,model:D})},[v,p,w,te,e,s,m,D]);const J=o.useMemo(()=>j.options.map(md),[j.options]);o.useEffect(()=>{if(!a){P.current=!1;return}j.disabled||P.current||(W.current?.querySelector("[role=combobox]")?.focus(),P.current=!0)},[a,i,j.disabled]);const q=V??j.selectedId,X=J.find(le=>le.id===q)??(V!==null?{id:V,name:qe(V)}:null),re=t.jsxs("span",{className:"flex flex-col gap-0.5",children:[t.jsx("span",{children:j.helper}),A&&t.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),t.jsx("output",{"aria-live":"polite",children:B?.model===D?B.text:""})]});return j.kind==="unsupported"?null:t.jsx("div",{ref:W,"data-setting-key":Qe,children:t.jsx(na,{label:n("ui.settings.model.default_effort.label"),icon:t.jsx(dr,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:J,selected:X,onSelect:le=>{te(le.id,null)},helperText:re,busy:w,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:j.disabled||w})})};function md(e){return{id:e.id,name:e.name,description:e.description}}const pd=e=>e.replace(/[\p{Co}\p{Cc}]/gu," ").replace(/\s+/g," ").trim(),ma=(e,s)=>{const a=s.trim().toLocaleLowerCase();return a?e.filter(i=>`${i.title} ${i.cwd} ${i.sourceId}`.toLocaleLowerCase().includes(a)):e},fd=(e,s)=>`${e??""}\0${[...s].sort().join("\0")}`,pa=5e3,_d=(e,s,a,i=pa)=>{const r=new Set(a);let l=!1;for(const c of ma(e,s))if(!r.has(c.sourceId)){if(r.size>=i){l=!0;break}r.add(c.sourceId)}return{selected:r,capped:l}},hd=/cancel/i,xd=new Set(["done","failed","cancelled"]),gs=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"}},nn=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"}},yd=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"}},vd=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"}},bd=e=>e==="failed"?"danger":e==="metadata_only"||e==="skipped_already_imported"?"neutral":e==="cancelled"?"warning":"success",kn=e=>pd(e.title)||e.sourceId,ms=({path:e,label:s,onCopyPath:a})=>{const[i,r]=o.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(L,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(e).then(l=>{l&&(r(!0),window.setTimeout(()=>r(!1),1500))})},children:[i?t.jsx(sa,{size:14}):t.jsx(Ks,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},kd=({progress:e,sessions:s,selected:a})=>{const i=new Map(e.results.map(u=>[u.sourceId,u])),r=e.sessionId,l=Math.max(0,e.total-e.completed-(r&&!i.has(r)?1:0)),c=s.filter(u=>a.has(u.sourceId));return t.jsxs("div",{className:"flex flex-col gap-2",children:[e.results.map(u=>t.jsx(fa,{row:u,jobCancelled:e.state==="cancelled"},`${u.source}:${u.sourceId}`)),c.filter(u=>!i.has(u.sourceId)&&u.sourceId!==r).map(u=>t.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[t.jsx("span",{className:"min-w-0 truncate",children:kn(u)}),t.jsx(_t,{variant:"neutral",children:n("ui.settings.imports.session_pending")})]},u.sourceId)),r&&!i.has(r)&&t.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[t.jsx(Ot,{size:14,className:"animate-spin"}),t.jsx("span",{children:n("ui.settings.imports.session_importing")}),t.jsx("span",{className:"min-w-0 truncate",children:r})]}),l>0&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:l})}),e.warnings.map(u=>t.jsx("p",{className:"text-meta text-warning",children:u.message},`${u.code}:${u.sessionId}:${u.message}`))]})},fa=({row:e,jobCancelled:s=!1})=>{const i=s&&e.outcome==="failed"&&e.warnings.some(r=>hd.test(r))?"cancelled":e.outcome;return t.jsxs("div",{className:"rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:e.sourceId}),t.jsx(_t,{variant:bd(i),children:n(vd(i))}),t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.session_meta",{messages:e.messages,compactions:e.compactions})})]}),e.targetSessionId&&(e.messages>0||e.outcome==="skipped_already_imported")&&t.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:n("ui.settings.imports.result_target",{target:e.targetSessionId})}),e.warnings.map(r=>t.jsx("p",{className:"mt-1 text-meta text-warning",children:r},r))]})},jd=({sources:e,activeSource:s,sessions:a,query:i,selected:r,preview:l,previewStale:c,previewError:u,confirmed:d,busy:g,error:p,progress:f,result:_,cancelling:x,onSelectSource:b,onQueryChange:k,onToggleSession:N,onSelectAll:T,onClearSelection:M,onConfirmChange:R,onImport:w,onCancel:S,onRetry:A,onImportAnother:K,onRefresh:V,selectionNotice:F,onCopyPath:B})=>{ie();const H=e.find(m=>m.source===s),D=f!==null&&!xd.has(f.state),z=f?.total??r.size,W=o.useMemo(()=>ma(a,i),[i,a]),P=W.length>0&&W.every(m=>r.has(m.sourceId)),G=r.size,te=G>0&&l!==null&&!c&&d&&!g&&!f&&!_;return t.jsx(_e,{title:n("ui.settings.imports.title"),icon:pn,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:t.jsxs("div",{className:"flex flex-col gap-5",children:[p&&t.jsxs(oe,{variant:"warning",children:[t.jsx(Bt,{children:n("ui.settings.imports.title")}),t.jsx(Ie,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:p}),t.jsx(L,{variant:"secondary",size:"sm",onClick:A,children:n("ui.settings.imports.retry")})]})})]}),g==="sources"&&e.length===0?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Se,{className:"h-20 w-full"}),t.jsx(Se,{className:"h-20 w-full"}),t.jsx(Se,{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(L,{variant:"ghost",size:"sm",onClick:V,disabled:D||g==="sources"||g==="sessions",children:[t.jsx(ur,{size:14,className:me(g==="sources"&&"animate-spin")}),n("ui.settings.imports.refresh")]})]}),!e.some(m=>m.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(m=>{const j=m.source===s,v=m.detected?n(gs(m.availability)):n("ui.settings.imports.source_not_found");return t.jsxs("button",{type:"button","aria-pressed":j,disabled:D,onClick:()=>b(m.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",j?"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:m.label}),t.jsx(_t,{variant:m.detected&&m.availability==="full"?"success":"neutral",children:v})]}),t.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.imports.source_sessions",{count:m.sessionCount})}),t.jsx("p",{className:"mt-1 break-all text-meta text-ink-dim",children:m.detail||m.root})]},m.source)})})]}),H&&!f&&!_&&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")," · ",H.label]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(L,{variant:"secondary",size:"sm",onClick:P?M:T,disabled:W.length===0,children:P?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:G})})]})]}),F&&t.jsx("output",{className:"text-meta text-warning",children:F}),t.jsxs("div",{className:"relative",children:[t.jsx(An,{size:15,className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),t.jsx(Te,{value:i,onChange:m=>k(m.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"ps-9"})]}),g==="sessions"?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Se,{className:"h-12 w-full"}),t.jsx(Se,{className:"h-12 w-full"}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:H.label})})]}):a.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:H.label})}):W.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:W.map(m=>{const j=`import-session-${m.source}-${m.sourceId}`;return t.jsxs("div",{className:me("flex items-start gap-3 rounded-md border p-3",r.has(m.sourceId)?"border-accent bg-row-selected":"border-hairline bg-surface hover:bg-sunken"),children:[t.jsx(yn,{id:j,checked:r.has(m.sourceId),onCheckedChange:()=>N(m.sourceId),"aria-label":kn(m),className:"mt-0.5"}),t.jsxs("label",{htmlFor:j,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:kn(m)}),t.jsx(_t,{variant:m.availability==="full"?"neutral":"warning",children:n(gs(m.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:m.messageCount??0,compactions:m.compactionCount})}),t.jsx("span",{children:n("ui.settings.imports.session_updated",{date:En(new Date((m.updatedTs||m.createdTs)*1e3))})})]}),m.cwd&&t.jsx("span",{className:"mt-1 block break-all font-mono text-meta text-ink-dim",children:m.cwd}),m.availability==="metadata_only"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.metadata_only_explain")}),m.availability==="unsupported"&&t.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.session_index_only")})]})]},m.sourceId)})})]}),H&&G>0&&!f&&!_&&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")}),(g==="preview"||c||l===null&&!u)&&t.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[t.jsx(Ot,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),l&&!c&&t.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-hairline bg-surface p-4",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.imports.preview_summary",{sessions:l.totalSessions,messages:l.totalMessages,compactions:l.totalCompactions})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:l.totalMemoryRecords,tokens:l.projectedMemoryTokens.toLocaleString()})}),l.warnings.slice(0,4).map((m,j)=>t.jsx("p",{className:"text-meta text-warning",children:m.message},`${m.code}:${m.sessionId}:${j}`)),l.warnings.length>4&&t.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:l.warnings.length})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_confirm")})]}),t.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-hairline bg-surface p-4",children:[u&&t.jsx(oe,{variant:"warning",children:t.jsx(Ie,{children:t.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsx("span",{children:u}),t.jsx(L,{variant:"secondary",size:"sm",onClick:A,children:n("ui.settings.imports.retry")})]})})}),t.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[t.jsx(yn,{checked:d,onCheckedChange:m=>R(m===!0),disabled:!l||c,"aria-label":n("ui.settings.imports.confirm_label"),className:"mt-0.5"}),t.jsx("span",{children:n("ui.settings.imports.confirm_label")})]}),t.jsxs(L,{variant:"primary",onClick:w,disabled:!te,className:"self-start",children:[g==="start"?t.jsx(Ot,{size:14,className:"animate-spin"}):t.jsx(pn,{size:14}),n("ui.settings.imports.import_button",{count:G})]})]})]}),f&&!_&&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(L,{variant:"secondary",size:"sm",onClick:S,disabled:x||f.state==="done"||f.state==="cancelled"||f.state==="failed",children:[t.jsx(yi,{size:12}),x?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(nn(f.state))})," · ",n(yd(f.phase))]}),t.jsx(Ir,{value:f.total?f.completed/f.total*100:0,className:"h-1.5"}),t.jsx(kd,{progress:f,sessions:a,selected:r})]}),_&&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(L,{variant:"secondary",size:"sm",onClick:K,children:n("ui.settings.imports.import_another")})]}),t.jsx("p",{className:"text-body-sm text-ink",children:_.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n(nn(_.state)),sessions:_.sessions.length,total:z,messages:_.messages}):n("ui.settings.imports.result_summary",{state:n(nn(_.state)),sessions:_.sessions.length,messages:_.messages})}),_.sessions.map(m=>t.jsx(fa,{row:m,jobCancelled:_.state==="cancelled"},`${m.source}:${m.sourceId}:${m.targetSessionId}`)),(_.instructionReviewPath||_.memoryReviewPath)&&t.jsxs("div",{className:"flex flex-col gap-2",children:[_.instructionReviewPath&&t.jsx(ms,{path:_.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:B}),_.memoryReviewPath&&t.jsx(ms,{path:_.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:B})]}),_.warnings.length>0&&t.jsx(oe,{variant:"warning",children:t.jsx(Ie,{children:t.jsxs("span",{className:"flex flex-col gap-1",children:[t.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:_.warnings.length})}),_.warnings.slice(0,4).map((m,j)=>t.jsx("span",{children:m.message},`${m.code}:${j}`))]})})}),_.error&&t.jsx(oe,{variant:"danger",children:t.jsx(Ie,{children:_.error})}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),g==="start"&&!f&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(Ot,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},$n=e=>({source:e.source,sessionId:e.session_id,code:e.code,message:e.message}),_a=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}),wd=e=>({jobId:e.job_id,state:e.state,sessions:e.sessions.map(_a),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($n),error:e.error});async function Nd(){return(await ye({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 Sd(e,s=!1){return(await ye({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 Md(e){const s=await ye({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($n),instructionReviewPaths:s.instruction_review_paths}}async function Cd(e){return(await ye({op:"imports.start",sources:e.sources,sessionIds:e.sessionIds,includeMemory:e.includeMemory??!0,includeInstructions:e.includeInstructions??!0})).job_id}async function Ad(e){const s=await ye({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(_a),warnings:s.warnings.map($n),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?wd(s.result):void 0}}async function Ed(e){await ye({op:"imports.cancel",jobId:e})}const At=new Set(["done","failed","cancelled"]),We=e=>e instanceof Error?e.message:String(e),Id=()=>{ie();const[e,s]=o.useState([]),[a,i]=o.useState(null),[r,l]=o.useState([]),[c,u]=o.useState(""),[d,g]=o.useState(new Set),[p,f]=o.useState(null),[_,x]=o.useState(null),[b,k]=o.useState(!1),[N,T]=o.useState(null),[M,R]=o.useState(null),[w,S]=o.useState(null),[A,K]=o.useState(null),[V,F]=o.useState(!1),[B,H]=o.useState(null),[D,z]=o.useState(0),W=o.useRef(0),P=o.useRef(0),[G,te]=o.useState(null),[m,j]=o.useState(null),v=o.useRef(null),E=w!==null&&!At.has(w.state),J=o.useCallback(async()=>{T("sources"),R(null);try{const Y=await Nd();s(Y),i(se=>Y.some(Z=>Z.source===se&&Z.detected)?se:Y.find(Z=>Z.detected)?.source??null)}catch(Y){R(n("ui.settings.imports.error_sources",{reason:We(Y)}))}finally{T(null)}},[]);o.useEffect(()=>{J()},[J]);const q=o.useCallback(async Y=>{const se=++W.current;T("sessions"),R(null);try{const O=await Sd(Y);if(se!==W.current)return;l(O)}catch(O){if(se!==W.current)return;l([]),R(n("ui.settings.imports.error_sessions",{source:Y,reason:We(O)}))}finally{se===W.current&&T(null)}},[]);o.useEffect(()=>{if(!a){l([]);return}l([]),g(new Set),f(null),x(null),te(null),j(null),k(!1),K(null),S(null),q(a)},[a,q]);const X=o.useCallback(Y=>{g(Y),k(!1),te(null),j(null),H(null)},[]),re=o.useCallback(Y=>{E||(i(Y),u(""))},[E]),le=o.useCallback(Y=>{const se=new Set(d);se.has(Y)?se.delete(Y):se.add(Y),X(se)},[X,d]),ce=o.useCallback(()=>{const Y=_d(r,c,d);X(Y.selected),Y.capped&&H(n("ui.settings.imports.selection_limit",{max:pa}))},[c,X,d,r]),ke=o.useCallback(()=>{X(new Set)},[X]),ue=o.useMemo(()=>fd(a,d),[a,d]),I=p!==null&&_!==ue,Q=o.useCallback(async()=>{if(!a||d.size===0)return;const Y=++P.current,se=ue;T("preview"),R(null),j(null);try{const O=await Md({sources:[a],sessionIds:{[a]:[...d].sort()}});if(Y!==P.current)return;f(O),x(se)}catch(O){if(Y!==P.current)return;f(null),x(null),te(se),j(n("ui.settings.imports.error_preview",{reason:We(O)}))}finally{Y===P.current&&T(null)}},[a,ue,d]);o.useEffect(()=>{if(!a||d.size===0||w||A||p&&_===ue||!p&&G===ue)return;const Y=setTimeout(()=>{Q()},250);return()=>clearTimeout(Y)},[a,d,ue,p,_,G,w,A,Q]);const ne=o.useCallback(async()=>{if(!(!a||d.size===0||!p||I||!b||w)){T("start"),R(null),K(null);try{const Y=await Cd({sources:[a],sessionIds:{[a]:[...d].sort()}}),se=Date.now()/1e3;S({jobId:Y,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:d.size,results:[],warnings:[],error:"",startedAt:se,updatedAt:se})}catch(Y){R(n("ui.settings.imports.error_start",{reason:We(Y)}))}finally{T(null)}}},[a,b,p,I,w,d]),de=w?.jobId??null,ee=w?.state??null;o.useEffect(()=>{if(!de||!ee||At.has(ee))return;let Y=!0,se;const O=async()=>{try{const Z=await Ad(de);if(!Y)return;if(v.current){const ae=v.current;v.current=null,R(Ne=>Ne===ae?null:Ne)}S(Z),Z.result&&K({...Z.result,jobId:Z.jobId}),At.has(Z.state)||(se=setTimeout(O,900))}catch(Z){if(!Y)return;const ae=n("ui.settings.imports.error_job",{reason:We(Z)});v.current=ae,R(ae),se=setTimeout(O,2e3)}};return se=setTimeout(O,D>0?0:700),()=>{Y=!1,se&&clearTimeout(se)}},[de,ee,D]);const ve=o.useCallback(async()=>{if(!(!w||At.has(w.state))){F(!0),R(null);try{await Ed(w.jobId)}catch(Y){R(n("ui.settings.imports.error_cancel",{reason:We(Y)}))}finally{F(!1)}}},[w]),be=o.useCallback(()=>{g(new Set),f(null),x(null),te(null),j(null),k(!1),H(null),K(null),S(null),R(null),a&&q(a)},[a,q]),$e=o.useCallback(async Y=>{try{return await navigator.clipboard.writeText(Y),!0}catch{return!1}},[]),Le=o.useCallback(async()=>{E||(H(null),te(null),j(null),await J(),a&&await q(a))},[a,E,q,J]),fe=o.useCallback(()=>{if(E){R(null),z(Y=>Y+1);return}te(null),j(null),Le()},[E,Le]);return t.jsx(jd,{sources:e,activeSource:a,sessions:r,query:c,selected:d,preview:p,previewStale:I,previewError:m,confirmed:b,busy:N,error:M,progress:w,result:A,cancelling:V,onSelectSource:re,onQueryChange:u,onToggleSession:le,onSelectAll:ce,onClearSelection:ke,onConfirmChange:k,onImport:()=>void ne(),onCancel:()=>void ve(),onRetry:fe,onImportAnother:be,onRefresh:Le,selectionNotice:B,onCopyPath:$e})},dt="ui.settings.appearance.agent_avatar_size_setting",Rd=e=>e==="small"?n(`${dt}.small`):e==="medium"?n(`${dt}.medium`):n(`${dt}.large`),ps={className:"size-4",glyphClassName:"size-2"},Td=({size:e})=>{const s=Qa[e],a=Ya[e],i=Za[e],r=(l,c)=>t.jsx(Rr,{className:me("items-center justify-center text-ink-muted",l),children:t.jsx(ea,{className:c,"aria-hidden":"true"})});return t.jsxs("div",{"aria-hidden":"true","data-agent-size-sample":e,className:"mt-3 flex items-start gap-6 rounded-md border border-hairline bg-surface p-3",children:[t.jsxs("div",{className:"flex h-10 items-center gap-2",children:[r(s.className,s.glyphClassName),t.jsx("span",{className:"h-2 w-16 rounded-full bg-sunken"})]}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:me("flex",i.className),children:r(a.className,a.glyphClassName)}),t.jsx("span",{className:"h-2 w-28 rounded-full bg-sunken"})]}),t.jsxs("div",{"data-agent-size-sample-fixed":"",className:"flex h-10 items-center gap-2",children:[r(ps.className,ps.glyphClassName),t.jsx("span",{className:"h-2 w-12 rounded-full bg-sunken"})]})]})},Ld=({value:e,onChange:s,searchRow:a})=>{ie();const i=o.useId();return t.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:i,className:"flex min-h-6 items-center text-body text-ink",children:n(`${dt}.agent_picture_size`)}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n(`${dt}.how_large_the_agent_s_picture_appears_in_the_chat_window_and_the_chat`)}),t.jsx(Td,{size:un(e)})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(pt,{value:e,onValueChange:r=>s(un(r)),children:t.jsx(ft,{"aria-labelledby":i,children:Wa.map(r=>t.jsx(Ve,{value:r,children:Rd(r)},r))})})})]})},Od=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function ha(e){if(!e)return null;const s=e.split("\\").join("/").split("/").filter(Boolean);for(const[a,i]of Od)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const $t=e=>n("ui.settings.integrations.integration_model.tool_count",{count:e}),Fd=e=>n("ui.settings.integrations.integration_model.integration_count",{count:e}),Dd=["connected","needs_sign_in","not_started","connecting","error"],xa=e=>Dd.includes(e),et=(e,s)=>[...s].filter(a=>a.name===e&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,zd={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},$d=1e12,Pd=1e9,Ud=60*60*1e3,ya=(e,s=Date.now())=>{if(typeof e!="number"||!Number.isFinite(e))return null;const a=e>=$d?e:e<Pd?null:e*1e3;return a===null||a>s+Ud?null:Math.min(a,s)},He=(e,s)=>e?.[s]??zd,bt=(e,s,a)=>qd(e,s)??a?.lastDecisive??null,Kd=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}:{}}),Pn=(e,s)=>e.status==="not_started"&&typeof e.tool_count=="number"&&(s.connectedAt!==null||e.status_basis==="stored"&&e.tool_count_basis==="last_seen"),Bd=(e,s)=>[...s].filter(a=>a.name===e).sort((a,i)=>i.created_at-a.created_at)[0]??null,qd=(e,s)=>Bd(e,s.filter(a=>a.status!=="cancelled")),Vt=e=>e.actions.includes("set_key")||e.actions.includes("add_key");function Vd(e,s){const a=Math.max(0,Math.round((e-s)/1e3));if(a<60)return n("ui.settings.integrations.integration_model.just_now");const i=Math.round(a/60);if(i<60)return n("ui.settings.integrations.integration_model.minutes_min_ago",{minutes:i});const r=Math.round(i/60);return r<24?n("ui.settings.integrations.integration_model.hours_h_ago",{hours:r}):n("ui.settings.integrations.integration_model.days_ago",{days:Math.round(r/24)})}function sn(e){if(!e)return null;const s=e.trim();if(!s||/^\/\w/.test(s)||/\/mcp\s+\w+/.test(s))return null;let a=s;for(let i=0;i<3;i+=1){const r=a.replace(/^(?:connection (?:closed|error|refused)|error|closed|failed)\s*:\s*/i,"").trim();if(r===a)break;a=r}return a=a.replace(/\s*\(\s*\d{3}\s*\)/g,"").replace(/\s+([.,;])/g,"$1").replace(/\s{2,}/g," ").trim(),a||null}function Hd(e,s=[],a,i=Date.now()){const r=He(a,e.name),l=et(e.name,s);if(l){if(l.action==="login"||l.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(l.action==="logout")return{label:n("ui.settings.integrations.integration_model.signing_out"),tone:"info",detail:null,busy:!0}}if(!xa(e.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const c=bt(e.name,s,r),u=Ht(c)&&e.status!=="connected",d=Pn(e,r),g=Bn(c)&&e.status!=="connected",p=(c?.action==="login"||c?.action==="reauth")&&c.status==="failed";if(r.disconnectedAt!==null)return{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1,explanation:n(fs)};switch(e.status){case"connected":return{label:typeof e.tool_count=="number"?n("ui.settings.integrations.integration_model.connected_with_tools",{tools:String($t(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"||ut(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:sn(e.status_reason),busy:!1};case"error":return{label:n("ui.settings.integrations.integration_model.couldn_t_start"),tone:"danger",detail:sn(e.status_reason)??n("ui.settings.integrations.integration_model.no_reason_was_given"),busy:!1};default:if(u)return{label:n("ui.settings.integrations.integration_model.signed_out"),tone:"warning",detail:null,busy:!1};if(g)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(ut(e,s,r))return{label:n("ui.settings.integrations.integration_model.needs_a_key"),tone:"warning",detail:null,busy:!1};if(p)return{label:n("ui.settings.integrations.integration_model.sign_in_didn_t_finish"),tone:"warning",detail:null,busy:!1};if(r.needsSignIn)return{label:e.auth.kind==="api_key"||ut(e,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:sn(e.status_reason),busy:!1};if(e.status_basis==="stored"&&d&&r.disconnectedAt===null){const f=r.connectedAt??ya(e.last_seen_at,i);return{label:f!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(Vd(i,f)),tools:String($t(e.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String($t(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(fs)}:{label:n("ui.settings.integrations.integration_model.ready"),tone:"neutral",detail:null,busy:!1,explanation:n(Qd)}}}const va=e=>n("ui.settings.integrations.integration_model.replace_keys",{count:e}),Gd=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function Wd(e,s){const a=e?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(Gd,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const Qd="ui.settings.integrations.integration_model.copy_ready_explanation",fs="ui.settings.integrations.integration_model.copy_not_connected_explanation",Yd=e=>e.transport==="local_command"?n("ui.settings.integrations.integration_model.local_command"):n("ui.settings.integrations.integration_model.remote_url");function ba(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 ha(e.source.path)}}function Zd(e,s){const a=[{text:Yd(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($t(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=ba(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 Un=(e,s)=>s.disconnectedAt!==null?"not_started":e.status;function Kn(e,s=[],a){const i=He(a,e.name),r=et(e.name,s);if(r)return r.action==="login"||r.action==="reauth"?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.continue_sign_in")}:null;const l=p=>e.actions.includes(p),c=Vt(e),u=ut(e,s,i);if(!xa(e.status))return l("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const d=bt(e.name,s,i),g=d?.status==="failed"&&kt(d);switch(Un(e,i)){case"connected":case"connecting":return null;case"needs_sign_in":return u?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:l("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}:c?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:l("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 l("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:l("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.retry")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};default:{if(Ht(d)&&l("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(Bn(d)&&l("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&l("connect"))return{kind:"connect",label:n("ui.settings.integrations.integration_model.connect")};if(i.needsSignIn){if(u&&c)return{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")};if(l("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}}return u&&c?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:g&&l("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:Pn(e,i)&&!l("connect")?null:l("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&e.status_basis!=="live"?{variant:"ghost"}:{}}:l("test")&&e.tool_count===null&&e.tool_count_basis===null?{kind:"test",label:n("ui.settings.integrations.integration_model.test"),variant:"ghost"}:null}}}const kt=e=>e.action==="login"||e.action==="reauth",Ht=e=>!!(e&&e.action==="logout"&&e.status==="complete"),Bn=e=>!!(e&&e.action==="logout"&&e.status!=="running"&&e.status!=="complete"),ka=/no oauth authorization server/i;function ut(e,s,a){if(!Vt(e))return!1;const i=bt(e.name,s,a);return i&&kt(i)&&i.status==="failed"&&ka.test(i.message??"")?!0:a.needsKey}function Jd(e,s=[],a){const i=Kn(e,s,a)?.kind,r=Un(e,He(a,e.name)),l=d=>e.actions.includes(d),c=[],u=et(e.name,s);if(u&&c.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!u&&l("test")&&i!=="test"&&c.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),l("connect")&&i!=="connect"&&r!=="connected"&&c.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!u&&l("sign_in")&&i!=="sign_in"&&r!=="connected"&&c.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),l("reload")&&c.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!u&&l("reauth")&&i!=="reauth"&&c.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),Vt(e)&&i!=="set_key"&&c.push({kind:"set_key",label:e.auth.secret_refs.length>0?n("ui.settings.integrations.integration_model.update_key"):n("ui.settings.integrations.integration_model.add_key")}),l("sign_out")&&c.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),l("disconnect")&&r==="connected"&&c.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),l("copy_setup")&&e.setup_prompt&&c.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&c.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),l("remove"))c.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!e.source.editable){const d=ba(e);c.push({kind:"remove_elsewhere",label:d?n("ui.settings.integrations.integration_model.remove_in_origin",{origin:String(d)}):n("ui.settings.integrations.integration_model.remove_in_its_own_file"),hint:d?n("ui.settings.integrations.integration_model.defined_in_origin_s_config_remove_it_there",{origin:String(d)}):n("ui.settings.integrations.integration_model.defined_in_a_file_this_app_doesn_t_write_remove_it_there")})}return c}const Xd={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 ja(e,s=[],a){const i=He(a,e.name),r=et(e.name,s),l=Un(e,i);if(r&&i.pinnedGroup&&i.pinnedOperationId===r.id)return i.pinnedGroup;if(l==="needs_sign_in"||l==="error")return"attention";const c=bt(e.name,s,i);return Ht(c)&&l!=="connected"||Bn(c)&&l!=="connected"?"attention":i.disconnectedAt!==null?"ready":ut(e,s,i)||i.needsSignIn&&l!=="connected"||c?.status==="failed"&&kt(c)&&l!=="connected"?"attention":l==="connected"||e.status_basis==="stored"&&Pn(e,i)?"connected":r&&r.action!=="test"?"attention":"ready"}function eu(e,s=[],a){return["attention","connected","ready"].map(r=>({id:r,title:Xd[r],rows:e.filter(l=>ja(l,s,a)===r)})).filter(r=>r.rows.length>0)}function tu(e,s,a=Date.now()){if(!s)return e??{};const i={};for(const r of s.servers){const l=He(e,r.name),c=et(r.name,s.operations),u=bt(r.name,s.operations,l),d=Ht(u),g=r.status==="connected"&&(r.status_basis==="probe"||r.status_basis==="live"),p=l.holdUntil!==null&&a<l.holdUntil,f=!p&&!d&&l.connectedAt===null&&r.status_basis==="stored"&&r.tool_count_basis==="last_seen"?ya(r.last_seen_at,a):null,_=!d,x=u?.status==="failed"&&kt(u)&&ka.test(u.message??""),b={connectedAt:g&&!p?a:f!==null?f:_?l.connectedAt:null,connectedToolCount:g&&!p||f!==null?r.tool_count??l.connectedToolCount:_?l.connectedToolCount:null,settledGroup:l.settledGroup,pinnedGroup:c&&l.pinnedOperationId===c.id?l.pinnedGroup:c?l.settledGroup:null,pinnedOperationId:c?c.id:null,needsKey:g?!1:l.needsKey||x,needsSignIn:g||d?!1:l.needsSignIn||r.status==="needs_sign_in",disconnectedAt:g&&!p?null:l.disconnectedAt,holdUntil:p?l.holdUntil:null,lastDecisive:u?Kd(u):null};c||(b.settledGroup=ja(r,s.operations,{...i,[r.name]:b})),i[r.name]=b}return i}const nu=(e,s)=>e!==null&&s===e,jn="local-operator.settings.integrations.row-memory",wa=(e,s)=>`${e}#${s}`;function su(e,s){const a={};if(!s)return a;for(const i of s.servers){const r=e[i.name];r&&(a[wa(i.source.path,i.name)]=r)}return a}function au(e,s,a){if(!s)return e;let i=null;for(const r of s.servers){if(Object.prototype.hasOwnProperty.call(e,r.name))continue;const l=ou(a[wa(r.source.path,r.name)]);l&&(i=i??{...e},i[r.name]=l)}return i??e}const iu=["attention","connected","ready"],Na=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),qn=e=>typeof e=="number"&&Number.isFinite(e)?e:null,_s=e=>iu.includes(e)?e:null,an=e=>{const s=qn(e);return s!==null&&s>=1e12?s:null};function ru(e){if(!Na(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:qn(e.created_at)??0,credential_removed:e.credential_removed===!0,...typeof e.message=="string"?{message:e.message}:{}}}function ou(e){if(!Na(e))return null;const s=an(e.connectedAt),a=an(e.disconnectedAt),i=e.needsKey===!0,r=e.needsSignIn===!0,l=ru(e.lastDecisive);return s===null&&a===null&&!i&&!r&&!l?null:{connectedAt:s,connectedToolCount:qn(e.connectedToolCount),settledGroup:_s(e.settledGroup),pinnedGroup:_s(e.pinnedGroup),pinnedOperationId:typeof e.pinnedOperationId=="string"?e.pinnedOperationId:null,needsKey:i,needsSignIn:r,disconnectedAt:a,holdUntil:an(e.holdUntil),lastDecisive:l}}const Sa=2e3,hs=8e3;function lu(e){return e&&(e.servers.some(a=>a.status==="connecting")||e.operations.some(a=>a.status==="running"))?Sa:!1}const cu=/^[A-Za-z0-9_.:-]{1,100}$/,du=/:\/\//;function uu(e,s){const a=e.trim();return a?cu.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 gu(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"):du.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 mu=e=>e.split(`
|
|
287
|
+
`).map(s=>s.trim()).filter(Boolean);function wn(e,s){const a=!!e?.cold,i=(e?.servers??[]).map(r=>{const l=r.transport==="http",c=r.secret_refs??[],u=r.status==="connected"?"connected":r.status==="connecting"?"connecting":r.status==="auth-required"?"needs_sign_in":"not_started",d=[];u!=="connected"&&d.push("connect"),u==="connected"&&d.push("disconnect"),a||d.push("reload"),l&&r.transport_oauth_supported!==!1&&d.push("sign_in"),c.length>0&&d.push("set_key"),r.owned_scope&&d.push("remove"),r.setup?.text&&d.push("copy_setup");const g=ha(r.source);return{id:r.name,name:r.name,scope:r.owned_scope??"global",project_cwd:null,source:{kind:pu(r.source,g,r.owned_scope),path:r.source??"",editable:r.owned_scope!==null,owned_scope:r.owned_scope},transport:l?"remote_url":"local_command",endpoint:{command:null,url:null,endpoint_redacted:!1},status:u,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:a?"stored":"live",auth:{kind:c.length?"api_key":l?"unknown":"none",signed_in:null,secret_refs:c.map(p=>({id:p.id,state:"missing"}))},tool_count:typeof r.tool_count=="number"?r.tool_count:null,tool_count_basis:typeof r.tool_count=="number"?"live":null,actions:d,setup_prompt:r.setup?.text??null}});return{cwd:"",project_scope_available:i.some(r=>r.source.owned_scope==="project"),global_path:"",project_path:null,status_source:a?"config":"live",session_id:s,servers:i,operations:(e?.operations??[]).map(r=>({...r}))}}const pu=(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",xs={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")}},fu="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function Et(e,s,a){if(s instanceof Sn&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(xs,s.code)?xs[s.code]:n(fu);return`${vi[e]}. ${i}`}return bi(e,s,a).message}const _u="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",hu="ui.settings.integrations.add_integration_form.copy_transport_hint",xu=({existingNames:e,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:r,initial:l})=>{ie();const[c,u]=o.useState(l?.name??""),[d,g]=o.useState(l?.mode??"command"),[p,f]=o.useState(l?.command??""),[_,x]=o.useState(l?.args??""),[b,k]=o.useState(l?.url??""),[N,T]=o.useState("global"),[M,R]=o.useState(l?.touched?{name:!0,command:!0,url:!0}:{}),[w,S]=o.useState(!!l?.touched),[A,K]=o.useState(!1),[V,F]=o.useState(null),B=o.useRef(null),H=o.useRef(null),D=o.useRef(null);o.useEffect(()=>{B.current?.focus()},[]);const z=uu(c,e),W=d==="command"&&!p.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,P=d==="url"?gu(b):null,G=v=>w||M[v],te=async v=>{if(v.preventDefault(),S(!0),z||W||P){z?B.current?.focus():W?H.current?.focus():D.current?.focus();return}K(!0),F(null);const E=s?N:"global",J=d==="command"?{name:c.trim(),scope:E,mode:d,command:p.trim(),args:mu(_)}:{name:c.trim(),scope:E,mode:d,url:b.trim()},q=await i(J);K(!1),F(q)},m=(v,E,J)=>E&&G(J)?t.jsx("p",{id:v,className:"text-body-sm text-danger",children:E}):null,j=v=>v.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:v=>void te(v),onKeyDown:v=>{v.key==="Escape"&&(v.stopPropagation(),r())},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Re,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),t.jsx(Te,{ref:B,id:"integration-add-name",value:c,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(z&&G("name")),"aria-describedby":z&&G("name")?"integration-add-name-error":void 0,onChange:v=>u(v.target.value),onBlur:()=>R(v=>({...v,name:!0}))}),m("integration-add-name-error",z,"name")]}),t.jsxs(pt,{value:d,onValueChange:v=>g(v==="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(ft,{"aria-labelledby":"integration-add-transport-label",children:[t.jsx(Ve,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),t.jsx(Ve,{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(hu)}),t.jsxs(es,{value:"command",className:"mt-0 flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Re,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),t.jsx(Te,{ref:H,id:"integration-add-command",value:p,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(W&&G("command")),"aria-describedby":W&&G("command")?"integration-add-command-error":void 0,onChange:v=>f(v.target.value),onBlur:()=>R(v=>({...v,command:!0}))}),m("integration-add-command-error",W,"command")]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs(Re,{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(Fn,{id:"integration-add-args",value:_,rows:2,className:"font-mono",onChange:v=>x(v.target.value)})]})]}),t.jsx(es,{value:"url",className:"mt-0 flex flex-col gap-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Re,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),t.jsx(Te,{ref:D,id:"integration-add-url",type:"url",value:b,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(P&&G("url")),"aria-describedby":P&&G("url")?"integration-add-url-error":"integration-add-url-help",onChange:v=>k(v.target.value),onBlur:()=>R(v=>({...v,url:!0}))}),m("integration-add-url-error",P,"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(pt,{value:N,onValueChange:v=>T(v==="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(ft,{"aria-labelledby":"integration-add-scope-label",children:[t.jsx(Ve,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),t.jsx(Ve,{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:N==="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,V?t.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:V}):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(_u)}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(L,{type:"button",variant:"ghost",size:"md",onMouseDown:j,onClick:r,children:n("ui.settings.integrations.add_integration_form.cancel")}),t.jsxs(L,{type:"submit",variant:"primary",size:"md",disabled:A,onMouseDown:j,children:[A?t.jsx(Me,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},yu=4;function vu(e){return e.rowMoving?e.now+e.windowMs:Math.max(e.hold.until,e.lastMovingAt+e.windowMs)}function bu(e){return e.now>e.hold.until||e.hold.reanchors>=yu?"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 ku(e){const s=vu({hold:e.hold,now:e.now,windowMs:e.windowMs,rowMoving:e.rowMoving,lastMovingAt:e.lastMovingAt});if(e.now>s)return{hold:null,land:null};const a=e.hold.landedOn??null,i=e.candidate;if(!i)return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(!a)return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:i},land:i};const r=bu({hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},candidate:i,active:e.active,body:e.body,now:e.now});if(r==="settled")return{hold:{until:s,reanchors:e.hold.reanchors,landedOn:a},land:null};if(r==="drop")return{hold:null,land:null};const l=!a.isConnected;return{hold:{until:l?e.now+e.windowMs:s,reanchors:l?e.hold.reanchors+1:e.hold.reanchors,landedOn:i},land:i}}function ju(e){const{row:s,target:a}=e;return!s||!a||typeof a.nodeType!="number"?!1:!s.contains(a)}const ys=250;function vs(e){return e?!e.disabled:!1}function wu(e){return vs(e.primary)?e.primary??null:vs(e.overflow)?e.overflow??null:null}function Nu(e){return e.verdict==="finished"?null:e.watchMs}const Ma="key";function Su(e){const{name:s,keyless:a,freeName:i,names:r,values:l,replace:c,canReplace:u}=e;if(a){const d=Nn(s,i);return{values:{[d]:(l[Ma]??"").trim()},confirmedReplace:c&&u?[d]:[],header:i.trim()}}return{values:Object.fromEntries(r.map(d=>[d,(l[d]??"").trim()])),confirmedReplace:c&&u?r:[],header:void 0}}function Nn(e,s){const a=bs(e),i=bs(s);if(!i)return"";const r=[a,i].filter(Boolean).join("_"),l=/^[A-Za-z_]/.test(r)?r:`K_${r}`;if(l.length<=rn)return l;const c=Mu(a),u=rn-i.length-c.length-2,d=[a.slice(0,Math.max(u,0)),c,i].filter(Boolean).join("_");return d.length<=rn?d:d.slice(-128)}const rn=128,bs=e=>e.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),Mu=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)},Cu=({name:e,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:r,failure:l,onSave:c,onClose:u})=>{ie();const[d,g]=o.useState({}),[p,f]=o.useState(!1),[_,x]=o.useState(""),b=a?[Nn(e,_)]:[...s],k=a?[Ma]:b,N=(a?Nn(e,_).length>0:!0)&&k.every(M=>(d[M]??"").trim()),T=b.some(M=>i.includes(M));return t.jsx(Bs,{open:!0,onClose:u,maxWidth:"xs",title:n("ui.settings.integrations.integration_key_dialog.add_keys_heading",{count:a?1:s.length,name:e}),actions:t.jsxs(t.Fragment,{children:[t.jsx(fn,{onClick:u,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),t.jsx(_n,{disabled:!N||r,onClick:()=>{const M=Su({name:e,keyless:a,freeName:_,names:b,values:d,replace:p,canReplace:T});c(M.values,M.confirmedReplace,M.header)},children:r?n("ui.settings.integrations.integration_key_dialog.saving"):n("ui.settings.integrations.integration_key_dialog.save_and_test")})]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted",children:[t.jsx("p",{className:"-mx-1.5",children:a?n("ui.settings.integrations.integration_key_dialog.keys_are_saved_encrypted_on_this_computer_this_one_is_stored_unde"):n("ui.settings.integrations.integration_key_dialog.keys_are_saved_encrypted_on_this_computer_other_integrations_that")}),a?t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Re,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),t.jsx(Te,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:_,onChange:M=>x(M.target.value)}),t.jsx("p",{className:"-mx-1.5 text-ink-dim text-meta",children:n("ui.settings.integrations.integration_key_dialog.this_server_declares_no_key_of_its_own_so_local_operator_adds_one")})]}):null,k.filter(M=>a!==!0||M.trim().length>0).map(M=>t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(Re,{htmlFor:`integration-key-${M}`,className:"font-mono",children:a?"Key":M}),t.jsx(Te,{id:`integration-key-${M}`,type:"password",autoComplete:"off",value:d[M]??"",onChange:R=>g(w=>({...w,[M]:R.target.value}))})]},M)),T?t.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[t.jsx(yn,{id:"integration-key-replace",checked:p,onCheckedChange:M=>f(M===!0)}),t.jsx(Re,{htmlFor:"integration-key-replace",className:"font-normal",children:va(b.length)})]}):null,l?t.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:l}):null]})})},Au={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},Eu={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"},Iu=({row:e,operations:s,memories:a,now:i,projectScopeAvailable:r,highlighted:l=!1,rowRef:c,primaryRef:u,overflowRef:d,pending:g,failure:p,confirm:f,onPrimary:_,onOverflow:x,onConfirm:b,onCancelConfirm:k})=>{ie();const N=Hd(e,s,a,i),T=l&&N.tone==="danger"?"text-ink":Eu[N.tone],M=Kn(e,s,a),R=Jd(e,s,a),w=Zd(e,r),S=R.findIndex(A=>A.kind==="remove"||A.kind==="remove_elsewhere");return t.jsxs("li",{ref:c,"data-integration":e.name,"data-search-row":`integration.${e.id}`,"data-search-control":!0,"data-status":e.status,className:me("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",l&&"bg-row-selected"),onKeyDown:A=>{!f||A.key!=="Escape"||(A.stopPropagation(),k())},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:N.busy?t.jsx(Me,{size:"xs"}):t.jsx("span",{"aria-hidden":"true","data-tone":N.tone,className:me("size-2 rounded-full",Au[N.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:w.map((A,K)=>t.jsxs("span",{children:[K>0?" · ":null,A.importSource&&e.source.path?t.jsx(Xe,{content:Ja(e.source.path),children:t.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:A.text})}):A.text]},A.text))})]}),N.explanation?t.jsx(Xe,{content:N.explanation,children:t.jsx("span",{className:me("shrink-0 text-body-sm",T),children:N.label})}):t.jsx("span",{className:me("shrink-0 text-body-sm",T),children:N.label}),M?t.jsxs(L,{ref:u,variant:M.variant??"secondary",size:"sm","aria-label":`${M.label} ${e.name}`,disabled:g,"data-integration-action":M.kind,onClick:()=>_(M),children:[g?t.jsx(Me,{size:"xs"}):null,M.label]}):null,t.jsxs(Tr,{children:[t.jsx(Lr,{asChild:!0,children:t.jsx(L,{ref:d,variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_row.more_actions_for_name",{name:String(e.name)}),disabled:g,children:t.jsx(ki,{"aria-hidden":"true"})})}),t.jsx(Or,{align:"end",className:"min-w-48",children:R.map((A,K)=>t.jsx(Ru,{item:A,separated:K===S&&K>0,onSelect:()=>x(A)},A.kind))})]})]}),N.detail?t.jsx("p",{className:me("ps-7 text-body-sm",N.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:N.detail}):null,p?t.jsx("p",{className:me("ps-7 text-body-sm",l?"text-ink":"text-danger"),role:"alert",children:p}):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(L,{variant:"danger",size:"sm",onClick:b,"data-integration-confirm":f.kind,children:f.kind==="remove"?n("ui.settings.integrations.integration_row.remove"):n("ui.settings.integrations.integration_row.sign_out")}),t.jsx(L,{variant:"ghost",size:"sm",onClick:k,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},Ru=({item:e,separated:s,onSelect:a})=>(ie(),t.jsxs(t.Fragment,{children:[s?t.jsx(Fr,{}):null,e.kind==="remove_elsewhere"?t.jsxs(ts,{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(ts,{destructive:e.kind==="remove",onSelect:a,"data-integration-menu":e.kind,children:e.label})]}));function Tu(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:Wd(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:Lu(s.message??null,a)}}function Lu(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 Ou(e,s){return e.kind==="ready"?"ready":e.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const Fu=({name:e,action:s,keyRoute:a,phase:i,onStart:r,onCancel:l,onOpenLink:c,onClose:u})=>{ie();const d=i.kind==="running"?i.operation:null,g=i.kind==="running"?Tu(e,d,a):null,p=i.kind==="starting"||i.kind==="running"&&g?.tone==="progress",f=g&&g.tone!=="progress",_=o.useRef(null),x=o.useRef(!1),b=Ou(i,g);o.useEffect(()=>{if(!x.current){x.current=!0;return}b&&_.current?.focus()},[b]);const k=()=>u(g?.tone==="success"?"signed-in":"dismissed");return t.jsx(Bs,{open:!0,onClose:k,maxWidth:"xs",fullWidth:!0,title:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_to_name",{name:String(e)}),dialogProps:{onOpenAutoFocus:N=>{N.preventDefault(),_.current?.focus()}},actions:t.jsxs(t.Fragment,{children:[p&&d?t.jsx(fn,{ref:_,onClick:()=>l(d.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):t.jsx(fn,{ref:i.kind==="ready"?void 0:_,onClick:k,children:g?.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(_n,{ref:_,onClick:r,children:n("ui.settings.integrations.integration_sign_in_dialog.continue_in_browser")}):null,i.kind==="refused"||g?.tone==="failure"?t.jsx(_n,{ref:g?.tone==="failure"?_:void 0,onClick:r,children:n("ui.settings.integrations.integration_sign_in_dialog.try_again")}):null]}),children:t.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted","aria-live":"polite",children:[i.kind==="ready"?t.jsx("p",{className:"-mx-1.5",children:n("ui.settings.integrations.integration_sign_in_dialog.browser_approval_notice",{name:e,replaces:s==="reauth"?"yes":"no"})}):null,i.kind==="starting"?t.jsxs("p",{className:"-mx-1.5 flex items-center gap-2",children:[t.jsx(Me,{size:"xs"}),n("ui.settings.integrations.integration_sign_in_dialog.starting_sign_in")]}):null,g?t.jsxs("div",{className:"flex flex-col gap-1",role:f?"status":void 0,children:[t.jsxs("p",{className:(g.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[g.tone==="progress"?t.jsx(Me,{size:"xs",className:"mt-0.5"}):null,g.tone==="failure"?t.jsx(Dr,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,t.jsx("span",{children:g.message})]}),g.reason?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:g.reason}):null,g.nextStep?t.jsx("p",{className:"-mx-1.5 text-ink-muted",children:g.nextStep}):null]}):null,g?.link&&g.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:g.link,children:g.link}),t.jsx(L,{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(g.link??"").then(()=>hn(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:t.jsx(Ks,{"aria-hidden":"true"})})]}),t.jsx(L,{variant:"link",size:"sm",onClick:()=>c(g.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]})})},Du=e=>e.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),zu=/^[A-Za-z]:[\\/]/,Pt=e=>{const s=e?.trim();return s&&(s.startsWith("/")||zu.test(s))?s:null};function $u(e){const r=e?.payload?.frontend?.snapshot?.cwd;return typeof r=="string"&&r.trim()?r:null}const ht="local-operator.settings.integrations.last-cwd";function Pu(e,s,a=typeof localStorage>"u"?null:localStorage){const i=Pt(s);if(!(!e||!i||!a))try{const r=a.getItem(ht),l=r?JSON.parse(r):{};if(l[e]===i)return;a.setItem(ht,JSON.stringify({...l,[e]:i}))}catch{}}const Ca=()=>typeof localStorage>"u"?null:localStorage;function Aa(e=Ca()){if(!e)return{};try{const s=e.getItem(jn);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const ks=256;function Uu(e,s=Ca()){if(s)try{const a={...Aa(s),...e},i=Object.keys(a);if(i.length>ks){const r={};for(const l of i.slice(-ks))r[l]=a[l];s.setItem(jn,JSON.stringify(r));return}s.setItem(jn,JSON.stringify(a))}catch{}}function js(e,s,a){if(e==="saved")return null;if(e==="replace_confirmation_required"){const r=va(Object.keys(a).length);return n("ui.settings.integrations.use_integrations.a_saved_value_already_exists_for_this_key_tick_label_to_overwrite",{label:String(r)})}if(e==="invalid_target")return n("ui.settings.integrations.use_integrations.that_header_can_t_carry_this_key_it_may_already_be_set_on_the_ser");const i=s.length?s:Object.keys(a);return n("ui.settings.integrations.use_integrations.keys_not_saved",{keys:String(i.join(", "))})}function Ku(e,s=typeof localStorage>"u"?null:localStorage){if(!(!e||!s))try{const a=s.getItem(ht);if(!a)return;const i=JSON.parse(a);if(!(e in i))return;const r={...i};delete r[e],s.setItem(ht,JSON.stringify(r))}catch{}}const Bu=e=>!!(e&&typeof e=="object"&&"code"in e&&e.code==="invalid_cwd"),qu=(e,s)=>s!==null&&e===s?null:e;function Vu(e,s=typeof localStorage>"u"?null:localStorage){if(!e||!s)return null;try{const a=s.getItem(ht);if(!a)return null;const r=JSON.parse(a)[e];return typeof r=="string"?r:null}catch{return null}}const Hu=e=>e.action==="disconnect"?"disconnected":"connected";function Gu(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 Wu(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 Qu({sessionId:e}){const s=yt(),a=Je(s.data,"mcp_catalog"),i=Je(s.data,"mcp"),r=a?"catalog":i?"session":null,[l,c]=o.useState(null),u=xt(),d=ct(I=>I.sessions),g=ct(I=>I.fetchSessions),p=ct(I=>I.loading),f=o.useMemo(()=>d.find(I=>I.session_id===e)??null,[d,e]),_=o.useMemo(()=>r==="session"&&!e?Du(d):null,[r,e,d]),x=r==="session"?e??_?.session_id??null:null;o.useEffect(()=>{r!=="session"||e||d.length>0||g(Xa)},[r,e,d.length,g]);const b=r==="catalog"?Pt(f?.cwd):null,k=r==="catalog"&&!!e&&b===null,N=Ae({queryKey:["desktop","session-cwd",e??""],queryFn:()=>ye({op:"sessions.get",sessionId:e??""}),enabled:k,staleTime:Number.POSITIVE_INFINITY,retry:!1}),T=k&&!N.isFetched,M=b??Pt($u(N.data))??(N.isFetched?Pt(Vu(e)):null),R=qu(M,l),w=r==="catalog"?R:null,S=r==="catalog"?e??null:null,A=ji.catalog(w,S);o.useEffect(()=>{r!=="catalog"||!e||!w||Pu(e,w)},[r,e,w]);const K=o.useRef(0),[V,F]=o.useState(0),B=o.useRef(null),H=o.useCallback((I,Q)=>{const ne=Date.now()+hs;K.current=ne,B.current={name:I,expect:Q},F(ne)},[]),D=o.useCallback(I=>Date.now()<K.current?Sa:lu(I),[]),z=Ae({queryKey:A,queryFn:()=>Si(w,S),enabled:r==="catalog"&&!T,staleTime:1e4,refetchInterval:I=>D(I.state.data)}),W=Bu(z.error);o.useEffect(()=>{!W||!M||l===M||(c(M),Ku(e))},[W,M,l,e]);const P=Ae({queryKey:xn.list(x??""),queryFn:()=>Mi(x??""),enabled:r==="session"&&!!x,staleTime:1e4,refetchInterval:I=>D(I.state.data?wn(I.state.data,x??""):void 0)}),G=o.useMemo(()=>{if(r==="catalog")return z.data;if(r==="session"&&P.data&&x)return wn(P.data,x)},[r,z.data,P.data,x]),te=o.useCallback(()=>Yu({queryClient:u,route:r,catalogKey:A,sessionId:x}),[r,A,u,x]);o.useEffect(()=>{if(!V)return;const I=B.current;if(!I)return;const Q=G?.servers.find(de=>de.name===I.name);!Q||!(I.expect==="connected"?Q.status==="connected":Q.status_basis==="live"&&Q.status!=="connected")||(K.current=0,B.current=null,F(0))},[G,V]);const m=o.useRef({}),[j,v]=o.useState(0),E=o.useMemo(()=>(m.current=tu(au(m.current,G,Aa()),G),m.current),[G,j]),J=o.useRef("");o.useEffect(()=>{const I=su(E,G);if(!Object.keys(I).length)return;const Q=JSON.stringify(I);Q!==J.current&&(J.current=Q,Uu(I))},[E,G]);const q=o.useCallback(I=>{const Q=He(m.current,I);Q.needsKey||(m.current={...m.current,[I]:{...Q,needsKey:!0}},v(ne=>ne+1))},[]),X=o.useCallback(I=>{if(I.action!=="disconnect"&&I.action!=="connect"&&I.action!=="reload")return;const Q=He(m.current,I.name),ne=Date.now()+hs,de=I.action==="disconnect"?{...Q,connectedAt:null,disconnectedAt:Date.now(),holdUntil:ne}:{...Q,disconnectedAt:null,holdUntil:ne};m.current={...m.current,[I.name]:de},H(I.name,Hu(I)),v(ee=>ee+1)},[H]),re=o.useCallback(async I=>{if(r==="catalog"){const Q=Gu(I);if(!Q)return null;try{const ne=await wi(w,Q);return u.setQueryData(A,ne),X(I),ne.operation?.id??null}catch(ne){throw ne instanceof Sn&&ne.status===409&&u.invalidateQueries({queryKey:A}),ne}}if(r==="session"&&x){const Q=await ye({op:"mcp.control",sessionId:x,control:Wu(I)});X(I);const ne=xn.list(x),de=Q?.data;return de&&"servers"in de&&Array.isArray(de.servers)?(u.setQueryData(ne,de),null):(u.invalidateQueries({queryKey:ne}),de&&"id"in de&&typeof de.id=="string"?de.id:null)}return null},[r,w,A,u,x,X]),le=o.useCallback(async I=>{if(r==="catalog"&&S&&(I.action==="connect"||I.action==="disconnect"||I.action==="reload")){try{await ye({op:"mcp.control",sessionId:S,control:{action:I.action,name:I.name,...I.action==="disconnect"?{confirmed:!0}:{}}})}catch(Q){throw u.invalidateQueries({queryKey:A}),Q}return X(I),await u.invalidateQueries({queryKey:A}),null}return re(I)},[r,S,u,A,re,X]),ce=o.useCallback(async(I,Q,ne,de)=>{if(r==="catalog"){const ee=await Ni(w,I,Q,ne,de);if(ee.catalog&&u.setQueryData(A,ee.catalog),ee.code!=="saved")return{saved:!1,message:js(ee.code,ee.failed_ids,Q)};try{await re({action:"test",name:I})}catch{}return{saved:!0,message:null}}if(r==="session"&&x){const ee=await ye({op:"mcp.credentials.store",sessionId:x,name:I,values:Q,confirmedReplace:ne});if(ee.data?.code!=="saved")return{saved:!1,message:js(ee.data?.code,ee.data?.failed_ids??[],Q)};try{await re({action:"connect",name:I})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[r,w,A,u,re,x]),ke=r==="catalog"?z:P,ue=o.useCallback(()=>{ke.refetch()},[ke]);return{enabled:r!==null,route:r,sessionId:r==="catalog"?S:x,borrowed:_,noConversation:r==="session"&&!x&&!p,document:G,isLoading:s.isLoading||r==="catalog"&&(T||z.isLoading)||r==="session"&&(x?P.isLoading:p),isError:ke.isError,folderUnavailable:nu(l,M),refetch:ue,readDocument:te,control:le,storeKeys:ce,memories:E,markNeedsKey:q}}function Yu(e){if(e.route==="catalog")return e.queryClient.getQueryData(e.catalogKey);if(e.route==="session"&&e.sessionId){const s=e.queryClient.getQueryData(xn.list(e.sessionId));return s?wn(s,e.sessionId):void 0}}const Zu=(e,s)=>{const a=e?.trim();if(!a)return null;const i=Ai(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},Ju=6,on="ui.settings.integrations.mcp_management_section.copy_section_title",Xu="ui.settings.integrations.mcp_management_section.copy_section_description",eg={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},tg=({sessionId:e,sectionRef:s,highlightServer:a})=>{ie();const i=Qu({sessionId:e}),{document:r,control:l,readDocument:c}=i,u=Os(),d=r?.servers??[],g=r?.operations??[],p=r?.project_scope_available??!1,[f,_]=o.useState(!1),[x,b]=o.useState(""),[k,N]=o.useState(null),[T,M]=o.useState({}),[R,w]=o.useState(null),[S,A]=o.useState(null),[K,V]=o.useState({kind:"ready"}),[F,B]=o.useState(null),[H,D]=o.useState(null),[z,W]=o.useState(!1),P=o.useRef({}),G=o.useRef({}),te=o.useRef({}),m=o.useRef(0),j=o.useRef(null),v=o.useRef(null),E=o.useRef(null),[J,q]=o.useState(null),[X,re]=o.useState(null),[le,ce]=o.useState(null),ke=o.useCallback(()=>{const y=E.current;E.current=null,A(null),B(null),window.setTimeout(()=>{y?.isConnected&&y.focus()},0)},[]),ue=o.useCallback(y=>{const h=window.document.activeElement;E.current=h instanceof HTMLElement?h:null,A(y)},[]),I=o.useCallback((y,h)=>{re({name:y,waitForSignIn:h==="signed-in",until:Date.now()+lt,reanchors:0}),ke()},[ke]),Q=o.useMemo(()=>Zu(a,d.map(y=>y.name)),[a,d]),ne=Q?.kind==="matched"?Q.name:null,de=o.useRef(null),ee=o.useRef(null),ve=x.trim().toLowerCase(),be=o.useMemo(()=>ve?d.filter(y=>y.name.toLowerCase().includes(ve)):d,[d,ve]),$e=eu(be,g,i.memories),Le=S?.kind==="sign_in"?d.find(y=>y.name===S.name)??null:null;o.useEffect(()=>{!ne||ee.current===ne||!x||b("")},[ne,x]),o.useEffect(()=>{!ne||ee.current===ne||be.some(y=>y.name===ne)&&(ee.current=ne,de.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[ne,be]),o.useEffect(()=>{if(!F)return;const y=g.find(h=>h.id===F)??null;V({kind:"running",operation:y})},[g,F]);const fe=g.some(y=>y.status==="running"),Y=y=>{const h=window.document.activeElement;h&&h!==window.document.body&&h.isConnected||re({name:y,waitForSignIn:!1,until:Date.now()+lt,reanchors:0})},se=async(y,h,C)=>{N(y),M(({[y]:he,...pe})=>pe);let U=null,ge=!1;try{U=await C()}catch(he){ge=!0,M(pe=>({...pe,[y]:Et(eg[h]??"status",he,fe)}))}finally{N(null),h!=="sign_out"&&(h!=="remove"||ge)&&Y(y)}return{operationId:U,failed:ge}},O=y=>d.find(h=>h.name===y),Z=y=>{y.source.path&&Ei(y.source.path)},ae=async(y,h)=>{V({kind:"starting"}),B(null);try{const C=await l({action:h,name:y});C?B(C):V({kind:"running",operation:null})}catch(C){C instanceof Sn&&C.code==="oauth_unsupported"&&i.markNeedsKey(y),V({kind:"refused",message:Et("grant",C,fe)})}},Ne=(y,h)=>{switch(h.kind){case"sign_in":case"reauth":{const C=g.find(U=>U.name===y.name&&U.status==="running");C&&kt(C)?(V({kind:"running",operation:C}),B(C.id)):(V({kind:"ready"}),B(null)),ue({kind:"sign_in",name:y.name,action:h.kind==="reauth"?"reauth":"login"});return}case"set_key":D(null),ue({kind:"key",name:y.name,keyNames:y.auth.secret_refs.map(C=>C.id)});return;case"fix":Z(y);return;case"sign_out":w({name:y.name,kind:"sign_out"});return;default:{const C=h.kind;se(y.name,C,()=>l({action:C,name:y.name}))}}},tt=(y,h)=>{switch(h.kind){case"remove":case"sign_out":w({name:y.name,kind:h.kind});return;case"sign_in":case"reauth":case"set_key":Ne(y,{kind:h.kind,label:h.label});return;case"open_config":Z(y);return;case"copy_setup":navigator.clipboard.writeText(y.setup_prompt??"").then(()=>hn(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const C=g.find(U=>U.name===y.name&&U.status==="running");C&&se(y.name,"cancel",()=>l({action:"cancel",operationId:C.id}));return}case"test":case"connect":case"disconnect":case"reload":{const C=h.kind;se(y.name,C,()=>l({action:C,name:y.name}));return}default:return}},je=(y,h)=>{if(w(null),h==="remove"){const C=y.source.owned_scope;if(!C)return;const U=be.findIndex(ge=>ge.name===y.name);se(y.name,"remove",()=>l({action:"remove",name:y.name,scope:C})).then(({operationId:ge,failed:he})=>{he||ge!==null||(hn(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(y.name)})),U>=0&&ce({index:U}))});return}se(y.name,"sign_out",()=>l({action:"logout",name:y.name})).then(()=>{re({name:y.name,waitForSignIn:!1,until:Date.now()+lt,reanchors:0})})},jt=async y=>{try{return await l({action:"add",name:y.name,scope:y.scope,...y.mode==="command"?{command:y.command,args:y.args}:{url:y.url}}),_(!1),q(y.name),null}catch(h){return Et("add",h,!1)}},wt=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(on)}),t.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(Xu)})]}),i.enabled&&d.length>0&&!f?t.jsxs(L,{ref:j,variant:"secondary",size:"sm",onClick:()=>_(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Zn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return t.jsx(_e,{title:n(on),titleComponent:wt,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),children:t.jsx(oe,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const nt=t.jsx(xu,{existingNames:d.map(y=>y.name),projectScopeAvailable:p,projectLabel:r?.cwd?sg(r.cwd):null,onSubmit:jt,onCancel:()=>{_(!1),window.setTimeout(()=>j.current?.focus(),0)}}),st=S?O(S.name):void 0,Gt=Object.entries(T).filter(([y])=>!d.some(h=>h.name===y)),Wt=y=>M(({[y]:h,...C})=>C);o.useEffect(()=>{if(!J)return;const y=P.current[J];if(!y){d.some(h=>h.name===J)&&(G.current[J]?.focus(),q(null));return}y.focus(),q(null)},[J,d]),o.useEffect(()=>{if(!le)return;const h=be[Math.min(le.index,be.length-1)]??be.at(-1);if(h){const C=P.current[h.name]??G.current[h.name];if(!C)return;C.focus()}else j.current?.focus();ce(null)},[le,be]);const Ge=o.useCallback((y,h)=>{const C=c()??r,U=C?.servers.find(Pe=>Pe.name===y.name),ge=C?.operations??[],he=U?U.status==="connecting"||et(U.name,ge)!==null:!1;he&&U&&(m.current=h);const pe=U?Kn(U,ge,i.memories):null;if(U&&y.waitForSignIn&&(pe?.kind==="sign_in"||pe?.kind==="reauth"))return"kept";const Ce=ku({hold:y,now:h,windowMs:lt,rowMoving:he,lastMovingAt:m.current,candidate:U?wu({primary:pe?P.current[U.name]:null,overflow:G.current[U.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Ce.hold)return re(null),"finished";if(!Ce.land)return"kept";re({name:y.name,waitForSignIn:!1,until:Ce.hold.until,landedOn:Ce.land,reanchors:Ce.hold.reanchors});const Ee=Ce.land;return window.setTimeout(()=>{Ee.isConnected&&Ee.focus()},0),"landed"},[c,r,i.memories]);return o.useEffect(()=>{if(!X)return;Ge(X,Date.now());let y=0,h=!1;const C=()=>{if(h)return;const U=Nu({verdict:Ge(X,Date.now()),watchMs:ys});U!==null&&(y=window.setTimeout(C,U))};return y=window.setTimeout(C,ys),()=>{h=!0,window.clearTimeout(y)}},[X,Ge]),o.useEffect(()=>{if(!X)return;const y=h=>{ju({target:h.target,row:te.current[X.name]})&&re(null)};return window.document.addEventListener("pointerdown",y,!0),()=>{window.document.removeEventListener("pointerdown",y,!0)}},[X]),t.jsxs(_e,{title:n(on),titleComponent:wt,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[i.route==="session"&&i.borrowed?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.borrowed_chat_notice",{chat:i.borrowed.title?.trim()||i.borrowed.session_id.slice(0,6)})}):null,i.noConversation?t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.integrations_can_be_managed_here_once_a_chat_has_started")}),t.jsx(L,{variant:"primary",size:"sm",onClick:()=>u("/chat"),children:n("ui.settings.integrations.mcp_management_section.start_a_chat")}),t.jsx("p",{className:"text-ink-dim text-meta",children:n("ui.settings.integrations.mcp_management_section.updating_local_operator_removes_this_step")})]}):null,i.isLoading?t.jsx("div",{className:"flex h-24 items-center justify-center",children:t.jsx(Me,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?t.jsx(oe,{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(oe,{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(L,{variant:"secondary",size:"sm",onClick:i.refetch,children:n("ui.settings.integrations.mcp_management_section.retry")})]})}):null,Gt.map(([y,h])=>t.jsx(oe,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:h}),t.jsx(L,{variant:"ghost",size:"sm",onClick:()=>Wt(y),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},y)),f&&d.length>0?nt:null,d.length>=Ju?t.jsxs("div",{className:"relative",children:[t.jsx(An,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-ink-dim"}),t.jsx(Te,{ref:v,value:x,onChange:y=>b(y.target.value),onKeyDown:y=>{y.key!=="Escape"||!x||(y.preventDefault(),b(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:Fd(d.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"ps-9"})]}):null,Q?.kind==="miss"&&d.length>0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.no_match_for_name",{asked:String(Q.asked)})}):null,Q?.kind==="matched"&&Q.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(Q.name),asked:String(Q.unresolved)})}):null,r&&d.length===0&&!i.isLoading?f?nt:t.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[t.jsx(qs,{"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(L,{variant:"primary",size:"md",onClick:()=>_(!0),"data-tour-tag":"mcp-add-server",children:[t.jsx(Zn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,d.length>0&&be.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(L,{variant:"secondary",size:"sm",onClick:()=>{b(""),window.setTimeout(()=>{(v.current??j.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,$e.map(y=>t.jsxs("section",{"aria-labelledby":`integrations-group-${y.id}`,className:"flex flex-col gap-1.5",children:[t.jsxs("h3",{id:`integrations-group-${y.id}`,className:"px-1 text-ink-dim text-meta",children:[y.title," · ",y.rows.length]}),t.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:y.rows.map(h=>t.jsx(Iu,{row:h,operations:g,memories:i.memories,projectScopeAvailable:p,highlighted:h.name===ne,rowRef:C=>{te.current[h.name]=C,h.name===ne&&(de.current=C)},primaryRef:C=>{P.current[h.name]=C},overflowRef:C=>{G.current[h.name]=C},pending:k===h.name,failure:T[h.name]??null,confirm:R?.name===h.name?{kind:R.kind}:null,onPrimary:C=>Ne(h,C),onOverflow:C=>tt(h,C),onConfirm:()=>R&&je(h,R.kind),onCancelConfirm:()=>{w(null),window.setTimeout(()=>{G.current[h.name]?.focus()},0)}},h.id))})]},y.id))]}),S?.kind==="sign_in"?t.jsx(Fu,{name:S.name,action:S.action,keyRoute:Le?Vt(Le):!1,phase:K,onStart:()=>void ae(S.name,S.action),onCancel:y=>void l({action:"cancel",operationId:y}).catch(()=>{}),onOpenLink:y=>void Ci(y),onClose:y=>I(S.name,y)}):null,S?.kind==="key"?t.jsx(Cu,{name:S.name,keyNames:S.keyNames.length?S.keyNames:st?.auth.secret_refs.map(y=>y.id)??[],keyless:S.keyNames.length===0,savedKeys:st?.auth.secret_refs.filter(y=>y.state==="encrypted").map(y=>y.id),saving:z,failure:H,onClose:ke,onSave:(y,h,C)=>{W(!0),D(null),i.storeKeys(S.name,y,h,C).then(U=>{if(!U.saved){D(U.message);return}A(null),re({name:S.name,waitForSignIn:!1,until:Date.now()+lt,reanchors:0})}).catch(U=>D(Et("key",U,!1))).finally(()=>W(!1))}}):null]})},lt=4e3,ng=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,sg=e=>e.replace(ng,"~"),gt=new WeakMap,ws=new WeakSet;function Ea(e,s){if(!ws.has(e)){ws.add(e);let i=Ye(e);Ii(e,()=>{const r=Ye(e);i!==r&&(i=r,gt.delete(e))})}if(!s.startsWith(`${Ye(e)}:`))return;const a=gt.get(e);if(a?.key===s)return a;gt.delete(e)}function ag(e,s,a){if(s.startsWith(`${Ye(e)}:`)){if(Ea(e,s),!Object.keys(a).length){gt.delete(e);return}gt.set(e,{key:s,fields:a})}}const ig=we.object({display_name:we.string(),title:we.string(),description:we.string(),timezone:we.string()}),rg=ig.extend({account_id:we.string(),display_label:we.string(),avatar_url:we.string().optional(),avatar:we.object({source:we.string(),hash:we.string(),updated_at:we.string().optional()}).optional()}),og=we.object({scope:we.string().regex(/^[a-f0-9]{64}$/),profile:rg});class Ns extends Error{constructor(s,a){super("Account profile request failed"),this.code=s,this.status=a}}async function It(e,s=null){const a=await ei(e,s);if(a.kind!=="json")throw new Ns(a.kind==="error"?a.code:void 0,a.kind==="error"?a.status:null);const i=og.parse(a.body.result);if(i.profile.account_id!==e.expectedAccountId)throw new Ns("account_mismatch",409);return i}const Rt={read:e=>It({op:"account.profile",expectedAccountId:e}),update:(e,s,a)=>It({op:"account.profile.update",expectedAccountId:e,scope:s,fields:a}),upload:(e,s,a)=>It({op:"account.avatar.put",expectedAccountId:e,scope:s},a),remove:(e,s,a)=>It({op:"account.avatar.delete",expectedAccountId:e,scope:s,mode:a,confirmed:!0})};function ln(e,s){return Object.fromEntries(Object.keys(e).filter(a=>e[a]!==s[a]).map(a=>[a,s[a]]))}const Ia={snapshot:(e,s)=>["account-profile",e,s]};function cn(e,s,a){if(Ye(e)!==s||Ri(e).accountId!==a.profile.account_id)throw new Error("Account authority changed");e.setQueryData(Ia.snapshot(a.profile.account_id,s),a),e.setQueryData(Qn.user(),i=>{if(!i||i.account.id!==a.profile.account_id)return i;const{display_name:r,title:l,description:c,timezone:u,avatar:d,avatar_url:g}=a.profile;return{...i,account:{...i.account,profile:{...i.account.profile,display_name:r,title:l,description:c,timezone:u,avatar:d},avatar_url:g}}}),e.invalidateQueries({predicate:i=>i.queryKey[0]==="team-bridge"&&i.queryKey.some((r,l)=>r==="account"&&i.queryKey[l+1]===a.profile.account_id)}),e.invalidateQueries({queryKey:Qn.user()})}function lg(e=!0,s=()=>"personal"){const a=xt(),i=Vs(),r=i.accountId,l=s(),c=Ae({queryKey:Ia.snapshot(r??"unresolved",i.token),enabled:e&&!!r,retry:!1,queryFn:()=>Ti(a,r,()=>Rt.read(r??""))}),u=()=>{if(!r||Ye(a)!==i.token||s()!==l)throw new Error("Account authority changed")};return{...c,authority:i,async update(d){if(u(),!c.data||!r)throw new Error("Account profile unresolved");const g=await Rt.update(r,c.data.scope,d);return u(),cn(a,i.token,g),g},async upload(d){if(u(),!c.data||!r)throw new Error("Account profile unresolved");const g=await Rt.upload(r,c.data.scope,d);return u(),cn(a,i.token,g),g},async remove(d){if(u(),!c.data||!r)throw new Error("Account profile unresolved");const g=await Rt.remove(r,c.data.scope,d);return u(),cn(a,i.token,g),g}}}const cg=1024*1024;function dg(e){const s=new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.length>=24&&s.getUint32(0)===2303741511&&s.getUint32(4)===218765834&&s.getUint32(12)===1229472850)return{width:s.getUint32(16),height:s.getUint32(20)};if(e.length>=4&&e[0]===255&&e[1]===216){let a=2;for(;a+3<e.length;){if(e[a++]!==255)return null;for(;e[a]===255;)a++;const i=e[a++];if(i===217||i===218||a+2>e.length)return null;if(i===1||i>=208&&i<=215)continue;const r=s.getUint16(a);if(r<2||a+r>e.length)return null;if([192,193,194,195,197,198,199,201,202,203,205,206,207].includes(i)&&r>=8)return{width:s.getUint16(a+5),height:s.getUint16(a+3)};a+=r}}if(e.length>=25&&s.getUint32(0)===1380533830&&s.getUint32(8)===1464156752&&s.getUint32(4,!0)+8===e.length){const a=s.getUint32(12);if(a===1448097880&&e.length>=30)return{width:1+e[24]+(e[25]<<8)+(e[26]<<16),height:1+e[27]+(e[28]<<8)+(e[29]<<16)};if(a===1448097824&&e.length>=30&&e[23]===157&&e[24]===1&&e[25]===42)return{width:s.getUint16(26,!0)&16383,height:s.getUint16(28,!0)&16383};if(a===1448097868&&e[20]===47)return{width:1+((e[22]&63)<<8|e[21]),height:1+((e[24]&15)<<10|e[23]<<2|(e[22]&192)>>6)}}return null}function Ss(e){return!!(e&&e.width>0&&e.height>0&&e.width<=4096&&e.height<=4096&&e.width*e.height<=16e6)}async function ug(e){if(!e.size||e.size>cg||!["image/png","image/jpeg","image/webp"].includes(e.type))throw new Error("Profile image refused");const s=new Uint8Array(await e.arrayBuffer());if(!Ss(dg(s)))throw new Error("Profile image dimensions refused");const a=await createImageBitmap(e,{imageOrientation:"from-image"});if(!Ss(a))throw a.close(),new Error("Profile decoded image dimensions refused");return a}const Tt=e=>({display_name:e.profile.display_name,title:e.profile.title,description:e.profile.description,timezone:e.profile.timezone}),Ut={display_name:64,title:80,description:500},gg=e=>Ut[e]*2,Ms=8,Cs=e=>e.formatToParts(new Date).find(s=>s.type==="timeZoneName")?.value;function mg(){return[...new Set(["UTC",...Intl.supportedValuesOf("timeZone")])].map(e=>{const s=Cs(new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"shortOffset"})),a=Cs(new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"})),i=[s,a].filter(r=>!!r&&r!==e);return{id:e,name:e.split("_").join(" "),description:s,keywords:i}})}function pg({snapshot:e,initialDraft:s,onDraftChange:a,photoUrl:i,onSave:r,onUpload:l,onRemove:c}){ie();const u=o.useId(),[d,g]=o.useState(()=>Tt(e)),[p,f]=o.useState(()=>({...Tt(e),...s})),[_,x]=o.useState(!1),[b,k]=o.useState(!1),[N,T]=o.useState(),[M,R]=o.useState(),[w,S]=o.useState(),[A,K]=o.useState(),[V,F]=o.useState(),[B,H]=o.useState(),D={heading:o.useRef(null),photo:o.useRef(null),remove:o.useRef(null),remove_cancel:o.useRef(null),cancel:o.useRef(null),keep_editing:o.useRef(null),display_name:o.useRef(null),title:o.useRef(null),description:o.useRef(null)},z=o.useMemo(mg,[]),[W,P]=o.useState(!1),[G,te]=o.useState(!1),[m,j]=o.useState(),v=Wr(m),E=o.useRef(null),J=o.useRef(void 0),q=o.useRef(!0),X=o.useRef(0),re=Object.keys(ln(d,p)).length>0;o.useEffect(()=>{a?.(ln(d,p))},[d,p,a]);const le=w==="photo_invalid"?n("ui.settings.personal_profile.photo_invalid"):w?n("ui.settings.personal_profile.photo_error"):void 0,ce=e.profile.avatar,ke=ce?.source==="uploaded"?"uploaded":"provider",ue=_||b;o.useEffect(()=>(q.current=!0,()=>{q.current=!1,X.current++,J.current?.close()}),[]),o.useEffect(()=>{B&&(D[B].current?.focus(),H(void 0))});const I=()=>{X.current++,J.current?.close(),J.current=void 0,j(void 0),S(void 0)},Q=()=>{I(),H("photo")},ne=()=>{P(!1),H("cancel")},de=()=>{te(!1),H("remove")},ee=(O,Z=!1)=>ae=>{ae.key!=="Escape"||Z||(ae.preventDefault(),ae.stopPropagation(),O())},ve=async O=>{if(!O||ue)return;const Z=++X.current;S(void 0),k(!0),F(void 0);try{const ae=await ug(O);if(!q.current||Z!==X.current){ae.close();return}J.current?.close(),J.current=ae,j(ae),te(!1)}catch{q.current&&Z===X.current&&S("photo_invalid")}finally{q.current&&Z===X.current&&k(!1)}},be=async()=>{if(!q.current||ue||!re)return;const O=ln(d,p),Z=Object.keys(Ut).map(ae=>ae in O&&[...p[ae]].length>Ut[ae]?{field:ae,reason:"length"}:ae==="description"&&p.description.split(`
|
|
288
|
+
`).length>Ms?{field:ae,reason:"lines"}:void 0).find(Boolean);if(Z){R(Z),H(Z.field);return}x(!0),T(void 0),R(void 0),K(void 0);try{const ae=await r(O);if(!q.current)return;g(Tt(ae)),f(Tt(ae)),K("saved"),H("heading")}catch{q.current&&T("save_error")}finally{q.current&&x(!1)}},$e=async O=>{if(!q.current||ue)return;k(!0),S(void 0),F(void 0);const Z=X.current,ae=v.capture();try{if(O.size>1024*1024)throw new Error("Profile crop too large");if(!await Yr(v,ae,()=>O.arrayBuffer(),tt=>{if(!(!q.current||Z!==X.current))return l(new Uint8Array(tt))})||!q.current)return;I(),F("photo_saved"),H("photo")}catch{q.current&&S("photo_error")}finally{q.current&&k(!1)}},Le=async()=>{if(!(!q.current||ue)){k(!0),S(void 0),F(void 0);try{await c(ke),q.current&&(te(!1),F("photo_removed"),H("photo"))}catch{q.current&&S("photo_error")}finally{q.current&&k(!1)}}},fe=(O,Z)=>{_||(f(ae=>({...ae,[O]:Z})),K(void 0),T(void 0),M?.field===O&&R(void 0),P(!1))},Y=O=>M?.field!==O?void 0:M.reason==="lines"?n("ui.settings.personal_profile.description_lines",{count:String(Ms)}):n("ui.settings.personal_profile.field_too_long",{count:String(Ut[O])}),se=(O,Z,ae)=>{const Ne=Y(O);return t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Re,{htmlFor:`${u}-${O}`,children:Z}),ae({id:`${u}-${O}`,value:p[O],maxLength:gg(O),readOnly:_,"aria-invalid":Ne?!0:void 0,"aria-describedby":Ne?`${u}-${O}-error`:void 0}),Ne&&t.jsx("p",{id:`${u}-${O}-error`,className:"text-meta text-danger",children:Ne})]})};return t.jsxs("section",{"aria-labelledby":`${u}-heading`,className:"flex min-w-0 flex-col gap-4","data-account-profile-editor":"",children:[t.jsx("h3",{ref:D.heading,id:`${u}-heading`,tabIndex:-1,className:"text-section font-semibold text-ink focus:outline-none",children:n("ui.settings.personal_profile.heading")}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t.jsx("span",{className:"inline-flex size-16 shrink-0 items-center justify-center overflow-hidden rounded-full bg-sunken text-ink-muted","aria-hidden":"true",children:i?t.jsx("img",{alt:"",src:i,className:"size-full object-cover"}):e.profile.display_label.trim()[0]||"?"}),t.jsx(L,{ref:D.photo,variant:"secondary",size:"sm",disabled:ue,onClick:()=>E.current?.click(),children:ce?.hash?n("ui.settings.personal_profile.replace"):n("ui.settings.personal_profile.choose")}),ce?.hash&&t.jsx(L,{ref:D.remove,variant:"ghost",size:"sm",disabled:ue,onClick:()=>{te(!0),I(),H("remove_cancel")},children:n("ui.settings.personal_profile.remove")}),t.jsx("input",{ref:E,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",tabIndex:-1,"aria-hidden":"true",disabled:ue,onChange:O=>{const Z=O.currentTarget.files?.[0];O.currentTarget.value="",ve(Z)}})]}),t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.personal_profile.photo_help")}),t.jsx("output",{className:"text-meta text-ink-muted empty:hidden",children:V==="photo_saved"?n("ui.settings.personal_profile.photo_saved"):V==="photo_removed"?n("ui.settings.personal_profile.photo_removed"):null}),m&&t.jsx("div",{onKeyDown:ee(Q,b),children:t.jsx(Qr,{source:m,outputEdge:256,onSave:O=>void $e(O),onCancel:Q,saving:b,error:le,previewSizes:[{id:"profile",px:64,label:n("ui.settings.personal_profile.preview"),caption:n("ui.settings.personal_profile.preview_caption")}],copy:{cropArea:n("ui.settings.personal_profile.crop_area"),instructions:(O,Z)=>n("ui.settings.personal_profile.crop_instructions",{width:String(O),height:String(Z)}),zoom:n("ui.settings.personal_profile.zoom"),zoomIn:n("ui.settings.personal_profile.zoom_in"),zoomOut:n("ui.settings.personal_profile.zoom_out"),zoomValue:O=>n("ui.settings.personal_profile.zoom_value",{value:O}),recenter:n("ui.settings.personal_profile.recenter"),previews:n("ui.settings.personal_profile.previews"),save:n("ui.settings.personal_profile.save_photo"),saving:n("ui.settings.personal_profile.saving"),cancel:n("ui.common.actions.cancel"),errorEncode:n("ui.settings.personal_profile.crop_error")}})}),G&&t.jsxs("fieldset",{className:"flex flex-col gap-2","aria-label":n("ui.settings.personal_profile.remove"),onKeyDown:ee(de,b),children:[t.jsx("p",{className:"text-body-sm text-ink",children:ke==="uploaded"?n("ui.settings.personal_profile.remove_uploaded"):n("ui.settings.personal_profile.remove_provider")}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(L,{variant:"danger",size:"sm",disabled:ue,onClick:()=>void Le(),children:b?n("ui.settings.personal_profile.saving"):n("ui.settings.personal_profile.remove")}),t.jsx(L,{ref:D.remove_cancel,variant:"secondary",size:"sm",disabled:ue,onClick:de,children:n("ui.common.actions.cancel")})]})]}),w&&!m&&t.jsx("p",{role:"alert",className:"text-meta text-danger",children:le}),t.jsxs("form",{className:"flex min-w-0 flex-col gap-4",onSubmit:O=>{O.preventDefault(),be()},"aria-busy":_,children:[se("display_name",n("ui.settings.personal_profile.display_name"),O=>t.jsx(Te,{ref:D.display_name,...O,onChange:Z=>fe("display_name",Z.target.value),autoComplete:"nickname"})),se("title",n("ui.settings.personal_profile.title"),O=>t.jsx(Te,{ref:D.title,...O,onChange:Z=>fe("title",Z.target.value),autoComplete:"organization-title"})),se("description",n("ui.settings.personal_profile.description"),O=>t.jsx(Fn,{ref:D.description,...O,onChange:Z=>fe("description",Z.target.value),rows:3})),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Re,{asChild:!0,children:t.jsx("span",{"aria-hidden":"true",children:n("ui.settings.personal_profile.timezone")})}),t.jsx(na,{showLabel:!1,ariaLabel:n("ui.settings.personal_profile.timezone"),placeholder:n("ui.settings.personal_profile.timezone_placeholder"),busyLabel:n("ui.settings.personal_profile.loading"),options:z,selected:p.timezone?z.find(O=>O.id===p.timezone)??{id:p.timezone,name:p.timezone.split("_").join(" ")}:null,onSelect:O=>fe("timezone",O.id),onClear:()=>fe("timezone","")})]}),N&&t.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.personal_profile.save_error")}),W?t.jsxs("div",{className:"flex flex-col gap-2",onKeyDown:ee(ne),children:[t.jsx("p",{role:"alert",className:"text-body-sm text-ink",children:n("ui.settings.personal_profile.discard")}),t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(L,{type:"button",variant:"secondary",size:"sm",onClick:()=>{f(d),P(!1),T(void 0),R(void 0),H("heading")},children:n("ui.settings.personal_profile.discard_action")}),t.jsx(L,{ref:D.keep_editing,type:"button",variant:"primary",size:"sm",onClick:ne,children:n("ui.settings.personal_profile.keep_editing")})]})]}):t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(L,{type:"submit",variant:"primary",size:"sm",disabled:!re||ue,children:_?n("ui.settings.personal_profile.saving"):n("ui.settings.personal_profile.save")}),t.jsx(L,{ref:D.cancel,type:"button",variant:"secondary",size:"sm",disabled:!re||_,onClick:()=>{P(!0),H("keep_editing")},children:n("ui.common.actions.cancel")})]})]}),t.jsx("output",{className:"text-meta text-ink-muted empty:hidden",children:A==="saved"?n("ui.settings.personal_profile.saved"):null}),t.jsxs(L,{variant:"link",size:"sm",className:"w-fit",onClick:()=>In("https://console.radienthq.com/dashboard/account"),children:[n("ui.settings.personal_profile.manage"),t.jsx(Hs,{"aria-hidden":"true"})]})]})}function fg(){return ie(),t.jsx("output",{className:"text-body-sm text-ink-muted",children:n("ui.settings.personal_profile.loading")})}function _g({onRetry:e}){return ie(),t.jsxs("div",{className:"flex flex-col items-start gap-2",children:[t.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:n("ui.settings.personal_profile.load_error")}),t.jsx(L,{variant:"secondary",size:"sm",onClick:e,children:n("ui.common.actions.retry")})]})}const hg=/^[a-f0-9]{16}$/;function xg(){ie();const e=yt(),s=Je(e.data,"account_profile"),a=Vs(),i=o.useCallback(()=>{try{return JSON.stringify(a.accountId?qr(window.localStorage,a.accountId)??"personal":"unresolved")}catch{return"unresolved"}},[a.accountId]),r=o.useCallback(b=>{const k=N=>{(N.key===Hr||N.key===null)&&b()};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[]),l=o.useSyncExternalStore(r,i,i),c=lg(s,i),u=o.useRef(null),d=c.data,g=xt(),p=`${c.authority.token}:${l}:${d?.scope??""}`,f=d?Ea(g,p):void 0,_=d?.profile.avatar?.hash,x=gr(d&&_&&hg.test(_)?{accountId:d.profile.account_id,hash:_}:null,64);return o.useEffect(()=>{!d||!Vr(c.authority.token)||(u.current?.scrollIntoView({block:"start"}),u.current?.focus({preventScroll:!0}))},[d,c.authority.token]),s?!c.authority.accountId||c.isPending?t.jsx(fg,{}):d?t.jsx("div",{ref:u,tabIndex:-1,"aria-label":n("ui.settings.personal_profile.heading"),className:"focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:t.jsx(pg,{snapshot:d,initialDraft:f?.fields,onDraftChange:b=>ag(g,p,b),photoUrl:x,onSave:c.update,onUpload:c.upload,onRemove:c.remove},p)}):t.jsx(_g,{onRetry:()=>void c.refetch()}):t.jsx(L,{variant:"secondary",size:"sm",onClick:()=>In("https://console.radienthq.com/dashboard/account"),children:n("ui.settings.personal_profile.manage")})}const yg=({verification:e})=>{ie();const{prices:s}=Oi(),a=e.grant_amount??s?.default_new_credits,{sentence:i,action:r}=Fi(e.signup_grant,Di(a)),l=zi(e.claim_url,$i);return t.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[t.jsx(qt,{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(L,{variant:"secondary",size:"sm",onClick:()=>In(l),children:r})]})]})},vg=({onAfterCredentialUpdate:e})=>{ie();const{isAuthenticated:s,user:a,isLoading:i,accountRead:r,signOut:l}=Li(),c=Gs(f=>f.isSigningOut),u=o.useCallback(async()=>{try{await l()}catch(f){console.error("Error signing out:",f)}},[l]),d=(()=>{if(!s||!a?.radientUser)return null;const{account:f,identity:_,verification:x}=a.radientUser,b=x!=null&&!x.email_verified&&x.signup_grant!=="claimed";return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mb-8",children:t.jsx(xg,{})}),t.jsxs(vt,{children:[t.jsx(xe,{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(_t,{variant:"success",className:"capitalize",children:f.status})]})}),t.jsx(xe,{label:n("ui.settings.account.radient_account_section.name"),value:f.name||n("ui.settings.account.radient_account_section.not_provided")}),t.jsx(xe,{label:n("ui.settings.account.radient_account_section.email"),value:f.email}),t.jsx(xe,{label:n("ui.settings.account.radient_account_section.account_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.id})}),t.jsx(xe,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:t.jsx("span",{className:"text-mono-sm",children:f.tenant_id})}),t.jsx(xe,{label:n("ui.settings.account.radient_account_section.provider"),value:t.jsx("span",{className:"capitalize",children:_.provider})}),t.jsx(xe,{label:n("ui.settings.account.radient_account_section.created"),value:Ws(f.created_at)})]}),b&&x?t.jsx(yg,{verification:x}):null,t.jsx("div",{className:"mt-8",children:t.jsx(mr,{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(L,{variant:"danger",className:"mt-3",onClick:u,children:[t.jsx(pr,{}),n("ui.settings.account.radient_account_section.sign_out_from_radient")]})]})]})})(),g=r==="refused"?n("ui.settings.account.radient_account_section.radient_refused_the_sign_in_this_app_is_holding_so_your_account_d"):Qs(r)?n("ui.settings.account.radient_account_section.your_radient_account_could_not_be_read_so_this_app_cannot_show_yo"):n("ui.settings.account.radient_account_section.you_are_not_currently_signed_in_to_radient"),p=s&&a?null:t.jsxs("div",{children:[t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[g," ",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(Gr,{titleText:"",onAfterCredentialUpdate:e,descriptionText:"",onSignInSuccess:()=>{}})})]});return i||c?t.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[t.jsx(Me,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!c&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.account.radient_account_section.loading_your_radient_account_details")})]}):s&&a?.radientUser?d:t.jsx("div",{className:"flex flex-col gap-4",children:p})},dn={label:1,synonym:.8,key:.75,choice:.7,section:.6,description:.4},bg={exact:1,prefix:.92,substring:.7,subsequence:.45};function Ra(e){return e.length<4||!e.endsWith("s")?e:/(?:ch|sh|ss|x|z)es$/.test(e)?e.slice(0,-2):e.slice(0,-1)}function As(e){let s=!1;const a=e.split(" ").map(i=>{const r=Ra(i);return r!==i&&(s=!0),r}).join(" ");return s?a:e}const Es=new WeakMap,Is={exact:3,prefix:2,substring:1};function kg(e,s,a){const i=Ra(a),r=[Nt(e,a)];i!==a&&r.push(Nt(e,i)),s!==e&&(r.push(Nt(s,a)),i!==a&&r.push(Nt(s,i)));let l=null;for(const c of r)!c||c==="subsequence"||(!l||Is[c]>Is[l])&&(l=c);return l}const jg=12,wg=2;function Ng(e,s){let a=0,i=-1,r=null,l=Es.get(e.fields);if(!l){l={};for(const c of Object.keys(dn)){const u=e.fields[c];u&&(l[c]=As(u))}Es.set(e.fields,l)}for(const c of s){let u=-1,d=null;for(const g of Object.keys(dn)){const p=e.fields[g];if(!p)continue;const f=kg(p,l[g]??As(p),c);if(!f)continue;const _=dn[g]*bg[f];_>u&&(u=_,d=g)}if(d===null)return null;a+=u,u>i&&(i=u,r=d)}return r?{score:a,reason:r}:null}function Sg(e,s,a=jg){const i=fr(s);if(i.length===0)return{results:[],total:0};const r=mt(s),l=[];for(const c of e){const u=Ng(c,i);if(!u)continue;const d=c.fields.label!==""&&c.fields.label===r;l.push({entry:c,reason:u.reason,score:d?u.score+wg:u.score})}return l.sort((c,u)=>u.score-c.score||c.entry.fields.label.length-u.entry.fields.label.length||c.entry.order-u.entry.order),{results:l.slice(0,Math.max(0,a)).map(({entry:c,reason:u})=>({entry:c,reason:u})),total:l.length}}function Mg(e){return mt(e)===""}function Cg(e){const s=new Map;for(const r of e){const l=r.entry.sectionId||"",c=s.get(l);if(c){c.results.push(r);continue}s.set(l,{sectionId:l,sectionLabel:r.entry.sectionLabel,results:[r]})}const a=[...s.values()],i=a.filter(r=>r.sectionId==="");return[...a.filter(r=>r.sectionId!==""),...i]}const Ag={label:"ui.settings.search.reason.label",synonym:"ui.settings.search.reason.synonym",key:"ui.settings.search.reason.key",choice:"ui.settings.search.reason.choice",section:"ui.settings.search.reason.section",description:"ui.settings.search.reason.description"};function Eg(e){const{registry:s,sections:a,build:i=Xc}=e,r=ie();return o.useMemo(()=>i({registry:s,sections:a}),[i,s,a,r])}function Ig(){return Ki()==="mac"?"⌘F":"Ctrl+F"}const Rg=o.forwardRef(function({index:s,readRendered:a,onJump:i,onDismiss:r,className:l},c){ie();const u=o.useRef(null),d=o.useRef(null),[g,p]=o.useState(null),[f,_]=o.useState(""),[x,b]=o.useState(!1),[k,N]=o.useState(-1),[T,M]=o.useState(""),R=o.useId();o.useImperativeHandle(c,()=>({focus:()=>{u.current?.focus(),b(!0)}}));const w=o.useCallback(()=>a?.()??[],[a]),S=o.useCallback(()=>{p(w())},[w]),A=o.useCallback(()=>{p(v=>v??w())},[w]),K=o.useCallback(()=>{const v=g;return v&&v.length>0?[...s,...v]:s},[s,g]),V=Mg(f),{results:F,total:B}=o.useMemo(()=>Sg(K(),f),[K,f]),H=o.useMemo(()=>Cg(F),[F]),D=k<0||F.length===0?-1:Math.min(k,F.length-1),z=D>=0?F[D]:void 0,W=o.useMemo(()=>new Map(F.map((v,E)=>[v.entry.id,E])),[F]),P=o.useCallback(v=>{v!==void 0&&_(v),b(!1),N(-1),r?.()},[r]),G=o.useCallback(async v=>{if(await i(v)==="missing"){M(n("ui.settings.search.jump.missing"));return}M(""),b(!1),N(-1)},[i]),te=v=>`${R}-option-${v}`,m=v=>{switch(v.key){case"ArrowDown":v.preventDefault(),b(!0),N(E=>F.length===0?-1:E<0?0:(E+1)%F.length);return;case"ArrowUp":v.preventDefault(),b(!0),N(E=>F.length===0?-1:E<0?F.length-1:(E-1+F.length)%F.length);return;case"Home":if(!x)return;v.preventDefault(),N(0);return;case"End":if(!x)return;v.preventDefault(),N(Math.max(0,F.length-1));return;case"Enter":if(v.preventDefault(),!x){b(!0);return}{const E=z??F[0];E&&G(E.entry)}return;case"Escape":if(v.preventDefault(),f!==""){_(""),M(""),N(-1);return}P();return;default:return}},j=V?"":n("ui.settings.search.results.count",{count:B});return t.jsxs("div",{ref:d,className:me("relative @container w-full",l),onBlur:v=>{const E=v.relatedTarget;E&&d.current?.contains(E)||(b(!1),N(-1),r?.())},children:[t.jsxs("div",{className:"relative",children:[t.jsx(An,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-ink-dim"}),t.jsx(Te,{ref:u,role:"combobox","aria-expanded":x,"aria-controls":x?R:void 0,"aria-activedescendant":x&&z?te(D):void 0,"aria-autocomplete":"list","aria-label":n("ui.settings.search.field.label"),placeholder:n("ui.settings.search.field.placeholder"),value:f,type:"text",className:"pl-8",onFocus:()=>{S(),b(!0)},onChange:v=>{A(),_(v.currentTarget.value),N(-1),M(""),b(!0)},onKeyDown:m})]}),x&&t.jsxs("div",{id:R,role:"listbox",tabIndex:-1,"aria-label":n("ui.settings.search.panel.label"),className:"absolute top-full right-0 z-40 mt-2 flex max-h-[min(24rem,60vh)] w-full min-w-80 flex-col overflow-y-auto rounded-md border border-hairline bg-elevated p-1 shadow-overlay",children:[T&&t.jsx("p",{"data-search-notice":"","aria-hidden":"true",className:"px-2 pt-2 pb-1 text-body-sm text-ink",children:T}),V?t.jsxs("div",{className:"flex flex-col gap-1 px-2 py-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.empty.summary")}),t.jsx("p",{className:"text-meta text-ink-dim",children:t.jsx(Pi,{text:n("ui.settings.search.empty.shortcut",{shortcut:Ui(Ig())})})})]}):F.length===0?t.jsxs("div",{className:"flex flex-col gap-2 px-2 py-2",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.no_results.title",{query:f})}),t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.search.no_results.hint")}),t.jsx("button",{type:"button",className:"min-h-6 w-fit rounded-sm px-1.5 py-1 text-body-sm text-accent underline-offset-2 hover:underline focus-visible:outline-2",onMouseDown:v=>v.preventDefault(),onClick:()=>{P(""),u.current?.focus()},children:n("ui.settings.search.no_results.clear")})]}):t.jsxs(t.Fragment,{children:[H.map(v=>t.jsxs("div",{role:v.sectionLabel?"group":void 0,"aria-label":v.sectionLabel||void 0,children:[v.sectionLabel&&t.jsx("p",{className:"px-2 pt-2 pb-1 font-medium text-ink-muted text-meta",children:v.sectionLabel}),v.results.map(E=>{const J=W.get(E.entry.id)??0,q=J===D;return t.jsxs("div",{id:te(J),role:"option","aria-selected":q,"data-search-result-id":E.entry.id,className:me("flex cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 @[40rem]:flex-row @[40rem]:items-baseline @[40rem]:justify-between @[40rem]:gap-4",q?"bg-accent-wash outline-solid outline-1 -outline-offset-1 outline-control":"hover:bg-row-hover"),onMouseDown:X=>X.preventDefault(),onMouseEnter:()=>N(J),onClick:()=>G(E.entry),children:[t.jsx("span",{className:"min-w-0 text-body-sm text-ink",children:E.entry.label}),t.jsxs("span",{className:"@[40rem]:shrink-0 @[40rem]:text-right text-meta text-ink-dim",children:[E.entry.sectionLabel&&n("ui.settings.search.row.section_hint",{section:E.entry.sectionLabel}),E.entry.sectionLabel&&" · ",n(Ag[E.reason]),E.entry.detail&&E.entry.detail!==E.entry.sectionLabel&&t.jsxs(t.Fragment,{children:[" · ",E.entry.detail]})]})]},E.entry.id)})]},v.sectionId||"no-section")),B>F.length&&t.jsx("p",{"data-search-more":"",className:"px-2 pt-1 pb-2 text-meta text-ink-dim",children:n("ui.settings.search.results.more",{count:B-F.length})})]})]}),t.jsx("output",{"aria-live":"polite",className:"sr-only",children:T||j})]})});function Tg({metric:e,data:s}){return ie(),t.jsx(Bi,{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)}`:qi(a),children:t.jsx(mc,{data:s,children:t.jsx($s,{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 Lg={all:["desktop","tts-path-resolution"]};function Og(e){return Ae({queryKey:Lg.all,queryFn:()=>ye({op:"tts.paths"}),enabled:e,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:ti})}const Fg=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function Rs(e){const s=new Map(e.map(r=>[r.key,r])),a=[],i=[];for(const r of Fg){const l=s.get(r);l?a.push(l):i.push(r)}return{rows:a,missing:i}}const Dg=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Ts(e){return typeof e=="string"&&Dg.includes(e)}function zg(e){if(e===null||typeof e!="object")return null;const s=e;if(!Ts(s.path)||typeof s.reason!="string"||typeof s.servable!="boolean"||!Array.isArray(s.rungs))return null;const a=[];for(const i of s.rungs){if(i===null||typeof i!="object")return null;const r=i;if(!Ts(r.path)||typeof r.available!="boolean"||typeof r.reason!="string")return null;a.push({path:r.path,available:r.available,reason:r.reason})}return{path:s.path,reason:s.reason,servable:s.servable,rungs:a}}const $g={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 Ta(e){return $g[e]}function Pg(e){return{servable:e.servable,serving:e.path==="none"?null:e.path,reason:e.reason,rungs:e.rungs.map(s=>({path:s.path,name:Ta(s.path),available:s.available,reason:s.reason}))}}const Ug="ui.settings.speech.speech_section.copy_backend_older_sentence",La="ui.settings.speech.speech_section.copy_unavailable_sentence",Kg=({resetErrorBoundary:e})=>(ie(),t.jsx(oe,{variant:"warning",children:t.jsxs("div",{className:"flex flex-col items-start gap-3",children:[t.jsx("span",{children:n(La)}),t.jsxs(L,{variant:"secondary",onClick:e,children:[t.jsx($r,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function Bg(e){return e==="enabled"?"ready":e==="below-version"?"older":"pairing"}const qg=({sectionRef:e})=>{ie();const s=yt(),a=Ys(),i=ni(s.data,"tts"),r=Bg(i),l=Ae({queryKey:Kt.all,queryFn:()=>ye({op:"settings.list"}),enabled:r==="ready",staleTime:1e4}),c=Og(r==="ready"),{hasRadientApiKey:u,hasRadientSession:d,speechBlock:g}=Vi(),p=`${d}:${u}`,f=o.useRef(p),_=c.refetch;o.useEffect(()=>{f.current!==p&&(f.current=p,_())},[p,_]);const x=l.data,b=o.useMemo(()=>Rs(x?.settings??[]),[x]),[k,N]=o.useState({}),[T,M]=o.useState({}),[R,w]=o.useState({});o.useEffect(()=>{x&&N(m=>{let j=!1;const v={...m};for(const E of Rs(x.settings).rows){const J=m[E.key];if(J&&J.value!==rt(E).value)continue;const q=rt(E);J&&J.value===q.value&&J.cascadeBase===q.cascadeBase||(v[E.key]=q,j=!0)}return j?v:m})},[x]);const S=(m,j)=>M(v=>({...v,[m]:j})),A=(m,j)=>w(v=>({...v,[m]:j})),K=async m=>{const j=k[m.key];if(!j)return;const v=Wi(m,j);if(!v.ok){A(m.key,v.error);return}S(m.key,!0),A(m.key,null);try{await ye(v.request),S(m.key,!1);const J=(await l.refetch()).data?.settings.find(q=>q.key===m.key);J&&N(q=>{const X=q[m.key];return X&&X.value===j.value&&X.cascadeBase===j.cascadeBase?{...q,[m.key]:rt(J)}:q})}catch(E){S(m.key,!1),A(m.key,E instanceof Error?E.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},V=async m=>{S(m.key,!0),A(m.key,null);try{await ye({op:"settings.reset",key:m.key}),N(j=>({...j,[m.key]:rt({...m,value:m.default,is_default:!0})})),S(m.key,!1),await l.refetch()}catch(j){S(m.key,!1),A(m.key,j instanceof Error?j.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},F=o.useMemo(()=>zg(c.data),[c.data]),B=F?Pg(F):null,H=c.isSuccess&&F===null,D=(s.data?null:s.error)??null,z=l.error,W=n("ui.settings.speech.speech_section.speech_voicing"),P=n("ui.settings.speech.speech_section.how_the_assistant_sounds_when_it_speaks_aloud");if(r==="pairing"){const{sentence:m}=gn(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),D);return t.jsx(_e,{title:W,icon:St,description:P,sectionRef:e,children:t.jsx(oe,{variant:"warning",children:m})})}if(r==="older")return t.jsx(_e,{title:W,icon:St,description:P,sectionRef:e,children:t.jsx(oe,{variant:"warning",children:n(Ug)})});if(z||!x){const{sentence:m,remedy:j}=gn(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),z);return t.jsx(_e,{title:W,icon:St,description:P,sectionRef:e,children:t.jsx(oe,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:m}),j&&t.jsx(L,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{l.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const G=B?!B.servable:g==="offline",te=B?B.rungs.find(m=>m.path===B.serving)??null:null;return t.jsx(_e,{title:W,icon:St,description:P,sectionRef:e,searchSection:"speech",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.speech_voicing"),searchIgnore:"speech rows are registry keys read from the daemon's own selection",children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsxs("section",{className:"flex flex-col gap-3",children:[c.isPending&&t.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[t.jsx(Me,{}),Yn("checking")]}),(c.isError||H)&&!B&&g!=="offline"&&t.jsx(oe,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{children:[n(La)," ",c.error instanceof Error?c.error.message:""]}),t.jsx(L,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{c.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})}),t.jsx(zr,{fallbackRender:Kg,resetKeys:[c.dataUpdatedAt],children:B&&t.jsxs(t.Fragment,{children:[t.jsxs(vt,{children:[t.jsx(xe,{label:n("ui.settings.speech.speech_section.speaks_through"),value:B.serving?Ta(B.serving):n("ui.settings.speech.speech_section.nothing_yet")}),t.jsx(xe,{label:n("ui.settings.speech.speech_section.availability"),value:B.servable?n("ui.settings.speech.speech_section.ready"):n("ui.settings.speech.speech_section.no_provider")})]}),B.reason&&B.reason!==te?.reason&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:B.reason}),t.jsx("ul",{className:"flex flex-col gap-1",children:B.rungs.map(m=>t.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[t.jsxs("span",{className:m.path===B.serving?"text-ink":"text-ink-muted",children:[m.name,t.jsxs("span",{className:m.path===B.serving?"text-ink-muted":"text-ink-dim",children:[" ",m.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:m.reason})]},m.path))})]})})]}),G&&t.jsx(oe,{variant:"warning",children:Yn(g)}),t.jsx("div",{className:"flex flex-col gap-1",children:b.rows.map(m=>t.jsx(Hi,{setting:m,draft:k[m.key]??rt(m),tier:Gi(m),saving:!!T[m.key],error:R[m.key]??null,onDraftChange:j=>N(v=>({...v,[m.key]:j})),onSave:()=>{K(m)},onReset:()=>{V(m)}},m.key))}),b.missing.length>0&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:b.missing.length,rows:b.missing.join(", ")})})]})})},Vg=()=>{ie();const{data:e,isLoading:s,error:a,refetch:i}=dc(),r=uc(),[l,c]=o.useState(""),[u,d]=o.useState(!1);o.useEffect(()=>{c(e?.content??""),d(!1)},[e]);const g=b=>{const k=b.target.value;c(k),d(k!==(e?.content??""))},p=async()=>{if(!(!u||r.isPending))try{const b={content:l};await r.mutateAsync(b),await i(),d(!1)}catch(b){console.error("Error updating system prompt:",b)}},f=()=>{c(e?.content??""),d(!1)},_=r.isPending,x=()=>t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Re,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),t.jsx(Fn,{id:"app-system-prompt",name:"systemPrompt",value:l,onChange:g,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(L,{variant:"primary",onClick:p,disabled:!u||_,children:[_?t.jsx(Me,{size:"sm"}):t.jsx(Xs,{}),_?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),t.jsx(L,{onClick:f,disabled:!u||_,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:En(e.last_modified)})]})]});return t.jsx(_e,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:Zr,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(Me,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a?t.jsx(oe,{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")})}):x()})},Hg=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],Gg=e=>Hg.includes(e),Wg=e=>{const s=[];let a=0;for(const i of e){const r=Math.max(0,Math.floor(i.count)),l=Math.max(1,Math.floor(i.columns));for(let c=0;c<r;c+=l)s.push({start:a+c,count:Math.min(l,r-c)});a+=r}return s},Qg=({index:e,key:s,groups:a})=>{const i=Wg(a),r=i.reduce((l,c)=>l+c.count,0);if(!Number.isInteger(e)||e<0||e>=r)return e;switch(s){case"Home":return 0;case"End":return r-1;case"ArrowLeft":return Math.max(0,e-1);case"ArrowRight":return Math.min(r-1,e+1);case"ArrowUp":case"ArrowDown":{const l=i.findIndex(d=>e>=d.start&&e<d.start+d.count),c=i[l+(s==="ArrowDown"?1:-1)];if(!c)return e;const u=e-i[l].start;return c.start+Math.min(u,c.count-1)}default:return e}},Yg={localOperatorDark:vl,localOperatorLight:Pl,dracula:Rl,dune:Wo,sage:gl,monokai:hr,tokyoNight:wl,iceberg:Ll,radient:rl,neon:Yi,obsidian:aa,synth:lo,catppuccinMocha:To,catppuccinLatte:_l,tokyoNightStorm:No,gruvbox:ho,nord:lc,oneDark:ro,solarizedDark:zl,rosePine:Jo,rosePineMoon:xl,rosePineDawn:Io,alucard:el,gruvboxLight:Po,tokyoNightDay:kl,oneLight:pl,catppuccinFrappe:zo,catppuccinMacchiato:ll,palenight:Qi,everforest:ec,everforestLight:Jl,kanagawaWave:ac,kanagawaLotus:Yo,ayuDark:Ko,ayuMirage:qo,ayuLight:Cl,nightfox:Mo,duskfox:ql,synthwave:Sl,matrix:uo,tron:jo,cyberpunk:_r,vaporwave:Yl,outrun:fo,neonNoir:nc,arcade:dl,forest:Wl,ocean:Ho,desert:Hl,autumn:rc,lavender:Fl,arctic:Ao,rosewood:al,solarizedLight:Kl,githubLight:nl,paper:Jr,linen:El,highContrastLight:ao,mintLight:mo},Ls="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",Zg=({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"})]})]})]}),Jg=({id:e,name:s,description:a,isSelected:i,isTabStop:r,onSelect:l,onFocusTile:c})=>{const u=Yg[e];return t.jsx(Xe,{side:"bottom",align:"start",content:a,children:t.jsxs("button",{type:"button","data-theme-tile":e,"aria-pressed":i,tabIndex:r?0:-1,onFocus:c,onClick:l,className:me("relative flex flex-col gap-1.5 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart",i?Ls:"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(Zg,{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",Ls),children:t.jsx(sa,{size:12,className:"text-accent","aria-hidden":"true"})})]}),t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(u,{size:12,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink",children:s})]})]})})},Xg=e=>[...e.querySelectorAll("[data-theme-grid]")].map(s=>{const a=[...s.querySelectorAll("[data-theme-tile]")],i=a[0]?.getBoundingClientRect().top??0;return{count:a.length,columns:Math.max(1,a.filter(r=>Math.abs(r.getBoundingClientRect().top-i)<1).length)}}),em=()=>{ie();const{themeName:e,setTheme:s}=Be(),a=Object.values(za),i=[{label:n("ui.settings.appearance.theme_selector.dark"),items:a.filter(d=>d.theme.palette.mode==="dark")},{label:n("ui.settings.appearance.theme_selector.light"),items:a.filter(d=>d.theme.palette.mode==="light")}].filter(d=>d.items.length>0),[r,l]=o.useState(null),c=o.useMemo(()=>{const d=i.flatMap(g=>g.items.map(p=>p.id));return r&&d.includes(r)?r:d.includes(e)?e:d[0]},[i,r,e]),u=d=>{if(!Gg(d.key))return;const g=[...d.currentTarget.querySelectorAll("[data-theme-tile]")],p=g.indexOf(d.target);if(p<0)return;d.preventDefault();const f=Qg({index:p,key:d.key,groups:Xg(d.currentTarget)});f!==p&&g[f]?.focus()};return t.jsx(Pr,{children:t.jsx("div",{onKeyDown:u,"data-search-ignore":"the theme picker is a grid of fifty-nine choices; the Appearance section result is its destination",className:"flex flex-col gap-6",children:i.map(d=>t.jsxs("div",{children:[t.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:d.label}),t.jsx("div",{"data-theme-grid":d.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:d.items.map(({id:g,name:p,description:f})=>t.jsx(Jg,{id:g,name:p,description:f,isSelected:g===e,isTabStop:g===c,onSelect:()=>s(g),onFocusTile:()=>l(g)},g))})]},d.label))})})},tm=({value:e,onChange:s,searchRow:a})=>{ie();const i=o.useId();return t.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("span",{id:i,className:"flex min-h-6 items-center text-body text-ink",children:n("ui.settings.appearance.transcript_display_mode_setting.transcript_display")}),t.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n("ui.settings.appearance.transcript_display_mode_setting.by_turn_condenses_each_turn_to_its_answer_by_response_keeps_every")})]}),t.jsx("div",{className:"flex h-6 shrink-0 items-center",children:t.jsx(pt,{value:e,onValueChange:r=>s(Fs(r)),children:t.jsx(ft,{"aria-labelledby":i,children:si.map(r=>t.jsx(Ve,{value:r.value,children:r.value==="by-turn"?n("ui.settings.appearance.transcript_display_mode_setting.by_turn"):n("ui.settings.appearance.transcript_display_mode_setting.by_response")},r.value))})})})]})},nm=()=>{ie();const{data:e,isLoading:s,error:a}=fc({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(Fo,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&t.jsx(Se,{className:"h-6 w-36"}),a&&t.jsx(oe,{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(L,{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(bo,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},sm=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],am=()=>{ie();const[e,s]=o.useState("credits"),a=o.useMemo(()=>{const u=new Date,d=gc(u);return{start_date:ns(d),end_date:ns(u),rollup:"daily"}},[]),{data:i,isLoading:r,error:l}=hc(a,{enabled:!0}),c=o.useMemo(()=>i?.data_points?[...i.data_points].sort((d,g)=>Jt(d.timestamp).getTime()-Jt(g.timestamp).getTime()).map(d=>({bucket:ar(to(Jt(d.timestamp),"yyyy-MM-dd")),value:e==="credits"?Number.parseFloat(d.total_cost.toFixed(2)):d.total_tokens})):[],[i,e]);return t.jsxs("div",{children:[t.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[t.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[t.jsx(yo,{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:sm.map(({id:u,label:d})=>t.jsx(L,{variant:"ghost",size:"sm","aria-pressed":e===u,onClick:()=>s(u),className:me(e===u&&"bg-surface text-ink hover:bg-surface"),children:d},u))})]})]}),r&&t.jsx(Se,{className:"h-62 w-full"}),l&&t.jsx(oe,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:l.message})}),!r&&!l&&i&&c.length>0&&t.jsx(Tg,{metric:e,data:c}),!r&&!l&&(!i||c.length===0)&&t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.settings_page.no_usage_recorded_in_the_last_30_days")})]})},im=()=>(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(Ar,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_account")]}),t.jsx(L,{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(Hs,{})]})})]})),km=()=>{ie();const e=Zi(),s=Be(h=>h.showAgentReasoning),a=Be(h=>h.setShowAgentReasoning),i=Be(h=>h.transcriptDisplayMode),r=Be(h=>h.setTranscriptDisplayMode),l=Be(h=>h.agentAvatarSize),c=Be(h=>h.setAgentAvatarSize),{data:u,isLoading:d,isFetching:g,error:p,refetch:f}=Ji(),{needsProvider:_}=Xi(),x=Ys(),{sentence:b,remedy:k}=gn(x??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),p),N=xr(),[T,M]=o.useState(null),R=Gs(),{isAuthenticated:w,accountRead:S,isFetching:A,isRefreshing:K,refreshUser:V}=Cn(),F=ct(h=>h.activeSessionId),B=ct(h=>h.sessions),H=qc(),{accountId:D,snapshot:z,model:W}=Js(),P=o.useRef(null);z.status?P.current={accountId:D,status:z.status}:z.checking||(P.current=null);const G=z.status??(P.current?.accountId===D?P.current.status:null),te=wc(H),m=o.useMemo(()=>yr.filter(h=>h.id!=="agent-messages"||H!=="absent"),[H]),j=o.useCallback(()=>W.check("surface_open",!0),[W]),[v,E]=o.useState("general"),[J,q]=o.useState(!1),X=o.useRef(null),re=o.useRef(null),{startTour:le}=vr(),ce=ai(),ke=Os(),{data:ue,refetch:I}=er(),{refreshModels:Q}=tr(),ne=o.useMemo(()=>ue?.keys?[...ue.keys].sort():[],[ue?.keys]),de=o.useRef({keys:"",hosting:void 0});o.useEffect(()=>{const h=ne.join(","),C=u?.values?.hosting;(de.current.keys!==h||de.current.hosting!==C)&&(de.current={keys:h,hosting:C},Q().catch(U=>{console.error("Failed to refresh models after credentials or hosting change:",U)}))},[ne,u?.values?.hosting,Q]);const ee=o.useRef({general:o.useRef(null),radient:o.useRef(null),integrations:o.useRef(null),appearance:o.useRef(null),speech:o.useRef(null),keyboard:o.useRef(null),providers:o.useRef(null),"agent-messages":o.useRef(null),backend:o.useRef(null),imports:o.useRef(null),updates:o.useRef(null)}).current,ve=o.useMemo(()=>new URLSearchParams(ce.search).get("setting"),[ce.search]),be=o.useMemo(()=>new URLSearchParams(ce.search).get("filter")??"",[ce.search]),$e=o.useMemo(()=>new URLSearchParams(ce.search).get("mcp")??void 0,[ce.search]),Le=o.useMemo(()=>new URLSearchParams(ce.search).get("provider"),[ce.search]),fe=o.useCallback(h=>{E(h),q(!0);const C=ee[h],U=re.current;if(C?.current&&U){const he=C.current.getBoundingClientRect().top-U.getBoundingClientRect().top;U.scrollHeight>U.clientHeight?U.scrollTo({top:Math.max(0,U.scrollTop+he-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,C.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(X.current??void 0),X.current=setTimeout(()=>{q(!1),X.current=null},800)}else q(!1)},[ee]),Y=o.useRef(null),se=o.useRef(null),O=yt(),Z=Je(O.data,"settings"),ae=Ae({queryKey:Kt.all,queryFn:()=>ye({op:"settings.list"}),enabled:Z,staleTime:1e4}),Ne=Eg({registry:ae.data,sections:m}),tt=o.useCallback(()=>re.current?Jc(re.current):[],[]),[je,jt]=o.useState(null),wt=o.useCallback(async h=>{se.current=null;const C=re.current??document;if(h.source==="page")return sd(C,h.id.slice(5));if(h.source==="section")return ad(C,h.sectionId);const U=h.settingKey;if(!U)return"missing";const ge=Lt(U,"backend");return ae.data&&!ae.data.settings.some(he=>he.key===U)?"missing":(fe(ge),jt({key:U,nonce:Date.now()}),C.querySelector(`[data-search-section="${ge}"]`)?"landed":"missing")},[fe,ae.data]);o.useEffect(()=>{jt(null)},[ce.search]),o.useEffect(()=>{const h=C=>{!(C.metaKey||C.ctrlKey)||C.altKey||C.key.toLowerCase()==="f"&&(ii(C.target)||(C.preventDefault(),se.current=re.current?.scrollTop??null,Y.current?.focus()))};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[]),o.useEffect(()=>{const h=setTimeout(()=>{const C=re.current;if(!C)return;const U=()=>{if(J)return;const ge=C.getBoundingClientRect(),he=ge.height;let pe="",Ce=0;for(const[Ee,Pe]of Object.entries(ee))if(Pe.current){const Fe=Pe.current.getBoundingClientRect(),Ue=ge.top,at=Fe.top-Ue,it=Fe.bottom-Ue,Oa=Fe.height,Fa=Math.max(0,at),Da=Math.min(he,it),Vn=Math.max(0,Da-Fa)/Oa,Hn=Vn+(at<he*.3?.1:0);Hn>Ce&&Vn>.1&&(Ce=Hn,pe=Ee)}pe&&pe!==v&&E(pe)};return U(),C.addEventListener("scroll",U,{passive:!0}),()=>{C.removeEventListener("scroll",U),clearTimeout(X.current??void 0)}},100);return()=>clearTimeout(h)},[ee,v,J]),o.useEffect(()=>{const h=new URLSearchParams(ce.search),C=h.get("section"),U=h.get("setting"),ge=U?Lt(U,"backend"):C;if(ge==="agent-messages"&&!te)return;const he=ge?ee[ge]:void 0;if(!ge||!he)return;let pe=!1,Ce=Number.NaN,Ee=0;const Pe=window.setTimeout(()=>{pe||(pe=!0,Ue.disconnect(),fe(ge))},2e3),Fe=()=>{if(pe)return;const at=he.current;if(!at){Ee=requestAnimationFrame(Fe);return}const it=Math.round(at.getBoundingClientRect().top+window.scrollY);if(it===Ce&&it>0){pe=!0,Ue.disconnect(),window.clearTimeout(Pe),fe(ge);return}Ce=it,Ee=requestAnimationFrame(Fe)},Ue=new ResizeObserver(()=>{pe||(cancelAnimationFrame(Ee),Ee=requestAnimationFrame(Fe))});return re.current&&Ue.observe(re.current),Ee=requestAnimationFrame(Fe),()=>{pe=!0,cancelAnimationFrame(Ee),Ue.disconnect(),window.clearTimeout(Pe)}},[ce.search,ee,fe,te]);const nt=async(h,C)=>{M(h);try{await N.mutateAsync({[h]:C}),await f()}catch(U){console.error(`Error updating ${h}:`,U)}finally{M(null)}},st=d,Gt=S==="checking",Wt=Qs(S),Ge=S==="ready"||S==="checking"||A,y=Zs(st,4e3);return p?t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(oe,{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:b}),k&&t.jsx(L,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void f(),disabled:g,children:g?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):st?t.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[t.jsx(Me,{size:"lg",label:y?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),y&&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")})]}):u?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(br,{activeSection:v,onSelectSection:fe,sections:m})}),t.jsx("div",{ref:re,"data-settings-content":!0,"data-glass-region":"canvas-content","data-tour-tag":"settings-general-section",className:"panel-scroll flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Er,{title:n("ui.settings.page.title"),icon:Jn}),t.jsx(Rg,{onDismiss:()=>{const h=se.current;se.current=null,h!==null&&re.current?.scrollTo({top:h})},ref:Y,index:Ne,readRendered:tt,onJump:wt})]}),t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsxs("div",{ref:ee.general,"data-search-section":"general","data-search-section-label":n("ui.settings.navigation.settings_sidebar.general_settings"),className:"flex flex-col gap-8",children:[t.jsx(kr,{focus:ve===Zt||je?.key===Zt,focusNonce:je?.key===Zt?je.nonce:void 0}),t.jsxs(_e,{title:n("ui.settings.profile.title"),icon:ea,description:n(w?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[Gt&&t.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),Wt&&t.jsx(oe,{variant:"warning",children:t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("span",{children:n(S==="refused"?"ui.settings.profile.account_read_failed_refused":"ui.settings.profile.account_read_failed_retry")}),t.jsx(L,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>V(),disabled:K,children:K?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(Xn,{searchRow:"general.profile.name",value:R.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:T==="user_name",onSave:async h=>{M("user_name");try{R.updateName(h)}finally{M(null)}},readOnly:Ge}),t.jsx(Xn,{searchRow:"general.profile.email",value:R.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:T==="user_email",onSave:async h=>{M("user_email");try{R.updateEmail(h)}finally{M(null)}},readOnly:Ge})]})]}),t.jsx(_e,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:t.jsxs(L,{variant:"secondary","data-search-row":"general.tour","data-search-control":!0,onClick:()=>{le({forceModalCompleted:!0})},children:[t.jsx(nr,{}),n("ui.settings.tour.action")]})}),t.jsx(_e,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:jr,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:t.jsxs("div",{"data-search-row":"general.model","data-search-control":!0,"data-search-label":n("ui.settings.model.settings_page.model_settings"),"data-search-terms":[n("ui.common.models.hosting_select.hosting_provider"),n("ui.common.models.model_select.model"),n("ui.settings.model.default_effort.label")].join(" "),className:"flex flex-col gap-4",children:[t.jsx(wr,{value:u.values.hosting,isSaving:T==="hosting",onSave:h=>nt("hosting",h),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),t.jsx(Nr,{value:u.values.model_name,hostingId:u.values.hosting,isSaving:T==="model_name",onSave:h=>nt("model_name",h),allowCustom:!0,allowDefault:!1}),t.jsx(gd,{hosting:u.values.hosting,modelName:u.values.model_name,focus:ve===Qe||je?.key===Qe,focusNonce:je?.key===Qe?je.nonce:void 0}),_&&t.jsx(oe,{variant:"neutral",icon:t.jsx(qt,{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:()=>{fe("providers"),ee.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),t.jsx(Vg,{}),t.jsx(_e,{title:n("ui.settings.configuration.settings_page.configuration_information"),icon:qt,description:n("ui.settings.configuration.settings_page.system_information_about_the_current_configuration"),children:t.jsxs(vt,{children:[t.jsx(xe,{label:n("ui.settings.configuration.settings_page.version"),value:t.jsx("span",{className:"text-mono-sm",children:u.version})}),t.jsx(xe,{label:n("ui.settings.configuration.settings_page.created"),value:Ws(u.metadata.created_at)}),t.jsx(xe,{label:n("ui.settings.configuration.settings_page.last_modified"),value:En(u.metadata.last_modified)}),t.jsx(xe,{label:n("ui.settings.configuration.settings_page.description"),value:u.metadata.description||n("ui.settings.configuration.settings_page.no_description_available")})]})})]}),t.jsx(_e,{title:n("ui.settings.appearance.settings_page.appearance"),icon:aa,description:n("ui.settings.appearance.settings_page.customize_the_look_and_feel_of_local_operator"),sectionRef:ee.appearance,dataTourTag:"settings-appearance-section",searchSection:"appearance",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.appearance"),children:t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(em,{}),t.jsx(ia,{searchRow:"appearance.reasoning",value:s,label:n("ui.settings.appearance.settings_page.show_agent_reasoning"),description:n("ui.settings.appearance.settings_page.adds_the_agent_s_reasoning_and_thinking_rows_to_conversations_the"),onChange:async h=>a(h)}),t.jsx(tm,{searchRow:"appearance.transcript",value:Fs(i),onChange:h=>r(h)}),t.jsx(Ld,{searchRow:"appearance.agent-picture-size",value:un(l),onChange:h=>c(h)}),t.jsx(bc,{searchRow:"appearance.glass",state:e.state,onChange:e.set})]})}),t.jsx(qg,{sectionRef:ee.speech}),t.jsx(Sr,{sectionRef:ee.keyboard,focusKey:ve}),t.jsx(_e,{title:n("ui.settings.model.settings_page.model_providers"),icon:qs,description:n("ui.settings.navigation.settings_page.sign_in_to_the_services_your_agents_think_with_new_chats_use_your"),sectionRef:ee.providers,searchSection:"providers",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.model_providers"),id:"model-providers",className:"focus-visible:outline-none!",children:t.jsx(Mr,{initialProviderId:Le,onChangeModel:()=>fe("general")})}),t.jsx(tg,{sessionId:F??void 0,sectionRef:ee.integrations,highlightServer:$e}),t.jsx(_e,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:t.jsx(im,{}),description:n("ui.settings.account.settings_page.your_radient_account_radient_pass_details_and_credits_to_use_radi"),sectionRef:ee.radient,dataTourTag:"settings-radient-account-section",searchSection:"radient",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.radient_account"),searchIgnore:"account, billing and usage are read-only or remote",children:t.jsxs("div",{className:"flex flex-col gap-8",children:[t.jsx(vg,{onAfterCredentialUpdate:()=>{Q(),I()}}),w&&t.jsxs(t.Fragment,{children:[t.jsx(nm,{}),t.jsx(am,{})]})]})}),te&&t.jsx(_e,{title:n("ui.agentMessages.settings.section"),icon:Cr,description:n("ui.agentMessages.settings.description"),sectionRef:ee["agent-messages"],id:"agent-messages",searchSection:"agent-messages",searchSectionLabel:n("ui.agentMessages.settings.section"),searchIgnore:"agent messages is a consent state machine; its registry rows are searchable",className:"border-b border-hairline pb-8",children:G?t.jsx(Rc,{availability:H,status:G,accountId:D,refusal:z.refusal,onRefreshStatus:j,sessions:B,focus:ve===Qt||je?.key===Qt,focusNonce:je?.key===Qt?je.nonce:void 0,onOpenSession:h=>{W.invalidateStatus(),ri(ke,h)}}):z.refusal?t.jsxs(oe,{variant:"warning",children:[t.jsx(Bt,{children:n("ui.agentMessages.settings.error.title")}),t.jsxs(Ie,{children:[z.refusal.code!=="client_unavailable"&&t.jsx("span",{className:"block",children:Dt(z.refusal)}),t.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),t.jsx(L,{className:"mt-3",variant:"secondary",onClick:()=>void j(),children:n("ui.agentMessages.settings.error.retry")})]})]}):t.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[t.jsx(Se,{className:"h-5 w-40"}),t.jsx(Se,{className:"h-4 w-full max-w-xl"})]})}),t.jsx(_e,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:Jn,description:n("ui.settings.navigation.settings_page.every_setting_the_backend_registry_owns_searchable_with_typed_edi"),sectionRef:ee.backend,searchSection:"backend",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.backend_settings"),searchIgnore:"registry rows are searched by the Backend section's own filter",children:t.jsx(sr,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,hideSpeechShortcuts:!0,focusKey:je?je.key:ve&&Lt(ve,"backend")==="backend"?ve:null,focusNonce:je?.nonce,initialFilter:be})}),t.jsx("div",{ref:ee.imports,"data-search-section":"imports","data-search-section-label":n("ui.settings.imports.title"),"data-search-ignore":"imports are a one-off task list, not a setting",children:t.jsx(Id,{})}),t.jsx("div",{ref:ee.updates,"data-search-section":"updates","data-search-section-label":n("ui.settings.navigation.settings_sidebar.application_updates"),"data-search-ignore":"application updates are an action surface, not a setting",children:t.jsx(ld,{})})]})]})})]}):t.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:t.jsx(oe,{variant:"warning",className:"w-full max-w-xl",children:n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded")})})};export{km as SettingsPage};
|