local-operator-ui 0.50.4 → 0.50.5
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 +714 -2
- package/out/preload/index.js +27 -0
- package/out/renderer/assets/{_basePickBy-BIQfMR48.js → _basePickBy-MqnTyq9I.js} +1 -1
- package/out/renderer/assets/{_baseUniq-BgTVzDm4.js → _baseUniq-CzQAUleR.js} +1 -1
- package/out/renderer/assets/{agent-details-page-CK7UCkbX.js → agent-details-page-D2c8rI46.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-CjntTfYQ.js → agent-hub-page-D4sv4tUI.js} +1 -1
- package/out/renderer/assets/{agents-page-C6JEzbLk.js → agents-page-B9C4I1IW.js} +3 -3
- package/out/renderer/assets/{appearance-Cr-wz2XG.js → appearance-A89pzM5N.js} +23 -23
- package/out/renderer/assets/{approvalsOverlay-JbQyo85G.js → approvalsOverlay-CckaSJfb.js} +1 -1
- package/out/renderer/assets/{arc-DlEzSww-.js → arc-BRaroyF-.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-BHqdE7jj.js → architectureDiagram-IEHRJDOE-f9X1UE5j.js} +1 -1
- package/out/renderer/assets/{avatar-cropper-Y_1k15A7.js → avatar-cropper-DADSSOLR.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-Ct_S7g13.js → blockDiagram-JOT3LUYC-aRJrzNKD.js} +1 -1
- package/out/renderer/assets/{book-open--MyFxzqx.js → book-open-CagaYMlx.js} +1 -1
- package/out/renderer/assets/browser-page-C6WYL-Bk.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-D4MzNaMs.js → browser-webauthn-prompt-mUq6rglz.js} +1 -1
- package/out/renderer/assets/{building-2-DtAeE_Wx.js → building-2-D90qekEp.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-0cfxxrV1.js → c4Diagram-VJAJSXHY-1avaFE7r.js} +1 -1
- package/out/renderer/assets/channel-CQpXAX8k.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-DFPtGlqQ.js → chunk-4BMEZGHF-P7K636gL.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-meyStMgl.js → chunk-A2AXSNBT-CfsDhJRl.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BEdPo4ks.js → chunk-AEK57VVT-Kj3Rf5_d.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DcExUv5N.js → chunk-D6G4REZN-xDsjlOUq.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-D97bec7O.js → chunk-RZ5BOZE2-DIF8Lqo2.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-DGjNqQ8a.js → chunk-XZIHB7SX-Br8p73Lh.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-LMx7MKEa.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-LMx7MKEa.js +1 -0
- package/out/renderer/assets/clone-DHGxQKO_.js +1 -0
- package/out/renderer/assets/{console-mirror-D1SJfDTV.js → console-mirror-ByyXT7c6.js} +1 -1
- package/out/renderer/assets/{consoleCapture-BQo7ETQQ.js → consoleCapture-gFuWypOU.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-BDpuF7C6.js → conversation-input-sync-YCivFEkS.js} +271 -261
- package/out/renderer/assets/{dagre-OKDRZEBW-CBaDWFEt.js → dagre-OKDRZEBW-D1w1327z.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-ispcTo5e.js → diagram-SSKATNLV-Do-2Jv4y.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-BDlsgMn-.js → diagram-VNBRO52H-C2lx3QWJ.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-CYPeSaH3.js → erDiagram-Q7BY3M3F-JeUq9Cly.js} +1 -1
- package/out/renderer/assets/error-boundary-BGVlRCw3.js +126 -0
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-CMLsGESL.js → flowDiagram-4HSFHLVR-D3yS_mhp.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-BRVxsCCP.js → ganttDiagram-APWFNJXF-FR4EjLgp.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-DE5og2RV.js → gitGraphDiagram-7IBYFJ6S-CbM3dyah.js} +1 -1
- package/out/renderer/assets/{graph-DDnRFykm.js → graph-BDjQkLDh.js} +1 -1
- package/out/renderer/assets/{heart-CCdYNI3u.js → heart-PNTjqqZS.js} +1 -1
- package/out/renderer/assets/{index-Cpnot8lK.js → index-BCg6JvJu.js} +165 -170
- package/out/renderer/assets/index-Bq7EoBUY.css +1 -0
- package/out/renderer/assets/{index-CiHJ3lYz.js → index-DTPREjNM.js} +1 -1
- package/out/renderer/assets/{index-Fa4fKvzr.js → index-DbC25gXB.js} +1 -1
- package/out/renderer/assets/{index-Bs2AkJmK.js → index-E3-tyr3L.js} +1 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-DQcs6RuX.js +2 -0
- package/out/renderer/assets/{installer-DvzmkQaw.js → installer-CZZyRGmr.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-go9IQj5S.js → journeyDiagram-U35MCT3I-CAMPGTNs.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BHwLNw_X.js → kanban-definition-NDS4AKOZ-Dmbw3PG5.js} +1 -1
- package/out/renderer/assets/{layout-zQcTVlOl.js → layout-FG-5ZqEo.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-BilFWlCA.js → legacy-agents-page-R_JJVZDG.js} +1 -1
- package/out/renderer/assets/{library-page-BCQH7-hs.js → library-page-BojfLTCk.js} +3 -3
- package/out/renderer/assets/{log-in-D60gifZq.js → log-in-D1_csvz-.js} +1 -1
- package/out/renderer/assets/{mermaid.core-DZNLevFz.js → mermaid.core-amA2P2XE.js} +5 -5
- package/out/renderer/assets/{mesh-page-CLeQ-D4w.js → mesh-page-DneLIThd.js} +1 -1
- package/out/renderer/assets/{messages-Be02UCki.js → messages-DpF6u7CO.js} +10 -10
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DrOY-0sS.js → mindmap-definition-ALO5MXBD-BHLtKx4M.js} +1 -1
- package/out/renderer/assets/{mini-Bab6ERe8.js → mini-CuTJw8ye.js} +1 -1
- package/out/renderer/assets/{notebook-pen-DTmLjGHC.js → notebook-pen-CRJd5KOX.js} +1 -1
- package/out/renderer/assets/{notifications-page-BbM3mzCl.js → notifications-page-CHfqkzac.js} +1 -1
- package/out/renderer/assets/{org-access-3xV9NsSd.js → org-access-BzCeyPYV.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-JoOFLPYi.js → org-surface-gate-BegBAEQg.js} +1 -1
- package/out/renderer/assets/{page-header-BBtmeXz0.js → page-header-DoKjJ0FP.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-JyfdH5gn.js → pieDiagram-IB7DONF6-BnsJEqdU.js} +1 -1
- package/out/renderer/assets/{project-markdown-D6HwXefM.js → project-markdown-f3ovh91c.js} +1 -1
- package/out/renderer/assets/{projects-page-D5xBEICx.js → projects-page-CbNI3Jfp.js} +1 -1
- package/out/renderer/assets/{publication-validation-pOLp0dos.js → publication-validation-C6lAhD6Y.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BBtDnoHn.js → quadrantDiagram-7GDLP6J5-C2hX_6X4.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-CtHJCWrJ.js → radar-MK3ICKWK-DjaWx01q.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-DNkhmyBv.js → radient-auth-buttons-Y98w-eOS.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-sB5SDSjY.js → requirementDiagram-KVF5MWMF-KzKRuqkd.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-CGioYe_J.js → sankeyDiagram-QLVOVGJD-Sruwawc3.js} +1 -1
- package/out/renderer/assets/{schedules-page-jothEmnC.js → schedules-page-RCt88EF-.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-CuNhF6i-.js → sequenceDiagram-X6HHIX6F-CL60GXcE.js} +1 -1
- package/out/renderer/assets/settings-page-BziBodsJ.js +301 -0
- package/out/renderer/assets/{smartart-CGZfbyUs.js → smartart-9r6f1ytJ.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-D5ElgpJs.js → stateDiagram-DGXRK772-CkqfOaV8.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-B9kV7FiZ.js +1 -0
- package/out/renderer/assets/{team-bridge-page-4TgWaKxG.js → team-bridge-page-Dptva2gj.js} +2 -2
- package/out/renderer/assets/{team-bridge-scope-preference-D5JQQEFh.js → team-bridge-scope-preference-CKHpt7Ch.js} +1 -1
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-B1vy2fC7.js → timeline-definition-BDJGKUSR-BMtjF9LB.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-CHGnPs7p.js → use-download-agent-mutation-DXsZfEw2.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-BpNsrx-E.js → use-session-snapshot-CXxu0XOr.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-C-K_hlon.js → xychartDiagram-VJFVF3MP-72VXqwJ9.js} +1 -1
- package/out/renderer/browser-approvals-overlay.html +2 -2
- package/out/renderer/console-capture.html +6 -6
- package/out/renderer/index.html +8 -8
- package/out/renderer/installer.html +5 -5
- package/out/renderer/mini.html +8 -8
- package/package.json +1 -1
- package/out/renderer/assets/browser-page-CvQaa7ZF.js +0 -1
- package/out/renderer/assets/channel-BIfd2mO_.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-u2P52chH.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-u2P52chH.js +0 -1
- package/out/renderer/assets/clone-DXgy9Qu9.js +0 -1
- package/out/renderer/assets/error-boundary-iA1OMXPz.js +0 -126
- package/out/renderer/assets/index-B-6m8CCG.css +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-Bdk9rxy6.js +0 -2
- package/out/renderer/assets/settings-page-caFCB3St.js +0 -296
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-61oDVBom.js +0 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import{r as o,j as e,c as pe,f as xt,t as We,i as st}from"./index-E3-tyr3L.js";import{h as Fe,u as bt,at as yr,aq as br,au as vr,av as ot,a as vt,c as _t,aw as kr,a8 as jr,ax as wr,ay as Nr,az as Sr,aA as Cr,d as je,aB as es,aC as Mr,aD as Ar,aE as Er,aF as Rr,E as xe,aG as ts,aH as Ir,aI as Tr,aJ as Lr,aK as Or,aL as ei,aM as Dr,aN as Rt,aO as _n,aP as Mn,aQ as An,aR as Fr,aS as Gs,aT as zr,aU as Pr,aV as Ws,aW as $r,L as ys,aX as Ur,w as Tt,aY as Kr,o as ti,ah as ns,q as ni,K as Br,aZ as Pt,J as De,r as qr,a_ as It,a$ as Hr,b0 as Ys,b1 as Qs,b2 as Vr,b3 as si,a4 as Gr,a5 as Wr}from"./appearance-A89pzM5N.js";import{o as Yr}from"./console-mirror-ByyXT7c6.js";import{e_ as ss,e$ as Qr,f0 as Zs,f1 as tt,cD as Zr,b6 as ai,b7 as bs,aH as ii,bx as Jr,aA as vs,f2 as Xr,f3 as eo,f4 as to,f5 as no,f6 as ri,f7 as ks,b4 as oi,f8 as so,f9 as ao,fa as rn,fb as ci,fc as io,bz as as,fd as Js,fe as ro,ff as pt,fg as lt,c5 as js,fh as ws,cS as on,cg as oo,fi as li,fj as Ns,fk as yn,fl as co,fm as lo,fn as uo,fo as En,fp as Ss,fq as mo,fr as go,aW as di,bB as is,bC as rs,a2 as Cs,aB as os,fs as po,ft as fo,fu as cs,fv as ho,fw as xo,fx as _o,fy as ui,fz as yo,fA as bo,fB as vo,fC as ko,fD as mi,fE as jo,fF as wo,fG as No,fH as So,fI as Nt,fJ as Gt,e9 as Co,fK as ls,fL as Mo,e8 as Ao,fM as Eo,fN as Ro,fO as Io,fP as To,fQ as Lo,fR as Xs,ca as Ms,fS as it,fT as St,fU as Oo,fV as Do,fW as ea,fX as Fo,fY as zo,fZ as Po,f_ as $o,f$ as Uo,g0 as Ko,dv as ft,ev as Bo,dj as gi,dw as qo,b as ta,dk as Ho,dl as As,a1 as pi,bw as Vo,g1 as fi,bA as hi,g2 as xi,g3 as Go,g4 as Wo,g5 as Yo,g6 as Qo,g7 as Zo,g8 as Jo,dS as Xo,b3 as ec,g9 as tc,ga as nc,cc as sc,gb as Ct,gc as na,gd as ac,ge as ic,gf as rc,gg as oc,gh as cc,r as lc,gi as Rn,gj as Wt,gk as dc,gl as uc,gm as mc,gn as gc,go as pc,gp as fc,gq as In,gr as sa,gs as hc,cy as xc,gt as _c,gu as yc,cF as bc,gv as vc,gw as kc,gx as jc,ez as Tn,gy as wc,gz as Nc}from"./conversation-input-sync-YCivFEkS.js";import{dg as _i,dh as Sc,di as Cc,dj as yi,dk as Mc,cf as Ac,dl as Ve,N as Ec,S as bi,bE as qt,bF as Te,dm as $t,dn as Re,dp as Ln,dq as Rc,R as Ic,bj as vi,a as bn,c1 as Tc,bz as Lc,c as Oc,dr as Dc,ds as Fc,cd as zc,dt as Pc,du as Yt,dv as Qt,dw as $c,dx as Uc,bS as Kc,bD as Bc,bP as qc,dy as Hc,dz as Vc,dA as Gc,dB as Wc,bt as aa,dC as Yc,bA as ia,bZ as Qc,bB as Zc,bC as Jc,dD as Xc,dE as el,bs as tl,dF as nl}from"./index-BCg6JvJu.js";import{P as sl}from"./page-header-DoKjJ0FP.js";import{c as X,u as te,B as O,S as Ce,_ as ki,w as Ye,N as Ut,O as Kt,P as ct,A as ge,q as vn,x as Be,f as $e,R as Es,U as Rs,V as Is,W as Ts,Y as ht,L as qe,K as Le,a6 as kn,$ as ji,i as yt,h as ds,af as wi,a as Nn,Z as al,aa as Ni,a7 as il,a8 as rl,a9 as ol,ar as us,r as Si,G as Ci,at as cl,au as ra,T as Ls,D as Os,b as Ds,d as Fs,I as ll,e as nt,av as Mi,aw as dl,X as oa,al as jn,E as Ai,ag as ul,ah as ml,ax as gl,ay as pl,n as cn,o as ln,p as dn,z as un}from"./error-boundary-BGVlRCw3.js";import{t as n,L as On}from"./messages-DpF6u7CO.js";import{u as fl,a as hl,D as xl,b as _l,d as yl,S as bl}from"./team-bridge-scope-preference-CKHpt7Ch.js";import{R as vl}from"./radient-auth-buttons-Y98w-eOS.js";import{u as kl,A as jl,d as wl}from"./avatar-cropper-DADSSOLR.js";import{N as Nl}from"./notebook-pen-CRJd5KOX.js";import{k as mt,p as Ei}from"./roles-D1pcbxAx.js";import{B as Sl}from"./book-open-CagaYMlx.js";import{i as Cl,a as rt,b as Ml,p as Dn,f as Al}from"./parseISO-CxPiCKvF.js";import{t as El}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 Rl=[["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"}]],Il=X("aperture",Rl);/**
|
|
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 Tl=[["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"}]],Ll=X("atom",Tl);/**
|
|
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 Ol=[["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"}]],Dl=X("audio-waveform",Ol);/**
|
|
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 Fl=[["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"}]],zl=X("binary",Fl);/**
|
|
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 Pl=[["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"}]],$l=X("candy",Pl);/**
|
|
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 Ul=[["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"}]],Kl=X("car-front",Ul);/**
|
|
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 Bl=[["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"}]],ql=X("cassette-tape",Bl);/**
|
|
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 Hl=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Vl=X("chart-line",Hl);/**
|
|
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 Gl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],Wl=X("circle-plus",Gl);/**
|
|
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 Yl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],Ql=X("circle-stop",Yl);/**
|
|
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 Zl=[["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"}]],Jl=X("circuit-board",Zl);/**
|
|
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 Xl=[["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"}]],ed=X("cloud-lightning",Xl);/**
|
|
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 td=[["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"}]],nd=X("cloud-moon",td);/**
|
|
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 sd=[["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"}]],ad=X("cloud-snow",sd);/**
|
|
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 id=[["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"}]],rd=X("cloud-sun",id);/**
|
|
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 od=[["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"}]],cd=X("coffee",od);/**
|
|
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 ld=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]],Ri=X("contrast",ld);/**
|
|
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 dd=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],ud=X("credit-card",dd);/**
|
|
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 md=[["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"}]],gd=X("cup-soda",md);/**
|
|
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 pd=[["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"}]],fd=X("disc-3",pd);/**
|
|
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 hd=[["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"}]],xd=X("droplet",hd);/**
|
|
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 _d=[["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"}]],yd=X("droplets",_d);/**
|
|
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 bd=[["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"}]],vd=X("fish",bd);/**
|
|
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 kd=[["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"}]],jd=X("flame",kd);/**
|
|
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 wd=[["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"}]],Nd=X("flower-2",wd);/**
|
|
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 Sd=[["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"}]],Cd=X("flower",Sd);/**
|
|
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 Md=[["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"}]],Ad=X("ghost",Md);/**
|
|
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 Ed=[["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"}]],Rd=X("github",Ed);/**
|
|
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 Id=[["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"}]],Td=X("guitar",Id);/**
|
|
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 Ld=[["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"}]],Od=X("hexagon",Ld);/**
|
|
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 Dd=[["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"}]],Fd=X("ice-cream-bowl",Dd);/**
|
|
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 zd=[["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"}]],Pd=X("joystick",zd);/**
|
|
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 $d=[["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"}]],Ud=X("leaf",$d);/**
|
|
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 Kd=[["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"}]],Bd=X("lightbulb",Kd);/**
|
|
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 qd=[["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"}]],Hd=X("milk",qd);/**
|
|
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 Vd=[["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"}]],Gd=X("moon-star",Vd);/**
|
|
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 Wd=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],Yd=X("moon",Wd);/**
|
|
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 Qd=[["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"}]],Zd=X("mountain-snow",Qd);/**
|
|
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 Jd=[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]],Xd=X("mountain",Jd);/**
|
|
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 eu=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],tu=X("palette",eu);/**
|
|
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 nu=[["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"}]],su=X("radio",nu);/**
|
|
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 au=[["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"}]],iu=X("sailboat",au);/**
|
|
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 ru=[["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"}]],ou=X("shirt",ru);/**
|
|
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 cu=[["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"}]],lu=X("skull",cu);/**
|
|
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 du=[["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"}]],uu=X("snowflake",du);/**
|
|
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 mu=[["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"}]],gu=X("sparkle",mu);/**
|
|
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 pu=[["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"}]],fu=X("sun-dim",pu);/**
|
|
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 hu=[["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"}]],xu=X("sun",hu);/**
|
|
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 _u=[["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"}]],yu=X("sunrise",_u);/**
|
|
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 bu=[["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"}]],vu=X("sunset",bu);/**
|
|
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 ku=[["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"}]],ju=X("tent",ku);/**
|
|
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 wu=[["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"}]],Nu=X("tree-deciduous",wu);/**
|
|
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 Su=[["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"}]],Cu=X("tree-palm",Su);/**
|
|
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 Mu=[["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"}]],Au=X("tree-pine",Mu);/**
|
|
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 Eu=[["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"}]],Ru=X("trees",Eu);/**
|
|
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 Iu=[["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"}]],Tu=X("umbrella",Iu);/**
|
|
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 Lu=[["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"}]],Ou=X("waves",Lu);/**
|
|
287
|
+
* @license lucide-react v0.507.0 - ISC
|
|
288
|
+
*
|
|
289
|
+
* This source code is licensed under the ISC license.
|
|
290
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
291
|
+
*/const Du=[["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"}]],Fu=X("wheat",Du);/**
|
|
292
|
+
* @license lucide-react v0.507.0 - ISC
|
|
293
|
+
*
|
|
294
|
+
* This source code is licensed under the ISC license.
|
|
295
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
296
|
+
*/const zu=[["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"}]],Pu=X("wind",zu),$u=({appVersion:t=null,slowWaitHintMs:s})=>{te();const a="https://local-operator.com/download",[i,r]=o.useState(!1),c=_i(i,s??Sc),[l,d]=o.useState(!1),[u,m]=o.useState(null),[p,g]=o.useState("info"),[f,x]=o.useState(null),[j,y]=o.useState(null),N=t?.trim()?t.trim():null,M=o.useRef(!1),E=ss(F=>F.openDetail),T=o.useRef(!1),R=o.useRef(0),D=o.useRef(!1),b=o.useCallback((F,w)=>{T.current=!1,m(F),g(w),d(!0)},[]),z=o.useCallback(F=>{T.current=!0,m(F),g("success"),d(!0)},[]),B=o.useCallback(()=>{T.current&&(T.current=!1,d(!1),m(null))},[]),{clearDeferredUpdate:K}=Qr();o.useEffect(()=>{const F=window.api.updater.onUpdateError(_=>{M.current&&_.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:""}),T.current=!1,m(null),g("warning"),d(!0))}),w=window.api.updater.onBackendUpdateDevMode(_=>{M.current&&b(_,"info")}),G=()=>{D.current=!0,B()},P=window.api.updater.onUpdateAvailable(G),V=window.api.updater.onUpdateNpxAvailable(G),Z=window.api.updater.onBackendUpdateAvailable(G);return()=>{F(),w(),P(),V(),Z()}},[B,b]),o.useEffect(()=>{let F=!1;const w=()=>{window.api.updater.getLastInstallAttempt().then(P=>{F||y(P)}).catch(()=>{})};w();const G=window.api.updater.onUpdateInstallFailed(()=>w());return()=>{F=!0,G()}},[]);const h=async()=>{const F=++R.current;B(),D.current=!1;try{r(!0),M.current=!0,K(tt.UI),K(tt.BACKEND);const w=await window.api.updater.checkForAllUpdates({manual:!0});if(F!==R.current)return;w.app==="available"&&E(tt.UI),w.server==="available"&&E(tt.BACKEND),w?.affirmation&&!D.current?z(w.affirmation):B()}catch(w){if(F!==R.current)return;console.warn(`Update check failed; the app-level alert owns the report: ${Cc(w)}`)}finally{F===R.current&&r(!1),setTimeout(()=>{M.current=!1},2e3)}},L=()=>{T.current=!1,d(!1),m(null)};return e.jsxs(e.Fragment,{children:[j&&e.jsxs("div",{className:"mb-3 rounded-sm bg-sunken p-3",children:[e.jsxs("p",{className:"text-body-sm text-ink",children:[n("ui.common.updates.check_for_updates_button.the_last_update_to_version"),j.targetVersion," ",n("ui.common.updates.check_for_updates_button.didn_t_finish"),j.attempts>1?n("ui.common.updates.check_for_updates_button.detail",{attempts:j.attempts,attemptsText:String(j.attempts)}):"",".",N?n("ui.common.updates.check_for_updates_button.version",{liveversion:String(N)}):null]}),e.jsxs("p",{className:"mt-1 text-meta text-ink-dim",children:[n("ui.common.updates.check_for_updates_button.detected")," ",j.detectedAt?new Date(j.detectedAt).toLocaleString():n("ui.common.updates.check_for_updates_button.at_an_unknown_time"),". ",j.detail]}),e.jsx(O,{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")})]}),e.jsxs(O,{variant:"outline",onClick:()=>void h(),disabled:i,children:[i?e.jsx(Ce,{size:"sm"}):null,i?n("ui.common.updates.check_for_updates_button.checking"):n("ui.common.updates.check_for_updates_button.check_for_updates")]}),c&&e.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")}),f&&e.jsxs(Zs,{open:l,autoHideDuration:1e4,onClose:L,variant:"warning",children:[e.jsx("p",{className:"text-body-sm",children:f.message}),f.command&&e.jsx("code",{className:"mt-2 block rounded-sm bg-sunken p-2 text-mono-sm text-ink",children:f.command})]}),u&&p!=="danger"&&e.jsx(Zs,{open:l,autoHideDuration:6e3,onClose:L,variant:p,children:u})]})},mn=["system-prompt"],Uu=()=>{const{shouldEnableQuery:t}=Zr();return Fe({enabled:t({bypassInternetCheck:!0}),queryKey:mn,queryFn:async()=>{try{const a=await ai(bs.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 ii(a),s}},refetchOnWindowFocus:!1,staleTime:5e3})},Ku=()=>{const t=bt(),s=ai(bs.baseUrl);return Jr({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 ii(r),i}},onSuccess:async a=>{await t.invalidateQueries({queryKey:mn,refetchType:"none"}),t.setQueryData(mn,i=>i&&{...i,...a}),await t.refetchQueries({queryKey:mn,type:"all"}),vs(n("ui.notices.settings.system_prompt_updated"))},onError:a=>{console.error("Error updating system prompt:",a)}})},Lt=({searchRow:t,searchTerms:s,value:a,label:i,description:r,onChange:c,icon:l,isSaving:d=!1,disabled:u=!1,savingInPlace:m=!1})=>{te();const[p,g]=o.useState(a),f=o.useRef(0),[x,j]=o.useState(0);o.useEffect(()=>{m&&f.current>0||g(a)},[a,m,x]);const y=o.useId(),N=`${y}-label`,M=`${y}-description`,E=async T=>{if(!(d&&!m||u)){if(g(T),m){f.current+=1;try{await c(T)}catch(R){console.error("Error toggling setting:",R)}finally{f.current-=1,f.current===0&&j(R=>R+1)}return}try{await c(T)}catch(R){g(!T),console.error("Error toggling setting:",R)}}};return e.jsxs("div",{"data-search-row":t,"data-search-terms":t?s:void 0,"data-search-control":t?"":void 0,className:"flex items-start justify-between gap-4","aria-busy":m&&d?!0:void 0,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("span",{id:N,"data-search-label":"",className:"flex min-h-6 items-center gap-2 text-body text-ink",children:[l&&e.jsx(l,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}),i]}),r&&e.jsx("p",{id:M,className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:r})]}),e.jsxs("div",{className:"flex h-6 shrink-0 items-center gap-2",children:[m&&d&&e.jsx(Ce,{size:"xs",label:n("ui.common.forms.toggle_setting.saving",{label:i})}),d&&!m?e.jsx(Ce,{size:"md",label:n("ui.common.forms.toggle_setting.saving",{label:i})}):e.jsx(ki,{checked:p,onCheckedChange:E,disabled:u,"aria-labelledby":N,"aria-describedby":r?M:void 0})]})]})};function ca(t,s){const a=El(t,s?.in);if(!Cl(a))throw new RangeError("Invalid time value");const i=rt(a.getDate(),2),r=rt(a.getMonth()+1,2),c=a.getFullYear(),l=rt(a.getHours(),2),d=rt(a.getMinutes(),2),u=rt(a.getSeconds(),2);let m="",p="";const g=a.getTimezoneOffset();if(g!==0){const f=Math.abs(g),x=rt(Math.trunc(f/60),2),j=rt(f%60,2);p=`${g<0?"+":"-"}${x}:${j}`}else p="Z";return`${c}-${r}-${i}T${l}:${d}:${u}${m}${p}`}function Bu(t,s,a){return Ml(t,-30,a)}var qu=Xr({chartName:"LineChart",GraphicalChild:ri,axisComponents:[{axisType:"xAxis",AxisComp:eo},{axisType:"yAxis",AxisComp:to}],formatAxisMap:no});const Hu=["radient","creditBalance"],Vu=t=>{const{user:s,isAuthenticated:a}=ks(),i=s?.account?.tenant_id,r=a&&!!i&&t?.enabled;return Fe({queryKey:[Hu,i],queryFn:async()=>{if(!i)throw new Error(n("ui.common.errors.tenant_missing"));const c=await oi({operation:"credits",tenantId:i});if(!c||typeof c.balance!="number")throw new Error(n("ui.common.errors.credit_balance_invalid"));return c},enabled:r,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},Gu=["radient","usageRollup"],Wu=(t,s)=>{const{user:a,isAuthenticated:i}=ks(),r=a?.account?.tenant_id,c=i&&!!r&&s?.enabled;return Fe({queryKey:[...Gu,r,t],queryFn:async()=>{if(!r)throw new Error(n("ui.common.errors.tenant_missing"));const l={};for(const[u,m]of Object.entries(t))m!=null&&(l[u]=String(m));const d=await oi({operation:"usage",tenantId:r,query:l});if(!d)throw new Error(n("ui.common.errors.usage_rollup_invalid"));return d},enabled:c,staleTime:5*60*1e3,refetchOnWindowFocus:!0})},Yu=t=>t==="sidebars"?n("ui.settings.appearance.window_glass.coverage_sidebars"):n("ui.settings.appearance.window_glass.coverage_full"),Qu=t=>{switch(t){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")}},Zu=t=>{switch(t){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")}},la=({label:t,description:s,value:a,onValueChange:i,options:r})=>{const c=o.useId();return e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{id:c,className:"flex min-h-6 items-center text-body text-ink",children:t}),e.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:s})]}),e.jsx("div",{className:"flex h-6 shrink-0 items-center",children:e.jsx(Ut,{value:a,onValueChange:i,children:e.jsx(Kt,{"aria-labelledby":c,children:r.map(l=>e.jsx(ct,{value:l.value,children:l.label},l.value))})})})]})},Ju=({state:t,onChange:s,searchRow:a})=>{te();const i=o.useId(),r=`${i}-description`,[c,l]=o.useState(null),d=o.useRef(!1),u=o.useRef(null),m=t?.settings.intensity??0;if(!t)return null;const p=!t.capability.supported,g=p?Zu(t.capability.reason):null,f=async y=>{if(d.current){u.current=y;return}d.current=!0;try{await s({intensity:y})}finally{d.current=!1;const N=u.current;u.current=null,N!==null&&N!==y?f(N):l(null)}},x=t.settings.enabled,j=c??m;return e.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex flex-col gap-4","data-window-glass":"","data-glass-gate":t.capability.reason,children:[e.jsx(Ye,{content:g,disabled:!p,children:e.jsx("div",{className:p?"opacity-60":void 0,children:e.jsx(Lt,{value:p?!1:x,disabled:p,label:n("ui.settings.appearance.window_glass.label"),description:n("ui.settings.appearance.window_glass.description"),onChange:async y=>s({enabled:y})},p?"unavailable":"available")})}),g&&e.jsx("p",{"data-glass-unsupported":t.capability.reason,className:"max-w-2xl text-body-sm text-ink-muted",children:g}),t.restartRequired&&e.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&&e.jsxs(e.Fragment,{children:[e.jsx(la,{label:n("ui.settings.appearance.window_glass.coverage_label"),description:n("ui.settings.appearance.window_glass.coverage_description"),value:t.settings.coverage,onValueChange:y=>void s({coverage:y}),options:so.map(y=>({value:y,label:Yu(y)}))}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex min-h-6 items-center justify-between gap-3",children:[e.jsx("label",{htmlFor:i,className:"text-body text-ink",children:n("ui.settings.appearance.window_glass.intensity_label")}),e.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(j)})})]}),e.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")}),e.jsx("input",{id:i,type:"range",min:0,max:100,step:5,value:j,"aria-describedby":r,"aria-valuetext":n("ui.settings.appearance.window_glass.intensity_value",{value:String(j)}),onChange:y=>{const N=Number(y.target.value);l(N),f(N)},style:{"--fill":`${j}%`},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"}),e.jsxs("div",{"aria-hidden":"true",className:"mt-1 flex justify-between text-meta text-ink-dim",children:[e.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_start")}),e.jsx("span",{children:n("ui.settings.appearance.window_glass.intensity_end")})]})]}),e.jsx(la,{label:n("ui.settings.appearance.window_glass.material_label"),description:n("ui.settings.appearance.window_glass.material_description"),value:t.settings.material,onValueChange:y=>void s({material:y}),options:t.capability.materials.map(y=>({value:y,label:Qu(y)}))})]})]})},Xu=new Set(["B","C","D","E","F"]);function em(t){const{status:s,refused:a,everVisible:i,checking:r=!1}=t;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&&Xu.has(s.surface_state)?"visible":"absent":r&&i?"visible":a&&i?"error":"absent"}function tm(t,s){return t!=="absent"}function Mt(t,s){if(t.surface_state==="F")return"F";const a=s.endpoint;return a?a.state==="paused"?"D":a.state==="disabled"?"E":"C":"B"}const nm="open_chief_of_staff";function sm(t){const s=t?.delivery_hold;if(!s||s.code!==nm||s.count<=0)return null;const a=s.session||t?.local.session||null;return{count:s.count,sessionId:a}}function Ii(t){return yr(t)}function am(t){return t.target.endpoint_id?{kind:"endpoint",id:t.target.endpoint_id}:{kind:"account",id:t.target.account_id??""}}function ms(t){return t.map((s,a)=>{const i=am(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 gs(t,s){return t.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 Ti(t){return JSON.stringify(t)}function im(t){return t.saving?{disabled:!0,reason:"saving"}:["send","receive"].some(i=>t.modes[i]==="listed_only"&&!t.entries.some(r=>r.direction===i&&r.effect==="allow"))?{disabled:!0,reason:"needs_entry"}:Ti(gs(t.entries,t.modes))===t.savedSignature?{disabled:!0,reason:"unchanged"}:{disabled:!1}}const rm=/^[^\s\p{Cc}]{1,128}$/u;function om(t){return t===""?n("ui.agentMessages.settings.allowlist.identifier_empty"):t.length>128?n("ui.agentMessages.settings.allowlist.identifier_long"):rm.test(t)?null:n("ui.agentMessages.settings.allowlist.identifier_invalid")}function gn(t){switch(t.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 t.message||n("ui.agentMessages.settings.refusal.generic")}}const cm=['[data-agent-messages-action="turn_on_again"]','[role="switch"]','[data-agent-messages-action="enable"]'],Fn="__none__";function lm({availability:t,status:s,accountId:a,refusal:i=null,api:r=Ac,onRefreshStatus:c,sessions:l=[],onOpenSession:d,focus:u=!1,focusNonce:m}){te();const[p,g]=o.useState({kind:"loading"}),[f,x]=o.useState(0),[j,y]=o.useState(null),[N,M]=o.useState(null),[E,T]=o.useState(s?.local.enabled??!1),[R,D]=o.useState(s?.local.session??""),b=s?.tenant_id??void 0,z=t==="visible",B=s?.account_id??null,K=B!==null&&B===a;o.useEffect(()=>{if(!z)return;let _=!1;return g({kind:"loading"}),M(null),(async()=>{try{const I=await r.settings(b);if(_)return;if(!I){g({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}let S=null;if(I.endpoint){if(S=await r.allowlist(I.settings.tenant_id),_)return;if(!S){g({kind:"error",refusal:{code:"invalid_response",message:n("ui.agentMessages.settings.error.unreadable")}});return}}g({kind:"ready",settings:I,allowlist:S})}catch(I){if(_)return;g({kind:"error",refusal:Ve(I)})}})(),()=>{_=!0}},[z,a,B,b,f,r]),o.useEffect(()=>{if(!z||p.kind!=="ready"||!p.settings.endpoint||p.allowlist)return;let _=!1;return(async()=>{try{const I=await r.allowlist(p.settings.settings.tenant_id);if(_||!I)return;g(S=>S.kind==="ready"&&!S.allowlist?{...S,allowlist:I}:S)}catch(I){_||M(Ve(I))}})(),()=>{_=!0}},[z,p,r]),o.useEffect(()=>{s&&(T(s.local.enabled),D(s.local.session))},[s]);const h=()=>x(_=>_+1),L=p.kind==="ready"?p.settings:null,F=fl(s,L,B),w=hl({api:r,accountId:K?B:null,tenantId:L?.settings.tenant_id??null,markerTenantId:s?.tenant_id??null,onSettings:_=>g(I=>I.kind==="ready"?{...I,settings:_}:I),onChanged:()=>c(!0)}),G=o.useRef(null),P=o.useRef(!1),V=o.useRef(m);if(o.useEffect(()=>{m!==V.current&&(V.current=m,P.current=!1)},[m]),o.useEffect(()=>{if(!u){P.current=!1;return}if(P.current||p.kind!=="ready"||j!==null)return;const _=G.current,I=cm.map(S=>_?.querySelector(`${S}:not(:disabled)`)).find(S=>S!=null);I&&(I.focus(),P.current=!0)},[u,m,p,j,s]),t==="absent")return null;if(t==="dark")return e.jsxs("div",{"data-agent-messages-section":"",className:"flex flex-col gap-2",children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.dark.title")}),e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.body")}),e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.dark.nothing_enabled")})]});if(t==="error")return e.jsx("div",{"data-agent-messages-section":"",children:e.jsxs(ge,{variant:"warning",children:[e.jsx(vn,{children:n("ui.agentMessages.settings.error.title")}),e.jsxs(Be,{children:[i?gn(i):n("ui.agentMessages.settings.refusal.generic"),e.jsx(O,{className:"mt-3",variant:"secondary",onClick:()=>{h(),c(!0)},children:n("ui.agentMessages.settings.error.retry")})]})]})});if(!s||!a)return null;const Z=sm(s);return e.jsxs("div",{ref:G,"data-agent-messages-section":"",className:"flex flex-col gap-6",children:[Z&&e.jsx(um,{count:Z.count,onMessage:Z.sessionId&&d?()=>d(Z.sessionId):void 0}),F&&e.jsx(xl,{consentText:br(s,L),pending:w.pending,failure:w.failure,onTurnOff:()=>void w.turnOff(),onDismiss:()=>void w.dismiss()}),N&&e.jsx(ge,{variant:"warning",children:e.jsx(Be,{children:gn(N)})}),p.kind==="loading"&&e.jsx(dm,{}),p.kind==="error"&&e.jsxs(ge,{variant:"warning",children:[e.jsx(vn,{children:n("ui.agentMessages.settings.error.title")}),e.jsxs(Be,{children:[p.refusal.code!=="client_unavailable"&&e.jsx("span",{className:"block",children:gn(p.refusal)}),e.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),e.jsx(O,{className:"mt-3",variant:"secondary",onClick:h,children:n("ui.agentMessages.settings.error.retry")})]})]}),p.kind==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx(pm,{state:Mt(s,p.settings),status:s,settings:p.settings,accountId:B??a,accountMatches:K,api:r,pending:j,localEnabled:E,onActionRefusal:M,onSettings:_=>g(I=>I.kind==="ready"?{...I,settings:_}:I),onLocalEnabled:T,onRefreshStatus:c,setPending:y}),e.jsx(hm,{value:R,sessions:l,pending:j==="session",disabled:j!==null,onSave:async _=>{y("session"),M(null);try{await r.localSetting("team_bridge.session",_),D(_),await c(!0)}catch(I){M(Ve(I))}finally{y(null)}}}),p.allowlist&&(Mt(s,p.settings)==="C"||Mt(s,p.settings)==="D"||Mt(s,p.settings)==="F")&&e.jsx(xm,{allowlist:p.allowlist,accountId:B??a,accountMatches:K,readOnly:s.read_only===!0&&Mt(s,p.settings)==="F",pending:j!==null,onSaving:_=>y(_?"allowlist":null),onRefusal:M,onSaved:_=>g(I=>I.kind==="ready"?{...I,allowlist:_}:I),api:r},p.allowlist.view.tenant_id??"tenant")]})]})}function dm(){return e.jsxs("div",{className:"flex flex-col gap-3","aria-busy":"true",children:[e.jsx($e,{className:"h-5 w-40"}),e.jsx($e,{className:"h-4 w-full max-w-xl"}),e.jsx($e,{className:"h-9 w-36"}),e.jsx($e,{className:"h-4 w-64"})]})}const um=({count:t,onMessage:s})=>e.jsx("output",{className:"block","data-agent-messages-hold":"open_chief_of_staff",children:e.jsx(ge,{variant:"info",className:pe(Ec,"border-transparent"),children:e.jsxs("div",{className:"flex w-full min-w-0 items-center gap-3",children:[e.jsx("p",{className:"min-w-0 flex-1 text-body-sm text-ink",children:s?n("ui.agentMessages.settings.hold.chief_of_staff",{count:t}):n("ui.agentMessages.settings.hold.chief_of_staff_unlinked",{count:t})}),s&&e.jsx(O,{variant:"ghost",size:"sm",className:"shrink-0 text-ink",onClick:s,children:n("ui.agentMessages.settings.hold.open")})]})})}),da=({text:t})=>e.jsx("div",{className:"rounded-md border border-hairline bg-sunken p-3",children:e.jsx("p",{className:"whitespace-pre-wrap text-body-sm text-ink-muted",children:t})}),Li={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"},Oi={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 mm(t){return t==="B"?"ui.agentMessages.settings.default_on.b_title":Li[t]}function gm(t){return t==="B"?"ui.agentMessages.settings.default_on.b_body":t==="E"?"ui.agentMessages.settings.default_on.e_body":Oi[t]}const pm=({state:t,status:s,settings:a,accountId:i,accountMatches:r,api:c,pending:l,localEnabled:d,onActionRefusal:u,onSettings:m,onLocalEnabled:p,onRefreshStatus:g,setPending:f})=>{const x=Ii(s),j=a.settings.tenant_id,y=l!==null||!r,N=vr(s);async function M(b,z={}){if(!r)return null;f(b),u(null);try{const B=await c.updateSettings({expected_account_id:i,tenant_id:j,state:b,...z});if(m(B),b==="disabled"&&!N)try{await c.localSetting("team_bridge.enabled",!1),p(!1)}catch(K){u(Ve(K))}return B}catch(B){const K=Ve(B);return u(K),K.code==="consent_version_unknown"&&await g(!0),null}finally{f(null)}}async function E(){if(!(!x||!r||!await M("active",{consent_version:x.version,consented_via:"settings"}))){f("local");try{await c.localSetting("team_bridge.enabled",!0),p(!0),await g(!0)}catch(z){u(Ve(z))}finally{f(null)}}}if(t==="F")return e.jsxs("div",{"data-agent-messages-state":t,className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"rounded-md border border-hairline bg-sunken p-3",children:[e.jsx("p",{className:"text-body-sm text-ink",children:s.state_note?.trim()?s.state_note:n("ui.agentMessages.settings.state.turned_off_title")}),e.jsx("p",{className:"mt-1 text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.turned_off_org")})]}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.state.read_only")}),e.jsx(zn,{settings:a,status:s,readOnly:!0}),e.jsx(Pn,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:d,disabled:y,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async b=>{f("local"),u(null);try{await c.localSetting("team_bridge.enabled",b),p(b),await g(!0)}catch(z){u(Ve(z))}finally{f(null)}}})]});const T=a.endpoint?.label?.trim(),R=a.endpoint?.consent??null,D=R!==null&&!R.current;return e.jsxs("div",{"data-agent-messages-state":t,className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"text-heading text-ink",children:n(N?mm(t):Li[t])}),T&&e.jsx("span",{className:"text-body-sm text-ink-muted",children:T})]}),e.jsx("p",{className:"max-w-2xl text-body-sm text-ink-muted",children:n(N?gm(t):Oi[t])}),N&&t==="E"&&e.jsxs("div",{className:"flex flex-col gap-3",children:[x?e.jsx(da,{text:x.text}):e.jsx(ge,{variant:"warning",children:e.jsx(Be,{children:n("ui.agentMessages.settings.consent.unavailable")})}),e.jsx("div",{className:"flex flex-wrap items-center gap-3",children:e.jsx(O,{"data-agent-messages-action":"turn_on_again","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void E(),disabled:y||!x,children:n("ui.agentMessages.settings.action.turn_on_again")})})]}),!N&&(t==="B"||t==="E")&&e.jsxs("div",{className:"flex flex-col gap-3",children:[x?e.jsx(da,{text:x.text}):e.jsx(ge,{variant:"warning",children:e.jsx(Be,{children:n("ui.agentMessages.settings.consent.unavailable")})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx(O,{"data-agent-messages-action":"enable","data-search-row":"agent-messages.enabled","data-search-control":!0,onClick:()=>void E(),disabled:y||!x,children:t==="B"?n("ui.agentMessages.settings.action.enable"):n("ui.agentMessages.settings.action.enable_again")}),e.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.off_by_default")})]})]}),t==="C"&&a.endpoint&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(O,{"data-agent-messages-action":"pause",variant:"secondary",disabled:y,onClick:()=>void M("paused"),children:n("ui.agentMessages.settings.action.pause")}),e.jsx(O,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:y,onClick:()=>void M("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),e.jsx(zn,{settings:a,status:s}),D&&!N&&e.jsx(ua,{onRenew:()=>void E(),disabled:y||!x}),e.jsx(Pn,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:d,disabled:y,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async b=>{f("local"),u(null);try{await c.localSetting("team_bridge.enabled",b),p(b),await g(!0)}catch(z){u(Ve(z))}finally{f(null)}}})]}),t==="D"&&a.endpoint&&e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(O,{"data-agent-messages-action":"resume",disabled:y||a.settings.consent_required&&x===null,onClick:()=>void M("active",a.settings.consent_required&&x?{consent_version:x.version,consented_via:"settings"}:{}),children:n("ui.agentMessages.settings.action.resume")}),e.jsx(O,{"data-agent-messages-action":"turn_off",variant:"secondary",disabled:y,onClick:()=>void M("disabled"),children:n("ui.agentMessages.settings.action.turn_off")})]}),a.settings.consent_required&&!x&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.unavailable")}),e.jsx(zn,{settings:a,status:s}),D&&!N&&e.jsx(ua,{onRenew:()=>void E(),disabled:y||!x}),e.jsx(Pn,{searchRow:"agent-messages.enabled",searchTerms:"team bridge team_bridge enabled devices",value:d,disabled:y,description:n("ui.agentMessages.settings.local.stays_enrolled"),onChange:async b=>{f("local"),u(null);try{await c.localSetting("team_bridge.enabled",b),p(b),await g(!0)}catch(z){u(Ve(z))}finally{f(null)}}})]})]})},ua=({onRenew:t,disabled:s})=>e.jsx(ge,{variant:"warning",children:e.jsxs(Be,{children:[n("ui.agentMessages.settings.consent.renew"),e.jsx(O,{"data-agent-messages-action":"enable",className:"mt-3",variant:"secondary",disabled:s,onClick:t,children:n("ui.agentMessages.settings.action.enable_again")})]})});function fm(t){switch(t){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 t}}const zn=({settings:t,status:s,readOnly:a=!1})=>{const i=t.endpoint?.consent??null,r=Ii(s);return i?e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs(qt,{children:[e.jsx(Te,{label:n("ui.agentMessages.settings.consent.version"),value:i.version}),e.jsx(Te,{label:n("ui.agentMessages.settings.consent.via"),value:fm(i.consented_via)}),e.jsx(Te,{label:n("ui.agentMessages.settings.consent.at"),value:i.consented_at})]}),!a&&r&&e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.show")}),e.jsx("p",{className:"mt-2 whitespace-pre-wrap text-body-sm text-ink-muted",children:r.text})]})]}):e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.consent.no_record")})},Pn=({value:t,disabled:s,description:a,onChange:i,searchRow:r,searchTerms:c})=>{const l=o.useId();return e.jsxs("div",{"data-search-row":r,"data-search-control":r?"":void 0,"data-search-terms":c,className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{id:l,className:"text-body-sm text-ink",children:n("ui.agentMessages.settings.local.label")}),e.jsx("p",{className:"mt-0.5 text-meta text-ink-dim",children:a})]}),e.jsx(ki,{"aria-labelledby":l,checked:t,disabled:s,onCheckedChange:d=>void i(d)})]})},hm=({value:t,sessions:s,pending:a,disabled:i,onSave:r})=>{const c=s.some(l=>l.session_id===t);return e.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:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.session.title")}),e.jsx("p",{className:"max-w-2xl text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.help")}),e.jsxs(Es,{value:t===""?Fn:t,disabled:i,onValueChange:l=>void r(l===Fn?"":l),children:[e.jsx(Rs,{className:"w-full max-w-md","aria-label":n("ui.agentMessages.settings.session.title"),children:e.jsx(Is,{})}),e.jsxs(Ts,{children:[e.jsx(ht,{value:Fn,children:n("ui.agentMessages.settings.session.none")}),s.map(l=>e.jsx(ht,{value:l.session_id,children:l.title?.trim()||l.session_id},l.session_id)),t!==""&&!c&&e.jsx(ht,{value:t,children:t})]})]}),t!==""&&!c&&e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.session.unavailable")}),a&&e.jsx("p",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})},xm=({allowlist:t,accountId:s,accountMatches:a,readOnly:i,pending:r,api:c,onSaving:l,onRefusal:d,onSaved:u})=>{const[m,p]=o.useState(()=>ms(t.allowlist.entries)),[g,f]=o.useState(()=>({send:t.view.directions.send.mode,receive:t.view.directions.receive.mode})),x=r||i||!a,j=Ti(gs(_m(t),ym(t))),y=im({entries:m,modes:g,savedSignature:j,saving:r}),N=o.useRef(0),M=R=>p(D=>[...D,{...R,key:`${R.direction}:${R.effect}:${N.current++}`}]),E=R=>p(D=>D.filter(b=>b.key!==R)),T=async()=>{if(!x){l(!0),d(null);try{const R=await c.updateAllowlist({expected_account_id:s,tenant_id:t.allowlist.tenant_id,entries:gs(m,g)}),D=ms(R.allowlist.entries);p(D),f({send:R.view.directions.send.mode,receive:R.view.directions.receive.mode}),u(R)}catch(R){d(Ve(R))}finally{l(!1)}}};return e.jsxs("div",{"data-agent-messages-allowlist":"",className:"flex flex-col gap-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.agentMessages.settings.allowlist.title")}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.description")})]}),e.jsx(ma,{direction:"receive",title:n("ui.agentMessages.settings.allowlist.receive"),mode:g.receive,cues:t.view.cues,entries:m.filter(R=>R.direction==="receive"),disabled:x,onMode:R=>f(D=>({...D,receive:R})),onAdd:R=>M({...R,direction:"receive"}),onRemove:E}),e.jsx(ma,{direction:"send",title:n("ui.agentMessages.settings.allowlist.send"),mode:g.send,cues:t.view.cues,entries:m.filter(R=>R.direction==="send"),disabled:x,onMode:R=>f(D=>({...D,send:R})),onAdd:R=>M({...R,direction:"send"}),onRemove:E}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(O,{onClick:()=>void T(),disabled:y.disabled||x,children:[e.jsx(bi,{size:14}),n("ui.agentMessages.settings.allowlist.save")]}),y.disabled&&y.reason==="needs_entry"&&e.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.needs_entry")}),y.disabled&&y.reason==="unchanged"&&e.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.unchanged")}),i&&e.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.read_only")}),r&&e.jsx("span",{className:"text-meta text-ink-dim","aria-live":"polite",children:n("ui.agentMessages.settings.saving")})]})]})};function _m(t){return ms(t.allowlist.entries)}function ym(t){return{send:t.view.directions.send.mode,receive:t.view.directions.receive.mode}}const ma=({direction:t,title:s,mode:a,cues:i,entries:r,disabled:c,onMode:l,onAdd:d,onRemove:u})=>{const m=r.filter(g=>g.effect==="allow"),p=r.filter(g=>g.effect==="deny");return e.jsxs("fieldset",{"data-agent-messages-direction":t,"data-agent-messages-level":a,className:"flex flex-col gap-3 rounded-md border border-hairline p-3",children:[e.jsx("legend",{className:"px-1 text-body-sm text-ink",children:s}),e.jsx(bm,{mode:a,disabled:c,onMode:l}),e.jsxs("div",{className:"flex flex-col gap-1 text-meta text-ink-dim",children:[i.allow_entry_switches_direction_to_listed_only&&e.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_listed_only")}),i.removing_allow_does_not_stop_open_thread&&e.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_remove")}),i.deny_stops_pair_both_directions&&e.jsx("p",{children:n("ui.agentMessages.settings.allowlist.cue_deny")})]}),a==="listed_only"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.allowed_heading")}),m.length===0&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.allowed_empty")}),m.map(g=>e.jsx(ga,{entry:g,disabled:c,onRemove:()=>u(g.key)},g.key)),e.jsx(pa,{label:n("ui.agentMessages.settings.allowlist.add_allowed"),disabled:c,onAdd:g=>d({...g,effect:"allow"})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.agentMessages.settings.allowlist.blocked_heading")}),p.length===0&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.agentMessages.settings.allowlist.blocked_empty")}),p.map(g=>e.jsx(ga,{entry:g,disabled:c,onRemove:()=>u(g.key)},g.key)),e.jsx(pa,{label:n("ui.agentMessages.settings.allowlist.add_blocked"),disabled:c,onAdd:g=>d({...g,effect:"deny"})})]})]})},bm=({mode:t,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 e.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[e.jsx("legend",{className:"sr-only",children:n("ui.agentMessages.settings.allowlist.level")}),e.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:i.map(r=>e.jsx(O,{variant:"ghost",size:"sm","aria-pressed":t===r.value,disabled:s,onClick:()=>a(r.value),className:pe(t===r.value&&"bg-surface text-ink hover:bg-surface"),children:r.label},r.value))})]})},ga=({entry:t,disabled:s,onRemove:a})=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded border border-hairline px-2 py-1",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:t.kind==="endpoint"?n("ui.agentMessages.settings.allowlist.agent_id"):n("ui.agentMessages.settings.allowlist.person_id")}),e.jsx("span",{className:"break-all font-mono text-body-sm text-ink",children:t.id})]}),e.jsx(O,{variant:"secondary",size:"sm",disabled:s,"aria-label":`${n("ui.agentMessages.settings.allowlist.remove")} ${t.id}`,onClick:a,children:n("ui.agentMessages.settings.allowlist.remove")})]}),pa=({label:t,disabled:s,onAdd:a})=>{const[i,r]=o.useState("endpoint"),[c,l]=o.useState(""),[d,u]=o.useState(null),m=o.useId(),p=`${m}-help`,g=()=>{const f=om(c.trim());u(f),!f&&(a({kind:i,id:c.trim()}),l(""))};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(qe,{htmlFor:m,children:t}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(Es,{value:i,disabled:s,onValueChange:f=>r(f),children:[e.jsx(Rs,{className:"w-32","aria-label":n("ui.agentMessages.settings.allowlist.kind"),children:e.jsx(Is,{})}),e.jsxs(Ts,{children:[e.jsx(ht,{value:"endpoint",children:n("ui.agentMessages.settings.allowlist.kind_agent")}),e.jsx(ht,{value:"account",children:n("ui.agentMessages.settings.allowlist.kind_person")})]})]}),e.jsx(Le,{id:m,"aria-describedby":p,className:"max-w-xs",value:c,disabled:s,placeholder:n("ui.agentMessages.settings.allowlist.identifier"),onChange:f=>l(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),g())}}),e.jsx(O,{variant:"secondary",size:"sm",disabled:s,onClick:g,children:n("ui.agentMessages.settings.allowlist.add")})]}),e.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")}),d&&e.jsx("p",{className:"text-meta text-danger",children:d})]})};function vm(){const{snapshot:t}=yi(),[s,a]=o.useState(!1),i=em({status:t.status,refused:t.refusal!==null,everVisible:s,checking:t.checking});return o.useEffect(()=>{i!=="absent"&&a(!0)},[i]),o.useEffect(()=>{Mc()},[]),i}function zs(t){const s=a=>typeof a=="string"?$t(a):$t((a??[]).join(" "));return{label:s(t.label),synonym:s(t.synonym),key:s(t.key),choice:s(t.choice),section:s(t.section),description:s(t.description)}}function km(t){const s=new Map;for(const a of t??[])s.set(a.name,{label:a.title||a.name,folded:$t([a.title,a.name].join(" "))});return s}function jm(t,s={}){if(!t)return[];const{startOrder:a=0,sections:i=[]}=s,r=km(t.sections),c=new Map(i.map(l=>[l.id,l.label]));return t.settings.map((l,d)=>{const u=r.get(l.section),m=rn(l.key,"backend");return{id:`setting:${l.key}`,source:"registry",label:l.label||l.key,description:l.help??"",sectionId:m,sectionLabel:c.get(m)??"",detail:u?.label??l.section,order:a+d,settingKey:l.key,fields:zs({label:l.label,synonym:l.synonyms??[],key:l.key,choice:(l.choices??[]).flatMap(p=>[p.label,p.description??""]),section:u?.folded??l.section,description:l.help})}})}function wm(t,s=0){return t.map((a,i)=>({id:`section:${a.id}`,source:"section",label:a.label,sectionId:a.id,sectionLabel:a.label,order:s+i,fields:zs({label:a.label})}))}function Nm(t){const s=t.getAttribute("data-search-label");if(s?.trim())return s.trim();const a=t.querySelector("[data-search-label]");if(a?.textContent?.trim())return a.textContent.trim();const i=t.querySelector("h2, h3, h4, legend");if(i?.textContent?.trim())return i.textContent.trim();const r=t.getAttribute("aria-label");return r?.trim()?r.trim():((t.firstElementChild??t).textContent??"").trim()}function Sm(t){const s=t.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 Cm(t){return t.closest("[data-search-section]")}function Mm(t,s){const a=(t.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 Am(t,s=0){return Array.from(t.querySelectorAll("[data-search-row]")).map((i,r)=>{const c=Cm(i),l=c?.getAttribute("data-search-section")??"",u=(c?.getAttribute("data-search-section-label")?.trim()??"")||c?.querySelector("[data-search-section-label], h2")?.textContent?.trim()||"",m=Nm(i),p=i.getAttribute("data-search-terms")??"",g=Mm(i,m);return{id:`page:${i.getAttribute("data-search-row")??r}`,source:"page",label:Sm(m),sectionId:l,sectionLabel:u,order:s+r,fields:zs({label:m,synonym:p,section:[u,l],description:g})}})}function Em(t){const s=jm(t.registry,{startOrder:0,sections:t.sections}).filter(i=>!(i.settingKey&&i.settingKey in ao)),a=[...t.rendered??[]].map((i,r)=>({...i,order:s.length+r}));return[...s,...a,...wm(t.sections??[],s.length+a.length)]}const Rm=12,fa="input, textarea, select, button, [role='switch'], [role='tab'], [role='combobox'], [tabindex]";function Im(t,s){return t.querySelector(`[data-search-row="${CSS.escape(s)}"]`)}function Tm(t){const a=(t.matches("[data-search-control]")?t:null)??t.querySelector("[data-search-control]");return a?a.matches(fa)?a:a.querySelector(fa)??a:t}function Di(t){return t.isConnected&&t.closest("[hidden]")===null}function Lm(t,s,a={}){const i=a.frames??Rm,r=a.paint??ci;return new Promise(c=>{let l=0;const d=()=>{const u=Im(t,s);if(u&&Di(u)){const m=Tm(u);m===u&&(u.tabIndex=-1),m.scrollIntoView({block:"center"}),m.focus(),r(u),c("landed");return}if(l+=1,l>=i){c("missing");return}requestAnimationFrame(d)};requestAnimationFrame(d)})}function Om(t,s,a={}){const i=t.querySelector(`[data-search-section="${CSS.escape(s)}"]`);return!i||!Di(i)?"missing":(i.scrollIntoView({block:"start"}),i.tabIndex<0&&(i.tabIndex=-1),i.focus(),(a.paint??ci)(i),"landed")}const ha={get[tt.UI](){return n("ui.settings.updates.update_following.application_updates")},get[tt.BACKEND](){return n("ui.settings.updates.update_following.server_updates")}},Zt={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")}}},xa=({type:t})=>{te();const s=ss(i=>i.followed[t]),a=ss(i=>i.setFollowedSegment);return e.jsxs("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:items-center sm:justify-between sm:gap-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-body-sm text-ink",children:ha[t]}),e.jsx("div",{className:"mt-0.5 text-meta text-ink-muted",children:Zt[s].description})]}),e.jsxs(Es,{value:s,onValueChange:i=>a(t,i),children:[e.jsx(Rs,{"aria-label":n("ui.settings.updates.update_following.surface_choice",{surface:ha[t],choice:Zt[s].label}),className:"w-full sm:w-56","data-followed-segment":t,children:e.jsx(Is,{})}),e.jsx(Ts,{children:io.map(i=>e.jsx(ht,{value:i,title:Zt[i].description,children:Zt[i].label},i))})]})]})},Dm=()=>(te(),e.jsxs("div",{className:pe("flex flex-col gap-3"),children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.updates.update_following.update_notifications")}),e.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")})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(xa,{type:tt.UI}),e.jsx(xa,{type:tt.BACKEND})]})]})),Fm=({appVersion:t})=>e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(Dm,{}),e.jsx($u,{appVersion:t})]}),zm=t=>{if(!t)return null;try{return new URL(t).host}catch{return null}},Pm=()=>{te();const[t,s]=o.useState(null),[a,i]=o.useState({value:"Loading...",detail:null,degraded:!1}),[r,c]=o.useState({platform:"Loading...",arch:"...",nodeVersion:"Loading...",electronVersion:"Loading...",chromeVersion:"Loading..."});o.useEffect(()=>{let d=!0;const u=x=>{if(!d)return;const j=zm(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 y=x.version||"Version unknown";i({value:j?`${y} · ${j}`:y,detail:x.detail||null,degraded:x.state==="degraded"})};let m=!1;const p=window.api?.backend?.onStatusChange(x=>{m=!0,u(x)}),g=async()=>{try{const[x,j]=await Promise.all([window.api.systemInfo.getAppVersion(),window.api.systemInfo.getPlatformInfo()]);d&&(s(x),c(j))}catch(x){console.error("Error fetching app information:",x)}},f=async()=>{try{const x=window.api?.backend;if(x){const N=await x.getStatus();m||u(N);return}const j=await Js.healthCheck(bs.baseUrl),y=Js.getServerVersion(j);d&&i({value:y,detail:null,degraded:!1})}catch(x){console.error("Error fetching server version:",x),d&&i({value:"Unavailable",detail:null,degraded:!1})}};return g(),f(),()=>{d=!1,p?.()}},[]);const l=(d,u,m,p={})=>e.jsx(Te,{label:e.jsx(Ye,{content:m,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(kn,{size:12,className:"shrink-0"}),d]})}),valueClassName:p.valueClassName,value:e.jsxs(e.Fragment,{children:[p.valueTooltip?e.jsx(Ye,{content:p.valueTooltip,children:e.jsx("span",{"data-backend-version":p.valueHoverTarget?"":void 0,children:u})}):u,p.statusNote?e.jsx("span",{className:"mt-0.5 block text-meta text-ink-dim",children:p.statusNote}):null]})});return e.jsx(Re,{title:n("ui.settings.updates.app_updates_section.application_updates_and_info"),icon:as,description:n("ui.settings.updates.app_updates_section.check_for_updates_and_view_information_about_your_local_operator_"),dataTourTag:"settings-app-updates-section",children:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs(qt,{children:[l(n("ui.settings.updates.app_updates_section.application_version"),t??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")),l(n("ui.settings.updates.app_updates_section.server_version"),Ln(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}),l(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")),l(n("ui.settings.updates.app_updates_section.node_js_version"),Ln(r.nodeVersion),n("ui.settings.updates.app_updates_section.the_javascript_runtime_environment_version")),l(n("ui.settings.updates.app_updates_section.electron_version"),Ln(r.electronVersion),n("ui.settings.updates.app_updates_section.the_framework_version_enabling_this_desktop_application"))]}),e.jsx(Fm,{appVersion:t})]})})};function Fi(t){const s={id:"",name:n("ui.settings.model.default_effort.model_default")};return t.resolvedLevel&&t.stored.trim()===""&&Ps(t.resolvedLevel,t.storable)!==null&&(s.description=n("ui.settings.model.default_effort.model_default_resolves",{level:ot(t.resolvedLevel)})),[s,...zi(t.ladder,t.storable)]}function Ps(t,s){const a=t.trim().toLowerCase();return a===""?null:s.find(i=>i.trim().toLowerCase()===a)??null}function zi(t,s){return t.flatMap(a=>{const i=Ps(a,s);return i===null?[]:[{id:i,name:ot(a)}]})}function $m(t,s){const a=t.trim().toLowerCase();return a!==""&&s.some(i=>i.toLowerCase()===a)?s.find(i=>i.toLowerCase()===a)??"":""}function Um(t){if(!t.resolved||t.ladder===null)return null;const s=t.stored.trim().toLowerCase();if(s===""||t.ladder.some(r=>r.toLowerCase()===s))return null;const a=(t.resolvedLevel??"").trim(),i=a===""?"":Ps(a,t.storable)??"";return i.trim().toLowerCase()===s?null:i}const pn="\0unread";function Jt(t){return t.trim()===""?"":pn}function Km(t){if(!t.supported)return{kind:"unsupported",options:[],selectedId:"",disabled:!0,helper:""};if(!t.hasHome)return et("no-home",n("ui.settings.model.default_effort.no_home"));if(!t.hasModel)return et("no-model",n("ui.settings.model.default_effort.no_model"),pn);if(t.settings==="loading")return et("settings-loading",n("ui.settings.model.default_effort.settings_loading"),pn);if(t.settings==="error")return et("settings-error",n("ui.settings.model.default_effort.settings_error"),pn);if(t.preview==="loading")return et("loading",n("ui.settings.model.default_effort.loading"),Jt(t.stored));if(t.preview==="error")return et("error",n("ui.settings.model.default_effort.error"),Jt(t.stored));if(t.ladder===null||!t.specResolved)return et("unresolved",n("ui.settings.model.default_effort.unresolved"),Jt(t.stored));const s=t.ladder;if(s.length===0)return et("empty",n("ui.settings.model.default_effort.empty"),Jt(t.stored));const a=zi(s,t.storable);if(a.length===0){const i=ot(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:Fi({ladder:s,resolvedLevel:t.resolvedLevel,stored:t.stored,storable:t.storable}),selectedId:$m(t.stored,a.map(i=>i.id)),disabled:!1,helper:n("ui.settings.model.default_effort.helper_ready")}}function et(t,s,a=""){return{kind:t,options:Fi({ladder:[],resolvedLevel:null,stored:"",storable:[]}),selectedId:a,disabled:!0,helper:s}}const Bm=({hosting:t,modelName:s,focus:a=!1,focusNonce:i})=>{te();const r=vt(),c=_t(r.data,"draft_preview"),l=ro(),d=t!==""&&s!=="",u=Fe({queryKey:lt.all,queryFn:()=>je({op:"settings.list"}),enabled:c,staleTime:1e4}),m=u.data?.settings.find(le=>le.key===pt),p=typeof m?.value=="string"?m.value:"",g=(m?.choices??[]).map(le=>le.value).filter(le=>typeof le=="string"),f={cwd:l??"",model:d?{provider:t,model_id:s,reasoning_effort:null}:null},x=u.isSuccess?p:null,j=Fe({...jr(f,_t(r.data,"draft_fast")),queryKey:[...kr(f),"model_effort",x],enabled:c&&!!l&&d}),y=j.isSuccess&&!j.isPlaceholderData,N=y?wr(j.data?.snapshot,null).effort:null,M=y&&Array.isArray(N?.reasoning_efforts)?Nr(N):null,E=y?Sr(N):null,T=N!==null&&!Cr(N),[R,D]=o.useState(!1),[b,z]=o.useState(!1),[B,K]=o.useState(null),[h,L]=o.useState(null),F=`${t}\0${s}`,w=bt(),G=o.useRef(null),P=o.useRef(!1),V=o.useRef(i);o.useEffect(()=>{i!==V.current&&(V.current=i,P.current=!1)},[i]);const Z=o.useCallback(async(le,ue)=>{D(!0),K(le),z(!1),ue===null&&L(null);try{await je({op:"settings.edit",key:pt,value:le}),await w.invalidateQueries({queryKey:lt.all}),ue!==null&&L(ue)}catch{z(!0)}finally{D(!1),K(null)}},[w]),_=typeof N?.display_name=="string"&&N.display_name.trim()||s,I=Km({supported:c,hasHome:!!l,hasModel:d,settings:u.isError?"error":u.isSuccess?"ready":"loading",preview:j.isError?"error":y?"ready":"loading",ladder:M,specResolved:T,stored:p,resolvedLevel:E,storable:g}),S=Um({stored:p,ladder:M,resolvedLevel:E,resolved:y&&T&&u.isSuccess,storable:g}),q=o.useRef(null);o.useEffect(()=>{if(S===null||R)return;const le=`${t}\0${s}\0${p}\0${S}`;if(q.current===le)return;q.current=le;const ue=S===""?n("ui.settings.model.default_effort.clamped_unset",{level:ot(p),model:_}):n("ui.settings.model.default_effort.clamped",{level:ot(p),model:_,resolved:ot(S)});Z(S,{text:ue,model:F})},[S,p,R,Z,t,s,_,F]);const ae=o.useMemo(()=>I.options.map(qm),[I.options]);o.useEffect(()=>{if(!a){P.current=!1;return}I.disabled||P.current||(G.current?.querySelector("[role=combobox]")?.focus(),P.current=!0)},[a,i,I.disabled]);const Y=B??I.selectedId,ne=ae.find(le=>le.id===Y)??(B!==null?{id:B,name:ot(B)}:null),ce=e.jsxs("span",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{children:I.helper}),b&&e.jsx("span",{className:"text-danger",children:n("ui.settings.model.default_effort.save_failed")}),e.jsx("output",{"aria-live":"polite",children:h?.model===F?h.text:""})]});return I.kind==="unsupported"?null:e.jsx("div",{ref:G,"data-setting-key":pt,children:e.jsx(ji,{label:n("ui.settings.model.default_effort.label"),icon:e.jsx(Rc,{size:16,"aria-hidden":"true"}),placeholder:n("ui.settings.model.default_effort.placeholder"),options:ae,selected:ne,onSelect:le=>{Z(le.id,null)},helperText:ce,busy:R,busyLabel:n("ui.settings.model.default_effort.busy"),disabled:I.disabled||R})})};function qm(t){return{id:t.id,name:t.name,description:t.description}}const Hm=t=>t.replace(/[\p{Co}\p{Cc}]/gu," ").replace(/\s+/g," ").trim(),Pi=(t,s)=>{const a=s.trim().toLocaleLowerCase();return a?t.filter(i=>`${i.title} ${i.cwd} ${i.sourceId}`.toLocaleLowerCase().includes(a)):t},Vm=(t,s)=>`${t??""}\0${[...s].sort().join("\0")}`,$i=5e3,Gm=(t,s,a,i=$i)=>{const r=new Set(a);let c=!1;for(const l of Pi(t,s))if(!r.has(l.sourceId)){if(r.size>=i){c=!0;break}r.add(l.sourceId)}return{selected:r,capped:c}},Wm=/cancel/i,Ym=new Set(["done","failed","cancelled"]),_a=t=>{switch(t){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"}},$n=t=>{switch(t){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"}},Qm=t=>{switch(t){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"}},Zm=t=>{switch(t){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"}},Jm=t=>t==="failed"?"danger":t==="metadata_only"||t==="skipped_already_imported"?"neutral":t==="cancelled"?"warning":"success",ps=t=>Hm(t.title)||t.sourceId,ya=({path:t,label:s,onCopyPath:a})=>{const[i,r]=o.useState(!1);return e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-hairline bg-surface p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-body-sm text-ink",children:s}),e.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:t})]}),e.jsxs(O,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{a(t).then(c=>{c&&(r(!0),window.setTimeout(()=>r(!1),1500))})},children:[i?e.jsx(Nn,{size:14}):e.jsx(li,{size:14}),i?n("ui.settings.imports.copied"):n("ui.settings.imports.copy_path")]})]})},Xm=({progress:t,sessions:s,selected:a})=>{const i=new Map(t.results.map(d=>[d.sourceId,d])),r=t.sessionId,c=Math.max(0,t.total-t.completed-(r&&!i.has(r)?1:0)),l=s.filter(d=>a.has(d.sourceId));return e.jsxs("div",{className:"flex flex-col gap-2",children:[t.results.map(d=>e.jsx(Ui,{row:d,jobCancelled:t.state==="cancelled"},`${d.source}:${d.sourceId}`)),l.filter(d=>!i.has(d.sourceId)&&d.sourceId!==r).map(d=>e.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:[e.jsx("span",{className:"min-w-0 truncate",children:ps(d)}),e.jsx(yt,{variant:"neutral",children:n("ui.settings.imports.session_pending")})]},d.sourceId)),r&&!i.has(r)&&e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-hairline bg-surface p-2 text-body-sm text-ink-muted",children:[e.jsx(on,{size:14,className:"animate-spin"}),e.jsx("span",{children:n("ui.settings.imports.session_importing")}),e.jsx("span",{className:"min-w-0 truncate",children:r})]}),c>0&&e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.progress_pending",{count:c})}),t.warnings.map(d=>e.jsx("p",{className:"text-meta text-warning",children:d.message},`${d.code}:${d.sessionId}:${d.message}`))]})},Ui=({row:t,jobCancelled:s=!1})=>{const i=s&&t.outcome==="failed"&&t.warnings.some(r=>Wm.test(r))?"cancelled":t.outcome;return e.jsxs("div",{className:"rounded-md border border-hairline bg-surface p-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:t.sourceId}),e.jsx(yt,{variant:Jm(i),children:n(Zm(i))}),e.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.session_meta",{messages:t.messages,compactions:t.compactions})})]}),t.targetSessionId&&(t.messages>0||t.outcome==="skipped_already_imported")&&e.jsx("p",{className:"mt-1 break-all font-mono text-meta text-ink-muted",children:n("ui.settings.imports.result_target",{target:t.targetSessionId})}),t.warnings.map(r=>e.jsx("p",{className:"mt-1 text-meta text-warning",children:r},r))]})},eg=({sources:t,activeSource:s,sessions:a,query:i,selected:r,preview:c,previewStale:l,previewError:d,confirmed:u,busy:m,error:p,progress:g,result:f,cancelling:x,onSelectSource:j,onQueryChange:y,onToggleSession:N,onSelectAll:M,onClearSelection:E,onConfirmChange:T,onImport:R,onCancel:D,onRetry:b,onImportAnother:z,onRefresh:B,selectionNotice:K,onCopyPath:h})=>{te();const L=t.find(_=>_.source===s),F=g!==null&&!Ym.has(g.state),w=g?.total??r.size,G=o.useMemo(()=>Pi(a,i),[i,a]),P=G.length>0&&G.every(_=>r.has(_.sourceId)),V=r.size,Z=V>0&&c!==null&&!l&&u&&!m&&!g&&!f;return e.jsx(Re,{title:n("ui.settings.imports.title"),icon:as,description:n("ui.settings.imports.description"),dataTourTag:"settings-import-section",children:e.jsxs("div",{className:"flex flex-col gap-5",children:[p&&e.jsxs(ge,{variant:"warning",children:[e.jsx(vn,{children:n("ui.settings.imports.title")}),e.jsx(Be,{children:e.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("span",{children:p}),e.jsx(O,{variant:"secondary",size:"sm",onClick:b,children:n("ui.settings.imports.retry")})]})})]}),m==="sources"&&t.length===0?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx($e,{className:"h-20 w-full"}),e.jsx($e,{className:"h-20 w-full"}),e.jsx($e,{className:"h-20 w-full"}),e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sources")})]}):t.length===0?e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}):e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.source_heading")}),e.jsxs(O,{variant:"ghost",size:"sm",onClick:B,disabled:F||m==="sources"||m==="sessions",children:[e.jsx(Ic,{size:14,className:pe(m==="sources"&&"animate-spin")}),n("ui.settings.imports.refresh")]})]}),!t.some(_=>_.detected)&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sources")}),e.jsx("div",{className:"grid gap-2 lg:grid-cols-3",children:t.map(_=>{const I=_.source===s,S=_.detected?n(_a(_.availability)):n("ui.settings.imports.source_not_found");return e.jsxs("button",{type:"button","aria-pressed":I,disabled:F,onClick:()=>j(_.source),className:pe("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",I?"border-accent bg-accent-wash":"border-hairline bg-surface hover:bg-sunken"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-body-sm font-medium text-ink",children:_.label}),e.jsx(yt,{variant:_.detected&&_.availability==="full"?"success":"neutral",children:S})]}),e.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.imports.source_sessions",{count:_.sessionCount})}),e.jsx("p",{className:"mt-1 break-all text-meta text-ink-dim",children:_.detail||_.root})]},_.source)})})]}),L&&!g&&!f&&e.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("h3",{className:"text-heading text-ink",children:[n("ui.settings.imports.source_heading")," · ",L.label]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{variant:"secondary",size:"sm",onClick:P?E:M,disabled:G.length===0,children:P?n("ui.settings.imports.clear_all"):n("ui.settings.imports.select_all")}),e.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.selected",{count:V})})]})]}),K&&e.jsx("output",{className:"text-meta text-warning",children:K}),e.jsxs("div",{className:"relative",children:[e.jsx(js,{size:15,className:"pointer-events-none absolute top-1/2 start-3 -translate-y-1/2 text-ink-dim"}),e.jsx(Le,{value:i,onChange:_=>y(_.target.value),placeholder:n("ui.settings.imports.search_placeholder"),className:"ps-9"})]}),m==="sessions"?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx($e,{className:"h-12 w-full"}),e.jsx($e,{className:"h-12 w-full"}),e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.loading_sessions",{source:L.label})})]}):a.length===0?e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_sessions",{source:L.label})}):G.length===0?e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.imports.empty_filter")}):e.jsx("div",{className:"flex max-h-80 flex-col gap-1 overflow-y-auto",children:G.map(_=>{const I=`import-session-${_.source}-${_.sourceId}`;return e.jsxs("div",{className:pe("flex items-start gap-3 rounded-md border p-3",r.has(_.sourceId)?"border-accent bg-row-selected":"border-hairline bg-surface hover:bg-sunken"),children:[e.jsx(ds,{id:I,checked:r.has(_.sourceId),onCheckedChange:()=>N(_.sourceId),"aria-label":ps(_),className:"mt-0.5"}),e.jsxs("label",{htmlFor:I,className:"min-w-0 flex-1 cursor-pointer text-start",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-body-sm text-ink",children:ps(_)}),e.jsx(yt,{variant:_.availability==="full"?"neutral":"warning",children:n(_a(_.availability))})]}),e.jsxs("span",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-meta text-ink-muted",children:[e.jsx("span",{children:n("ui.settings.imports.session_meta",{messages:_.messageCount??0,compactions:_.compactionCount})}),e.jsx("span",{children:n("ui.settings.imports.session_updated",{date:ws(new Date((_.updatedTs||_.createdTs)*1e3))})})]}),_.cwd&&e.jsx("span",{className:"mt-1 block break-all font-mono text-meta text-ink-dim",children:_.cwd}),_.availability==="metadata_only"&&e.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.metadata_only_explain")}),_.availability==="unsupported"&&e.jsx("span",{className:"mt-1 block text-meta text-warning",children:n("ui.settings.imports.session_index_only")})]})]},_.sourceId)})})]}),L&&V>0&&!g&&!f&&e.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.preview_heading")}),(m==="preview"||l||c===null&&!d)&&e.jsxs("p",{className:"flex items-center gap-2 text-meta text-ink-muted",children:[e.jsx(on,{size:14,className:"animate-spin"}),n("ui.settings.imports.loading_preview")]}),c&&!l&&e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-hairline bg-surface p-4",children:[e.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.imports.preview_summary",{sessions:c.totalSessions,messages:c.totalMessages,compactions:c.totalCompactions})}),e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_memory",{records:c.totalMemoryRecords,tokens:c.projectedMemoryTokens.toLocaleString()})}),c.warnings.slice(0,4).map((_,I)=>e.jsx("p",{className:"text-meta text-warning",children:_.message},`${_.code}:${_.sessionId}:${I}`)),c.warnings.length>4&&e.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.imports.warnings_heading",{count:c.warnings.length})}),e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.preview_confirm")})]}),e.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border border-hairline bg-surface p-4",children:[d&&e.jsx(ge,{variant:"warning",children:e.jsx(Be,{children:e.jsxs("span",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("span",{children:d}),e.jsx(O,{variant:"secondary",size:"sm",onClick:b,children:n("ui.settings.imports.retry")})]})})}),e.jsxs("div",{className:"flex items-start gap-2 text-body-sm text-ink",children:[e.jsx(ds,{checked:u,onCheckedChange:_=>T(_===!0),disabled:!c||l,"aria-label":n("ui.settings.imports.confirm_label"),className:"mt-0.5"}),e.jsx("span",{children:n("ui.settings.imports.confirm_label")})]}),e.jsxs(O,{variant:"primary",onClick:R,disabled:!Z,className:"self-start",children:[m==="start"?e.jsx(on,{size:14,className:"animate-spin"}):e.jsx(as,{size:14}),n("ui.settings.imports.import_button",{count:V})]})]})]}),g&&!f&&e.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.progress_heading")}),e.jsxs(O,{variant:"secondary",size:"sm",onClick:D,disabled:x||g.state==="done"||g.state==="cancelled"||g.state==="failed",children:[e.jsx(oo,{size:12}),x?n("ui.settings.imports.cancelling"):n("ui.settings.imports.cancel")]})]}),e.jsxs("p",{className:"text-meta text-ink-muted",children:[n("ui.settings.imports.progress_job",{job:g.jobId,state:n($n(g.state))})," · ",n(Qm(g.phase))]}),e.jsx(wi,{value:g.total?g.completed/g.total*100:0,className:"h-1.5"}),e.jsx(Xm,{progress:g,sessions:a,selected:r})]}),f&&e.jsxs("div",{className:"flex flex-col gap-3 border-t border-hairline pt-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.imports.result_heading")}),e.jsx(O,{variant:"secondary",size:"sm",onClick:z,children:n("ui.settings.imports.import_another")})]}),e.jsx("p",{className:"text-body-sm text-ink",children:f.state==="cancelled"?n("ui.settings.imports.result_summary_cancelled",{state:n($n(f.state)),sessions:f.sessions.length,total:w,messages:f.messages}):n("ui.settings.imports.result_summary",{state:n($n(f.state)),sessions:f.sessions.length,messages:f.messages})}),f.sessions.map(_=>e.jsx(Ui,{row:_,jobCancelled:f.state==="cancelled"},`${_.source}:${_.sourceId}:${_.targetSessionId}`)),(f.instructionReviewPath||f.memoryReviewPath)&&e.jsxs("div",{className:"flex flex-col gap-2",children:[f.instructionReviewPath&&e.jsx(ya,{path:f.instructionReviewPath,label:n("ui.settings.imports.review_instructions"),onCopyPath:h}),f.memoryReviewPath&&e.jsx(ya,{path:f.memoryReviewPath,label:n("ui.settings.imports.review_memory"),onCopyPath:h})]}),f.warnings.length>0&&e.jsx(ge,{variant:"warning",children:e.jsx(Be,{children:e.jsxs("span",{className:"flex flex-col gap-1",children:[e.jsx("span",{children:n("ui.settings.imports.warnings_heading",{count:f.warnings.length})}),f.warnings.slice(0,4).map((_,I)=>e.jsx("span",{children:_.message},`${_.code}:${I}`))]})})}),f.error&&e.jsx(ge,{variant:"danger",children:e.jsx(Be,{children:f.error})}),e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.imports.rerun_safe")})]}),m==="start"&&!g&&e.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(on,{size:14,className:"animate-spin"}),n("ui.settings.imports.importing")]})]})})},$s=t=>({source:t.source,sessionId:t.session_id,code:t.code,message:t.message}),Ki=t=>({source:t.source,sourceId:t.source_id,targetSessionId:t.target_session_id,outcome:t.outcome,messages:t.messages,compactions:t.compactions,redactions:t.redactions,skipped:t.skipped,warnings:t.warnings}),tg=t=>({jobId:t.job_id,state:t.state,sessions:t.sessions.map(Ki),messages:t.messages,compactions:t.compactions,memoryImported:t.memory_imported,memorySkipped:t.memory_skipped,memoryReviewPath:t.memory_review_path,instructionReviewPath:t.instruction_review_path,redactions:t.redactions,warnings:t.warnings.map($s),error:t.error});async function ng(){return(await je({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 sg(t,s=!1){return(await je({op:"imports.sessions",source:t,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 ag(t){const s=await je({op:"imports.preview",sources:t.sources,sessionIds:t.sessionIds,includeMemory:t.includeMemory??!0,includeInstructions:t.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($s),instructionReviewPaths:s.instruction_review_paths}}async function ig(t){return(await je({op:"imports.start",sources:t.sources,sessionIds:t.sessionIds,includeMemory:t.includeMemory??!0,includeInstructions:t.includeInstructions??!0})).job_id}async function rg(t){const s=await je({op:"imports.status",jobId:t});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(Ki),warnings:s.warnings.map($s),error:s.error,startedAt:s.started_at,updatedAt:s.updated_at,result:s.result?tg(s.result):void 0}}async function og(t){await je({op:"imports.cancel",jobId:t})}const Xt=new Set(["done","failed","cancelled"]),gt=t=>t instanceof Error?t.message:String(t),cg=()=>{te();const[t,s]=o.useState([]),[a,i]=o.useState(null),[r,c]=o.useState([]),[l,d]=o.useState(""),[u,m]=o.useState(new Set),[p,g]=o.useState(null),[f,x]=o.useState(null),[j,y]=o.useState(!1),[N,M]=o.useState(null),[E,T]=o.useState(null),[R,D]=o.useState(null),[b,z]=o.useState(null),[B,K]=o.useState(!1),[h,L]=o.useState(null),[F,w]=o.useState(0),G=o.useRef(0),P=o.useRef(0),[V,Z]=o.useState(null),[_,I]=o.useState(null),S=o.useRef(null),q=R!==null&&!Xt.has(R.state),ae=o.useCallback(async()=>{M("sources"),T(null);try{const ie=await ng();s(ie),i(de=>ie.some(oe=>oe.source===de&&oe.detected)?de:ie.find(oe=>oe.detected)?.source??null)}catch(ie){T(n("ui.settings.imports.error_sources",{reason:gt(ie)}))}finally{M(null)}},[]);o.useEffect(()=>{ae()},[ae]);const Y=o.useCallback(async ie=>{const de=++G.current;M("sessions"),T(null);try{const Q=await sg(ie);if(de!==G.current)return;c(Q)}catch(Q){if(de!==G.current)return;c([]),T(n("ui.settings.imports.error_sessions",{source:ie,reason:gt(Q)}))}finally{de===G.current&&M(null)}},[]);o.useEffect(()=>{if(!a){c([]);return}c([]),m(new Set),g(null),x(null),Z(null),I(null),y(!1),z(null),D(null),Y(a)},[a,Y]);const ne=o.useCallback(ie=>{m(ie),y(!1),Z(null),I(null),L(null)},[]),ce=o.useCallback(ie=>{q||(i(ie),d(""))},[q]),le=o.useCallback(ie=>{const de=new Set(u);de.has(ie)?de.delete(ie):de.add(ie),ne(de)},[ne,u]),ue=o.useCallback(()=>{const ie=Gm(r,l,u);ne(ie.selected),ie.capped&&L(n("ui.settings.imports.selection_limit",{max:$i}))},[l,ne,u,r]),we=o.useCallback(()=>{ne(new Set)},[ne]),U=o.useMemo(()=>Vm(a,u),[a,u]),$=p!==null&&f!==U,v=o.useCallback(async()=>{if(!a||u.size===0)return;const ie=++P.current,de=U;M("preview"),T(null),I(null);try{const Q=await ag({sources:[a],sessionIds:{[a]:[...u].sort()}});if(ie!==P.current)return;g(Q),x(de)}catch(Q){if(ie!==P.current)return;g(null),x(null),Z(de),I(n("ui.settings.imports.error_preview",{reason:gt(Q)}))}finally{ie===P.current&&M(null)}},[a,U,u]);o.useEffect(()=>{if(!a||u.size===0||R||b||p&&f===U||!p&&V===U)return;const ie=setTimeout(()=>{v()},250);return()=>clearTimeout(ie)},[a,u,U,p,f,V,R,b,v]);const W=o.useCallback(async()=>{if(!(!a||u.size===0||!p||$||!j||R)){M("start"),T(null),z(null);try{const ie=await ig({sources:[a],sessionIds:{[a]:[...u].sort()}}),de=Date.now()/1e3;D({jobId:ie,state:"queued",phase:"queued",source:a,sessionId:"",completed:0,total:u.size,results:[],warnings:[],error:"",startedAt:de,updatedAt:de})}catch(ie){T(n("ui.settings.imports.error_start",{reason:gt(ie)}))}finally{M(null)}}},[a,j,p,$,R,u]),se=R?.jobId??null,ee=R?.state??null;o.useEffect(()=>{if(!se||!ee||Xt.has(ee))return;let ie=!0,de;const Q=async()=>{try{const oe=await rg(se);if(!ie)return;if(S.current){const me=S.current;S.current=null,T(Ie=>Ie===me?null:Ie)}D(oe),oe.result&&z({...oe.result,jobId:oe.jobId}),Xt.has(oe.state)||(de=setTimeout(Q,900))}catch(oe){if(!ie)return;const me=n("ui.settings.imports.error_job",{reason:gt(oe)});S.current=me,T(me),de=setTimeout(Q,2e3)}};return de=setTimeout(Q,F>0?0:700),()=>{ie=!1,de&&clearTimeout(de)}},[se,ee,F]);const ye=o.useCallback(async()=>{if(!(!R||Xt.has(R.state))){K(!0),T(null);try{await og(R.jobId)}catch(ie){T(n("ui.settings.imports.error_cancel",{reason:gt(ie)}))}finally{K(!1)}}},[R]),Se=o.useCallback(()=>{m(new Set),g(null),x(null),Z(null),I(null),y(!1),L(null),z(null),D(null),T(null),a&&Y(a)},[a,Y]),he=o.useCallback(async ie=>{try{return await navigator.clipboard.writeText(ie),!0}catch{return!1}},[]),be=o.useCallback(async()=>{q||(L(null),Z(null),I(null),await ae(),a&&await Y(a))},[a,q,Y,ae]),ke=o.useCallback(()=>{if(q){T(null),w(ie=>ie+1);return}Z(null),I(null),be()},[q,be]);return e.jsx(eg,{sources:t,activeSource:a,sessions:r,query:l,selected:u,preview:p,previewStale:$,previewError:_,confirmed:j,busy:N,error:E,progress:R,result:b,cancelling:B,onSelectSource:ce,onQueryChange:d,onToggleSession:le,onSelectAll:ue,onClearSelection:we,onConfirmChange:y,onImport:()=>void W(),onCancel:()=>void ye(),onRetry:ke,onImportAnother:Se,onRefresh:be,selectionNotice:h,onCopyPath:he})},Ot="ui.settings.appearance.agent_avatar_size_setting",lg=t=>t==="small"?n(`${Ot}.small`):t==="medium"?n(`${Ot}.medium`):n(`${Ot}.large`),ba={className:"size-4",glyphClassName:"size-2"},dg=({size:t})=>{const s=Ar[t],a=Er[t],i=Rr[t],r=(c,l)=>e.jsx(al,{className:pe("items-center justify-center text-ink-muted",c),children:e.jsx(vi,{className:l,"aria-hidden":"true"})});return e.jsxs("div",{"aria-hidden":"true","data-agent-size-sample":t,className:"mt-3 flex items-start gap-6 rounded-md border border-hairline bg-surface p-3",children:[e.jsxs("div",{className:"flex h-10 items-center gap-2",children:[r(s.className,s.glyphClassName),e.jsx("span",{className:"h-2 w-16 rounded-full bg-sunken"})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:pe("flex",i.className),children:r(a.className,a.glyphClassName)}),e.jsx("span",{className:"h-2 w-28 rounded-full bg-sunken"})]}),e.jsxs("div",{"data-agent-size-sample-fixed":"",className:"flex h-10 items-center gap-2",children:[r(ba.className,ba.glyphClassName),e.jsx("span",{className:"h-2 w-12 rounded-full bg-sunken"})]})]})},ug=({value:t,onChange:s,searchRow:a})=>{te();const i=o.useId();return e.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{id:i,className:"flex min-h-6 items-center text-body text-ink",children:n(`${Ot}.agent_picture_size`)}),e.jsx("p",{className:"mt-0.5 max-w-2xl text-body-sm text-ink-muted",children:n(`${Ot}.how_large_the_agent_s_picture_appears_in_the_chat_window_and_the_chat`)}),e.jsx(dg,{size:es(t)})]}),e.jsx("div",{className:"flex h-6 shrink-0 items-center",children:e.jsx(Ut,{value:t,onValueChange:r=>s(es(r)),children:e.jsx(Kt,{"aria-labelledby":i,children:Mr.map(r=>e.jsx(ct,{value:r,children:lg(r)},r))})})})]})},Bi=()=>{const t=xe(i=>i.themeName),s=xe(i=>i.customThemeId),a=Ns();return o.useMemo(()=>{const i=a.themes.find(c=>c.id===s),r=xt(i?.base??t)?.palette;return{palette:r&&i?yn(r,i):r,name:i?.name??We[t].name}},[t,s,a])},Un=t=>{const s=[1,3,5].map(g=>Number.parseInt(t.slice(g,g+2),16)/255).map(g=>g<=.04045?g/12.92:((g+.055)/1.055)**2.4),[a,i,r]=s,c=Math.cbrt(.4122214708*a+.5363325363*i+.0514459929*r),l=Math.cbrt(.2119034982*a+.6806995451*i+.1073969566*r),d=Math.cbrt(.0883024619*a+.2817188376*i+.6299787005*r),u=.2104542553*c+.793617785*l-.0040720468*d,m=1.9779984951*c-2.428592205*l+.4505937099*d,p=.0259040371*c+.7827717662*l-.808675766*d;return{l:u,c:Math.hypot(m,p),h:(Math.atan2(p,m)*180/Math.PI+360)%360}},Kn=({l:t,c:s,h:a})=>{const i=s*Math.cos(a*Math.PI/180),r=s*Math.sin(a*Math.PI/180),c=(t+.3963377774*i+.2158037573*r)**3,l=(t-.1055613458*i-.0638541728*r)**3,d=(t-.0894841775*i-1.291485548*r)**3;return[4.0767416621*c-3.3077115913*l+.2309699292*d,-1.2684380046*c+2.6097574011*l-.3413193965*d,-.0041960863*c-.7034186147*l+1.707614701*d]},va=t=>{const s={l:Math.max(0,Math.min(1,t.l)),c:Math.max(0,Math.min(.4,t.c)),h:(t.h%360+360)%360},a=c=>c.every(l=>l>=-1e-7&&l<=1+1e-7),i=!a(Kn(s));if(i){let c=0,l=s.c;for(let d=0;d<22;d++){const u=(c+l)/2;a(Kn({...s,c:u}))?c=u:l=u}s.c=c}return{hex:`#${Kn(s).map(c=>{const l=c<=.0031308?12.92*c:1.055*c**.4166666666666667-.055;return Math.round(Math.max(0,Math.min(1,l))*255).toString(16).padStart(2,"0")}).join("").toUpperCase()}`,clipped:i}},mg=t=>t.length===3&&t.every(s=>Number.isFinite(s)&&s>=0&&s<=255)?`#${t.map(s=>Math.round(s).toString(16).padStart(2,"0")).join("").toUpperCase()}`:null,qi="lo-recent-colours-v1",Hi=()=>{try{const t=JSON.parse(localStorage.getItem(qi)??"[]");return Array.isArray(t)?t.filter(s=>typeof s=="string"&&/^#[0-9A-Fa-f]{6}$/.test(s)).slice(0,8):[]}catch{return[]}},Vi=t=>{try{localStorage.setItem(qi,JSON.stringify([t,...Hi().filter(s=>s!==t)].slice(0,8)))}catch{}},Gi=({value:t,onChange:s,onValidityChange:a,swatches:i=[]})=>{te();const r=o.useId(),c=o.useRef(t),[l,d]=o.useState(()=>Un(t)),[u,m]=o.useState(t),[p,g]=o.useState("hex"),[f,x]=o.useState(!1),[j,y]=o.useState(!1),[N,M]=o.useState(!1),E=o.useCallback((h,L,F=p)=>F==="rgb"?[1,3,5].map(w=>Number.parseInt(h.slice(w,w+2),16)).join(", "):F==="oklch"?`${(L.l*100).toFixed(2)} ${L.c.toFixed(4)} ${L.h.toFixed(2)}`:h,[p]);o.useEffect(()=>{if(t===c.current)return;c.current=t;const h=Un(t);d(h),m(E(t,h)),y(!1),x(!1),a?.(!0)},[t,E,a]);const T=h=>{const L={l:Math.max(0,Math.min(1,h.l)),c:Math.max(0,Math.min(.4,h.c)),h:(h.h%360+360)%360},F=va(L);d(L),c.current=F.hex,y(F.clipped),m(E(F.hex,L)),x(!1),a?.(!0),s(F.hex)},R=h=>{const L=Un(h);c.current=h,d(L),m(E(h,L)),y(!1),x(!1),a?.(!0),s(h)},D=()=>{const h=u.trim().split(/[\s,]+/).map(Number),L=p==="hex"?ts(u):p==="rgb"?mg(h):null;if(p==="oklch"&&h.length===3&&h.every(Number.isFinite)&&h[0]>=0&&h[0]<=100&&h[1]>=0&&h[1]<=.4&&h[2]>=0&&h[2]<=360){T({l:h[0]/100,c:h[1],h:h[2]});return}if(!L){x(!0),a?.(!1);return}R(L)},b=h=>{const L=h.currentTarget.getBoundingClientRect();T({...l,c:(h.clientX-L.left)/L.width*.4,l:1-(h.clientY-L.top)/L.height})},z=h=>{const L=h.shiftKey?.1:.01,F={...l};switch(h.key){case"ArrowLeft":F.c-=L*.4;break;case"ArrowRight":F.c+=L*.4;break;case"ArrowUp":F.l+=L;break;case"ArrowDown":F.l-=L;break;case"Home":F.c=0;break;case"End":F.c=.4;break;case"PageUp":F.l+=.1;break;case"PageDown":F.l-=.1;break;default:return}h.preventDefault(),T(F)},B=o.useMemo(()=>Array.from({length:48},(h,L)=>{const F=1-(L+.5)/48;return`linear-gradient(to right, ${Array.from({length:17},(w,G)=>va({l:F,c:G/16*.4,h:l.h}).hex).join(", ")})`}),[l.h]),K=globalThis.EyeDropper;return e.jsxs("div",{className:"flex min-w-0 flex-col gap-3","data-colour-picker":"",children:[e.jsx("div",{id:`${r}-help`,className:"sr-only",children:n("ui.settings.appearance.editor.picker.area_description")}),e.jsxs("div",{role:"slider",tabIndex:0,"aria-label":n("ui.settings.appearance.editor.picker.area"),"aria-describedby":`${r}-help`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(l.l*100),"aria-valuetext":n("ui.settings.appearance.editor.picker.area_value",{lightness:String(Math.round(l.l*100)),chroma:l.c.toFixed(3),hue:String(Math.round(l.h))}),onKeyDown:z,onPointerDown:h=>{h.currentTarget.setPointerCapture(h.pointerId),b(h)},onPointerMove:h=>{h.currentTarget.hasPointerCapture(h.pointerId)&&b(h)},className:"relative h-40 touch-none rounded-md border border-control focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:[e.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 flex flex-col",children:B.map((h,L)=>e.jsx("div",{className:"min-h-0 flex-1",style:{background:h}},String(L)))}),e.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute size-3 rounded-full border-2 border-white outline-1 outline-black",style:{left:`calc(${l.c/.4*100}% - 6px)`,top:`calc(${(1-l.l)*100}% - 6px)`,background:t}})]}),e.jsxs("label",{className:"flex flex-col gap-1 text-meta",children:[n("ui.settings.appearance.picker.hue"),e.jsx("input",{type:"range",dir:"ltr",min:0,max:360,step:1,value:l.h,onChange:h=>T({...l,h:Number(h.target.value)}),"data-colour-hue":"",className:"h-6 w-full focus-visible:outline-2 focus-visible:outline-accent"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("label",{className:"flex flex-col gap-1 text-meta",children:[n("ui.settings.appearance.editor.picker.lightness"),e.jsx("input",{type:"range",dir:"ltr",min:0,max:100,value:l.l*100,onChange:h=>T({...l,l:Number(h.target.value)/100}),className:"h-6 w-full accent-accent"})]}),e.jsxs("label",{className:"flex flex-col gap-1 text-meta",children:[n("ui.settings.appearance.editor.picker.chroma"),e.jsx("input",{type:"range",dir:"ltr",min:0,max:.4,step:.001,value:l.c,onChange:h=>T({...l,c:Number(h.target.value)}),className:"h-6 w-full accent-accent"})]})]}),e.jsxs("div",{className:"flex min-w-0 gap-2",children:[e.jsxs("select",{"aria-label":n("ui.settings.appearance.editor.picker.format"),value:p,onChange:h=>{g(h.target.value),m(E(t,l,h.target.value)),x(!1)},className:"min-w-0 rounded-sm border border-control bg-sunken px-2 text-body-sm",children:[e.jsx("option",{value:"hex",children:n("ui.settings.appearance.picker.hex")}),e.jsx("option",{value:"rgb",children:n("ui.settings.appearance.editor.picker.rgb")}),e.jsx("option",{value:"oklch",children:n("ui.settings.appearance.editor.picker.oklch")})]}),e.jsx("input",{dir:"ltr","aria-label":p==="hex"?n("ui.settings.appearance.picker.hex"):p==="rgb"?n("ui.settings.appearance.editor.picker.rgb"):n("ui.settings.appearance.editor.picker.oklch"),value:u,"aria-invalid":f,"aria-describedby":f?`${r}-error`:void 0,onChange:h=>{m(h.target.value),x(!0),a?.(!1)},onBlur:D,onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),D())},className:"min-w-0 flex-1 rounded-sm border border-control bg-sunken px-2 py-1.5 font-mono text-meta"}),e.jsx("span",{"aria-hidden":"true",className:"size-8 shrink-0 rounded-sm border border-control",style:{backgroundColor:t}})]}),f&&e.jsx("p",{id:`${r}-error`,role:"alert",className:"text-meta text-danger",children:n("ui.settings.appearance.editor.picker.invalid_channels")}),j&&e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.appearance.editor.picker.gamut")}),[{key:"theme",label:n("ui.settings.appearance.editor.picker.theme_swatches"),items:i},{key:"recent",label:n("ui.settings.appearance.editor.picker.recent"),items:Hi()}].map(h=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-meta text-ink-muted",children:h.label}),e.jsx("div",{className:"flex flex-wrap gap-1",children:[...new Set(h.items)].map(L=>e.jsx("button",{type:"button","aria-label":n("ui.settings.appearance.editor.picker.swatch",{hex:L}),className:"size-7 rounded-sm border border-control focus-visible:outline-2 focus-visible:outline-accent",style:{background:L},onClick:()=>R(L)},L))}),!h.items.length&&e.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.settings.appearance.editor.picker.recent_empty")})]},h.key)),K&&e.jsx(O,{type:"button",variant:"secondary",onClick:async()=>{try{const h=await new K().open(),L=ts(h.sRGBHex);L&&R(L),M(!1)}catch(h){h instanceof DOMException&&h.name==="AbortError"||M(!0)}},children:n("ui.settings.appearance.picker.eyedropper")}),N&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.appearance.editor.picker.eyedropper_error")})]})},gg=5,pg={red:"ui.settings.appearance.hue.red",orange:"ui.settings.appearance.hue.orange",amber:"ui.settings.appearance.hue.amber",yellow:"ui.settings.appearance.hue.yellow",lime:"ui.settings.appearance.hue.lime",green:"ui.settings.appearance.hue.green",teal:"ui.settings.appearance.hue.teal",cyan:"ui.settings.appearance.hue.cyan",blue:"ui.settings.appearance.hue.blue",indigo:"ui.settings.appearance.hue.indigo",violet:"ui.settings.appearance.hue.violet",pink:"ui.settings.appearance.hue.pink",neutral:"ui.settings.appearance.hue.neutral"},ka=t=>n(pg[Tr(t)]),ja=(t,s)=>t.kind!==s.kind?!1:t.kind==="palette"&&s.kind==="palette"?t.id===s.id:t.kind==="custom"&&s.kind==="custom"?t.hex===s.hex:!0,fg=t=>{te();const{themeName:s,themeAccent:a,themeAccentAlt:i,curated:r,all:c,paletteName:l,custom:d,customNames:u,selected:m,paintedAccent:p,adjusted:g,applied:f}=t,[x,j]=o.useState(!1),y=o.useRef(null),N=o.useRef(null),[M,E]=o.useState(null),T=x?c:r,R=o.useMemo(()=>[{key:"theme",ref:{kind:"theme"},hex:a,label:n("ui.settings.appearance.accent.theme_accent",{theme:s})},{key:"theme-alt",ref:{kind:"theme-alt"},hex:i,label:n("ui.settings.appearance.accent.theme_second_accent",{theme:s})},...T.map(w=>({key:`palette:${w.id}`,ref:{kind:"palette",id:w.id},hex:w.hex,label:n("ui.settings.appearance.accent.from_theme",{theme:l(w.id),hue:ka(w.hex)})}))],[s,a,i,T,l]),D=d.map(w=>({key:`custom:${w}`,ref:{kind:"custom",hex:w},hex:w,custom:w,label:n("ui.settings.appearance.accent.custom_swatch",{name:u[w]??w})})),b=[...R];if(m.kind==="palette"&&!R.some(w=>ja(w.ref,m))){const w=c.find(G=>G.id===m.id);w&&b.push({key:`palette:${w.id}`,ref:m,hex:w.hex,label:n("ui.settings.appearance.accent.from_theme",{theme:l(w.id),hue:ka(w.hex)})})}const z=[...b,...D],B=Math.max(0,z.findIndex(w=>ja(w.ref,m))),K=m.kind!=="theme"&&f&&g>gg?n("ui.settings.appearance.accent.adjusted"):null,h=o.useRef(null),L=w=>{if(!["ArrowRight","ArrowDown","ArrowLeft","ArrowUp"].includes(w.key)&&w.key!=="Home"&&w.key!=="End")return;const P=[...h.current?.querySelectorAll('[role="radio"]')??[]],V=P.indexOf(w.target);if(V<0)return;w.preventDefault();const Z=getComputedStyle(w.currentTarget).direction==="rtl",_=w.key==="ArrowDown"||w.key==="ArrowRight"&&!Z||w.key==="ArrowLeft"&&Z,I=w.key==="Home"?0:w.key==="End"?P.length-1:(V+(_?1:-1)+P.length)%P.length;P[I]?.focus(),P[I]?.click()},F=(w,G)=>{const P=G===B,V=e.jsx("button",{type:"button",role:"radio","aria-checked":P,"aria-label":w.label,tabIndex:P?0:-1,"data-accent-swatch":w.key,onClick:()=>t.onSelect(w.ref),className:pe("group relative flex size-8 shrink-0 items-center justify-center rounded-full"),children:e.jsx("span",{"aria-hidden":"true",style:{backgroundColor:w.hex},className:pe("flex size-6 items-center justify-center rounded-full border border-hairline transition-colors group-hover:border-hairline-strong",P&&"outline-2 outline-ink outline-offset-2"),children:P&&e.jsx(Nn,{size:14,strokeWidth:3,style:{color:w.hex.toUpperCase()===p.toUpperCase()?"var(--color-on-accent)":Lr(w.hex).ink}})})}),Z=P&&K?`${w.label}. ${K}`:w.label,_=e.jsx(Ye,{side:"bottom",content:Z,children:V},w.key);if(!w.custom)return _;const I=w.custom;return e.jsxs(co,{children:[e.jsx(lo,{asChild:!0,children:e.jsx("span",{className:"inline-flex",onContextMenuCapture:S=>{y.current=S.currentTarget.querySelector("button")},onKeyDown:S=>{if(S.key!=="ContextMenu"&&!(S.key==="F10"&&S.shiftKey))return;S.preventDefault();const q=S.currentTarget.getBoundingClientRect();S.currentTarget.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,clientX:q.left,clientY:q.bottom}))},children:_})}),e.jsxs(uo,{onCloseAutoFocus:S=>{const q=N.current;q&&(S.preventDefault(),N.current=null,requestAnimationFrame(()=>E(q)))},children:[e.jsx(En,{onSelect:()=>{N.current={kind:"edit",hex:I}},children:n("ui.settings.appearance.accent.edit_colour")}),e.jsx(En,{onSelect:()=>{N.current={kind:"rename",hex:I}},children:n("ui.settings.appearance.accent.rename")}),e.jsx(En,{destructive:!0,onSelect:()=>t.onRemove(I),children:n("ui.settings.appearance.accent.remove")})]})]},w.key)};return e.jsx(Ni,{children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs(il,{open:M!==null,onOpenChange:w=>{w||E(null)},children:[e.jsxs("div",{ref:h,role:"radiogroup","aria-label":n("ui.settings.appearance.accent.row_label"),onKeyDown:L,className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[b.map((w,G)=>F(w,G)),D.length>0&&e.jsx("span",{"aria-hidden":"true",className:"mx-1 h-6 w-px shrink-0 bg-hairline"}),D.map((w,G)=>F(w,b.length+G)),e.jsx(rl,{asChild:!0,children:e.jsx("span",{className:"inline-flex",children:e.jsx(Ye,{side:"bottom",content:n("ui.settings.appearance.accent.add"),children:e.jsx("button",{type:"button","aria-label":n("ui.settings.appearance.accent.add"),"data-accent-add":"",onClick:w=>{y.current=w.currentTarget,E({kind:"add"})},className:"flex size-8 shrink-0 items-center justify-center rounded-full text-ink-muted hover:text-ink",children:e.jsx("span",{className:"flex size-6 items-center justify-center rounded-full border border-control border-dashed",children:e.jsx(bn,{size:14})})})})})})]}),e.jsx(ol,{onCloseAutoFocus:w=>{w.preventDefault(),y.current?.focus()},align:"start",className:"w-66","aria-label":M?.kind==="rename"?n("ui.settings.appearance.picker.rename_dialog"):M?.kind==="edit"?n("ui.settings.appearance.picker.edit_dialog"):n("ui.settings.appearance.picker.dialog"),children:M?.kind==="rename"?e.jsx(xg,{initial:u[M.hex]??"",onCancel:()=>E(null),onSave:w=>{t.onRename(M.hex,w),E(null)}}):M?e.jsx(hg,{initial:M.kind==="edit"?M.hex:p,submitLabel:M.kind==="edit"?n("ui.settings.appearance.picker.save"):n("ui.settings.appearance.picker.add"),onCancel:()=>E(null),onSubmit:w=>{M.kind==="edit"?t.onReplace(M.hex,w):t.onAdd(w),E(null)}},M.kind==="edit"?M.hex:"add"):null})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-1",children:[e.jsx(O,{variant:"linkQuiet",size:"sm","aria-expanded":x,onClick:()=>j(w=>!w),children:x?n("ui.settings.appearance.accent.show_fewer"):n("ui.settings.appearance.accent.show_all")}),d.length>=Ir&&e.jsx("span",{className:"text-meta text-ink-dim",children:n("ui.settings.appearance.accent.limit")})]}),!f&&m.kind!=="theme"&&e.jsx("output",{className:"block px-1 text-meta text-warning",children:n("ui.settings.appearance.accent.not_applied")}),K&&e.jsx("p",{className:"px-1 text-meta text-ink-muted",children:K})]})})},hg=({initial:t,submitLabel:s,onSubmit:a,onCancel:i})=>{const[r,c]=o.useState(ts(t)??"#3B82F6"),[l,d]=o.useState(!0);return e.jsxs("form",{onSubmit:u=>{u.preventDefault(),l&&(Vi(r),a(r))},className:"flex flex-col gap-3",children:[e.jsx(Gi,{value:r,onChange:c,onValidityChange:d}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(O,{type:"button",variant:"ghost",size:"sm",onClick:i,children:n("ui.settings.appearance.picker.cancel")}),e.jsx(O,{type:"submit",variant:"primary",size:"sm",disabled:!l,children:s})]})]})},xg=({initial:t,onSave:s,onCancel:a})=>{const[i,r]=o.useState(t),c=o.useId();return e.jsxs("form",{className:"flex flex-col gap-3",onSubmit:l=>{l.preventDefault(),s(i)},children:[e.jsxs("label",{htmlFor:c,className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.settings.appearance.picker.name")}),e.jsx(Le,{id:c,inputSize:"sm",autoFocus:!0,maxLength:Or,value:i,onChange:l=>r(l.target.value)})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(O,{type:"button",variant:"ghost",size:"sm",onClick:a,children:n("ui.settings.appearance.picker.cancel")}),e.jsx(O,{type:"submit",variant:"primary",size:"sm",children:n("ui.settings.appearance.picker.save")})]})]})},_g=({previewTheme:t,className:s})=>(te(),e.jsx("section",{"aria-label":n("ui.settings.appearance.layers.preview_label"),"data-appearance-preview":"",className:pe("rounded-md border border-hairline",s),children:e.jsxs("div",{"data-theme":t,ref:yg,"aria-hidden":"true",className:pe("grid min-h-42 grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-3 rounded-md bg-canvas p-3 text-ink"),children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[e.jsx("div",{className:"self-end rounded-md bg-message-surface px-2.5 py-1.5 text-body-sm",children:n("ui.settings.appearance.layers.preview.user_message")}),e.jsxs("p",{className:"text-body-sm text-ink-muted",children:[n("ui.settings.appearance.layers.preview.agent_reply")," ",e.jsx("code",{className:"rounded-xs bg-sunken px-1 font-mono text-meta text-token-command",children:n("ui.settings.appearance.layers.preview.code")})]}),e.jsxs("div",{className:"mt-auto flex items-center gap-2 rounded-md border border-control bg-sunken px-2 py-1.5",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink-dim",children:n("ui.settings.appearance.layers.preview.composer_placeholder")}),e.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-sm bg-accent text-on-accent",children:e.jsx(Tc,{size:14})})]})]}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 rounded-md bg-surface p-1.5",children:[e.jsx("div",{className:"flex items-center rounded-sm px-2 py-1 text-body-sm text-ink-muted",children:e.jsx("span",{className:"truncate",children:n("ui.settings.appearance.layers.preview.row_inbox")})}),e.jsxs("div",{className:"flex items-center rounded-sm bg-row-hover px-2 py-1 text-body-sm text-ink",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:n("ui.settings.appearance.layers.preview.row_research")}),e.jsx(us,{count:3})]}),e.jsx("div",{className:"flex items-center rounded-sm bg-row-selected px-2 py-1 text-body-sm text-ink",children:e.jsx("span",{className:"truncate",children:n("ui.settings.appearance.layers.preview.row_release")})})]}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx("span",{className:"rounded-sm bg-accent px-2 py-0.5 text-meta text-on-accent",children:n("ui.settings.appearance.layers.preview.primary")}),e.jsx("span",{className:"rounded-sm border border-control bg-surface px-2 py-0.5 text-meta text-ink",children:n("ui.settings.appearance.layers.preview.secondary")}),e.jsx("span",{className:"rounded-sm bg-sunken px-2 py-0.5 text-ink-disabled text-meta",children:n("ui.settings.appearance.layers.preview.disabled")})]}),e.jsx(Bn,{tone:"success"}),e.jsx(Bn,{tone:"warning"}),e.jsx(Bn,{tone:"danger"})]})]})})),yg=t=>{t?.setAttribute("inert","")},bg={success:{icon:cl,className:"border-success-border bg-success-wash text-success",key:"ui.settings.appearance.layers.preview.success"},warning:{icon:Ci,className:"border-warning-border bg-warning-wash text-warning",key:"ui.settings.appearance.layers.preview.warning"},danger:{icon:Si,className:"border-danger-border bg-danger-wash text-danger",key:"ui.settings.appearance.layers.preview.danger"}},Bn=({tone:t})=>{const{icon:s,className:a,key:i}=bg[t];return e.jsxs("div",{className:pe("flex items-center gap-1.5 rounded-sm border px-2 py-0.5 text-meta",a),children:[e.jsx(s,{size:12,className:"shrink-0"}),e.jsx("span",{className:"truncate text-ink",children:n(i)})]})},vg={soft:"ui.settings.appearance.contrast.soft",gentle:"ui.settings.appearance.contrast.gentle",standard:"ui.settings.appearance.contrast.standard",strong:"ui.settings.appearance.contrast.strong",high:"ui.settings.appearance.contrast.high"},kg={soft:"ui.settings.appearance.contrast.soft_description",gentle:"ui.settings.appearance.contrast.gentle_description",standard:"ui.settings.appearance.contrast.standard_description",strong:"ui.settings.appearance.contrast.strong_description",high:"ui.settings.appearance.contrast.high_description"},Dt=t=>n(vg[t]),wa=t=>t>0?`+${t}`:String(t),Na=t=>{const s=ei(t);if(s)return Dt(s);const a=Fr(t);return a?n("ui.settings.appearance.contrast.value_between",{from:Dt(a[0]),to:Dt(a[1]),value:wa(t)}):wa(t)},jg=({committed:t,effective:s,mode:a,pending:i=!1,backgroundAtCeiling:r=!1,onDraft:c,onCommit:l})=>{te();const[d,u]=o.useState(null),m=d??t,p=o.useId(),g=o.useId(),f=o.useRef(m);f.current=m;const x=o.useRef(!1),[j,y]=o.useState({committed:t,mode:a,pending:i});(j.committed!==t||j.mode!==a||j.pending!==i)&&(y({committed:t,mode:a,pending:i}),(j.committed!==t||j.mode!==a||j.pending&&!i)&&u(null));const N=h=>{u(h),c(h)},M=h=>{h!==t?(N(h),l(h)):(u(null),c(null))},E=ei(m),T=E?null:Dr(m),R=s!==void 0&&!i&&d===null?s!==t:!1,D=h=>{if(h.button!==0)return;x.current=!0;const L=()=>{window.removeEventListener("pointerup",L),window.removeEventListener("pointercancel",L),x.current=!1,M(f.current)};window.addEventListener("pointerup",L),window.addEventListener("pointercancel",L)},b=h=>{let L=null;if(h.key==="PageUp")L=Gs(m,1);else if(h.key==="PageDown")L=Gs(m,-1);else if(h.key==="Home")L=-100;else if(h.key==="End")L=100;else if(h.key.startsWith("Arrow")){const F=getComputedStyle(h.currentTarget).direction==="rtl",w=h.key==="ArrowUp"||h.key==="ArrowRight"&&!F||h.key==="ArrowLeft"&&F,G=h.key==="ArrowDown"||h.key==="ArrowLeft"&&!F||h.key==="ArrowRight"&&F;w?L=An(m+Mn,{snap:!1}):G&&(L=An(m-Mn,{snap:!1}))}L!==null&&(h.preventDefault(),N(L))},z=h=>{(h.key.startsWith("Arrow")||h.key==="PageUp"||h.key==="PageDown"||h.key==="Home"||h.key==="End")&&M(f.current)},B=h=>{if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"].includes(h.key))return;h.preventDefault();const F=Rt.findIndex(_=>_.name===(E??T)),w=getComputedStyle(h.currentTarget).direction==="rtl",G=h.key==="ArrowDown"||h.key==="ArrowRight"!==w,P=Math.max(0,Math.min(Rt.length-1,F+(G?1:-1))),V=Rt[P];M(V.value),h.currentTarget.querySelectorAll("[role=radio]")[P]?.focus()},K=(m+100)/200*100;return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("h3",{id:g,className:"px-1 text-meta text-ink-dim",children:n("ui.settings.appearance.contrast.title")}),t!==0&&e.jsx(O,{variant:"link",size:"sm",onClick:()=>M(0),className:"min-h-6 min-w-6 text-meta",children:n("ui.settings.appearance.contrast.reset")})]}),e.jsx("div",{role:"radiogroup","aria-labelledby":g,onKeyDown:B,className:"grid grid-cols-5 gap-2",children:Rt.map(({name:h,value:L})=>{const F=E===h,w=T===h,G=F||E===null&&w;return e.jsx(Ye,{content:n(kg[h]),side:"bottom",children:e.jsxs("button",{type:"button",role:"radio","aria-checked":F,tabIndex:G?0:-1,"data-contrast-chip":h,onClick:()=>M(L),className:pe("relative flex h-13 min-w-0 flex-col gap-1 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart max-[900px]:h-12",F?"bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]":"hover:bg-surface"),children:[e.jsxs("span",{className:pe("relative block h-6 overflow-hidden rounded-sm border",F?"border-accent":"border-hairline"),children:[e.jsxs("span",{"data-theme":_n.chip(h),"aria-hidden":"true",className:"flex h-full flex-col justify-center gap-0.5 bg-canvas px-1.5",children:[e.jsx("span",{className:"block h-0.5 w-3/4 rounded-full bg-ink"}),e.jsx("span",{className:"block h-0.5 w-1/2 rounded-full bg-ink-muted"}),e.jsx("span",{className:"mt-0.5 block h-px w-full bg-border-control"})]}),F&&e.jsx("span",{className:"absolute end-0.5 top-0.5 flex size-3.5 items-center justify-center rounded-full bg-accent text-on-accent",children:e.jsx(Nn,{size:10,strokeWidth:3})})]}),e.jsx("span",{className:pe("truncate px-0.5 text-meta",F?"text-ink":"text-ink-muted"),children:w?n("ui.settings.appearance.contrast.adjusted",{preset:Dt(h)}):Dt(h)})]})},h)})}),e.jsx("output",{"aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Na(m)}),e.jsxs("div",{className:"flex items-center gap-3 px-1",children:[e.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:n("ui.settings.appearance.contrast.softer")}),e.jsx("input",{type:"range",min:-100,max:100,step:Mn,value:m,"aria-label":n("ui.settings.appearance.contrast.slider"),"aria-valuetext":Na(m),"aria-describedby":p,"data-contrast-slider":"",onPointerDown:D,onKeyDown:b,onKeyUp:z,onChange:h=>{const L=An(Number(h.target.value),{snap:x.current});x.current?N(L):M(L)},style:{"--fill":`${K}%`},className:"h-4 min-w-0 flex-1 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"}),e.jsx("span",{className:"shrink-0 text-meta text-ink-dim",children:n("ui.settings.appearance.contrast.deeper")})]}),e.jsx("p",{id:p,"aria-live":"polite",className:"px-1 text-meta text-ink-muted",children:i?n("ui.settings.appearance.contrast.applying"):R&&s!==void 0?n("ui.settings.appearance.contrast.capped_hint"):r?n("ui.settings.appearance.contrast.background_ceiling"):a==="dark"?n("ui.settings.appearance.contrast.applies_dark"):n("ui.settings.appearance.contrast.applies_light")})]})},Sa="lo-appearance-preview",Ca=t=>{let s=document.getElementById(Sa);if(!t){s?.remove();return}s||(s=document.createElement("style"),s.id=Sa,document.head.appendChild(s)),s.textContent!==t&&(s.textContent=t)},wg=t=>{if(t.identity)return null;const s=t.palette,a={};for(const i of $r)a[i]=s[i];return a},fs=new Set;let wn=null;const Wi=t=>{wn=t;for(const s of fs)s(t)},Ng=()=>{const[t,s]=o.useState(wn);return o.useEffect(()=>(fs.add(s),()=>{fs.delete(s)}),[]),t},Sg=t=>{const s=Ng(),a=Bi().palette,i=o.useMemo(()=>wg(t),[t]),r=o.useMemo(()=>a?Ws(a,Rt.map(({name:l,value:d})=>({id:_n.chip(l),contrast:d})),i):"",[a,i]),c=o.useRef(null);return o.useLayoutEffect(()=>{if(!a)return;const l=()=>{c.current=null;const d=wn===null?"":Ws(a,[{id:_n.strip,contrast:wn}],i);Ca(r+d)};c.current!==null&&cancelAnimationFrame(c.current),s===null?l():c.current=requestAnimationFrame(l)},[a,i,s,r]),o.useEffect(()=>()=>{c.current!==null&&cancelAnimationFrame(c.current),Ca("")},[]),s},Cg=()=>{const t=Ss(),s=Sg(t);return e.jsx("div",{className:"sticky top-0 z-10 -mx-1 border-hairline border-b bg-canvas px-1 pb-3",children:e.jsx(_g,{previewTheme:s===null?void 0:_n.strip})})},Mg=({title:t,action:s})=>e.jsxs("div",{className:"flex min-h-7 items-center justify-between gap-2 px-1 pb-2",children:[e.jsx("h3",{className:"text-meta text-ink-dim",children:t}),s]}),Ag=()=>{const t=xe(r=>r.setContrast),[s,a]=o.useState(!1);return{commit:o.useCallback((r,c)=>{a(!0),requestAnimationFrame(()=>requestAnimationFrame(()=>{t(r,c),Wi(null),a(!1)}))},[t]),pending:s}},Eg=()=>{te();const t=Ss(),s=xe(b=>b.themeName),a=xe(b=>b.contrast),i=xe(b=>b.accent),r=xe(b=>b.customAccents),c=xe(b=>b.customAccentNames),l=xe(b=>b.setAccent),d=xe(b=>b.addCustomAccent),u=xe(b=>b.replaceCustomAccent),m=xe(b=>b.renameCustomAccent),p=xe(b=>b.removeCustomAccent),{commit:g,pending:f}=Ag(),x=Bi(),j=x.palette,y=j?.mode??"dark",N=a[y]??0,M=i[y]??{kind:"theme"},E=o.useMemo(()=>Object.keys(We).map(b=>{const z=xt(b)?.palette;return z?{id:b,palette:z}:null}).filter(b=>!!b),[]),T=o.useMemo(()=>zr(E,y,s),[E,y,s]),R=o.useMemo(()=>Pr(E,y),[E,y]);if(!j)return null;const D=x.name;return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx("section",{"data-appearance-layer":"contrast",children:e.jsx(jg,{committed:N,effective:t.effectiveContrast,backgroundAtCeiling:y==="light"&&N>0&&t.palette.canvas.toUpperCase()===j.canvas.toUpperCase(),mode:y,pending:f,onDraft:Wi,onCommit:b=>g(y,b)})}),e.jsxs("section",{"data-appearance-layer":"accent",children:[e.jsx(Mg,{title:n("ui.settings.appearance.accent.title"),action:M.kind!=="theme"?e.jsx(O,{type:"button",variant:"link",size:"sm",className:"min-h-6 min-w-6",onClick:()=>l(y,{kind:"theme"}),children:n("ui.settings.appearance.accent.reset")}):null}),e.jsx(fg,{themeName:D,themeAccent:j.accent,themeAccentAlt:j.accentAlt,curated:T,all:R,paletteName:b=>We[b]?.name??b,custom:r,customNames:c,selected:M,paintedAccent:t.palette.accent,adjusted:t.accentAdjusted,applied:t.accentApplied,onSelect:b=>l(y,b),onAdd:b=>d(b,y),onReplace:u,onRename:m,onRemove:p})]})]})},Rg=()=>{te();const t=xe(d=>d.themeName),s=xe(d=>d.accent),a=xe(d=>d.customAccentNames),i=xe(d=>d.setAccent),r=xt(t)?.palette.mode??"dark",c=s[r],l=Ss();return!c||c.kind==="theme"||c.kind==="theme-alt"?null:e.jsxs("p",{className:"flex flex-wrap items-center gap-1.5 text-meta text-ink-muted",children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block size-3 rounded-full border border-hairline",style:{backgroundColor:l.palette.accent}}),e.jsx("span",{children:c.kind==="custom"?n("ui.settings.appearance.accent.override_notice",{colour:a[c.hex]??c.hex}):n("ui.settings.appearance.accent.palette_override_notice",{theme:We[c.id]?.name??c.id})}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx(O,{type:"button",variant:"link",size:"sm",className:"min-h-6 min-w-6",onClick:()=>i(r,{kind:"theme"}),children:n("ui.settings.appearance.accent.use_theme_accent")})]})},Ig=()=>(te(),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h3",{className:"px-1 text-meta text-ink-dim",children:n("ui.settings.appearance.layers.theme")}),e.jsx("div",{className:"px-1",children:e.jsx(Rg,{})})]})),Tg=({gallery:t})=>e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(Cg,{}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(Ig,{}),t]}),e.jsx(Eg,{})]}),Lg=[[[".claude.json"],"Claude Code"],[[".claude",".mcp.json"],"Claude Code"],[[".cursor","mcp.json"],"Cursor"],[[".vscode","mcp.json"],"VS Code"],[[".codex","config.toml"],"Codex CLI"]];function Yi(t){if(!t)return null;const s=t.split("\\").join("/").split("/").filter(Boolean);for(const[a,i]of Lg)if(!(s.length<a.length)&&s.slice(-a.length).join("/")===a.join("/"))return i;return null}const fn=t=>n("ui.settings.integrations.integration_model.tool_count",{count:t}),Og=t=>n("ui.settings.integrations.integration_model.integration_count",{count:t}),Dg=["connected","needs_sign_in","not_started","connecting","error"],Qi=t=>Dg.includes(t),kt=(t,s)=>[...s].filter(a=>a.name===t&&a.status==="running").sort((a,i)=>i.created_at-a.created_at)[0]??null,Fg={connectedAt:null,connectedToolCount:null,settledGroup:null,pinnedGroup:null,pinnedOperationId:null,needsKey:!1,needsSignIn:!1,disconnectedAt:null,holdUntil:null,lastDecisive:null},zg=1e12,Pg=1e9,$g=60*60*1e3,Zi=(t,s=Date.now())=>{if(typeof t!="number"||!Number.isFinite(t))return null;const a=t>=zg?t:t<Pg?null:t*1e3;return a===null||a>s+$g?null:Math.min(a,s)},dt=(t,s)=>t?.[s]??Fg,Ht=(t,s,a)=>Bg(t,s)??a?.lastDecisive??null,Ug=t=>({id:t.id,name:t.name,action:t.action,status:t.status,created_at:t.created_at,credential_removed:t.credential_removed,...t.message?{message:t.message}:{}}),Us=(t,s)=>t.status==="not_started"&&typeof t.tool_count=="number"&&(s.connectedAt!==null||t.status_basis==="stored"&&t.tool_count_basis==="last_seen"),Kg=(t,s)=>[...s].filter(a=>a.name===t).sort((a,i)=>i.created_at-a.created_at)[0]??null,Bg=(t,s)=>Kg(t,s.filter(a=>a.status!=="cancelled")),Sn=t=>t.actions.includes("set_key")||t.actions.includes("add_key");function qg(t,s){const a=Math.max(0,Math.round((t-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 qn(t){if(!t)return null;const s=t.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 Hg(t,s=[],a,i=Date.now()){const r=dt(a,t.name),c=kt(t.name,s);if(c){if(c.action==="login"||c.action==="reauth")return{label:n("ui.settings.integrations.integration_model.signing_in"),tone:"info",detail:null,busy:!0};if(c.action==="logout")return{label:n("ui.settings.integrations.integration_model.signing_out"),tone:"info",detail:null,busy:!0}}if(!Qi(t.status))return{label:n("ui.settings.integrations.integration_model.status_unavailable"),tone:"neutral",detail:null,busy:!1};const l=Ht(t.name,s,r),d=Cn(l)&&t.status!=="connected",u=Us(t,r),m=qs(l)&&t.status!=="connected",p=(l?.action==="login"||l?.action==="reauth")&&l.status==="failed";if(r.disconnectedAt!==null)return{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1,explanation:n(Ma)};switch(t.status){case"connected":return{label:typeof t.tool_count=="number"?n("ui.settings.integrations.integration_model.connected_with_tools",{tools:String(fn(t.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:t.auth.kind==="api_key"||Ft(t,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:qn(t.status_reason),busy:!1};case"error":return{label:n("ui.settings.integrations.integration_model.couldn_t_start"),tone:"danger",detail:qn(t.status_reason)??n("ui.settings.integrations.integration_model.no_reason_was_given"),busy:!1};default:if(d)return{label:n("ui.settings.integrations.integration_model.signed_out"),tone:"warning",detail:null,busy:!1};if(m)return{label:n("ui.settings.integrations.integration_model.sign_out_didn_t_finish"),tone:"warning",detail:n("ui.settings.integrations.integration_model.the_sign_in_is_still_saved"),busy:!1};if(Ft(t,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:t.auth.kind==="api_key"||Ft(t,s,r)?n("ui.settings.integrations.integration_model.needs_a_key"):n("ui.settings.integrations.integration_model.needs_sign_in"),tone:"warning",detail:qn(t.status_reason),busy:!1};if(t.status_basis==="stored"&&u&&r.disconnectedAt===null){const g=r.connectedAt??Zi(t.last_seen_at,i);return{label:g!==null?n("ui.settings.integrations.integration_model.worked_when_with_tools",{when:String(qg(i,g)),tools:String(fn(t.tool_count))}):n("ui.settings.integrations.integration_model.worked_earlier_with_tools",{tools:String(fn(t.tool_count))}),tone:"success",detail:null,busy:!1}}return t.status_basis==="live"?{label:n("ui.settings.integrations.integration_model.not_connected"),tone:"neutral",detail:null,busy:!1,explanation:n(Ma)}:{label:n("ui.settings.integrations.integration_model.ready"),tone:"neutral",detail:null,busy:!1,explanation:n(Wg)}}}const Ji=t=>n("ui.settings.integrations.integration_model.replace_keys",{count:t}),Vg=/[,;]?\s*(?:or|and)?\s*add (?:its|a|the) key instead\.?\s*$/i;function Gg(t,s){const a=t?.trim()??"";if(!a)return null;if(s)return a;const i=a.replace(Vg,"").trim();return i?/\.$/.test(i)?i:`${i}.`:a}const Wg="ui.settings.integrations.integration_model.copy_ready_explanation",Ma="ui.settings.integrations.integration_model.copy_not_connected_explanation",Yg=t=>t.transport==="local_command"?n("ui.settings.integrations.integration_model.local_command"):n("ui.settings.integrations.integration_model.remote_url");function Xi(t){switch(t.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 Yi(t.source.path)}}function Qg(t,s){const a=[{text:Yg(t),importSource:!1}];t.status!=="connected"&&t.tool_count_basis==="last_seen"&&typeof t.tool_count=="number"&&a.push({text:n("ui.settings.integrations.integration_model.tools_when_last_checked",{tools:String(fn(t.tool_count))}),importSource:!1}),s&&a.push({text:t.scope==="project"?n("ui.settings.integrations.integration_model.this_project"):n("ui.settings.integrations.integration_model.global"),importSource:!1});const i=Xi(t);return i?a.push({text:n("ui.settings.integrations.integration_model.imported_from_origin",{origin:String(i)}),importSource:!0}):t.source.editable||a.push({text:n("ui.settings.integrations.integration_model.imported_from_a_project_file"),importSource:!0}),a}const Ks=(t,s)=>s.disconnectedAt!==null?"not_started":t.status;function Bs(t,s=[],a){const i=dt(a,t.name),r=kt(t.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 c=p=>t.actions.includes(p),l=Sn(t),d=Ft(t,s,i);if(!Qi(t.status))return c("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.check_again")}:null;const u=Ht(t.name,s,i),m=u?.status==="failed"&&Vt(u);switch(Ks(t,i)){case"connected":case"connecting":return null;case"needs_sign_in":return d?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:c("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}:l?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:c("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 c("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}:c("test")?{kind:"test",label:n("ui.settings.integrations.integration_model.retry")}:{kind:"fix",label:n("ui.settings.integrations.integration_model.fix")};default:{if(Cn(u)&&c("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")};if(qs(u)&&c("sign_out"))return{kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out_again")};if(i.disconnectedAt!==null&&c("connect"))return{kind:"connect",label:n("ui.settings.integrations.integration_model.connect")};if(i.needsSignIn){if(d&&l)return{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")};if(c("sign_in"))return{kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}}return d&&l?{kind:"set_key",label:n("ui.settings.integrations.integration_model.add_key")}:m&&c("sign_in")?{kind:"sign_in",label:n("ui.settings.integrations.integration_model.try_again")}:Us(t,i)&&!c("connect")?null:c("connect")?{kind:"connect",label:n("ui.settings.integrations.integration_model.connect"),...i.connectedAt===null&&t.status_basis!=="live"?{variant:"ghost"}:{}}:c("test")&&t.tool_count===null&&t.tool_count_basis===null?{kind:"test",label:n("ui.settings.integrations.integration_model.test"),variant:"ghost"}:null}}}const Vt=t=>t.action==="login"||t.action==="reauth",Cn=t=>!!(t&&t.action==="logout"&&t.status==="complete"),qs=t=>!!(t&&t.action==="logout"&&t.status!=="running"&&t.status!=="complete"),er=/no oauth authorization server/i;function Ft(t,s,a){if(!Sn(t))return!1;const i=Ht(t.name,s,a);return i&&Vt(i)&&i.status==="failed"&&er.test(i.message??"")?!0:a.needsKey}function Zg(t,s=[],a){const i=Bs(t,s,a)?.kind,r=Ks(t,dt(a,t.name)),c=u=>t.actions.includes(u),l=[],d=kt(t.name,s);if(d&&l.push({kind:"cancel",label:n("ui.settings.integrations.integration_model.cancel")}),!d&&c("test")&&i!=="test"&&l.push({kind:"test",label:n("ui.settings.integrations.integration_model.test_connection")}),c("connect")&&i!=="connect"&&r!=="connected"&&l.push({kind:"connect",label:n("ui.settings.integrations.integration_model.reconnect")}),!d&&c("sign_in")&&i!=="sign_in"&&r!=="connected"&&l.push({kind:"sign_in",label:n("ui.settings.integrations.integration_model.sign_in")}),c("reload")&&l.push({kind:"reload",label:n("ui.settings.integrations.integration_model.reload")}),!d&&c("reauth")&&i!=="reauth"&&l.push({kind:"reauth",label:n("ui.settings.integrations.integration_model.sign_in_again")}),Sn(t)&&i!=="set_key"&&l.push({kind:"set_key",label:t.auth.secret_refs.length>0?n("ui.settings.integrations.integration_model.update_key"):n("ui.settings.integrations.integration_model.add_key")}),c("sign_out")&&l.push({kind:"sign_out",label:n("ui.settings.integrations.integration_model.sign_out")}),c("disconnect")&&r==="connected"&&l.push({kind:"disconnect",label:n("ui.settings.integrations.integration_model.disconnect")}),c("copy_setup")&&t.setup_prompt&&l.push({kind:"copy_setup",label:n("ui.settings.integrations.integration_model.copy_setup_prompt")}),i!=="fix"&&l.push({kind:"open_config",label:n("ui.settings.integrations.integration_model.open_config_file")}),c("remove"))l.push({kind:"remove",label:n("ui.settings.integrations.integration_model.remove"),destructive:!0});else if(!t.source.editable){const u=Xi(t);l.push({kind:"remove_elsewhere",label:u?n("ui.settings.integrations.integration_model.remove_in_origin",{origin:String(u)}):n("ui.settings.integrations.integration_model.remove_in_its_own_file"),hint:u?n("ui.settings.integrations.integration_model.defined_in_origin_s_config_remove_it_there",{origin:String(u)}):n("ui.settings.integrations.integration_model.defined_in_a_file_this_app_doesn_t_write_remove_it_there")})}return l}const Jg={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 tr(t,s=[],a){const i=dt(a,t.name),r=kt(t.name,s),c=Ks(t,i);if(r&&i.pinnedGroup&&i.pinnedOperationId===r.id)return i.pinnedGroup;if(c==="needs_sign_in"||c==="error")return"attention";const l=Ht(t.name,s,i);return Cn(l)&&c!=="connected"||qs(l)&&c!=="connected"?"attention":i.disconnectedAt!==null?"ready":Ft(t,s,i)||i.needsSignIn&&c!=="connected"||l?.status==="failed"&&Vt(l)&&c!=="connected"?"attention":c==="connected"||t.status_basis==="stored"&&Us(t,i)?"connected":r&&r.action!=="test"?"attention":"ready"}function Xg(t,s=[],a){return["attention","connected","ready"].map(r=>({id:r,title:Jg[r],rows:t.filter(c=>tr(c,s,a)===r)})).filter(r=>r.rows.length>0)}function ep(t,s,a=Date.now()){if(!s)return t??{};const i={};for(const r of s.servers){const c=dt(t,r.name),l=kt(r.name,s.operations),d=Ht(r.name,s.operations,c),u=Cn(d),m=r.status==="connected"&&(r.status_basis==="probe"||r.status_basis==="live"),p=c.holdUntil!==null&&a<c.holdUntil,g=!p&&!u&&c.connectedAt===null&&r.status_basis==="stored"&&r.tool_count_basis==="last_seen"?Zi(r.last_seen_at,a):null,f=!u,x=d?.status==="failed"&&Vt(d)&&er.test(d.message??""),j={connectedAt:m&&!p?a:g!==null?g:f?c.connectedAt:null,connectedToolCount:m&&!p||g!==null?r.tool_count??c.connectedToolCount:f?c.connectedToolCount:null,settledGroup:c.settledGroup,pinnedGroup:l&&c.pinnedOperationId===l.id?c.pinnedGroup:l?c.settledGroup:null,pinnedOperationId:l?l.id:null,needsKey:m?!1:c.needsKey||x,needsSignIn:m||u?!1:c.needsSignIn||r.status==="needs_sign_in",disconnectedAt:m&&!p?null:c.disconnectedAt,holdUntil:p?c.holdUntil:null,lastDecisive:d?Ug(d):null};l||(j.settledGroup=tr(r,s.operations,{...i,[r.name]:j})),i[r.name]=j}return i}const tp=(t,s)=>t!==null&&s===t,hs="local-operator.settings.integrations.row-memory",nr=(t,s)=>`${t}#${s}`;function np(t,s){const a={};if(!s)return a;for(const i of s.servers){const r=t[i.name];r&&(a[nr(i.source.path,i.name)]=r)}return a}function sp(t,s,a){if(!s)return t;let i=null;for(const r of s.servers){if(Object.prototype.hasOwnProperty.call(t,r.name))continue;const c=rp(a[nr(r.source.path,r.name)]);c&&(i=i??{...t},i[r.name]=c)}return i??t}const ap=["attention","connected","ready"],sr=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Hs=t=>typeof t=="number"&&Number.isFinite(t)?t:null,Aa=t=>ap.includes(t)?t:null,Hn=t=>{const s=Hs(t);return s!==null&&s>=1e12?s:null};function ip(t){if(!sr(t)||typeof t.id!="string"||typeof t.name!="string")return null;const s=t.action,a=t.status;return s!=="login"&&s!=="logout"&&s!=="reauth"&&s!=="test"||a!=="running"&&a!=="complete"&&a!=="cancelled"&&a!=="failed"?null:{id:t.id,name:t.name,action:s,status:a,created_at:Hs(t.created_at)??0,credential_removed:t.credential_removed===!0,...typeof t.message=="string"?{message:t.message}:{}}}function rp(t){if(!sr(t))return null;const s=Hn(t.connectedAt),a=Hn(t.disconnectedAt),i=t.needsKey===!0,r=t.needsSignIn===!0,c=ip(t.lastDecisive);return s===null&&a===null&&!i&&!r&&!c?null:{connectedAt:s,connectedToolCount:Hs(t.connectedToolCount),settledGroup:Aa(t.settledGroup),pinnedGroup:Aa(t.pinnedGroup),pinnedOperationId:typeof t.pinnedOperationId=="string"?t.pinnedOperationId:null,needsKey:i,needsSignIn:r,disconnectedAt:a,holdUntil:Hn(t.holdUntil),lastDecisive:c}}const ar=2e3,Ea=8e3;function op(t){return t&&(t.servers.some(a=>a.status==="connecting")||t.operations.some(a=>a.status==="running"))?ar:!1}const cp=/^[A-Za-z0-9_.:-]{1,100}$/,lp=/:\/\//;function dp(t,s){const a=t.trim();return a?cp.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 up(t){const s=t.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"):lp.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 mp=t=>t.split(`
|
|
297
|
+
`).map(s=>s.trim()).filter(Boolean);function xs(t,s){const a=!!t?.cold,i=(t?.servers??[]).map(r=>{const c=r.transport==="http",l=r.secret_refs??[],d=r.status==="connected"?"connected":r.status==="connecting"?"connecting":r.status==="auth-required"?"needs_sign_in":"not_started",u=[];d!=="connected"&&u.push("connect"),d==="connected"&&u.push("disconnect"),a||u.push("reload"),c&&r.transport_oauth_supported!==!1&&u.push("sign_in"),l.length>0&&u.push("set_key"),r.owned_scope&&u.push("remove"),r.setup?.text&&u.push("copy_setup");const m=Yi(r.source);return{id:r.name,name:r.name,scope:r.owned_scope??"global",project_cwd:null,source:{kind:gp(r.source,m,r.owned_scope),path:r.source??"",editable:r.owned_scope!==null,owned_scope:r.owned_scope},transport:c?"remote_url":"local_command",endpoint:{command:null,url:null,endpoint_redacted:!1},status:d,status_reason:null,status_observed_at:null,last_seen_at:null,status_basis:a?"stored":"live",auth:{kind:l.length?"api_key":c?"unknown":"none",signed_in:null,secret_refs:l.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:u,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:(t?.operations??[]).map(r=>({...r}))}}const gp=(t,s,a)=>s==="Claude Code"?"claude-code":s==="Cursor"?"cursor":s==="VS Code"?"vscode":s==="Codex CLI"?"codex":a?"local-operator":t?"project-mcp-json":"local-operator",Ra={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")}},pp="ui.settings.integrations.integration_model.copy_catalog_refusal_fallback";function en(t,s,a){if(s instanceof ys&&s.status===409){const i=typeof s.code=="string"&&Object.prototype.hasOwnProperty.call(Ra,s.code)?Ra[s.code]:n(pp);return`${mo[t]}. ${i}`}return go(t,s,a).message}const fp="ui.settings.integrations.add_integration_form.copy_add_integration_pickup_note",hp="ui.settings.integrations.add_integration_form.copy_transport_hint",xp=({existingNames:t,projectScopeAvailable:s,projectLabel:a,onSubmit:i,onCancel:r,initial:c})=>{te();const[l,d]=o.useState(c?.name??""),[u,m]=o.useState(c?.mode??"command"),[p,g]=o.useState(c?.command??""),[f,x]=o.useState(c?.args??""),[j,y]=o.useState(c?.url??""),[N,M]=o.useState("global"),[E,T]=o.useState(c?.touched?{name:!0,command:!0,url:!0}:{}),[R,D]=o.useState(!!c?.touched),[b,z]=o.useState(!1),[B,K]=o.useState(null),h=o.useRef(null),L=o.useRef(null),F=o.useRef(null);o.useEffect(()=>{h.current?.focus()},[]);const w=dp(l,t),G=u==="command"&&!p.trim()?n("ui.settings.integrations.add_integration_form.enter_the_command_to_run"):null,P=u==="url"?up(j):null,V=S=>R||E[S],Z=async S=>{if(S.preventDefault(),D(!0),w||G||P){w?h.current?.focus():G?L.current?.focus():F.current?.focus();return}z(!0),K(null);const q=s?N:"global",ae=u==="command"?{name:l.trim(),scope:q,mode:u,command:p.trim(),args:mp(f)}:{name:l.trim(),scope:q,mode:u,url:j.trim()},Y=await i(ae);z(!1),K(Y)},_=(S,q,ae)=>q&&V(ae)?e.jsx("p",{id:S,className:"text-body-sm text-danger",children:q}):null,I=S=>S.preventDefault();return e.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:S=>void Z(S),onKeyDown:S=>{S.key==="Escape"&&(S.stopPropagation(),r())},children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(qe,{htmlFor:"integration-add-name",children:n("ui.settings.integrations.add_integration_form.name")}),e.jsx(Le,{ref:h,id:"integration-add-name",value:l,placeholder:n("ui.settings.integrations.add_integration_form.e_g_notion"),autoComplete:"off","aria-invalid":!!(w&&V("name")),"aria-describedby":w&&V("name")?"integration-add-name-error":void 0,onChange:S=>d(S.target.value),onBlur:()=>T(S=>({...S,name:!0}))}),_("integration-add-name-error",w,"name")]}),e.jsxs(Ut,{value:u,onValueChange:S=>m(S==="url"?"url":"command"),className:"flex flex-col gap-1.5",children:[e.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")}),e.jsxs(Kt,{"aria-labelledby":"integration-add-transport-label",children:[e.jsx(ct,{value:"command","data-integration-transport":"command",children:n("ui.settings.integrations.add_integration_form.local_command")}),e.jsx(ct,{value:"url","data-integration-transport":"url",children:n("ui.settings.integrations.add_integration_form.remote_url")})]}),e.jsx("p",{className:"text-ink-dim text-meta",children:n(hp)}),e.jsxs(ra,{value:"command",className:"mt-0 flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(qe,{htmlFor:"integration-add-command",children:n("ui.settings.integrations.add_integration_form.command")}),e.jsx(Le,{ref:L,id:"integration-add-command",value:p,placeholder:n("ui.settings.integrations.add_integration_form.e_g_npx"),autoComplete:"off",className:"font-mono","aria-invalid":!!(G&&V("command")),"aria-describedby":G&&V("command")?"integration-add-command-error":void 0,onChange:S=>g(S.target.value),onBlur:()=>T(S=>({...S,command:!0}))}),_("integration-add-command-error",G,"command")]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(qe,{htmlFor:"integration-add-args",children:[n("ui.settings.integrations.add_integration_form.arguments")," ",e.jsx("span",{className:"font-normal text-ink-dim",children:n("ui.settings.integrations.add_integration_form.one_per_line")})]}),e.jsx(Ls,{id:"integration-add-args",value:f,rows:2,className:"font-mono",onChange:S=>x(S.target.value)})]})]}),e.jsx(ra,{value:"url",className:"mt-0 flex flex-col gap-4",children:e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(qe,{htmlFor:"integration-add-url",children:n("ui.settings.integrations.add_integration_form.url")}),e.jsx(Le,{ref:F,id:"integration-add-url",type:"url",value:j,placeholder:n("ui.settings.integrations.add_integration_form.https_mcp_example_com_mcp"),autoComplete:"off",className:"font-mono","aria-invalid":!!(P&&V("url")),"aria-describedby":P&&V("url")?"integration-add-url-error":"integration-add-url-help",onChange:S=>y(S.target.value),onBlur:()=>T(S=>({...S,url:!0}))}),_("integration-add-url-error",P,"url")??e.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?e.jsxs(Ut,{value:N,onValueChange:S=>M(S==="project"?"project":"global"),className:"flex flex-col gap-1.5",children:[e.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")}),e.jsxs(Kt,{"aria-labelledby":"integration-add-scope-label",children:[e.jsx(ct,{value:"global","data-integration-scope":"global",children:n("ui.settings.integrations.add_integration_form.all_chats")}),e.jsx(ct,{value:"project","data-integration-scope":"project",children:n("ui.settings.integrations.add_integration_form.this_project")})]}),a?e.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,B?e.jsx("p",{className:"text-body-sm text-danger",role:"alert",children:B}):null,e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:pe("text-body-sm text-ink-dim"),children:n(fp)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(O,{type:"button",variant:"ghost",size:"md",onMouseDown:I,onClick:r,children:n("ui.settings.integrations.add_integration_form.cancel")}),e.jsxs(O,{type:"submit",variant:"primary",size:"md",disabled:b,onMouseDown:I,children:[b?e.jsx(Ce,{size:"xs"}):null,n("ui.settings.integrations.add_integration_form.add_integration")]})]})]})]})},_p=4;function yp(t){return t.rowMoving?t.now+t.windowMs:Math.max(t.hold.until,t.lastMovingAt+t.windowMs)}function bp(t){return t.now>t.hold.until||t.hold.reanchors>=_p?"drop":t.hold.landedOn.isConnected&&(!t.candidate||t.candidate===t.hold.landedOn)?"settled":t.active&&t.active!==t.body&&t.active!==t.hold.landedOn?"drop":t.candidate?.isConnected?"restore":"drop"}function vp(t){const s=yp({hold:t.hold,now:t.now,windowMs:t.windowMs,rowMoving:t.rowMoving,lastMovingAt:t.lastMovingAt});if(t.now>s)return{hold:null,land:null};const a=t.hold.landedOn??null,i=t.candidate;if(!i)return{hold:{until:s,reanchors:t.hold.reanchors,landedOn:a},land:null};if(!a)return{hold:{until:s,reanchors:t.hold.reanchors,landedOn:i},land:i};const r=bp({hold:{until:s,reanchors:t.hold.reanchors,landedOn:a},candidate:i,active:t.active,body:t.body,now:t.now});if(r==="settled")return{hold:{until:s,reanchors:t.hold.reanchors,landedOn:a},land:null};if(r==="drop")return{hold:null,land:null};const c=!a.isConnected;return{hold:{until:c?t.now+t.windowMs:s,reanchors:c?t.hold.reanchors+1:t.hold.reanchors,landedOn:i},land:i}}function kp(t){const{row:s,target:a}=t;return!s||!a||typeof a.nodeType!="number"?!1:!s.contains(a)}const Ia=250;function Ta(t){return t?!t.disabled:!1}function jp(t){return Ta(t.primary)?t.primary??null:Ta(t.overflow)?t.overflow??null:null}function wp(t){return t.verdict==="finished"?null:t.watchMs}const ir="key";function Np(t){const{name:s,keyless:a,freeName:i,names:r,values:c,replace:l,canReplace:d}=t;if(a){const u=_s(s,i);return{values:{[u]:(c[ir]??"").trim()},confirmedReplace:l&&d?[u]:[],header:i.trim()}}return{values:Object.fromEntries(r.map(u=>[u,(c[u]??"").trim()])),confirmedReplace:l&&d?r:[],header:void 0}}function _s(t,s){const a=La(t),i=La(s);if(!i)return"";const r=[a,i].filter(Boolean).join("_"),c=/^[A-Za-z_]/.test(r)?r:`K_${r}`;if(c.length<=Vn)return c;const l=Sp(a),d=Vn-i.length-l.length-2,u=[a.slice(0,Math.max(d,0)),l,i].filter(Boolean).join("_");return u.length<=Vn?u:u.slice(-128)}const Vn=128,La=t=>t.trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,""),Sp=t=>{let s=2166136261;for(let a=0;a<t.length;a+=1)s^=t.charCodeAt(a),s=Math.imul(s,16777619)>>>0;return s.toString(36).toUpperCase().slice(0,5)},Cp=({name:t,keyNames:s,keyless:a=!1,savedKeys:i=[],saving:r,failure:c,onSave:l,onClose:d})=>{te();const[u,m]=o.useState({}),[p,g]=o.useState(!1),[f,x]=o.useState(""),j=a?[_s(t,f)]:[...s],y=a?[ir]:j,N=(a?_s(t,f).length>0:!0)&&y.every(E=>(u[E]??"").trim()),M=j.some(E=>i.includes(E));return e.jsx(di,{open:!0,onClose:d,maxWidth:"xs",title:n("ui.settings.integrations.integration_key_dialog.add_keys_heading",{count:a?1:s.length,name:t}),actions:e.jsxs(e.Fragment,{children:[e.jsx(is,{onClick:d,children:n("ui.settings.integrations.integration_key_dialog.cancel")}),e.jsx(rs,{disabled:!N||r,onClick:()=>{const E=Np({name:t,keyless:a,freeName:f,names:j,values:u,replace:p,canReplace:M});l(E.values,E.confirmedReplace,E.header)},children:r?n("ui.settings.integrations.integration_key_dialog.saving"):n("ui.settings.integrations.integration_key_dialog.save_and_test")})]}),children:e.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted",children:[e.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?e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(qe,{htmlFor:"integration-key-name",children:n("ui.settings.integrations.integration_key_dialog.the_header_this_server_wants_the_key_in")}),e.jsx(Le,{id:"integration-key-name",autoComplete:"off",placeholder:n("ui.settings.integrations.integration_key_dialog.e_g_authorization_or_x_api_key"),value:f,onChange:E=>x(E.target.value)}),e.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,y.filter(E=>a!==!0||E.trim().length>0).map(E=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(qe,{htmlFor:`integration-key-${E}`,className:"font-mono",children:a?"Key":E}),e.jsx(Le,{id:`integration-key-${E}`,type:"password",autoComplete:"off",value:u[E]??"",onChange:T=>m(R=>({...R,[E]:T.target.value}))})]},E)),M?e.jsxs("div",{className:"flex items-center gap-2 text-body-sm",children:[e.jsx(ds,{id:"integration-key-replace",checked:p,onCheckedChange:E=>g(E===!0)}),e.jsx(qe,{htmlFor:"integration-key-replace",className:"font-normal",children:Ji(j.length)})]}):null,c?e.jsx("p",{className:"-mx-1.5 text-body-sm text-danger",role:"alert",children:c}):null]})})},Mp={success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",neutral:"bg-ink-dim"},Ap={success:"text-ink-muted",warning:"text-warning",danger:"text-danger",info:"text-ink-muted",neutral:"text-ink-dim"},Ep=({row:t,operations:s,memories:a,now:i,projectScopeAvailable:r,highlighted:c=!1,rowRef:l,primaryRef:d,overflowRef:u,pending:m,failure:p,confirm:g,onPrimary:f,onOverflow:x,onConfirm:j,onCancelConfirm:y})=>{te();const N=Hg(t,s,a,i),M=c&&N.tone==="danger"?"text-ink":Ap[N.tone],E=Bs(t,s,a),T=Zg(t,s,a),R=Qg(t,r),D=T.findIndex(b=>b.kind==="remove"||b.kind==="remove_elsewhere");return e.jsxs("li",{ref:l,"data-integration":t.name,"data-search-row":`integration.${t.id}`,"data-search-control":!0,"data-status":t.status,className:pe("flex min-h-14 flex-col justify-center gap-1 px-4 py-2.5",c&&"bg-row-selected"),onKeyDown:b=>{!g||b.key!=="Escape"||(b.stopPropagation(),y())},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:N.busy?e.jsx(Ce,{size:"xs"}):e.jsx("span",{"aria-hidden":"true","data-tone":N.tone,className:pe("size-2 rounded-full",Mp[N.tone])})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{className:"truncate font-medium text-body text-ink",title:t.name,children:t.name}),e.jsx("span",{className:"truncate text-ink-dim text-meta",children:R.map((b,z)=>e.jsxs("span",{children:[z>0?" · ":null,b.importSource&&t.source.path?e.jsx(Ye,{content:Ur(t.source.path),children:e.jsx("span",{className:"underline decoration-dotted underline-offset-2",children:b.text})}):b.text]},b.text))})]}),N.explanation?e.jsx(Ye,{content:N.explanation,children:e.jsx("span",{className:pe("shrink-0 text-body-sm",M),children:N.label})}):e.jsx("span",{className:pe("shrink-0 text-body-sm",M),children:N.label}),E?e.jsxs(O,{ref:d,variant:E.variant??"secondary",size:"sm","aria-label":`${E.label} ${t.name}`,disabled:m,"data-integration-action":E.kind,onClick:()=>f(E),children:[m?e.jsx(Ce,{size:"xs"}):null,E.label]}):null,e.jsxs(Os,{children:[e.jsx(Ds,{asChild:!0,children:e.jsx(O,{ref:u,variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_row.more_actions_for_name",{name:String(t.name)}),disabled:m,children:e.jsx(Cs,{"aria-hidden":"true"})})}),e.jsx(Fs,{align:"end",className:"min-w-48",children:T.map((b,z)=>e.jsx(Rp,{item:b,separated:z===D&&z>0,onSelect:()=>x(b)},b.kind))})]})]}),N.detail?e.jsx("p",{className:pe("ps-7 text-body-sm",N.tone==="danger"?"text-ink-muted":"text-ink-dim"),children:N.detail}):null,p?e.jsx("p",{className:pe("ps-7 text-body-sm",c?"text-ink":"text-danger"),role:"alert",children:p}):null,g?e.jsxs("div",{className:"flex flex-wrap items-center gap-2 ps-7",children:[e.jsx("span",{className:"text-body-sm text-ink",children:g.kind==="remove"?n("ui.settings.integrations.integration_row.remove_name",{name:String(t.name)}):n("ui.settings.integrations.integration_row.sign_out_of_name",{name:String(t.name)})}),e.jsx("span",{className:"text-body-sm text-ink-muted",children:g.kind==="remove"?n("ui.settings.integrations.integration_row.agents_in_every_chat_lose_access_to_name",{name:String(t.name)}):t.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")}),e.jsx(O,{variant:"danger",size:"sm",onClick:j,"data-integration-confirm":g.kind,children:g.kind==="remove"?n("ui.settings.integrations.integration_row.remove"):n("ui.settings.integrations.integration_row.sign_out")}),e.jsx(O,{variant:"ghost",size:"sm",onClick:y,children:n("ui.settings.integrations.integration_row.keep")})]}):null]})},Rp=({item:t,separated:s,onSelect:a})=>(te(),e.jsxs(e.Fragment,{children:[s?e.jsx(ll,{}):null,t.kind==="remove_elsewhere"?e.jsxs(nt,{disabled:!0,className:"flex-col items-start gap-0.5",children:[e.jsx("span",{children:t.label}),e.jsx("span",{className:"text-meta text-ink-dim",children:t.hint})]}):e.jsx(nt,{destructive:t.kind==="remove",onSelect:a,"data-integration-menu":t.kind,children:t.label})]}));function Ip(t,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(t)}),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(t)}),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(t)}),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:Gg(s.message,a)??n("ui.settings.integrations.integration_sign_in_dialog.the_server_didn_t_say_why"),nextStep:Tp(s.message??null,a)}}function Tp(t,s){const a=(t??"").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 Lp(t,s){return t.kind==="ready"?"ready":t.kind==="running"&&s&&s.tone!=="progress"?s.tone==="success"?"success":"failure":"running"}const Op=({name:t,action:s,keyRoute:a,phase:i,onStart:r,onCancel:c,onOpenLink:l,onClose:d})=>{te();const u=i.kind==="running"?i.operation:null,m=i.kind==="running"?Ip(t,u,a):null,p=i.kind==="starting"||i.kind==="running"&&m?.tone==="progress",g=m&&m.tone!=="progress",f=o.useRef(null),x=o.useRef(!1),j=Lp(i,m);o.useEffect(()=>{if(!x.current){x.current=!0;return}j&&f.current?.focus()},[j]);const y=()=>d(m?.tone==="success"?"signed-in":"dismissed");return e.jsx(di,{open:!0,onClose:y,maxWidth:"xs",fullWidth:!0,title:n("ui.settings.integrations.integration_sign_in_dialog.sign_in_to_name",{name:String(t)}),dialogProps:{onOpenAutoFocus:N=>{N.preventDefault(),f.current?.focus()}},actions:e.jsxs(e.Fragment,{children:[p&&u?e.jsx(is,{ref:f,onClick:()=>c(u.id),children:n("ui.settings.integrations.integration_sign_in_dialog.cancel_sign_in")}):e.jsx(is,{ref:i.kind==="ready"?void 0:f,onClick:y,children:m?.tone==="success"?n("ui.settings.integrations.integration_sign_in_dialog.done"):n("ui.settings.integrations.integration_sign_in_dialog.close")}),i.kind==="ready"?e.jsx(rs,{ref:f,onClick:r,children:n("ui.settings.integrations.integration_sign_in_dialog.continue_in_browser")}):null,i.kind==="refused"||m?.tone==="failure"?e.jsx(rs,{ref:m?.tone==="failure"?f:void 0,onClick:r,children:n("ui.settings.integrations.integration_sign_in_dialog.try_again")}):null]}),children:e.jsxs("div",{className:"flex flex-col gap-3 p-1.5 text-body text-ink-muted","aria-live":"polite",children:[i.kind==="ready"?e.jsx("p",{className:"-mx-1.5",children:n("ui.settings.integrations.integration_sign_in_dialog.browser_approval_notice",{name:t,replaces:s==="reauth"?"yes":"no"})}):null,i.kind==="starting"?e.jsxs("p",{className:"-mx-1.5 flex items-center gap-2",children:[e.jsx(Ce,{size:"xs"}),n("ui.settings.integrations.integration_sign_in_dialog.starting_sign_in")]}):null,m?e.jsxs("div",{className:"flex flex-col gap-1",role:g?"status":void 0,children:[e.jsxs("p",{className:(m.tone==="success","-mx-1.5 flex items-start gap-2 text-ink"),children:[m.tone==="progress"?e.jsx(Ce,{size:"xs",className:"mt-0.5"}):null,m.tone==="failure"?e.jsx(Ci,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-danger"}):null,e.jsx("span",{children:m.message})]}),m.reason?e.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.reason}):null,m.nextStep?e.jsx("p",{className:"-mx-1.5 text-ink-muted",children:m.nextStep}):null]}):null,m?.link&&m.tone==="progress"?e.jsxs("div",{className:"flex flex-col items-start gap-1",children:[e.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-ink-dim text-mono-sm",title:m.link,children:m.link}),e.jsx(O,{variant:"ghost",size:"icon-sm","aria-label":n("ui.settings.integrations.integration_sign_in_dialog.copy_the_sign_in_link"),title:n("ui.settings.integrations.integration_sign_in_dialog.copy_the_sign_in_link"),onClick:()=>{navigator.clipboard.writeText(m.link??"").then(()=>os(n("ui.settings.integrations.integration_sign_in_dialog.sign_in_link_copied"))).catch(()=>{})},children:e.jsx(li,{"aria-hidden":"true"})})]}),e.jsx(O,{variant:"link",size:"sm",onClick:()=>l(m.link??""),children:n("ui.settings.integrations.integration_sign_in_dialog.open_the_sign_in_page")})]}):null,i.kind==="refused"?e.jsx("p",{className:"text-danger",role:"alert",children:i.message}):null]})})},Dp=t=>t.reduce((s,a)=>s?(a.updated_at??0)>(s.updated_at??0)?a:s:a,null),Fp=/^[A-Za-z]:[\\/]/,hn=t=>{const s=t?.trim();return s&&(s.startsWith("/")||Fp.test(s))?s:null};function zp(t){const r=t?.payload?.frontend?.snapshot?.cwd;return typeof r=="string"&&r.trim()?r:null}const Bt="local-operator.settings.integrations.last-cwd";function Pp(t,s,a=typeof localStorage>"u"?null:localStorage){const i=hn(s);if(!(!t||!i||!a))try{const r=a.getItem(Bt),c=r?JSON.parse(r):{};if(c[t]===i)return;a.setItem(Bt,JSON.stringify({...c,[t]:i}))}catch{}}const rr=()=>typeof localStorage>"u"?null:localStorage;function or(t=rr()){if(!t)return{};try{const s=t.getItem(hs);if(!s)return{};const a=JSON.parse(s);return!a||typeof a!="object"||Array.isArray(a)?{}:a}catch{return{}}}const Oa=256;function $p(t,s=rr()){if(s)try{const a={...or(s),...t},i=Object.keys(a);if(i.length>Oa){const r={};for(const c of i.slice(-Oa))r[c]=a[c];s.setItem(hs,JSON.stringify(r));return}s.setItem(hs,JSON.stringify(a))}catch{}}function Da(t,s,a){if(t==="saved")return null;if(t==="replace_confirmation_required"){const r=Ji(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(t==="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 Up(t,s=typeof localStorage>"u"?null:localStorage){if(!(!t||!s))try{const a=s.getItem(Bt);if(!a)return;const i=JSON.parse(a);if(!(t in i))return;const r={...i};delete r[t],s.setItem(Bt,JSON.stringify(r))}catch{}}const Kp=t=>!!(t&&typeof t=="object"&&"code"in t&&t.code==="invalid_cwd"),Bp=(t,s)=>s!==null&&t===s?null:t;function qp(t,s=typeof localStorage>"u"?null:localStorage){if(!t||!s)return null;try{const a=s.getItem(Bt);if(!a)return null;const r=JSON.parse(a)[t];return typeof r=="string"?r:null}catch{return null}}const Hp=t=>t.action==="disconnect"?"disconnected":"connected";function Vp(t){switch(t.action){case"cancel":return{action:"cancel",operation_id:t.operationId};case"connect":case"disconnect":case"reload":return null;case"test":return{action:"test",name:t.name};default:return{...t,confirmed:!0}}}function Gp(t){switch(t.action){case"cancel":return{action:"cancel",operation_id:t.operationId};case"test":case"connect":return{action:"connect",name:t.name};case"reload":return{action:"reload",name:t.name};case"add":return t;case"remove":return{...t,confirmed:!0};default:return{action:t.action,name:t.name,confirmed:!0}}}function Wp({sessionId:t}){const s=vt(),a=_t(s.data,"mcp_catalog"),i=_t(s.data,"mcp"),r=a?"catalog":i?"session":null,[c,l]=o.useState(null),d=bt(),u=Tt($=>$.sessions),m=Tt($=>$.fetchSessions),p=Tt($=>$.loading),g=o.useMemo(()=>u.find($=>$.session_id===t)??null,[u,t]),f=o.useMemo(()=>r==="session"&&!t?Dp(u):null,[r,t,u]),x=r==="session"?t??f?.session_id??null:null;o.useEffect(()=>{r!=="session"||t||u.length>0||m(Kr)},[r,t,u.length,m]);const j=r==="catalog"?hn(g?.cwd):null,y=r==="catalog"&&!!t&&j===null,N=Fe({queryKey:["desktop","session-cwd",t??""],queryFn:()=>je({op:"sessions.get",sessionId:t??""}),enabled:y,staleTime:Number.POSITIVE_INFINITY,retry:!1}),M=y&&!N.isFetched,E=j??hn(zp(N.data))??(N.isFetched?hn(qp(t)):null),T=Bp(E,c),R=r==="catalog"?T:null,D=r==="catalog"?t??null:null,b=po.catalog(R,D);o.useEffect(()=>{r!=="catalog"||!t||!R||Pp(t,R)},[r,t,R]);const z=o.useRef(0),[B,K]=o.useState(0),h=o.useRef(null),L=o.useCallback(($,v)=>{const W=Date.now()+Ea;z.current=W,h.current={name:$,expect:v},K(W)},[]),F=o.useCallback($=>Date.now()<z.current?ar:op($),[]),w=Fe({queryKey:b,queryFn:()=>xo(R,D),enabled:r==="catalog"&&!M,staleTime:1e4,refetchInterval:$=>F($.state.data)}),G=Kp(w.error);o.useEffect(()=>{!G||!E||c===E||(l(E),Up(t))},[G,E,c,t]);const P=Fe({queryKey:cs.list(x??""),queryFn:()=>_o(x??""),enabled:r==="session"&&!!x,staleTime:1e4,refetchInterval:$=>F($.state.data?xs($.state.data,x??""):void 0)}),V=o.useMemo(()=>{if(r==="catalog")return w.data;if(r==="session"&&P.data&&x)return xs(P.data,x)},[r,w.data,P.data,x]),Z=o.useCallback(()=>Yp({queryClient:d,route:r,catalogKey:b,sessionId:x}),[r,b,d,x]);o.useEffect(()=>{if(!B)return;const $=h.current;if(!$)return;const v=V?.servers.find(se=>se.name===$.name);!v||!($.expect==="connected"?v.status==="connected":v.status_basis==="live"&&v.status!=="connected")||(z.current=0,h.current=null,K(0))},[V,B]);const _=o.useRef({}),[I,S]=o.useState(0),q=o.useMemo(()=>(_.current=ep(sp(_.current,V,or()),V),_.current),[V,I]),ae=o.useRef("");o.useEffect(()=>{const $=np(q,V);if(!Object.keys($).length)return;const v=JSON.stringify($);v!==ae.current&&(ae.current=v,$p($))},[q,V]);const Y=o.useCallback($=>{const v=dt(_.current,$);v.needsKey||(_.current={..._.current,[$]:{...v,needsKey:!0}},S(W=>W+1))},[]),ne=o.useCallback($=>{if($.action!=="disconnect"&&$.action!=="connect"&&$.action!=="reload")return;const v=dt(_.current,$.name),W=Date.now()+Ea,se=$.action==="disconnect"?{...v,connectedAt:null,disconnectedAt:Date.now(),holdUntil:W}:{...v,disconnectedAt:null,holdUntil:W};_.current={..._.current,[$.name]:se},L($.name,Hp($)),S(ee=>ee+1)},[L]),ce=o.useCallback(async $=>{if(r==="catalog"){const v=Vp($);if(!v)return null;try{const W=await fo(R,v);return d.setQueryData(b,W),ne($),W.operation?.id??null}catch(W){throw W instanceof ys&&W.status===409&&d.invalidateQueries({queryKey:b}),W}}if(r==="session"&&x){const v=await je({op:"mcp.control",sessionId:x,control:Gp($)});ne($);const W=cs.list(x),se=v?.data;return se&&"servers"in se&&Array.isArray(se.servers)?(d.setQueryData(W,se),null):(d.invalidateQueries({queryKey:W}),se&&"id"in se&&typeof se.id=="string"?se.id:null)}return null},[r,R,b,d,x,ne]),le=o.useCallback(async $=>{if(r==="catalog"&&D&&($.action==="connect"||$.action==="disconnect"||$.action==="reload")){try{await je({op:"mcp.control",sessionId:D,control:{action:$.action,name:$.name,...$.action==="disconnect"?{confirmed:!0}:{}}})}catch(v){throw d.invalidateQueries({queryKey:b}),v}return ne($),await d.invalidateQueries({queryKey:b}),null}return ce($)},[r,D,d,b,ce,ne]),ue=o.useCallback(async($,v,W,se)=>{if(r==="catalog"){const ee=await ho(R,$,v,W,se);if(ee.catalog&&d.setQueryData(b,ee.catalog),ee.code!=="saved")return{saved:!1,message:Da(ee.code,ee.failed_ids,v)};try{await ce({action:"test",name:$})}catch{}return{saved:!0,message:null}}if(r==="session"&&x){const ee=await je({op:"mcp.credentials.store",sessionId:x,name:$,values:v,confirmedReplace:W});if(ee.data?.code!=="saved")return{saved:!1,message:Da(ee.data?.code,ee.data?.failed_ids??[],v)};try{await ce({action:"connect",name:$})}catch{}return{saved:!0,message:null}}return{saved:!1,message:null}},[r,R,b,d,ce,x]),we=r==="catalog"?w:P,U=o.useCallback(()=>{we.refetch()},[we]);return{enabled:r!==null,route:r,sessionId:r==="catalog"?D:x,borrowed:f,noConversation:r==="session"&&!x&&!p,document:V,isLoading:s.isLoading||r==="catalog"&&(M||w.isLoading)||r==="session"&&(x?P.isLoading:p),isError:we.isError,folderUnavailable:tp(c,E),refetch:U,readDocument:Z,control:le,storeKeys:ue,memories:q,markNeedsKey:Y}}function Yp(t){if(t.route==="catalog")return t.queryClient.getQueryData(t.catalogKey);if(t.route==="session"&&t.sessionId){const s=t.queryClient.getQueryData(cs.list(t.sessionId));return s?xs(s,t.sessionId):void 0}}const Qp=(t,s)=>{const a=t?.trim();if(!a)return null;const i=bo(a,s);return i.kind==="auth"?{kind:"matched",name:i.name,unresolved:null}:{kind:"miss",asked:a}},Zp=6,Gn="ui.settings.integrations.mcp_management_section.copy_section_title",Jp="ui.settings.integrations.mcp_management_section.copy_section_description",Xp={test:"test",connect:"reconnect",disconnect:"disconnect",reload:"reload",remove:"remove",sign_out:"disconnect",cancel:"cancel",login:"grant",reauth:"grant"},ef=({sessionId:t,sectionRef:s,highlightServer:a})=>{te();const i=Wp({sessionId:t}),{document:r,control:c,readDocument:l}=i,d=ti(),u=r?.servers??[],m=r?.operations??[],p=r?.project_scope_available??!1,[g,f]=o.useState(!1),[x,j]=o.useState(""),[y,N]=o.useState(null),[M,E]=o.useState({}),[T,R]=o.useState(null),[D,b]=o.useState(null),[z,B]=o.useState({kind:"ready"}),[K,h]=o.useState(null),[L,F]=o.useState(null),[w,G]=o.useState(!1),P=o.useRef({}),V=o.useRef({}),Z=o.useRef({}),_=o.useRef(0),I=o.useRef(null),S=o.useRef(null),q=o.useRef(null),[ae,Y]=o.useState(null),[ne,ce]=o.useState(null),[le,ue]=o.useState(null),we=o.useCallback(()=>{const A=q.current;q.current=null,b(null),h(null),window.setTimeout(()=>{A?.isConnected&&A.focus()},0)},[]),U=o.useCallback(A=>{const C=window.document.activeElement;q.current=C instanceof HTMLElement?C:null,b(A)},[]),$=o.useCallback((A,C)=>{ce({name:A,waitForSignIn:C==="signed-in",until:Date.now()+At,reanchors:0}),we()},[we]),v=o.useMemo(()=>Qp(a,u.map(A=>A.name)),[a,u]),W=v?.kind==="matched"?v.name:null,se=o.useRef(null),ee=o.useRef(null),ye=x.trim().toLowerCase(),Se=o.useMemo(()=>ye?u.filter(A=>A.name.toLowerCase().includes(ye)):u,[u,ye]),he=Xg(Se,m,i.memories),be=D?.kind==="sign_in"?u.find(A=>A.name===D.name)??null:null;o.useEffect(()=>{!W||ee.current===W||!x||j("")},[W,x]),o.useEffect(()=>{!W||ee.current===W||Se.some(A=>A.name===W)&&(ee.current=W,se.current?.scrollIntoView({block:"center",behavior:"smooth"}))},[W,Se]),o.useEffect(()=>{if(!K)return;const A=m.find(C=>C.id===K)??null;B({kind:"running",operation:A})},[m,K]);const ke=m.some(A=>A.status==="running"),ie=A=>{const C=window.document.activeElement;C&&C!==window.document.body&&C.isConnected||ce({name:A,waitForSignIn:!1,until:Date.now()+At,reanchors:0})},de=async(A,C,H)=>{N(A),E(({[A]:Ae,...Ne})=>Ne);let J=null,_e=!1;try{J=await H()}catch(Ae){_e=!0,E(Ne=>({...Ne,[A]:en(Xp[C]??"status",Ae,ke)}))}finally{N(null),C!=="sign_out"&&(C!=="remove"||_e)&&ie(A)}return{operationId:J,failed:_e}},Q=A=>u.find(C=>C.name===A),oe=A=>{A.source.path&&vo(A.source.path)},me=async(A,C)=>{B({kind:"starting"}),h(null);try{const H=await c({action:C,name:A});H?h(H):B({kind:"running",operation:null})}catch(H){H instanceof ys&&H.code==="oauth_unsupported"&&i.markNeedsKey(A),B({kind:"refused",message:en("grant",H,ke)})}},Ie=(A,C)=>{switch(C.kind){case"sign_in":case"reauth":{const H=m.find(J=>J.name===A.name&&J.status==="running");H&&Vt(H)?(B({kind:"running",operation:H}),h(H.id)):(B({kind:"ready"}),h(null)),U({kind:"sign_in",name:A.name,action:C.kind==="reauth"?"reauth":"login"});return}case"set_key":F(null),U({kind:"key",name:A.name,keyNames:A.auth.secret_refs.map(H=>H.id)});return;case"fix":oe(A);return;case"sign_out":R({name:A.name,kind:"sign_out"});return;default:{const H=C.kind;de(A.name,H,()=>c({action:H,name:A.name}))}}},Qe=(A,C)=>{switch(C.kind){case"remove":case"sign_out":R({name:A.name,kind:C.kind});return;case"sign_in":case"reauth":case"set_key":Ie(A,{kind:C.kind,label:C.label});return;case"open_config":oe(A);return;case"copy_setup":navigator.clipboard.writeText(A.setup_prompt??"").then(()=>os(n("ui.settings.integrations.mcp_management_section.setup_steps_copied_paste_them_into_a_chat"))).catch(()=>{});return;case"cancel":{const H=m.find(J=>J.name===A.name&&J.status==="running");H&&de(A.name,"cancel",()=>c({action:"cancel",operationId:H.id}));return}case"test":case"connect":case"disconnect":case"reload":{const H=C.kind;de(A.name,H,()=>c({action:H,name:A.name}));return}default:return}},Me=(A,C)=>{if(R(null),C==="remove"){const H=A.source.owned_scope;if(!H)return;const J=Se.findIndex(_e=>_e.name===A.name);de(A.name,"remove",()=>c({action:"remove",name:A.name,scope:H})).then(({operationId:_e,failed:Ae})=>{Ae||_e!==null||(os(n("ui.settings.integrations.mcp_management_section.removed_name",{name:String(A.name)})),J>=0&&ue({index:J}))});return}de(A.name,"sign_out",()=>c({action:"logout",name:A.name})).then(()=>{ce({name:A.name,waitForSignIn:!1,until:Date.now()+At,reanchors:0})})},Ue=async A=>{try{return await c({action:"add",name:A.name,scope:A.scope,...A.mode==="command"?{command:A.command,args:A.args}:{url:A.url}}),f(!1),Y(A.name),null}catch(C){return en("add",C,!1)}},Ge=e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-heading text-ink",children:n(Gn)}),e.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:n(Jp)})]}),i.enabled&&u.length>0&&!g?e.jsxs(O,{ref:I,variant:"secondary",size:"sm",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[e.jsx(bn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]}):null]});if(!i.enabled&&!i.isLoading)return e.jsx(Re,{title:n(Gn),titleComponent:Ge,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),children:e.jsx(ge,{variant:"warning",children:n("ui.settings.integrations.mcp_management_section.integrations_need_a_newer_local_operator_backend_update_it_and_re")})});const Ze=e.jsx(xp,{existingNames:u.map(A=>A.name),projectScopeAvailable:p,projectLabel:r?.cwd?nf(r.cwd):null,onSubmit:Ue,onCancel:()=>{f(!1),window.setTimeout(()=>I.current?.focus(),0)}}),at=D?Q(D.name):void 0,ut=Object.entries(M).filter(([A])=>!u.some(C=>C.name===A)),jt=A=>E(({[A]:C,...H})=>H);o.useEffect(()=>{if(!ae)return;const A=P.current[ae];if(!A){u.some(C=>C.name===ae)&&(V.current[ae]?.focus(),Y(null));return}A.focus(),Y(null)},[ae,u]),o.useEffect(()=>{if(!le)return;const C=Se[Math.min(le.index,Se.length-1)]??Se.at(-1);if(C){const H=P.current[C.name]??V.current[C.name];if(!H)return;H.focus()}else I.current?.focus();ue(null)},[le,Se]);const Je=o.useCallback((A,C)=>{const H=l()??r,J=H?.servers.find(He=>He.name===A.name),_e=H?.operations??[],Ae=J?J.status==="connecting"||kt(J.name,_e)!==null:!1;Ae&&J&&(_.current=C);const Ne=J?Bs(J,_e,i.memories):null;if(J&&A.waitForSignIn&&(Ne?.kind==="sign_in"||Ne?.kind==="reauth"))return"kept";const Oe=vp({hold:A,now:C,windowMs:At,rowMoving:Ae,lastMovingAt:_.current,candidate:J?jp({primary:Ne?P.current[J.name]:null,overflow:V.current[J.name]}):void 0,active:window.document.activeElement,body:window.document.body});if(!Oe.hold)return ce(null),"finished";if(!Oe.land)return"kept";ce({name:A.name,waitForSignIn:!1,until:Oe.hold.until,landedOn:Oe.land,reanchors:Oe.hold.reanchors});const ze=Oe.land;return window.setTimeout(()=>{ze.isConnected&&ze.focus()},0),"landed"},[l,r,i.memories]);return o.useEffect(()=>{if(!ne)return;Je(ne,Date.now());let A=0,C=!1;const H=()=>{if(C)return;const J=wp({verdict:Je(ne,Date.now()),watchMs:Ia});J!==null&&(A=window.setTimeout(H,J))};return A=window.setTimeout(H,Ia),()=>{C=!0,window.clearTimeout(A)}},[ne,Je]),o.useEffect(()=>{if(!ne)return;const A=C=>{kp({target:C.target,row:Z.current[ne.name]})&&ce(null)};return window.document.addEventListener("pointerdown",A,!0),()=>{window.document.removeEventListener("pointerdown",A,!0)}},[ne]),e.jsxs(Re,{title:n(Gn),titleComponent:Ge,sectionRef:s,searchSection:"integrations",searchSectionLabel:n("ui.settings.navigation.settings_sidebar.integrations"),children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[i.route==="session"&&i.borrowed?e.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?e.jsxs("div",{className:"flex flex-col items-start gap-2",children:[e.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")}),e.jsx(O,{variant:"primary",size:"sm",onClick:()=>d("/chat"),children:n("ui.settings.integrations.mcp_management_section.start_a_chat")}),e.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?e.jsx("div",{className:"flex h-24 items-center justify-center",children:e.jsx(Ce,{size:"lg",label:n("ui.settings.integrations.mcp_management_section.loading_integrations")})}):null,i.folderUnavailable?e.jsx(ge,{variant:"warning",children:e.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?e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:n("ui.settings.integrations.mcp_management_section.integrations_couldn_t_be_loaded")}),e.jsx(O,{variant:"secondary",size:"sm",onClick:i.refetch,children:n("ui.settings.integrations.mcp_management_section.retry")})]})}):null,ut.map(([A,C])=>e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:C}),e.jsx(O,{variant:"ghost",size:"sm",onClick:()=>jt(A),children:n("ui.settings.integrations.mcp_management_section.dismiss")})]})},A)),g&&u.length>0?Ze:null,u.length>=Zp?e.jsxs("div",{className:"relative",children:[e.jsx(js,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 start-3 size-4 -translate-y-1/2 text-ink-dim"}),e.jsx(Le,{ref:S,value:x,onChange:A=>j(A.target.value),onKeyDown:A=>{A.key!=="Escape"||!x||(A.preventDefault(),j(""))},placeholder:n("ui.settings.integrations.mcp_management_section.search_integrations_placeholder",{integrations:Og(u.length)}),"aria-label":n("ui.settings.integrations.mcp_management_section.search_integrations"),className:"ps-9"})]}):null,v?.kind==="miss"&&u.length>0?e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.no_match_for_name",{asked:String(v.asked)})}):null,v?.kind==="matched"&&v.unresolved?e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.showing_fallback_for_unknown",{shown:String(v.name),asked:String(v.unresolved)})}):null,r&&u.length===0&&!i.isLoading?g?Ze:e.jsxs("div",{className:"flex flex-col items-start gap-3 rounded-lg bg-surface p-6",children:[e.jsx(ui,{"aria-hidden":"true",className:"size-5 text-ink-muted"}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h3",{className:"text-heading text-ink",children:n("ui.settings.integrations.mcp_management_section.no_integrations_yet")}),e.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")})]}),e.jsxs(O,{variant:"primary",size:"md",onClick:()=>f(!0),"data-tour-tag":"mcp-add-server",children:[e.jsx(bn,{"aria-hidden":"true"}),n("ui.settings.integrations.mcp_management_section.add_integration")]})]}):null,u.length>0&&Se.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-2",children:[e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.integrations.mcp_management_section.no_integrations_match_this_search")}),e.jsx(O,{variant:"secondary",size:"sm",onClick:()=>{j(""),window.setTimeout(()=>{(S.current??I.current)?.focus()},0)},children:n("ui.settings.integrations.mcp_management_section.clear_search")})]}):null,he.map(A=>e.jsxs("section",{"aria-labelledby":`integrations-group-${A.id}`,className:"flex flex-col gap-1.5",children:[e.jsxs("h3",{id:`integrations-group-${A.id}`,className:"px-1 text-ink-dim text-meta",children:[A.title," · ",A.rows.length]}),e.jsx("ul",{className:"flex flex-col divide-y divide-hairline overflow-hidden rounded-lg bg-surface",children:A.rows.map(C=>e.jsx(Ep,{row:C,operations:m,memories:i.memories,projectScopeAvailable:p,highlighted:C.name===W,rowRef:H=>{Z.current[C.name]=H,C.name===W&&(se.current=H)},primaryRef:H=>{P.current[C.name]=H},overflowRef:H=>{V.current[C.name]=H},pending:y===C.name,failure:M[C.name]??null,confirm:T?.name===C.name?{kind:T.kind}:null,onPrimary:H=>Ie(C,H),onOverflow:H=>Qe(C,H),onConfirm:()=>T&&Me(C,T.kind),onCancelConfirm:()=>{R(null),window.setTimeout(()=>{V.current[C.name]?.focus()},0)}},C.id))})]},A.id))]}),D?.kind==="sign_in"?e.jsx(Op,{name:D.name,action:D.action,keyRoute:be?Sn(be):!1,phase:z,onStart:()=>void me(D.name,D.action),onCancel:A=>void c({action:"cancel",operationId:A}).catch(()=>{}),onOpenLink:A=>void yo(A),onClose:A=>$(D.name,A)}):null,D?.kind==="key"?e.jsx(Cp,{name:D.name,keyNames:D.keyNames.length?D.keyNames:at?.auth.secret_refs.map(A=>A.id)??[],keyless:D.keyNames.length===0,savedKeys:at?.auth.secret_refs.filter(A=>A.state==="encrypted").map(A=>A.id),saving:w,failure:L,onClose:we,onSave:(A,C,H)=>{G(!0),F(null),i.storeKeys(D.name,A,C,H).then(J=>{if(!J.saved){F(J.message);return}b(null),ce({name:D.name,waitForSignIn:!1,until:Date.now()+At,reanchors:0})}).catch(J=>F(en("key",J,!1))).finally(()=>G(!1))}}):null]})},At=4e3,tf=/^\/(?:Users|home)\/[^/]+(?=\/|$)/,nf=t=>t.replace(tf,"~"),cr="group/row flex min-h-11 items-center gap-3 border-b border-hairline px-2",lr="group/row flex min-h-11 items-center gap-3 border-b border-hairline px-2 hover:bg-row-hover",dr="group-hover/row:not-data-[state=checked]:border-ink-muted",ur=({sound:t,state:s,onToggle:a,inTabOrder:i})=>{te();const r=s==="playing",c=r?n("ui.settings.notifications.preview.stop",{name:t.label}):n("ui.settings.notifications.preview.play",{name:t.label});return e.jsx("button",{type:"button",className:pe(jo,r&&"text-accent hover:text-accent"),"aria-label":c,"aria-pressed":r,tabIndex:i?void 0:-1,"data-preview":t.id,onClick:l=>{l.preventDefault(),l.stopPropagation(),a()},children:s==="loading"?e.jsx(Ce,{size:"sm"}):r?e.jsx(Ql,{className:"size-4","aria-hidden":"true"}):e.jsx(mi,{className:"size-4","aria-hidden":"true"})})},Fa=({sound:t,isDefault:s,preview:a,onPreview:i,describedBy:r,description:c,noPreview:l=!1})=>{te();const d=`notification-sound-${t.id}`,u=c?`${d}-description`:void 0;return e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("label",{htmlFor:d,className:pe(lr,"cursor-pointer"),"data-sound-row":t.id,children:[e.jsx(Mi,{id:d,value:t.id,className:dr,"aria-describedby":[u,r].filter(Boolean).join(" ")||void 0,"aria-label":s?`${t.label}, ${n("ui.settings.notifications.list.default_tag")}`:void 0}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col py-2",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-body text-ink",title:t.label,children:t.label}),s&&e.jsx(yt,{variant:"neutral",className:"shrink-0",children:n("ui.settings.notifications.list.default_tag")})]}),c&&e.jsx("span",{id:u,className:"text-body-sm text-ink-muted",children:c})]}),!l&&e.jsx(ur,{sound:t,state:a,onToggle:i,inTabOrder:!1})]}),a==="failed"&&e.jsx("output",{className:"block px-2 pt-1 pb-2 text-meta text-danger",children:n("ui.settings.notifications.preview.failed")})]})},sf=({sound:t,selected:s,preview:a,onPreview:i,mode:r,maxNameChars:c,describedBy:l,moreRef:d,onStartRename:u,onRename:m,onCancelRename:p,onStartRemove:g,onConfirmRemove:f,onCancelRemove:x})=>{te();const j=`notification-sound-${t.id}`,y=o.useRef(null),N=ko(t.duration_s);if(o.useEffect(()=>{if(r.kind==="confirm-remove"&&!r.removing){const M=setTimeout(()=>y.current?.focus(),0);return()=>clearTimeout(M)}},[r]),r.kind==="confirm-remove"){const M=s?n("ui.settings.notifications.custom.remove_confirm_selected",{name:t.label}):n("ui.settings.notifications.custom.remove_confirm",{name:t.label});return e.jsxs("div",{className:"flex flex-col gap-2 border-b border-hairline px-2 py-2","data-sound-row":t.id,"data-row-mode":"confirm-remove",onKeyDown:E=>{E.key==="Escape"&&(E.stopPropagation(),x())},children:[e.jsxs("div",{className:"flex min-h-7 flex-wrap items-center gap-x-3 gap-y-2",children:[e.jsx("p",{className:"min-w-0 flex-1 text-body-sm text-ink",children:M}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs(O,{variant:"danger",size:"sm",onClick:f,disabled:r.removing,children:[r.removing&&e.jsx(Ce,{size:"xs"}),n("ui.settings.notifications.custom.remove_action")]}),e.jsx(O,{ref:y,variant:"secondary",size:"sm",onClick:x,disabled:r.removing,children:n("ui.settings.notifications.custom.cancel")})]})]}),r.error&&e.jsx("output",{className:"block text-meta text-danger",children:r.error})]})}return r.kind==="renaming"?e.jsx("div",{className:"flex flex-col border-b border-hairline px-2 py-1","data-sound-row":t.id,"data-row-mode":"renaming",children:e.jsxs("div",{className:"flex min-h-9 items-center gap-3",children:[e.jsx("span",{"aria-hidden":"true",className:pe("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",s?"border-accent":"border-control"),children:s&&e.jsx("span",{className:"size-2 rounded-full bg-accent"})}),e.jsx(af,{initial:t.label,maxNameChars:c,saving:r.saving,onSave:m,onCancel:p,serverError:r.error})]})}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("label",{htmlFor:j,className:pe(lr,"@container cursor-pointer"),"data-sound-row":t.id,children:[e.jsx(Mi,{id:j,value:t.id,className:dr,"aria-describedby":l,"aria-keyshortcuts":"F2 Delete",onKeyDown:M=>{M.key==="F2"?(M.preventDefault(),u()):M.key==="Delete"&&(M.preventDefault(),g())}}),e.jsx("span",{className:"min-w-0 flex-1 truncate py-2 text-body text-ink",title:t.label,children:t.label}),N&&e.jsx("span",{"aria-hidden":"true",className:"hidden shrink-0 font-mono text-mono-sm text-ink-dim @[420px]:inline",children:N}),e.jsx(ur,{sound:t,state:a,onToggle:i,inTabOrder:!0}),e.jsxs(Os,{children:[e.jsx(Ds,{asChild:!0,children:e.jsx(O,{ref:d,variant:"ghost",size:"icon",className:"size-11 shrink-0 text-ink-muted hover:text-ink","aria-label":n("ui.settings.notifications.custom.more",{name:t.label}),"data-sound-more":t.id,onClick:M=>M.stopPropagation(),children:e.jsx(Cs,{"aria-hidden":"true"})})}),e.jsxs(Fs,{align:"end",className:"min-w-40",children:[e.jsx(nt,{onSelect:u,children:n("ui.settings.notifications.custom.rename")}),e.jsx(nt,{onSelect:g,children:n("ui.settings.notifications.custom.remove")})]})]})]}),a==="failed"&&e.jsx("output",{className:"block px-2 pt-1 pb-2 text-meta text-danger",children:n("ui.settings.notifications.preview.failed")})]})},af=({initial:t,maxNameChars:s,saving:a,onSave:i,onCancel:r,serverError:c})=>{te();const[l,d]=o.useState(t),[u,m]=o.useState(null),p=o.useRef(null),g=o.useId();o.useEffect(()=>{const y=setTimeout(()=>{p.current?.focus(),p.current?.select()},0);return()=>clearTimeout(y)},[]);const f=u??c,x=o.useRef(!1);o.useEffect(()=>{a||(x.current=!1)},[a]);const j=()=>{const y=wo(l,s);if(y){m(y==="ui.settings.notifications.custom.rename_long"?n(y,{max:s}):n("ui.settings.notifications.custom.rename_empty"));return}x.current=!0,i(l.trim())};return e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[e.jsx(Le,{ref:p,inputSize:"sm",value:l,disabled:a,"aria-label":n("ui.settings.notifications.custom.rename_label"),"aria-invalid":f?!0:void 0,"aria-describedby":f?g:void 0,onChange:y=>{d(y.target.value),m(null)},onKeyDown:y=>{y.nativeEvent.isComposing||(y.key==="Escape"?(y.preventDefault(),y.stopPropagation(),x.current=!0,r()):y.key==="Enter"&&(y.preventDefault(),j()))},onBlur:()=>{if(!(a||x.current)){if(l.trim()===t.trim()){x.current=!0,r();return}j()}}}),f&&e.jsx("p",{id:g,className:"text-meta text-danger",children:f})]})},rf=".wav,.flac,.mp3,.ogg,audio/wav,audio/flac,audio/mpeg,audio/ogg",Wn=t=>t instanceof Error&&t.message?t.message:"";function of(t){return t.kind==="error"&&t.refusal?{code:t.refusal.code,params:t.refusal.params}:{code:null}}const mr=o.forwardRef(({listing:t,selectedId:s,volume:a,canSelect:i,onSelect:r,onChanged:c,initialPreview:l,initialPending:d,initialSaveError:u,initialFailedChoice:m,initialMode:p},g)=>{te();const f=o.useMemo(()=>No(t.sounds),[t.sounds]),x=o.useId(),j=o.useId(),y=t.limits,[N,M]=o.useState(null),[E,T]=o.useState(u??null),[R,D]=o.useState(m??null),b=o.useRef(null),z=o.useRef(null),B=N??s,K=o.useRef(B);K.current=B,o.useEffect(()=>{N!==null&&N===s&&M(null)},[N,s]);const h=o.useCallback(async k=>{try{await r(k),T(null),D(null)}catch(re){M(null),D(k),T(Wn(re))}},[r]),L=o.useCallback(k=>{b.current&&clearTimeout(b.current),z.current=k,b.current=setTimeout(()=>{b.current=null,z.current=null,h(k)},So)},[h]),F=o.useCallback(()=>{if(!b.current)return;clearTimeout(b.current),b.current=null;const k=z.current;z.current=null,k&&h(k)},[h]),w=()=>{b.current&&clearTimeout(b.current),b.current=null,z.current=null},G=o.useRef(F);G.current=F;const[P,V]=o.useState(l??null),Z=o.useRef(null),_=o.useRef(0),I=Nt(k=>k.ownerId),S=Nt(k=>k.status);o.useEffect(()=>{!P||P.state!=="playing"||(I!==Gt||S==="ended")&&V(null)},[I,S,P]);const q=o.useCallback(()=>{Z.current&&Co(Z.current),Z.current=null},[]),ae=o.useCallback(()=>{_.current+=1,Nt.getState().stop(Gt),V(null)},[]),Y=o.useCallback(async(k,re)=>{if(k===ls)return;const fe=++_.current,Ee=Date.now();V({id:k,state:"loading"});try{const Ke=await ns({op:"notification_sounds.audio",soundId:k,volume:Math.max(0,Math.min(100,Math.round(re)))},null);if(fe!==_.current)return;if(Date.now()-Ee>Mo){V(null);return}if(Ke.kind!=="bytes")throw new Error("no audio");q();const Pe=Ao(Ke.data,Ke.mimeType||"audio/wav");Z.current=Pe;const ve=await Nt.getState().play(Gt,Pe,{onEnded:()=>V(null),fixedOutput:{volume:1,playbackRate:1},onError:()=>V({id:k,state:"failed"})});if(fe!==_.current)return;V(ve?{id:k,state:"playing"}:{id:k,state:"failed"})}catch{if(fe!==_.current)return;V({id:k,state:"failed"})}},[q]),ne=k=>{if(P?.id===k&&P.state==="playing"){ae();return}Y(k,a)};o.useImperativeHandle(g,()=>({previewSelected:k=>{Y(B,k)}}),[Y,B]),o.useEffect(()=>()=>{G.current(),Nt.getState().stop(Gt),q()},[q]);const[ce,le]=o.useState(""),[ue,we]=o.useState(null),[U,$]=o.useState(p?{[p.id]:p.mode}:{}),v=k=>U[k]??{kind:"idle"},W=(k,re)=>$(fe=>({...fe,[k]:re})),se=o.useRef(new Map),ee=k=>{let re=se.current.get(k);return re||(re={current:null},se.current.set(k,re)),re},ye=o.useRef(null),Se=o.useRef(null),[he,be]=o.useState(null);o.useEffect(()=>{if(!he)return;const k=setTimeout(()=>{he==="add"?ye.current?.focus():se.current.get(he)?.current?.focus(),be(null)},0);return()=>clearTimeout(k)},[he]);const ke=async(k,re)=>{W(k.id,{kind:"renaming",saving:!0,error:null});try{await je({op:"notification_sounds.rename",id:k.id,name:re}),await c(),W(k.id,{kind:"idle"}),be(k.id)}catch(fe){W(k.id,{kind:"renaming",saving:!1,error:n("ui.settings.notifications.custom.rename_failed",{reason:Wn(fe)}).trim()})}},ie=async k=>{W(k.id,{kind:"confirm-remove",removing:!0,error:null});const re=f.custom.map(fe=>fe.id);try{const fe=await je({op:"notification_sounds.remove",id:k.id});P?.id===k.id&&ae();const Ee=fe?.selection_reset===!0;Ee&&(w(),M(Eo)),le(Ee?n("ui.settings.notifications.custom.removed_reset",{name:k.label}):n("ui.settings.notifications.custom.removed",{name:k.label}));const Ke=Ro(re,k.id);$(Pe=>{const{[k.id]:ve,...Xe}=Pe;return Xe}),await c(),be(Ke??"add")}catch(fe){W(k.id,{kind:"confirm-remove",removing:!1,error:n("ui.settings.notifications.custom.remove_failed",{name:k.label,reason:Wn(fe)}).trim()})}},[de,Q]=o.useState(()=>(d??[]).map(({fileName:k,percent:re,...fe})=>({...fe,file:new File([],k)}))),[oe,me]=o.useState(()=>Object.fromEntries((d??[]).map(k=>[k.key,k.percent??0]))),Ie=o.useRef(Promise.resolve()),Qe=o.useRef(0),Me=o.useRef(new Set),Ue=(k,re)=>Q(fe=>fe.map(Ee=>Ee.key===k?{...Ee,...re}:Ee)),Ge=k=>Q(re=>re.filter(fe=>fe.key!==k)),Ze=async k=>{if(Me.current.has(k.key))return null;if(k.file.size>y.max_bytes)return Ue(k.key,{phase:"error",refusal:{code:"too_large"}}),null;Ue(k.key,{phase:"uploading"}),me(Pe=>({...Pe,[k.key]:0}));let re;try{re=await lf(k.file,Pe=>me(ve=>({...ve,[k.key]:Math.round(Pe*100)})))}catch{return Ue(k.key,{phase:"error",refusal:{code:null}}),null}if(Me.current.has(k.key))return null;if(re.byteLength>y.max_bytes)return Ue(k.key,{phase:"error",refusal:{code:"too_large"}}),null;Ue(k.key,{phase:"processing"});const fe=await ns({op:"notification_sounds.upload",fileName:k.file.name||"sound",name:k.stem},re).catch(()=>null);if(Me.current.has(k.key))return null;if(!fe||fe.kind!=="json")return Ue(k.key,{phase:"error",refusal:fe?of(fe):{code:null}}),null;const Ee=fe.body,Ke=typeof Ee?.result?.id=="string"?Ee.result.id:null;return await c(),Ge(k.key),Ke},at=k=>{if(k.length===0)return;we(null);const re=f.custom.length+de.filter(ve=>ve.phase!=="error").length,{accepted:fe,overLimit:Ee}=Lo(k,re,y.max_sounds),Ke=[...fe.map(ve=>({key:`upload-${++Qe.current}`,file:ve,stem:Xs(ve.name,y.max_name_chars),phase:"queued"})),...Ee.map(ve=>({key:`upload-${++Qe.current}`,file:ve,stem:Xs(ve.name,y.max_name_chars),phase:"error",refusal:{code:"limit_reached"}}))];Q(ve=>[...ve,...Ke]);const Pe=Ke.filter(ve=>ve.phase==="queued");Ie.current=Ie.current.then(async()=>{const ve=[];for(const Xe of Pe){const wt=await Ze(Xe);wt&&ve.push({id:wt,name:Xe.stem})}if(ve.length!==0){if(Pe.length===1&&ve.length===1)ut(ve[0]);else{const Xe=n("ui.settings.notifications.custom.added_many",{count:ve.length});le(Xe),we(Xe)}ye.current?.focus()}})},ut=k=>{w(),M(k.id),h(k.id),Y(k.id,a),le(n("ui.settings.notifications.custom.added_one",{name:k.name}))},jt=k=>{Ue(k.key,{phase:"queued",refusal:void 0}),Ie.current=Ie.current.then(async()=>{const re=await Ze({...k,phase:"queued"});re&&ut({id:re,name:k.stem})})},Je=k=>{Me.current.add(k.key),Ge(k.key)},A=f.custom.length,C=A>=y.max_sounds,H=k=>P?.id===k?P.state:"idle",J=o.useRef({active:!1,repeated:!1}),_e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ae=k=>{_e.includes(k.key)&&(J.current.active=!0,k.repeat&&(J.current.repeated=!0))},Ne=k=>{if(!_e.includes(k.key))return;const re=J.current.repeated;J.current={active:!1,repeated:!1},re&&Y(K.current,a)},Oe=k=>{if(!J.current.active)return;const re=k.target;re?.getAttribute("role")==="radio"&&re.getAttribute("data-state")!=="checked"&&re.click()},ze=k=>{k.key==="Escape"&&P&&ae()},He=()=>Se.current?.click();return e.jsxs("div",{className:"flex flex-col gap-3",onKeyDown:ze,children:[e.jsx("span",{id:j,className:"sr-only",children:n("ui.settings.notifications.list.label")}),e.jsxs(dl,{"aria-labelledby":j,value:B,loop:!0,disabled:!i,onValueChange:k=>{k!==K.current&&(M(k),K.current=k,T(null),J.current.repeated||Y(k,a),L(k))},onKeyDownCapture:Ae,onKeyUp:Ne,onFocusCapture:Oe,onBlur:k=>{k.currentTarget.contains(k.relatedTarget)||F()},children:[e.jsx("p",{className:"px-2 pb-1 text-meta text-ink-dim",children:n("ui.settings.notifications.list.builtin")}),e.jsxs("div",{className:"border-t border-hairline",children:[f.builtin.map(k=>e.jsx(Fa,{sound:k,isDefault:k.is_default,preview:H(k.id),onPreview:()=>ne(k.id)},k.id)),f.system&&e.jsx("div",{className:"border-t border-hairline",children:e.jsx(Fa,{sound:{...f.system,label:n("ui.settings.notifications.list.system_name")},isDefault:!1,preview:"idle",onPreview:()=>{},noPreview:!0,description:n("ui.settings.notifications.list.system_description")})})]}),e.jsxs("div",{className:"flex items-baseline justify-between px-2 pt-5 pb-1",children:[e.jsx("p",{id:x,className:"text-meta text-ink-dim",children:n("ui.settings.notifications.list.custom")}),A>0&&e.jsx("p",{className:"font-mono text-mono-sm text-ink-dim",children:n("ui.settings.notifications.list.custom_count",{count:A,max:y.max_sounds})})]}),e.jsxs("div",{className:"border-t border-hairline",children:[A===0&&de.length===0&&e.jsx("p",{className:`${cr} text-body-sm text-ink-muted`,children:n("ui.settings.notifications.custom.empty")}),f.custom.map(k=>e.jsx(sf,{sound:k,selected:B===k.id,preview:H(k.id),onPreview:()=>ne(k.id),mode:v(k.id),maxNameChars:y.max_name_chars,describedBy:x,moreRef:ee(k.id),onStartRename:()=>W(k.id,{kind:"renaming",saving:!1,error:null}),onRename:re=>ke(k,re),onCancelRename:()=>{W(k.id,{kind:"idle"}),be(k.id)},onStartRemove:()=>W(k.id,{kind:"confirm-remove",removing:!1,error:null}),onConfirmRemove:()=>void ie(k),onCancelRemove:()=>{W(k.id,{kind:"idle"}),be(k.id)}},k.id)),de.map(k=>e.jsx(df,{row:k,percent:oe[k.key]??0,limitSeconds:y.max_duration_s,limitMegabytes:Math.round(y.max_bytes/(1024*1024)),maxSounds:y.max_sounds,onCancel:()=>Je(k),onDismiss:()=>Ge(k.key),onChooseAnother:()=>{Ge(k.key),He()},onRetry:()=>jt(k)},k.key))]})]}),E!==null&&e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("span",{children:n("ui.settings.notifications.save.failed",{reason:E}).trim()}),R&&e.jsx(O,{variant:"secondary",size:"sm",onClick:()=>{M(R),h(R)},children:n("ui.settings.notifications.retry")})]})}),e.jsxs("div",{className:"flex flex-col items-start gap-2 px-2",children:[e.jsx("input",{ref:Se,type:"file",multiple:!0,accept:rf,className:"hidden",tabIndex:-1,"aria-hidden":"true",onChange:k=>{const re=Array.from(k.target.files??[]);k.target.value="",at(re)}}),e.jsxs(O,{ref:ye,variant:"secondary",size:"sm",disabled:C,onClick:He,children:[e.jsx(bn,{"aria-hidden":"true"}),n("ui.settings.notifications.custom.add")]}),e.jsx("p",{className:"text-body-sm text-ink-muted",children:C?n("ui.settings.notifications.custom.full",{count:y.max_sounds}):n("ui.settings.notifications.custom.hint",{seconds:y.max_duration_s,megabytes:Math.round(y.max_bytes/(1024*1024))})})]}),ue&&e.jsx("p",{className:"px-2 text-body-sm text-ink-muted","aria-hidden":"true","data-added-notice":"",children:ue}),e.jsx("output",{"aria-live":"polite",className:"sr-only",children:ce})]})});mr.displayName="NotificationSoundList";function cf(t,s){switch(t){case"ui.settings.notifications.error.too_large":return n(t,{file:s.file,megabytes:s.megabytes});case"ui.settings.notifications.error.too_long":return n(t,{file:s.file,seconds:s.seconds,limit:s.limitSeconds});case"ui.settings.notifications.custom.full":return n(t,{count:s.maxSounds});case"ui.settings.notifications.error.unsupported_codec":case"ui.settings.notifications.error.unsupported_format":case"ui.settings.notifications.error.undecodable":case"ui.settings.notifications.error.silent":case"ui.settings.notifications.error.network":return n(t,{file:s.file});default:return n("ui.settings.notifications.error.network",{file:s.file})}}async function lf(t,s){if(typeof FileReader>"u"||t.size===0){const a=await t.arrayBuffer();return s(1),new Uint8Array(a)}return new Promise((a,i)=>{const r=new FileReader;r.onprogress=c=>{c.lengthComputable&&c.total>0&&s(c.loaded/c.total)},r.onerror=()=>i(r.error),r.onload=()=>{s(1),a(new Uint8Array(r.result))},r.readAsArrayBuffer(t)})}const df=({row:t,percent:s,limitSeconds:a,limitMegabytes:i,maxSounds:r,onCancel:c,onDismiss:l,onChooseAnother:d,onRetry:u})=>{te();const m=t.file.name||t.stem;if(t.phase==="error"){const g=t.refusal??{code:null},f=Io(g),x=cf(f.key,{file:m,seconds:To(g,a),limitSeconds:a,megabytes:i,maxSounds:r});return e.jsxs("div",{className:"flex min-h-11 flex-wrap items-center gap-x-3 gap-y-1 border-b border-hairline px-2","data-pending-row":t.key,"data-pending-phase":"error",children:[e.jsx(Si,{className:"size-4 shrink-0 text-danger","aria-hidden":"true"}),e.jsx("output",{className:"block min-w-0 flex-1 text-body-sm text-ink",children:x}),f.action==="retry"?e.jsx(O,{variant:"link",size:"sm",onClick:u,children:n("ui.settings.notifications.retry")}):e.jsx(O,{variant:"link",size:"sm",onClick:d,children:n("ui.settings.notifications.error.choose_another")}),e.jsx(O,{variant:"ghost",size:"icon",className:"size-11 shrink-0 text-ink-muted hover:text-ink","aria-label":n("ui.settings.notifications.error.dismiss"),onClick:l,children:e.jsx(oa,{"aria-hidden":"true"})})]})}const p=t.phase==="processing";return e.jsxs("div",{className:cr,"data-pending-row":t.key,"data-pending-phase":t.phase,children:[e.jsx("span",{className:"inline-flex size-4 shrink-0 items-center justify-center",children:e.jsx(Ce,{size:"xs"})}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-body text-ink",title:t.stem,children:t.stem}),e.jsxs("span",{className:"flex shrink-0 items-center gap-2 text-meta text-ink-muted",children:[p?n("ui.settings.notifications.custom.finishing"):n("ui.settings.notifications.custom.uploading",{percent:s}),e.jsx(uf,{value:p?null:s})]}),p?e.jsx("span",{className:"size-11 shrink-0","aria-hidden":"true"}):e.jsx(O,{variant:"ghost",size:"icon",className:"size-11 shrink-0 text-ink-muted hover:text-ink","aria-label":n("ui.settings.notifications.custom.cancel_upload",{file:m}),onClick:c,children:e.jsx(oa,{"aria-hidden":"true"})})]})},uf=({value:t})=>e.jsx(wi,{value:t,className:"w-16","aria-hidden":"true"}),Yn={list:[...Br.settings,"notification-sounds"]};function mf(t){return t==="enabled"?"ready":t==="below-version"?"older":"pairing"}const gf=({resetErrorBoundary:t})=>(te(),e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("span",{children:n("ui.settings.notifications.load.failed",{reason:""}).trim()}),e.jsxs(O,{variant:"secondary",size:"sm",onClick:t,children:[e.jsx(jn,{"aria-hidden":"true"}),n("ui.settings.notifications.retry")]})]})})),Qn=(t,s)=>typeof t?.value=="boolean"?t.value:s,za=(t,s)=>typeof t?.value=="number"&&Number.isFinite(t.value)?t.value:s,pf=({sectionRef:t,listPresets:s})=>{te();const a=bt(),i=vt(),r=Ms(),c=ni(i.data,"notification_sounds"),l=mf(c),d=Fe({queryKey:lt.all,queryFn:()=>je({op:"settings.list"}),enabled:l!=="pairing",staleTime:1e4}),u=Fe({queryKey:Yn.list,queryFn:async()=>{const U=await je({op:"notification_sounds.list"}),$=$o(U);if(!$)throw new Error("unreadable notification sound listing");return $},enabled:l==="ready",staleTime:1e4}),m=d.data?.settings??[],p=o.useMemo(()=>new Map(m.map(U=>[U.key,U])),[m]),g=p.get(it),f=p.get(St),x=o.useMemo(()=>Oo(m),[m]),j=x.byKey["notifications.sound.enabled"],y=x.byKey["notifications.sound.id"],N=x.byKey["notifications.sound.volume"],[M,E]=o.useState({}),[T,R]=o.useState({}),D=o.useCallback((U,$)=>E(v=>({...v,[U]:$})),[]),b=o.useCallback((U,$)=>R(v=>({...v,[U]:$})),[]),z=o.useCallback(async()=>{await Promise.all([a.invalidateQueries({queryKey:lt.all}),a.invalidateQueries({queryKey:Yn.list})])},[a]),B=o.useRef(new Map),K=o.useRef(new Map),h=o.useCallback((U,$)=>{const v=B.current.get(U)??Promise.resolve();K.current.set(U,(K.current.get(U)??0)+1),D(U,!0),b(U,null);const W=v.catch(()=>{}).then(async()=>{try{await je({op:"settings.edit",key:U,value:$}),await z()}catch(se){throw b(U,se instanceof Error&&se.message?se.message:n("ui.settings.notifications.save.failed_generic")),se}finally{const se=(K.current.get(U)??1)-1;K.current.set(U,se),se===0&&D(U,!1)}});return B.current.set(U,W),W},[z,D,b]),L=o.useCallback(async U=>{D(U,!0),b(U,null);try{await je({op:"settings.reset",key:U}),await z()}catch($){throw b(U,$ instanceof Error&&$.message?$.message:n("ui.settings.notifications.save.failed_generic")),$}finally{D(U,!1)}},[z,D,b]),F=Do(),w=o.useRef(null);o.useEffect(()=>{const U=F.configChange;if(!U)return;const $=`${U.epoch}:${U.seq}`;w.current!==$&&(w.current=$,U.changedKeys.some(v=>v==="notifications"||v.startsWith("notifications.")||v==="display"||v===it||v===St)&&z())},[F.configChange,z]),o.useEffect(()=>{const U=()=>{a.invalidateQueries({queryKey:Yn.list})};return window.addEventListener("focus",U),()=>window.removeEventListener("focus",U)},[a]);const G=o.useRef(null),P=o.useRef(null),V=o.useRef(null),Z=n("ui.settings.notifications.section.title"),_=n("ui.settings.notifications.section.description"),I=U=>e.jsx(Re,{title:Z,icon:Oc,description:_,sectionRef:t,searchSection:"notifications",searchSectionLabel:Z,searchIgnore:"notification rows are registry keys read from the daemon's own selection",children:U});if(l==="pairing"){const{sentence:U}=Pt(r??null,n("ui.settings.notifications.load.failed",{reason:""}).trim(),i.data?null:i.error??null);return I(e.jsx(ge,{variant:"warning",children:U}))}const S=Qn(g,!0),q=e.jsxs("div",{className:"flex flex-col gap-1",ref:P,children:[g&&e.jsx(Lt,{label:g.label,description:g.help||void 0,value:S,isSaving:!!M[it],savingInPlace:!0,onChange:U=>h(it,U).catch(()=>{})}),f&&e.jsx(Lt,{label:f.label,description:f.help||void 0,value:Qn(f,!0),isSaving:!!M[St],savingInPlace:!0,onChange:U=>h(St,U).catch(()=>{})}),[it,St].map(U=>T[U]&&e.jsx("output",{className:"block text-meta text-danger",children:T[U]},U))]});if(d.isPending)return I(e.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(Ce,{size:"sm"}),n("ui.settings.notifications.load.loading")]}));if(d.error){const{sentence:U}=Pt(r??null,n("ui.settings.notifications.load.failed",{reason:""}).trim(),d.error);return I(e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("span",{children:U}),e.jsxs(O,{variant:"secondary",size:"sm",onClick:()=>{z().then(()=>{a.getQueryState(lt.all)?.status==="success"&&R({})})},children:[e.jsx(jn,{"aria-hidden":"true"}),n("ui.settings.notifications.retry")]})]})}))}const ae=e.jsx("h3",{className:"text-body font-medium text-ink",children:n("ui.settings.notifications.sound.heading")});if(l==="older")return I(e.jsxs("div",{className:"flex flex-col gap-6",children:[q,e.jsxs("div",{className:"flex flex-col gap-2 border-t border-hairline pt-6",children:[ae,e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.notifications.backend_older")})]})]}));const Y=u.data??null,ne=Qn(j,Y?.enabled??!0),ce=typeof y?.value=="string"?y.value:Y?.selected??"",le=za(N?{...N,value:N.default}:void 0,ea),ue=za(N,Y?.volume??ea),we=U=>{const{key:$,value:v}=Uo(U,le);return n($,{value:v})};return I(e.jsxs("div",{className:"flex flex-col gap-6",children:[q,e.jsxs("div",{className:"flex flex-col gap-4 border-t border-hairline pt-6","data-notification-sound-group":"",children:[ae,!S&&e.jsx(ge,{variant:"info",children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("span",{children:n("ui.settings.notifications.sound.gated")}),e.jsx(O,{variant:"secondary",size:"sm",disabled:!!M[it],onClick:()=>{h(it,!0).then(()=>Pa(P.current,'[role="switch"]'),()=>{})},children:n("ui.settings.notifications.sound.gated_action")})]})}),j&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(Lt,{searchRow:"notifications.sound.enabled",searchTerms:n("ui.settings.notifications.search_terms"),label:n("ui.settings.notifications.sound.enabled_label"),description:n("ui.settings.notifications.sound.enabled_description"),value:ne,isSaving:!!M["notifications.sound.enabled"],savingInPlace:!0,onChange:U=>h("notifications.sound.enabled",U).catch(()=>{})}),!ne&&e.jsx("p",{className:"text-body-sm text-ink-muted","data-sound-off-note":"",children:n("ui.settings.notifications.sound.enabled_off_note")}),T["notifications.sound.enabled"]&&e.jsx("output",{className:"block text-meta text-danger",children:T["notifications.sound.enabled"]})]}),N&&e.jsxs("div",{ref:V,className:"flex flex-col gap-1","data-search-row":"notifications.sound.volume","data-search-control":"",children:[e.jsx(Lc,{value:ue,label:n("ui.settings.notifications.volume.label"),description:n(Ko(ue,ce)),min:0,max:100,step:Po,pageStep:zo,icon:Fo(ue),readout:we,valueText:U=>n("ui.settings.notifications.volume.valuetext",{value:Math.round(U)}),disabled:ce===ls,isSaving:!!M["notifications.sound.volume"],savingInPlace:!0,trailing:Math.round(ue)!==Math.round(le)?e.jsx(O,{variant:"link",size:"sm",disabled:ce===ls,onClick:()=>{L("notifications.sound.volume").then(()=>{Pa(V.current,'input[type="range"]'),G.current?.previewSelected(le)},()=>{})},children:n("ui.settings.notifications.volume.reset")}):null,onChange:async U=>{await h("notifications.sound.volume",U),G.current?.previewSelected(U)}}),T["notifications.sound.volume"]&&e.jsx("output",{className:"block text-meta text-danger",children:T["notifications.sound.volume"]})]}),u.error?e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("span",{children:n("ui.settings.notifications.load.failed",{reason:u.error instanceof Error?u.error.message:""}).trim()}),e.jsxs(O,{variant:"secondary",size:"sm",onClick:()=>{u.refetch()},children:[e.jsx(jn,{"aria-hidden":"true"}),n("ui.settings.notifications.retry")]})]})}):Y?e.jsx(Ai,{fallbackRender:gf,children:e.jsx(mr,{ref:G,listing:Y,selectedId:ce,volume:ue,canSelect:!!y,onSelect:U=>h("notifications.sound.id",U),onChanged:z,...s})}):e.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(Ce,{size:"sm"}),n("ui.settings.notifications.load.loading")]}),x.missing.length>0&&e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.notifications.missing_rows",{count:x.missing.length,rows:x.missing.join(", ")})}),e.jsx(ff,{})]})]}))},ff=()=>{te();const[t,s]=o.useState("idle"),a=window.api?.sendTestNotification;return typeof a!="function"?null:e.jsxs("div",{className:"flex flex-col items-start gap-2",children:[e.jsxs(O,{variant:"secondary",size:"sm",disabled:t==="sending",onClick:async()=>{s("sending");try{const i=await a();s(i.shown?"sent":"failed")}catch{s("failed")}},children:[t==="sending"&&e.jsx(Ce,{size:"xs"}),n("ui.settings.notifications.test.action")]}),e.jsx("output",{"aria-live":"polite",className:"text-body-sm text-ink-muted",children:t==="sent"?n("ui.settings.notifications.test.sent"):t==="failed"?n("ui.settings.notifications.test.failed"):""})]})};function Pa(t,s){requestAnimationFrame(()=>{t?.querySelector(s)?.focus()})}const zt=new WeakMap,$a=new WeakSet;function gr(t,s){if(!$a.has(t)){$a.add(t);let i=ft(t);Bo(t,()=>{const r=ft(t);i!==r&&(i=r,zt.delete(t))})}if(!s.startsWith(`${ft(t)}:`))return;const a=zt.get(t);if(a?.key===s)return a;zt.delete(t)}function hf(t,s,a){if(s.startsWith(`${ft(t)}:`)){if(gr(t,s),!Object.keys(a).length){zt.delete(t);return}zt.set(t,{key:s,fields:a})}}const xf=De.object({display_name:De.string(),title:De.string(),description:De.string(),timezone:De.string()}),_f=xf.extend({account_id:De.string(),display_label:De.string(),avatar_url:De.string().optional(),avatar:De.object({source:De.string(),hash:De.string(),updated_at:De.string().optional()}).optional()}),yf=De.object({scope:De.string().regex(/^[a-f0-9]{64}$/),profile:_f});class Ua extends Error{constructor(s,a){super("Account profile request failed"),this.code=s,this.status=a}}async function tn(t,s=null){const a=await ns(t,s);if(a.kind!=="json")throw new Ua(a.kind==="error"?a.code:void 0,a.kind==="error"?a.status:null);const i=yf.parse(a.body.result);if(i.profile.account_id!==t.expectedAccountId)throw new Ua("account_mismatch",409);return i}const nn={read:t=>tn({op:"account.profile",expectedAccountId:t}),update:(t,s,a)=>tn({op:"account.profile.update",expectedAccountId:t,scope:s,fields:a}),upload:(t,s,a)=>tn({op:"account.avatar.put",expectedAccountId:t,scope:s},a),remove:(t,s,a)=>tn({op:"account.avatar.delete",expectedAccountId:t,scope:s,mode:a,confirmed:!0})};function Zn(t,s){return Object.fromEntries(Object.keys(t).filter(a=>t[a]!==s[a]).map(a=>[a,s[a]]))}const pr={snapshot:(t,s)=>["account-profile",t,s]};function Jn(t,s,a){if(ft(t)!==s||qo(t).accountId!==a.profile.account_id)throw new Error("Account authority changed");t.setQueryData(pr.snapshot(a.profile.account_id,s),a),t.setQueryData(ta.user(),i=>{if(!i||i.account.id!==a.profile.account_id)return i;const{display_name:r,title:c,description:l,timezone:d,avatar:u,avatar_url:m}=a.profile;return{...i,account:{...i.account,profile:{...i.account.profile,display_name:r,title:c,description:l,timezone:d,avatar:u},avatar_url:m}}}),t.invalidateQueries({predicate:i=>i.queryKey[0]==="team-bridge"&&i.queryKey.some((r,c)=>r==="account"&&i.queryKey[c+1]===a.profile.account_id)}),t.invalidateQueries({queryKey:ta.user()})}function bf(t=!0,s=()=>"personal"){const a=bt(),i=gi(),r=i.accountId,c=s(),l=Fe({queryKey:pr.snapshot(r??"unresolved",i.token),enabled:t&&!!r,retry:!1,queryFn:()=>Ho(a,r,()=>nn.read(r??""))}),d=()=>{if(!r||ft(a)!==i.token||s()!==c)throw new Error("Account authority changed")};return{...l,authority:i,async update(u){if(d(),!l.data||!r)throw new Error("Account profile unresolved");const m=await nn.update(r,l.data.scope,u);return d(),Jn(a,i.token,m),m},async upload(u){if(d(),!l.data||!r)throw new Error("Account profile unresolved");const m=await nn.upload(r,l.data.scope,u);return d(),Jn(a,i.token,m),m},async remove(u){if(d(),!l.data||!r)throw new Error("Account profile unresolved");const m=await nn.remove(r,l.data.scope,u);return d(),Jn(a,i.token,m),m}}}const vf=1024*1024;function kf(t){const s=new DataView(t.buffer,t.byteOffset,t.byteLength);if(t.length>=24&&s.getUint32(0)===2303741511&&s.getUint32(4)===218765834&&s.getUint32(12)===1229472850)return{width:s.getUint32(16),height:s.getUint32(20)};if(t.length>=4&&t[0]===255&&t[1]===216){let a=2;for(;a+3<t.length;){if(t[a++]!==255)return null;for(;t[a]===255;)a++;const i=t[a++];if(i===217||i===218||a+2>t.length)return null;if(i===1||i>=208&&i<=215)continue;const r=s.getUint16(a);if(r<2||a+r>t.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(t.length>=25&&s.getUint32(0)===1380533830&&s.getUint32(8)===1464156752&&s.getUint32(4,!0)+8===t.length){const a=s.getUint32(12);if(a===1448097880&&t.length>=30)return{width:1+t[24]+(t[25]<<8)+(t[26]<<16),height:1+t[27]+(t[28]<<8)+(t[29]<<16)};if(a===1448097824&&t.length>=30&&t[23]===157&&t[24]===1&&t[25]===42)return{width:s.getUint16(26,!0)&16383,height:s.getUint16(28,!0)&16383};if(a===1448097868&&t[20]===47)return{width:1+((t[22]&63)<<8|t[21]),height:1+((t[24]&15)<<10|t[23]<<2|(t[22]&192)>>6)}}return null}function Ka(t){return!!(t&&t.width>0&&t.height>0&&t.width<=4096&&t.height<=4096&&t.width*t.height<=16e6)}async function jf(t){if(!t.size||t.size>vf||!["image/png","image/jpeg","image/webp"].includes(t.type))throw new Error("Profile image refused");const s=new Uint8Array(await t.arrayBuffer());if(!Ka(kf(s)))throw new Error("Profile image dimensions refused");const a=await createImageBitmap(t,{imageOrientation:"from-image"});if(!Ka(a))throw a.close(),new Error("Profile decoded image dimensions refused");return a}const sn=t=>({display_name:t.profile.display_name,title:t.profile.title,description:t.profile.description,timezone:t.profile.timezone}),xn={display_name:64,title:80,description:500},wf=t=>xn[t]*2,Ba=8,qa=t=>t.formatToParts(new Date).find(s=>s.type==="timeZoneName")?.value;function Nf(){return[...new Set(["UTC",...Intl.supportedValuesOf("timeZone")])].map(t=>{const s=qa(new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"shortOffset"})),a=qa(new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"short"})),i=[s,a].filter(r=>!!r&&r!==t);return{id:t,name:t.split("_").join(" "),description:s,keywords:i}})}function Sf({snapshot:t,initialDraft:s,onDraftChange:a,photoUrl:i,onSave:r,onUpload:c,onRemove:l}){te();const d=o.useId(),[u,m]=o.useState(()=>sn(t)),[p,g]=o.useState(()=>({...sn(t),...s})),[f,x]=o.useState(!1),[j,y]=o.useState(!1),[N,M]=o.useState(),[E,T]=o.useState(),[R,D]=o.useState(),[b,z]=o.useState(),[B,K]=o.useState(),[h,L]=o.useState(),F={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)},w=o.useMemo(Nf,[]),[G,P]=o.useState(!1),[V,Z]=o.useState(!1),[_,I]=o.useState(),S=kl(_),q=o.useRef(null),ae=o.useRef(void 0),Y=o.useRef(!0),ne=o.useRef(0),ce=Object.keys(Zn(u,p)).length>0;o.useEffect(()=>{a?.(Zn(u,p))},[u,p,a]);const le=R==="photo_invalid"?n("ui.settings.personal_profile.photo_invalid"):R?n("ui.settings.personal_profile.photo_error"):void 0,ue=t.profile.avatar,we=ue?.source==="uploaded"?"uploaded":"provider",U=f||j;o.useEffect(()=>(Y.current=!0,()=>{Y.current=!1,ne.current++,ae.current?.close()}),[]),o.useEffect(()=>{h&&(F[h].current?.focus(),L(void 0))});const $=()=>{ne.current++,ae.current?.close(),ae.current=void 0,I(void 0),D(void 0)},v=()=>{$(),L("photo")},W=()=>{P(!1),L("cancel")},se=()=>{Z(!1),L("remove")},ee=(Q,oe=!1)=>me=>{me.key!=="Escape"||oe||(me.preventDefault(),me.stopPropagation(),Q())},ye=async Q=>{if(!Q||U)return;const oe=++ne.current;D(void 0),y(!0),K(void 0);try{const me=await jf(Q);if(!Y.current||oe!==ne.current){me.close();return}ae.current?.close(),ae.current=me,I(me),Z(!1)}catch{Y.current&&oe===ne.current&&D("photo_invalid")}finally{Y.current&&oe===ne.current&&y(!1)}},Se=async()=>{if(!Y.current||U||!ce)return;const Q=Zn(u,p),oe=Object.keys(xn).map(me=>me in Q&&[...p[me]].length>xn[me]?{field:me,reason:"length"}:me==="description"&&p.description.split(`
|
|
298
|
+
`).length>Ba?{field:me,reason:"lines"}:void 0).find(Boolean);if(oe){T(oe),L(oe.field);return}x(!0),M(void 0),T(void 0),z(void 0);try{const me=await r(Q);if(!Y.current)return;m(sn(me)),g(sn(me)),z("saved"),L("heading")}catch{Y.current&&M("save_error")}finally{Y.current&&x(!1)}},he=async Q=>{if(!Y.current||U)return;y(!0),D(void 0),K(void 0);const oe=ne.current,me=S.capture();try{if(Q.size>1024*1024)throw new Error("Profile crop too large");if(!await wl(S,me,()=>Q.arrayBuffer(),Qe=>{if(!(!Y.current||oe!==ne.current))return c(new Uint8Array(Qe))})||!Y.current)return;$(),K("photo_saved"),L("photo")}catch{Y.current&&D("photo_error")}finally{Y.current&&y(!1)}},be=async()=>{if(!(!Y.current||U)){y(!0),D(void 0),K(void 0);try{await l(we),Y.current&&(Z(!1),K("photo_removed"),L("photo"))}catch{Y.current&&D("photo_error")}finally{Y.current&&y(!1)}}},ke=(Q,oe)=>{f||(g(me=>({...me,[Q]:oe})),z(void 0),M(void 0),E?.field===Q&&T(void 0),P(!1))},ie=Q=>E?.field!==Q?void 0:E.reason==="lines"?n("ui.settings.personal_profile.description_lines",{count:String(Ba)}):n("ui.settings.personal_profile.field_too_long",{count:String(xn[Q])}),de=(Q,oe,me)=>{const Ie=ie(Q);return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(qe,{htmlFor:`${d}-${Q}`,children:oe}),me({id:`${d}-${Q}`,value:p[Q],maxLength:wf(Q),readOnly:f,"aria-invalid":Ie?!0:void 0,"aria-describedby":Ie?`${d}-${Q}-error`:void 0}),Ie&&e.jsx("p",{id:`${d}-${Q}-error`,className:"text-meta text-danger",children:Ie})]})};return e.jsxs("section",{"aria-labelledby":`${d}-heading`,className:"flex min-w-0 flex-col gap-4","data-account-profile-editor":"",children:[e.jsx("h3",{ref:F.heading,id:`${d}-heading`,tabIndex:-1,className:"text-section font-semibold text-ink focus:outline-none",children:n("ui.settings.personal_profile.heading")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.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?e.jsx("img",{alt:"",src:i,className:"size-full object-cover"}):t.profile.display_label.trim()[0]||"?"}),e.jsx(O,{ref:F.photo,variant:"secondary",size:"sm",disabled:U,onClick:()=>q.current?.click(),children:ue?.hash?n("ui.settings.personal_profile.replace"):n("ui.settings.personal_profile.choose")}),ue?.hash&&e.jsx(O,{ref:F.remove,variant:"ghost",size:"sm",disabled:U,onClick:()=>{Z(!0),$(),L("remove_cancel")},children:n("ui.settings.personal_profile.remove")}),e.jsx("input",{ref:q,type:"file",accept:"image/png,image/jpeg,image/webp",className:"sr-only",tabIndex:-1,"aria-hidden":"true",disabled:U,onChange:Q=>{const oe=Q.currentTarget.files?.[0];Q.currentTarget.value="",ye(oe)}})]}),e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.personal_profile.photo_help")}),e.jsx("output",{className:"text-meta text-ink-muted empty:hidden",children:B==="photo_saved"?n("ui.settings.personal_profile.photo_saved"):B==="photo_removed"?n("ui.settings.personal_profile.photo_removed"):null}),_&&e.jsx("div",{onKeyDown:ee(v,j),children:e.jsx(jl,{source:_,outputEdge:256,onSave:Q=>void he(Q),onCancel:v,saving:j,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:(Q,oe)=>n("ui.settings.personal_profile.crop_instructions",{width:String(Q),height:String(oe)}),zoom:n("ui.settings.personal_profile.zoom"),zoomIn:n("ui.settings.personal_profile.zoom_in"),zoomOut:n("ui.settings.personal_profile.zoom_out"),zoomValue:Q=>n("ui.settings.personal_profile.zoom_value",{value:Q}),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")}})}),V&&e.jsxs("fieldset",{className:"flex flex-col gap-2","aria-label":n("ui.settings.personal_profile.remove"),onKeyDown:ee(se,j),children:[e.jsx("p",{className:"text-body-sm text-ink",children:we==="uploaded"?n("ui.settings.personal_profile.remove_uploaded"):n("ui.settings.personal_profile.remove_provider")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(O,{variant:"danger",size:"sm",disabled:U,onClick:()=>void be(),children:j?n("ui.settings.personal_profile.saving"):n("ui.settings.personal_profile.remove")}),e.jsx(O,{ref:F.remove_cancel,variant:"secondary",size:"sm",disabled:U,onClick:se,children:n("ui.common.actions.cancel")})]})]}),R&&!_&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:le}),e.jsxs("form",{className:"flex min-w-0 flex-col gap-4",onSubmit:Q=>{Q.preventDefault(),Se()},"aria-busy":f,children:[de("display_name",n("ui.settings.personal_profile.display_name"),Q=>e.jsx(Le,{ref:F.display_name,...Q,onChange:oe=>ke("display_name",oe.target.value),autoComplete:"nickname"})),de("title",n("ui.settings.personal_profile.title"),Q=>e.jsx(Le,{ref:F.title,...Q,onChange:oe=>ke("title",oe.target.value),autoComplete:"organization-title"})),de("description",n("ui.settings.personal_profile.description"),Q=>e.jsx(Ls,{ref:F.description,...Q,onChange:oe=>ke("description",oe.target.value),rows:3})),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(qe,{asChild:!0,children:e.jsx("span",{"aria-hidden":"true",children:n("ui.settings.personal_profile.timezone")})}),e.jsx(ji,{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:w,selected:p.timezone?w.find(Q=>Q.id===p.timezone)??{id:p.timezone,name:p.timezone.split("_").join(" ")}:null,onSelect:Q=>ke("timezone",Q.id),onClear:()=>ke("timezone","")})]}),N&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.personal_profile.save_error")}),G?e.jsxs("div",{className:"flex flex-col gap-2",onKeyDown:ee(W),children:[e.jsx("p",{role:"alert",className:"text-body-sm text-ink",children:n("ui.settings.personal_profile.discard")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:()=>{g(u),P(!1),M(void 0),T(void 0),L("heading")},children:n("ui.settings.personal_profile.discard_action")}),e.jsx(O,{ref:F.keep_editing,type:"button",variant:"primary",size:"sm",onClick:W,children:n("ui.settings.personal_profile.keep_editing")})]})]}):e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(O,{type:"submit",variant:"primary",size:"sm",disabled:!ce||U,children:f?n("ui.settings.personal_profile.saving"):n("ui.settings.personal_profile.save")}),e.jsx(O,{ref:F.cancel,type:"button",variant:"secondary",size:"sm",disabled:!ce||f,onClick:()=>{P(!0),L("keep_editing")},children:n("ui.common.actions.cancel")})]})]}),e.jsx("output",{className:"text-meta text-ink-muted empty:hidden",children:b==="saved"?n("ui.settings.personal_profile.saved"):null}),e.jsxs(O,{variant:"link",size:"sm",className:"w-fit",onClick:()=>As("https://console.radienthq.com/dashboard/account"),children:[n("ui.settings.personal_profile.manage"),e.jsx(pi,{"aria-hidden":"true"})]})]})}function Cf(){return te(),e.jsx("output",{className:"text-body-sm text-ink-muted",children:n("ui.settings.personal_profile.loading")})}function Mf({onRetry:t}){return te(),e.jsxs("div",{className:"flex flex-col items-start gap-2",children:[e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:n("ui.settings.personal_profile.load_error")}),e.jsx(O,{variant:"secondary",size:"sm",onClick:t,children:n("ui.common.actions.retry")})]})}const Af=/^[a-f0-9]{16}$/;function Ef(){te();const t=vt(),s=_t(t.data,"account_profile"),a=gi(),i=o.useCallback(()=>{try{return JSON.stringify(a.accountId?_l(window.localStorage,a.accountId)??"personal":"unresolved")}catch{return"unresolved"}},[a.accountId]),r=o.useCallback(j=>{const y=N=>{(N.key===bl||N.key===null)&&j()};return window.addEventListener("storage",y),()=>window.removeEventListener("storage",y)},[]),c=o.useSyncExternalStore(r,i,i),l=bf(s,i),d=o.useRef(null),u=l.data,m=bt(),p=`${l.authority.token}:${c}:${u?.scope??""}`,g=u?gr(m,p):void 0,f=u?.profile.avatar?.hash,x=Dc(u&&f&&Af.test(f)?{accountId:u.profile.account_id,hash:f}:null,64);return o.useEffect(()=>{!u||!yl(l.authority.token)||(d.current?.scrollIntoView({block:"start"}),d.current?.focus({preventScroll:!0}))},[u,l.authority.token]),s?!l.authority.accountId||l.isPending?e.jsx(Cf,{}):u?e.jsx("div",{ref:d,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:e.jsx(Sf,{snapshot:u,initialDraft:g?.fields,onDraftChange:j=>hf(m,p,j),photoUrl:x,onSave:l.update,onUpload:l.upload,onRemove:l.remove},p)}):e.jsx(Mf,{onRetry:()=>void l.refetch()}):e.jsx(O,{variant:"secondary",size:"sm",onClick:()=>As("https://console.radienthq.com/dashboard/account"),children:n("ui.settings.personal_profile.manage")})}const Rf=({verification:t})=>{te();const{prices:s}=Go(),a=t.grant_amount??s?.default_new_credits,{sentence:i,action:r}=Wo(t.signup_grant,Yo(a)),c=Qo(t.claim_url,Zo);return e.jsxs("div",{className:"mt-8 flex items-start gap-3 rounded-sm border border-hairline bg-surface p-3",children:[e.jsx(kn,{className:"mt-0.5 size-4 shrink-0 text-ink-muted","aria-hidden":"true"}),e.jsxs("div",{className:"flex min-w-0 flex-col items-start gap-2",children:[e.jsx("p",{className:"text-body-sm text-ink",children:i}),e.jsx(O,{variant:"secondary",size:"sm",onClick:()=>As(c),children:r})]})]})},If=({onAfterCredentialUpdate:t})=>{te();const{isAuthenticated:s,user:a,isLoading:i,accountRead:r,signOut:c}=Vo(),l=fi(g=>g.isSigningOut),d=o.useCallback(async()=>{try{await c()}catch(g){console.error("Error signing out:",g)}},[c]),u=(()=>{if(!s||!a?.radientUser)return null;const{account:g,identity:f,verification:x}=a.radientUser,j=x!=null&&!x.email_verified&&x.signup_grant!=="claimed";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-8",children:e.jsx(Ef,{})}),e.jsxs(qt,{children:[e.jsx(Te,{label:n("ui.settings.account.radient_account_section.status"),value:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[n("ui.settings.account.radient_account_section.connected"),e.jsx(yt,{variant:"success",className:"capitalize",children:g.status})]})}),e.jsx(Te,{label:n("ui.settings.account.radient_account_section.name"),value:g.name||n("ui.settings.account.radient_account_section.not_provided")}),e.jsx(Te,{label:n("ui.settings.account.radient_account_section.email"),value:g.email}),e.jsx(Te,{label:n("ui.settings.account.radient_account_section.account_id"),value:e.jsx("span",{className:"text-mono-sm",children:g.id})}),e.jsx(Te,{label:n("ui.settings.account.radient_account_section.tenant_id"),value:e.jsx("span",{className:"text-mono-sm",children:g.tenant_id})}),e.jsx(Te,{label:n("ui.settings.account.radient_account_section.provider"),value:e.jsx("span",{className:"capitalize",children:f.provider})}),e.jsx(Te,{label:n("ui.settings.account.radient_account_section.created"),value:hi(g.created_at)})]}),j&&x?e.jsx(Rf,{verification:x}):null,e.jsx("div",{className:"mt-8",children:e.jsx(Fc,{offerSignIn:!0})}),e.jsxs("div",{className:"mt-8",children:[e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.radient_account_section.need_to_sign_out_or_switch_accounts")}),e.jsxs(O,{variant:"danger",className:"mt-3",onClick:d,children:[e.jsx(zc,{}),n("ui.settings.account.radient_account_section.sign_out_from_radient")]})]})]})})(),m=r==="refused"?n("ui.settings.account.radient_account_section.radient_refused_the_sign_in_this_app_is_holding_so_your_account_d"):xi(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:e.jsxs("div",{children:[e.jsxs("p",{className:"text-body-sm text-ink-muted",children:[m," ",n("ui.settings.account.radient_account_section.sign_in_to_access_your_account_details_or_sign_up_to_get_free_cre")]}),e.jsx("div",{className:"mt-6",children:e.jsx(vl,{titleText:"",onAfterCredentialUpdate:t,descriptionText:"",onSignInSuccess:()=>{}})})]});return i||l?e.jsxs("div",{className:"flex min-h-36 flex-col items-center justify-center gap-3",children:[e.jsx(Ce,{size:"lg",label:n("ui.settings.account.radient_account_section.loading_account")}),!l&&e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.account.radient_account_section.loading_your_radient_account_details")})]}):s&&a?.radientUser?u:e.jsx("div",{className:"flex flex-col gap-4",children:p})},Xn={label:1,synonym:.8,key:.75,choice:.7,section:.6,description:.4},Tf={exact:1,prefix:.92,substring:.7,subsequence:.45};function fr(t){return t.length<4||!t.endsWith("s")?t:/(?:ch|sh|ss|x|z)es$/.test(t)?t.slice(0,-2):t.slice(0,-1)}function Ha(t){let s=!1;const a=t.split(" ").map(i=>{const r=fr(i);return r!==i&&(s=!0),r}).join(" ");return s?a:t}const Va=new WeakMap,Ga={exact:3,prefix:2,substring:1};function Lf(t,s,a){const i=fr(a),r=[Yt(t,a)];i!==a&&r.push(Yt(t,i)),s!==t&&(r.push(Yt(s,a)),i!==a&&r.push(Yt(s,i)));let c=null;for(const l of r)!l||l==="subsequence"||(!c||Ga[l]>Ga[c])&&(c=l);return c}const Of=12,Df=2;function Ff(t,s){let a=0,i=-1,r=null,c=Va.get(t.fields);if(!c){c={};for(const l of Object.keys(Xn)){const d=t.fields[l];d&&(c[l]=Ha(d))}Va.set(t.fields,c)}for(const l of s){let d=-1,u=null;for(const m of Object.keys(Xn)){const p=t.fields[m];if(!p)continue;const g=Lf(p,c[m]??Ha(p),l);if(!g)continue;const f=Xn[m]*Tf[g];f>d&&(d=f,u=m)}if(u===null)return null;a+=d,d>i&&(i=d,r=u)}return r?{score:a,reason:r}:null}function zf(t,s,a=Of){const i=Pc(s);if(i.length===0)return{results:[],total:0};const r=$t(s),c=[];for(const l of t){const d=Ff(l,i);if(!d)continue;const u=l.fields.label!==""&&l.fields.label===r;c.push({entry:l,reason:d.reason,score:u?d.score+Df:d.score})}return c.sort((l,d)=>d.score-l.score||l.entry.fields.label.length-d.entry.fields.label.length||l.entry.order-d.entry.order),{results:c.slice(0,Math.max(0,a)).map(({entry:l,reason:d})=>({entry:l,reason:d})),total:c.length}}function Pf(t){return $t(t)===""}function $f(t){const s=new Map;for(const r of t){const c=r.entry.sectionId||"",l=s.get(c);if(l){l.results.push(r);continue}s.set(c,{sectionId:c,sectionLabel:r.entry.sectionLabel,results:[r]})}const a=[...s.values()],i=a.filter(r=>r.sectionId==="");return[...a.filter(r=>r.sectionId!==""),...i]}const Uf={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 Kf(t){const{registry:s,sections:a,build:i=Em}=t,r=te();return o.useMemo(()=>i({registry:s,sections:a}),[i,s,a,r])}function Bf(){return ec()==="mac"?"⌘F":"Ctrl+F"}const qf=o.forwardRef(function({index:s,readRendered:a,onJump:i,onDismiss:r,className:c},l){te();const d=o.useRef(null),u=o.useRef(null),[m,p]=o.useState(null),[g,f]=o.useState(""),[x,j]=o.useState(!1),[y,N]=o.useState(-1),[M,E]=o.useState(""),T=o.useId();o.useImperativeHandle(l,()=>({focus:()=>{d.current?.focus(),j(!0)}}));const R=o.useCallback(()=>a?.()??[],[a]),D=o.useCallback(()=>{p(R())},[R]),b=o.useCallback(()=>{p(S=>S??R())},[R]),z=o.useCallback(()=>{const S=m;return S&&S.length>0?[...s,...S]:s},[s,m]),B=Pf(g),{results:K,total:h}=o.useMemo(()=>zf(z(),g),[z,g]),L=o.useMemo(()=>$f(K),[K]),F=y<0||K.length===0?-1:Math.min(y,K.length-1),w=F>=0?K[F]:void 0,G=o.useMemo(()=>new Map(K.map((S,q)=>[S.entry.id,q])),[K]),P=o.useCallback(S=>{S!==void 0&&f(S),j(!1),N(-1),r?.()},[r]),V=o.useCallback(async S=>{if(await i(S)==="missing"){E(n("ui.settings.search.jump.missing"));return}E(""),j(!1),N(-1)},[i]),Z=S=>`${T}-option-${S}`,_=S=>{switch(S.key){case"ArrowDown":S.preventDefault(),j(!0),N(q=>K.length===0?-1:q<0?0:(q+1)%K.length);return;case"ArrowUp":S.preventDefault(),j(!0),N(q=>K.length===0?-1:q<0?K.length-1:(q-1+K.length)%K.length);return;case"Home":if(!x)return;S.preventDefault(),N(0);return;case"End":if(!x)return;S.preventDefault(),N(Math.max(0,K.length-1));return;case"Enter":if(S.preventDefault(),!x){j(!0);return}{const q=w??K[0];q&&V(q.entry)}return;case"Escape":if(S.preventDefault(),g!==""){f(""),E(""),N(-1);return}P();return;default:return}},I=B?"":n("ui.settings.search.results.count",{count:h});return e.jsxs("div",{ref:u,className:pe("relative @container w-full",c),onBlur:S=>{const q=S.relatedTarget;q&&u.current?.contains(q)||(j(!1),N(-1),r?.())},children:[e.jsxs("div",{className:"relative",children:[e.jsx(js,{size:14,"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-ink-dim"}),e.jsx(Le,{ref:d,role:"combobox","aria-expanded":x,"aria-controls":x?T:void 0,"aria-activedescendant":x&&w?Z(F):void 0,"aria-autocomplete":"list","aria-label":n("ui.settings.search.field.label"),placeholder:n("ui.settings.search.field.placeholder"),value:g,type:"text",className:"pl-8",onFocus:()=>{D(),j(!0)},onChange:S=>{b(),f(S.currentTarget.value),N(-1),E(""),j(!0)},onKeyDown:_})]}),x&&e.jsxs("div",{id:T,role:"listbox",tabIndex:-1,"aria-label":n("ui.settings.search.panel.label"),className:"absolute top-full right-0 z-40 mt-2 flex max-h-[min(24rem,60vh)] w-full min-w-80 flex-col overflow-y-auto rounded-md border border-hairline bg-elevated p-1 shadow-overlay",children:[M&&e.jsx("p",{"data-search-notice":"","aria-hidden":"true",className:"px-2 pt-2 pb-1 text-body-sm text-ink",children:M}),B?e.jsxs("div",{className:"flex flex-col gap-1 px-2 py-2",children:[e.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.empty.summary")}),e.jsx("p",{className:"text-meta text-ink-dim",children:e.jsx(Jo,{text:n("ui.settings.search.empty.shortcut",{shortcut:Xo(Bf())})})})]}):K.length===0?e.jsxs("div",{className:"flex flex-col gap-2 px-2 py-2",children:[e.jsx("p",{className:"text-body-sm text-ink",children:n("ui.settings.search.no_results.title",{query:g})}),e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.search.no_results.hint")}),e.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:S=>S.preventDefault(),onClick:()=>{P(""),d.current?.focus()},children:n("ui.settings.search.no_results.clear")})]}):e.jsxs(e.Fragment,{children:[L.map(S=>e.jsxs("div",{role:S.sectionLabel?"group":void 0,"aria-label":S.sectionLabel||void 0,children:[S.sectionLabel&&e.jsx("p",{className:"px-2 pt-2 pb-1 font-medium text-ink-muted text-meta",children:S.sectionLabel}),S.results.map(q=>{const ae=G.get(q.entry.id)??0,Y=ae===F;return e.jsxs("div",{id:Z(ae),role:"option","aria-selected":Y,"data-search-result-id":q.entry.id,className:pe("flex cursor-pointer flex-col gap-0.5 rounded-sm px-2 py-1.5 @[40rem]:flex-row @[40rem]:items-baseline @[40rem]:justify-between @[40rem]:gap-4",Y?"bg-accent-wash outline-solid outline-1 -outline-offset-1 outline-control":"hover:bg-row-hover"),onMouseDown:ne=>ne.preventDefault(),onMouseEnter:()=>N(ae),onClick:()=>V(q.entry),children:[e.jsx("span",{className:"min-w-0 text-body-sm text-ink",children:q.entry.label}),e.jsxs("span",{className:"@[40rem]:shrink-0 @[40rem]:text-right text-meta text-ink-dim",children:[q.entry.sectionLabel&&n("ui.settings.search.row.section_hint",{section:q.entry.sectionLabel}),q.entry.sectionLabel&&" · ",n(Uf[q.reason]),q.entry.detail&&q.entry.detail!==q.entry.sectionLabel&&e.jsxs(e.Fragment,{children:[" · ",q.entry.detail]})]})]},q.entry.id)})]},S.sectionId||"no-section")),h>K.length&&e.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:h-K.length})})]})]}),e.jsx("output",{"aria-live":"polite",className:"sr-only",children:M||I})]})});function Hf({metric:t,data:s}){return te(),e.jsx(tc,{title:"",heightClassName:"h-62",yAxisWidth:48,unit:t==="credits"?"credits":"tokens",srSummary:t==="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=>t==="credits"?`$${a.toFixed(2)}`:nc(a),children:e.jsx(qu,{data:s,children:e.jsx(ri,{type:"monotone",dataKey:"value",strokeWidth:2,dot:!1,activeDot:{r:4,strokeWidth:0},name:t==="credits"?n("ui.settings.account.settings_usage_chart.credits_consumed"):n("ui.settings.account.settings_usage_chart.tokens_used")})})})}const Vf={all:["desktop","tts-path-resolution"]};function Gf(t){return Fe({queryKey:Vf.all,queryFn:()=>je({op:"tts.paths"}),enabled:t,staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:qr})}const Wf=["speech.voice.gender","speech.voice.tone","speech.voice.expressiveness","speech.voice.pace","speech.voice.language","speech.voice.accent","speech.voice.instructions"];function Wa(t){const s=new Map(t.map(r=>[r.key,r])),a=[],i=[];for(const r of Wf){const c=s.get(r);c?a.push(c):i.push(r)}return{rows:a,missing:i}}const Yf=["provider_tts_radient","provider_tts_elevenlabs","provider_tts_openai","none"];function Ya(t){return typeof t=="string"&&Yf.includes(t)}function Qf(t){if(t===null||typeof t!="object")return null;const s=t;if(!Ya(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(!Ya(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 Zf={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 hr(t){return Zf[t]}function Jf(t){return{servable:t.servable,serving:t.path==="none"?null:t.path,reason:t.reason,rungs:t.rungs.map(s=>({path:s.path,name:hr(s.path),available:s.available,reason:s.reason}))}}const Xf="ui.settings.speech.speech_section.copy_backend_older_sentence",xr="ui.settings.speech.speech_section.copy_unavailable_sentence",eh=({resetErrorBoundary:t})=>(te(),e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("span",{children:n(xr)}),e.jsxs(O,{variant:"secondary",onClick:t,children:[e.jsx(jn,{"aria-hidden":"true"}),n("ui.settings.speech.speech_section.try_again")]})]})}));function th(t){return t==="enabled"?"ready":t==="below-version"?"older":"pairing"}const nh=({sectionRef:t})=>{te();const s=vt(),a=Ms(),i=ni(s.data,"tts"),r=th(i),c=Fe({queryKey:lt.all,queryFn:()=>je({op:"settings.list"}),enabled:r==="ready",staleTime:1e4}),l=Gf(r==="ready"),{hasRadientApiKey:d,hasRadientSession:u,speechBlock:m}=sc(),p=`${u}:${d}`,g=o.useRef(p),f=l.refetch;o.useEffect(()=>{g.current!==p&&(g.current=p,f())},[p,f]);const x=c.data,j=o.useMemo(()=>Wa(x?.settings??[]),[x]),[y,N]=o.useState({}),[M,E]=o.useState({}),[T,R]=o.useState({});o.useEffect(()=>{x&&N(_=>{let I=!1;const S={..._};for(const q of Wa(x.settings).rows){const ae=_[q.key];if(ae&&ae.value!==Ct(q).value)continue;const Y=Ct(q);ae&&ae.value===Y.value&&ae.cascadeBase===Y.cascadeBase||(S[q.key]=Y,I=!0)}return I?S:_})},[x]);const D=(_,I)=>E(S=>({...S,[_]:I})),b=(_,I)=>R(S=>({...S,[_]:I})),z=async _=>{const I=y[_.key];if(!I)return;const S=rc(_,I);if(!S.ok){b(_.key,S.error);return}D(_.key,!0),b(_.key,null);try{await je(S.request),D(_.key,!1);const ae=(await c.refetch()).data?.settings.find(Y=>Y.key===_.key);ae&&N(Y=>{const ne=Y[_.key];return ne&&ne.value===I.value&&ne.cascadeBase===I.cascadeBase?{...Y,[_.key]:Ct(ae)}:Y})}catch(q){D(_.key,!1),b(_.key,q instanceof Error?q.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_saved"))}},B=async _=>{D(_.key,!0),b(_.key,null);try{await je({op:"settings.reset",key:_.key}),N(I=>({...I,[_.key]:Ct({..._,value:_.default,is_default:!0})})),D(_.key,!1),await c.refetch()}catch(I){D(_.key,!1),b(_.key,I instanceof Error?I.message:n("ui.settings.speech.speech_section.the_setting_could_not_be_reset"))}},K=o.useMemo(()=>Qf(l.data),[l.data]),h=K?Jf(K):null,L=l.isSuccess&&K===null,F=(s.data?null:s.error)??null,w=c.error,G=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:_}=Pt(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),F);return e.jsx(Re,{title:G,icon:Qt,description:P,sectionRef:t,children:e.jsx(ge,{variant:"warning",children:_})})}if(r==="older")return e.jsx(Re,{title:G,icon:Qt,description:P,sectionRef:t,children:e.jsx(ge,{variant:"warning",children:n(Xf)})});if(w||!x){const{sentence:_,remedy:I}=Pt(a??null,n("ui.settings.speech.speech_section.speech_settings_could_not_be_loaded"),w);return e.jsx(Re,{title:G,icon:Qt,description:P,sectionRef:t,children:e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:_}),I&&e.jsx(O,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{c.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})})})}const V=h?!h.servable:m==="offline",Z=h?h.rungs.find(_=>_.path===h.serving)??null:null;return e.jsx(Re,{title:G,icon:Qt,description:P,sectionRef:t,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:e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("section",{className:"flex flex-col gap-3",children:[l.isPending&&e.jsxs("p",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[e.jsx(Ce,{}),na("checking")]}),(l.isError||L)&&!h&&m!=="offline"&&e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{children:[n(xr)," ",l.error instanceof Error?l.error.message:""]}),e.jsx(O,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>{l.refetch()},children:n("ui.settings.speech.speech_section.retry")})]})}),e.jsx(Ai,{fallbackRender:eh,resetKeys:[l.dataUpdatedAt],children:h&&e.jsxs(e.Fragment,{children:[e.jsxs(qt,{children:[e.jsx(Te,{label:n("ui.settings.speech.speech_section.speaks_through"),value:h.serving?hr(h.serving):n("ui.settings.speech.speech_section.nothing_yet")}),e.jsx(Te,{label:n("ui.settings.speech.speech_section.availability"),value:h.servable?n("ui.settings.speech.speech_section.ready"):n("ui.settings.speech.speech_section.no_provider")})]}),h.reason&&h.reason!==Z?.reason&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:h.reason}),e.jsx("ul",{className:"flex flex-col gap-1",children:h.rungs.map(_=>e.jsxs("li",{className:"flex flex-col gap-0.5 text-body-sm",children:[e.jsxs("span",{className:_.path===h.serving?"text-ink":"text-ink-muted",children:[_.name,e.jsxs("span",{className:_.path===h.serving?"text-ink-muted":"text-ink-dim",children:[" ",_.available?n("ui.settings.speech.speech_section.available"):n("ui.settings.speech.speech_section.not_available")]})]}),e.jsx("span",{className:"text-meta text-ink-dim",children:_.reason})]},_.path))})]})})]}),V&&e.jsx(ge,{variant:"warning",children:na(m)}),e.jsx("div",{className:"flex flex-col gap-1",children:j.rows.map(_=>e.jsx(ac,{setting:_,draft:y[_.key]??Ct(_),tier:ic(_),saving:!!M[_.key],error:T[_.key]??null,onDraftChange:I=>N(S=>({...S,[_.key]:I})),onSave:()=>{z(_)},onReset:()=>{B(_)}},_.key))}),j.missing.length>0&&e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.speech.speech_section.missing_voice_rows",{count:j.missing.length,rows:j.missing.join(", ")})})]})})},_r=oc().use(cc).use(lc),Qa=t=>JSON.stringify(_r.parse(t),(s,a)=>{if(!(s==="position"||s==="spread"))return a}),Za=t=>{try{const s=_r.parse(t);return JSON.stringify(s).includes('"type":"html"')?!1:Qa(t)===Qa($c(Uc(t)))}catch{return!1}},sh=({value:t,onChange:s,disabled:a=!1})=>{const i=o.useId(),[r,c]=o.useState(()=>Za(t)),[l,d]=o.useState(()=>!r),[u,m]=o.useState(0),[p,g]=o.useState(t),f=o.useMemo(()=>({id:`system-prompt-draft-${i}-${u}`,title:"system-prompt.md",path:"",type:"markdown",content:p}),[i,u,p]),x=o.useCallback(N=>s(N),[s]),j=o.useMemo(()=>({onChange:x,disabled:a,label:n("ui.settings.model.system_prompt.instructions")}),[x,a]),y=()=>{const N=Za(t);c(N),N&&(g(t),m(M=>M+1),d(!1))};return e.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[e.jsxs("fieldset",{className:"flex flex-wrap gap-2","aria-label":n("ui.settings.model.system_prompt.instructions"),children:[e.jsx(O,{variant:"ghost",className:l?void 0:"bg-sunken font-semibold text-ink","aria-pressed":!l,disabled:a,onClick:y,children:n("ui.settings.model.system_prompt.rich_text")}),e.jsx(O,{variant:"ghost",className:l?"bg-sunken font-semibold text-ink":void 0,"aria-pressed":l,disabled:a,onClick:()=>d(!0),children:n("ui.settings.model.system_prompt.source")})]}),!r&&e.jsx(ge,{children:n("ui.settings.model.system_prompt.source_required")}),l?e.jsx(Ls,{id:"app-system-prompt",name:"systemPrompt","aria-label":n("ui.settings.model.system_prompt.instructions"),value:t,disabled:a,onChange:N=>s(N.target.value),placeholder:n("ui.settings.model.system_prompt.enter_instructions_for_how_all_agents_should_behave_and_respond_t"),className:"min-h-72 max-h-[65vh] resize-y font-mono"}):e.jsx("div",{className:"h-[min(32rem,65vh)] min-h-64 min-w-0 overflow-hidden rounded-lg bg-surface",...a?{inert:""}:{},children:e.jsx(Kc,{document:f,draft:j,measure:"fill"},f.id)})]})},ah=()=>{te();const{data:t,isLoading:s,error:a}=Uu(),i=Ku(),[r,c]=o.useState(""),[l,d]=o.useState(!1),u=o.useRef(!1),m=o.useRef(""),[p,g]=o.useState(0),[f,x]=o.useState(null);o.useLayoutEffect(()=>{u.current||(m.current=t?.content??"",c(m.current),g(T=>T+1),d(!1))},[t]);const j=o.useCallback(T=>{c(T),u.current=T!==m.current,d(u.current),x(null)},[]),y=async()=>{if(!(!l||i.isPending)){x(null);try{const T={content:r};await i.mutateAsync(T),m.current=r,u.current=!1,d(!1)}catch(T){x(T instanceof Error?T.message:n("ui.common.errors.system_prompt_update_unknown"))}}},N=()=>{u.current=!1,m.current=t?.content??"",c(m.current),g(T=>T+1),x(null),d(!1)},M=i.isPending,E=()=>e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(qe,{htmlFor:"app-system-prompt",children:n("ui.settings.model.system_prompt.instructions")}),e.jsx(sh,{value:r,onChange:j,disabled:M},p)]}),f&&e.jsx(ge,{variant:"danger",children:f}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(O,{variant:"primary",onClick:y,disabled:!l||M,children:[M?e.jsx(Ce,{size:"sm"}):e.jsx(bi,{}),M?n("ui.settings.model.system_prompt.saving"):n("ui.settings.model.system_prompt.save_changes")]}),e.jsx(O,{onClick:N,disabled:!l||M,children:n("ui.settings.model.system_prompt.cancel")})]}),t?.last_modified&&e.jsxs("p",{className:"text-ink-dim text-meta",children:[n("ui.settings.model.system_prompt.last_modified")," ",e.jsx("span",{className:"font-mono text-mono-sm",children:ws(t.last_modified)})]})]});return e.jsx(Re,{title:n("ui.settings.model.system_prompt.system_prompt"),icon:Nl,description:n("ui.settings.model.system_prompt.every_local_operator_agent_receives_this_prompt_in_addition_to_it"),children:s?e.jsx("div",{className:"flex min-h-50 items-center justify-center",children:e.jsx(Ce,{size:"lg",label:n("ui.settings.model.system_prompt.loading_system_prompt")})}):a&&!t&&!l?e.jsx(ge,{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")})}):E()})},ih=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],rh=t=>ih.includes(t),oh=t=>{const s=[];let a=0;for(const i of t){const r=Math.max(0,Math.floor(i.count)),c=Math.max(1,Math.floor(i.columns));for(let l=0;l<r;l+=c)s.push({start:a+l,count:Math.min(c,r-l)});a+=r}return s},ch=({index:t,key:s,groups:a})=>{const i=oh(a),r=i.reduce((c,l)=>c+l.count,0);if(!Number.isInteger(t)||t<0||t>=r)return t;switch(s){case"Home":return 0;case"End":return r-1;case"ArrowLeft":return Math.max(0,t-1);case"ArrowRight":return Math.min(r-1,t+1);case"ArrowUp":case"ArrowDown":{const c=i.findIndex(u=>t>=u.start&&t<u.start+u.count),l=i[c+(s==="ArrowDown"?1:-1)];if(!l)return t;const d=t-i[c].start;return l.start+Math.min(d,l.count-1)}default:return t}},lh=`const x = {
|
|
299
|
+
ready: true
|
|
300
|
+
};`,dh=({id:t})=>(te(),e.jsx("section",{"aria-label":n("ui.settings.appearance.editor.preview"),"data-custom-theme-preview":"",children:e.jsxs("div",{"data-theme":t,ref:s=>{s?.setAttribute("inert","")},"aria-hidden":"true",className:"grid min-w-0 grid-cols-2 gap-2 rounded-md bg-canvas p-2 text-ink",children:[It.map(s=>e.jsx("div",{"data-accent-preview":s.id,className:"flex min-w-0 flex-wrap items-center gap-2 text-meta",children:s.preview==="interaction"?e.jsx("span",{className:"rounded-sm border border-control px-2 py-1",style:{color:`var(--lo-${mt(s.ink)})`,outline:`2px solid var(--lo-${mt(s.role)})`,outlineOffset:-2},children:n(s.usageKey)}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"rounded-sm px-2 py-1",style:{color:`var(--lo-${mt(s.ink)})`,background:`var(--lo-${mt(s.wash)})`},children:n("ui.settings.appearance.editor.preview.identity")}),e.jsxs("span",{style:{color:`var(--lo-${mt(s.ink)})`},children:[e.jsx("span",{"aria-hidden":"true",children:"● "}),n("ui.settings.appearance.editor.preview.category")]}),e.jsx("span",{style:{color:`var(--lo-${mt(s.ink)})`},children:n("ui.settings.appearance.editor.preview.meta")})]})},s.id)),e.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[e.jsx("p",{className:"self-end rounded-sm bg-message-surface px-2 py-1 text-meta",children:n("ui.settings.appearance.editor.preview.user")}),e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.appearance.editor.preview.assistant")})]}),e.jsxs("div",{className:"min-w-0 rounded-sm bg-surface p-1 text-meta",children:[e.jsx("div",{className:"truncate px-1 py-0.5 text-ink-muted",children:n("ui.settings.appearance.editor.preview.sidebar")}),e.jsx("div",{className:"truncate rounded-xs bg-row-hover px-1 py-0.5",children:n("ui.settings.appearance.editor.preview.normal")}),e.jsxs("div",{className:"flex items-center justify-between gap-1 rounded-xs bg-row-selected px-1 py-0.5",children:[e.jsx("span",{className:"truncate",children:n("ui.settings.appearance.editor.preview.selected")}),e.jsx(us,{count:3})]})]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1 rounded-sm border border-control bg-sunken px-1 py-1",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink-dim",children:n("ui.settings.appearance.editor.preview.composer")}),e.jsx(O,{variant:"primary",size:"sm",tabIndex:-1,children:n("ui.settings.appearance.editor.preview.send")})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[e.jsx(O,{variant:"primary",size:"sm",tabIndex:-1,children:n("ui.settings.appearance.editor.preview.primary")}),e.jsx(O,{size:"sm",variant:"secondary",tabIndex:-1,children:n("ui.settings.appearance.editor.preview.secondary")}),e.jsx(O,{size:"sm",disabled:!0,tabIndex:-1,children:n("ui.settings.appearance.editor.preview.disabled")})]}),e.jsxs("div",{className:"flex min-w-0 flex-col gap-1 text-meta",children:[e.jsx("div",{className:"rounded-xs border border-success-border bg-success-wash px-1 text-success",children:n("ui.settings.appearance.editor.preview.success")}),e.jsx("div",{className:"rounded-xs border border-warning-border bg-warning-wash px-1 text-warning",children:n("ui.settings.appearance.editor.preview.warning")}),e.jsx("div",{className:"rounded-xs border border-danger-border bg-danger-wash px-1 text-danger",children:n("ui.settings.appearance.editor.preview.danger")})]}),e.jsxs("div",{className:"grid min-w-0 grid-cols-2 gap-1",children:[e.jsx("pre",{className:"overflow-hidden rounded-sm bg-sunken p-1 font-mono text-meta text-token-command",children:e.jsx("code",{children:lh})}),e.jsxs("div",{className:"min-w-0 rounded-sm bg-elevated p-1 text-meta",children:[e.jsx("div",{className:"truncate rounded-xs bg-row-hover px-1",children:n("ui.settings.appearance.editor.preview.menu_item")}),e.jsx("div",{className:"truncate px-1 text-danger",children:n("ui.settings.appearance.editor.preview.menu_danger")})]})]}),e.jsx(Le,{inputSize:"sm",readOnly:!0,tabIndex:-1,"aria-label":n("ui.settings.appearance.editor.preview.input"),value:n("ui.settings.appearance.editor.preview.input"),className:"outline-2 outline-accent"}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1 rounded-sm bg-row-selected p-1",children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full bg-success"}),e.jsx("span",{className:"truncate text-meta",children:n("ui.settings.appearance.editor.preview.bridge_name")}),e.jsx(us,{count:3}),e.jsx("span",{className:"text-meta text-ink-dim",children:12})]}),e.jsx("div",{className:"col-span-2 rounded-xs border border-info-border bg-info-wash px-1 text-meta text-info",children:n("ui.settings.appearance.editor.preview.info")})]})})),uh=()=>({canvas:n("ui.settings.appearance.editor.role.canvas"),surface:n("ui.settings.appearance.editor.role.surface"),ink:n("ui.settings.appearance.editor.role.ink"),inkMuted:n("ui.settings.appearance.editor.role.inkMuted"),accent:n("ui.settings.appearance.editor.role.accent"),borderControl:n("ui.settings.appearance.editor.role.borderControl"),elevated:n("ui.settings.appearance.editor.role.elevated"),sunken:n("ui.settings.appearance.editor.role.sunken"),messageSurface:n("ui.settings.appearance.editor.role.messageSurface"),mediaSurface:n("ui.settings.appearance.editor.role.mediaSurface"),rowHover:n("ui.settings.appearance.editor.role.rowHover"),rowSelected:n("ui.settings.appearance.editor.role.rowSelected"),inkDim:n("ui.settings.appearance.editor.role.inkDim"),inkDisabled:n("ui.settings.appearance.editor.role.inkDisabled"),tokenCommand:n("ui.settings.appearance.editor.role.tokenCommand"),hairline:n("ui.settings.appearance.editor.role.hairline"),hairlineStrong:n("ui.settings.appearance.editor.role.hairlineStrong"),accentHover:n("ui.settings.appearance.editor.role.accentHover"),accentActive:n("ui.settings.appearance.editor.role.accentActive"),chartBarHover:n("ui.settings.appearance.editor.role.chartBarHover"),accentWash:n("ui.settings.appearance.editor.role.accentWash"),onAccent:n("ui.settings.appearance.editor.role.onAccent"),accentAlt:n("ui.settings.appearance.editor.role.accentAlt"),accentAltWash:n("ui.settings.appearance.editor.role.accentAltWash"),success:n("ui.settings.appearance.editor.role.success"),successWash:n("ui.settings.appearance.editor.role.successWash"),successBorder:n("ui.settings.appearance.editor.role.successBorder"),warning:n("ui.settings.appearance.editor.role.warning"),warningWash:n("ui.settings.appearance.editor.role.warningWash"),warningBorder:n("ui.settings.appearance.editor.role.warningBorder"),danger:n("ui.settings.appearance.editor.role.danger"),dangerWash:n("ui.settings.appearance.editor.role.dangerWash"),dangerBorder:n("ui.settings.appearance.editor.role.dangerBorder"),info:n("ui.settings.appearance.editor.role.info"),infoWash:n("ui.settings.appearance.editor.role.infoWash"),infoBorder:n("ui.settings.appearance.editor.role.infoBorder"),overlayShadow:n("ui.settings.appearance.editor.role.overlayShadow"),scrim:n("ui.settings.appearance.editor.role.scrim")}),an=t=>uh()[t]??t,Et=/^#[0-9A-Fa-f]{6}$/,mh=({initial:t,onClose:s})=>{te();const a=o.useId().replace(/[^a-z0-9]/gi,""),i=`custom-draft-${a}`,[r,c]=o.useState(t),[l,d]=o.useState(t);o.useEffect(()=>{const v=setTimeout(()=>d(r),180);return()=>clearTimeout(v)},[r]);const[u,m]=o.useState({}),[p,g]=o.useState(null),[f,x]=o.useState(!0),[j,y]=o.useState(!1),[N,M]=o.useState(!1),[E,T]=o.useState(!1),R=o.useRef(null),D=o.useRef(!1),[b,z]=o.useState(""),[B,K]=o.useState(()=>{try{return localStorage.getItem("lo-theme-editor-advanced")==="true"}catch{return!1}}),[h,L]=o.useState([]),F=Ns(),w=xe(v=>v.contrast),G=xe(v=>v.accent),P=xt(r.base)?.palette;if(!P)throw new Error("unknown custom theme base");const V=o.useMemo(()=>yn(P,r),[P,r]),Z=o.useMemo(()=>Rn(V,r.base),[V,r.base]),_=o.useMemo(()=>yn(P,l),[P,l]),I=o.useMemo(()=>Rn(_,r.base).findings.length===0,[_,r.base]),S=o.useMemo(()=>I?Hr(_,{contrast:w[P.mode],accent:G[P.mode],id:r.base,preserveSecondary:!0,paletteAccent:v=>xt(v)?.palette.accent}):{palette:_},[_,I,w,G,P.mode,r.base]),q=o.useMemo(()=>Rn(S.palette,r.base),[S.palette,r.base]),ae=P.mode==="dark"?Ys(V.canvas).l>50:Ys(V.canvas).l<50,Y=JSON.stringify(r)!==JSON.stringify(t)||Object.keys(u).length>0,ne=Object.values(u).some(v=>!Et.test(v)),ce=!F.themes.some(v=>v.id===r.id)&&F.themes.length>=50,le=v=>{L(W=>[...W.slice(-19),r]),c(v),y(!1),M(!1)},ue=(v,W)=>{const se=Object.prototype.hasOwnProperty.call(r.overrides,v)?"overrides":It.find(ee=>ee.role===v)?.storage??(Wt.includes(v)?"seeds":"overrides");le({...r,[se]:{...r[se],[v]:W}}),m(ee=>{const ye={...ee};return delete ye[v],ye})},we=()=>{E||(Y?(R.current=document.activeElement instanceof HTMLElement?document.activeElement:null,T(!0)):s())},U=()=>{const v=mc(P,r);v?(le(v),z(n("ui.settings.appearance.editor.validation_pass"))):M(!0)},$=(v,W=an(v))=>{const se=q.readings.filter(he=>he.foreground===v||he.background===v).sort((he,be)=>he.value/he.floor-be.value/be.floor)[0],ee=u[v]??r.overrides[v]??r.seeds[v]??V[v],ye=Object.prototype.hasOwnProperty.call(r.overrides,v),Se=`${a}-${v}`;return e.jsxs("div",{className:"flex flex-col gap-2 border-hairline border-b py-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button","aria-label":n("ui.settings.appearance.editor.edit_role",{role:W}),"aria-expanded":p===v,onClick:()=>{g(p===v?null:v),x(!0)},className:"size-8 shrink-0 rounded-sm border border-control focus-visible:outline-2 focus-visible:outline-accent",style:{background:V[v]}}),e.jsxs("label",{htmlFor:Se,className:"min-w-0 flex-1 text-body-sm",children:[W,ye&&e.jsx("span",{className:"ms-1 text-meta text-ink-muted",children:n("ui.settings.appearance.editor.edited")})]}),e.jsx(Le,{id:Se,inputSize:"sm",value:ee,maxLength:7,"aria-invalid":!Et.test(ee),className:"w-24 shrink-0 font-mono",onChange:he=>m(be=>({...be,[v]:he.target.value})),onBlur:()=>{Et.test(ee)&&ue(v,ee.toUpperCase())},onKeyDown:he=>{he.key==="Enter"&&Et.test(ee)&&(he.preventDefault(),ue(v,ee.toUpperCase()))}}),se&&e.jsx("span",{className:pe("text-meta",se.value<se.floor?"text-danger":"text-ink-muted"),title:`${n("ui.settings.appearance.editor.pair",{foreground:an(se.foreground),background:an(se.background)})} · ${n("ui.settings.appearance.editor.floor",{value:String(se.floor)})}`,children:n("ui.settings.appearance.editor.ratio",{value:se.value.toFixed(2)})}),(ye||Object.prototype.hasOwnProperty.call(r.seeds,v))&&e.jsx(O,{type:"button",size:"sm",variant:"ghost","aria-label":n("ui.settings.appearance.editor.reset_role",{role:W}),onClick:()=>{const he={...r.seeds},be={...r.overrides};ye?delete be[v]:delete he[v],le({...r,seeds:he,overrides:be}),m(ke=>{const ie={...ke};return delete ie[v],ie})},children:n("ui.settings.appearance.editor.reset_role",{role:W})})]}),!Et.test(ee)&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.appearance.editor.invalid_hex")}),p===v&&e.jsx("div",{className:"rounded-md border border-hairline bg-surface p-3",children:e.jsx(Gi,{value:V[v],onChange:he=>ue(v,he),onValidityChange:x,swatches:[...new Set([...Wt,...It.map(he=>he.role)])].map(he=>V[he])},v)})]},v)};return e.jsxs(e.Fragment,{children:[e.jsx(ul,{open:!0,onOpenChange:v=>{v||we()},children:e.jsxs(ml,{className:"flex w-full max-w-full flex-col gap-0 overflow-hidden sm:w-140 sm:max-w-140 text-ink",onKeyDown:v=>{if((v.metaKey||v.ctrlKey)&&v.key==="z"&&!(v.target instanceof HTMLInputElement||v.target instanceof HTMLTextAreaElement||v.target instanceof HTMLElement&&v.target.isContentEditable)){v.preventDefault();const W=h.at(-1);W&&(c(W),L(se=>se.slice(0,-1)))}},children:[e.jsxs("div",{className:"shrink-0 border-hairline border-b pb-3 pe-8",children:[e.jsx(gl,{children:n("ui.settings.appearance.editor.edit")}),e.jsx(pl,{children:n("ui.settings.appearance.editor.preview_note")})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("label",{htmlFor:`${a}-name`,className:"flex flex-col gap-1 text-body-sm",children:[n("ui.settings.appearance.editor.name"),e.jsx(Le,{value:r.name,id:`${a}-name`,maxLength:60,onChange:v=>le({...r,name:v.target.value}),"aria-invalid":!r.name.trim()})]}),!r.name.trim()&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.appearance.editor.name_required")}),e.jsxs("p",{className:"text-meta text-ink-muted",children:[n("ui.settings.appearance.editor.base",{name:st(r.base)?We[r.base].name:r.base})," ","·"," ",n(P.mode==="dark"?"ui.settings.appearance.editor.mode_dark":"ui.settings.appearance.editor.mode_light")]}),ae&&e.jsx("p",{className:"text-meta text-warning",children:n("ui.settings.appearance.editor.mode_warning")}),e.jsx("style",{children:Ei(i,S.palette)}),e.jsx(dh,{id:i}),e.jsxs("p",{className:"text-meta text-ink-muted",children:[I&&n("ui.settings.appearance.editor.contrast_note",{value:String(w[P.mode])})," ",I&&G[P.mode].kind!=="theme"?n("ui.settings.appearance.editor.accent_note"):null]}),e.jsxs("div",{"aria-live":"polite",className:"flex flex-wrap items-center justify-between gap-2 rounded-sm border border-hairline bg-surface p-2 text-body-sm",children:[e.jsx("span",{className:ne||!f||Z.findings.length?"text-danger":"text-success",children:ne?n("ui.settings.appearance.editor.invalid_hex"):f?Z.findings.length?n("ui.settings.appearance.editor.validation_summary",{count:Z.findings.length}):n("ui.settings.appearance.editor.validation_pass"):n("ui.settings.appearance.editor.picker.invalid_channels")}),!ne&&f&&Z.findings.length>0&&e.jsx(O,{type:"button",variant:"secondary",size:"sm",onClick:U,children:n("ui.settings.appearance.editor.adjust")})]}),N&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.appearance.editor.adjust_unavailable")}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-body-sm font-medium",children:n("ui.settings.appearance.editor.accents")}),It.map(v=>e.jsxs("div",{"data-accent-family":v.id,children:[e.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:n(v.usageKey)}),$(v.role,n(v.labelKey))]},v.id)),e.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:n("ui.settings.appearance.editor.accent.effective")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-body-sm font-medium",children:n("ui.settings.appearance.editor.essentials")}),Wt.filter(v=>!Qs(v)).map(v=>$(v))]}),e.jsxs("section",{children:[e.jsxs("button",{type:"button","aria-expanded":B,className:"flex w-full items-center justify-between text-start text-body-sm font-medium",onClick:()=>{K(!B);try{localStorage.setItem("lo-theme-editor-advanced",String(!B))}catch{}},children:[n("ui.settings.appearance.editor.advanced"),e.jsx("span",{"aria-hidden":"true",children:B?"−":"+"})]}),e.jsx("p",{className:"mt-2 text-meta text-ink-muted",children:n("ui.settings.appearance.editor.pinned_note")}),B&&e.jsxs(e.Fragment,{children:[It.map(v=>e.jsxs("section",{className:"mt-3","data-accent-variants":v.id,children:[e.jsxs("h4",{className:"text-body-sm font-medium",children:[n(v.labelKey)," ·"," ",n("ui.settings.appearance.editor.accent.variants")]}),v.preview==="identity"&&e.jsx("p",{className:"mt-1 text-meta text-ink-muted",children:n("ui.settings.appearance.editor.accent.secondary_help")}),v.variants.map(W=>$(W))]},v.id)),dc.filter(v=>!Wt.includes(v)&&!Qs(v)).map(v=>$(v)),["overlayShadow","scrim"].map(v=>e.jsxs("label",{className:"flex flex-col gap-1 py-2 text-body-sm",children:[an(v),e.jsx("input",{type:"range",min:0,max:1,step:.01,value:r.overrides[v]??Number(/\/\s*([\d.]+)/.exec(P[v])?.[1]??.5),onChange:W=>le({...r,overrides:{...r.overrides,[v]:W.target.value}}),className:"h-7 accent-accent"})]},v))]})]})]})}),e.jsxs("div",{className:"shrink-0 border-hairline border-t pt-3",children:[e.jsx("output",{className:"text-meta text-ink-muted",children:b}),j&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.appearance.editor.save_error")}),ce&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:n("ui.settings.appearance.editor.limit")}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(O,{variant:"ghost",onClick:we,children:n("ui.settings.appearance.editor.cancel")}),e.jsx(O,{variant:"primary",disabled:!r.name.trim()||r.name.length>60||ne||!f||Z.findings.length>0||ce,onClick:()=>{try{const v={...r,name:r.name.trim(),updatedAt:Date.now()};uc(v),xe.setState({themeName:st(v.base)?v.base:"localOperatorDark",customThemeId:v.id});for(const W of Object.values(v.seeds))Vi(W);vs(n("ui.settings.appearance.editor.saved")),s()}catch{y(!0)}},children:n("ui.settings.appearance.editor.save")})]})]})]})}),e.jsx(cn,{open:E,onOpenChange:T,children:e.jsxs(ln,{onCloseAutoFocus:v=>{!D.current&&R.current?.isConnected&&(v.preventDefault(),R.current.focus({preventScroll:!0}))},children:[e.jsx(dn,{children:n("ui.settings.appearance.editor.discard_title")}),e.jsx(un,{children:n("ui.settings.appearance.editor.discard_description")}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(O,{variant:"secondary",onClick:()=>T(!1),children:n("ui.settings.appearance.editor.keep_editing")}),e.jsx(O,{variant:"danger",onClick:()=>{D.current=!0,s()},children:n("ui.settings.appearance.editor.discard")})]})]})})]})},gh=({loading:t,error:s,count:a,onRetry:i})=>(te(),t?e.jsx("p",{"aria-live":"polite",className:"text-meta text-ink-muted",children:n("ui.settings.appearance.editor.loading")}):s?e.jsxs("div",{className:"text-meta text-danger",role:"alert",children:[n("ui.settings.appearance.editor.load_error")," ",e.jsx(O,{variant:"ghost",size:"sm",onClick:i,children:n("ui.settings.appearance.editor.retry")})]}):a===0?e.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.settings.appearance.editor.empty")}):null),Ja=()=>`custom-${crypto.randomUUID().replace(/-/g,"").slice(0,20)}`,ph=()=>{const t=Ns(),s=xe(b=>b.customThemeId),a=xe(b=>b.themeName),[i,r]=o.useState(null),[c,l]=o.useState(null),[d,u]=o.useState(null),[m,p]=o.useState(!1),[g,f]=o.useState(""),[x,j]=o.useState(""),[y,N]=o.useState(""),M=b=>{const z=t.themes.find(h=>h.id===b),B=z?.base??b;if(!st(B))return;const K=sa(n("ui.settings.appearance.editor.new_name",{name:z?.name??We[B].name}),t.themes);r({format:"local-operator-theme",version:1,id:Ja(),name:K,base:B,seeds:{...z?.seeds},overrides:{...z?.overrides},updatedAt:Date.now()})},E=b=>{try{const z=hc(b,st,{id:Ja()});z.name=sa(z.name,t.themes),p(!1),N(""),r(z)}catch(z){const B=z instanceof Error?z.message:"import_error",K={import_invalid_json:n("ui.settings.appearance.editor.import_invalid_json"),import_format:n("ui.settings.appearance.editor.import_format"),import_version:n("ui.settings.appearance.editor.import_version"),import_size:n("ui.settings.appearance.editor.import_size"),import_base:n("ui.settings.appearance.editor.import_base"),import_name:n("ui.settings.appearance.editor.import_name"),import_roles:n("ui.settings.appearance.editor.import_roles"),import_unsafe:n("ui.settings.appearance.editor.import_unsafe")};N(K[B]??n("ui.settings.appearance.editor.import_error"))}},T=(b,z=!0)=>{const B=t.themes.find(h=>h.id===b),K=B?.name??(st(b)?We[b].name:b);return e.jsxs(Os,{children:[e.jsx(Ds,{asChild:!0,children:e.jsx(O,{type:"button",variant:"ghost",size:"icon-sm",tabIndex:z?0:-1,"aria-label":n("ui.settings.appearance.editor.more",{name:K}),className:"absolute end-1 top-1 z-10 bg-canvas",children:e.jsx(Cs,{size:14})})}),e.jsxs(Fs,{align:"end",children:[B&&e.jsx(nt,{onSelect:()=>r(B),children:n("ui.settings.appearance.editor.edit")}),e.jsx(nt,{onSelect:()=>M(b),children:n("ui.settings.appearance.editor.duplicate")}),B&&e.jsxs(e.Fragment,{children:[e.jsx(nt,{onSelect:()=>{u(B),N(""),j("")},children:n("ui.settings.appearance.editor.export")}),e.jsx(nt,{onSelect:()=>{l(B),N("")},children:n("ui.settings.appearance.editor.delete")})]})]})]})},R=e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(O,{variant:"secondary",size:"sm",onClick:()=>{const b=t.themes.find(z=>z.id===s);b?r(b):M(a)},children:n("ui.settings.appearance.editor.customize")}),e.jsx(O,{variant:"ghost",size:"sm",onClick:()=>{p(!0),N(""),f("")},children:n("ui.settings.appearance.editor.import")})]}),e.jsx(gh,{loading:t.loading,error:t.error,count:t.themes.length,onRetry:gc})]}),D=e.jsxs(e.Fragment,{children:[i&&e.jsx(mh,{initial:i,onClose:()=>r(null)},i.id),e.jsx(cn,{open:!!c,onOpenChange:b=>{b||l(null)},children:e.jsxs(ln,{children:[e.jsx(dn,{children:n("ui.settings.appearance.editor.delete_title",{name:c?.name??""})}),e.jsx(un,{children:n("ui.settings.appearance.editor.delete_description")}),y&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:y}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(O,{variant:"secondary",onClick:()=>l(null),children:n("ui.settings.appearance.editor.cancel")}),e.jsx(O,{variant:"danger",onClick:()=>{if(c)try{pc(c.id),s===c.id&&xe.setState({customThemeId:null}),l(null),vs(n("ui.settings.appearance.editor.deleted"))}catch{N(n("ui.settings.appearance.editor.save_error"))}},children:n("ui.settings.appearance.editor.delete")})]})]})}),e.jsx(cn,{open:m,onOpenChange:p,children:e.jsxs(ln,{children:[e.jsx(dn,{children:n("ui.settings.appearance.editor.import_title")}),e.jsx(un,{children:n("ui.settings.appearance.editor.import_description")}),e.jsxs("label",{className:"flex flex-col gap-1 text-body-sm",children:[n("ui.settings.appearance.editor.import_text"),e.jsx("textarea",{dir:"ltr","aria-invalid":!!y,value:g,onChange:b=>f(b.target.value),className:"min-h-48 w-full rounded-sm border border-control bg-sunken p-2 font-mono text-meta"})]}),y&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:y}),e.jsxs("div",{className:"flex flex-wrap justify-between gap-2",children:[e.jsxs("label",{className:"cursor-pointer rounded-sm border border-control px-2 py-1.5 text-body-sm focus-within:outline-2 focus-within:outline-accent",children:[n("ui.settings.appearance.editor.import_file"),e.jsx("input",{type:"file",accept:".json,application/json",className:"sr-only",onChange:async b=>{const z=b.target.files?.[0];if(z){if(z.size>fc){N(n("ui.settings.appearance.editor.import_size"));return}try{E(await z.text())}catch{N(n("ui.settings.appearance.editor.import_read"))}b.target.value=""}}})]}),e.jsx(O,{disabled:!g.trim(),onClick:()=>E(g),children:n("ui.settings.appearance.editor.import_submit")})]})]})}),e.jsx(cn,{open:!!d,onOpenChange:b=>{b||u(null)},children:e.jsxs(ln,{children:[e.jsx(dn,{children:n("ui.settings.appearance.editor.export_title",{name:d?.name??""})}),e.jsx(un,{children:n("ui.settings.appearance.editor.export_title",{name:d?.name??""})}),y&&e.jsx("p",{role:"alert",className:"text-meta text-danger",children:y}),e.jsx("textarea",{dir:"ltr","aria-label":n("ui.settings.appearance.editor.import_text"),readOnly:!0,value:d?In(d):"",className:"min-h-48 w-full rounded-sm border border-control bg-sunken p-2 font-mono text-meta"}),e.jsx("p",{"aria-live":"polite",className:"text-meta text-success",children:x}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[e.jsx(O,{variant:"secondary",onClick:()=>{if(d)try{const b=URL.createObjectURL(new Blob([In(d)],{type:"application/json"})),z=document.createElement("a");z.href=b,z.download=`${d.name.replace(/[^a-z0-9_-]/gi,"-").slice(0,60)||"theme"}.json`,z.click(),setTimeout(()=>URL.revokeObjectURL(b),1e3)}catch{N(n("ui.settings.appearance.editor.export_error"))}},children:n("ui.settings.appearance.editor.export_file")}),e.jsx(O,{onClick:async()=>{if(d)try{await navigator.clipboard.writeText(In(d)),j(n("ui.settings.appearance.editor.export_copied"))}catch{N(n("ui.settings.appearance.editor.clipboard_error"))}},children:n("ui.settings.appearance.editor.export_copy")})]})]})})]});return{library:t,active:s,header:R,menu:T,dialogs:D}},fh={localOperatorDark:Yd,localOperatorLight:xu,dracula:lu,dune:jd,sage:Ud,monokai:qc,tokyoNight:Xd,iceberg:uu,radient:Od,neon:_c,obsidian:Ri,synth:Dl,catppuccinMocha:cd,catppuccinLatte:Hd,tokyoNightStorm:ed,gruvbox:ql,nord:Pu,oneDark:Ll,solarizedDark:fu,rosePine:Cd,rosePineMoon:Gd,rosePineDawn:rd,alucard:Ad,gruvboxLight:fd,tokyoNightDay:Zd,oneLight:Bd,catppuccinFrappe:gd,catppuccinMacchiato:Fd,palenight:xc,everforest:Ru,everforestLight:Au,kanagawaWave:Ou,kanagawaLotus:Nd,ayuDark:xd,ayuMirage:yd,ayuLight:iu,nightfox:nd,duskfox:vu,synthwave:su,matrix:zl,tron:Jl,cyberpunk:Bc,vaporwave:Cu,outrun:Kl,neonNoir:Tu,arcade:Pd,forest:Nu,ocean:vd,desert:ju,autumn:Fu,lavender:gu,arctic:ad,rosewood:Td,solarizedLight:yu,githubLight:Rd,paper:Sl,linen:ou,highContrastLight:Il,mintLight:$l},Xa="bg-[color-mix(in_srgb,var(--color-accent)_8%,var(--color-accent-wash))]",hh=({id:t})=>e.jsxs("div",{"data-theme":t,"aria-hidden":"true",className:"flex h-full bg-canvas",children:[e.jsxs("div",{className:"flex w-1/4 flex-col gap-1 bg-sunken p-1",children:[e.jsx("span",{className:"flex h-2.5 items-center rounded-xs bg-accent-wash px-1",children:e.jsx("span",{className:"h-1 w-full rounded-xs bg-accent"})}),e.jsx("span",{className:"mx-1 h-1 w-2/3 rounded-xs bg-ink-dim"}),e.jsx("span",{className:"mx-1 h-1 w-1/2 rounded-xs bg-ink-dim"})]}),e.jsxs("div",{className:"flex flex-1 flex-col justify-between p-1",children:[e.jsxs("div",{className:"flex flex-col gap-1 rounded-xs bg-surface p-1",children:[e.jsx("span",{className:"h-1 w-3/5 rounded-xs bg-ink"}),e.jsx("span",{className:"h-1 w-full rounded-xs bg-ink-dim"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"h-2.5 w-6 rounded-xs bg-elevated"}),e.jsx("span",{className:"h-2.5 w-5 rounded-xs bg-accent"}),e.jsx("span",{className:"h-2.5 w-4 rounded-xs bg-accent-alt"}),e.jsx("span",{className:"h-2.5 w-4 rounded-xs border border-control"})]})]})]}),xh=({id:t,name:s,description:a,isSelected:i,isTabStop:r,onSelect:c,onFocusTile:l})=>{const d=fh[t]??tu;return e.jsx(Ye,{side:"bottom",align:"start",content:a,children:e.jsxs("button",{type:"button","data-theme-tile":t,"aria-pressed":i,tabIndex:r?0:-1,onFocus:l,onClick:c,className:pe("relative flex flex-col gap-1.5 rounded-md p-1 text-start transition-colors duration-fast ease-out-quart",i?Xa:"hover:bg-surface"),children:[e.jsxs("span",{className:pe("relative block h-10 overflow-hidden rounded-sm border transition-colors duration-fast ease-out-quart",i?"border-accent":"border-hairline"),children:[e.jsx(hh,{id:t}),i&&e.jsx("span",{className:pe("pointer-events-none absolute top-0.5 end-0.5 flex h-4 w-4 items-center justify-center rounded-full",Xa),children:e.jsx(Nn,{size:12,className:"text-accent","aria-hidden":"true"})})]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(d,{size:12,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-meta text-ink",children:s})]})]})})},_h=t=>[...t.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)}}),yh=()=>{te();const{themeName:t,setTheme:s}=xe(),a=ph(),i=a.library.themes.find(g=>g.id===a.active)?.id??t,r=a.library.themes.flatMap(g=>{const f=xt(g.base)?.palette;if(!f)return[];const x=yn(f,g);return[{id:g.id,name:g.name,description:n("ui.settings.appearance.editor.base",{name:st(g.base)?We[g.base].name:g.base}),css:Ei(g.id,x)}]}),c=Object.values(We),l=[{label:n("ui.settings.appearance.editor.custom_group"),items:r},{label:n("ui.settings.appearance.theme_selector.dark"),items:c.filter(g=>g.theme.palette.mode==="dark")},{label:n("ui.settings.appearance.theme_selector.light"),items:c.filter(g=>g.theme.palette.mode==="light")}].filter(g=>g.items.length>0),[d,u]=o.useState(null),m=o.useMemo(()=>{const g=l.flatMap(f=>f.items.map(x=>x.id));return d&&g.includes(d)?d:g.includes(i)?i:g[0]},[l,d,i]),p=g=>{if(!rh(g.key))return;const f=[...g.currentTarget.querySelectorAll("[data-theme-tile]")],x=f.indexOf(g.target);if(x<0)return;g.preventDefault();const j=ch({index:x,key:g.key,groups:_h(g.currentTarget)});j!==x&&f[j]?.focus()};return e.jsx(Ni,{children:e.jsxs("div",{onKeyDown:p,"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:[a.header,e.jsx("style",{children:r.map(g=>g.css).join(`
|
|
301
|
+
`)}),a.dialogs,l.map(g=>e.jsxs("div",{children:[e.jsx("h3",{className:"px-1 pb-2 text-meta text-ink-dim",children:g.label}),e.jsx("div",{"data-theme-grid":g.label,className:"grid grid-cols-[repeat(auto-fill,minmax(160px,1fr))] gap-2",children:g.items.map(({id:f,name:x,description:j})=>e.jsxs("div",{className:"group relative min-w-0",children:[e.jsx(xh,{id:f,name:x,description:j,isSelected:f===i,isTabStop:f===m,onSelect:()=>{const y=a.library.themes.find(N=>N.id===f);y&&st(y.base)?xe.setState({themeName:y.base,customThemeId:f}):st(f)&&s(f)},onFocusTile:()=>u(f)}),e.jsx("div",{className:"absolute end-1 top-1 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100",children:a.menu(f,f===m)})]},f))})]},g.label))]})})},bh=({value:t,onChange:s,searchRow:a})=>{te();const i=o.useId();return e.jsxs("div",{"data-search-row":a,"data-search-control":a?"":void 0,className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.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")}),e.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")})]}),e.jsx("div",{className:"flex h-6 shrink-0 items-center",children:e.jsx(Ut,{value:t,onValueChange:r=>s(si(r)),children:e.jsx(Kt,{"aria-labelledby":i,children:Vr.map(r=>e.jsx(ct,{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))})})})]})},vh=()=>{te();const{data:t,isLoading:s,error:a}=Vu({enabled:!0});return e.jsxs("div",{children:[e.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-heading text-ink",children:[e.jsx(ud,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_pass")]}),s&&e.jsx($e,{className:"h-6 w-36"}),a&&e.jsx(ge,{variant:"warning",children:n("ui.settings.account.settings_page.credit_balance_load_failed",{reason:a.message})}),t&&!s&&!a&&e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsxs("p",{className:"flex-1 text-body-sm text-ink-muted",children:[n("ui.settings.account.settings_page.available_credits")," ",e.jsx("span",{className:"font-medium text-ink",children:t.balance.toFixed(2)})]}),e.jsx(O,{variant:"secondary",size:"sm",asChild:!0,children:e.jsxs("a",{href:"https://console.radienthq.com/dashboard/billing",target:"_blank",rel:"noopener noreferrer",children:[e.jsx(Wl,{}),n("ui.settings.account.settings_page.add_credits")]})})]})]})},kh=[{id:"credits",get label(){return n("ui.settings.account.settings_page.credits")}},{id:"tokens",get label(){return n("ui.settings.account.settings_page.tokens")}}],jh=()=>{te();const[t,s]=o.useState("credits"),a=o.useMemo(()=>{const d=new Date,u=Bu(d);return{start_date:ca(u),end_date:ca(d),rollup:"daily"}},[]),{data:i,isLoading:r,error:c}=Wu(a,{enabled:!0}),l=o.useMemo(()=>i?.data_points?[...i.data_points].sort((u,m)=>Dn(u.timestamp).getTime()-Dn(m.timestamp).getTime()).map(u=>({bucket:Nc(Al(Dn(u.timestamp),"yyyy-MM-dd")),value:t==="credits"?Number.parseFloat(u.total_cost.toFixed(2)):u.total_tokens})):[],[i,t]);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("h3",{className:"flex items-center gap-2 text-heading text-ink",children:[e.jsx(Vl,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.usage_last_30_days")]}),e.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[e.jsx("legend",{className:"sr-only",children:n("ui.settings.account.settings_page.usage_metric")}),e.jsx("div",{"data-glass-well":"",className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:kh.map(({id:d,label:u})=>e.jsx(O,{variant:"ghost",size:"sm","aria-pressed":t===d,onClick:()=>s(d),className:pe(t===d&&"bg-surface text-ink hover:bg-surface"),children:u},d))})]})]}),r&&e.jsx($e,{className:"h-62 w-full"}),c&&e.jsx(ge,{variant:"warning",children:n("ui.settings.account.settings_page.usage_load_failed",{reason:c.message})}),!r&&!c&&i&&l.length>0&&e.jsx(Hf,{metric:t,data:l}),!r&&!c&&(!i||l.length===0)&&e.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.settings.account.settings_page.no_usage_recorded_in_the_last_30_days")})]})},wh=()=>(te(),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[e.jsx(nl,{size:16,className:"shrink-0 text-ink-dim"}),n("ui.settings.account.settings_page.radient_account")]}),e.jsx(O,{variant:"secondary",size:"sm",className:"self-start sm:self-center",asChild:!0,children:e.jsxs("a",{href:"https://console.radienthq.com",target:"_blank",rel:"noopener noreferrer",children:[n("ui.settings.account.settings_page.go_to_radient_console"),e.jsx(pi,{})]})})]})),Uh=()=>{te();const t=yc(),s=xe(C=>C.showAgentReasoning),a=xe(C=>C.setShowAgentReasoning),i=xe(C=>C.transcriptDisplayMode),r=xe(C=>C.setTranscriptDisplayMode),c=xe(C=>C.agentAvatarSize),l=xe(C=>C.setAgentAvatarSize),{data:d,isLoading:u,isFetching:m,error:p,refetch:g}=bc(),{needsProvider:f}=vc(),x=Ms(),{sentence:j,remedy:y}=Pt(x??null,n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded"),p),N=Hc(),[M,E]=o.useState(null),T=fi(),{isAuthenticated:R,accountRead:D,isFetching:b,isRefreshing:z,refreshUser:B}=ks(),K=Tt(C=>C.activeSessionId),h=Tt(C=>C.sessions),L=vm(),{accountId:F,snapshot:w,model:G}=yi(),P=o.useRef(null);w.status?P.current={accountId:F,status:w.status}:w.checking||(P.current=null);const V=w.status??(P.current?.accountId===F?P.current.status:null),Z=tm(L),_=o.useMemo(()=>Vc.filter(C=>C.id!=="agent-messages"||L!=="absent"),[L]),I=o.useCallback(()=>G.check("surface_open",!0),[G]),[S,q]=o.useState("general"),[ae,Y]=o.useState(!1),ne=o.useRef(null),ce=o.useRef(null),{startTour:le}=Gc(),ue=Gr(),we=ti(),{data:U,refetch:$}=kc(),{refreshModels:v}=jc(),W=o.useMemo(()=>U?.keys?[...U.keys].sort():[],[U?.keys]),se=o.useRef({keys:"",hosting:void 0});o.useEffect(()=>{const C=W.join(","),H=d?.values?.hosting;(se.current.keys!==C||se.current.hosting!==H)&&(se.current={keys:C,hosting:H},v().catch(J=>{console.error("Failed to refresh models after credentials or hosting change:",J)}))},[W,d?.values?.hosting,v]);const ee=o.useRef({general:o.useRef(null),radient:o.useRef(null),integrations:o.useRef(null),appearance:o.useRef(null),notifications: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,ye=o.useMemo(()=>new URLSearchParams(ue.search).get("setting"),[ue.search]),Se=o.useMemo(()=>new URLSearchParams(ue.search).get("filter")??"",[ue.search]),he=o.useMemo(()=>new URLSearchParams(ue.search).get("mcp")??void 0,[ue.search]),be=o.useMemo(()=>new URLSearchParams(ue.search).get("provider"),[ue.search]),ke=o.useCallback(C=>{q(C),Y(!0);const H=ee[C],J=ce.current;if(H?.current&&J){const Ae=H.current.getBoundingClientRect().top-J.getBoundingClientRect().top;J.scrollHeight>J.clientHeight?J.scrollTo({top:Math.max(0,J.scrollTop+Ae-80),behavior:"smooth"}):window.scrollTo({top:Math.max(0,H.current.getBoundingClientRect().top+window.scrollY-80),behavior:"smooth"}),clearTimeout(ne.current??void 0),ne.current=setTimeout(()=>{Y(!1),ne.current=null},800)}else Y(!1)},[ee]),ie=o.useRef(null),de=o.useRef(null),Q=vt(),oe=_t(Q.data,"settings"),me=Fe({queryKey:lt.all,queryFn:()=>je({op:"settings.list"}),enabled:oe,staleTime:1e4}),Ie=Kf({registry:me.data,sections:_}),Qe=o.useCallback(()=>ce.current?Am(ce.current):[],[]),[Me,Ue]=o.useState(null),Ge=o.useCallback(async C=>{de.current=null;const H=ce.current??document;if(C.source==="page")return Lm(H,C.id.slice(5));if(C.source==="section")return Om(H,C.sectionId);const J=C.settingKey;if(!J)return"missing";const _e=rn(J,"backend");return me.data&&!me.data.settings.some(Ae=>Ae.key===J)?"missing":(ke(_e),Ue({key:J,nonce:Date.now()}),H.querySelector(`[data-search-section="${_e}"]`)?"landed":"missing")},[ke,me.data]);o.useEffect(()=>{Ue(null)},[ue.search]),o.useEffect(()=>{const C=H=>{!(H.metaKey||H.ctrlKey)||H.altKey||H.key.toLowerCase()==="f"&&(Wr(H.target)||(H.preventDefault(),de.current=ce.current?.scrollTop??null,ie.current?.focus()))};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[]),o.useEffect(()=>{const C=setTimeout(()=>{const H=ce.current;if(!H)return;const J=()=>{if(ae)return;const _e=H.getBoundingClientRect(),Ae=_e.height;let Ne="",Oe=0;for(const[ze,He]of Object.entries(ee))if(He.current){const k=He.current.getBoundingClientRect(),re=_e.top,fe=k.top-re,Ee=k.bottom-re,Ke=k.height,Pe=Math.max(0,fe),ve=Math.min(Ae,Ee),wt=Math.max(0,ve-Pe)/Ke,Vs=wt+(fe<Ae*.3?.1:0);Vs>Oe&&wt>.1&&(Oe=Vs,Ne=ze)}Ne&&Ne!==S&&q(Ne)};return J(),H.addEventListener("scroll",J,{passive:!0}),()=>{H.removeEventListener("scroll",J),clearTimeout(ne.current??void 0)}},100);return()=>clearTimeout(C)},[ee,S,ae]),o.useEffect(()=>{const C=new URLSearchParams(ue.search),H=C.get("section"),J=C.get("setting"),_e=J?rn(J,"backend"):H;if(_e==="agent-messages"&&!Z)return;const Ae=_e?ee[_e]:void 0;if(!_e||!Ae)return;let Ne=!1,Oe=Number.NaN,ze=0;const He=window.setTimeout(()=>{Ne||(Ne=!0,re.disconnect(),ke(_e))},2e3),k=()=>{if(Ne)return;const fe=Ae.current;if(!fe){ze=requestAnimationFrame(k);return}const Ee=Math.round(fe.getBoundingClientRect().top+window.scrollY);if(Ee===Oe&&Ee>0){Ne=!0,re.disconnect(),window.clearTimeout(He),ke(_e);return}Oe=Ee,ze=requestAnimationFrame(k)},re=new ResizeObserver(()=>{Ne||(cancelAnimationFrame(ze),ze=requestAnimationFrame(k))});return ce.current&&re.observe(ce.current),ze=requestAnimationFrame(k),()=>{Ne=!0,cancelAnimationFrame(ze),re.disconnect(),window.clearTimeout(He)}},[ue.search,ee,ke,Z]);const Ze=async(C,H)=>{E(C);try{await N.mutateAsync({[C]:H}),await g()}catch(J){console.error(`Error updating ${C}:`,J)}finally{E(null)}},at=u,ut=D==="checking",jt=xi(D),Je=D==="ready"||D==="checking"||b,A=_i(at,4e3);return p?e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:e.jsx(ge,{variant:"warning",className:"w-full max-w-xl",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:j}),y&&e.jsx(O,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>void g(),disabled:m,children:m?n("ui.settings.navigation.settings_page.retrying"):n("ui.settings.navigation.settings_page.retry")})]})})}):at?e.jsxs("div",{role:"status",className:"flex h-full w-full flex-col items-center justify-center gap-3 bg-canvas",children:[e.jsx(Ce,{size:"lg",label:A?void 0:n("ui.settings.navigation.settings_page.loading_settings")}),A&&e.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")})]}):d?e.jsxs("div",{"data-glass-region":"canvas","data-glass-split":"",className:"panel-flush flex min-h-0 flex-1 overflow-hidden bg-canvas",children:[e.jsx("div",{className:"w-12 shrink-0 overflow-y-auto min-[1040px]:w-55",children:e.jsx(Wc,{activeSection:S,onSelectSection:ke,sections:_})}),e.jsx("div",{"data-glass-region":"canvas-content",className:"panel-top-pad flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx("div",{ref:ce,"data-settings-content":!0,"data-tour-tag":"settings-general-section",className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6 md:p-8",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-8 pb-8",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(sl,{title:n("ui.settings.page.title"),icon:aa}),e.jsx(qf,{onDismiss:()=>{const C=de.current;de.current=null,C!==null&&ce.current?.scrollTo({top:C})},ref:ie,index:Ie,readRendered:Qe,onJump:Ge})]}),e.jsxs("div",{className:"flex flex-col gap-8",children:[e.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:[e.jsx(Yc,{focus:ye===On||Me?.key===On,focusNonce:Me?.key===On?Me.nonce:void 0}),e.jsxs(Re,{title:n("ui.settings.profile.title"),icon:vi,description:n(R?"ui.settings.profile.description_authenticated":"ui.settings.profile.description_anonymous"),children:[ut&&e.jsx("p",{className:"text-meta text-ink-dim",children:n("ui.settings.profile.account_checking")}),jt&&e.jsx(ge,{variant:"warning",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{children:n(D==="refused"?"ui.settings.profile.account_read_failed_refused":"ui.settings.profile.account_read_failed_retry")}),e.jsx(O,{variant:"secondary",size:"sm",className:"shrink-0",onClick:()=>B(),disabled:z,children:z?n("ui.settings.profile.retrying"):n("ui.settings.profile.retry")})]})}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(ia,{searchRow:"general.profile.name",value:T.profile.name,label:n("ui.settings.profile.display_name.label"),placeholder:n("ui.settings.profile.display_name.placeholder"),isSaving:M==="user_name",onSave:async C=>{E("user_name");try{T.updateName(C)}finally{E(null)}},readOnly:Je}),e.jsx(ia,{searchRow:"general.profile.email",value:T.profile.email,label:n("ui.settings.profile.email.label"),placeholder:n("ui.settings.profile.email.placeholder"),isSaving:M==="user_email",onSave:async C=>{E("user_email");try{T.updateEmail(C)}finally{E(null)}},readOnly:Je})]})]}),e.jsx(Re,{title:n("ui.settings.tour.title"),description:n("ui.settings.tour.description"),children:e.jsxs(O,{variant:"secondary","data-search-row":"general.tour","data-search-control":!0,onClick:()=>{le({forceModalCompleted:!0})},children:[e.jsx(mi,{}),n("ui.settings.tour.action")]})}),e.jsx(Re,{id:"model-settings",title:n("ui.settings.model.settings_page.model_settings"),icon:Qc,description:n("ui.settings.model.settings_page.configure_the_default_ai_model_and_hosting_providers_used_for_gen"),children:e.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:[e.jsx(Zc,{value:d.values.hosting,isSaving:M==="hosting",onSave:C=>Ze("hosting",C),filterByCredentials:!0,allowCustom:!0,allowDefault:!1,emptyHelperText:n("ui.settings.model.settings_page.no_hosting_options")}),e.jsx(Jc,{value:d.values.model_name,hostingId:d.values.hosting,isSaving:M==="model_name",onSave:C=>Ze("model_name",C),allowCustom:!0,allowDefault:!1}),e.jsx(Bm,{hosting:d.values.hosting,modelName:d.values.model_name,focus:ye===pt||Me?.key===pt,focusNonce:Me?.key===pt?Me.nonce:void 0}),f&&e.jsx(ge,{variant:"neutral",icon:e.jsx(kn,{className:"size-4","aria-hidden":"true"}),children:e.jsxs("span",{children:[n("ui.settings.model.provider_callout.sentence"),e.jsx("button",{type:"button",className:"text-accent underline underline-offset-2",onClick:()=>{ke("providers"),ee.providers.current?.focus({preventScroll:!0})},children:n("ui.settings.model.provider_callout.providers_link")}),"."]})})]})}),e.jsx(ah,{}),e.jsx(Re,{title:n("ui.settings.configuration.settings_page.configuration_information"),icon:kn,description:n("ui.settings.configuration.settings_page.system_information_about_the_current_configuration"),children:e.jsxs(qt,{children:[e.jsx(Te,{label:n("ui.settings.configuration.settings_page.version"),value:e.jsx("span",{className:"text-mono-sm",children:d.version})}),e.jsx(Te,{label:n("ui.settings.configuration.settings_page.created"),value:hi(d.metadata.created_at)}),e.jsx(Te,{label:n("ui.settings.configuration.settings_page.last_modified"),value:ws(d.metadata.last_modified)}),e.jsx(Te,{label:n("ui.settings.configuration.settings_page.description"),value:d.metadata.description||n("ui.settings.configuration.settings_page.no_description_available")})]})})]}),e.jsx(Re,{title:n("ui.settings.appearance.settings_page.appearance"),icon:Ri,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:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(Tg,{gallery:e.jsx(yh,{})}),e.jsx(Lt,{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 C=>a(C)}),e.jsx(bh,{searchRow:"appearance.transcript",value:si(i),onChange:C=>r(C)}),e.jsx(ug,{searchRow:"appearance.agent-picture-size",value:es(c),onChange:C=>l(C)}),e.jsx(Ju,{searchRow:"appearance.glass",state:t.state,onChange:t.set})]})}),e.jsx(pf,{sectionRef:ee.notifications}),e.jsx(nh,{sectionRef:ee.speech}),e.jsx(Xc,{sectionRef:ee.keyboard,focusKey:ye}),e.jsx(Re,{title:n("ui.settings.model.settings_page.model_providers"),icon:ui,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:e.jsx(el,{initialProviderId:be,onChangeModel:()=>ke("general")})}),e.jsx(ef,{sessionId:K??void 0,sectionRef:ee.integrations,highlightServer:he}),e.jsx(Re,{title:n("ui.settings.account.settings_page.radient_account"),titleComponent:e.jsx(wh,{}),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:e.jsxs("div",{className:"flex flex-col gap-8",children:[e.jsx(If,{onAfterCredentialUpdate:()=>{v(),$()}}),R&&e.jsxs(e.Fragment,{children:[e.jsx(vh,{}),e.jsx(jh,{})]})]})}),Z&&e.jsx(Re,{title:n("ui.agentMessages.settings.section"),icon:tl,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:V?e.jsx(lm,{availability:L,status:V,accountId:F,refusal:w.refusal,onRefreshStatus:I,sessions:h,focus:ye===Tn||Me?.key===Tn,focusNonce:Me?.key===Tn?Me.nonce:void 0,onOpenSession:C=>{G.invalidateStatus(),Yr(we,C)}}):w.refusal?e.jsxs(ge,{variant:"warning",children:[e.jsx(vn,{children:n("ui.agentMessages.settings.error.title")}),e.jsxs(Be,{children:[w.refusal.code!=="client_unavailable"&&e.jsx("span",{className:"block",children:gn(w.refusal)}),e.jsx("span",{className:"block",children:n("ui.agentMessages.settings.error.no_changes")}),e.jsx(O,{className:"mt-3",variant:"secondary",onClick:()=>void I(),children:n("ui.agentMessages.settings.error.retry")})]})]}):e.jsxs("div",{"aria-busy":"true",className:"flex flex-col gap-3",children:[e.jsx($e,{className:"h-5 w-40"}),e.jsx($e,{className:"h-4 w-full max-w-xl"})]})}),e.jsx(Re,{title:n("ui.settings.navigation.settings_page.backend_settings"),icon:aa,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:e.jsx(wc,{hideInterfaceLanguage:!0,hideModelEffort:!0,hideAgentMessages:!0,hideSpeechShortcuts:!0,hideNotifications:!0,focusKey:Me?Me.key:ye&&rn(ye,"backend")==="backend"?ye:null,focusNonce:Me?.nonce,initialFilter:Se})}),e.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:e.jsx(cg,{})}),e.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:e.jsx(Pm,{})})]})]})})})]}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-canvas p-6",children:e.jsx(ge,{variant:"warning",className:"w-full max-w-xl",children:n("ui.settings.navigation.settings_page.your_settings_could_not_be_loaded")})})};export{Uh as SettingsPage};
|