@lacneu/atrium 0.102.0 → 0.102.1

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-EQHMWEbX.js","assets/preload-helper-Czpn1I53.js","assets/RolesTab-DU0g4d-R.js","assets/bundle-mjs-C73ZY4La.js","assets/api-DSJJn0d7.js","assets/lock-0lxfSnTE.js","assets/checkbox-CsI4ggnp.js","assets/check-DmQzfrws.js","assets/dist-DDCmobc1.js","assets/dist-D-RIDSJc.js","assets/button-Dio0PVrp.js","assets/input-BSpTsBA6.js","assets/convexApi-CyScjgcq.js","assets/toast-xNFwDnUy.js","assets/x-CK8d5DC1.js","assets/badge-C4po8DQ1.js","assets/ConfirmDialog-BXcki0Ee.js","assets/alert-dialog-BoEv1f8g.js","assets/dist-CkbybbG7.js","assets/dialog-BfrsWZiD.js","assets/EntitySheet-B2B48bss.js","assets/loader-circle-BNhIFGdg.js","assets/roleDescriptions-x3mUxTcX.js","assets/InstancesTab-BevtM68H.js","assets/FieldLabel-Tea3wyVe.js","assets/tooltip-v_AyOWn6.js","assets/select-qM3ZfTHx.js","assets/dist-ClkJChBn.js","assets/chevron-up-Dsqj2Oaj.js","assets/dist-Cw3aN_jM.js","assets/locales-CPjguROj.js","assets/curation-CQksaIbm.js","assets/popover-DBaIbsBr.js","assets/dist-ChrIV8UV.js","assets/groupManageView-BMBqgRhV.js","assets/DataTableShell-DRFFBx_j.js","assets/chevrons-up-down-Pva00Np5.js","assets/dropdown-menu-DHMOOlaP.js","assets/dist-D7doQlva.js","assets/plus-Djbdyc2E.js","assets/trash-2-B4WSfc7G.js","assets/table-D2SJC960.js","assets/BridgeTab-D4RFq-Rb.js","assets/useNavigate-D3GIoxyW.js","assets/chevron-right-C_b_y922.js","assets/usageView-C9Y6E0Zu.js","assets/server-DLnWqkX-.js","assets/triangle-alert-BkDa-x8g.js","assets/tabs-mZfLmn2f.js","assets/format-DGKgJf2p.js","assets/appHost-CH3EGcJw.js","assets/FilterBar-DTVwlDpF.js","assets/search-BK6bzZNi.js","assets/rotate-ccw-BD-9XzMC.js","assets/TimeRangePicker-D3PJq1H8.js","assets/compatView--1YlftIc.js","assets/dispatchErrorInfo-Bb7JyJFO.js","assets/PromptInjectionsTab-Vdb1lF36.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-CCBW5ofF.css","assets/GroupsTab-Io16XZHz.js","assets/chevron-left-DQ9FCoo_.js","assets/users-BJqaWlH1.js","assets/star-CM6J2w_J.js","assets/DetailChips-Cv1sxdhU.js","assets/IntegrationsTab-DMY6VTUC.js","assets/FeedbacksTab-6URuFdfg.js","assets/SubAgentReportsTab-D9rclslo.js","assets/TrashTab-BMSJ7ANC.js","assets/use_paginated_query-CQj09xXv.js","assets/fileMetaView-Ci5C4w9Q.js","assets/trashView-Ct0Xw-a9.js","assets/trashPage-WtAhGCt7.js","assets/trashPage-DfKyy5ga.css","assets/DeletedChatsTab-COYSFkNf.js","assets/FilesTab-esMtHJXt.js","assets/download-DWgC7zCa.js","assets/ScheduledTab-B6gWc0HN.js","assets/list-eSch39T9.js","assets/cronDescribe-CAuRX7uW.js","assets/pencil-aUWxuLhy.js","assets/TimezoneCombobox-CPTpWNQm.js","assets/AgentFilesTab-C3CUT4Ep.js","assets/capabilities-BTqhMVxR.js","assets/PreferencesTab-DJ9p401L.js","assets/useFontScale-ByBFat3y.js","assets/ChatDefaultsTab-D0d9yEow.js","assets/KnobRow-BsOT2O6U.js","assets/AccessTab-JmFp20Kp.js","assets/ThemeShowroom-N4qzUtlq.js","assets/useChart-CKFEN42T.js","assets/card-CerX9wDn.js","assets/AdvancedFilter-Bb66m5kb.js","assets/ProjectPage-BxEF71jN.js","assets/useStartNewChat-BszDHUjD.js","assets/useStartNewChat-DgQf_3y0.css","assets/eye-B-ipuYEd.js","assets/ProjectPage-BXsrYrrF.css","assets/TracesTab-DiAkOmei.js","assets/copy-BaUCUMp2.js","assets/deliveryRecorder-C7NQZrrH.js","assets/searchSchemas-CS2ZgsHC.js","assets/VoiceTab-BSh-05Ze.js","assets/speech-CrNma2Ue.js","assets/AuditTab-BV-XydO_.js","assets/AnomaliesTab-BQ2Bu98W.js","assets/KpiTab-KPPcgUxA.js","assets/ServiceAccountsTab-Dmb_LH0V.js","assets/UsersTab-BQaLsUCK.js","assets/AdminSettings-B8n1yLsD.js"])))=>i.map(i=>d[i]);
2
- import{a as e,c as t,i as n,l as r,o as i,r as a,s as o}from"./bundle-mjs-C73ZY4La.js";import{$A as s,$B as c,$C as l,$D as u,$E as d,$H as f,$J as p,$R as m,$T as h,$V as g,$X as _,$a as v,$c as y,$f as b,$g as x,$h as S,$i as C,$n as w,$o as T,$p as E,$r as D,$s as O,$t as k,$w as A,$z as j,A as M,AB as N,AD as P,AH as F,AJ as I,AM as ee,AR as L,AS as R,AT as z,AU as B,AV as V,Aa as te,Ad as ne,Ag as re,Ai as ie,Al as ae,Ap as oe,Ar as se,Au as ce,Aw as le,B as ue,BB as de,BC as fe,BD as pe,BH as me,BJ as he,BR as ge,BT as _e,BV as ve,BX as ye,Ba as be,Bg as xe,Bh as Se,Bi as Ce,Bl as we,Bn as Te,Bo as Ee,Br as De,Bs as Oe,Bu as ke,Bv as Ae,Bw as je,CB as Me,CH as Ne,CM as Pe,CR as Fe,CS as Ie,CT as Le,CU as Re,CV as ze,Ca as Be,Cd as Ve,Cg as He,Ci as Ue,Cl as We,Cn as Ge,Cp as Ke,Cr as qe,Cs as Je,Cv as Ye,Cw as Xe,Cy as Ze,D as Qe,DB as $e,DH as et,DJ as tt,DM as nt,DR as rt,DS as it,DT as at,DU as ot,DV as st,Da as ct,Dc as lt,Dd as ut,Dg as dt,Di as ft,Dl as pt,Dp as mt,Dr as ht,Ds as gt,Dv as _t,Dw as vt,E as H,EB as yt,EH as bt,EJ as xt,EM as St,ER as Ct,ES as wt,ET as Tt,EU as Et,EV as Dt,Ea as Ot,Ed as kt,Eg as At,Ei as jt,El as Mt,Ep as Nt,Er as Pt,Es as Ft,Ev as It,Ew as Lt,F as Rt,FB as zt,FC as Bt,FH as Vt,FJ as Ht,FR as Ut,FS as Wt,FT as Gt,FU as Kt,FV as qt,FX as Jt,Fa as Yt,Fd as Xt,Fg as Zt,Fh as Qt,Fi as $t,Fl as en,Fp as tn,Fr as nn,Fs as rn,Fu as an,Fw as on,G as sn,GA as cn,GB as ln,GC as un,GD as dn,GH as fn,GJ as pn,GR as mn,GT as hn,GV as gn,GX as _n,Ga as vn,Gg as yn,Gh as bn,Gi as xn,Gn as Sn,Go as Cn,Gr as wn,Gs as Tn,Gt as En,Gv as Dn,Gw as On,H as kn,HB as An,HC as jn,HH as Mn,HJ as Nn,HR as Pn,HT as Fn,HV as In,HX as Ln,Ha as Rn,Hg as zn,Hh as Bn,Hi as Vn,Hn,Ho as Un,Hr as Wn,Hs as Gn,Hu as Kn,Hv as qn,Hw as Jn,I as Yn,IB as Xn,IH as Zn,IJ as Qn,IR as $n,IT as er,IU as tr,IV as nr,IX as rr,Ia as ir,Id as ar,Ig as or,Ih as sr,Ii as cr,Il as lr,In as ur,Io as dr,Ip as fr,Ir as pr,Is as mr,Iu as hr,Iv as gr,Iw as _r,JA as vr,JB as yr,JC as br,JD as xr,JH as Sr,JJ as Cr,JR as wr,JT as Tr,JV as Er,JX as Dr,Ja as Or,Jc as kr,Jg as Ar,Jh as jr,Ji as Mr,Jn as Nr,Jo as Pr,Jp as Fr,Jq as Ir,Jr as Lr,Js as Rr,Jt as zr,Jv as Br,Jw as Vr,KA as Hr,KB as Ur,KC as Wr,KD as Gr,KH as Kr,KJ as qr,KR as Jr,KT as Yr,KV as Xr,KX as Zr,Ka as Qr,Kc as $r,Kf as ei,Kg as ti,Kh as ni,Ki as ri,Kn as ii,Kr as ai,Ks as oi,Kt as si,Kv as ci,Kw as li,L as ui,LB as di,LH as fi,LJ as pi,LR as mi,LT as hi,LV as gi,LX as _i,La as vi,Ld as yi,Lg as bi,Lh as xi,Li as Si,Ll as Ci,Ln as wi,Lo as Ti,Lp as Ei,Lr as Di,Ls as Oi,Lu as ki,Lw as Ai,M as ji,MB as Mi,MH as Ni,MJ as Pi,MM as Fi,MR as Ii,MS as Li,MT as Ri,MU as zi,MV as Bi,Ma as Vi,Md as Hi,Mg as Ui,Mi as Wi,Ml as Gi,Mp as Ki,Mr as qi,Mu as Ji,Mw as Yi,N as Xi,NB as Zi,NC as Qi,ND as $i,NH as ea,NJ as ta,NR as na,NS as ra,NT as ia,NU as aa,NV as oa,Na as sa,Nd as ca,Ng as la,Nh as ua,Ni as da,Nl as fa,Np as pa,Nr as ma,Ns as ha,Nu as ga,Nv as _a,Nw as va,O as ya,OB as ba,OH as xa,OJ as Sa,OM as Ca,OR as wa,OS as Ta,OT as Ea,OU as Da,OV as Oa,Oa as ka,Oc as Aa,Od as ja,Og as Ma,Oi as Na,Ol as Pa,Op as Fa,Or as Ia,Os as La,Ov as Ra,Ow as za,P as Ba,PB as Va,PC as Ha,PH as Ua,PJ as Wa,PR as Ga,PS as Ka,PT as qa,PU as Ja,PV as Ya,PX as Xa,Pa as Za,Pd as Qa,Pg as $a,Ph as eo,Pi as to,Pl as no,Pp as ro,Pr as io,Ps as ao,Pu as oo,Pv as so,Pw as co,QA as lo,QB as uo,QC as fo,QD as po,QE as mo,QH as ho,QJ as go,QR as _o,QT as vo,QV as yo,QX as bo,Qf as xo,Qg as So,Qh as Co,Qi as wo,Qn as To,Qo as Eo,Qp as Do,Qr as Oo,Qs as ko,Qt as Ao,Qw as jo,Qz as Mo,R as No,RB as Po,RH as Fo,RJ as Io,RR as Lo,RT as Ro,RV as zo,RX as Bo,Ra as Vo,Rd as Ho,Rg as Uo,Rh as Wo,Ri as Go,Rl as Ko,Rn as qo,Ro as Jo,Rr as Yo,Rs as Xo,Ru as Zo,Rv as Qo,Rw as $o,SB as es,SH as ts,SM as ns,SR as rs,SS as is,ST as as,SU as os,SV as ss,Sa as cs,Sd as ls,Sg as us,Sh as ds,Si as fs,Sl as ps,Sn as ms,Sp as hs,Sr as gs,Ss as _s,Sv as vs,Sw as ys,T as bs,TB as xs,TH as Ss,TJ as Cs,TM as ws,TR as Ts,TS as Es,TT as Ds,TU as Os,TV as ks,Ta as As,Td as js,Tg as Ms,Ti as Ns,Tl as Ps,Tn as Fs,Tp as Is,Tr as Ls,Ts as Rs,Tv as zs,Tw as Bs,U as Vs,UB as Hs,UC as Us,UD as Ws,UH as Gs,UJ as Ks,UR as qs,UT as Js,UV as Ys,UX as Xs,Ua as Zs,Ug as Qs,Uh as $s,Ui as ec,Un as tc,Ur as nc,Us as rc,Uu as ic,Uv as ac,Uw as oc,V as sc,VB as cc,VC as lc,VH as uc,VJ as dc,VR as fc,VT as pc,VV as mc,VX as hc,Va as gc,Vg as _c,Vh as vc,Vi as yc,Vn as bc,Vo as xc,Vr as Sc,Vs as Cc,Vu as wc,Vv as Tc,Vw as Ec,W as Dc,WA as Oc,WB as kc,WC as Ac,WD as jc,WH as Mc,WJ as Nc,WR as Pc,WT as Fc,WV as Ic,WX as Lc,Wa as Rc,Wg as zc,Wh as Bc,Wi as Vc,Wn as Hc,Wo as Uc,Wr as Wc,Ws as Gc,Wu as Kc,Wv as qc,Ww as Jc,XA as Yc,XB as Xc,XC as Zc,XD as Qc,XE as $c,XH as el,XJ as tl,XR as nl,XT as rl,XV as il,XX as U,Xa as al,Xc as ol,Xf as sl,Xg as cl,Xh as ll,Xi as ul,Xn as dl,Xo as fl,Xp as pl,Xr as ml,Xs as hl,Xt as gl,Xw as _l,Xz as vl,YA as yl,YB as bl,YC as xl,YD as Sl,YH as Cl,YJ as wl,YR as Tl,YT as El,YV as Dl,YX as W,Ya as Ol,Yc as kl,Yg as Al,Yh as jl,Yi as Ml,Yn as Nl,Yo as Pl,Yp as Fl,Yr as Il,Ys as Ll,Yt as Rl,Yv as zl,Yw as Bl,ZA as Vl,ZB as Hl,ZC as Ul,ZD as Wl,ZE as Gl,ZH as Kl,ZJ as ql,ZR as Jl,ZT as Yl,ZV as Xl,ZX as Zl,Zc as Ql,Zg as $l,Zh as eu,Zi as tu,Zn as nu,Zo as ru,Zp as iu,Zr as au,Zs as ou,Zt as su,Zw as cu,Zz as lu,_ as uu,_B as du,_H as fu,_M as pu,_O as mu,_S as hu,_T as gu,_U as _u,_V as vu,_a as yu,_c as bu,_d as xu,_f as Su,_g as Cu,_h as wu,_i as Tu,_j as Eu,_l as Du,_n as Ou,_o as ku,_p as Au,_q as ju,_r as Mu,_s as Nu,_t as Pu,aB as Fu,aD as Iu,aH as Lu,aO as Ru,aT as zu,aU as Bu,aV as Vu,aY as Hu,aZ as Uu,a_ as Wu,aa as Gu,ac as Ku,ad as qu,ag as Ju,ai as Yu,aj as Xu,al as Zu,am as Qu,an as $u,ao as ed,ap as td,ar as nd,as as rd,at as id,aw as ad,az as od,bB as sd,bH as cd,bM as ld,bO as ud,bS as dd,bT as fd,bU as pd,bV as md,ba as hd,bd as gd,bf as _d,bg as vd,bh as yd,bi as bd,bj as xd,bl as Sd,bn as Cd,bp as wd,bq as Td,br as Ed,bs as Dd,bu as Od,bv as kd,bw as Ad,cB as jd,cE as Md,cM as Nd,cO as Pd,cS as Fd,cT as Id,cU as Ld,cV as Rd,cY as zd,c_ as Bd,ca as Vd,cc as Hd,cd as Ud,cg as Wd,ch as Gd,ci as Kd,cj as qd,cl as Jd,cn as Yd,cp as Xd,cr as Zd,cs as Qd,ct as $d,cw as ef,cy as tf,dB as nf,dD as rf,dE as af,dH as of,dM as sf,dO as cf,dS as lf,dT as uf,dU as df,dV as ff,dY as pf,da as mf,dc as hf,dd as gf,dg as _f,dh as vf,di as yf,dj as bf,dl as xf,dn as Sf,dp as Cf,dr as wf,ds as Tf,dt as Ef,dy as Df,eB as Of,eD as kf,eE as Af,eH as jf,eO as Mf,eT as Nf,eU as Pf,eV as Ff,eY as If,eZ as Lf,e_ as Rf,ea as zf,ec as Bf,ed as Vf,eg as Hf,ei as Uf,ej as Wf,el as Gf,em as Kf,en as qf,er as Jf,es as Yf,ew as Xf,ez as Zf,fB as Qf,fD as $f,fE as ep,fH as tp,fM as np,fO as rp,fS as ip,fT as ap,fU as op,fV as sp,fa as cp,fc as lp,fd as up,fg as dp,fh as fp,fi as pp,fj as mp,fl as hp,fn as gp,fp as _p,fr as vp,fs as yp,ft as bp,fy as xp,g as Sp,gB as Cp,gD as wp,gE as Tp,gH as Ep,gM as Dp,gO as Op,gS as kp,gT as Ap,gU as jp,gV as Mp,ga as Np,gc as Pp,gd as Fp,gf as Ip,gg as Lp,gh as Rp,gi as zp,gj as Bp,gl as Vp,gn as Hp,go as Up,gp as Wp,gr as Gp,gs as Kp,gt as qp,hB as Jp,hD as Yp,hE as Xp,hH as Zp,hM as eee,hO as Qp,hS as $p,hT as em,hU as tm,hV as nm,ha as rm,hc as im,hd as am,hf as om,hg as tee,hh as sm,hi as cm,hj as lm,hl as um,hn as dm,ho as fm,hp as pm,hq as mm,hr as hm,hs as gm,ht as _m,iB as vm,iD as ym,iH as bm,iO as xm,iT as Sm,iU as Cm,iV as wm,iY as Tm,iZ as Em,i_ as Dm,ia as nee,ic as Om,id as ree,ig as km,ii as iee,ij as Am,il as jm,im as Mm,in as Nm,ip as Pm,ir as Fm,is as Im,it as Lm,iw as Rm,iz as zm,j as Bm,jB as Vm,jH as Hm,jJ as Um,jM as Wm,jR as Gm,jS as Km,jT as qm,jU as Jm,jV as Ym,ja as Xm,jd as Zm,jg as Qm,ji as $m,jl as eh,jp as th,jr as nh,ju as rh,jw as ih,k as ah,kB as oh,kD as sh,kH as ch,kJ as lh,kM as uh,kR as dh,kS as fh,kT as ph,kU as mh,kV as hh,ka as gh,kc as _h,kd as vh,kg as yh,ki as bh,kl as xh,kp as Sh,kr as Ch,kv as wh,kw as Th,lB as Eh,lE as Dh,lH as Oh,lM as kh,lO as Ah,lS as jh,lT as Mh,lU as Nh,lV as Ph,l_ as Fh,la as Ih,lc as Lh,ld as Rh,lg as zh,lh as Bh,li as Vh,lj as Hh,ll as Uh,ln as Wh,lp as Gh,lr as Kh,ls as qh,lt as Jh,lw as Yh,ly as Xh,mB as Zh,mD as Qh,mE as $h,mH as eg,mM as aee,mO as oee,mS as see,mT as cee,mU as lee,mV as uee,ma as dee,mc as tg,md as fee,mg as ng,mh as pee,mi as mee,mj as hee,ml as gee,mn as _ee,mp as vee,mq as yee,mr as bee,ms as xee,mt as See,mu as Cee,my as wee,nB as Tee,nD as rg,nE as Eee,nH as Dee,nO as Oee,nT as kee,nU as Aee,nV as jee,nY as Mee,nZ as ig,n_ as ag,na as Nee,nc as Pee,nd as Fee,ng as og,ni as sg,nj as cg,nl as lg,nm as ug,nn as dg,no as fg,np as pg,nr as mg,ns as hg,nt as gg,nw as _g,nz as vg,oB as yg,oE as bg,oH as xg,oM as Sg,oO as Cg,oS as wg,oT as Tg,oU as Eg,oV as Dg,oY as Og,oZ as kg,o_ as Ag,oa as jg,oc as Mg,od as Ng,og as Pg,oh as Fg,oi as Ig,oj as Lg,ol as Rg,om as zg,on as Bg,op as Vg,or as Hg,os as Ug,ot as Wg,ow as Gg,pB as Kg,pD as qg,pE as Jg,pH as Yg,pM as Xg,pO as Zg,pS as Qg,pT as $g,pU as e_,pV as t_,pa as n_,pc as r_,pd as i_,pg as a_,ph as o_,pi as s_,pj as c_,pl as l_,pn as u_,pp as d_,pr as f_,ps as p_,pt as m_,pu as h_,py as g_,qA as __,qB as v_,qC as y_,qD as b_,qH as x_,qJ as S_,qR as C_,qT as w_,qV as T_,qX as E_,qa as D_,qc as O_,qf as k_,qg as A_,qh as j_,qi as M_,qn as N_,qr as P_,qs as F_,qt as I_,qv as L_,qw as R_,r as z_,rB as B_,rD as V_,rH as H_,rO as U_,rT as W_,rU as G_,rV as K_,rY as q_,rZ as J_,r_ as Y_,ra as X_,rc as Z_,rd as Q_,rg as $_,ri as ev,rj as tv,rl as nv,rm as rv,rn as iv,rp as av,rr as ov,rs as sv,rt as cv,rw as lv,ry as uv,rz as dv,sB as fv,sE as pv,sH as mv,sM as hv,sO as gv,sS as _v,sT as vv,sU as yv,sV as bv,sY as xv,s_ as Sv,sa as Cv,sc as wv,sd as Tv,sg as Ev,sh as Dv,si as Ov,sj as kv,sl as Av,sm as jv,sn as Mv,sp as Nv,sr as Pv,ss as Fv,st as Iv,sw as Lv,sy as Rv,t as G,tB as zv,tD as Bv,tE as Vv,tH as Hv,tO as Uv,tT as Wv,tU as Gv,tV as Kv,tY as qv,tZ as Jv,t_ as Yv,ta as Xv,tc as Zv,td as Qv,tg as $v,ti as ey,tj as ty,tl as ny,tm as ry,tn as iy,tr as ay,ts as oy,tt as sy,tw as cy,ty as ly,tz as uy,uB as dy,uE as fy,uF as py,uH as my,uM as hy,uO as gy,uS as _y,uT as vy,uU as yy,uV as by,uY as xy,u_ as Sy,ua as Cy,uc as wy,ud as Ty,ug as Ey,uh as Dy,ui as Oy,uj as ky,ul as Ay,un as jy,up as My,ur as Ny,us as Py,ut as Fy,uw as Iy,uy as Ly,v as Ry,vB as zy,vH as By,vM as Vy,vO as Hy,vS as Uy,vT as Wy,vU as Gy,vV as Ky,va as qy,vd as Jy,vf as Yy,vg as Xy,vh as Zy,vi as Qy,vj as $y,vl as eb,vn as tb,vo as nb,vp as rb,vq as ib,vr as ab,vs as ob,vt as sb,vw as cb,wB as lb,wH as ub,wM as db,wR as fb,wS as pb,wT as mb,wU as hb,wV as gb,wa as _b,wd as vb,wg as yb,wi as bb,wl as xb,wn as Sb,wp as Cb,wr as wb,ws as Tb,wv as Eb,ww as Db,x as Ob,xB as kb,xH as Ab,xM as jb,xO as Mb,xS as Nb,xT as Pb,xU as Fb,xV as Ib,xa as Lb,xd as Rb,xg as zb,xh as Bb,xi as Vb,xj as Hb,xl as Ub,xn as Wb,xp as Gb,xq as Kb,xr as qb,xs as Jb,xv as Yb,xw as Xb,y as Zb,yB as Qb,yH as $b,yM as ex,yO as tx,yS as nx,yT as rx,yU as ix,yV as ax,ya as ox,yd as sx,yf as cx,yg as lx,yh as ux,yi as dx,yj as fx,yk as px,yl as mx,yn as hx,yp as gx,yq as _x,yr as vx,ys as yx,yv as bx,yw as xx,z as Sx,zB as Cx,zD as wx,zH as Tx,zJ as Ex,zR as Dx,zT as Ox,zV as kx,zX as Ax,za as jx,zd as Mx,zg as Nx,zh as Px,zi as Fx,zl as Ix,zn as Lx,zo as Rx,zr as zx,zs as Bx,zu as Vx,zv as Hx,zw as Ux}from"./api-DSJJn0d7.js";import{S as Wx,_ as Gx,a as Kx,b as qx,c as Jx,d as Yx,f as Xx,g as Zx,h as Qx,i as $x,l as eS,m as tS,n as nS,o as rS,p as iS,r as aS,s as oS,t as sS,u as cS,v as lS,x as uS,y as dS}from"./useNavigate-D3GIoxyW.js";import{B as fS,C as Iee,D as Lee,E as pS,F as mS,G as hS,H as gS,I as _S,J as vS,K as yS,L as bS,M as Ree,N as zee,O as Bee,P as Vee,R as xS,T as SS,U as Hee,V as CS,_ as Uee,a as wS,b as Wee,c as Gee,d as TS,f as ES,g as DS,h as Kee,i as OS,k as qee,l as Jee,m as kS,n as Yee,o as AS,p as jS,q as MS,r as NS,s as PS,t as Xee,v as Zee,w as FS,x as IS,y as Qee,z as LS}from"./useStartNewChat-BszDHUjD.js";import{a as RS,c as zS,d as BS,f as $ee,i as VS,l as HS,n as ete,o as tte,r as US,s as nte,t as WS,u as rte}from"./speech-CrNma2Ue.js";import{t as GS}from"./check-DmQzfrws.js";import{r as KS}from"./dist-ClkJChBn.js";import{t as qS}from"./chevron-left-DQ9FCoo_.js";import{t as JS}from"./chevron-right-C_b_y922.js";import{t as YS}from"./chevron-up-Dsqj2Oaj.js";import{n as XS,t as ZS}from"./usageView-C9Y6E0Zu.js";import{_ as QS,a as $S,c as eC,d as tC,f as nC,g as rC,h as iC,i as aC,l as oC,m as sC,n as cC,o as lC,p as uC,r as dC,s as fC,t as pC,u as mC}from"./dropdown-menu-DHMOOlaP.js";import{n as hC,t as gC}from"./search-BK6bzZNi.js";import{t as _C}from"./copy-BaUCUMp2.js";import{t as vC}from"./download-DWgC7zCa.js";import{n as yC,t as bC}from"./eye-B-ipuYEd.js";import{a as xC,i as SC,n as CC,o as wC,t as TC}from"./deliveryRecorder-C7NQZrrH.js";import{t as EC}from"./loader-circle-BNhIFGdg.js";import{t as DC}from"./lock-0lxfSnTE.js";import{t as OC}from"./checkbox-CsI4ggnp.js";import{a as kC,i as AC,n as jC,r as MC,t as NC}from"./cronDescribe-CAuRX7uW.js";import{t as PC}from"./pencil-aUWxuLhy.js";import{t as FC}from"./plus-Djbdyc2E.js";import{t as IC}from"./rotate-ccw-BD-9XzMC.js";import{t as LC}from"./server-DLnWqkX-.js";import{i as RC,n as zC,r as BC,t as VC}from"./users-BJqaWlH1.js";import{t as HC}from"./trash-2-B4WSfc7G.js";import{t as UC}from"./triangle-alert-BkDa-x8g.js";import{i as WC,n as GC,t as KC}from"./useChart-CKFEN42T.js";import{t as qC}from"./x-CK8d5DC1.js";import{i as JC,n as YC,r as XC,t as ZC}from"./tooltip-v_AyOWn6.js";import{a as QC,i as $C,n as ew,r as tw,t as nw}from"./select-qM3ZfTHx.js";import{a as rw,c as iw,i as aw,n as ow,o as sw,r as cw,s as lw,t as uw}from"./alert-dialog-BoEv1f8g.js";import{i as dw,n as fw,r as pw,t as mw}from"./tabs-mZfLmn2f.js";import{n as hw,r as gw,t as _w}from"./popover-DBaIbsBr.js";import{t as K}from"./button-Dio0PVrp.js";import{t as vw}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{a as yw,c as bw,d as xw,i as Sw,l as Cw,n as ww,o as Tw,r as Ew,s as Dw}from"./useFontScale-ByBFat3y.js";import{n as Ow,r as kw,t as Aw}from"./toast-xNFwDnUy.js";import{t as jw}from"./badge-C4po8DQ1.js";import{c as Mw,d as Nw,f as Pw,l as Fw,o as Iw,r as Lw,s as Rw,u as zw}from"./chunk-7TTQLYRW-ByhoRIPY.js";import{t as Bw}from"./preload-helper-Czpn1I53.js";import{a as Vw,i as Hw,n as Uw,r as Ww}from"./format-DGKgJf2p.js";import{a as Gw,i as Kw,n as qw,o as Jw,r as Yw,t as Xw}from"./dialog-BfrsWZiD.js";import{a as Zw,d as Qw,f as $w,h as eT,i as tT,l as nT,m as rT,p as iT,r as aT}from"./searchSchemas-CS2ZgsHC.js";import{n as oT,r as sT,t as cT}from"./appHost-CH3EGcJw.js";import{n as lT,r as uT,t as dT}from"./ConfirmDialog-BXcki0Ee.js";import{a as fT,i as pT,n as mT,o as hT,r as gT,s as _T,t as vT}from"./EntitySheet-B2B48bss.js";import{a as yT,c as bT,d as xT,f as ST,g as CT,h as wT,i as TT,l as ET,m as DT,n as OT,o as kT,p as AT,r as jT,s as MT,u as NT}from"./KnobRow-BsOT2O6U.js";import{s as PT}from"./groupManageView-BMBqgRhV.js";import{n as FT,r as IT,t as LT}from"./fileMetaView-Ci5C4w9Q.js";import{r as RT,t as zT}from"./trashView-Ct0Xw-a9.js";import{a as BT,c as VT,i as HT,l as UT,n as WT,r as GT,s as KT}from"./AdminSettings-B8n1yLsD.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var qT=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),JT=i(((e,t)=>{t.exports=qT()})),YT=i((t=>{var r=JT(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function N(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?N(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return N(e(t))}catch{}}return null}var P=Array.isArray,F=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var te=z(null),ne=z(null),re=z(null),ie=z(null);function ae(e,t){switch(V(re,t),V(ne,e),V(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(te),V(te,e)}function oe(){B(te),B(ne),B(re)}function se(e){e.memoizedState!==null&&V(ie,e);var t=te.current,n=Xd(t,e.type);t!==n&&(V(ne,e),V(te,n))}function ce(e){ne.current===e&&(B(te),B(ne)),ie.current===e&&(B(ie),op._currentValue=ee)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/pdf-EQHMWEbX.js","assets/preload-helper-Czpn1I53.js","assets/RolesTab-DU0g4d-R.js","assets/bundle-mjs-C73ZY4La.js","assets/api-DSJJn0d7.js","assets/lock-0lxfSnTE.js","assets/checkbox-CsI4ggnp.js","assets/check-DmQzfrws.js","assets/dist-DDCmobc1.js","assets/dist-D-RIDSJc.js","assets/button-Dio0PVrp.js","assets/input-BSpTsBA6.js","assets/convexApi-CyScjgcq.js","assets/toast-xNFwDnUy.js","assets/x-CK8d5DC1.js","assets/badge-C4po8DQ1.js","assets/ConfirmDialog-BXcki0Ee.js","assets/alert-dialog-BoEv1f8g.js","assets/dist-CkbybbG7.js","assets/dialog-BfrsWZiD.js","assets/EntitySheet-B2B48bss.js","assets/loader-circle-BNhIFGdg.js","assets/roleDescriptions-x3mUxTcX.js","assets/InstancesTab-BevtM68H.js","assets/FieldLabel-Tea3wyVe.js","assets/tooltip-v_AyOWn6.js","assets/select-qM3ZfTHx.js","assets/dist-ClkJChBn.js","assets/chevron-up-Dsqj2Oaj.js","assets/dist-Cw3aN_jM.js","assets/locales-CPjguROj.js","assets/curation-CQksaIbm.js","assets/popover-DBaIbsBr.js","assets/dist-ChrIV8UV.js","assets/groupManageView-BMBqgRhV.js","assets/DataTableShell-DRFFBx_j.js","assets/chevrons-up-down-Pva00Np5.js","assets/dropdown-menu-DHMOOlaP.js","assets/dist-D7doQlva.js","assets/plus-Djbdyc2E.js","assets/trash-2-B4WSfc7G.js","assets/table-D2SJC960.js","assets/BridgeTab-D4RFq-Rb.js","assets/useNavigate-D3GIoxyW.js","assets/chevron-right-C_b_y922.js","assets/usageView-C9Y6E0Zu.js","assets/server-DLnWqkX-.js","assets/triangle-alert-BkDa-x8g.js","assets/tabs-mZfLmn2f.js","assets/format-DGKgJf2p.js","assets/appHost-CH3EGcJw.js","assets/FilterBar-DTVwlDpF.js","assets/search-BK6bzZNi.js","assets/rotate-ccw-BD-9XzMC.js","assets/TimeRangePicker-D3PJq1H8.js","assets/compatView--1YlftIc.js","assets/dispatchErrorInfo-Bb7JyJFO.js","assets/PromptInjectionsTab-Vdb1lF36.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-CCBW5ofF.css","assets/GroupsTab-Io16XZHz.js","assets/chevron-left-DQ9FCoo_.js","assets/users-BJqaWlH1.js","assets/star-CM6J2w_J.js","assets/DetailChips-Cv1sxdhU.js","assets/IntegrationsTab-DMY6VTUC.js","assets/FeedbacksTab-6URuFdfg.js","assets/SubAgentReportsTab-D9rclslo.js","assets/TrashTab-BMSJ7ANC.js","assets/use_paginated_query-CQj09xXv.js","assets/fileMetaView-Ci5C4w9Q.js","assets/trashView-Ct0Xw-a9.js","assets/trashPage-WtAhGCt7.js","assets/trashPage-DfKyy5ga.css","assets/DeletedChatsTab-COYSFkNf.js","assets/FilesTab-esMtHJXt.js","assets/download-DWgC7zCa.js","assets/ScheduledTab-B6gWc0HN.js","assets/list-eSch39T9.js","assets/cronDescribe-CAuRX7uW.js","assets/pencil-aUWxuLhy.js","assets/TimezoneCombobox-CPTpWNQm.js","assets/AgentFilesTab-C3CUT4Ep.js","assets/capabilities-BTqhMVxR.js","assets/PreferencesTab-DJ9p401L.js","assets/useFontScale-ByBFat3y.js","assets/ChatDefaultsTab-D0d9yEow.js","assets/KnobRow-BsOT2O6U.js","assets/AccessTab-JmFp20Kp.js","assets/ThemeShowroom-N4qzUtlq.js","assets/useChart-CKFEN42T.js","assets/card-CerX9wDn.js","assets/AdvancedFilter-Bb66m5kb.js","assets/ProjectPage-BxEF71jN.js","assets/useStartNewChat-BszDHUjD.js","assets/useStartNewChat-DgQf_3y0.css","assets/eye-B-ipuYEd.js","assets/ProjectPage-BXsrYrrF.css","assets/TracesTab-DMdT_psj.js","assets/copy-BaUCUMp2.js","assets/deliveryRecorder-C7NQZrrH.js","assets/searchSchemas-Dm-Qg010.js","assets/VoiceTab-BSh-05Ze.js","assets/speech-CrNma2Ue.js","assets/AuditTab-D5YrLbTy.js","assets/AnomaliesTab-CpiY8ZTC.js","assets/KpiTab-DCfAwBfJ.js","assets/ServiceAccountsTab-Dmb_LH0V.js","assets/UsersTab-BQaLsUCK.js","assets/AdminSettings-B8n1yLsD.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,c as t,i as n,l as r,o as i,r as a,s as o}from"./bundle-mjs-C73ZY4La.js";import{$A as s,$B as c,$C as l,$D as u,$E as d,$H as f,$J as p,$R as m,$T as h,$V as g,$X as _,$a as v,$c as y,$f as b,$g as x,$h as S,$i as C,$n as w,$o as T,$p as E,$r as D,$s as O,$t as k,$w as A,$z as j,A as M,AB as N,AD as P,AH as F,AJ as I,AM as ee,AR as L,AS as R,AT as z,AU as B,AV as V,Aa as te,Ad as ne,Ag as re,Ai as ie,Al as ae,Ap as oe,Ar as se,Au as ce,Aw as le,B as ue,BB as de,BC as fe,BD as pe,BH as me,BJ as he,BR as ge,BT as _e,BV as ve,BX as ye,Ba as be,Bg as xe,Bh as Se,Bi as Ce,Bl as we,Bn as Te,Bo as Ee,Br as De,Bs as Oe,Bu as ke,Bv as Ae,Bw as je,CB as Me,CH as Ne,CM as Pe,CR as Fe,CS as Ie,CT as Le,CU as Re,CV as ze,Ca as Be,Cd as Ve,Cg as He,Ci as Ue,Cl as We,Cn as Ge,Cp as Ke,Cr as qe,Cs as Je,Cv as Ye,Cw as Xe,Cy as Ze,D as Qe,DB as $e,DH as et,DJ as tt,DM as nt,DR as rt,DS as it,DT as at,DU as ot,DV as st,Da as ct,Dc as lt,Dd as ut,Dg as dt,Di as ft,Dl as pt,Dp as mt,Dr as ht,Ds as gt,Dv as _t,Dw as vt,E as H,EB as yt,EH as bt,EJ as xt,EM as St,ER as Ct,ES as wt,ET as Tt,EU as Et,EV as Dt,Ea as Ot,Ed as kt,Eg as At,Ei as jt,El as Mt,Ep as Nt,Er as Pt,Es as Ft,Ev as It,Ew as Lt,F as Rt,FB as zt,FC as Bt,FH as Vt,FJ as Ht,FR as Ut,FS as Wt,FT as Gt,FU as Kt,FV as qt,FX as Jt,Fa as Yt,Fd as Xt,Fg as Zt,Fh as Qt,Fi as $t,Fl as en,Fp as tn,Fr as nn,Fs as rn,Fu as an,Fw as on,G as sn,GA as cn,GB as ln,GC as un,GD as dn,GH as fn,GJ as pn,GR as mn,GT as hn,GV as gn,GX as _n,Ga as vn,Gg as yn,Gh as bn,Gi as xn,Gn as Sn,Go as Cn,Gr as wn,Gs as Tn,Gt as En,Gv as Dn,Gw as On,H as kn,HB as An,HC as jn,HH as Mn,HJ as Nn,HR as Pn,HT as Fn,HV as In,HX as Ln,Ha as Rn,Hg as zn,Hh as Bn,Hi as Vn,Hn,Ho as Un,Hr as Wn,Hs as Gn,Hu as Kn,Hv as qn,Hw as Jn,I as Yn,IB as Xn,IH as Zn,IJ as Qn,IR as $n,IT as er,IU as tr,IV as nr,IX as rr,Ia as ir,Id as ar,Ig as or,Ih as sr,Ii as cr,Il as lr,In as ur,Io as dr,Ip as fr,Ir as pr,Is as mr,Iu as hr,Iv as gr,Iw as _r,JA as vr,JB as yr,JC as br,JD as xr,JH as Sr,JJ as Cr,JR as wr,JT as Tr,JV as Er,JX as Dr,Ja as Or,Jc as kr,Jg as Ar,Jh as jr,Ji as Mr,Jn as Nr,Jo as Pr,Jp as Fr,Jq as Ir,Jr as Lr,Js as Rr,Jt as zr,Jv as Br,Jw as Vr,KA as Hr,KB as Ur,KC as Wr,KD as Gr,KH as Kr,KJ as qr,KR as Jr,KT as Yr,KV as Xr,KX as Zr,Ka as Qr,Kc as $r,Kf as ei,Kg as ti,Kh as ni,Ki as ri,Kn as ii,Kr as ai,Ks as oi,Kt as si,Kv as ci,Kw as li,L as ui,LB as di,LH as fi,LJ as pi,LR as mi,LT as hi,LV as gi,LX as _i,La as vi,Ld as yi,Lg as bi,Lh as xi,Li as Si,Ll as Ci,Ln as wi,Lo as Ti,Lp as Ei,Lr as Di,Ls as Oi,Lu as ki,Lw as Ai,M as ji,MB as Mi,MH as Ni,MJ as Pi,MM as Fi,MR as Ii,MS as Li,MT as Ri,MU as zi,MV as Bi,Ma as Vi,Md as Hi,Mg as Ui,Mi as Wi,Ml as Gi,Mp as Ki,Mr as qi,Mu as Ji,Mw as Yi,N as Xi,NB as Zi,NC as Qi,ND as $i,NH as ea,NJ as ta,NR as na,NS as ra,NT as ia,NU as aa,NV as oa,Na as sa,Nd as ca,Ng as la,Nh as ua,Ni as da,Nl as fa,Np as pa,Nr as ma,Ns as ha,Nu as ga,Nv as _a,Nw as va,O as ya,OB as ba,OH as xa,OJ as Sa,OM as Ca,OR as wa,OS as Ta,OT as Ea,OU as Da,OV as Oa,Oa as ka,Oc as Aa,Od as ja,Og as Ma,Oi as Na,Ol as Pa,Op as Fa,Or as Ia,Os as La,Ov as Ra,Ow as za,P as Ba,PB as Va,PC as Ha,PH as Ua,PJ as Wa,PR as Ga,PS as Ka,PT as qa,PU as Ja,PV as Ya,PX as Xa,Pa as Za,Pd as Qa,Pg as $a,Ph as eo,Pi as to,Pl as no,Pp as ro,Pr as io,Ps as ao,Pu as oo,Pv as so,Pw as co,QA as lo,QB as uo,QC as fo,QD as po,QE as mo,QH as ho,QJ as go,QR as _o,QT as vo,QV as yo,QX as bo,Qf as xo,Qg as So,Qh as Co,Qi as wo,Qn as To,Qo as Eo,Qp as Do,Qr as Oo,Qs as ko,Qt as Ao,Qw as jo,Qz as Mo,R as No,RB as Po,RH as Fo,RJ as Io,RR as Lo,RT as Ro,RV as zo,RX as Bo,Ra as Vo,Rd as Ho,Rg as Uo,Rh as Wo,Ri as Go,Rl as Ko,Rn as qo,Ro as Jo,Rr as Yo,Rs as Xo,Ru as Zo,Rv as Qo,Rw as $o,SB as es,SH as ts,SM as ns,SR as rs,SS as is,ST as as,SU as os,SV as ss,Sa as cs,Sd as ls,Sg as us,Sh as ds,Si as fs,Sl as ps,Sn as ms,Sp as hs,Sr as gs,Ss as _s,Sv as vs,Sw as ys,T as bs,TB as xs,TH as Ss,TJ as Cs,TM as ws,TR as Ts,TS as Es,TT as Ds,TU as Os,TV as ks,Ta as As,Td as js,Tg as Ms,Ti as Ns,Tl as Ps,Tn as Fs,Tp as Is,Tr as Ls,Ts as Rs,Tv as zs,Tw as Bs,U as Vs,UB as Hs,UC as Us,UD as Ws,UH as Gs,UJ as Ks,UR as qs,UT as Js,UV as Ys,UX as Xs,Ua as Zs,Ug as Qs,Uh as $s,Ui as ec,Un as tc,Ur as nc,Us as rc,Uu as ic,Uv as ac,Uw as oc,V as sc,VB as cc,VC as lc,VH as uc,VJ as dc,VR as fc,VT as pc,VV as mc,VX as hc,Va as gc,Vg as _c,Vh as vc,Vi as yc,Vn as bc,Vo as xc,Vr as Sc,Vs as Cc,Vu as wc,Vv as Tc,Vw as Ec,W as Dc,WA as Oc,WB as kc,WC as Ac,WD as jc,WH as Mc,WJ as Nc,WR as Pc,WT as Fc,WV as Ic,WX as Lc,Wa as Rc,Wg as zc,Wh as Bc,Wi as Vc,Wn as Hc,Wo as Uc,Wr as Wc,Ws as Gc,Wu as Kc,Wv as qc,Ww as Jc,XA as Yc,XB as Xc,XC as Zc,XD as Qc,XE as $c,XH as el,XJ as tl,XR as nl,XT as rl,XV as il,XX as U,Xa as al,Xc as ol,Xf as sl,Xg as cl,Xh as ll,Xi as ul,Xn as dl,Xo as fl,Xp as pl,Xr as ml,Xs as hl,Xt as gl,Xw as _l,Xz as vl,YA as yl,YB as bl,YC as xl,YD as Sl,YH as Cl,YJ as wl,YR as Tl,YT as El,YV as Dl,YX as W,Ya as Ol,Yc as kl,Yg as Al,Yh as jl,Yi as Ml,Yn as Nl,Yo as Pl,Yp as Fl,Yr as Il,Ys as Ll,Yt as Rl,Yv as zl,Yw as Bl,ZA as Vl,ZB as Hl,ZC as Ul,ZD as Wl,ZE as Gl,ZH as Kl,ZJ as ql,ZR as Jl,ZT as Yl,ZV as Xl,ZX as Zl,Zc as Ql,Zg as $l,Zh as eu,Zi as tu,Zn as nu,Zo as ru,Zp as iu,Zr as au,Zs as ou,Zt as su,Zw as cu,Zz as lu,_ as uu,_B as du,_H as fu,_M as pu,_O as mu,_S as hu,_T as gu,_U as _u,_V as vu,_a as yu,_c as bu,_d as xu,_f as Su,_g as Cu,_h as wu,_i as Tu,_j as Eu,_l as Du,_n as Ou,_o as ku,_p as Au,_q as ju,_r as Mu,_s as Nu,_t as Pu,aB as Fu,aD as Iu,aH as Lu,aO as Ru,aT as zu,aU as Bu,aV as Vu,aY as Hu,aZ as Uu,a_ as Wu,aa as Gu,ac as Ku,ad as qu,ag as Ju,ai as Yu,aj as Xu,al as Zu,am as Qu,an as $u,ao as ed,ap as td,ar as nd,as as rd,at as id,aw as ad,az as od,bB as sd,bH as cd,bM as ld,bO as ud,bS as dd,bT as fd,bU as pd,bV as md,ba as hd,bd as gd,bf as _d,bg as vd,bh as yd,bi as bd,bj as xd,bl as Sd,bn as Cd,bp as wd,bq as Td,br as Ed,bs as Dd,bu as Od,bv as kd,bw as Ad,cB as jd,cE as Md,cM as Nd,cO as Pd,cS as Fd,cT as Id,cU as Ld,cV as Rd,cY as zd,c_ as Bd,ca as Vd,cc as Hd,cd as Ud,cg as Wd,ch as Gd,ci as Kd,cj as qd,cl as Jd,cn as Yd,cp as Xd,cr as Zd,cs as Qd,ct as $d,cw as ef,cy as tf,dB as nf,dD as rf,dE as af,dH as of,dM as sf,dO as cf,dS as lf,dT as uf,dU as df,dV as ff,dY as pf,da as mf,dc as hf,dd as gf,dg as _f,dh as vf,di as yf,dj as bf,dl as xf,dn as Sf,dp as Cf,dr as wf,ds as Tf,dt as Ef,dy as Df,eB as Of,eD as kf,eE as Af,eH as jf,eO as Mf,eT as Nf,eU as Pf,eV as Ff,eY as If,eZ as Lf,e_ as Rf,ea as zf,ec as Bf,ed as Vf,eg as Hf,ei as Uf,ej as Wf,el as Gf,em as Kf,en as qf,er as Jf,es as Yf,ew as Xf,ez as Zf,fB as Qf,fD as $f,fE as ep,fH as tp,fM as np,fO as rp,fS as ip,fT as ap,fU as op,fV as sp,fa as cp,fc as lp,fd as up,fg as dp,fh as fp,fi as pp,fj as mp,fl as hp,fn as gp,fp as _p,fr as vp,fs as yp,ft as bp,fy as xp,g as Sp,gB as Cp,gD as wp,gE as Tp,gH as Ep,gM as Dp,gO as Op,gS as kp,gT as Ap,gU as jp,gV as Mp,ga as Np,gc as Pp,gd as Fp,gf as Ip,gg as Lp,gh as Rp,gi as zp,gj as Bp,gl as Vp,gn as Hp,go as Up,gp as Wp,gr as Gp,gs as Kp,gt as qp,hB as Jp,hD as Yp,hE as Xp,hH as Zp,hM as eee,hO as Qp,hS as $p,hT as em,hU as tm,hV as nm,ha as rm,hc as im,hd as am,hf as om,hg as tee,hh as sm,hi as cm,hj as lm,hl as um,hn as dm,ho as fm,hp as pm,hq as mm,hr as hm,hs as gm,ht as _m,iB as vm,iD as ym,iH as bm,iO as xm,iT as Sm,iU as Cm,iV as wm,iY as Tm,iZ as Em,i_ as Dm,ia as nee,ic as Om,id as ree,ig as km,ii as iee,ij as Am,il as jm,im as Mm,in as Nm,ip as Pm,ir as Fm,is as Im,it as Lm,iw as Rm,iz as zm,j as Bm,jB as Vm,jH as Hm,jJ as Um,jM as Wm,jR as Gm,jS as Km,jT as qm,jU as Jm,jV as Ym,ja as Xm,jd as Zm,jg as Qm,ji as $m,jl as eh,jp as th,jr as nh,ju as rh,jw as ih,k as ah,kB as oh,kD as sh,kH as ch,kJ as lh,kM as uh,kR as dh,kS as fh,kT as ph,kU as mh,kV as hh,ka as gh,kc as _h,kd as vh,kg as yh,ki as bh,kl as xh,kp as Sh,kr as Ch,kv as wh,kw as Th,lB as Eh,lE as Dh,lH as Oh,lM as kh,lO as Ah,lS as jh,lT as Mh,lU as Nh,lV as Ph,l_ as Fh,la as Ih,lc as Lh,ld as Rh,lg as zh,lh as Bh,li as Vh,lj as Hh,ll as Uh,ln as Wh,lp as Gh,lr as Kh,ls as qh,lt as Jh,lw as Yh,ly as Xh,mB as Zh,mD as Qh,mE as $h,mH as eg,mM as aee,mO as oee,mS as see,mT as cee,mU as lee,mV as uee,ma as dee,mc as tg,md as fee,mg as ng,mh as pee,mi as mee,mj as hee,ml as gee,mn as _ee,mp as vee,mq as yee,mr as bee,ms as xee,mt as See,mu as Cee,my as wee,nB as Tee,nD as rg,nE as Eee,nH as Dee,nO as Oee,nT as kee,nU as Aee,nV as jee,nY as Mee,nZ as ig,n_ as ag,na as Nee,nc as Pee,nd as Fee,ng as og,ni as sg,nj as cg,nl as lg,nm as ug,nn as dg,no as fg,np as pg,nr as mg,ns as hg,nt as gg,nw as _g,nz as vg,oB as yg,oE as bg,oH as xg,oM as Sg,oO as Cg,oS as wg,oT as Tg,oU as Eg,oV as Dg,oY as Og,oZ as kg,o_ as Ag,oa as jg,oc as Mg,od as Ng,og as Pg,oh as Fg,oi as Ig,oj as Lg,ol as Rg,om as zg,on as Bg,op as Vg,or as Hg,os as Ug,ot as Wg,ow as Gg,pB as Kg,pD as qg,pE as Jg,pH as Yg,pM as Xg,pO as Zg,pS as Qg,pT as $g,pU as e_,pV as t_,pa as n_,pc as r_,pd as i_,pg as a_,ph as o_,pi as s_,pj as c_,pl as l_,pn as u_,pp as d_,pr as f_,ps as p_,pt as m_,pu as h_,py as g_,qA as __,qB as v_,qC as y_,qD as b_,qH as x_,qJ as S_,qR as C_,qT as w_,qV as T_,qX as E_,qa as D_,qc as O_,qf as k_,qg as A_,qh as j_,qi as M_,qn as N_,qr as P_,qs as F_,qt as I_,qv as L_,qw as R_,r as z_,rB as B_,rD as V_,rH as H_,rO as U_,rT as W_,rU as G_,rV as K_,rY as q_,rZ as J_,r_ as Y_,ra as X_,rc as Z_,rd as Q_,rg as $_,ri as ev,rj as tv,rl as nv,rm as rv,rn as iv,rp as av,rr as ov,rs as sv,rt as cv,rw as lv,ry as uv,rz as dv,sB as fv,sE as pv,sH as mv,sM as hv,sO as gv,sS as _v,sT as vv,sU as yv,sV as bv,sY as xv,s_ as Sv,sa as Cv,sc as wv,sd as Tv,sg as Ev,sh as Dv,si as Ov,sj as kv,sl as Av,sm as jv,sn as Mv,sp as Nv,sr as Pv,ss as Fv,st as Iv,sw as Lv,sy as Rv,t as G,tB as zv,tD as Bv,tE as Vv,tH as Hv,tO as Uv,tT as Wv,tU as Gv,tV as Kv,tY as qv,tZ as Jv,t_ as Yv,ta as Xv,tc as Zv,td as Qv,tg as $v,ti as ey,tj as ty,tl as ny,tm as ry,tn as iy,tr as ay,ts as oy,tt as sy,tw as cy,ty as ly,tz as uy,uB as dy,uE as fy,uF as py,uH as my,uM as hy,uO as gy,uS as _y,uT as vy,uU as yy,uV as by,uY as xy,u_ as Sy,ua as Cy,uc as wy,ud as Ty,ug as Ey,uh as Dy,ui as Oy,uj as ky,ul as Ay,un as jy,up as My,ur as Ny,us as Py,ut as Fy,uw as Iy,uy as Ly,v as Ry,vB as zy,vH as By,vM as Vy,vO as Hy,vS as Uy,vT as Wy,vU as Gy,vV as Ky,va as qy,vd as Jy,vf as Yy,vg as Xy,vh as Zy,vi as Qy,vj as $y,vl as eb,vn as tb,vo as nb,vp as rb,vq as ib,vr as ab,vs as ob,vt as sb,vw as cb,wB as lb,wH as ub,wM as db,wR as fb,wS as pb,wT as mb,wU as hb,wV as gb,wa as _b,wd as vb,wg as yb,wi as bb,wl as xb,wn as Sb,wp as Cb,wr as wb,ws as Tb,wv as Eb,ww as Db,x as Ob,xB as kb,xH as Ab,xM as jb,xO as Mb,xS as Nb,xT as Pb,xU as Fb,xV as Ib,xa as Lb,xd as Rb,xg as zb,xh as Bb,xi as Vb,xj as Hb,xl as Ub,xn as Wb,xp as Gb,xq as Kb,xr as qb,xs as Jb,xv as Yb,xw as Xb,y as Zb,yB as Qb,yH as $b,yM as ex,yO as tx,yS as nx,yT as rx,yU as ix,yV as ax,ya as ox,yd as sx,yf as cx,yg as lx,yh as ux,yi as dx,yj as fx,yk as px,yl as mx,yn as hx,yp as gx,yq as _x,yr as vx,ys as yx,yv as bx,yw as xx,z as Sx,zB as Cx,zD as wx,zH as Tx,zJ as Ex,zR as Dx,zT as Ox,zV as kx,zX as Ax,za as jx,zd as Mx,zg as Nx,zh as Px,zi as Fx,zl as Ix,zn as Lx,zo as Rx,zr as zx,zs as Bx,zu as Vx,zv as Hx,zw as Ux}from"./api-DSJJn0d7.js";import{S as Wx,_ as Gx,a as Kx,b as qx,c as Jx,d as Yx,f as Xx,g as Zx,h as Qx,i as $x,l as eS,m as tS,n as nS,o as rS,p as iS,r as aS,s as oS,t as sS,u as cS,v as lS,x as uS,y as dS}from"./useNavigate-D3GIoxyW.js";import{B as fS,C as Iee,D as Lee,E as pS,F as mS,G as hS,H as gS,I as _S,J as vS,K as yS,L as bS,M as Ree,N as zee,O as Bee,P as Vee,R as xS,T as SS,U as Hee,V as CS,_ as Uee,a as wS,b as Wee,c as Gee,d as TS,f as ES,g as DS,h as Kee,i as OS,k as qee,l as Jee,m as kS,n as Yee,o as AS,p as jS,q as MS,r as NS,s as PS,t as Xee,v as Zee,w as FS,x as IS,y as Qee,z as LS}from"./useStartNewChat-BszDHUjD.js";import{a as RS,c as zS,d as BS,f as $ee,i as VS,l as HS,n as ete,o as tte,r as US,s as nte,t as WS,u as rte}from"./speech-CrNma2Ue.js";import{t as GS}from"./check-DmQzfrws.js";import{r as KS}from"./dist-ClkJChBn.js";import{t as qS}from"./chevron-left-DQ9FCoo_.js";import{t as JS}from"./chevron-right-C_b_y922.js";import{t as YS}from"./chevron-up-Dsqj2Oaj.js";import{n as XS,t as ZS}from"./usageView-C9Y6E0Zu.js";import{_ as QS,a as $S,c as eC,d as tC,f as nC,g as rC,h as iC,i as aC,l as oC,m as sC,n as cC,o as lC,p as uC,r as dC,s as fC,t as pC,u as mC}from"./dropdown-menu-DHMOOlaP.js";import{n as hC,t as gC}from"./search-BK6bzZNi.js";import{t as _C}from"./copy-BaUCUMp2.js";import{t as vC}from"./download-DWgC7zCa.js";import{n as yC,t as bC}from"./eye-B-ipuYEd.js";import{a as xC,i as SC,n as CC,o as wC,t as TC}from"./deliveryRecorder-C7NQZrrH.js";import{t as EC}from"./loader-circle-BNhIFGdg.js";import{t as DC}from"./lock-0lxfSnTE.js";import{t as OC}from"./checkbox-CsI4ggnp.js";import{a as kC,i as AC,n as jC,r as MC,t as NC}from"./cronDescribe-CAuRX7uW.js";import{t as PC}from"./pencil-aUWxuLhy.js";import{t as FC}from"./plus-Djbdyc2E.js";import{t as IC}from"./rotate-ccw-BD-9XzMC.js";import{t as LC}from"./server-DLnWqkX-.js";import{i as RC,n as zC,r as BC,t as VC}from"./users-BJqaWlH1.js";import{t as HC}from"./trash-2-B4WSfc7G.js";import{t as UC}from"./triangle-alert-BkDa-x8g.js";import{i as WC,n as GC,t as KC}from"./useChart-CKFEN42T.js";import{t as qC}from"./x-CK8d5DC1.js";import{i as JC,n as YC,r as XC,t as ZC}from"./tooltip-v_AyOWn6.js";import{a as QC,i as $C,n as ew,r as tw,t as nw}from"./select-qM3ZfTHx.js";import{a as rw,c as iw,i as aw,n as ow,o as sw,r as cw,s as lw,t as uw}from"./alert-dialog-BoEv1f8g.js";import{i as dw,n as fw,r as pw,t as mw}from"./tabs-mZfLmn2f.js";import{n as hw,r as gw,t as _w}from"./popover-DBaIbsBr.js";import{t as K}from"./button-Dio0PVrp.js";import{t as vw}from"./input-BSpTsBA6.js";import"./convexApi-CyScjgcq.js";import{a as yw,c as bw,d as xw,i as Sw,l as Cw,n as ww,o as Tw,r as Ew,s as Dw}from"./useFontScale-ByBFat3y.js";import{n as Ow,r as kw,t as Aw}from"./toast-xNFwDnUy.js";import{t as jw}from"./badge-C4po8DQ1.js";import{c as Mw,d as Nw,f as Pw,l as Fw,o as Iw,r as Lw,s as Rw,u as zw}from"./chunk-7TTQLYRW-ByhoRIPY.js";import{t as Bw}from"./preload-helper-Czpn1I53.js";import{a as Vw,i as Hw,n as Uw,r as Ww}from"./format-DGKgJf2p.js";import{a as Gw,i as Kw,n as qw,o as Jw,r as Yw,t as Xw}from"./dialog-BfrsWZiD.js";import{a as Zw,d as Qw,f as $w,h as eT,i as tT,l as nT,m as rT,p as iT,r as aT}from"./searchSchemas-Dm-Qg010.js";import{n as oT,r as sT,t as cT}from"./appHost-CH3EGcJw.js";import{n as lT,r as uT,t as dT}from"./ConfirmDialog-BXcki0Ee.js";import{a as fT,i as pT,n as mT,o as hT,r as gT,s as _T,t as vT}from"./EntitySheet-B2B48bss.js";import{a as yT,c as bT,d as xT,f as ST,g as CT,h as wT,i as TT,l as ET,m as DT,n as OT,o as kT,p as AT,r as jT,s as MT,u as NT}from"./KnobRow-BsOT2O6U.js";import{s as PT}from"./groupManageView-BMBqgRhV.js";import{n as FT,r as IT,t as LT}from"./fileMetaView-Ci5C4w9Q.js";import{r as RT,t as zT}from"./trashView-Ct0Xw-a9.js";import{a as BT,c as VT,i as HT,l as UT,n as WT,r as GT,s as KT}from"./AdminSettings-B8n1yLsD.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var qT=i((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),JT=i(((e,t)=>{t.exports=qT()})),YT=i((t=>{var r=JT(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function N(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?N(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return N(e(t))}catch{}}return null}var P=Array.isArray,F=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee={pending:!1,data:null,method:null,action:null},L=[],R=-1;function z(e){return{current:e}}function B(e){0>R||(e.current=L[R],L[R]=null,R--)}function V(e,t){R++,L[R]=e.current,e.current=t}var te=z(null),ne=z(null),re=z(null),ie=z(null);function ae(e,t){switch(V(re,t),V(ne,e),V(te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}B(te),V(te,e)}function oe(){B(te),B(ne),B(re)}function se(e){e.memoizedState!==null&&V(ie,e);var t=te.current,n=Xd(t,e.type);t!==n&&(V(ne,e),V(te,n))}function ce(e){ne.current===e&&(B(te),B(ne)),ie.current===e&&(B(ie),op._currentValue=ee)}var le,ue;function de(e){if(le===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);le=t&&t[1]||``,ue=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+le+e+ue}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -155,4 +155,4 @@ Previous: [${e.join(`, `)}]\nIncoming: [${t.join(`, `)}]`);for(let n=0;n<e.lengt
155
155
  `)),s=$(e=>e.metadata?.custom?.groupText??null),c=s!==null&&s.trim()!==``?s:o,l=e.engine!==`gateway`;if(!e.enabled||!c.trim()||l&&!HS())return null;let u=US(e.lang,Ln()),d=t.active?.messageId===i,f=d&&t.active?.phase===`loading`,p=d&&t.active?.phase===`playing`,m=()=>{w7();let o=zS(c);if(l){let n=VS(o,{lang:u,rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(n?{messageId:i,phase:`playing`}:null);return}if(!a)return;let s=C7;t.setActive({messageId:i,phase:`loading`}),n({chatId:a,text:o.slice(0,1500)}).then(({mime:n,audioBase64:r})=>{if(s!==C7)return;let a=ete(r,n,{rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(a?{messageId:i,phase:`playing`}:null)}).catch(e=>{s===C7&&(r.error(_h(),e),t.setActive(null))})};return(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn${d?` oc-iconbtn--reading`:``}`,title:d?Ix():we(),"aria-label":d?Ix():we(),"aria-pressed":d,"aria-busy":f,onClick:()=>{if(d){w7(),t.setActive(null);return}m()},children:f?(0,J.jsx)(EC,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}):p?(0,J.jsx)(Hne,{}):(0,J.jsx)(Vne,{})})}function Bne(){let e=(0,q.useContext)(S7);if(!e.active)return null;let t=e.active.phase===`loading`;return(0,J.jsxs)(`div`,{className:`oc-reading-banner`,role:`status`,children:[t?(0,J.jsx)(EC,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,J.jsx)(rte,{size:14,className:`oc-reading-banner__pulse`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:t?Aa():lt()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-reading-banner__stop`,onClick:()=>{w7(),e.setActive(null)},children:Ix()})]})}function Vne(){return(0,J.jsxs)(H7,{children:[(0,J.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,J.jsx)(`path`,{d:`M15.5 8.5a5 5 0 0 1 0 7`})]})}function Hne(){return(0,J.jsxs)(H7,{children:[(0,J.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,J.jsx)(`line`,{x1:`22`,y1:`9`,x2:`16`,y2:`15`}),(0,J.jsx)(`line`,{x1:`16`,y1:`9`,x2:`22`,y2:`15`})]})}function W7(){return(0,J.jsxs)(H7,{children:[(0,J.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,J.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})}function G7(){return(0,J.jsx)(H7,{children:(0,J.jsx)(`path`,{d:`M20 6 9 17l-5-5`})})}function Une({text:e}){let t=(e??``).trim();return t?(0,J.jsx)(`div`,{className:`oc-msg__segment`,role:`note`,children:t}):null}function Wne({text:e}){let t=$(e=>e.metadata?.custom?.mentions??null);if(t===null||t.length===0)return(0,J.jsx)(J.Fragment,{children:e});let n=[],r=0;for(let[i,a]of t.entries())a.start<r||a.end>e.length||(a.start>r&&n.push(e.slice(r,a.start)),n.push((0,J.jsx)(`span`,{className:`oc-mention${a.isViewer?` oc-mention--self`:``}${a.isAgent===!0?` oc-mention--agent`:``}`,title:a.name,children:e.slice(a.start,a.end)},`${a.start}-${i}`)),r=a.end);return r<e.length&&n.push(e.slice(r)),(0,J.jsx)(J.Fragment,{children:n})}var K7={File:H8,Text:Wne},Gne={...K7,Text:oq,Reasoning:Une,data:{by_name:{widget:e0}},tools:{by_name:{__turn_flow__:i8,__delegated_reply__:Xne}}};function q7({kind:e}){let t=$(e=>P3(e.metadata?.custom)),n=W(G.messages.deleteMessage).withOptimisticUpdate(v6),r=lT(),i=kw(),a=(0,q.useContext)(D7),[o,s]=(0,q.useState)(!1),c=MV(e=>e.isRunning);if(!t)return null;async function l(){if(await r(e===`assistant`?{title:jf(),description:g(),confirmLabel:yo(),cancelLabel:Xl(),destructive:!0}:{title:il(),description:Dl(),confirmLabel:Er(),cancelLabel:Xl(),destructive:!0})){s(!0),e===`assistant`&&a?.begin();try{await n({messageId:t})}catch(t){e===`assistant`&&a?.cancel(),i.error(Ic(),t)}finally{s(!1)}}}return(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-iconbtn--danger`,title:c?b():e===`assistant`?T_():Xr(),"aria-label":gn(),"aria-busy":o,disabled:o||c,onClick:()=>void l(),children:o?(0,J.jsx)(EC,{size:15,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,J.jsx)(HC,{size:15,"aria-hidden":!0})})}function J7(){let e=$(e=>e.metadata?.custom?.rawText??``),t=$(e=>e.metadata?.custom?.chatId),n=$(e=>e.metadata?.custom?.messageId),r=$(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??Y7),i=U(G.subAgents.listSubAgents,e===``&&t?{chatId:t}:`skip`),a=e===``?HQ(i??[],_8(r),n).find(e=>e.status===`done`&&e.resultText)?.resultText??``:``,o=e===``&&a!==``,s=e===``?a:e,[l,u]=(0,q.useState)(!1),d=[...s].length;return(0,J.jsxs)(`div`,{className:`oc-msg__source`,children:[(0,J.jsxs)(`div`,{className:`oc-msg__source-head`,children:[(0,J.jsx)(`span`,{className:`oc-msg__source-label`,children:o?Kv({count:d}):d>1?jee({count:d}):K_({count:d})}),(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:Ff(),"aria-label":Ff(),onClick:()=>{navigator.clipboard?.writeText(s).then(()=>{u(!0),window.setTimeout(()=>u(!1),1200)})},children:l?(0,J.jsx)(G7,{}):(0,J.jsx)(W7,{})})]}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:s.length>0?s:c()})]})}function Kne({active:e,onToggle:t}){return(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn${e?` is-on`:``}`,onClick:t,"aria-pressed":e,title:e?uo():Hl(),"aria-label":Xc(),children:(0,J.jsx)(bA,{size:15,"aria-hidden":!0})})}function qne(){let[e,t]=(0,q.useState)(!1),n=E7(),r=$(e=>e.id.startsWith(`optimistic-`)),i=$(e=>e.metadata?.custom?.queued===!0),a=$(e=>e.id),o=$(e=>e.metadata?.custom?.custody??null),s=$(e=>e.metadata?.custom?.chatId??null),{can:c}=jT(o===`queued`?s:null),l=$(e=>e.metadata?.custom?.quotedRefs??null),u=kw(),d=$(e=>e.metadata?.custom?.authorName??null);return(0,J.jsx)(pG.Root,{className:`oc-msg oc-msg--user${r?` is-sending`:``}${i?` is-queued`:``}`,"data-message-id":a,children:(0,J.jsxs)(`div`,{className:`oc-msg__col oc-msg__col--user`,children:[(0,J.jsx)(uK,{}),d===null?null:(0,J.jsx)(`div`,{className:`oc-msg__author`,children:dr({name:d})}),l?.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:`oc-msg__quote`,title:Su(),onClick:e.messageId?()=>Z7(e.messageId,e.blockIndex,u):void 0,children:[(0,J.jsx)(cj,{size:12,"aria-hidden":!0,className:`oc-msg__quote-ico`}),(0,J.jsx)(`span`,{className:`oc-msg__quote-text`,children:e.excerpt})]},`${e.messageId??`orphan`}:${e.blockIndex??`all`}:${t}`))??null,(0,J.jsx)(`div`,{className:`oc-msg__bubble`,children:e?(0,J.jsx)(J7,{}):(0,J.jsx)(pG.Parts,{components:K7})}),r?(0,J.jsxs)(`span`,{className:`oc-msg__sending`,role:`status`,children:[(0,J.jsx)(`span`,{className:`oc-msg__sending-spin`,"aria-hidden":!0}),yr()]}):i?(0,J.jsxs)(`span`,{className:`oc-msg__queued`,role:`status`,children:[(0,J.jsx)(hC,{size:12,"aria-hidden":!0}),v_()]}):(0,J.jsxs)(J.Fragment,{children:[r6(o)===null?null:(0,J.jsx)(l8,{custody:o,messageId:a,canWithdraw:c(`discardPendingInput`)}),(0,J.jsxs)(dH.Root,{className:`oc-msg__actions oc-msg__actions--user`,autohide:`not-last`,children:[(0,J.jsx)(mK,{}),n.copyUser?(0,J.jsxs)(dH.Copy,{className:`oc-iconbtn`,title:bl(),children:[(0,J.jsx)(pG.If,{copied:!0,children:(0,J.jsx)(G7,{})}),(0,J.jsx)(pG.If,{copied:!1,children:(0,J.jsx)(W7,{})})]}):null,n.showSource?(0,J.jsx)(Kne,{active:e,onToggle:()=>t(e=>!e)}):null,n.showReport?(0,J.jsx)(r5,{}):null,n.showDelete?(0,J.jsx)(q7,{kind:`user`}):null]})]})]})})}function Jne({pool:e,agent:t}){let n=o2(e,t),r=n?.displayName??t.agentId;return(0,J.jsxs)(`span`,{className:`oc-chip oc-chip--agent oc-msg__agent`,title:Re({name:r}),children:[n?.emoji?(0,J.jsx)(`span`,{className:`oc-chip__emoji`,"aria-hidden":!0,children:n.emoji}):(0,J.jsx)(MS,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-chip__label`,children:r})]})}var Y7=[],Yne=[];function X7(){let e=(0,q.useRef)(null),[t,n]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>{let e=0;try{e=t.getTotalLength()}catch{e=0}if(!e){let n=t.getBoundingClientRect();e=2*(n.width+n.height)}e>0&&n(Math.round(e))};r();let i=new ResizeObserver(r);return i.observe(t.ownerSVGElement??t),()=>i.disconnect()},[]),(0,J.jsxs)(`svg`,{className:`oc-empty-answer__ants`,"aria-hidden":!0,children:[(0,J.jsx)(`rect`,{ref:e}),t===null?null:(0,J.jsx)(`rect`,{className:`oc-ants-accent`,style:{strokeDasharray:`3 3 3 3 3 ${Math.max(t-15,6)}`,animationDuration:`${Math.max(t*4,800)}ms`,animationTimingFunction:`steps(${Math.max(Math.round(t/6),8)}, end)`,"--oc-ants-p":`${t}px`}})]})}function Xne(e){let t=$(e=>e.metadata?.custom?.chatId),n=$(e=>e.metadata?.custom?.messageId),r=D8(U(G.subAgents.listSubAgents,t?{chatId:t}:`skip`),n,e.args?.slot);return r.length===0?null:(0,J.jsx)(J.Fragment,{children:r.map(e=>(0,J.jsxs)(`div`,{className:`oc-delegated-reply`,children:[e.agentId?(0,J.jsxs)(`div`,{className:`oc-empty-answer__from`,role:`note`,children:[(0,J.jsx)(SA,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:ua({agent:e.agentId})})]}):null,(0,J.jsx)(aq,{text:e.resultText})]},e.childSessionKey))})}function Zne({show:e}){let t=$(e=>e.metadata?.custom?.status),n=$(e=>e.metadata?.custom?.steerSegment===!0),r=$(e=>e.metadata?.custom?.chatId),i=$(e=>yQ(e.content)),a=$(e=>e.content.some(e=>e?.type===`file`||e?.type===`data`&&e.name===`widget`)),o=$(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??Y7),s=U(G.subAgents.listSubAgents,r?{chatId:r}:`skip`),c=$(e=>e.metadata?.custom?.messageId),l=$(e=>e.metadata?.custom?.settledAt??void 0),u=$(e=>e.metadata?.custom?.hasContinuation===!0),d=$(e=>e.metadata?.custom?.answeredChildRunIds??Yne),f=$(e=>e.metadata?.custom?.handOff??null),p=$(e=>e.metadata?.custom?.repeatWithheld===!0),[,m]=(0,q.useState)(0),h=E8({status:t,hasText:i||p,hasMedia:a,settledAt:l,delegatedInline:u,answeredChildRunIds:d,...f===null?{}:{projected:f.projected,resumedChildRunIds:f.resumedChildRunIds,resumedChildKeys:f.resumedChildKeys,laterUserTurn:f.laterUserTurn}},o,s,c),g=h.kind===`composing`||h.kind===`waiting`?h.recheckAt??null:null;return(0,q.useEffect)(()=>{if(g===null)return;let e=window.setTimeout(()=>m(e=>e+1),Math.max(g-Date.now(),0)+250);return()=>window.clearTimeout(e)},[g]),h.kind===`none`||n||f?.projected===!0&&(h.kind===`composing`||h.kind===`waiting`)?null:h.kind===`composing`?(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,J.jsx)(X7,{}),(0,J.jsx)(EC,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:h.taskName?xi({task:h.taskName}):Wo()})]}):h.kind===`failed`?e&&h.cardSilent!==!0?null:(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--failed`,role:`status`,children:[(0,J.jsx)(MS,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:h.taskName?Qt({task:h.taskName,reason:h.reason}):sr({reason:h.reason})})]}):h.kind===`waiting`?e&&h.recheckAt===void 0?null:(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,J.jsx)(X7,{}),(0,J.jsx)(EC,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:h.taskName?Px({task:h.taskName}):Se()})]}):h.kind===`done`?h.resultText?(0,J.jsxs)(J.Fragment,{children:[h.agentId?(0,J.jsxs)(`div`,{className:`oc-empty-answer__from`,role:`note`,children:[(0,J.jsx)(SA,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:ua({agent:h.agentId})})]}):null,(0,J.jsx)(aq,{text:h.resultText})]}):null:(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--generic`,role:`status`,children:[(0,J.jsx)(MS,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:eo()})]})}function Qne(){let[e,t]=(0,q.useState)(!1),n=E7(),r=H0(),i=$(e=>e.id),a=(0,q.useContext)(M7),o=kw(),s=(0,q.useCallback)((e,t)=>{let n=dM(e,t);n===`too-many`?o.error(Cn({count:10})):n===`too-long`&&o.error(Uc())},[o]),c=$(e=>e.metadata?.custom?.groupText??e.metadata?.custom?.rawText??``),l=$(e=>e.status?.type===`running`),u=$(e=>e.metadata?.custom?.chatId),d=$(e=>e.metadata?.custom?.messageId),f=$(e=>e.metadata?.custom?.status),p=$(e=>e.content.some(e=>e?.type===`file`)),m=$(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??Y7),h=U(G.subAgents.listSubAgents,c===``&&u?{chatId:u}:`skip`),g=c===``?E8({status:f,hasText:!1,hasMedia:p},m,h,d):null,_=c===``?g?.kind===`done`?g.resultText??``:``:c,v=(0,q.useContext)(k6),y=v!==null&&v.messageId===i?v:null,b=$(e=>e.metadata?.custom?.status),x=(0,q.useContext)(o8),S=$(e=>e.metadata?.custom?.steerSegment===!0&&!yQ(e.content)&&!e.content.some(e=>e?.type===`file`||e?.type===`data`&&e.name===`widget`)),C=$(e=>e.metadata?.custom?.groupFollows===!0),w=$(e=>e.metadata?.custom?.groupContinues===!0);Rne($(e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
156
156
  `)));let T=P7(),E=T&&T.perTurnRouting?T.messageAgents.has(i)?T.messageAgents.get(i)??T.primary:T.fallbackAgent:null,D=T?.pool,O=$(e=>e.metadata?.custom?.importedAgentLabel??null),k=(0,q.useMemo)(()=>{if(O!==null)return{...r,agentName:O,agentEmoji:null};if(!E)return r;let e=o2(D??[],E);return{...r,agentName:e?.displayName??E.agentId,agentEmoji:e?.emoji??null}},[O,E,r,D]);return b===void 0&&x||S&&!n.showTools?null:(0,J.jsxs)(pG.Root,{className:`oc-msg oc-msg--assistant${C?` oc-msg--group-follow`:``}${w?` oc-msg--group-continues`:``}`,"data-message-id":i,children:[C?(0,J.jsx)(`span`,{className:`oc-msg__avatar oc-msg__avatar--group`,"aria-hidden":!0}):(0,J.jsx)(F7,{className:`oc-msg__avatar`}),(0,J.jsxs)(`div`,{className:`oc-msg__col`,children:[C?null:(0,J.jsxs)(`div`,{className:`oc-msg__name`,children:[E?(0,J.jsx)(Jne,{pool:T.pool,agent:E}):(0,J.jsxs)(J.Fragment,{children:[r.agentEmoji?(0,J.jsx)(`span`,{className:`oc-msg__name-emoji`,"aria-hidden":!0,children:r.agentEmoji}):null,U0(r)]}),(0,J.jsx)(mK,{header:!0}),a!==null&&!i.startsWith(`optimistic-`)&&!l&&_!==``?(0,J.jsx)(`button`,{type:`button`,className:`oc-bmk-headbtn`,title:cx(),"aria-label":cx(),onClick:()=>{let e=tK(_,280);e!==``&&s(a,{messageId:i,blockIndex:null,excerpt:e})},children:(0,J.jsx)(cj,{size:13})}):null]}),(0,J.jsxs)(`div`,{className:`oc-msg__body`,children:[(0,J.jsx)(M6,{}),(0,J.jsx)(`div`,{className:`oc-msg__meta oc-msg__meta--cron`,children:(0,J.jsx)(CK,{})}),n.showTools?(0,J.jsxs)(`div`,{className:`oc-msg__meta`,children:[(0,J.jsx)(L2,{}),(0,J.jsx)(N8,{}),(0,J.jsx)(u8,{}),(0,J.jsx)(gJ,{})]}):null,(0,J.jsx)(I8,{}),e?(0,J.jsx)(J7,{}):(0,J.jsx)(pG.Parts,{components:Gne}),e?null:(0,J.jsx)(Zne,{show:n.showTools}),(0,J.jsx)(pne,{}),(0,J.jsx)(V0.Provider,{value:k,children:(0,J.jsx)(w6,{})}),y===null?null:(0,J.jsx)(L7,{quiet:y.quiet===!0,running:y.running,since:y.workingSince,progress:y.progressSummary??null,anchored:!0})]}),(0,J.jsx)(uK,{messageLevelMarkers:!1,onReplyToBlock:a!==null&&!i.startsWith(`optimistic-`)?(e,t)=>s(a,{messageId:i,blockIndex:e,excerpt:t}):void 0}),w?null:(0,J.jsxs)(dH.Root,{className:`oc-msg__actions`,autohide:`not-last`,children:[n.copyAssistant?(0,J.jsx)(Lne,{}):null,(0,J.jsx)(zne,{}),n.showReport?(0,J.jsx)(r5,{}):null,n.showDelete?(0,J.jsx)(q7,{kind:`assistant`}):null,(0,J.jsx)(Fne,{sourceShown:n.showSource,sourceActive:e,onToggleSource:()=>t(e=>!e)})]})]})]})}function $ne(){let e=$(e=>e.id);return(0,J.jsx)(pG.Root,{className:`oc-msg oc-msg--system`,"data-message-id":e,children:(0,J.jsx)(`div`,{className:`oc-msg__body`,children:(0,J.jsx)(pG.Parts,{components:K7})})})}function Z7(e,t,n){if(document.querySelector(`[data-message-id="${CSS.escape(e)}"]`)===null&&document.querySelector(`[data-message-id]`)!==null){n.error(Yy());return}iK(e,t,`smooth`)}function ere({chatId:e}){let t=vM(e),n=kw();return t.length===0?null:(0,J.jsx)(`div`,{className:`oc-composer__quotes`,role:`group`,"aria-label":Ip(),children:t.map(t=>(0,J.jsxs)(`div`,{className:`oc-composer__quote`,children:[(0,J.jsx)(cj,{size:13,"aria-hidden":!0,className:`oc-composer__quote-ico`}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__quote-text`,title:Su(),onClick:()=>Z7(t.messageId,t.blockIndex,n),children:t.excerpt}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__quote-x`,"aria-label":om(),onClick:()=>fM(e,pM(t)),children:(0,J.jsx)(qC,{size:13,"aria-hidden":!0})})]},pM(t)))})}function tre(){let e=DV(e=>e.status?.type),t=DV(e=>e.type),n=DV(e=>e.file??null),[r,i]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(t!==`image`||!n){i(null);return}let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},[t,n]);let a=e===`incomplete`,o=n!==null&&Iq(n),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),d=(0,q.useRef)(null);d.current=n;let f=n!==null&&(n.type.startsWith(`text/`)||/\.(txt|md|json|csv|log|xml|yaml|yml)$/i.test(n.name));return(0,J.jsxs)(kH.Root,{className:`oc-attach${a?` oc-attach--error`:``}${r&&!a?` oc-attach--image`:``}${o?` oc-attach--flash`:``}`,"data-status":e,children:[r&&!a?(0,J.jsx)(`img`,{src:r,alt:``,className:`oc-attach__thumb`}):(0,J.jsx)(`span`,{className:`oc-attach__icon`,"aria-hidden":!0,children:a?(0,J.jsx)(_A,{size:14}):t===`image`?(0,J.jsx)(zA,{size:14}):(0,J.jsx)(oj,{size:14})}),r&&!a?null:(0,J.jsx)(`span`,{className:`oc-attach__name`,children:(0,J.jsx)(kH.Name,{})}),a?(0,J.jsx)(`span`,{className:`oc-attach__state`,children:Jp()}):null,!a&&(f||r)?(0,J.jsx)(`button`,{type:`button`,className:`oc-attach__view`,"aria-label":nf(),title:nf(),onClick:()=>{if(c(!0),u(null),f&&n){let e=n,t=2e5;e.slice(0,t).text().then(n=>{d.current===e&&u(e.size>t?n+`
157
157
 
158
- `+Eh():n)}).catch(()=>{d.current===e&&u(null)})}},children:(0,J.jsx)(bC,{size:13,"aria-hidden":!0})}):null,(0,J.jsx)(kH.Remove,{className:`oc-attach__remove`,"aria-label":Qf(),children:(0,J.jsx)(qC,{size:13,"aria-hidden":!0})}),(0,J.jsx)(Xw,{open:s,onOpenChange:c,children:(0,J.jsxs)(qw,{className:`oc-attach__dialog`,children:[(0,J.jsx)(Gw,{children:(0,J.jsx)(Jw,{className:`oc-attach__dialog-title`,children:n?.name??nf()})}),r?(0,J.jsx)(`img`,{src:r,alt:``,className:`oc-attach__dialog-img`}):l===null?(0,J.jsx)(`p`,{className:`oc-attach__dialog-text`,children:`…`}):(0,J.jsx)(`pre`,{className:`oc-attach__dialog-text`,children:l})]})})]})}function nre(){let e=(0,q.useSyncExternalStore)(a0.subscribe,a0.getSnapshot);return e.active?(0,J.jsxs)(`div`,{className:`oc-upload`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`div`,{className:`oc-upload__head`,children:[(0,J.jsx)(EC,{className:`oc-upload__spin`,size:14,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:e.count>1?Kg({count:e.count,percent:e.percent}):Zh({percent:e.percent})})]}),(0,J.jsx)(`div`,{className:`oc-upload__track`,"aria-hidden":!0,children:(0,J.jsx)(`div`,{className:`oc-upload__bar`,style:{width:`${e.percent}%`}})})]}):null}function rre({reason:e}){let t=(0,q.useContext)(O7),n=OV(),r=kV(e=>e.text).trim().length>0,i=e===`subagent`;return(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!r||t===null,"aria-label":i?rt():wr(),title:r?i?Ct():C_():i?wa():Tl(),onClick:()=>{if(t===null)return;let e=n.getState().text;e.trim()!==``&&t(e).then(e=>{e&&n.setText(``)})},children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})})}function Q7(){let e=(0,q.useContext)(A7);return e===null?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send oc-composer__stop`,"aria-label":m(),title:_o(),onClick:()=>void e(),children:(0,J.jsx)(bj,{size:14,"aria-hidden":!0})})}function ire({chatId:e,gate:t,onManage:n}){let r=P7(),i=U(G.chatAgents.listChatAgents,{chatId:e}),a=i?K0(i.viewerRoomRole):!1,o=kw(),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(`agents`),[d,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(`member`),h=X0(i?.viewerRoomRole),g=Z0(p,i?.viewerRoomRole),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1);(0,q.useEffect)(()=>{m(`member`),f(``),v(!1),b(!1)},[e]);let x=U(G.chatParticipants.listInvitable,a&&s&&l===`people`?{chatId:e}:`skip`),S=W(G.chatParticipants.addMember),C=W(G.chatParticipants.removeMember),w=t=>{C({chatId:e,memberId:t.userId}).then(()=>o.success(Cd({name:t.name}))).catch(()=>o.error(ku()))},T=U(G.chatAgents.listAddableAgents,a&&s&&l===`agents`?{chatId:e}:`skip`),E=W(G.chatAgents.addChatAgent),D=W(G.chatAgents.removeChatAgent),O=t=>{let n=t.displayName??t.agentId;D({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).then(e=>{e.removed&&o.success(Cd({name:n}))}).catch(()=>o.error(Sc()))},k=t=>{E({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/chat_agents_limit:(\d+)/.exec(t);o.error(n===null?PT(e)?Ze():tc():Lr({count:Number(n[1])}))})},[A,j]=(0,q.useState)(``),M=U(G.chatParticipants.listMembers,{chatId:e}),N=OV(),P=r?.pool??[],F=r?.roomAgents??[],I=i==null?r?.primary??null:i.primary?{instanceName:i.primary.instanceName,agentId:i.primary.agentId}:null,ee=(0,q.useMemo)(()=>f2(P,i?[i.primary,...i.agents]:[]),[P,i]),{room:L,others:R}=(0,q.useMemo)(()=>l2(qee(ee,A),I,F),[ee,A,F,I]),z=(0,q.useMemo)(()=>u2([...ee,...T??[]]),[ee,T]),B=t.onCall!=null&&!P.some(e=>Q0(e,t.onCall));if(!r||t.hidden&&!n)return null;let V=!t.hidden,{disabled:te}=t,ne=t=>{let n=S4(String(e),N.getState().text,{instanceName:t.instanceName,agentId:t.agentId},i4(t.displayName??t.agentId));n!==null&&N.setText(n)},re=t.onCall??r.primary,ie=o2(P,re),ae=new Set((T??[]).map(e=>`${e.instanceName}\u0000${e.agentId}`)),oe=A.trim().toLocaleLowerCase(),se=_2(ee,T??[],A),ce=se.slice(0,8),le=R.length+se.length,ue=h2({unfolded:_,searching:oe!==``,hereCount:L.length}),de=e=>{let t=z.has(`${e.instanceName}\u0000${e.agentId}`),n=ae.has(`${e.instanceName}\u0000${e.agentId}`),r=d2(i?.viewerRoomRole,e,I,F),a=(0,J.jsxs)(`button`,{type:`button`,role:`option`,className:`oc-agentrow`,disabled:e.state===`deleted`||te||!V,title:e.state===`deleted`?Qi():hx({name:e.displayName??e.agentId}),onClick:()=>{ne(e),c(!1),j(``)},children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,title:e.kind===`hermes`?`Hermes`:`OpenClaw`,children:(0,J.jsx)(V2,{kind:e.kind,size:16})}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId,Q0(e,I)?(0,J.jsx)(wA,{size:12,className:`oc-agentrow__primary`,"aria-label":tb(),children:(0,J.jsx)(`title`,{children:tb()})}):null]}),t?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),(0,J.jsx)(dA,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`${e.instanceName}/${e.agentId}`);if(!n&&!r)return a;let o=e.displayName??e.agentId;return(0,J.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[a,n?(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__add`,title:Hc(),"aria-label":Hc(),onClick:()=>k(e),children:(0,J.jsx)(FC,{size:14,"aria-hidden":!0})}):null,r?(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Wb({name:o}),"aria-label":Wb({name:o}),onClick:()=>O(e),children:(0,J.jsx)(qC,{size:14,"aria-hidden":!0})}):null]},`${e.instanceName}/${e.agentId}`)},fe=+!!I+F.length,pe=M?.length??1,me=Nl({agents:fe,people:pe,next:re?`${ie?.displayName??re.agentId}${(z.has(`${re.instanceName}\u0000${re.agentId}`)||B)&&re?` (${re.instanceName})`:``}`:`—`}),he=(0,J.jsxs)(J.Fragment,{children:[V&&P.length>6||a?(0,J.jsxs)(`div`,{className:`oc-agentlist__search`,children:[(0,J.jsx)(gC,{size:14,"aria-hidden":!0}),(0,J.jsx)(`input`,{autoFocus:!0,value:A,onChange:e=>j(e.target.value),placeholder:Bt(),"aria-label":Ha()})]}):null,te?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:t.reason===`call-active`?os():Fb()}):null,(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`listbox`,children:[L.map(e=>de(e)),L.length>0&&le>0?(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentlist__divider oc-agentlist__toggle`,"aria-expanded":ue,onClick:()=>v(!ue),children:[(0,J.jsx)(JS,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:Il()}),(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:le})]}):null,ue?(0,J.jsx)(J.Fragment,{children:R.map(e=>{let t=`${e.instanceName}\u0000${e.agentId}`,n=ae.has(t);return(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow oc-agentrow--outside`,disabled:!n,onClick:()=>k(e),title:n?Hc():Ou(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V2,{kind:e.kind,size:16})}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),z.has(t)?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),n?(0,J.jsx)(FC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`}):null]},`other/${e.instanceName}/${e.agentId}`)})}):null,ue&&ce.length>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-agentlist__divider`,role:`presentation`,children:Hn()}),ce.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow`,onClick:()=>k(e),title:Hc(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V2,{kind:e.kind,size:16})}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),z.has(`${e.instanceName}\u0000${e.agentId}`)?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),(0,J.jsx)(FC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`add/${e.instanceName}/${e.agentId}`))]}):null]})]}),ge=(t,n)=>{let r=x4(String(e),N.getState().text,String(n),i4(t));r!==null&&N.setText(r),c(!1)},_e=d.trim().toLocaleLowerCase(),ve=(M??[]).filter(e=>_e===``||e.name.toLocaleLowerCase().includes(_e)),ye=(x??[]).filter(e=>e.name.toLocaleLowerCase().includes(_e)||(e.detail??``).toLocaleLowerCase().includes(_e)),be=ye.slice(0,8),xe=h2({unfolded:y,searching:_e!==``,hereCount:ve.filter(e=>!e.isSelf).length}),Se=t=>{S({chatId:e,memberId:t.userId,role:g}).then(()=>f(``)).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/participants_limit:(\d+)/.exec(t);o.error(n===null?ku():nb({count:Number(n[1])}))})},Ce=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-agentlist__search`,children:[(0,J.jsx)(gC,{size:14,"aria-hidden":!0}),(0,J.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:a?Te():bc(),"aria-label":a?Te():bc()})]}),(0,J.jsx)(`div`,{className:`oc-agentlist__caption`,children:N_()}),(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`list`,children:[ve.map(e=>{let t=(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,disabled:e.isSelf,onClick:()=>ge(e.name,e.userId),title:e.isSelf?void 0:ii({name:e.name}),children:[(0,J.jsx)(B2,{userId:String(e.userId),name:e.name}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.name,e.isSelf?(0,J.jsx)(`span`,{className:`oc-agentrow__tag`,children:ur()}):null]}),(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(are,{role:e.roomRole})})]}),(0,J.jsx)(dA,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId));return Y0(i?.viewerRoomRole,e)?(0,J.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[t,(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Wb({name:e.name}),"aria-label":Wb({name:e.name}),onClick:()=>w(e),children:(0,J.jsx)(qC,{size:14,"aria-hidden":!0})})]},String(e.userId)):t}),a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-agentlist__divider oc-agentlist__divider--invite`,role:`presentation`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentlist__toggle`,"aria-expanded":xe,onClick:()=>b(!xe),children:[(0,J.jsx)(JS,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:Lx()}),x!==void 0&&ye.length>0?(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:ye.length}):null]}),xe?(0,J.jsxs)(`label`,{className:`oc-invite-as`,children:[(0,J.jsx)(`span`,{children:Gp()}),(0,J.jsxs)(nw,{value:g,onValueChange:e=>m(e),children:[(0,J.jsx)($C,{size:`sm`,className:`oc-invite-as__trigger`,children:(0,J.jsx)(QC,{})}),(0,J.jsx)(ew,{children:h.map(e=>(0,J.jsx)(tw,{value:e,children:q2(e)},e))})]})]}):null]}),xe?x===void 0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:qo()}):be.length===0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Ti()}):be.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,onClick:()=>Se(e),title:wi({name:e.name,role:q2(g)}),children:[(0,J.jsx)(B2,{userId:String(e.userId),name:e.name}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsx)(`span`,{className:`oc-agentrow__name`,children:e.name}),e.detail?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,title:e.detail,children:(0,J.jsx)(`span`,{className:`oc-agentrow__model`,children:e.detail})}):null]}),(0,J.jsx)(zC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId))):null,xe&&ye.length>be.length?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:ms({count:ye.length-be.length})}):null]}):null]})]});return(0,J.jsxs)(`span`,{className:`oc-roompill`,children:[(0,J.jsxs)(_w,{open:s,onOpenChange:e=>{c(e),e||(j(``),v(!1),b(!1))},children:[(0,J.jsx)(gw,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-roompill__main`,title:t.reason===`call-active`?os():me,"aria-label":me,children:[(0,J.jsx)(VC,{size:16,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-roompill__count`,children:fe+pe})]})}),(0,J.jsxs)(hw,{align:`start`,className:`oc-composer__agent-pop p-0`,children:[(0,J.jsxs)(`div`,{className:`oc-roomtabs`,role:`tablist`,children:[(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`agents`,className:`oc-roomtabs__tab`,onClick:()=>u(`agents`),children:[(0,J.jsx)(MS,{size:14,"aria-hidden":!0}),nu(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:fe})]}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`people`,className:`oc-roomtabs__tab`,onClick:()=>u(`people`),children:[(0,J.jsx)(VC,{size:14,"aria-hidden":!0}),dl(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:pe})]})]}),l===`agents`?he:Ce]})]}),n?(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`oc-roompill__chev`,title:Nr(),"aria-label":Nr(),children:(0,J.jsx)(KS,{size:13,"aria-hidden":!0})})}),(0,J.jsx)(cC,{align:`end`,className:`oc-roommenu`,children:(0,J.jsxs)(dC,{onSelect:()=>n(`agents`,null),children:[(0,J.jsx)(fj,{"aria-hidden":!0}),bee()]})})]}):null]})}function are({role:e}){let t=e===`owner`?nd():e===`manager`?Fm():e===`viewer`?mg():ov();return(0,J.jsxs)(`span`,{className:`oc-rolemark`,title:t,children:[(0,J.jsx)(e===`owner`?wA:e===`manager`?RC:e===`viewer`?bC:wj,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:t})]})}function ore(e){let t=(0,q.useContext)(x7),n=OV(),r=kw(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(``),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(e);u.current=e;let d=(0,q.useSyncExternalStore)(Lj,Rj),f=d!==null&&d.targetChatId===e.chatId;(0,q.useEffect)(()=>()=>{c.current?.stop(),c.current=null,a(!1),s(``)},[e.chatId]);let p=(0,q.useCallback)(()=>{requestAnimationFrame(()=>{let t=e.rootRef.current?.querySelector(`.oc-composer__input`);t&&(t.scrollTop=t.scrollHeight)})},[]),m=US(t.lang,Ln()),h=(0,q.useRef)(m);h.current=m;let g=(0,q.useRef)(e.voiceInput);g.current=e.voiceInput;let _=(0,q.useCallback)(()=>{let e=Rj();e!==null&&e.targetChatId===u.current.chatId&&iM(),c.current?.stop(),c.current=null,a(!1),s(``)},[]),v=(0,q.useCallback)(()=>{if(!WS()){r.error(O_());return}let e=Rj();if(e!==null&&e.targetChatId!==u.current.chatId&&e.recording){r.error(Ub());return}let t=u.current.chatId,i={h:null,boundToHold:!1};l.current=i;let o=RS({lang:m,onText:(e,r)=>{if(i.holdGen!==void 0&&i.holdGen!==Gj())return;let a=Rj();if(a!==null&&a.targetChatId===t){if(Kj(e,r.paragraph),u.current.chatId===t){let e=Rj();e!==null&&(n.setText(e.text),p())}return}if(u.current.chatId!==t)return;let o=n.getState().text;n.setText(aM(o,e,r.paragraph)),p()},onInterim:e=>{if(i.holdGen!==void 0&&i.holdGen!==Gj())return;let n=Rj();n!==null&&n.targetChatId===t&&qj(e),s(e)},onEnd:()=>{i.boundToHold&&nM(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``))},onError:e=>{i.boundToHold&&nM(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``),e===`not-allowed`||e===`service-not-allowed`?r.error(kr()):e!==`no-speech`&&e!==`aborted`&&r.error($r({code:e})))}});if(o===null){r.error(O_());return}i.h=o;let d=Rj();if(d!==null&&d.targetChatId===t){i.boundToHold=!0,Wj(()=>o.stop()),i.holdGen=Gj(),a(!0);return}c.current=o,a(!0)},[m,r]),y=(0,q.useCallback)(()=>{if(n.getState().attachments.length>0||l0()){r.error(ps());return}let e=c.current;Uj({targetChatId:u.current.chatId,targetLabel:u.current.chatTitle,text:n.getState().text,voiceEnabled:g.current,voiceLang:h.current,recording:e!==null,...e===null?{}:{stop:()=>e.stop()}})&&(e!==null&&l.current?.h===e&&(l.current.boundToHold=!0,l.current.holdGen=Gj()),c.current=null,a(!1),s(``),n.setText(``))},[r]);return{recording:i||f&&d!==null&&d.recording,interim:f&&d!==null?d.interim:o,held:f,canPin:d===null,pinned:d!==null,pinnedHere:f,pinnedLabel:d?.targetLabel??``,pinnedTargetChatId:d?.targetChatId??null,pendingSend:f?d?.pendingSend??null:null,pendingSendId:f?d?.pendingSendId??0:0,pendingRestore:f?d?.pendingRestore??null:null,start:v,stop:_,hold:y}}function sre({recording:e,onStart:t,onStop:n}){let r=U(G.me.getMe,{host:cT})?.dictationShortcut??null,i=(0,q.useRef)(()=>{});(0,q.useEffect)(()=>{if(!r)return;let e=e=>{e.repeat||Cw(e,r)&&(e.preventDefault(),i.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=r?` (${xw(r,bw())})`:``;return(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${e?` oc-composer__icon--rec`:``}`,title:(e?kl():ol())+a,"aria-label":e?kl():ol(),"aria-pressed":e,ref:e=>{i.current=()=>e?.click()},onClick:()=>e?n():t(),children:(0,J.jsx)(BS,{size:18,"aria-hidden":!0})})}function cre({chatId:e,chatTitle:t=``,showTools:n,onToggleTools:r,unavailable:i=!1,agentGate:a,onTalkCallActiveChange:o,serverCallSessionId:s,subAgentBusy:c=!1}){let{can:l,loading:u,resolved:d}=jT(e),f=u||!d||l(`inboundAttachments`),p=E7().voiceInput,m=H0(),h=P7(),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(`agents`),[b,x]=(0,q.useState)(null),S=(0,q.useCallback)(()=>x(null),[]),C=(0,q.useCallback)((e,t)=>{y(e),x(t),_(!0)},[]),w=h?.nextTarget??null,T=h?.primary??null,E=(h?.roomAgents.length??0)>0,D=E&&T?o2(h?.pool??[],T)?.displayName??T.agentId:U0(m),k=MV(e=>e.isRunning),A=s8(e),j=A!==null&&l(`followUpModes`),M=B8({turnRunning:k,hasRunningSubAgent:!j&&c}),N=M.mode===`queue`,P=(0,q.useContext)(O7),F=OV(),I=Dr(),ee=(0,q.useRef)(null),L=sS(),R=ore({chatId:e,chatTitle:t===``?D:t,voiceInput:p,rootRef:ee}),[z,B]=(0,q.useState)(!1),V=R.pendingSendId,te=kw(),ne=(0,q.useRef)(0);(0,q.useEffect)(()=>{if(V===0||ne.current===V)return;ne.current=V;let e=Rj(),t=e?.pendingSend??``,n=e?.holdId??-1;if(Zj(),i){Qj(n),te.error(sd());return}if(t.trim()===``){$j(n);return}N&&P!==null?P(t).then(e=>{e?Rj()?.holdId===n&&(iM(),F.setText(``)):Qj(n)}):Rj()?.holdId===n&&(iM(),F.setText(t),F.send())},[V]);let re=R.pendingRestore;(0,q.useEffect)(()=>{re!==null&&(F.setText(re),tM(),iM())},[re]),(0,q.useEffect)(()=>{if(!z)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),B(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[z]);let ie=(0,q.useContext)(Aq);(0,q.useEffect)(()=>{if(ie!==null)return ie.current={canAttach:f&&!N&&!R.pinned,attachFile:e=>R.pinned?Promise.resolve():(le(e=>e+1),F.addAttachment(e).then(()=>{de(``),requestAnimationFrame(()=>de(Tn()))}).finally(()=>le(e=>Math.max(0,e-1)))),insertText:e=>{let t=F.getState();F.setText(t.text+e),de(``),requestAnimationFrame(()=>de(Gc()))}},()=>{ie.current=null}},[ie,f,N,F,R.pinned]);let oe=(0,q.useRef)(1),se=kw(),[ce,le]=(0,q.useState)(0),[ue,de]=(0,q.useState)(``),fe=ce>0,pe=(0,J.jsxs)(J.Fragment,{children:[z?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__backdrop`,"aria-label":eh(),onClick:()=>B(!1)}):null,(0,J.jsxs)(mW.Root,{ref:ee,className:`oc-composer${i?` oc-composer--disabled`:``}${R.recording?` oc-composer--dictation`:``}${z?` oc-composer--expanded`:``}`,children:[z?(0,J.jsxs)(`div`,{className:`oc-composer__exphead`,children:[(0,J.jsx)(`span`,{className:`oc-composer__exptitle`,children:Ko()}),(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__expclose`,title:eh(),onClick:()=>B(!1),children:[(0,J.jsx)(ej,{size:15,"aria-hidden":!0}),eh()]})]}):null,e?(0,J.jsx)(e4,{chatId:e,onOpen:()=>C(`people`,null)}):null,e?(0,J.jsx)(t4,{chatId:e,routing:h,open:g,onOpenChange:_,tab:v,onTabChange:y,intent:b,onIntentDone:S}):null,(0,J.jsx)(ere,{chatId:e}),(0,J.jsx)(`div`,{className:`oc-attachrow`,children:(0,J.jsx)(mW.Attachments,{components:{Attachment:tre}})}),(0,J.jsx)(`span`,{className:`oc-sr-only`,role:`status`,"aria-live":`polite`,children:ue}),(0,J.jsx)(nre,{}),(0,J.jsx)(mW.Input,{className:`oc-composer__input`,placeholder:i?sd():E?Cp({name:D}):Qb({name:D}),autoFocus:!0,rows:1,disabled:i,onKeyDownCapture:e=>{if(fe&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation();return}if(!N||P===null||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)return;e.preventDefault(),e.stopPropagation();let t=F.getState().text;if(t.trim()===``)return;let n=j?t6(A?.preference??null,A?.serverMode??null):null,r=n===null?void 0:e.metaKey||e.ctrlKey?n6(n):n.mode;P(t,n===null?void 0:{...r?{mode:r}:{},immediate:r!==`queue`}).then(e=>{e&&F.setText(``)})},onPaste:e=>{if((e.clipboardData?.files?.length??0)>0)return;let t=e.clipboardData?.getData(`text/plain`)??``;if(!t)return;let n=R8(t);if(n!==null&&f&&!N){e.preventDefault();let r=e.currentTarget,i=r.selectionStart??null,a=r.selectionEnd??null,o=F.getState().text,s=()=>{let e=F.getState();e.text===o&&i!==null&&a!==null?F.setText(o.slice(0,i)+t+o.slice(a)):F.setText(e.text+t)};le(e=>e+1),I.query(G.chatExport.exportByReference,{reference:n}).then(e=>{let t=e;if(t===null){s();return}let n=new File([t.markdown],t.filename,{type:`text/markdown; charset=utf-8`});return Fq(n),F.addAttachment(n).then(()=>{de(``),requestAnimationFrame(()=>de(Bf()))})}).catch(()=>{s(),se.error(O())}).finally(()=>le(e=>Math.max(0,e-1)));return}let r=Nq(t,oe.current);if(r.kind!==`file`||!f)return;if(e.preventDefault(),N){se.error(Pm());return}oe.current+=1;let i=new File([t],r.filename??`texte-colle.txt`,{type:`text/plain; charset=utf-8`});Fq(i),le(e=>e+1),F.addAttachment(i).then(()=>{de(``),requestAnimationFrame(()=>de(pg({lines:String(r.lines)})))}).catch(e=>{console.error(`[paste] attachment routing failed:`,e),se.error(av())}).finally(()=>le(e=>Math.max(0,e-1)))},autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`}),R.recording&&R.interim!==``?(0,J.jsxs)(`div`,{className:`oc-composer__interim`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`oc-composer__interim-dot`}),R.interim]}):null,(0,J.jsxs)(`div`,{className:`oc-composer__bar`,children:[(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(Z5,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,attachmentsSupported:f,attachDisabled:N||i}),z?null:(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__tools${n?` is-on`:``}`,onClick:r,"aria-pressed":n,title:n?jd():fv(),children:[(0,J.jsx)(BC,{size:15,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-composer__tools-label`,children:yg()})]}),(0,J.jsx)(ire,{chatId:e,gate:a,onManage:C}),(0,J.jsx)(P5,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,multiAgent:h?.perTurnRouting===!0||(h?.roomAgents?.length??0)>0})]}),(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(`span`,{className:`oc-composer__voiceslot${R.canPin||R.held?` is-shown`:``}`,"aria-hidden":!R.canPin&&!R.held,children:R.held?(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__heldchip`,title:Ql(),"aria-label":Ql(),onClick:()=>iM(),children:[(0,J.jsx)(fS,{size:12,"aria-hidden":!0}),ae(),(0,J.jsx)(qC,{size:11,"aria-hidden":!0})]}):(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon oc-composer__hold`,title:Ci(),"aria-label":Ci(),onClick:R.hold,disabled:!R.canPin||fe,tabIndex:!R.canPin||fe?-1:0,children:(0,J.jsx)(fS,{size:16,"aria-hidden":!0})})}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${z?` is-on`:``}`,title:z?eh():Gi(),"aria-label":z?eh():Gi(),"aria-pressed":z,onClick:()=>B(e=>!e),children:z?(0,J.jsx)(ej,{size:16,"aria-hidden":!0}):(0,J.jsx)(XA,{size:16,"aria-hidden":!0})}),p?(0,J.jsx)(sre,{recording:R.recording,onStart:R.start,onStop:R.stop}):null,(0,J.jsx)(P0,{chatId:e,onCallActiveChange:o,serverCallSessionId:s,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null},e),i?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!0,"aria-label":uy(),children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})}):M.mode===`queue`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q7,{}),j?(0,J.jsx)(c8,{chatId:e,queueSend:P===null?null:(e,t)=>P(e,{...t?{mode:t}:{},immediate:t!==`queue`})}):(0,J.jsx)(rre,{reason:M.reason})]}):j&&c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q7,{}),(0,J.jsx)(mW.Send,{className:`oc-composer__send`,"aria-label":Zf(),disabled:fe,children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})})]}):(0,J.jsx)(mW.Send,{className:`oc-composer__send`,"aria-label":Zf(),disabled:fe,children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})})]})]})]})]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Bne,{}),R.pinned?(0,J.jsxs)(`div`,{className:`oc-composer__pinnednote`,role:`note`,children:[(0,J.jsx)(fS,{size:14,"aria-hidden":!0}),R.pinnedHere?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:lr()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>eM(),children:en()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:no({chat:R.pinnedLabel||Mt()})}),R.pinnedTargetChatId?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>{L({to:`/chat/$chatId`,params:{chatId:R.pinnedTargetChatId}})},children:fa()}):null]})]}):z?(0,Tk.createPortal)(pe,document.body):pe]})}function lre({chatId:e}){let t=I5(e);return t.offered?(0,J.jsxs)(dC,{disabled:t.pending,"data-widgets-toggle":!0,onSelect:()=>t.set(!t.enabled),children:[(0,J.jsx)(UA,{}),t.enabled?gg():sy()]}):null}var $7=67324752,e9=33639248,t9=101010256,n9=0,r9=2048,i9=class extends Error{reason;constructor(e,t){super(t===void 0?e:`${e}: ${t}`),this.reason=e,this.name=`ZipError`}},ure=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function a9(e){let t=4294967295;for(let n of e)t=ure[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function dre(e){if(e.length>65535)throw new i9(`too_many_entries`,String(e.length));let t=new TextEncoder,n=[],r=[],i=0;for(let a of e){let e=t.encode(a.name),o=a9(a.bytes),s=new Uint8Array(30+e.length),c=new DataView(s.buffer);c.setUint32(0,$7,!0),c.setUint16(4,20,!0),c.setUint16(6,r9,!0),c.setUint16(8,n9,!0),c.setUint16(10,0,!0),c.setUint16(12,33,!0),c.setUint32(14,o,!0),c.setUint32(18,a.bytes.length,!0),c.setUint32(22,a.bytes.length,!0),c.setUint16(26,e.length,!0),c.setUint16(28,0,!0),s.set(e,30);let l=new Uint8Array(46+e.length),u=new DataView(l.buffer);u.setUint32(0,e9,!0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,r9,!0),u.setUint16(10,n9,!0),u.setUint16(12,0,!0),u.setUint16(14,33,!0),u.setUint32(16,o,!0),u.setUint32(20,a.bytes.length,!0),u.setUint32(24,a.bytes.length,!0),u.setUint16(28,e.length,!0),u.setUint32(42,i,!0),l.set(e,46),n.push(s,a.bytes),r.push(l),i+=s.length+a.bytes.length}let a=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(22),s=new DataView(o.buffer);s.setUint32(0,t9,!0),s.setUint16(8,e.length,!0),s.setUint16(10,e.length,!0),s.setUint32(12,a,!0),s.setUint32(16,i,!0);let c=n.reduce((e,t)=>e+t.length,0)+a+22,l=new Uint8Array(c),u=0;for(let e of[...n,...r,o])l.set(e,u),u+=e.length;return l}function fre(e){let t=new DataView(e.buffer,e.byteOffset,e.length),n=new TextDecoder,r=-1;for(let n=e.length-22;n>=0;--n)if(t.getUint32(n,!0)===t9){r=n;break}if(r===-1)throw new i9(`not_a_zip`);let i=t.getUint16(r+10,!0),a=t.getUint32(r+16,!0),o=[];for(let r=0;r<i;r+=1){if(a+46>e.length||t.getUint32(a,!0)!==e9)throw new i9(`corrupt`,`central directory`);let r=t.getUint16(a+8,!0),i=t.getUint16(a+10,!0),s=t.getUint32(a+16,!0),c=t.getUint32(a+24,!0),l=t.getUint16(a+28,!0),u=t.getUint16(a+30,!0),d=t.getUint16(a+32,!0),f=t.getUint32(a+42,!0),p=n.decode(e.subarray(a+46,a+46+l));if(i!==n9)throw new i9(`unsupported_method`,p);if((r&r9)===0)throw new i9(`unsupported_encoding`,p);if(f+30>e.length||t.getUint32(f,!0)!==$7)throw new i9(`corrupt`,p);let m=t.getUint16(f+26,!0),h=t.getUint16(f+28,!0),g=f+30+m+h;if(g+c>e.length)throw new i9(`corrupt`,p);let _=e.slice(g,g+c);if(a9(_)!==s)throw new i9(`checksum_mismatch`,p);o.push({name:p,bytes:_}),a+=46+l+u+d}return o}var o9=`manifest.json`,s9=`chats/`,pre=`sections/`,c9=`blobs/`,mre=512*1024*1024,hre=1e4,gre=76,_re=600*1e3;function vre(e,t){return e.filter(e=>t-e.updatedAt>_re)}var yre=class extends Error{bytes;constructor(e){super(`archive exceeds ${mre} bytes`),this.bytes=e,this.name=`ArchiveTooLarge`}};async function l9(e,t,n){let r=new TextEncoder,i=await e.manifest(),a=[],o=0,s=0,c=0,l=new Set,u=(e,t)=>{if(o+=t.length+gre+2*e.length,o>536870912)throw new yre(o);a.push({name:e,bytes:t})},d=[];for(let a of t){let t=await e.chat(a);u(`${s9}${a}.json`,r.encode(JSON.stringify(t)));for(let t of i.sections){let i=null,o=0;do{let f=await e.section(a,t,i);f.rows.length>0&&u(`${pre}${a}/${t}/${o}.json`,r.encode(JSON.stringify(f.rows)));for(let t of f.blobs){if(t.url===null){d.push(t.key);continue}l.has(t.key)||(l.add(t.key),u(`${c9}${t.key}`,await e.blob(t.url)),s+=1,n?.({phase:`blobs`,done:s,total:null}))}i=f.cursor,o+=1,c+=1,n?.({phase:`sections`,done:c,total:null})}while(i!==null&&o<1e4);if(i!==null)throw Error(`export of ${t} did not finish within ${hre} pages`)}}return n?.({phase:`packing`,done:a.length,total:a.length}),a.unshift({name:o9,bytes:r.encode(JSON.stringify({...i,missingBlobs:d}))}),{archive:dre(a),manifest:i,blobCount:s,missingBlobs:d}}async function bre(e,t,n,r){let i=new TextDecoder,a=fre(t);r?.({phase:`reading`,done:a.length,total:a.length});let o=new Map(a.map(e=>[e.name,e.bytes])).get(o9);if(o===void 0)throw Error(`archive has no manifest`);let s=JSON.parse(i.decode(o)),c=await e.begin({formatVersion:s.formatVersion,origin:s.origin??null},n),l=0,u=!1,d=new Map,f=new Set;try{let t=a.filter(e=>e.name.startsWith(c9)).length;for(let n of a){if(!n.name.startsWith(`blobs/`))continue;let i=n.name.slice(6);if(d.has(i))throw Error(`archive names the same blob twice: ${i}`);let a=await e.upload(n.bytes,i);await e.registerBlob(c,a),d.set(i,a),r?.({phase:`uploading`,done:d.size,total:t})}let n=a.filter(e=>e.name.startsWith(s9));for(let t of n){let n=JSON.parse(i.decode(t.bytes)),r=await e.batch(c,`chats`,[n],u9([n],d));l+=r.written,d9([n],r.writtenIds,f)}for(let t of s.sections){let n=a.filter(e=>e.name.startsWith(`sections/`)&&e.name.includes(`/${t}/`)).sort((e,t)=>f9(e.name)-f9(t.name));for(let a of n){let n=JSON.parse(i.decode(a.bytes)),o=await e.batch(c,t,n,u9(n,d));l+=o.written,r?.({phase:`writing`,done:l,total:null}),d9(n,o.writtenIds,f)}}for(let[t,n]of d)f.has(t)||await e.discardUpload(c,n);let o=Math.ceil(l/100)+100;for(let t=0;t<o&&!u;t+=1)u=(await e.finish(c)).done}catch(t){try{let t=!1;for(let n=0;n<1e4&&!t;n+=1)t=(await e.abandon(c)).done;for(let t of d.values())await e.discardUpload(c,t)}catch{}throw t}return{importId:c,written:l,purged:u}}function u9(e,t){let n=new Set;for(let t of e){let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let r=t.archiveBlobKeys;if(Array.isArray(r))for(let e of r)typeof e==`string`&&n.add(e)}let r=[];for(let e of n){let n=t.get(e);n!==void 0&&r.push({key:e,storageId:n})}return r}function d9(e,t,n){let r=new Set(t);for(let t of e){if(typeof t._id!=`string`||!r.has(t._id))continue;let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let i=t.archiveBlobKeys;if(Array.isArray(i))for(let e of i)typeof e==`string`&&n.add(e)}}function f9(e){let t=/\/(\d+)\.json$/.exec(e);return t===null?0:Number(t[1])}function p9(e){return`atrium-${e.normalize(`NFKD`).replace(/[^\p{Letter}\p{Number}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}.zip`}function m9(e,t){let n=URL.createObjectURL(new Blob([e],{type:`application/zip`})),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function xre(){let e=Dr(),[t,n]=(0,q.useState)({running:!1,progress:null}),r=(0,q.useRef)(!1),i=(0,q.useCallback)(()=>({manifest:()=>e.action(G.archiveExport.exportManifest,{}),chat:t=>e.query(G.archiveExport.exportChat,{chatId:t}),section:(t,n,r)=>e.query(G.archiveExport.exportChatSection,{chatId:t,section:n,cursor:r}),blob:async e=>{let t=await fetch(e);if(!t.ok)throw Error(`attachment could not be read (${t.status})`);return new Uint8Array(await t.arrayBuffer())}}),[e]),a=(0,q.useCallback)(()=>({begin:(t,n)=>e.mutation(G.archiveImport.beginImport,{manifest:t,targetProjectId:n??null}),batch:(t,n,r,i)=>e.mutation(G.archiveImport.importBatch,{importId:t,section:n,rows:r,blobs:i.map(e=>({key:e.key,storageId:e.storageId}))}),finish:t=>e.mutation(G.archiveImport.finishImport,{importId:t}),abandon:t=>e.mutation(G.archiveImport.abandonImport,{importId:t}),upload:async t=>{let n=await e.mutation(G.chats.generateUploadUrl,{}),{storageId:r}=await(await fetch(n,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:new Blob([t])})).json();return await e.mutation(G.uploads.registerUpload,{storageId:r}),r},registerBlob:async(t,n)=>{await e.mutation(G.archiveImport.registerImportBlob,{importId:t,storageId:n})},discardUpload:async(t,n)=>{await e.mutation(G.archiveImport.discardUpload,{importId:t,storageId:n})}}),[e]),o=(0,q.useCallback)(async e=>{if(r.current)throw Error(`a transfer is already running`);r.current=!0,n({running:!0,progress:null});try{return await e(e=>n({running:!0,progress:e}))}finally{r.current=!1,n({running:!1,progress:null})}},[]),s=(0,q.useCallback)((e,t)=>o(async n=>{let{archive:r,missingBlobs:a}=await l9(i(),e,n);return m9(r,p9(t)),{missingBlobs:a}}),[o,i]),c=(0,q.useCallback)((t,n)=>o(async r=>{let a=await e.query(G.archiveExport.exportFolderTree,{projectId:t});if(!a.complete)throw Error(`folder_too_large`);let o=[];for(let t of a.folders){let n=null;do{let r=await e.query(G.archiveExport.exportFolderChats,{projectId:t._id,cursor:n});o.push(...r.chatIds),n=r.cursor}while(n!==null)}let{archive:s,missingBlobs:c}=await l9(i(),o,r);return m9(s,p9(n)),{missingBlobs:c,chatCount:o.length}}),[e,o,i]),l=(0,q.useCallback)((e,t)=>o(async n=>{if(e.size>536870912)throw Error(`archive_too_large`);return bre(a(),new Uint8Array(await e.arrayBuffer()),t,n)}),[o,a]);return(0,q.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await e.query(G.archiveImport.listOpenImports,{});for(let r of vre(n,Date.now())){let n=!1;for(let i=0;i<1e3&&!n&&!t;i+=1)n=(await e.mutation(G.archiveImport.abandonImport,{importId:r.importId})).done}}catch{}})(),()=>{t=!0}},[e]),{state:t,exportChats:s,exportFolder:c,importArchive:l}}var h9=(0,q.createContext)(null);function Sre({children:e}){let t=xre(),n=kw(),r=(e,t)=>{let r=e instanceof Error?e.message:String(e);if(r.includes(`folder_too_large`)){n.error(Yf());return}if(r.includes(`already running`)){n.error(T());return}if(r.includes(`archive_too_large`)){n.error(Pl());return}if(r.includes(`not_a_zip`)||r.includes(`no manifest`)){n.error(fl());return}n.error(t,e)},i={state:t.state,exportChat:(e,i)=>{t.exportChats([e],i).then(({missingBlobs:e})=>{e.length>0?n.error(sv({count:e.length})):n.success(Im())}).catch(e=>r(e,ru()))},exportFolder:(e,i)=>{t.exportFolder(e,i).then(({missingBlobs:e})=>{e.length>0?n.error(sv({count:e.length})):n.success(Im())}).catch(e=>r(e,ru()))},importArchive:(e,i)=>{t.importArchive(e,i).then(({written:e,purged:t})=>{n.success(hg({count:e}),t?void 0:oy())}).catch(e=>r(e,Eo()))}},a={...i,pickAndImport:e=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.zip,application/zip`,t.addEventListener(`change`,()=>{let n=t.files?.[0];n!==void 0&&i.importArchive(n,e)}),t.click()}};return(0,J.jsx)(h9.Provider,{value:a,children:e})}function g9(){return(0,q.useContext)(h9)}function Cre(e){if(!e.running)return null;let t=e.progress;if(t===null)return Qd();switch(t.phase){case`sections`:return Py({count:t.done});case`blobs`:return qh({count:t.done});case`packing`:return Qd();case`reading`:return Fv({count:t.done});case`uploading`:return Ug({done:t.done,total:t.total??t.done});case`writing`:return rd({count:t.done})}}function wre(e,t){return e===null?t:`${e}-${t}`}var Tre=e=>{let{transform:t}=e;return{...t,y:0}};function Ere(e,t,n){let r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}var Dre=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:Ere(n,t,i)},Ore=e=>{let{transform:t}=e;return{...t,x:0}},_9=`project:none`,kre=e=>`project:${e}`,v9=`projhead:`,y9=e=>`${v9}${e}`,b9=`oc.noproject.collapsed`,x9=`oc.shared.collapsed`;function S9(){return(0,J.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,J.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}var C9=(0,q.createContext)(new Map);function Are({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=U(G.messages.listChats,{}),a=U(G.projects.listProjects,{}),o=U(G.me.getMe,{host:cT})?.ui?.effective?.showChatAge??!0,s=U(G.chatReads.myChatReads,{}),c=(0,q.useMemo)(()=>{let e=new Map;for(let t of s??[])e.set(t.chatId,t.lastSeenAt);return e},[s]),l=U(G.chatReads.myBusyChats,{}),d=(0,q.useMemo)(()=>new Set(l??[]),[l]),{byChat:f}=xS(l??null),p=U(G.agentRequests.pendingByChat,{}),m=(0,q.useMemo)(()=>{let e=new Map;for(let t of p??[])e.set(t.chatId,t.kinds.includes(`approval`)?`approval`:t.kinds.includes(`credential`)?`credential`:`question`);return e},[p]),h=U(G.chatBookmarks.myBookmarkedChats,{}),g=U(G.chatExport.referenceLabel,{}),_=(0,q.useMemo)(()=>new Set(h??[]),[h]),v=(0,q.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=c.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,c,e]),[y,b]=(0,q.useState)(0);(0,q.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>b(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let x=W(G.projects.createProject),S=W(G.projects.setProjectCollapsed),C=W(G.projects.setProjectSidebar),w=W(G.chats.reorderChat),T=W(G.projects.reorderProject),E=W(G.chats.moveChatToProject),D=uT(),O=gv(),k=(0,q.useRef)(null),A=(0,q.useRef)(null),j=(0,q.useRef)(null),[M,N]=(0,q.useState)(`full`);(0,q.useLayoutEffect)(()=>{let e=k.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=A.current?.offsetWidth??0,r=j.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;N(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[O,r]);let[P,F]=(0,q.useState)(null),I=(0,q.useRef)(!1);(0,q.useEffect)(()=>{!I.current&&i&&F(i)},[i]);let ee=P??i??[],L=ee.filter(e=>e.sidebarHidden!==!0),R=ee.filter(e=>e.sidebarHidden===!0),z=i===void 0&&P===null,[B,V]=(0,q.useState)(null),[te,ne]=(0,q.useState)(()=>localStorage.getItem(b9)===`1`),[re,ie]=(0,q.useState)(()=>localStorage.getItem(x9)===`1`);function ae(){ie(e=>(localStorage.setItem(x9,e?`0`:`1`),!e))}function oe(){ne(e=>(localStorage.setItem(b9,e?`0`:`1`),!e))}let se=M2();(0,q.useEffect)(()=>{if(!se?.expand)return;let e=L.find(e=>e._id===se.chatId);if(!e)return;let t=e.projectId??null;if(t===null){te&&(localStorage.setItem(b9,`0`),ne(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&S({projectId:t,collapsed:!1})},[se,L,a,te,S]);let ce=SS(FS(Uee,{activationConstraint:{distance:4}}),FS(Qee,{activationConstraint:{delay:250,tolerance:8}}),FS(DS,{coordinateGetter:TS})),le=(0,q.useRef)(!1),ue=()=>{le.current=!0,setTimeout(()=>{le.current=!1},0)},de=(0,q.useCallback)(e=>String(e.active.id).startsWith(v9)?IS({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(v9))}):IS(e),[]),fe=L.filter(e=>e.pinned),pe=L.filter(e=>!e.pinned&&e.role===`participant`),me=L.filter(e=>!e.pinned&&e.role!==`participant`),he=e=>me.filter(t=>(t.projectId??null)===e),ge=sS(),_e=(0,q.useMemo)(()=>Vee(a??[]),[a]),ve=(0,q.useMemo)(()=>_e.filter(e=>!e.sidebarHidden),[_e]),ye=(0,q.useMemo)(()=>_e.filter(e=>e.sidebarHidden),[_e]),be=(0,q.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,zee(e,t._id)]))},[a]),xe=(0,q.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),Se=e=>me.filter(t=>t.projectId!==null&&(be.get(t.projectId)??t.projectId)===e);function Ce(e){return L.find(t=>t._id===e)}async function we(e){V(null),ue();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(v9)){let e=r.slice(9),t=ve,n=null;if(i.startsWith(v9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==_9)n=i.slice(8);else{let e=Ce(i);n=e&&!e.pinned?e.projectId??null:null}if(n===null||n===e)return;let a=t.findIndex(t=>t._id===e),o=t.findIndex(e=>e._id===n);if(a<0||o<0)return;let s=[...t],[c]=s.splice(a,1);s.splice(o,0,c);let l=s[o-1]??null,u=s[o+1]??null;await T({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=Ce(r);if(!a||a.role===`participant`)return;if(i.startsWith(v9)){let e=i.slice(9);if((a.projectId??null)===e)return;I.current=!0,F(t=>(t??L).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await E({chatId:a._id,projectId:e})}finally{I.current=!1}return}if(i.startsWith(`project:`)){let e=i===_9?null:i.slice(8);if((a.projectId??null)===e)return;I.current=!0,F(t=>(t??L).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await E({chatId:a._id,projectId:e})}finally{I.current=!1}return}let o=Ce(i);if(!o||t.id===n.id)return;if((o.projectId??null)!==(a.projectId??null)||o.pinned!==a.pinned){if(a.pinned||o.pinned)return;I.current=!0,F(e=>(e??L).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await E({chatId:a._id,projectId:o.projectId??null})}finally{I.current=!1}return}let s=o.pinned?fe:he(o.projectId??null),c=s.map(e=>e._id),l=c.indexOf(a._id),u=c.indexOf(o._id);if(l<0||u<0)return;let d=[...s];d.splice(l,1),d.splice(u,0,a);let f=d[u-1]??null,p=d[u+1]??null;I.current=!0,F(e=>[...(e??L).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await w({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{I.current=!1}}let Te=g9(),Ee=Te?Cre(Te.state):null,[De,Oe]=(0,q.useState)(!1),ke=B?Ce(B):null;return(0,J.jsx)(C9.Provider,{value:m,children:(0,J.jsx)(mS.Provider,{value:f,children:(0,J.jsxs)(`aside`,{className:`oc-sidebar`+(De?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Oe(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Oe(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Oe(!1);let t=e.dataTransfer.files[0];t!==void 0&&Te?.importArchive(t,null)},children:[De?(0,J.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,J.jsx)(WC,{className:`size-4`}),(0,J.jsx)(`span`,{children:Tf()})]}):null,Ee===null?null:(0,J.jsxs)(`div`,{className:`oc-sidebar__transfer`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(`span`,{className:`oc-sidebar__transfer-spin`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-sidebar__transfer-label`,children:Ee})]}),(0,J.jsxs)(`div`,{className:`oc-sidebar__top`,ref:k,children:[(0,J.jsxs)(K,{className:M===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${O} (${r})`,"aria-label":O,children:[(0,J.jsx)(FC,{}),M===`icon`?null:(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:O}),M===`full`?(0,J.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,J.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,J.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:A,children:[(0,J.jsxs)(K,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,J.jsx)(FC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:O}),(0,J.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(hS,{})})]})}),(0,J.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,J.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:j,children:[(0,J.jsxs)(K,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,J.jsx)(FC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:O})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(hS,{})})]})}),(0,J.jsx)(K,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Cg(),title:Cg(),onClick:async()=>{let e=await D({title:Cg(),label:Ru(),placeholder:xm(),confirmLabel:U_()});e&&await x({name:e})},children:(0,J.jsx)(hS,{})})]}),(0,J.jsxs)(kS,{sensors:ce,collisionDetection:de,modifiers:[Ore,Dre],onDragStart:e=>V(String(e.active.id)),onDragCancel:()=>{V(null),ue()},onDragEnd:we,children:[(0,J.jsx)(`div`,{className:`oc-sidebar__scroll`,children:z?(0,J.jsx)(S9,{}):(0,J.jsxs)(J.Fragment,{children:[fe.length>0?(0,J.jsx)(w9,{label:Oee(),chats:fe,children:fe.map(n=>(0,J.jsx)(T9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:d.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:le,onSelect:t},n._id))}):null,(0,J.jsx)(PS,{items:ve.map(e=>y9(e._id)),strategy:jS,children:ve.map(n=>{let r=Se(n._id);return(0,J.jsx)(w9,{label:n.name,dropId:kre(n._id),sortId:y9(n._id),suppressClick:le,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>d.has(e._id)),unread:r.some(e=>v.has(e._id)),onToggle:()=>void S({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void ge({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,J.jsx)(`div`,{className:`oc-sidebar__empty`,children:Uv()}):r.map(r=>(0,J.jsx)(T9,{chat:r,active:r._id===e,unread:v.has(r._id),busy:d.has(r._id),bookmarked:_.has(r._id),referenceLabel:g,domainLabel:r.projectId!==null&&r.projectId!==n._id?xe.get(r.projectId)??null:null,ageTick:y,suppressClick:le,onSelect:t},r._id))},n._id)})}),ye.length>0?(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,children:[(0,J.jsx)(yC,{className:`size-3.5`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:Pr({count:ye.length})})]})}),(0,J.jsx)(cC,{align:`start`,className:`w-56`,children:ye.map(e=>(0,J.jsxs)(dC,{onSelect:()=>void C({projectId:e._id,hidden:!1}),children:[(0,J.jsx)(yS,{}),` `,e.name]},e._id))})]}):null,pe.length>0||R.length>0?(0,J.jsxs)(w9,{label:nh(),chats:pe,collapsible:!0,collapsed:re,busy:pe.some(e=>d.has(e._id)),unread:pe.some(e=>v.has(e._id)),onToggle:ae,children:[re?null:pe.map(n=>(0,J.jsx)(T9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:d.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:le,onSelect:t},n._id)),!re&&R.length>0?(0,J.jsx)(jre,{chats:R}):null]}):null,(0,J.jsx)(w9,{label:Mf(),dropId:_9,chats:he(null),collapsible:!0,collapsed:te,busy:he(null).some(e=>d.has(e._id)),unread:he(null).some(e=>v.has(e._id)),onToggle:oe,children:te?null:he(null).map(n=>(0,J.jsx)(T9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:d.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:le,onSelect:t},n._id))})]})}),(0,J.jsxs)(Kee,{children:[B?.startsWith(v9)?(()=>{let e=(a??[]).find(e=>y9(e._id)===B);return e?(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":AS(e)},children:[(0,J.jsx)(KS,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,J.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,ke?(0,J.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[wS(ke.color)?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:wS(ke.color)}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsx)(`span`,{className:`oc-chatitem__label`,children:ke.title||u()})]}):null]})]})]})})})}function w9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:l,unread:u,onToggle:f,onOpen:p,children:m}){let h=W(G.projects.setProjectSidebar),g=g9(),_=(0,q.useContext)(mS),v=o.map(e=>_.get(e._id)).find(e=>e!==void 0)??null,y=W(G.projects.deleteProject),b=W(G.projects.renameProject),x=W(G.projects.setProjectColor),S=W(G.projects.moveProject),C=lT(),w=RT(),[T,E]=(0,q.useState)(!1),[D,O]=(0,q.useState)(e),[k,A]=(0,q.useState)(!1),j=U(G.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:M,isOver:N}=Iee({id:t??`static:${e}`}),F=ES({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:I,...ee}=F.listeners??{},L=p??f,R=e=>{e.target===e.currentTarget&&s&&L&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),L())},z=a?AS(a):null;return(0,J.jsxs)(`div`,{ref:e=>{t&&M(e),n&&F.setNodeRef(e)},className:`oc-sidebar__group`+(N?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...z?{"--proj-hue":z}:{},...n?{transform:pS.Transform.toString(F.transform),transition:F.transition,opacity:F.isDragging?.35:1}:{}},children:[(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head group/head`+(s?` oc-sidebar__group-head--btn`:``),title:c&&l&&v?bS(v):void 0,...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||L?.()},onKeyDown:R}:{},...n?ee:{},children:[s?p?(0,J.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn`,"aria-label":c?P():sh(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&f?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,J.jsx)(JS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(KS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,J.jsx)(JS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(KS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):null,(0,J.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,J.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":ym(),onClick:e=>e.stopPropagation(),...F.attributes,onKeyDown:I,children:(0,J.jsx)(FA,{className:`size-3.5`})}):null,c&&l?(0,J.jsx)(`span`,{className:_S(v,po()).className,title:_S(v,po()).label,"aria-label":_S(v,po()).label}):null,c&&u?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:Gr(),"aria-label":Gr()}):null,i?(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":Qc(),className:`oc-sidebar__group-menu opacity-0 group-hover/head:opacity-100 group-focus-within/head:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(rC,{})})}),(0,J.jsxs)(cC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[p?(0,J.jsxs)(dC,{onSelect:()=>p(),children:[(0,J.jsx)(yS,{}),` `,pe()]}):null,(0,J.jsxs)(dC,{onSelect:()=>{O(e),E(!0)},children:[(0,J.jsx)(PC,{}),` `,rg()]}),(0,J.jsxs)(dC,{onSelect:()=>A(!0),children:[(0,J.jsx)(hS,{}),` `,qg()]}),a!==void 0&&a.parentId===null?(0,J.jsxs)(dC,{onSelect:()=>void h({projectId:a._id,hidden:!0}),children:[(0,J.jsx)(yC,{}),` `,wx()]}):null,g&&a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(dC,{disabled:g.state.running,onSelect:()=>g.exportFolder(a._id,e),children:[(0,J.jsx)(vC,{}),` `,p_()]}),(0,J.jsxs)(dC,{disabled:g.state.running,onSelect:()=>g.pickAndImport(a._id),children:[(0,J.jsx)(WC,{}),` `,yp()]})]}):null,(0,J.jsx)(aC,{children:d()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void x({projectId:i,color:null}),"aria-label":mo(),children:`✕`}),OS.map(e=>(0,J.jsx)(`button`,{className:`oc-colorgrid__dot`+(a?.color===e.value?` is-selected`:``),style:{background:e.hue},"aria-label":e.value,onClick:()=>void x({projectId:i,color:e.value})},e.value))]}),(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=j?.folders??0,n=j?.chats??0;await C({title:Ws({name:e}),description:zT({folders:t,chats:n,days:w}),confirmWord:Iu(),confirmLabel:jc(),destructive:!0})&&await y({projectId:i})})},children:[(0,J.jsx)(HC,{}),` `,Iu()]})]})]}):null]}),(0,J.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,J.jsx)(PS,{items:o.map(e=>e._id),strategy:jS,children:m})}),i?(0,J.jsx)(vT,{open:T,onOpenChange:E,title:Sl(),canSubmit:D.trim().length>0,onSubmit:async()=>{await b({projectId:i,name:D.trim()}),E(!1)},children:(0,J.jsx)(`div`,{className:`oc-form`,children:(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Xp()}),(0,J.jsx)(vw,{value:D,onChange:e=>O(e.target.value),autoFocus:!0})]})})}):null,i&&k?(0,J.jsx)(NS,{open:k,onOpenChange:A,title:rf(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void S({projectId:i,parentId:e})}):null]})}var T9=(0,q.memo)(function({chat:e,active:t,unread:n,busy:r,bookmarked:i,referenceLabel:a,domainLabel:o,suppressClick:s,onSelect:c}){let l=(0,q.useContext)(C9).get(e._id),f=(0,q.useContext)(mS).get(e._id)??null,p=g9(),{attributes:m,listeners:h,setNodeRef:g,transform:_,transition:v,isDragging:y}=ES({id:e._id}),{onKeyDown:b,...x}=h??{},S=W(G.chats.renameChat),C=kw(),w=()=>{if(a===void 0)return;let t=wre(a,e._id);navigator.clipboard.writeText(t).then(()=>C.success(Pee({reference:t})),()=>C.error(Zv()))},T=W(G.chats.deleteChat),E=W(G.chats.pinChat),D=W(G.chats.setChatColor),O=W(G.chats.moveChatToProject),k=W(G.chats.setChatSidebar),A=W(G.chatParticipants.leaveChat),j=e.role===`participant`,M=sS(),[N,P]=(0,q.useState)(!1),F=U(G.me.getMe,{host:cT})?.ui?.effective?.showChatAge??!0,I=lT(),ee=RT(),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(e.title??``),V=M2()?.chatId===e._id,te=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!V)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;te.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>j2(e._id),2600);return()=>clearTimeout(n)},[V,e._id]);let ne={transform:pS.Transform.toString(_),transition:v,opacity:+!y},re=wS(e.color);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{ref:e=>{g(e),te.current=e},style:ne,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(V?` oc-chatitem--flash`:``),title:r&&f?bS(f):void 0,onClick:()=>{s.current||c(e._id)},...x,onAnimationEnd:t=>{V&&t.animationName===`oc-chatitem-flash`&&j2(e._id)},children:[(0,J.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":ym(),onClick:e=>e.stopPropagation(),...m,onKeyDown:b,children:(0,J.jsx)(FA,{className:`size-3.5`})}),re?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:re}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsxs)(`button`,{className:`oc-chatitem__label`,onClick:t=>{t.stopPropagation(),!s.current&&c(e._id)},children:[(0,J.jsxs)(`span`,{className:`oc-chatitem__title`,children:[e.group?(0,J.jsx)(VC,{className:`oc-chatitem__group`,size:12,"aria-label":ht()}):null,e.title||u()]}),e.role===`participant`&&e.ownerName?(0,J.jsx)(`span`,{className:`oc-chatitem__domain`,children:Ia({name:e.ownerName})}):o?(0,J.jsx)(`span`,{className:`oc-chatitem__domain`,children:o}):null]}),l===void 0?null:(0,J.jsx)(`span`,{className:`oc-areq-sidebadge oc-areq-sidebadge--${l}`,title:Vh(),"aria-label":Vh(),children:l===`approval`?(0,J.jsx)(RC,{size:11,"aria-hidden":!0}):l===`credential`?(0,J.jsx)(HA,{size:11,"aria-hidden":!0}):(0,J.jsx)(QA,{size:11,"aria-hidden":!0})}),r?(0,J.jsx)(`span`,{className:_S(f,Wl()).className,title:_S(f,Wl()).label,"aria-label":_S(f,Wl()).label}):null,n?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:Gr(),"aria-label":Gr()}):null,e.readOnly?(0,J.jsx)(`span`,{className:`oc-chatitem__readonly`,title:dn(),children:(0,J.jsx)(DC,{size:12,"aria-label":dn()})}):null,i?(0,J.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Ku(),children:(0,J.jsx)(mA,{size:12,"aria-label":Ku()})}):null,F?(0,J.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Uw(e.updatedAt),children:Yee(e.updatedAt,Date.now())}):null,(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":V_(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(rC,{})})}),(0,J.jsxs)(cC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[j?null:(0,J.jsxs)(dC,{onSelect:()=>{B(e.title??``),R(!0)},children:[(0,J.jsx)(PC,{}),` `,rg()]}),p&&!j?(0,J.jsxs)(dC,{disabled:p.state.running,onSelect:()=>p.exportChat(e._id,e.title??Mf()),children:[(0,J.jsx)(vC,{}),` `,xee()]}):null,(0,J.jsxs)(dC,{onSelect:()=>void E({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,J.jsx)(LS,{}):(0,J.jsx)(fS,{}),e.pinned?Bv():kf()]}),j?null:(0,J.jsx)(lre,{chatId:e._id}),j?null:(0,J.jsxs)(dC,{onSelect:w,disabled:a===void 0,children:[(0,J.jsx)(GA,{}),` `,Z_()]}),j?null:(0,J.jsxs)(dC,{onSelect:()=>P(!0),children:[(0,J.jsx)(yS,{}),` `,Qh()]}),e.projectId===null?null:(0,J.jsxs)(dC,{onSelect:()=>void M({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,J.jsx)(MA,{}),` `,$i()]}),e.pinned?null:(0,J.jsxs)(dC,{onSelect:()=>void k({chatId:e._id,hidden:!0}),children:[(0,J.jsx)(CS,{}),` `,wx()]}),j?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{variant:`destructive`,onSelect:()=>void A({chatId:e._id}),children:[(0,J.jsx)(YA,{}),` `,Rx()]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aC,{children:d()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void D({chatId:e._id,color:null}),"aria-label":mo(),children:`✕`}),OS.map(t=>(0,J.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void D({chatId:e._id,color:t.value})},t.value))]}),(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await I({title:Gl(),description:$c({days:ee}),confirmLabel:Iu(),destructive:!0})&&await T({chatId:e._id})})},children:[(0,J.jsx)(HC,{}),` `,Iu()]})]})]})]})]}),(0,J.jsx)(vT,{open:L,onOpenChange:R,title:Tp(),canSubmit:z.trim().length>0,onSubmit:async()=>{await S({chatId:e._id,title:z.trim()}),R(!1)},children:(0,J.jsx)(`div`,{className:`oc-form`,children:(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Xp()}),(0,J.jsx)(vw,{value:z,onChange:e=>B(e.target.value),autoFocus:!0})]})})}),N?(0,J.jsx)(NS,{open:N,onOpenChange:P,title:$f(),currentId:e.projectId,onPick:t=>void O({chatId:e._id,projectId:t})}):null]})});function jre({chats:e}){let[t,n]=(0,q.useState)(!1),r=W(G.chats.setChatSidebar);return(0,J.jsxs)(`div`,{className:`oc-hiddenshared`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-hiddenshared__toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,J.jsx)(KS,{size:12,"aria-hidden":!0}):(0,J.jsx)(JS,{size:12,"aria-hidden":!0}),se({count:e.length})]}),t?(0,J.jsx)(`ul`,{className:`oc-hiddenshared__list`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`oc-hiddenshared__row`,children:[(0,J.jsx)(`span`,{className:`oc-hiddenshared__title`,children:e.title??Mf()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-hiddenshared__show`,onClick:()=>void r({chatId:e._id,hidden:!1}),children:Ch()})]},e._id))}):null]})}var E9=null,D9=0,Mre=400;function Nre(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!E9)try{E9=new e}catch{return null}return E9}function O9(e,t,n,r,i){let a=e.createOscillator(),o=e.createGain();a.type=`sine`,a.frequency.value=t;let s=e.currentTime+n;o.gain.setValueAtTime(1e-4,s),o.gain.linearRampToValueAtTime(i,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,s+r),a.connect(o).connect(e.destination),a.start(s),a.stop(s+r+.02)}function k9(e){let t=Date.now();if(t-D9<Mre)return;let n=Nre();if(!n)return;D9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function Pre(){k9(e=>{O9(e,660,0,.16,.12),O9(e,440,.14,.2,.1)})}function Fre(){k9(e=>{O9(e,880,0,.14,.08)})}function Ire({activeChatId:e}){let t=U(G.messages.listChats,{}),n=W(G.chatReads.markChatSeen),r=U(G.me.getMe,{host:cT}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,q.useRef)(null),s=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!t)return;s.current!==String(a)&&(s.current=String(a),o.current=null);let r=new Map;for(let e of t)e.lastAssistantAt!==null&&r.set(e._id,e.lastAssistantAt);let c=o.current;if(o.current=r,c===null)return;let l=!1;for(let[t,i]of r){let r=c.get(t);r!==void 0&&i<=r||r===void 0&&Date.now()-i>3e4||(l=!0,t===e&&document.visibilityState===`visible`?n({chatId:t}):t!==e&&A2(t))}l&&i&&Fre()},[t,e,i,n,a]),(0,q.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,q.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}var A9=[`admin`,`user`,`pending`];function j9(){let e=U(G.me.authProviders)?.anonymous===!0,[t,n]=(0,q.useState)(!1),r=U(G.dev.listUsersDev,e?{}:`skip`),i=U(G.me.getImpersonation),a=W(G.dev.setMyRole),o=W(G.dev.setRole),s=W(G.admin.startImpersonation),c=W(G.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:Mb(),children:[(0,J.jsx)(Tj,{size:13}),`DEV`]}),(0,J.jsx)(Xw,{open:t,onOpenChange:n,children:(0,J.jsxs)(qw,{children:[(0,J.jsxs)(Gw,{children:[(0,J.jsx)(Jw,{children:ud()}),(0,J.jsx)(Yw,{children:tx()})]}),(0,J.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,J.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[Hy({canonical:l?.canonical??`…`}),` `,(0,J.jsx)(jw,{variant:`outline`,children:l?.role??`…`})]}),(0,J.jsx)(`div`,{className:`oc-devsw__roles`,children:A9.map(e=>(0,J.jsx)(K,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?mu():e===`user`?Op():Qp()},e))})]}),d?(0,J.jsxs)(`div`,{className:`oc-devsw__imp`,children:[oee(),` `,(0,J.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,J.jsx)(K,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Zg()})]}):null,(0,J.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,J.jsx)(`p`,{className:`oc-devsw__empty`,children:rp()}):f.map(e=>(0,J.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,J.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,J.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:A9.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))}),(0,J.jsx)(K,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?gy():Ah():cf(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:Pd()})]},e.profileId))})]})})]})}var M9=`atrium.authelia-login`;function Lre(e){let t=new URL(e.href);if(t.origin!==e.origin)throw Error(`Invalid login return origin.`);for(let e of[`code`,`state`,`error`,`error_description`])t.searchParams.delete(e);return`${t.pathname}${t.search}${t.hash}`}function Rre(e,t){let n;return{start(r,i=!1){if(n)return n;try{let t=e.getItem(M9);if(!i&&t!==null)return Promise.resolve(t===`signed-out`?`signed-out`:`failed`);e.setItem(M9,`attempted`)}catch{return Promise.resolve(`failed`)}return n=(async()=>{try{let e=await r(`authelia`,{redirectTo:t()});return e.redirect||e.signingIn?`redirecting`:`failed`}catch{return`failed`}})().finally(()=>{n=void 0}),n},signedOut(){try{e.setItem(M9,`signed-out`)}catch{}},authenticated(){try{e.removeItem(M9)}catch{}}}}var N9;function P9(){return N9??=Rre({getItem:e=>window.sessionStorage.getItem(e),setItem:(e,t)=>window.sessionStorage.setItem(e,t),removeItem:e=>window.sessionStorage.removeItem(e)},()=>Lre(window.location)),N9}function F9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=IE();async function i(){P9().signedOut(),await r()}let a=W(G.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(G.me.getMe,{host:cT});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(G.me.getMe,{host:cT},{...n,themeMode:t,resolvedThemeMode:r})}),o=t??`default`;return(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsxs)(K,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,J.jsx)(KS,{className:`opacity-60`})]})}),(0,J.jsx)(cC,{align:`end`,className:`w-52`,children:n?(0,J.jsxs)(dC,{onClick:()=>void i(),children:[(0,J.jsx)(YA,{}),` `,Xa()]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aC,{children:Ax()}),(0,J.jsxs)($S,{value:o,onValueChange:e=>void a({mode:e==="default"?null:e}),children:[(0,J.jsxs)(lC,{value:`light`,children:[(0,J.jsx)(xj,{}),` `,Bo()]}),(0,J.jsxs)(lC,{value:`dark`,children:[(0,J.jsx)(nj,{}),` `,_i()]}),(0,J.jsxs)(lC,{value:`system`,children:[(0,J.jsx)(tj,{}),` `,rr()]}),(0,J.jsx)(lC,{value:`default`,children:Jt()})]}),(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{onClick:()=>void i(),children:[(0,J.jsx)(YA,{}),` `,Xa()]})]})})]})}function zre({providers:e,children:t}){return e===void 0?(0,J.jsx)(`div`,{className:`oc-boot`,children:Hb()}):e.autheliaOnly?(0,J.jsx)(Vre,{enabled:e.authelia}):t}function Bre({state:e,retry:t}){return(0,J.jsx)(`div`,{className:`oc-signin`,children:(0,J.jsxs)(`div`,{className:`oc-signin__card`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(`p`,{className:`oc-signin__subtitle`,children:e===`redirecting`?lm():e===`signed-out`?hee():e===`unavailable`?bf():c_()}),e===`failed`||e===`signed-out`?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider`,onClick:t,children:Bp()}):null]})})}function Vre({enabled:e}){let{signIn:t}=IE(),[n,r]=(0,q.useState)(e?`redirecting`:`unavailable`);return(0,q.useEffect)(()=>{let n=!0;return e?P9().start(t).then(e=>{n&&r(e)}):r(`unavailable`),()=>{n=!1}},[e,t]),(0,J.jsx)(Bre,{state:n,retry:()=>{r(`redirecting`),P9().start(t,!0).then(r)}})}var Hre={altered_words:()=>ip(),incorrect:()=>lf(),incoherence:()=>_y(),formatting:()=>jh(),latency:()=>Fd(),api_error:()=>_v(),other:()=>wg()},I9=e=>Hre[e]?.()??e,Ure={anomaly_open:UC,anomaly_resolved:XS,feedback_reply:gS,feedback_resolved:gS,feedback_new:gS,curation:OA,operator_announcement:ZA,mention:dA,agent_request:QA,chat_added:VC,group_invite:zC},Wre={atrium:()=>Dd(),assistants:()=>yx(),platform:()=>ob()},Gre={investigating:()=>Nu(),monitoring:()=>Kp(),resolved:()=>gm()},L9=e=>(e?Wre[e]:void 0)?.()??`?`,Kre=e=>(e?Gre[e]:void 0)?.()??`?`,R9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(Ln()):`?`},qre={notif_feedback_reply_admin:()=>({title:kp(),body:$p()}),notif_feedback_reply:()=>({title:kp(),body:$p()}),notif_feedback_resolved:()=>({title:k_(),body:ei()}),notif_feedback_new:e=>({title:see(),body:Qg({reference:e.reference??`?`,category:I9(e.category??`other`)})}),notif_mention:e=>({title:De(),body:qi({chat:e.chat??``})}),notif_chat_added:e=>({title:zx({by:e.by??`?`}),body:qi({chat:e.chat??``})}),notif_group_invite_request:e=>({title:Yo(),body:Di({by:e.by??`?`,group:e.group??`?`})}),notif_group_invite_approved:e=>({title:pr(),body:nn({email:e.email??`?`,group:e.group??`?`})}),notif_group_invite_rejected:e=>({title:io(),body:ma({email:e.email??`?`,group:e.group??`?`})}),notif_agent_request_question:e=>({title:Kd(),body:Yu({chat:e.chat??``})}),notif_agent_request_approval:e=>({title:Ov(),body:Yu({chat:e.chat??``})}),notif_agent_request_credential:e=>({title:Ig(),body:Yu({chat:e.chat??``})}),notif_curation_proposed:e=>({title:Kc(),body:ic({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:Kn(),body:wc({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:ke(),body:Vx({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Zo({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:ki({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:La(),body:gt({service:L9(e.service),startsAt:R9(e.starts_at),endsAt:R9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:Ft(),body:Rs({service:L9(e.service),completedAt:R9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Tb(),body:Je({service:L9(e.service),status:Kre(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:_s(),body:Jb({plan:e.plan??`?`,effectiveAt:R9(e.effective_at)})})};function z9(e){let t=e.messageKey?qre[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:kp(),body:$p()}:e.kind===`feedback_resolved`?{title:k_(),body:ei()}:{title:e.title,body:e.body}}function Jre(){let e=U(G.notifications.myUnreadCount)??0,t=U(G.notifications.myNotifications),n=U(G.feedback.myFeedback),r=W(G.notifications.markRead),i=W(G.notifications.markAllRead),a=W(G.notifications.clearOne),o=W(G.notifications.clearAll),s=W(G.feedback.closeMyFeedback),c=sS(),[l,u]=(0,q.useState)(!1),d=U(G.me.getMe,{host:cT}),f=d?.ui?.effective?.notifSound===!0,p=d?.ui?.effective?.notifSystem===!0,m=d?.userId??null,h=(0,q.useRef)(null),g=(0,q.useRef)(0),_=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!t)return;_.current!==String(m)&&(_.current=String(m),h.current=null,g.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(h.current===null){h.current=new Set(t.map(e=>String(e._id))),g.current=e;return}let n=h.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>g.current);for(let e of t)n.add(String(e._id));if(g.current=Math.max(g.current,e),n.size>500){let e=new Set(t.map(e=>String(e._id)));for(let t of n)e.has(t)||n.delete(t)}if(r.length!==0&&(f&&Pre(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=z9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,f,p,m]);let v=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(u(!1),e.href.startsWith(`/chat/`)){c({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);c({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,J.jsxs)(pC,{open:l,onOpenChange:u,children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?Wt({count:e}):Ka(),children:[(0,J.jsx)(fA,{size:18,"aria-hidden":!0}),e>0?(0,J.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,J.jsxs)(cC,{align:`end`,className:`oc-notif`,children:[(0,J.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,J.jsx)(`span`,{children:ra()}),t&&t.length>0?(0,J.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:Li()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Km()})]}):null]}),t===void 0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:ye()}):t.length===0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:R()}):(0,J.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=Ure[e.kind]??fA,{title:n,body:i}=z9(e);return(0,J.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>v(e):void 0,children:[(0,J.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,J.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,J.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,J.jsx)(`button`,{type:`button`,title:fh(),"aria-label":fh(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,J.jsx)(GS,{size:13})}):null,(0,J.jsx)(`button`,{type:`button`,title:Ta(),"aria-label":Ta(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,J.jsx)(qC,{size:13})})]})]}),(0,J.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,J.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(Ln())})]},e._id)})}),n&&n.length>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:it()}),(0,J.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,J.jsx)(Yre,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function Yre({it:e,onClose:t,onNavigate:n}){let r=kw(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(dd(),e)}finally{d(!1)}}return(0,J.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,J.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,J.jsx)(`span`,{className:`oc-notif__title`,children:I9(e.category)}),(0,J.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?sl():e.answered?wt():Es()})]}),(0,J.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(Ln())}),e.thread.length>0?(0,J.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?pb():e.authorRole===`agent`?xo():Ie()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,J.jsx)(KS,{size:13,"aria-hidden":!0}):(0,J.jsx)(JS,{size:13,"aria-hidden":!0}),Nb()]}),i?(0,J.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,J.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,J.jsx)(Lk,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:is()}),o?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:dd()})]}),o?(0,J.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,J.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:nx()}),(0,J.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:Uy()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:hu()})]})]}):null]})}var B9=2,Xre=180;function Zre(){let e=sS(),t=(0,q.useRef)(null),n=(0,q.useRef)(null),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)(0),f=(0,q.useMemo)(()=>xw(Dw,bw()),[]);(0,q.useEffect)(()=>{let e=setTimeout(()=>c(a),Xre);return()=>clearTimeout(e)},[a]);let p=s.trim(),m=U(G.search.searchConversations,p.length>=B9?{query:p}:`skip`),h=m??[],g=p.length>=B9&&m===void 0;(0,q.useEffect)(()=>{let e=e=>{Cw(e,Dw)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,q.useEffect)(()=>{r&&(o(``),c(``),d(0))},[r]),(0,q.useEffect)(()=>{d(0)},[m]),(0,q.useEffect)(()=>{(n.current?.querySelector(`[data-index="${u}"]`))?.scrollIntoView({block:`nearest`})},[u]);let _=(0,q.useCallback)((t,n)=>{i(!1),n&&a.trim()&&Lee(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":Xf(),children:[(0,J.jsx)(gC,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-search-trigger__label`,children:l()}),(0,J.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:f})]}),(0,J.jsx)(Xw,{open:r,onOpenChange:i,children:(0,J.jsxs)(qw,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,J.jsx)(Jw,{className:`sr-only`,children:fo()}),(0,J.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,J.jsx)(gC,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,J.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),d(e=>Math.min(e+1,h.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),d(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=h[u];t&&_(t.chatId,t.messageId)}},placeholder:Ul(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":Zc()})]}),(0,J.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:p.length<B9?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:xl({count:B9})}):g?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:br()}):h.length===0?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:y_({term:p})}):h.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===u,className:z_(`oc-search-result`,t===u&&`is-active`),onMouseMove:()=>d(t),onClick:()=>_(e.chatId,e.messageId),children:[(0,J.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,J.jsx)(IA,{size:15}):(0,J.jsx)(gS,{size:15})}),(0,J.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,J.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||Wr()}),e.projectPath&&e.projectPath.length>0?(0,J.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":Yp(),children:e.projectPath.join(` › `)}):null,e.snippet?(0,J.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,J.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?un():Ac()})]},e.chatId))}),(0,J.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↑`}),(0,J.jsx)(`kbd`,{children:`↓`}),` `,Us()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↵`}),` `,jn()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:lc()}),` `,fe()]})]})]})})]})}var V9=[{id:`personal`,label:()=>Ly(),tabs:[`preferences`,`theme`,`files`,`scheduled`,`deletedChats`]},{id:`agents`,label:()=>Xh(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>tf(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`,`trash`]},{id:`observability`,label:()=>Rv(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],Qre=new Map(V9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function H9(e){let t=Qre.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function $re(e,t){return e.find(e=>H9(e)===t)}V9.flatMap(e=>[...e.tabs]);function eie(){let e=U(G.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.gatewaysUnreachable??0,n=e.known?e.available?t>0?`warn`:`ok`:`error`:`idle`,r=e.known?e.available?t>0?px({count:t}):`${Yh()}${e.checkedAt?ef({time:Vw(e.checkedAt)}):``}`:Lv({reason:e.reason??`?`}):Iy();return(0,J.jsx)(XC,{delayDuration:150,children:(0,J.jsxs)(ZC,{children:[(0,J.jsx)(JC,{asChild:!0,children:(0,J.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,J.jsx)(YC,{children:r})]})})}function U9(e){let t=new Set(HT),n=new Set,r=[];for(let i of e??[])t.has(i)&&!n.has(i)&&(r.push(i),n.add(i));for(let e of HT)n.has(e)||r.push(e);return r}function tie(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function nie({tab:e,active:t}){let n=BT[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,J.jsx)(eie,{}):null]});return WT.includes(e)?(0,J.jsx)(Lk,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,J.jsx)(Lk,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function rie({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=ES({id:e});return(0,J.jsxs)(`div`,{ref:i,style:{transform:pS.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":wee(),...n,...r,children:(0,J.jsx)(FA,{size:14,"aria-hidden":!0})}),(0,J.jsx)(nie,{tab:e,active:t})]})}function iie(){let e=U(G.me.getMe,{host:cT}),t=W(G.me.setSettingsTabOrder),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:H9(n),i=(0,q.useMemo)(()=>U9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,q.useState)(i);(0,q.useEffect)(()=>o(i),[i]);let s=(0,q.useMemo)(()=>new Set(UT(e?.permissions??[])),[e?.permissions]),c=(0,q.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&H9(e)===r),[a,s,r]),l=SS(FS(Zee,{activationConstraint:{distance:5}}),FS(DS,{coordinateGetter:TS}));if(r===void 0||c.length===0)return null;let u=V9.find(e=>e.id===r);function d(e){let{active:n,over:r}=e;if(!r||n.id===r.id)return;let i=c.indexOf(n.id),s=c.indexOf(r.id);if(i<0||s<0)return;let l=tie(a,Gee(c,i,s));o(l),t({order:l})}return(0,J.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,J.jsx)(kS,{sensors:l,collisionDetection:Wee,modifiers:[Tre],onDragEnd:d,children:(0,J.jsx)(PS,{items:c,strategy:Jee,children:c.map(e=>(0,J.jsx)(rie,{tab:e,active:e===n},e))})})})}function aie(){let e=U(G.me.getMe,{host:cT}),t=sS(),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:H9(n),i=(0,q.useMemo)(()=>new Set(UT(e?.permissions??[])),[e?.permissions]),a=(0,q.useMemo)(()=>U9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=V9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=$re(a,e.id);n&&t({to:KT(n)})}return(0,J.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":g_(),children:[(0,J.jsx)(Lk,{to:`/`,className:`oc-settings-nav__back`,children:xp()}),(0,J.jsx)(`div`,{className:`oc-settings-nav__title`,children:Df()}),(0,J.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,J.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var oie=`trash`,sie=`deletedChats`;function cie(){throw ID({to:`/settings/$tab`,params:{tab:sie},replace:!0})}var W9=`oc.theme`;function G9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function K9(e){(0,q.useEffect)(()=>{let t=e??localStorage.getItem(W9)??`system`;if(localStorage.setItem(W9,t),G9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>G9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function lie(e){(0,q.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=Ln()}catch{t=void 0}t!==e&&Xs(e)},[e])}var uie=(0,q.lazy)(()=>Bw(()=>import(`./RolesTab-DU0g4d-R.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))),die=(0,q.lazy)(()=>Bw(()=>import(`./InstancesTab-BevtM68H.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([23,3,4,24,25,26,7,27,28,8,29,9,30,31,6,32,33,10,11,12,13,14,15,19,18,16,17,20,21,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]))),fie=(0,q.lazy)(()=>Bw(()=>import(`./PromptInjectionsTab-Vdb1lF36.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([57,3,4,24,25,26,7,27,28,8,29,9,30,31,6,10,13,14,50,58,59]))),pie=(0,q.lazy)(()=>Bw(()=>import(`./GroupsTab-Io16XZHz.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([60,3,4,61,44,6,7,8,9,46,62,63,14,26,27,28,29,48,38,10,11,12,13,15,19,18,50,16,17,20,21,34,51,52,53,54,33,49,35,36,37,39,40,41,64]))),mie=(0,q.lazy)(()=>Bw(()=>import(`./IntegrationsTab-DMY6VTUC.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([65,3,4,6,7,8,9,26,27,28,29,10,11,12,15]))),hie=(0,q.lazy)(()=>Bw(()=>import(`./FeedbacksTab-6URuFdfg.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([66,3,4,10,12,49,16,17,18,11,19,14,35,27,28,36,37,29,9,38,6,7,8,39,40,41]))),gie=(0,q.lazy)(()=>Bw(()=>import(`./SubAgentReportsTab-D9rclslo.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([67,3,4,10,12,49,16,17,18,11,19,14,35,27,28,36,37,29,9,38,6,7,8,39,40,41]))),_ie=(0,q.lazy)(()=>Bw(()=>import(`./TrashTab-BMSJ7ANC.js`).then(e=>({default:e.TrashTab})),__vite__mapDeps([68,3,4,69,40,10,12,13,14,49,16,17,18,11,19,70,71,72,53,73]))),vie=(0,q.lazy)(()=>Bw(()=>import(`./DeletedChatsTab-COYSFkNf.js`).then(e=>({default:e.DeletedChatsTab})),__vite__mapDeps([74,3,4,69,10,12,16,17,18,11,19,14,71,72,53,40,49,73]))),yie=(0,q.lazy)(()=>Bw(()=>import(`./FilesTab-esMtHJXt.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([75,3,4,37,27,29,9,38,76,6,7,8,53,40,26,28,17,18,10,12,13,14,15,41]))),bie=(0,q.lazy)(()=>Bw(()=>import(`./ScheduledTab-B6gWc0HN.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([77,3,4,61,44,78,21,79,80,53,40,26,7,27,28,8,29,9,17,18,10,32,33,11,12,13,14,15,19,50,41,51,52,54,49,81,36,59]))),xie=(0,q.lazy)(()=>Bw(()=>import(`./AgentFilesTab-C3CUT4Ep.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([82,3,4,47,26,7,27,28,8,29,9,17,18,10,12,13,14,15,19,50,83,31,55,59]))),Sie=(0,q.lazy)(()=>Bw(()=>import(`./PreferencesTab-DJ9p401L.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([84,3,4,6,7,8,9,26,27,28,29,10,11,12,85,50,13,14,15,58,30,81,36,32,33,59]))),Cie=(0,q.lazy)(()=>Bw(()=>import(`./ChatDefaultsTab-D0d9yEow.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([86,3,4,69,6,7,8,9,47,26,27,28,29,10,11,12,87,21,53,83,55,59]))),wie=(0,q.lazy)(()=>Bw(()=>import(`./AccessTab-JmFp20Kp.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([88,3,4,26,7,27,28,8,29,9,12,15]))),Tie=(0,q.lazy)(()=>Bw(()=>import(`./ThemeShowroom-N4qzUtlq.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([89,3,4,7,37,27,29,9,38,76,6,8,90,14,26,28,10,11,12,15,50,58,30,91,41,54,52,33,49,51,53,92,39])));function Eie(){let{isAuthenticated:e}=iE();return(0,q.useEffect)(()=>{e&&P9().authenticated()},[e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(uE,{children:(0,J.jsx)(`div`,{className:`oc-boot`,children:Hb()})}),(0,J.jsx)(lE,{children:(0,J.jsx)(Oie,{})}),(0,J.jsx)(cE,{children:(0,J.jsx)(Aw,{children:(0,J.jsx)(Sre,{children:(0,J.jsx)(Aie,{})})})})]})}function Die(){return(0,J.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,J.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,J.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,J.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,J.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function Oie(){let{signIn:e}=IE();K9(void 0),ww(void 0);let t=U(G.charts.brandForHost,{host:cT}),n=oT(cT),r=t??n??null,i=GC(void 0);KC(r?.tokens??null,i),(0,q.useEffect)(()=>{t&&sT(cT,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?I0(a,i):null,s=a?.label??`Atrium`,c=U(G.me.authProviders),[l,u]=(0,q.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(xd())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.authelia&&!c.anonymous;return(0,J.jsx)(zre,{providers:c,children:(0,J.jsxs)(`div`,{className:`oc-signin`,children:[(0,J.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,J.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,J.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,J.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,J.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,J.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,J.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,J.jsx)(`h1`,{className:`oc-signin__title`,children:fx()}),(0,J.jsx)(`p`,{className:`oc-signin__subtitle`,children:$y()}),(0,J.jsxs)(`div`,{className:`oc-signin__providers`,children:[c?.google?(0,J.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,J.jsx)(Die,{}),(0,J.jsx)(`span`,{children:Eu()})]}):null,c?.microsoft?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider oc-provider--microsoft`,onClick:()=>void d(`microsoft-entra-id`),children:(0,J.jsx)(`span`,{children:mp()})}):null,c?.authelia?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider oc-provider--authelia`,onClick:()=>void d(`authelia`),children:(0,J.jsx)(`span`,{children:Bp()})}):null]}),l?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:bf()}):null,c?.anonymous?(0,J.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:ky()}):null]})]})})}function kie(){let{width:e,collapsed:t,isMobile:n}=V$();return(0,J.jsxs)(`div`,{className:`oc-shell`,children:[(0,J.jsxs)(`header`,{className:`oc-topbar`,children:[(0,J.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,J.jsx)(`div`,{className:`oc-topbar__search`,children:(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,J.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,J.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,J.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,J.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,J.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,J.jsx)(S9,{})]})}):null,(0,J.jsx)(`main`,{className:`oc-main`})]})]})}function Aie(){let e=U(G.me.getMe,{host:cT}),t=W(G.me.bootstrap),n=sS();(0,q.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),K9(e?.resolvedThemeMode),ww(e?.resolvedFontScale);let r=GC(e?.resolvedThemeMode);KC(e?.resolvedChartTokens,r),lie(e?.resolvedLocale);let i=(0,q.useRef)(null);if((0,q.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,J.jsx)(kie,{});let a=e.name||e.email||Hh();return e.role===`pending`?(0,J.jsxs)(`div`,{className:`oc-shell`,children:[(0,J.jsx)(q9,{}),(0,J.jsx)(j9,{}),(0,J.jsxs)(`header`,{className:`oc-topbar`,children:[(0,J.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,J.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,J.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,J.jsx)(F9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,J.jsxs)(`div`,{className:`oc-pending`,children:[(0,J.jsx)(`h1`,{className:`oc-pending__title`,children:qd()}),(0,J.jsx)(`p`,{className:`oc-pending__body`,children:kv()})]})]}):(0,J.jsx)(Mie,{canOpenSettings:UT(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=U(G.me.getImpersonation),t=W(G.admin.stopImpersonation);return!e||!e.impersonating?null:(0,J.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,J.jsx)(bC,{className:`size-4 shrink-0`}),(0,J.jsxs)(`span`,{className:`oc-imp__text`,children:[Lg(),` `,(0,J.jsx)(`strong`,{children:e.targetLabel}),Xu(),(0,J.jsx)(`strong`,{children:e.realLabel}),Am()]}),(0,J.jsx)(K,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:tv()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=GC(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=I0(e,n),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>s(!1),[a]),(0,J.jsxs)(J.Fragment,{children:[a!==null&&!o?(0,J.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,J.jsx)(B0,{className:`oc-brand__logo`}):null,(0,J.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function jie({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,J.jsxs)(`header`,{className:`oc-topbar`,children:[(0,J.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,J.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":i?cg():ty(),onClick:a,children:i?(0,J.jsx)(aj,{}):(0,J.jsx)(CS,{})}),(0,J.jsx)(Lk,{to:`/`,className:`oc-topbar__brand`,children:(0,J.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,J.jsx)(`div`,{className:`oc-topbar__search`,children:(0,J.jsx)(Zre,{})}),(0,J.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,J.jsx)(Jre,{}),(0,J.jsx)(F9,{label:e,mode:t})]})]})}function Mie({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:c,collapsed:l,toggleCollapsed:u,collapse:d,startResize:f,isMobile:p}=V$(),m=nA(),h=vS({strict:!1}),g=sS(),_=!!m({to:`/settings`,fuzzy:!0});(0,q.useEffect)(()=>{p&&d()},[cA({select:e=>e.pathname}),p,d]);let v=(0,q.useCallback)(e=>{g({to:`/chat/$chatId`,params:{chatId:e}})},[g]),{startNewChat:y,picker:b}=Xee(v),x=(0,q.useMemo)(()=>xw(Tw,bw()),[]);return(0,q.useEffect)(()=>{let e=e=>{Cw(e,Tw)&&(e.preventDefault(),y())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,J.jsxs)(`div`,{className:`oc-shell`,children:[b,(0,J.jsx)(Ire,{activeChatId:h.chatId??null}),(0,J.jsx)(q9,{}),(0,J.jsx)(j9,{}),(0,J.jsx)(jie,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,collapsed:l,onToggleSidebar:u}),(0,J.jsxs)(`div`,{className:p?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[p&&!l?(0,J.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:d,"aria-hidden":!0}):null,l?null:(0,J.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{c.current=p?null:e},style:p?void 0:{width:o,flex:`0 0 ${o}px`},children:[_?(0,J.jsx)(aie,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Are,{activeChatId:h.chatId??null,onSelect:v,onNewChat:()=>void y(),newChatShortcut:x}),(0,J.jsx)(K,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,J.jsx)(gA,{"aria-hidden":!0}),b_()]})}),(0,J.jsx)(K,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,J.jsx)(WA,{"aria-hidden":!0}),xr()]})}),e?(0,J.jsx)(K,{variant:`ghost`,className:`mx-2 mb-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings`,children:[(0,J.jsx)(pj,{"aria-hidden":!0}),Wf()]})}):null]}),(0,J.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:f,role:`separator`,"aria-orientation":`vertical`,"aria-label":s()})]}),(0,J.jsx)(`main`,{className:`oc-main`,children:(0,J.jsx)(Qk,{})}),(0,J.jsx)(U$,{viewerUserId:t,currentChatId:h.chatId??null})]}),(0,J.jsx)(_K,{})]})}function Nie(){let e=U(G.me.getMe,{host:cT}),t=sS(),n=cA({select:e=>e.pathname}),r=(0,q.useMemo)(()=>e?UT(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,q.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,J.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:Hb()});if(i)return null;let a=VT(n),o=a!==void 0&&!r.includes(a);return(0,J.jsxs)(`div`,{className:`oc-admin`,children:[(0,J.jsx)(iie,{}),(0,J.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,J.jsx)(Pie,{}):(0,J.jsx)(Qk,{})})]})}function Pie(){return(0,J.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,J.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,J.jsx)(UC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:lo()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Vl()})]})}function Fie(){let e=U(G.me.getMe,{host:cT}),t=sS();return(0,q.useEffect)(()=>{if(e===void 0)return;let n=UT(e.permissions??[]),r=n.includes(`files`)?KT(`files`):n.length>0?KT(n[0]):`/`;t({to:r,replace:!0})},[e,t]),(0,J.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:Hb()})}function Iie(e){switch(e){case`groups`:return(0,J.jsx)(pie,{});case`integrations`:return(0,J.jsx)(mie,{});case`instances`:return(0,J.jsx)(die,{});case`injections`:return(0,J.jsx)(fie,{});case`theme`:return(0,J.jsx)(Tie,{});case`feedbacks`:return(0,J.jsx)(hie,{});case`subagentReports`:return(0,J.jsx)(gie,{});case`files`:return(0,J.jsx)(yie,{});case`scheduled`:return(0,J.jsx)(bie,{});case`agentFiles`:return(0,J.jsx)(xie,{});case`preferences`:return(0,J.jsx)(Sie,{});case`chatDefaults`:return(0,J.jsx)(Cie,{});case`access`:return(0,J.jsx)(wie,{});case`trash`:return(0,J.jsx)(_ie,{});case`deletedChats`:return(0,J.jsx)(vie,{});default:return(0,J.jsx)(uie,{})}}function Lie(){let{tab:e}=vS({from:`/settings/$tab`});return(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:Iie(e)})}function Rie(){let{chatId:e}=vS({from:`/chat/$chatId`}),{m:t}=nS({from:`/chat/$chatId`});return(0,q.useEffect)(()=>{G$(e)},[e]),(0,J.jsx)(I7,{chatId:e,focusMessageId:t??null})}function zie(){let e=sS(),t=K$(),n=U(G.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,q.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,J.jsx)(`div`,{className:`oc-boot`,children:Hb()}):(0,J.jsx)(I7,{chatId:null})}var Y9=Hk({component:Eie}),Bie=Bk({getParentRoute:()=>Y9,path:`/`,component:zie}),Vie=Bk({getParentRoute:()=>Y9,path:`chat/$chatId`,component:Rie,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),Hie=Bk({getParentRoute:()=>Y9,path:`project/$projectId`,component:Uk(()=>Bw(()=>import(`./ProjectPage-BxEF71jN.js`),__vite__mapDeps([93,3,4,43,94,7,46,63,11,12,15,19,14,18,10,95,27,44,37,29,9,38,96,78,80,40,13,16,17,20,21,71,97])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),Uie=Bk({getParentRoute:()=>Y9,path:oie,beforeLoad:cie}),X9=Bk({getParentRoute:()=>Y9,path:`settings`,component:Nie}),Wie=Bk({getParentRoute:()=>X9,path:`/`,component:Fie}),Gie=Bk({getParentRoute:()=>X9,path:`traces`,validateSearch:$w,component:Uk(()=>Bw(()=>import(`./TracesTab-DiAkOmei.js`),__vite__mapDeps([98,3,4,43,7,99,96,100,14,26,27,28,8,29,9,48,38,10,12,15,49,19,18,101,50,54,52,33,11,51,53,92,39,35,36,37,6,40,41])),`TracesTab`)}),Kie=Bk({getParentRoute:()=>X9,path:`bridge`,validateSearch:Zw,component:Uk(()=>Bw(()=>import(`./BridgeTab-D4RFq-Rb.js`),__vite__mapDeps([42,3,4,24,25,26,7,27,28,8,29,9,30,31,43,44,36,45,21,6,46,47,48,38,32,33,10,11,12,13,14,15,49,19,18,50,41,51,52,53,54,55,56])),`BridgeTab`)}),qie=Bk({getParentRoute:()=>X9,path:`voice`,validateSearch:rT,component:Uk(()=>Bw(()=>import(`./VoiceTab-BSh-05Ze.js`),__vite__mapDeps([102,3,4,43,103,6,7,8,9,26,27,28,29,48,38,10,12,15,50,59])),`VoiceTab`)}),Jie=Bk({getParentRoute:()=>X9,path:`audit`,validateSearch:tT,component:Uk(()=>Bw(()=>import(`./AuditTab-BV-XydO_.js`),__vite__mapDeps([104,3,4,43,26,7,27,28,8,29,9,12,49,101,54,52,33,10,11,51,53,92,39,14,35,36,37,38,6,40,41])),`AuditTab`)}),Yie=Bk({getParentRoute:()=>X9,path:`anomalies`,validateSearch:aT,component:Uk(()=>Bw(()=>import(`./AnomaliesTab-BQ2Bu98W.js`),__vite__mapDeps([105,3,4,43,26,7,27,28,8,29,9,12,13,14,15,49,19,18,10,101,50,16,17,11,54,52,33,51,53,35,36,37,38,6,39,40,41,56])),`AnomaliesTab`)}),Xie=Bk({getParentRoute:()=>X9,path:`kpi`,validateSearch:nT,component:Uk(()=>Bw(()=>import(`./KpiTab-KPPcgUxA.js`),__vite__mapDeps([106,3,4,43,12,101,50,91,54,52,33,29,9,10,11,49])),`KpiTab`)}),Zie=Bk({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:Qw,component:Uk(()=>Bw(()=>import(`./ServiceAccountsTab-Dmb_LH0V.js`),__vite__mapDeps([107,3,4,43,7,27,44,99,26,28,8,29,9,10,11,12,13,14,15,49,19,18,16,17,20,21,51,52,53,54,33,35,36,37,38,6,39,40,41,22])),`ServiceAccountsTab`)}),Qie=Bk({getParentRoute:()=>X9,path:`users`,validateSearch:iT,component:Uk(()=>Bw(()=>import(`./UsersTab-BQaLsUCK.js`),__vite__mapDeps([108,3,4,43,37,27,29,9,38,6,7,8,46,63,26,28,10,12,13,14,15,19,18,50,16,17,11,34,109,51,52,53,54,33,49,35,36,39,40,41,64])),`UsersTab`)}),$ie=Bk({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw ID({to:`/settings/$tab`,params:{tab:GT.uiprefs},replace:!0})}}),eae=Bk({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:eT([...WT]).catch(`roles`).parse(e.tab)}),component:Lie});function tae({error:e,reset:t}){let n=sS(),r=q$(e),[i]=(0,q.useState)(()=>r&&Z$(Date.now()));return(0,q.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,J.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Yc()})}):(0,J.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,J.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,J.jsx)(UC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:yl()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:vr()}),(0,J.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:__()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:Hr()})]})]})}function nae(){let e=sS();return(0,J.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,J.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,J.jsx)(xA,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:cn()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Oc()}),(0,J.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:Hr()})})]})}var Z9=iA({routeTree:Y9.addChildren([Bie,Vie,Hie,Uie,X9.addChildren([Wie,Gie,qie,Kie,Jie,Yie,Xie,Zie,Qie,$ie,eae])]),defaultPreload:`intent`,defaultErrorComponent:tae,defaultNotFoundComponent:nae}),rae=()=>null;function Q9({children:e}){return(0,J.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=dE.createRoot(document.getElementById(`root`));$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(Q9,{children:ye()})})),t1().then(e=>{E1(document,w1(C1(a1(),window.location.origin,[r1(),i1()])));let t=new Zr(e);$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(LE,{client:t,children:(0,J.jsxs)(dT,{children:[(0,J.jsx)(n5,{children:(0,J.jsx)(sA,{router:Z9})}),(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(rae,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsxs)(Q9,{children:[yi(),` `,e instanceof Error?e.message:String(e)]})}))});
158
+ `+Eh():n)}).catch(()=>{d.current===e&&u(null)})}},children:(0,J.jsx)(bC,{size:13,"aria-hidden":!0})}):null,(0,J.jsx)(kH.Remove,{className:`oc-attach__remove`,"aria-label":Qf(),children:(0,J.jsx)(qC,{size:13,"aria-hidden":!0})}),(0,J.jsx)(Xw,{open:s,onOpenChange:c,children:(0,J.jsxs)(qw,{className:`oc-attach__dialog`,children:[(0,J.jsx)(Gw,{children:(0,J.jsx)(Jw,{className:`oc-attach__dialog-title`,children:n?.name??nf()})}),r?(0,J.jsx)(`img`,{src:r,alt:``,className:`oc-attach__dialog-img`}):l===null?(0,J.jsx)(`p`,{className:`oc-attach__dialog-text`,children:`…`}):(0,J.jsx)(`pre`,{className:`oc-attach__dialog-text`,children:l})]})})]})}function nre(){let e=(0,q.useSyncExternalStore)(a0.subscribe,a0.getSnapshot);return e.active?(0,J.jsxs)(`div`,{className:`oc-upload`,role:`status`,"aria-live":`polite`,children:[(0,J.jsxs)(`div`,{className:`oc-upload__head`,children:[(0,J.jsx)(EC,{className:`oc-upload__spin`,size:14,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:e.count>1?Kg({count:e.count,percent:e.percent}):Zh({percent:e.percent})})]}),(0,J.jsx)(`div`,{className:`oc-upload__track`,"aria-hidden":!0,children:(0,J.jsx)(`div`,{className:`oc-upload__bar`,style:{width:`${e.percent}%`}})})]}):null}function rre({reason:e}){let t=(0,q.useContext)(O7),n=OV(),r=kV(e=>e.text).trim().length>0,i=e===`subagent`;return(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!r||t===null,"aria-label":i?rt():wr(),title:r?i?Ct():C_():i?wa():Tl(),onClick:()=>{if(t===null)return;let e=n.getState().text;e.trim()!==``&&t(e).then(e=>{e&&n.setText(``)})},children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})})}function Q7(){let e=(0,q.useContext)(A7);return e===null?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send oc-composer__stop`,"aria-label":m(),title:_o(),onClick:()=>void e(),children:(0,J.jsx)(bj,{size:14,"aria-hidden":!0})})}function ire({chatId:e,gate:t,onManage:n}){let r=P7(),i=U(G.chatAgents.listChatAgents,{chatId:e}),a=i?K0(i.viewerRoomRole):!1,o=kw(),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(`agents`),[d,f]=(0,q.useState)(``),[p,m]=(0,q.useState)(`member`),h=X0(i?.viewerRoomRole),g=Z0(p,i?.viewerRoomRole),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1);(0,q.useEffect)(()=>{m(`member`),f(``),v(!1),b(!1)},[e]);let x=U(G.chatParticipants.listInvitable,a&&s&&l===`people`?{chatId:e}:`skip`),S=W(G.chatParticipants.addMember),C=W(G.chatParticipants.removeMember),w=t=>{C({chatId:e,memberId:t.userId}).then(()=>o.success(Cd({name:t.name}))).catch(()=>o.error(ku()))},T=U(G.chatAgents.listAddableAgents,a&&s&&l===`agents`?{chatId:e}:`skip`),E=W(G.chatAgents.addChatAgent),D=W(G.chatAgents.removeChatAgent),O=t=>{let n=t.displayName??t.agentId;D({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).then(e=>{e.removed&&o.success(Cd({name:n}))}).catch(()=>o.error(Sc()))},k=t=>{E({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/chat_agents_limit:(\d+)/.exec(t);o.error(n===null?PT(e)?Ze():tc():Lr({count:Number(n[1])}))})},[A,j]=(0,q.useState)(``),M=U(G.chatParticipants.listMembers,{chatId:e}),N=OV(),P=r?.pool??[],F=r?.roomAgents??[],I=i==null?r?.primary??null:i.primary?{instanceName:i.primary.instanceName,agentId:i.primary.agentId}:null,ee=(0,q.useMemo)(()=>f2(P,i?[i.primary,...i.agents]:[]),[P,i]),{room:L,others:R}=(0,q.useMemo)(()=>l2(qee(ee,A),I,F),[ee,A,F,I]),z=(0,q.useMemo)(()=>u2([...ee,...T??[]]),[ee,T]),B=t.onCall!=null&&!P.some(e=>Q0(e,t.onCall));if(!r||t.hidden&&!n)return null;let V=!t.hidden,{disabled:te}=t,ne=t=>{let n=S4(String(e),N.getState().text,{instanceName:t.instanceName,agentId:t.agentId},i4(t.displayName??t.agentId));n!==null&&N.setText(n)},re=t.onCall??r.primary,ie=o2(P,re),ae=new Set((T??[]).map(e=>`${e.instanceName}\u0000${e.agentId}`)),oe=A.trim().toLocaleLowerCase(),se=_2(ee,T??[],A),ce=se.slice(0,8),le=R.length+se.length,ue=h2({unfolded:_,searching:oe!==``,hereCount:L.length}),de=e=>{let t=z.has(`${e.instanceName}\u0000${e.agentId}`),n=ae.has(`${e.instanceName}\u0000${e.agentId}`),r=d2(i?.viewerRoomRole,e,I,F),a=(0,J.jsxs)(`button`,{type:`button`,role:`option`,className:`oc-agentrow`,disabled:e.state===`deleted`||te||!V,title:e.state===`deleted`?Qi():hx({name:e.displayName??e.agentId}),onClick:()=>{ne(e),c(!1),j(``)},children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,title:e.kind===`hermes`?`Hermes`:`OpenClaw`,children:(0,J.jsx)(V2,{kind:e.kind,size:16})}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId,Q0(e,I)?(0,J.jsx)(wA,{size:12,className:`oc-agentrow__primary`,"aria-label":tb(),children:(0,J.jsx)(`title`,{children:tb()})}):null]}),t?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),(0,J.jsx)(dA,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`${e.instanceName}/${e.agentId}`);if(!n&&!r)return a;let o=e.displayName??e.agentId;return(0,J.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[a,n?(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__add`,title:Hc(),"aria-label":Hc(),onClick:()=>k(e),children:(0,J.jsx)(FC,{size:14,"aria-hidden":!0})}):null,r?(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Wb({name:o}),"aria-label":Wb({name:o}),onClick:()=>O(e),children:(0,J.jsx)(qC,{size:14,"aria-hidden":!0})}):null]},`${e.instanceName}/${e.agentId}`)},fe=+!!I+F.length,pe=M?.length??1,me=Nl({agents:fe,people:pe,next:re?`${ie?.displayName??re.agentId}${(z.has(`${re.instanceName}\u0000${re.agentId}`)||B)&&re?` (${re.instanceName})`:``}`:`—`}),he=(0,J.jsxs)(J.Fragment,{children:[V&&P.length>6||a?(0,J.jsxs)(`div`,{className:`oc-agentlist__search`,children:[(0,J.jsx)(gC,{size:14,"aria-hidden":!0}),(0,J.jsx)(`input`,{autoFocus:!0,value:A,onChange:e=>j(e.target.value),placeholder:Bt(),"aria-label":Ha()})]}):null,te?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:t.reason===`call-active`?os():Fb()}):null,(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`listbox`,children:[L.map(e=>de(e)),L.length>0&&le>0?(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentlist__divider oc-agentlist__toggle`,"aria-expanded":ue,onClick:()=>v(!ue),children:[(0,J.jsx)(JS,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:Il()}),(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:le})]}):null,ue?(0,J.jsx)(J.Fragment,{children:R.map(e=>{let t=`${e.instanceName}\u0000${e.agentId}`,n=ae.has(t);return(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow oc-agentrow--outside`,disabled:!n,onClick:()=>k(e),title:n?Hc():Ou(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V2,{kind:e.kind,size:16})}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),z.has(t)?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),n?(0,J.jsx)(FC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`}):null]},`other/${e.instanceName}/${e.agentId}`)})}):null,ue&&ce.length>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-agentlist__divider`,role:`presentation`,children:Hn()}),ce.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow`,onClick:()=>k(e),title:Hc(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V2,{kind:e.kind,size:16})}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),z.has(`${e.instanceName}\u0000${e.agentId}`)?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),(0,J.jsx)(FC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`add/${e.instanceName}/${e.agentId}`))]}):null]})]}),ge=(t,n)=>{let r=x4(String(e),N.getState().text,String(n),i4(t));r!==null&&N.setText(r),c(!1)},_e=d.trim().toLocaleLowerCase(),ve=(M??[]).filter(e=>_e===``||e.name.toLocaleLowerCase().includes(_e)),ye=(x??[]).filter(e=>e.name.toLocaleLowerCase().includes(_e)||(e.detail??``).toLocaleLowerCase().includes(_e)),be=ye.slice(0,8),xe=h2({unfolded:y,searching:_e!==``,hereCount:ve.filter(e=>!e.isSelf).length}),Se=t=>{S({chatId:e,memberId:t.userId,role:g}).then(()=>f(``)).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/participants_limit:(\d+)/.exec(t);o.error(n===null?ku():nb({count:Number(n[1])}))})},Ce=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-agentlist__search`,children:[(0,J.jsx)(gC,{size:14,"aria-hidden":!0}),(0,J.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:a?Te():bc(),"aria-label":a?Te():bc()})]}),(0,J.jsx)(`div`,{className:`oc-agentlist__caption`,children:N_()}),(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`list`,children:[ve.map(e=>{let t=(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,disabled:e.isSelf,onClick:()=>ge(e.name,e.userId),title:e.isSelf?void 0:ii({name:e.name}),children:[(0,J.jsx)(B2,{userId:String(e.userId),name:e.name}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.name,e.isSelf?(0,J.jsx)(`span`,{className:`oc-agentrow__tag`,children:ur()}):null]}),(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(are,{role:e.roomRole})})]}),(0,J.jsx)(dA,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId));return Y0(i?.viewerRoomRole,e)?(0,J.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[t,(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Wb({name:e.name}),"aria-label":Wb({name:e.name}),onClick:()=>w(e),children:(0,J.jsx)(qC,{size:14,"aria-hidden":!0})})]},String(e.userId)):t}),a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-agentlist__divider oc-agentlist__divider--invite`,role:`presentation`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentlist__toggle`,"aria-expanded":xe,onClick:()=>b(!xe),children:[(0,J.jsx)(JS,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:Lx()}),x!==void 0&&ye.length>0?(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:ye.length}):null]}),xe?(0,J.jsxs)(`label`,{className:`oc-invite-as`,children:[(0,J.jsx)(`span`,{children:Gp()}),(0,J.jsxs)(nw,{value:g,onValueChange:e=>m(e),children:[(0,J.jsx)($C,{size:`sm`,className:`oc-invite-as__trigger`,children:(0,J.jsx)(QC,{})}),(0,J.jsx)(ew,{children:h.map(e=>(0,J.jsx)(tw,{value:e,children:q2(e)},e))})]})]}):null]}),xe?x===void 0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:qo()}):be.length===0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Ti()}):be.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,onClick:()=>Se(e),title:wi({name:e.name,role:q2(g)}),children:[(0,J.jsx)(B2,{userId:String(e.userId),name:e.name}),(0,J.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,J.jsx)(`span`,{className:`oc-agentrow__name`,children:e.name}),e.detail?(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,title:e.detail,children:(0,J.jsx)(`span`,{className:`oc-agentrow__model`,children:e.detail})}):null]}),(0,J.jsx)(zC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId))):null,xe&&ye.length>be.length?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:ms({count:ye.length-be.length})}):null]}):null]})]});return(0,J.jsxs)(`span`,{className:`oc-roompill`,children:[(0,J.jsxs)(_w,{open:s,onOpenChange:e=>{c(e),e||(j(``),v(!1),b(!1))},children:[(0,J.jsx)(gw,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-roompill__main`,title:t.reason===`call-active`?os():me,"aria-label":me,children:[(0,J.jsx)(VC,{size:16,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-roompill__count`,children:fe+pe})]})}),(0,J.jsxs)(hw,{align:`start`,className:`oc-composer__agent-pop p-0`,children:[(0,J.jsxs)(`div`,{className:`oc-roomtabs`,role:`tablist`,children:[(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`agents`,className:`oc-roomtabs__tab`,onClick:()=>u(`agents`),children:[(0,J.jsx)(MS,{size:14,"aria-hidden":!0}),nu(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:fe})]}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`people`,className:`oc-roomtabs__tab`,onClick:()=>u(`people`),children:[(0,J.jsx)(VC,{size:14,"aria-hidden":!0}),dl(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:pe})]})]}),l===`agents`?he:Ce]})]}),n?(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsx)(`button`,{type:`button`,className:`oc-roompill__chev`,title:Nr(),"aria-label":Nr(),children:(0,J.jsx)(KS,{size:13,"aria-hidden":!0})})}),(0,J.jsx)(cC,{align:`end`,className:`oc-roommenu`,children:(0,J.jsxs)(dC,{onSelect:()=>n(`agents`,null),children:[(0,J.jsx)(fj,{"aria-hidden":!0}),bee()]})})]}):null]})}function are({role:e}){let t=e===`owner`?nd():e===`manager`?Fm():e===`viewer`?mg():ov();return(0,J.jsxs)(`span`,{className:`oc-rolemark`,title:t,children:[(0,J.jsx)(e===`owner`?wA:e===`manager`?RC:e===`viewer`?bC:wj,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:t})]})}function ore(e){let t=(0,q.useContext)(x7),n=OV(),r=kw(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(``),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(e);u.current=e;let d=(0,q.useSyncExternalStore)(Lj,Rj),f=d!==null&&d.targetChatId===e.chatId;(0,q.useEffect)(()=>()=>{c.current?.stop(),c.current=null,a(!1),s(``)},[e.chatId]);let p=(0,q.useCallback)(()=>{requestAnimationFrame(()=>{let t=e.rootRef.current?.querySelector(`.oc-composer__input`);t&&(t.scrollTop=t.scrollHeight)})},[]),m=US(t.lang,Ln()),h=(0,q.useRef)(m);h.current=m;let g=(0,q.useRef)(e.voiceInput);g.current=e.voiceInput;let _=(0,q.useCallback)(()=>{let e=Rj();e!==null&&e.targetChatId===u.current.chatId&&iM(),c.current?.stop(),c.current=null,a(!1),s(``)},[]),v=(0,q.useCallback)(()=>{if(!WS()){r.error(O_());return}let e=Rj();if(e!==null&&e.targetChatId!==u.current.chatId&&e.recording){r.error(Ub());return}let t=u.current.chatId,i={h:null,boundToHold:!1};l.current=i;let o=RS({lang:m,onText:(e,r)=>{if(i.holdGen!==void 0&&i.holdGen!==Gj())return;let a=Rj();if(a!==null&&a.targetChatId===t){if(Kj(e,r.paragraph),u.current.chatId===t){let e=Rj();e!==null&&(n.setText(e.text),p())}return}if(u.current.chatId!==t)return;let o=n.getState().text;n.setText(aM(o,e,r.paragraph)),p()},onInterim:e=>{if(i.holdGen!==void 0&&i.holdGen!==Gj())return;let n=Rj();n!==null&&n.targetChatId===t&&qj(e),s(e)},onEnd:()=>{i.boundToHold&&nM(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``))},onError:e=>{i.boundToHold&&nM(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``),e===`not-allowed`||e===`service-not-allowed`?r.error(kr()):e!==`no-speech`&&e!==`aborted`&&r.error($r({code:e})))}});if(o===null){r.error(O_());return}i.h=o;let d=Rj();if(d!==null&&d.targetChatId===t){i.boundToHold=!0,Wj(()=>o.stop()),i.holdGen=Gj(),a(!0);return}c.current=o,a(!0)},[m,r]),y=(0,q.useCallback)(()=>{if(n.getState().attachments.length>0||l0()){r.error(ps());return}let e=c.current;Uj({targetChatId:u.current.chatId,targetLabel:u.current.chatTitle,text:n.getState().text,voiceEnabled:g.current,voiceLang:h.current,recording:e!==null,...e===null?{}:{stop:()=>e.stop()}})&&(e!==null&&l.current?.h===e&&(l.current.boundToHold=!0,l.current.holdGen=Gj()),c.current=null,a(!1),s(``),n.setText(``))},[r]);return{recording:i||f&&d!==null&&d.recording,interim:f&&d!==null?d.interim:o,held:f,canPin:d===null,pinned:d!==null,pinnedHere:f,pinnedLabel:d?.targetLabel??``,pinnedTargetChatId:d?.targetChatId??null,pendingSend:f?d?.pendingSend??null:null,pendingSendId:f?d?.pendingSendId??0:0,pendingRestore:f?d?.pendingRestore??null:null,start:v,stop:_,hold:y}}function sre({recording:e,onStart:t,onStop:n}){let r=U(G.me.getMe,{host:cT})?.dictationShortcut??null,i=(0,q.useRef)(()=>{});(0,q.useEffect)(()=>{if(!r)return;let e=e=>{e.repeat||Cw(e,r)&&(e.preventDefault(),i.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=r?` (${xw(r,bw())})`:``;return(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${e?` oc-composer__icon--rec`:``}`,title:(e?kl():ol())+a,"aria-label":e?kl():ol(),"aria-pressed":e,ref:e=>{i.current=()=>e?.click()},onClick:()=>e?n():t(),children:(0,J.jsx)(BS,{size:18,"aria-hidden":!0})})}function cre({chatId:e,chatTitle:t=``,showTools:n,onToggleTools:r,unavailable:i=!1,agentGate:a,onTalkCallActiveChange:o,serverCallSessionId:s,subAgentBusy:c=!1}){let{can:l,loading:u,resolved:d}=jT(e),f=u||!d||l(`inboundAttachments`),p=E7().voiceInput,m=H0(),h=P7(),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(`agents`),[b,x]=(0,q.useState)(null),S=(0,q.useCallback)(()=>x(null),[]),C=(0,q.useCallback)((e,t)=>{y(e),x(t),_(!0)},[]),w=h?.nextTarget??null,T=h?.primary??null,E=(h?.roomAgents.length??0)>0,D=E&&T?o2(h?.pool??[],T)?.displayName??T.agentId:U0(m),k=MV(e=>e.isRunning),A=s8(e),j=A!==null&&l(`followUpModes`),M=B8({turnRunning:k,hasRunningSubAgent:!j&&c}),N=M.mode===`queue`,P=(0,q.useContext)(O7),F=OV(),I=Dr(),ee=(0,q.useRef)(null),L=sS(),R=ore({chatId:e,chatTitle:t===``?D:t,voiceInput:p,rootRef:ee}),[z,B]=(0,q.useState)(!1),V=R.pendingSendId,te=kw(),ne=(0,q.useRef)(0);(0,q.useEffect)(()=>{if(V===0||ne.current===V)return;ne.current=V;let e=Rj(),t=e?.pendingSend??``,n=e?.holdId??-1;if(Zj(),i){Qj(n),te.error(sd());return}if(t.trim()===``){$j(n);return}N&&P!==null?P(t).then(e=>{e?Rj()?.holdId===n&&(iM(),F.setText(``)):Qj(n)}):Rj()?.holdId===n&&(iM(),F.setText(t),F.send())},[V]);let re=R.pendingRestore;(0,q.useEffect)(()=>{re!==null&&(F.setText(re),tM(),iM())},[re]),(0,q.useEffect)(()=>{if(!z)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),B(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[z]);let ie=(0,q.useContext)(Aq);(0,q.useEffect)(()=>{if(ie!==null)return ie.current={canAttach:f&&!N&&!R.pinned,attachFile:e=>R.pinned?Promise.resolve():(le(e=>e+1),F.addAttachment(e).then(()=>{de(``),requestAnimationFrame(()=>de(Tn()))}).finally(()=>le(e=>Math.max(0,e-1)))),insertText:e=>{let t=F.getState();F.setText(t.text+e),de(``),requestAnimationFrame(()=>de(Gc()))}},()=>{ie.current=null}},[ie,f,N,F,R.pinned]);let oe=(0,q.useRef)(1),se=kw(),[ce,le]=(0,q.useState)(0),[ue,de]=(0,q.useState)(``),fe=ce>0,pe=(0,J.jsxs)(J.Fragment,{children:[z?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__backdrop`,"aria-label":eh(),onClick:()=>B(!1)}):null,(0,J.jsxs)(mW.Root,{ref:ee,className:`oc-composer${i?` oc-composer--disabled`:``}${R.recording?` oc-composer--dictation`:``}${z?` oc-composer--expanded`:``}`,children:[z?(0,J.jsxs)(`div`,{className:`oc-composer__exphead`,children:[(0,J.jsx)(`span`,{className:`oc-composer__exptitle`,children:Ko()}),(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__expclose`,title:eh(),onClick:()=>B(!1),children:[(0,J.jsx)(ej,{size:15,"aria-hidden":!0}),eh()]})]}):null,e?(0,J.jsx)(e4,{chatId:e,onOpen:()=>C(`people`,null)}):null,e?(0,J.jsx)(t4,{chatId:e,routing:h,open:g,onOpenChange:_,tab:v,onTabChange:y,intent:b,onIntentDone:S}):null,(0,J.jsx)(ere,{chatId:e}),(0,J.jsx)(`div`,{className:`oc-attachrow`,children:(0,J.jsx)(mW.Attachments,{components:{Attachment:tre}})}),(0,J.jsx)(`span`,{className:`oc-sr-only`,role:`status`,"aria-live":`polite`,children:ue}),(0,J.jsx)(nre,{}),(0,J.jsx)(mW.Input,{className:`oc-composer__input`,placeholder:i?sd():E?Cp({name:D}):Qb({name:D}),autoFocus:!0,rows:1,disabled:i,onKeyDownCapture:e=>{if(fe&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation();return}if(!N||P===null||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)return;e.preventDefault(),e.stopPropagation();let t=F.getState().text;if(t.trim()===``)return;let n=j?t6(A?.preference??null,A?.serverMode??null):null,r=n===null?void 0:e.metaKey||e.ctrlKey?n6(n):n.mode;P(t,n===null?void 0:{...r?{mode:r}:{},immediate:r!==`queue`}).then(e=>{e&&F.setText(``)})},onPaste:e=>{if((e.clipboardData?.files?.length??0)>0)return;let t=e.clipboardData?.getData(`text/plain`)??``;if(!t)return;let n=R8(t);if(n!==null&&f&&!N){e.preventDefault();let r=e.currentTarget,i=r.selectionStart??null,a=r.selectionEnd??null,o=F.getState().text,s=()=>{let e=F.getState();e.text===o&&i!==null&&a!==null?F.setText(o.slice(0,i)+t+o.slice(a)):F.setText(e.text+t)};le(e=>e+1),I.query(G.chatExport.exportByReference,{reference:n}).then(e=>{let t=e;if(t===null){s();return}let n=new File([t.markdown],t.filename,{type:`text/markdown; charset=utf-8`});return Fq(n),F.addAttachment(n).then(()=>{de(``),requestAnimationFrame(()=>de(Bf()))})}).catch(()=>{s(),se.error(O())}).finally(()=>le(e=>Math.max(0,e-1)));return}let r=Nq(t,oe.current);if(r.kind!==`file`||!f)return;if(e.preventDefault(),N){se.error(Pm());return}oe.current+=1;let i=new File([t],r.filename??`texte-colle.txt`,{type:`text/plain; charset=utf-8`});Fq(i),le(e=>e+1),F.addAttachment(i).then(()=>{de(``),requestAnimationFrame(()=>de(pg({lines:String(r.lines)})))}).catch(e=>{console.error(`[paste] attachment routing failed:`,e),se.error(av())}).finally(()=>le(e=>Math.max(0,e-1)))},autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`}),R.recording&&R.interim!==``?(0,J.jsxs)(`div`,{className:`oc-composer__interim`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`oc-composer__interim-dot`}),R.interim]}):null,(0,J.jsxs)(`div`,{className:`oc-composer__bar`,children:[(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(Z5,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,attachmentsSupported:f,attachDisabled:N||i}),z?null:(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__tools${n?` is-on`:``}`,onClick:r,"aria-pressed":n,title:n?jd():fv(),children:[(0,J.jsx)(BC,{size:15,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-composer__tools-label`,children:yg()})]}),(0,J.jsx)(ire,{chatId:e,gate:a,onManage:C}),(0,J.jsx)(P5,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,multiAgent:h?.perTurnRouting===!0||(h?.roomAgents?.length??0)>0})]}),(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(`span`,{className:`oc-composer__voiceslot${R.canPin||R.held?` is-shown`:``}`,"aria-hidden":!R.canPin&&!R.held,children:R.held?(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__heldchip`,title:Ql(),"aria-label":Ql(),onClick:()=>iM(),children:[(0,J.jsx)(fS,{size:12,"aria-hidden":!0}),ae(),(0,J.jsx)(qC,{size:11,"aria-hidden":!0})]}):(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon oc-composer__hold`,title:Ci(),"aria-label":Ci(),onClick:R.hold,disabled:!R.canPin||fe,tabIndex:!R.canPin||fe?-1:0,children:(0,J.jsx)(fS,{size:16,"aria-hidden":!0})})}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${z?` is-on`:``}`,title:z?eh():Gi(),"aria-label":z?eh():Gi(),"aria-pressed":z,onClick:()=>B(e=>!e),children:z?(0,J.jsx)(ej,{size:16,"aria-hidden":!0}):(0,J.jsx)(XA,{size:16,"aria-hidden":!0})}),p?(0,J.jsx)(sre,{recording:R.recording,onStart:R.start,onStop:R.stop}):null,(0,J.jsx)(P0,{chatId:e,onCallActiveChange:o,serverCallSessionId:s,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null},e),i?(0,J.jsxs)(J.Fragment,{children:[M.mode===`queue`?(0,J.jsx)(Q7,{}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!0,"aria-label":uy(),children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})})]}):M.mode===`queue`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q7,{}),j?(0,J.jsx)(c8,{chatId:e,queueSend:P===null?null:(e,t)=>P(e,{...t?{mode:t}:{},immediate:t!==`queue`})}):(0,J.jsx)(rre,{reason:M.reason})]}):j&&c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q7,{}),(0,J.jsx)(mW.Send,{className:`oc-composer__send`,"aria-label":Zf(),disabled:fe,children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})})]}):(0,J.jsx)(mW.Send,{className:`oc-composer__send`,"aria-label":Zf(),disabled:fe,children:(0,J.jsx)(uA,{size:18,"aria-hidden":!0})})]})]})]})]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Bne,{}),R.pinned?(0,J.jsxs)(`div`,{className:`oc-composer__pinnednote`,role:`note`,children:[(0,J.jsx)(fS,{size:14,"aria-hidden":!0}),R.pinnedHere?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:lr()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>eM(),children:en()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:no({chat:R.pinnedLabel||Mt()})}),R.pinnedTargetChatId?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>{L({to:`/chat/$chatId`,params:{chatId:R.pinnedTargetChatId}})},children:fa()}):null]})]}):z?(0,Tk.createPortal)(pe,document.body):pe]})}function lre({chatId:e}){let t=I5(e);return t.offered?(0,J.jsxs)(dC,{disabled:t.pending,"data-widgets-toggle":!0,onSelect:()=>t.set(!t.enabled),children:[(0,J.jsx)(UA,{}),t.enabled?gg():sy()]}):null}var $7=67324752,e9=33639248,t9=101010256,n9=0,r9=2048,i9=class extends Error{reason;constructor(e,t){super(t===void 0?e:`${e}: ${t}`),this.reason=e,this.name=`ZipError`}},ure=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function a9(e){let t=4294967295;for(let n of e)t=ure[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function dre(e){if(e.length>65535)throw new i9(`too_many_entries`,String(e.length));let t=new TextEncoder,n=[],r=[],i=0;for(let a of e){let e=t.encode(a.name),o=a9(a.bytes),s=new Uint8Array(30+e.length),c=new DataView(s.buffer);c.setUint32(0,$7,!0),c.setUint16(4,20,!0),c.setUint16(6,r9,!0),c.setUint16(8,n9,!0),c.setUint16(10,0,!0),c.setUint16(12,33,!0),c.setUint32(14,o,!0),c.setUint32(18,a.bytes.length,!0),c.setUint32(22,a.bytes.length,!0),c.setUint16(26,e.length,!0),c.setUint16(28,0,!0),s.set(e,30);let l=new Uint8Array(46+e.length),u=new DataView(l.buffer);u.setUint32(0,e9,!0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,r9,!0),u.setUint16(10,n9,!0),u.setUint16(12,0,!0),u.setUint16(14,33,!0),u.setUint32(16,o,!0),u.setUint32(20,a.bytes.length,!0),u.setUint32(24,a.bytes.length,!0),u.setUint16(28,e.length,!0),u.setUint32(42,i,!0),l.set(e,46),n.push(s,a.bytes),r.push(l),i+=s.length+a.bytes.length}let a=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(22),s=new DataView(o.buffer);s.setUint32(0,t9,!0),s.setUint16(8,e.length,!0),s.setUint16(10,e.length,!0),s.setUint32(12,a,!0),s.setUint32(16,i,!0);let c=n.reduce((e,t)=>e+t.length,0)+a+22,l=new Uint8Array(c),u=0;for(let e of[...n,...r,o])l.set(e,u),u+=e.length;return l}function fre(e){let t=new DataView(e.buffer,e.byteOffset,e.length),n=new TextDecoder,r=-1;for(let n=e.length-22;n>=0;--n)if(t.getUint32(n,!0)===t9){r=n;break}if(r===-1)throw new i9(`not_a_zip`);let i=t.getUint16(r+10,!0),a=t.getUint32(r+16,!0),o=[];for(let r=0;r<i;r+=1){if(a+46>e.length||t.getUint32(a,!0)!==e9)throw new i9(`corrupt`,`central directory`);let r=t.getUint16(a+8,!0),i=t.getUint16(a+10,!0),s=t.getUint32(a+16,!0),c=t.getUint32(a+24,!0),l=t.getUint16(a+28,!0),u=t.getUint16(a+30,!0),d=t.getUint16(a+32,!0),f=t.getUint32(a+42,!0),p=n.decode(e.subarray(a+46,a+46+l));if(i!==n9)throw new i9(`unsupported_method`,p);if((r&r9)===0)throw new i9(`unsupported_encoding`,p);if(f+30>e.length||t.getUint32(f,!0)!==$7)throw new i9(`corrupt`,p);let m=t.getUint16(f+26,!0),h=t.getUint16(f+28,!0),g=f+30+m+h;if(g+c>e.length)throw new i9(`corrupt`,p);let _=e.slice(g,g+c);if(a9(_)!==s)throw new i9(`checksum_mismatch`,p);o.push({name:p,bytes:_}),a+=46+l+u+d}return o}var o9=`manifest.json`,s9=`chats/`,pre=`sections/`,c9=`blobs/`,mre=512*1024*1024,hre=1e4,gre=76,_re=600*1e3;function vre(e,t){return e.filter(e=>t-e.updatedAt>_re)}var yre=class extends Error{bytes;constructor(e){super(`archive exceeds ${mre} bytes`),this.bytes=e,this.name=`ArchiveTooLarge`}};async function l9(e,t,n){let r=new TextEncoder,i=await e.manifest(),a=[],o=0,s=0,c=0,l=new Set,u=(e,t)=>{if(o+=t.length+gre+2*e.length,o>536870912)throw new yre(o);a.push({name:e,bytes:t})},d=[];for(let a of t){let t=await e.chat(a);u(`${s9}${a}.json`,r.encode(JSON.stringify(t)));for(let t of i.sections){let i=null,o=0;do{let f=await e.section(a,t,i);f.rows.length>0&&u(`${pre}${a}/${t}/${o}.json`,r.encode(JSON.stringify(f.rows)));for(let t of f.blobs){if(t.url===null){d.push(t.key);continue}l.has(t.key)||(l.add(t.key),u(`${c9}${t.key}`,await e.blob(t.url)),s+=1,n?.({phase:`blobs`,done:s,total:null}))}i=f.cursor,o+=1,c+=1,n?.({phase:`sections`,done:c,total:null})}while(i!==null&&o<1e4);if(i!==null)throw Error(`export of ${t} did not finish within ${hre} pages`)}}return n?.({phase:`packing`,done:a.length,total:a.length}),a.unshift({name:o9,bytes:r.encode(JSON.stringify({...i,missingBlobs:d}))}),{archive:dre(a),manifest:i,blobCount:s,missingBlobs:d}}async function bre(e,t,n,r){let i=new TextDecoder,a=fre(t);r?.({phase:`reading`,done:a.length,total:a.length});let o=new Map(a.map(e=>[e.name,e.bytes])).get(o9);if(o===void 0)throw Error(`archive has no manifest`);let s=JSON.parse(i.decode(o)),c=await e.begin({formatVersion:s.formatVersion,origin:s.origin??null},n),l=0,u=!1,d=new Map,f=new Set;try{let t=a.filter(e=>e.name.startsWith(c9)).length;for(let n of a){if(!n.name.startsWith(`blobs/`))continue;let i=n.name.slice(6);if(d.has(i))throw Error(`archive names the same blob twice: ${i}`);let a=await e.upload(n.bytes,i);await e.registerBlob(c,a),d.set(i,a),r?.({phase:`uploading`,done:d.size,total:t})}let n=a.filter(e=>e.name.startsWith(s9));for(let t of n){let n=JSON.parse(i.decode(t.bytes)),r=await e.batch(c,`chats`,[n],u9([n],d));l+=r.written,d9([n],r.writtenIds,f)}for(let t of s.sections){let n=a.filter(e=>e.name.startsWith(`sections/`)&&e.name.includes(`/${t}/`)).sort((e,t)=>f9(e.name)-f9(t.name));for(let a of n){let n=JSON.parse(i.decode(a.bytes)),o=await e.batch(c,t,n,u9(n,d));l+=o.written,r?.({phase:`writing`,done:l,total:null}),d9(n,o.writtenIds,f)}}for(let[t,n]of d)f.has(t)||await e.discardUpload(c,n);let o=Math.ceil(l/100)+100;for(let t=0;t<o&&!u;t+=1)u=(await e.finish(c)).done}catch(t){try{let t=!1;for(let n=0;n<1e4&&!t;n+=1)t=(await e.abandon(c)).done;for(let t of d.values())await e.discardUpload(c,t)}catch{}throw t}return{importId:c,written:l,purged:u}}function u9(e,t){let n=new Set;for(let t of e){let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let r=t.archiveBlobKeys;if(Array.isArray(r))for(let e of r)typeof e==`string`&&n.add(e)}let r=[];for(let e of n){let n=t.get(e);n!==void 0&&r.push({key:e,storageId:n})}return r}function d9(e,t,n){let r=new Set(t);for(let t of e){if(typeof t._id!=`string`||!r.has(t._id))continue;let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let i=t.archiveBlobKeys;if(Array.isArray(i))for(let e of i)typeof e==`string`&&n.add(e)}}function f9(e){let t=/\/(\d+)\.json$/.exec(e);return t===null?0:Number(t[1])}function p9(e){return`atrium-${e.normalize(`NFKD`).replace(/[^\p{Letter}\p{Number}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}.zip`}function m9(e,t){let n=URL.createObjectURL(new Blob([e],{type:`application/zip`})),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function xre(){let e=Dr(),[t,n]=(0,q.useState)({running:!1,progress:null}),r=(0,q.useRef)(!1),i=(0,q.useCallback)(()=>({manifest:()=>e.action(G.archiveExport.exportManifest,{}),chat:t=>e.query(G.archiveExport.exportChat,{chatId:t}),section:(t,n,r)=>e.query(G.archiveExport.exportChatSection,{chatId:t,section:n,cursor:r}),blob:async e=>{let t=await fetch(e);if(!t.ok)throw Error(`attachment could not be read (${t.status})`);return new Uint8Array(await t.arrayBuffer())}}),[e]),a=(0,q.useCallback)(()=>({begin:(t,n)=>e.mutation(G.archiveImport.beginImport,{manifest:t,targetProjectId:n??null}),batch:(t,n,r,i)=>e.mutation(G.archiveImport.importBatch,{importId:t,section:n,rows:r,blobs:i.map(e=>({key:e.key,storageId:e.storageId}))}),finish:t=>e.mutation(G.archiveImport.finishImport,{importId:t}),abandon:t=>e.mutation(G.archiveImport.abandonImport,{importId:t}),upload:async t=>{let n=await e.mutation(G.chats.generateUploadUrl,{}),{storageId:r}=await(await fetch(n,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:new Blob([t])})).json();return await e.mutation(G.uploads.registerUpload,{storageId:r}),r},registerBlob:async(t,n)=>{await e.mutation(G.archiveImport.registerImportBlob,{importId:t,storageId:n})},discardUpload:async(t,n)=>{await e.mutation(G.archiveImport.discardUpload,{importId:t,storageId:n})}}),[e]),o=(0,q.useCallback)(async e=>{if(r.current)throw Error(`a transfer is already running`);r.current=!0,n({running:!0,progress:null});try{return await e(e=>n({running:!0,progress:e}))}finally{r.current=!1,n({running:!1,progress:null})}},[]),s=(0,q.useCallback)((e,t)=>o(async n=>{let{archive:r,missingBlobs:a}=await l9(i(),e,n);return m9(r,p9(t)),{missingBlobs:a}}),[o,i]),c=(0,q.useCallback)((t,n)=>o(async r=>{let a=await e.query(G.archiveExport.exportFolderTree,{projectId:t});if(!a.complete)throw Error(`folder_too_large`);let o=[];for(let t of a.folders){let n=null;do{let r=await e.query(G.archiveExport.exportFolderChats,{projectId:t._id,cursor:n});o.push(...r.chatIds),n=r.cursor}while(n!==null)}let{archive:s,missingBlobs:c}=await l9(i(),o,r);return m9(s,p9(n)),{missingBlobs:c,chatCount:o.length}}),[e,o,i]),l=(0,q.useCallback)((e,t)=>o(async n=>{if(e.size>536870912)throw Error(`archive_too_large`);return bre(a(),new Uint8Array(await e.arrayBuffer()),t,n)}),[o,a]);return(0,q.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await e.query(G.archiveImport.listOpenImports,{});for(let r of vre(n,Date.now())){let n=!1;for(let i=0;i<1e3&&!n&&!t;i+=1)n=(await e.mutation(G.archiveImport.abandonImport,{importId:r.importId})).done}}catch{}})(),()=>{t=!0}},[e]),{state:t,exportChats:s,exportFolder:c,importArchive:l}}var h9=(0,q.createContext)(null);function Sre({children:e}){let t=xre(),n=kw(),r=(e,t)=>{let r=e instanceof Error?e.message:String(e);if(r.includes(`folder_too_large`)){n.error(Yf());return}if(r.includes(`already running`)){n.error(T());return}if(r.includes(`archive_too_large`)){n.error(Pl());return}if(r.includes(`not_a_zip`)||r.includes(`no manifest`)){n.error(fl());return}n.error(t,e)},i={state:t.state,exportChat:(e,i)=>{t.exportChats([e],i).then(({missingBlobs:e})=>{e.length>0?n.error(sv({count:e.length})):n.success(Im())}).catch(e=>r(e,ru()))},exportFolder:(e,i)=>{t.exportFolder(e,i).then(({missingBlobs:e})=>{e.length>0?n.error(sv({count:e.length})):n.success(Im())}).catch(e=>r(e,ru()))},importArchive:(e,i)=>{t.importArchive(e,i).then(({written:e,purged:t})=>{n.success(hg({count:e}),t?void 0:oy())}).catch(e=>r(e,Eo()))}},a={...i,pickAndImport:e=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.zip,application/zip`,t.addEventListener(`change`,()=>{let n=t.files?.[0];n!==void 0&&i.importArchive(n,e)}),t.click()}};return(0,J.jsx)(h9.Provider,{value:a,children:e})}function g9(){return(0,q.useContext)(h9)}function Cre(e){if(!e.running)return null;let t=e.progress;if(t===null)return Qd();switch(t.phase){case`sections`:return Py({count:t.done});case`blobs`:return qh({count:t.done});case`packing`:return Qd();case`reading`:return Fv({count:t.done});case`uploading`:return Ug({done:t.done,total:t.total??t.done});case`writing`:return rd({count:t.done})}}function wre(e,t){return e===null?t:`${e}-${t}`}var Tre=e=>{let{transform:t}=e;return{...t,y:0}};function Ere(e,t,n){let r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}var Dre=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:Ere(n,t,i)},Ore=e=>{let{transform:t}=e;return{...t,x:0}},_9=`project:none`,kre=e=>`project:${e}`,v9=`projhead:`,y9=e=>`${v9}${e}`,b9=`oc.noproject.collapsed`,x9=`oc.shared.collapsed`;function S9(){return(0,J.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,J.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}var C9=(0,q.createContext)(new Map);function Are({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=U(G.messages.listChats,{}),a=U(G.projects.listProjects,{}),o=U(G.me.getMe,{host:cT})?.ui?.effective?.showChatAge??!0,s=U(G.chatReads.myChatReads,{}),c=(0,q.useMemo)(()=>{let e=new Map;for(let t of s??[])e.set(t.chatId,t.lastSeenAt);return e},[s]),l=U(G.chatReads.myBusyChats,{}),d=(0,q.useMemo)(()=>new Set(l??[]),[l]),{byChat:f}=xS(l??null),p=U(G.agentRequests.pendingByChat,{}),m=(0,q.useMemo)(()=>{let e=new Map;for(let t of p??[])e.set(t.chatId,t.kinds.includes(`approval`)?`approval`:t.kinds.includes(`credential`)?`credential`:`question`);return e},[p]),h=U(G.chatBookmarks.myBookmarkedChats,{}),g=U(G.chatExport.referenceLabel,{}),_=(0,q.useMemo)(()=>new Set(h??[]),[h]),v=(0,q.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=c.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,c,e]),[y,b]=(0,q.useState)(0);(0,q.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>b(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let x=W(G.projects.createProject),S=W(G.projects.setProjectCollapsed),C=W(G.projects.setProjectSidebar),w=W(G.chats.reorderChat),T=W(G.projects.reorderProject),E=W(G.chats.moveChatToProject),D=uT(),O=gv(),k=(0,q.useRef)(null),A=(0,q.useRef)(null),j=(0,q.useRef)(null),[M,N]=(0,q.useState)(`full`);(0,q.useLayoutEffect)(()=>{let e=k.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=A.current?.offsetWidth??0,r=j.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;N(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[O,r]);let[P,F]=(0,q.useState)(null),I=(0,q.useRef)(!1);(0,q.useEffect)(()=>{!I.current&&i&&F(i)},[i]);let ee=P??i??[],L=ee.filter(e=>e.sidebarHidden!==!0),R=ee.filter(e=>e.sidebarHidden===!0),z=i===void 0&&P===null,[B,V]=(0,q.useState)(null),[te,ne]=(0,q.useState)(()=>localStorage.getItem(b9)===`1`),[re,ie]=(0,q.useState)(()=>localStorage.getItem(x9)===`1`);function ae(){ie(e=>(localStorage.setItem(x9,e?`0`:`1`),!e))}function oe(){ne(e=>(localStorage.setItem(b9,e?`0`:`1`),!e))}let se=M2();(0,q.useEffect)(()=>{if(!se?.expand)return;let e=L.find(e=>e._id===se.chatId);if(!e)return;let t=e.projectId??null;if(t===null){te&&(localStorage.setItem(b9,`0`),ne(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&S({projectId:t,collapsed:!1})},[se,L,a,te,S]);let ce=SS(FS(Uee,{activationConstraint:{distance:4}}),FS(Qee,{activationConstraint:{delay:250,tolerance:8}}),FS(DS,{coordinateGetter:TS})),le=(0,q.useRef)(!1),ue=()=>{le.current=!0,setTimeout(()=>{le.current=!1},0)},de=(0,q.useCallback)(e=>String(e.active.id).startsWith(v9)?IS({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(v9))}):IS(e),[]),fe=L.filter(e=>e.pinned),pe=L.filter(e=>!e.pinned&&e.role===`participant`),me=L.filter(e=>!e.pinned&&e.role!==`participant`),he=e=>me.filter(t=>(t.projectId??null)===e),ge=sS(),_e=(0,q.useMemo)(()=>Vee(a??[]),[a]),ve=(0,q.useMemo)(()=>_e.filter(e=>!e.sidebarHidden),[_e]),ye=(0,q.useMemo)(()=>_e.filter(e=>e.sidebarHidden),[_e]),be=(0,q.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,zee(e,t._id)]))},[a]),xe=(0,q.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),Se=e=>me.filter(t=>t.projectId!==null&&(be.get(t.projectId)??t.projectId)===e);function Ce(e){return L.find(t=>t._id===e)}async function we(e){V(null),ue();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(v9)){let e=r.slice(9),t=ve,n=null;if(i.startsWith(v9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==_9)n=i.slice(8);else{let e=Ce(i);n=e&&!e.pinned?e.projectId??null:null}if(n===null||n===e)return;let a=t.findIndex(t=>t._id===e),o=t.findIndex(e=>e._id===n);if(a<0||o<0)return;let s=[...t],[c]=s.splice(a,1);s.splice(o,0,c);let l=s[o-1]??null,u=s[o+1]??null;await T({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=Ce(r);if(!a||a.role===`participant`)return;if(i.startsWith(v9)){let e=i.slice(9);if((a.projectId??null)===e)return;I.current=!0,F(t=>(t??L).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await E({chatId:a._id,projectId:e})}finally{I.current=!1}return}if(i.startsWith(`project:`)){let e=i===_9?null:i.slice(8);if((a.projectId??null)===e)return;I.current=!0,F(t=>(t??L).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await E({chatId:a._id,projectId:e})}finally{I.current=!1}return}let o=Ce(i);if(!o||t.id===n.id)return;if((o.projectId??null)!==(a.projectId??null)||o.pinned!==a.pinned){if(a.pinned||o.pinned)return;I.current=!0,F(e=>(e??L).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await E({chatId:a._id,projectId:o.projectId??null})}finally{I.current=!1}return}let s=o.pinned?fe:he(o.projectId??null),c=s.map(e=>e._id),l=c.indexOf(a._id),u=c.indexOf(o._id);if(l<0||u<0)return;let d=[...s];d.splice(l,1),d.splice(u,0,a);let f=d[u-1]??null,p=d[u+1]??null;I.current=!0,F(e=>[...(e??L).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await w({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{I.current=!1}}let Te=g9(),Ee=Te?Cre(Te.state):null,[De,Oe]=(0,q.useState)(!1),ke=B?Ce(B):null;return(0,J.jsx)(C9.Provider,{value:m,children:(0,J.jsx)(mS.Provider,{value:f,children:(0,J.jsxs)(`aside`,{className:`oc-sidebar`+(De?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Oe(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Oe(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Oe(!1);let t=e.dataTransfer.files[0];t!==void 0&&Te?.importArchive(t,null)},children:[De?(0,J.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,J.jsx)(WC,{className:`size-4`}),(0,J.jsx)(`span`,{children:Tf()})]}):null,Ee===null?null:(0,J.jsxs)(`div`,{className:`oc-sidebar__transfer`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(`span`,{className:`oc-sidebar__transfer-spin`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-sidebar__transfer-label`,children:Ee})]}),(0,J.jsxs)(`div`,{className:`oc-sidebar__top`,ref:k,children:[(0,J.jsxs)(K,{className:M===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${O} (${r})`,"aria-label":O,children:[(0,J.jsx)(FC,{}),M===`icon`?null:(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:O}),M===`full`?(0,J.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,J.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,J.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:A,children:[(0,J.jsxs)(K,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,J.jsx)(FC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:O}),(0,J.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(hS,{})})]})}),(0,J.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,J.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:j,children:[(0,J.jsxs)(K,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,J.jsx)(FC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:O})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(hS,{})})]})}),(0,J.jsx)(K,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Cg(),title:Cg(),onClick:async()=>{let e=await D({title:Cg(),label:Ru(),placeholder:xm(),confirmLabel:U_()});e&&await x({name:e})},children:(0,J.jsx)(hS,{})})]}),(0,J.jsxs)(kS,{sensors:ce,collisionDetection:de,modifiers:[Ore,Dre],onDragStart:e=>V(String(e.active.id)),onDragCancel:()=>{V(null),ue()},onDragEnd:we,children:[(0,J.jsx)(`div`,{className:`oc-sidebar__scroll`,children:z?(0,J.jsx)(S9,{}):(0,J.jsxs)(J.Fragment,{children:[fe.length>0?(0,J.jsx)(w9,{label:Oee(),chats:fe,children:fe.map(n=>(0,J.jsx)(T9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:d.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:le,onSelect:t},n._id))}):null,(0,J.jsx)(PS,{items:ve.map(e=>y9(e._id)),strategy:jS,children:ve.map(n=>{let r=Se(n._id);return(0,J.jsx)(w9,{label:n.name,dropId:kre(n._id),sortId:y9(n._id),suppressClick:le,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>d.has(e._id)),unread:r.some(e=>v.has(e._id)),onToggle:()=>void S({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void ge({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,J.jsx)(`div`,{className:`oc-sidebar__empty`,children:Uv()}):r.map(r=>(0,J.jsx)(T9,{chat:r,active:r._id===e,unread:v.has(r._id),busy:d.has(r._id),bookmarked:_.has(r._id),referenceLabel:g,domainLabel:r.projectId!==null&&r.projectId!==n._id?xe.get(r.projectId)??null:null,ageTick:y,suppressClick:le,onSelect:t},r._id))},n._id)})}),ye.length>0?(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,children:[(0,J.jsx)(yC,{className:`size-3.5`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:Pr({count:ye.length})})]})}),(0,J.jsx)(cC,{align:`start`,className:`w-56`,children:ye.map(e=>(0,J.jsxs)(dC,{onSelect:()=>void C({projectId:e._id,hidden:!1}),children:[(0,J.jsx)(yS,{}),` `,e.name]},e._id))})]}):null,pe.length>0||R.length>0?(0,J.jsxs)(w9,{label:nh(),chats:pe,collapsible:!0,collapsed:re,busy:pe.some(e=>d.has(e._id)),unread:pe.some(e=>v.has(e._id)),onToggle:ae,children:[re?null:pe.map(n=>(0,J.jsx)(T9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:d.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:le,onSelect:t},n._id)),!re&&R.length>0?(0,J.jsx)(jre,{chats:R}):null]}):null,(0,J.jsx)(w9,{label:Mf(),dropId:_9,chats:he(null),collapsible:!0,collapsed:te,busy:he(null).some(e=>d.has(e._id)),unread:he(null).some(e=>v.has(e._id)),onToggle:oe,children:te?null:he(null).map(n=>(0,J.jsx)(T9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:d.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:le,onSelect:t},n._id))})]})}),(0,J.jsxs)(Kee,{children:[B?.startsWith(v9)?(()=>{let e=(a??[]).find(e=>y9(e._id)===B);return e?(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":AS(e)},children:[(0,J.jsx)(KS,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,J.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,ke?(0,J.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[wS(ke.color)?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:wS(ke.color)}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsx)(`span`,{className:`oc-chatitem__label`,children:ke.title||u()})]}):null]})]})]})})})}function w9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:l,unread:u,onToggle:f,onOpen:p,children:m}){let h=W(G.projects.setProjectSidebar),g=g9(),_=(0,q.useContext)(mS),v=o.map(e=>_.get(e._id)).find(e=>e!==void 0)??null,y=W(G.projects.deleteProject),b=W(G.projects.renameProject),x=W(G.projects.setProjectColor),S=W(G.projects.moveProject),C=lT(),w=RT(),[T,E]=(0,q.useState)(!1),[D,O]=(0,q.useState)(e),[k,A]=(0,q.useState)(!1),j=U(G.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:M,isOver:N}=Iee({id:t??`static:${e}`}),F=ES({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:I,...ee}=F.listeners??{},L=p??f,R=e=>{e.target===e.currentTarget&&s&&L&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),L())},z=a?AS(a):null;return(0,J.jsxs)(`div`,{ref:e=>{t&&M(e),n&&F.setNodeRef(e)},className:`oc-sidebar__group`+(N?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...z?{"--proj-hue":z}:{},...n?{transform:pS.Transform.toString(F.transform),transition:F.transition,opacity:F.isDragging?.35:1}:{}},children:[(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head group/head`+(s?` oc-sidebar__group-head--btn`:``),title:c&&l&&v?bS(v):void 0,...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||L?.()},onKeyDown:R}:{},...n?ee:{},children:[s?p?(0,J.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn`,"aria-label":c?P():sh(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&f?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,J.jsx)(JS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(KS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,J.jsx)(JS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(KS,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):null,(0,J.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,J.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":ym(),onClick:e=>e.stopPropagation(),...F.attributes,onKeyDown:I,children:(0,J.jsx)(FA,{className:`size-3.5`})}):null,c&&l?(0,J.jsx)(`span`,{className:_S(v,po()).className,title:_S(v,po()).label,"aria-label":_S(v,po()).label}):null,c&&u?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:Gr(),"aria-label":Gr()}):null,i?(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":Qc(),className:`oc-sidebar__group-menu opacity-0 group-hover/head:opacity-100 group-focus-within/head:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(rC,{})})}),(0,J.jsxs)(cC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[p?(0,J.jsxs)(dC,{onSelect:()=>p(),children:[(0,J.jsx)(yS,{}),` `,pe()]}):null,(0,J.jsxs)(dC,{onSelect:()=>{O(e),E(!0)},children:[(0,J.jsx)(PC,{}),` `,rg()]}),(0,J.jsxs)(dC,{onSelect:()=>A(!0),children:[(0,J.jsx)(hS,{}),` `,qg()]}),a!==void 0&&a.parentId===null?(0,J.jsxs)(dC,{onSelect:()=>void h({projectId:a._id,hidden:!0}),children:[(0,J.jsx)(yC,{}),` `,wx()]}):null,g&&a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(dC,{disabled:g.state.running,onSelect:()=>g.exportFolder(a._id,e),children:[(0,J.jsx)(vC,{}),` `,p_()]}),(0,J.jsxs)(dC,{disabled:g.state.running,onSelect:()=>g.pickAndImport(a._id),children:[(0,J.jsx)(WC,{}),` `,yp()]})]}):null,(0,J.jsx)(aC,{children:d()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void x({projectId:i,color:null}),"aria-label":mo(),children:`✕`}),OS.map(e=>(0,J.jsx)(`button`,{className:`oc-colorgrid__dot`+(a?.color===e.value?` is-selected`:``),style:{background:e.hue},"aria-label":e.value,onClick:()=>void x({projectId:i,color:e.value})},e.value))]}),(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=j?.folders??0,n=j?.chats??0;await C({title:Ws({name:e}),description:zT({folders:t,chats:n,days:w}),confirmWord:Iu(),confirmLabel:jc(),destructive:!0})&&await y({projectId:i})})},children:[(0,J.jsx)(HC,{}),` `,Iu()]})]})]}):null]}),(0,J.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,J.jsx)(PS,{items:o.map(e=>e._id),strategy:jS,children:m})}),i?(0,J.jsx)(vT,{open:T,onOpenChange:E,title:Sl(),canSubmit:D.trim().length>0,onSubmit:async()=>{await b({projectId:i,name:D.trim()}),E(!1)},children:(0,J.jsx)(`div`,{className:`oc-form`,children:(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Xp()}),(0,J.jsx)(vw,{value:D,onChange:e=>O(e.target.value),autoFocus:!0})]})})}):null,i&&k?(0,J.jsx)(NS,{open:k,onOpenChange:A,title:rf(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void S({projectId:i,parentId:e})}):null]})}var T9=(0,q.memo)(function({chat:e,active:t,unread:n,busy:r,bookmarked:i,referenceLabel:a,domainLabel:o,suppressClick:s,onSelect:c}){let l=(0,q.useContext)(C9).get(e._id),f=(0,q.useContext)(mS).get(e._id)??null,p=g9(),{attributes:m,listeners:h,setNodeRef:g,transform:_,transition:v,isDragging:y}=ES({id:e._id}),{onKeyDown:b,...x}=h??{},S=W(G.chats.renameChat),C=kw(),w=()=>{if(a===void 0)return;let t=wre(a,e._id);navigator.clipboard.writeText(t).then(()=>C.success(Pee({reference:t})),()=>C.error(Zv()))},T=W(G.chats.deleteChat),E=W(G.chats.pinChat),D=W(G.chats.setChatColor),O=W(G.chats.moveChatToProject),k=W(G.chats.setChatSidebar),A=W(G.chatParticipants.leaveChat),j=e.role===`participant`,M=sS(),[N,P]=(0,q.useState)(!1),F=U(G.me.getMe,{host:cT})?.ui?.effective?.showChatAge??!0,I=lT(),ee=RT(),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(e.title??``),V=M2()?.chatId===e._id,te=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!V)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;te.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>j2(e._id),2600);return()=>clearTimeout(n)},[V,e._id]);let ne={transform:pS.Transform.toString(_),transition:v,opacity:+!y},re=wS(e.color);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{ref:e=>{g(e),te.current=e},style:ne,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(V?` oc-chatitem--flash`:``),title:r&&f?bS(f):void 0,onClick:()=>{s.current||c(e._id)},...x,onAnimationEnd:t=>{V&&t.animationName===`oc-chatitem-flash`&&j2(e._id)},children:[(0,J.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":ym(),onClick:e=>e.stopPropagation(),...m,onKeyDown:b,children:(0,J.jsx)(FA,{className:`size-3.5`})}),re?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:re}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsxs)(`button`,{className:`oc-chatitem__label`,onClick:t=>{t.stopPropagation(),!s.current&&c(e._id)},children:[(0,J.jsxs)(`span`,{className:`oc-chatitem__title`,children:[e.group?(0,J.jsx)(VC,{className:`oc-chatitem__group`,size:12,"aria-label":ht()}):null,e.title||u()]}),e.role===`participant`&&e.ownerName?(0,J.jsx)(`span`,{className:`oc-chatitem__domain`,children:Ia({name:e.ownerName})}):o?(0,J.jsx)(`span`,{className:`oc-chatitem__domain`,children:o}):null]}),l===void 0?null:(0,J.jsx)(`span`,{className:`oc-areq-sidebadge oc-areq-sidebadge--${l}`,title:Vh(),"aria-label":Vh(),children:l===`approval`?(0,J.jsx)(RC,{size:11,"aria-hidden":!0}):l===`credential`?(0,J.jsx)(HA,{size:11,"aria-hidden":!0}):(0,J.jsx)(QA,{size:11,"aria-hidden":!0})}),r?(0,J.jsx)(`span`,{className:_S(f,Wl()).className,title:_S(f,Wl()).label,"aria-label":_S(f,Wl()).label}):null,n?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:Gr(),"aria-label":Gr()}):null,e.readOnly?(0,J.jsx)(`span`,{className:`oc-chatitem__readonly`,title:dn(),children:(0,J.jsx)(DC,{size:12,"aria-label":dn()})}):null,i?(0,J.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Ku(),children:(0,J.jsx)(mA,{size:12,"aria-label":Ku()})}):null,F?(0,J.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Uw(e.updatedAt),children:Yee(e.updatedAt,Date.now())}):null,(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":V_(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(rC,{})})}),(0,J.jsxs)(cC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[j?null:(0,J.jsxs)(dC,{onSelect:()=>{B(e.title??``),R(!0)},children:[(0,J.jsx)(PC,{}),` `,rg()]}),p&&!j?(0,J.jsxs)(dC,{disabled:p.state.running,onSelect:()=>p.exportChat(e._id,e.title??Mf()),children:[(0,J.jsx)(vC,{}),` `,xee()]}):null,(0,J.jsxs)(dC,{onSelect:()=>void E({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,J.jsx)(LS,{}):(0,J.jsx)(fS,{}),e.pinned?Bv():kf()]}),j?null:(0,J.jsx)(lre,{chatId:e._id}),j?null:(0,J.jsxs)(dC,{onSelect:w,disabled:a===void 0,children:[(0,J.jsx)(GA,{}),` `,Z_()]}),j?null:(0,J.jsxs)(dC,{onSelect:()=>P(!0),children:[(0,J.jsx)(yS,{}),` `,Qh()]}),e.projectId===null?null:(0,J.jsxs)(dC,{onSelect:()=>void M({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,J.jsx)(MA,{}),` `,$i()]}),e.pinned?null:(0,J.jsxs)(dC,{onSelect:()=>void k({chatId:e._id,hidden:!0}),children:[(0,J.jsx)(CS,{}),` `,wx()]}),j?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{variant:`destructive`,onSelect:()=>void A({chatId:e._id}),children:[(0,J.jsx)(YA,{}),` `,Rx()]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aC,{children:d()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void D({chatId:e._id,color:null}),"aria-label":mo(),children:`✕`}),OS.map(t=>(0,J.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void D({chatId:e._id,color:t.value})},t.value))]}),(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await I({title:Gl(),description:$c({days:ee}),confirmLabel:Iu(),destructive:!0})&&await T({chatId:e._id})})},children:[(0,J.jsx)(HC,{}),` `,Iu()]})]})]})]})]}),(0,J.jsx)(vT,{open:L,onOpenChange:R,title:Tp(),canSubmit:z.trim().length>0,onSubmit:async()=>{await S({chatId:e._id,title:z.trim()}),R(!1)},children:(0,J.jsx)(`div`,{className:`oc-form`,children:(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Xp()}),(0,J.jsx)(vw,{value:z,onChange:e=>B(e.target.value),autoFocus:!0})]})})}),N?(0,J.jsx)(NS,{open:N,onOpenChange:P,title:$f(),currentId:e.projectId,onPick:t=>void O({chatId:e._id,projectId:t})}):null]})});function jre({chats:e}){let[t,n]=(0,q.useState)(!1),r=W(G.chats.setChatSidebar);return(0,J.jsxs)(`div`,{className:`oc-hiddenshared`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-hiddenshared__toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,J.jsx)(KS,{size:12,"aria-hidden":!0}):(0,J.jsx)(JS,{size:12,"aria-hidden":!0}),se({count:e.length})]}),t?(0,J.jsx)(`ul`,{className:`oc-hiddenshared__list`,children:e.map(e=>(0,J.jsxs)(`li`,{className:`oc-hiddenshared__row`,children:[(0,J.jsx)(`span`,{className:`oc-hiddenshared__title`,children:e.title??Mf()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-hiddenshared__show`,onClick:()=>void r({chatId:e._id,hidden:!1}),children:Ch()})]},e._id))}):null]})}var E9=null,D9=0,Mre=400;function Nre(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!E9)try{E9=new e}catch{return null}return E9}function O9(e,t,n,r,i){let a=e.createOscillator(),o=e.createGain();a.type=`sine`,a.frequency.value=t;let s=e.currentTime+n;o.gain.setValueAtTime(1e-4,s),o.gain.linearRampToValueAtTime(i,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,s+r),a.connect(o).connect(e.destination),a.start(s),a.stop(s+r+.02)}function k9(e){let t=Date.now();if(t-D9<Mre)return;let n=Nre();if(!n)return;D9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function Pre(){k9(e=>{O9(e,660,0,.16,.12),O9(e,440,.14,.2,.1)})}function Fre(){k9(e=>{O9(e,880,0,.14,.08)})}function Ire({activeChatId:e}){let t=U(G.messages.listChats,{}),n=W(G.chatReads.markChatSeen),r=U(G.me.getMe,{host:cT}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,q.useRef)(null),s=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!t)return;s.current!==String(a)&&(s.current=String(a),o.current=null);let r=new Map;for(let e of t)e.lastAssistantAt!==null&&r.set(e._id,e.lastAssistantAt);let c=o.current;if(o.current=r,c===null)return;let l=!1;for(let[t,i]of r){let r=c.get(t);r!==void 0&&i<=r||r===void 0&&Date.now()-i>3e4||(l=!0,t===e&&document.visibilityState===`visible`?n({chatId:t}):t!==e&&A2(t))}l&&i&&Fre()},[t,e,i,n,a]),(0,q.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,q.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}var A9=[`admin`,`user`,`pending`];function j9(){let e=U(G.me.authProviders)?.anonymous===!0,[t,n]=(0,q.useState)(!1),r=U(G.dev.listUsersDev,e?{}:`skip`),i=U(G.me.getImpersonation),a=W(G.dev.setMyRole),o=W(G.dev.setRole),s=W(G.admin.startImpersonation),c=W(G.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:Mb(),children:[(0,J.jsx)(Tj,{size:13}),`DEV`]}),(0,J.jsx)(Xw,{open:t,onOpenChange:n,children:(0,J.jsxs)(qw,{children:[(0,J.jsxs)(Gw,{children:[(0,J.jsx)(Jw,{children:ud()}),(0,J.jsx)(Yw,{children:tx()})]}),(0,J.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,J.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[Hy({canonical:l?.canonical??`…`}),` `,(0,J.jsx)(jw,{variant:`outline`,children:l?.role??`…`})]}),(0,J.jsx)(`div`,{className:`oc-devsw__roles`,children:A9.map(e=>(0,J.jsx)(K,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?mu():e===`user`?Op():Qp()},e))})]}),d?(0,J.jsxs)(`div`,{className:`oc-devsw__imp`,children:[oee(),` `,(0,J.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,J.jsx)(K,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Zg()})]}):null,(0,J.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,J.jsx)(`p`,{className:`oc-devsw__empty`,children:rp()}):f.map(e=>(0,J.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,J.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,J.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:A9.map(e=>(0,J.jsx)(`option`,{value:e,children:e},e))}),(0,J.jsx)(K,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?gy():Ah():cf(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:Pd()})]},e.profileId))})]})})]})}var M9=`atrium.authelia-login`;function Lre(e){let t=new URL(e.href);if(t.origin!==e.origin)throw Error(`Invalid login return origin.`);for(let e of[`code`,`state`,`error`,`error_description`])t.searchParams.delete(e);return`${t.pathname}${t.search}${t.hash}`}function Rre(e,t){let n;return{start(r,i=!1){if(n)return n;try{let t=e.getItem(M9);if(!i&&t!==null)return Promise.resolve(t===`signed-out`?`signed-out`:`failed`);e.setItem(M9,`attempted`)}catch{return Promise.resolve(`failed`)}return n=(async()=>{try{let e=await r(`authelia`,{redirectTo:t()});return e.redirect||e.signingIn?`redirecting`:`failed`}catch{return`failed`}})().finally(()=>{n=void 0}),n},signedOut(){try{e.setItem(M9,`signed-out`)}catch{}},authenticated(){try{e.removeItem(M9)}catch{}}}}var N9;function P9(){return N9??=Rre({getItem:e=>window.sessionStorage.getItem(e),setItem:(e,t)=>window.sessionStorage.setItem(e,t),removeItem:e=>window.sessionStorage.removeItem(e)},()=>Lre(window.location)),N9}function F9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=IE();async function i(){P9().signedOut(),await r()}let a=W(G.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(G.me.getMe,{host:cT});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(G.me.getMe,{host:cT},{...n,themeMode:t,resolvedThemeMode:r})}),o=t??`default`;return(0,J.jsxs)(pC,{children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsxs)(K,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,J.jsx)(KS,{className:`opacity-60`})]})}),(0,J.jsx)(cC,{align:`end`,className:`w-52`,children:n?(0,J.jsxs)(dC,{onClick:()=>void i(),children:[(0,J.jsx)(YA,{}),` `,Xa()]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(aC,{children:Ax()}),(0,J.jsxs)($S,{value:o,onValueChange:e=>void a({mode:e==="default"?null:e}),children:[(0,J.jsxs)(lC,{value:`light`,children:[(0,J.jsx)(xj,{}),` `,Bo()]}),(0,J.jsxs)(lC,{value:`dark`,children:[(0,J.jsx)(nj,{}),` `,_i()]}),(0,J.jsxs)(lC,{value:`system`,children:[(0,J.jsx)(tj,{}),` `,rr()]}),(0,J.jsx)(lC,{value:`default`,children:Jt()})]}),(0,J.jsx)(fC,{}),(0,J.jsxs)(dC,{onClick:()=>void i(),children:[(0,J.jsx)(YA,{}),` `,Xa()]})]})})]})}function zre({providers:e,children:t}){return e===void 0?(0,J.jsx)(`div`,{className:`oc-boot`,children:Hb()}):e.autheliaOnly?(0,J.jsx)(Vre,{enabled:e.authelia}):t}function Bre({state:e,retry:t}){return(0,J.jsx)(`div`,{className:`oc-signin`,children:(0,J.jsxs)(`div`,{className:`oc-signin__card`,role:`status`,"aria-live":`polite`,children:[(0,J.jsx)(`p`,{className:`oc-signin__subtitle`,children:e===`redirecting`?lm():e===`signed-out`?hee():e===`unavailable`?bf():c_()}),e===`failed`||e===`signed-out`?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider`,onClick:t,children:Bp()}):null]})})}function Vre({enabled:e}){let{signIn:t}=IE(),[n,r]=(0,q.useState)(e?`redirecting`:`unavailable`);return(0,q.useEffect)(()=>{let n=!0;return e?P9().start(t).then(e=>{n&&r(e)}):r(`unavailable`),()=>{n=!1}},[e,t]),(0,J.jsx)(Bre,{state:n,retry:()=>{r(`redirecting`),P9().start(t,!0).then(r)}})}var Hre={altered_words:()=>ip(),incorrect:()=>lf(),incoherence:()=>_y(),formatting:()=>jh(),latency:()=>Fd(),api_error:()=>_v(),other:()=>wg()},I9=e=>Hre[e]?.()??e,Ure={anomaly_open:UC,anomaly_resolved:XS,feedback_reply:gS,feedback_resolved:gS,feedback_new:gS,curation:OA,operator_announcement:ZA,mention:dA,agent_request:QA,chat_added:VC,group_invite:zC},Wre={atrium:()=>Dd(),assistants:()=>yx(),platform:()=>ob()},Gre={investigating:()=>Nu(),monitoring:()=>Kp(),resolved:()=>gm()},L9=e=>(e?Wre[e]:void 0)?.()??`?`,Kre=e=>(e?Gre[e]:void 0)?.()??`?`,R9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(Ln()):`?`},qre={notif_feedback_reply_admin:()=>({title:kp(),body:$p()}),notif_feedback_reply:()=>({title:kp(),body:$p()}),notif_feedback_resolved:()=>({title:k_(),body:ei()}),notif_feedback_new:e=>({title:see(),body:Qg({reference:e.reference??`?`,category:I9(e.category??`other`)})}),notif_mention:e=>({title:De(),body:qi({chat:e.chat??``})}),notif_chat_added:e=>({title:zx({by:e.by??`?`}),body:qi({chat:e.chat??``})}),notif_group_invite_request:e=>({title:Yo(),body:Di({by:e.by??`?`,group:e.group??`?`})}),notif_group_invite_approved:e=>({title:pr(),body:nn({email:e.email??`?`,group:e.group??`?`})}),notif_group_invite_rejected:e=>({title:io(),body:ma({email:e.email??`?`,group:e.group??`?`})}),notif_agent_request_question:e=>({title:Kd(),body:Yu({chat:e.chat??``})}),notif_agent_request_approval:e=>({title:Ov(),body:Yu({chat:e.chat??``})}),notif_agent_request_credential:e=>({title:Ig(),body:Yu({chat:e.chat??``})}),notif_curation_proposed:e=>({title:Kc(),body:ic({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:Kn(),body:wc({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:ke(),body:Vx({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Zo({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:ki({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:La(),body:gt({service:L9(e.service),startsAt:R9(e.starts_at),endsAt:R9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:Ft(),body:Rs({service:L9(e.service),completedAt:R9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Tb(),body:Je({service:L9(e.service),status:Kre(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:_s(),body:Jb({plan:e.plan??`?`,effectiveAt:R9(e.effective_at)})})};function z9(e){let t=e.messageKey?qre[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:kp(),body:$p()}:e.kind===`feedback_resolved`?{title:k_(),body:ei()}:{title:e.title,body:e.body}}function Jre(){let e=U(G.notifications.myUnreadCount)??0,t=U(G.notifications.myNotifications),n=U(G.feedback.myFeedback),r=W(G.notifications.markRead),i=W(G.notifications.markAllRead),a=W(G.notifications.clearOne),o=W(G.notifications.clearAll),s=W(G.feedback.closeMyFeedback),c=sS(),[l,u]=(0,q.useState)(!1),d=U(G.me.getMe,{host:cT}),f=d?.ui?.effective?.notifSound===!0,p=d?.ui?.effective?.notifSystem===!0,m=d?.userId??null,h=(0,q.useRef)(null),g=(0,q.useRef)(0),_=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!t)return;_.current!==String(m)&&(_.current=String(m),h.current=null,g.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(h.current===null){h.current=new Set(t.map(e=>String(e._id))),g.current=e;return}let n=h.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>g.current);for(let e of t)n.add(String(e._id));if(g.current=Math.max(g.current,e),n.size>500){let e=new Set(t.map(e=>String(e._id)));for(let t of n)e.has(t)||n.delete(t)}if(r.length!==0&&(f&&Pre(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=z9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,f,p,m]);let v=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(u(!1),e.href.startsWith(`/chat/`)){c({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);c({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,J.jsxs)(pC,{open:l,onOpenChange:u,children:[(0,J.jsx)(eC,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?Wt({count:e}):Ka(),children:[(0,J.jsx)(fA,{size:18,"aria-hidden":!0}),e>0?(0,J.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,J.jsxs)(cC,{align:`end`,className:`oc-notif`,children:[(0,J.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,J.jsx)(`span`,{children:ra()}),t&&t.length>0?(0,J.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:Li()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Km()})]}):null]}),t===void 0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:ye()}):t.length===0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:R()}):(0,J.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=Ure[e.kind]??fA,{title:n,body:i}=z9(e);return(0,J.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>v(e):void 0,children:[(0,J.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,J.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,J.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,J.jsx)(`button`,{type:`button`,title:fh(),"aria-label":fh(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,J.jsx)(GS,{size:13})}):null,(0,J.jsx)(`button`,{type:`button`,title:Ta(),"aria-label":Ta(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,J.jsx)(qC,{size:13})})]})]}),(0,J.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,J.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(Ln())})]},e._id)})}),n&&n.length>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:it()}),(0,J.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,J.jsx)(Yre,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function Yre({it:e,onClose:t,onNavigate:n}){let r=kw(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``),[u,d]=(0,q.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(dd(),e)}finally{d(!1)}}return(0,J.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,J.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,J.jsx)(`span`,{className:`oc-notif__title`,children:I9(e.category)}),(0,J.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?sl():e.answered?wt():Es()})]}),(0,J.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(Ln())}),e.thread.length>0?(0,J.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?pb():e.authorRole===`agent`?xo():Ie()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,J.jsx)(KS,{size:13,"aria-hidden":!0}):(0,J.jsx)(JS,{size:13,"aria-hidden":!0}),Nb()]}),i?(0,J.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,J.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,J.jsx)(Lk,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:is()}),o?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:dd()})]}),o?(0,J.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,J.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:nx()}),(0,J.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:Uy()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:hu()})]})]}):null]})}var B9=2,Xre=180;function Zre(){let e=sS(),t=(0,q.useRef)(null),n=(0,q.useRef)(null),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)(``),[u,d]=(0,q.useState)(0),f=(0,q.useMemo)(()=>xw(Dw,bw()),[]);(0,q.useEffect)(()=>{let e=setTimeout(()=>c(a),Xre);return()=>clearTimeout(e)},[a]);let p=s.trim(),m=U(G.search.searchConversations,p.length>=B9?{query:p}:`skip`),h=m??[],g=p.length>=B9&&m===void 0;(0,q.useEffect)(()=>{let e=e=>{Cw(e,Dw)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,q.useEffect)(()=>{r&&(o(``),c(``),d(0))},[r]),(0,q.useEffect)(()=>{d(0)},[m]),(0,q.useEffect)(()=>{(n.current?.querySelector(`[data-index="${u}"]`))?.scrollIntoView({block:`nearest`})},[u]);let _=(0,q.useCallback)((t,n)=>{i(!1),n&&a.trim()&&Lee(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":Xf(),children:[(0,J.jsx)(gC,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-search-trigger__label`,children:l()}),(0,J.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:f})]}),(0,J.jsx)(Xw,{open:r,onOpenChange:i,children:(0,J.jsxs)(qw,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,J.jsx)(Jw,{className:`sr-only`,children:fo()}),(0,J.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,J.jsx)(gC,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,J.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),d(e=>Math.min(e+1,h.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),d(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=h[u];t&&_(t.chatId,t.messageId)}},placeholder:Ul(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":Zc()})]}),(0,J.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:p.length<B9?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:xl({count:B9})}):g?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:br()}):h.length===0?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:y_({term:p})}):h.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===u,className:z_(`oc-search-result`,t===u&&`is-active`),onMouseMove:()=>d(t),onClick:()=>_(e.chatId,e.messageId),children:[(0,J.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,J.jsx)(IA,{size:15}):(0,J.jsx)(gS,{size:15})}),(0,J.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,J.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||Wr()}),e.projectPath&&e.projectPath.length>0?(0,J.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":Yp(),children:e.projectPath.join(` › `)}):null,e.snippet?(0,J.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,J.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?un():Ac()})]},e.chatId))}),(0,J.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↑`}),(0,J.jsx)(`kbd`,{children:`↓`}),` `,Us()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↵`}),` `,jn()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:lc()}),` `,fe()]})]})]})})]})}var V9=[{id:`personal`,label:()=>Ly(),tabs:[`preferences`,`theme`,`files`,`scheduled`,`deletedChats`]},{id:`agents`,label:()=>Xh(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>tf(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`,`trash`]},{id:`observability`,label:()=>Rv(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],Qre=new Map(V9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function H9(e){let t=Qre.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function $re(e,t){return e.find(e=>H9(e)===t)}V9.flatMap(e=>[...e.tabs]);function eie(){let e=U(G.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.gatewaysUnreachable??0,n=e.known?e.available?t>0?`warn`:`ok`:`error`:`idle`,r=e.known?e.available?t>0?px({count:t}):`${Yh()}${e.checkedAt?ef({time:Vw(e.checkedAt)}):``}`:Lv({reason:e.reason??`?`}):Iy();return(0,J.jsx)(XC,{delayDuration:150,children:(0,J.jsxs)(ZC,{children:[(0,J.jsx)(JC,{asChild:!0,children:(0,J.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,J.jsx)(YC,{children:r})]})})}function U9(e){let t=new Set(HT),n=new Set,r=[];for(let i of e??[])t.has(i)&&!n.has(i)&&(r.push(i),n.add(i));for(let e of HT)n.has(e)||r.push(e);return r}function tie(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function nie({tab:e,active:t}){let n=BT[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,J.jsx)(eie,{}):null]});return WT.includes(e)?(0,J.jsx)(Lk,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,J.jsx)(Lk,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function rie({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=ES({id:e});return(0,J.jsxs)(`div`,{ref:i,style:{transform:pS.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":wee(),...n,...r,children:(0,J.jsx)(FA,{size:14,"aria-hidden":!0})}),(0,J.jsx)(nie,{tab:e,active:t})]})}function iie(){let e=U(G.me.getMe,{host:cT}),t=W(G.me.setSettingsTabOrder),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:H9(n),i=(0,q.useMemo)(()=>U9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,q.useState)(i);(0,q.useEffect)(()=>o(i),[i]);let s=(0,q.useMemo)(()=>new Set(UT(e?.permissions??[])),[e?.permissions]),c=(0,q.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&H9(e)===r),[a,s,r]),l=SS(FS(Zee,{activationConstraint:{distance:5}}),FS(DS,{coordinateGetter:TS}));if(r===void 0||c.length===0)return null;let u=V9.find(e=>e.id===r);function d(e){let{active:n,over:r}=e;if(!r||n.id===r.id)return;let i=c.indexOf(n.id),s=c.indexOf(r.id);if(i<0||s<0)return;let l=tie(a,Gee(c,i,s));o(l),t({order:l})}return(0,J.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,J.jsx)(kS,{sensors:l,collisionDetection:Wee,modifiers:[Tre],onDragEnd:d,children:(0,J.jsx)(PS,{items:c,strategy:Jee,children:c.map(e=>(0,J.jsx)(rie,{tab:e,active:e===n},e))})})})}function aie(){let e=U(G.me.getMe,{host:cT}),t=sS(),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:H9(n),i=(0,q.useMemo)(()=>new Set(UT(e?.permissions??[])),[e?.permissions]),a=(0,q.useMemo)(()=>U9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=V9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=$re(a,e.id);n&&t({to:KT(n)})}return(0,J.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":g_(),children:[(0,J.jsx)(Lk,{to:`/`,className:`oc-settings-nav__back`,children:xp()}),(0,J.jsx)(`div`,{className:`oc-settings-nav__title`,children:Df()}),(0,J.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,J.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var oie=`trash`,sie=`deletedChats`;function cie(){throw ID({to:`/settings/$tab`,params:{tab:sie},replace:!0})}var W9=`oc.theme`;function G9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function K9(e){(0,q.useEffect)(()=>{let t=e??localStorage.getItem(W9)??`system`;if(localStorage.setItem(W9,t),G9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>G9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function lie(e){(0,q.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=Ln()}catch{t=void 0}t!==e&&Xs(e)},[e])}var uie=(0,q.lazy)(()=>Bw(()=>import(`./RolesTab-DU0g4d-R.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]))),die=(0,q.lazy)(()=>Bw(()=>import(`./InstancesTab-BevtM68H.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([23,3,4,24,25,26,7,27,28,8,29,9,30,31,6,32,33,10,11,12,13,14,15,19,18,16,17,20,21,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56]))),fie=(0,q.lazy)(()=>Bw(()=>import(`./PromptInjectionsTab-Vdb1lF36.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([57,3,4,24,25,26,7,27,28,8,29,9,30,31,6,10,13,14,50,58,59]))),pie=(0,q.lazy)(()=>Bw(()=>import(`./GroupsTab-Io16XZHz.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([60,3,4,61,44,6,7,8,9,46,62,63,14,26,27,28,29,48,38,10,11,12,13,15,19,18,50,16,17,20,21,34,51,52,53,54,33,49,35,36,37,39,40,41,64]))),mie=(0,q.lazy)(()=>Bw(()=>import(`./IntegrationsTab-DMY6VTUC.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([65,3,4,6,7,8,9,26,27,28,29,10,11,12,15]))),hie=(0,q.lazy)(()=>Bw(()=>import(`./FeedbacksTab-6URuFdfg.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([66,3,4,10,12,49,16,17,18,11,19,14,35,27,28,36,37,29,9,38,6,7,8,39,40,41]))),gie=(0,q.lazy)(()=>Bw(()=>import(`./SubAgentReportsTab-D9rclslo.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([67,3,4,10,12,49,16,17,18,11,19,14,35,27,28,36,37,29,9,38,6,7,8,39,40,41]))),_ie=(0,q.lazy)(()=>Bw(()=>import(`./TrashTab-BMSJ7ANC.js`).then(e=>({default:e.TrashTab})),__vite__mapDeps([68,3,4,69,40,10,12,13,14,49,16,17,18,11,19,70,71,72,53,73]))),vie=(0,q.lazy)(()=>Bw(()=>import(`./DeletedChatsTab-COYSFkNf.js`).then(e=>({default:e.DeletedChatsTab})),__vite__mapDeps([74,3,4,69,10,12,16,17,18,11,19,14,71,72,53,40,49,73]))),yie=(0,q.lazy)(()=>Bw(()=>import(`./FilesTab-esMtHJXt.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([75,3,4,37,27,29,9,38,76,6,7,8,53,40,26,28,17,18,10,12,13,14,15,41]))),bie=(0,q.lazy)(()=>Bw(()=>import(`./ScheduledTab-B6gWc0HN.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([77,3,4,61,44,78,21,79,80,53,40,26,7,27,28,8,29,9,17,18,10,32,33,11,12,13,14,15,19,50,41,51,52,54,49,81,36,59]))),xie=(0,q.lazy)(()=>Bw(()=>import(`./AgentFilesTab-C3CUT4Ep.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([82,3,4,47,26,7,27,28,8,29,9,17,18,10,12,13,14,15,19,50,83,31,55,59]))),Sie=(0,q.lazy)(()=>Bw(()=>import(`./PreferencesTab-DJ9p401L.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([84,3,4,6,7,8,9,26,27,28,29,10,11,12,85,50,13,14,15,58,30,81,36,32,33,59]))),Cie=(0,q.lazy)(()=>Bw(()=>import(`./ChatDefaultsTab-D0d9yEow.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([86,3,4,69,6,7,8,9,47,26,27,28,29,10,11,12,87,21,53,83,55,59]))),wie=(0,q.lazy)(()=>Bw(()=>import(`./AccessTab-JmFp20Kp.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([88,3,4,26,7,27,28,8,29,9,12,15]))),Tie=(0,q.lazy)(()=>Bw(()=>import(`./ThemeShowroom-N4qzUtlq.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([89,3,4,7,37,27,29,9,38,76,6,8,90,14,26,28,10,11,12,15,50,58,30,91,41,54,52,33,49,51,53,92,39])));function Eie(){let{isAuthenticated:e}=iE();return(0,q.useEffect)(()=>{e&&P9().authenticated()},[e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(uE,{children:(0,J.jsx)(`div`,{className:`oc-boot`,children:Hb()})}),(0,J.jsx)(lE,{children:(0,J.jsx)(Oie,{})}),(0,J.jsx)(cE,{children:(0,J.jsx)(Aw,{children:(0,J.jsx)(Sre,{children:(0,J.jsx)(Aie,{})})})})]})}function Die(){return(0,J.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,J.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,J.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,J.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,J.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function Oie(){let{signIn:e}=IE();K9(void 0),ww(void 0);let t=U(G.charts.brandForHost,{host:cT}),n=oT(cT),r=t??n??null,i=GC(void 0);KC(r?.tokens??null,i),(0,q.useEffect)(()=>{t&&sT(cT,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?I0(a,i):null,s=a?.label??`Atrium`,c=U(G.me.authProviders),[l,u]=(0,q.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(xd())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.authelia&&!c.anonymous;return(0,J.jsx)(zre,{providers:c,children:(0,J.jsxs)(`div`,{className:`oc-signin`,children:[(0,J.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,J.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,J.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,J.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,J.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,J.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,J.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,J.jsx)(`h1`,{className:`oc-signin__title`,children:fx()}),(0,J.jsx)(`p`,{className:`oc-signin__subtitle`,children:$y()}),(0,J.jsxs)(`div`,{className:`oc-signin__providers`,children:[c?.google?(0,J.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,J.jsx)(Die,{}),(0,J.jsx)(`span`,{children:Eu()})]}):null,c?.microsoft?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider oc-provider--microsoft`,onClick:()=>void d(`microsoft-entra-id`),children:(0,J.jsx)(`span`,{children:mp()})}):null,c?.authelia?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider oc-provider--authelia`,onClick:()=>void d(`authelia`),children:(0,J.jsx)(`span`,{children:Bp()})}):null]}),l?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:bf()}):null,c?.anonymous?(0,J.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:ky()}):null]})]})})}function kie(){let{width:e,collapsed:t,isMobile:n}=V$();return(0,J.jsxs)(`div`,{className:`oc-shell`,children:[(0,J.jsxs)(`header`,{className:`oc-topbar`,children:[(0,J.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,J.jsx)(`div`,{className:`oc-topbar__search`,children:(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,J.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,J.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,J.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,J.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,J.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,J.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,J.jsx)(S9,{})]})}):null,(0,J.jsx)(`main`,{className:`oc-main`})]})]})}function Aie(){let e=U(G.me.getMe,{host:cT}),t=W(G.me.bootstrap),n=sS();(0,q.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),K9(e?.resolvedThemeMode),ww(e?.resolvedFontScale);let r=GC(e?.resolvedThemeMode);KC(e?.resolvedChartTokens,r),lie(e?.resolvedLocale);let i=(0,q.useRef)(null);if((0,q.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,J.jsx)(kie,{});let a=e.name||e.email||Hh();return e.role===`pending`?(0,J.jsxs)(`div`,{className:`oc-shell`,children:[(0,J.jsx)(q9,{}),(0,J.jsx)(j9,{}),(0,J.jsxs)(`header`,{className:`oc-topbar`,children:[(0,J.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,J.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,J.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,J.jsx)(F9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,J.jsxs)(`div`,{className:`oc-pending`,children:[(0,J.jsx)(`h1`,{className:`oc-pending__title`,children:qd()}),(0,J.jsx)(`p`,{className:`oc-pending__body`,children:kv()})]})]}):(0,J.jsx)(Mie,{canOpenSettings:UT(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=U(G.me.getImpersonation),t=W(G.admin.stopImpersonation);return!e||!e.impersonating?null:(0,J.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,J.jsx)(bC,{className:`size-4 shrink-0`}),(0,J.jsxs)(`span`,{className:`oc-imp__text`,children:[Lg(),` `,(0,J.jsx)(`strong`,{children:e.targetLabel}),Xu(),(0,J.jsx)(`strong`,{children:e.realLabel}),Am()]}),(0,J.jsx)(K,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:tv()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=GC(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=I0(e,n),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>s(!1),[a]),(0,J.jsxs)(J.Fragment,{children:[a!==null&&!o?(0,J.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,J.jsx)(B0,{className:`oc-brand__logo`}):null,(0,J.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function jie({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,J.jsxs)(`header`,{className:`oc-topbar`,children:[(0,J.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,J.jsx)(K,{variant:`ghost`,size:`icon-sm`,"aria-label":i?cg():ty(),onClick:a,children:i?(0,J.jsx)(aj,{}):(0,J.jsx)(CS,{})}),(0,J.jsx)(Lk,{to:`/`,className:`oc-topbar__brand`,children:(0,J.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,J.jsx)(`div`,{className:`oc-topbar__search`,children:(0,J.jsx)(Zre,{})}),(0,J.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,J.jsx)(Jre,{}),(0,J.jsx)(F9,{label:e,mode:t})]})]})}function Mie({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:c,collapsed:l,toggleCollapsed:u,collapse:d,startResize:f,isMobile:p}=V$(),m=nA(),h=vS({strict:!1}),g=sS(),_=!!m({to:`/settings`,fuzzy:!0});(0,q.useEffect)(()=>{p&&d()},[cA({select:e=>e.pathname}),p,d]);let v=(0,q.useCallback)(e=>{g({to:`/chat/$chatId`,params:{chatId:e}})},[g]),{startNewChat:y,picker:b}=Xee(v),x=(0,q.useMemo)(()=>xw(Tw,bw()),[]);return(0,q.useEffect)(()=>{let e=e=>{Cw(e,Tw)&&(e.preventDefault(),y())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[y]),(0,J.jsxs)(`div`,{className:`oc-shell`,children:[b,(0,J.jsx)(Ire,{activeChatId:h.chatId??null}),(0,J.jsx)(q9,{}),(0,J.jsx)(j9,{}),(0,J.jsx)(jie,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,collapsed:l,onToggleSidebar:u}),(0,J.jsxs)(`div`,{className:p?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[p&&!l?(0,J.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:d,"aria-hidden":!0}):null,l?null:(0,J.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{c.current=p?null:e},style:p?void 0:{width:o,flex:`0 0 ${o}px`},children:[_?(0,J.jsx)(aie,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Are,{activeChatId:h.chatId??null,onSelect:v,onNewChat:()=>void y(),newChatShortcut:x}),(0,J.jsx)(K,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,J.jsx)(gA,{"aria-hidden":!0}),b_()]})}),(0,J.jsx)(K,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,J.jsx)(WA,{"aria-hidden":!0}),xr()]})}),e?(0,J.jsx)(K,{variant:`ghost`,className:`mx-2 mb-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings`,children:[(0,J.jsx)(pj,{"aria-hidden":!0}),Wf()]})}):null]}),(0,J.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:f,role:`separator`,"aria-orientation":`vertical`,"aria-label":s()})]}),(0,J.jsx)(`main`,{className:`oc-main`,children:(0,J.jsx)(Qk,{})}),(0,J.jsx)(U$,{viewerUserId:t,currentChatId:h.chatId??null})]}),(0,J.jsx)(_K,{})]})}function Nie(){let e=U(G.me.getMe,{host:cT}),t=sS(),n=cA({select:e=>e.pathname}),r=(0,q.useMemo)(()=>e?UT(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,q.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,J.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:Hb()});if(i)return null;let a=VT(n),o=a!==void 0&&!r.includes(a);return(0,J.jsxs)(`div`,{className:`oc-admin`,children:[(0,J.jsx)(iie,{}),(0,J.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,J.jsx)(Pie,{}):(0,J.jsx)(Qk,{})})]})}function Pie(){return(0,J.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,J.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,J.jsx)(UC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:lo()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Vl()})]})}function Fie(){let e=U(G.me.getMe,{host:cT}),t=sS();return(0,q.useEffect)(()=>{if(e===void 0)return;let n=UT(e.permissions??[]),r=n.includes(`files`)?KT(`files`):n.length>0?KT(n[0]):`/`;t({to:r,replace:!0})},[e,t]),(0,J.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:Hb()})}function Iie(e){switch(e){case`groups`:return(0,J.jsx)(pie,{});case`integrations`:return(0,J.jsx)(mie,{});case`instances`:return(0,J.jsx)(die,{});case`injections`:return(0,J.jsx)(fie,{});case`theme`:return(0,J.jsx)(Tie,{});case`feedbacks`:return(0,J.jsx)(hie,{});case`subagentReports`:return(0,J.jsx)(gie,{});case`files`:return(0,J.jsx)(yie,{});case`scheduled`:return(0,J.jsx)(bie,{});case`agentFiles`:return(0,J.jsx)(xie,{});case`preferences`:return(0,J.jsx)(Sie,{});case`chatDefaults`:return(0,J.jsx)(Cie,{});case`access`:return(0,J.jsx)(wie,{});case`trash`:return(0,J.jsx)(_ie,{});case`deletedChats`:return(0,J.jsx)(vie,{});default:return(0,J.jsx)(uie,{})}}function Lie(){let{tab:e}=vS({from:`/settings/$tab`});return(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:Iie(e)})}function Rie(){let{chatId:e}=vS({from:`/chat/$chatId`}),{m:t}=nS({from:`/chat/$chatId`});return(0,q.useEffect)(()=>{G$(e)},[e]),(0,J.jsx)(I7,{chatId:e,focusMessageId:t??null})}function zie(){let e=sS(),t=K$(),n=U(G.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,q.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,J.jsx)(`div`,{className:`oc-boot`,children:Hb()}):(0,J.jsx)(I7,{chatId:null})}var Y9=Hk({component:Eie}),Bie=Bk({getParentRoute:()=>Y9,path:`/`,component:zie}),Vie=Bk({getParentRoute:()=>Y9,path:`chat/$chatId`,component:Rie,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),Hie=Bk({getParentRoute:()=>Y9,path:`project/$projectId`,component:Uk(()=>Bw(()=>import(`./ProjectPage-BxEF71jN.js`),__vite__mapDeps([93,3,4,43,94,7,46,63,11,12,15,19,14,18,10,95,27,44,37,29,9,38,96,78,80,40,13,16,17,20,21,71,97])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),Uie=Bk({getParentRoute:()=>Y9,path:oie,beforeLoad:cie}),X9=Bk({getParentRoute:()=>Y9,path:`settings`,component:Nie}),Wie=Bk({getParentRoute:()=>X9,path:`/`,component:Fie}),Gie=Bk({getParentRoute:()=>X9,path:`traces`,validateSearch:$w,component:Uk(()=>Bw(()=>import(`./TracesTab-DMdT_psj.js`),__vite__mapDeps([98,3,4,43,7,99,96,100,14,26,27,28,8,29,9,48,38,10,12,15,49,19,18,101,50,54,52,33,11,51,53,92,39,35,36,37,6,40,41])),`TracesTab`)}),Kie=Bk({getParentRoute:()=>X9,path:`bridge`,validateSearch:Zw,component:Uk(()=>Bw(()=>import(`./BridgeTab-D4RFq-Rb.js`),__vite__mapDeps([42,3,4,24,25,26,7,27,28,8,29,9,30,31,43,44,36,45,21,6,46,47,48,38,32,33,10,11,12,13,14,15,49,19,18,50,41,51,52,53,54,55,56])),`BridgeTab`)}),qie=Bk({getParentRoute:()=>X9,path:`voice`,validateSearch:rT,component:Uk(()=>Bw(()=>import(`./VoiceTab-BSh-05Ze.js`),__vite__mapDeps([102,3,4,43,103,6,7,8,9,26,27,28,29,48,38,10,12,15,50,59])),`VoiceTab`)}),Jie=Bk({getParentRoute:()=>X9,path:`audit`,validateSearch:tT,component:Uk(()=>Bw(()=>import(`./AuditTab-D5YrLbTy.js`),__vite__mapDeps([104,3,4,43,26,7,27,28,8,29,9,12,49,101,54,52,33,10,11,51,53,92,39,14,35,36,37,38,6,40,41])),`AuditTab`)}),Yie=Bk({getParentRoute:()=>X9,path:`anomalies`,validateSearch:aT,component:Uk(()=>Bw(()=>import(`./AnomaliesTab-CpiY8ZTC.js`),__vite__mapDeps([105,3,4,43,26,7,27,28,8,29,9,12,13,14,15,49,19,18,10,101,50,16,17,11,54,52,33,51,53,35,36,37,38,6,39,40,41,56])),`AnomaliesTab`)}),Xie=Bk({getParentRoute:()=>X9,path:`kpi`,validateSearch:nT,component:Uk(()=>Bw(()=>import(`./KpiTab-DCfAwBfJ.js`),__vite__mapDeps([106,3,4,43,12,101,50,91,54,52,33,29,9,10,11,49])),`KpiTab`)}),Zie=Bk({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:Qw,component:Uk(()=>Bw(()=>import(`./ServiceAccountsTab-Dmb_LH0V.js`),__vite__mapDeps([107,3,4,43,7,27,44,99,26,28,8,29,9,10,11,12,13,14,15,49,19,18,16,17,20,21,51,52,53,54,33,35,36,37,38,6,39,40,41,22])),`ServiceAccountsTab`)}),Qie=Bk({getParentRoute:()=>X9,path:`users`,validateSearch:iT,component:Uk(()=>Bw(()=>import(`./UsersTab-BQaLsUCK.js`),__vite__mapDeps([108,3,4,43,37,27,29,9,38,6,7,8,46,63,26,28,10,12,13,14,15,19,18,50,16,17,11,34,109,51,52,53,54,33,49,35,36,39,40,41,64])),`UsersTab`)}),$ie=Bk({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw ID({to:`/settings/$tab`,params:{tab:GT.uiprefs},replace:!0})}}),eae=Bk({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:eT([...WT]).catch(`roles`).parse(e.tab)}),component:Lie});function tae({error:e,reset:t}){let n=sS(),r=q$(e),[i]=(0,q.useState)(()=>r&&Z$(Date.now()));return(0,q.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,J.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Yc()})}):(0,J.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,J.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,J.jsx)(UC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:yl()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:vr()}),(0,J.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:__()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:Hr()})]})]})}function nae(){let e=sS();return(0,J.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,J.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,J.jsx)(xA,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:cn()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Oc()}),(0,J.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:Hr()})})]})}var Z9=iA({routeTree:Y9.addChildren([Bie,Vie,Hie,Uie,X9.addChildren([Wie,Gie,qie,Kie,Jie,Yie,Xie,Zie,Qie,$ie,eae])]),defaultPreload:`intent`,defaultErrorComponent:tae,defaultNotFoundComponent:nae}),rae=()=>null;function Q9({children:e}){return(0,J.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=dE.createRoot(document.getElementById(`root`));$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(Q9,{children:ye()})})),t1().then(e=>{E1(document,w1(C1(a1(),window.location.origin,[r1(),i1()])));let t=new Zr(e);$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(LE,{client:t,children:(0,J.jsxs)(dT,{children:[(0,J.jsx)(n5,{children:(0,J.jsx)(sA,{router:Z9})}),(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(rae,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsxs)(Q9,{children:[yi(),` `,e instanceof Error?e.message:String(e)]})}))});