@lacneu/atrium 0.104.3 → 0.104.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/assets/{AccessTab-D8xdWzT5.js → AccessTab-B2bpNynj.js} +1 -1
  2. package/dist/assets/{AdminSettings-CtNcFhMz.js → AdminSettings-C2bsOn0u.js} +1 -1
  3. package/dist/assets/{AdvancedFilter-Cod8SSd6.js → AdvancedFilter-DYTsdqhC.js} +1 -1
  4. package/dist/assets/{AgentFilesTab-Dfkkm3Fw.js → AgentFilesTab-BM2NUWub.js} +1 -1
  5. package/dist/assets/{AnomaliesTab-DlZ5M2UC.js → AnomaliesTab-BWiKxnXQ.js} +1 -1
  6. package/dist/assets/{AuditTab-Dh6gO6j5.js → AuditTab-CqpDXgVz.js} +1 -1
  7. package/dist/assets/{BridgeTab-Bnu9R5N4.js → BridgeTab-Cv2Co6h7.js} +1 -1
  8. package/dist/assets/{ChatDefaultsTab-CxmayDqi.js → ChatDefaultsTab-Dr-czhQm.js} +1 -1
  9. package/dist/assets/{ConfirmDialog-B7k0wvSi.js → ConfirmDialog-Bfi4_Ti8.js} +1 -1
  10. package/dist/assets/{DataTableShell-DvtkASQG.js → DataTableShell-1ZsZ0a2J.js} +1 -1
  11. package/dist/assets/{DeletedChatsTab-CnaK-AH0.js → DeletedChatsTab-By_xLvEC.js} +1 -1
  12. package/dist/assets/{DetailChips-DDAtgnjA.js → DetailChips-DkRU5HQ5.js} +1 -1
  13. package/dist/assets/{EntitySheet-DRzkWKlH.js → EntitySheet-D8Vdib4B.js} +1 -1
  14. package/dist/assets/{FeedbacksTab-D4LKaB_2.js → FeedbacksTab-YFBk45oU.js} +1 -1
  15. package/dist/assets/{FieldLabel-imj_Z0rZ.js → FieldLabel-Ce8urE01.js} +1 -1
  16. package/dist/assets/{FilesTab-D3XWSI2t.js → FilesTab-DL27Krkt.js} +1 -1
  17. package/dist/assets/{FilterBar-DCCuFxDn.js → FilterBar-DtNuk6dI.js} +1 -1
  18. package/dist/assets/{GroupsTab-DbayDYbZ.js → GroupsTab-CQrEUZSF.js} +1 -1
  19. package/dist/assets/{InstancesTab-031fn2Jt.js → InstancesTab-DiW-4KlM.js} +1 -1
  20. package/dist/assets/{IntegrationsTab-1whhDsmk.js → IntegrationsTab-DqWlrC3M.js} +1 -1
  21. package/dist/assets/{KnobRow-D6kXWvVI.js → KnobRow-4WODwFrS.js} +1 -1
  22. package/dist/assets/{KpiTab-2Vk6EtCf.js → KpiTab-BXC9YG9_.js} +1 -1
  23. package/dist/assets/{PreferencesTab-B5h49bYq.js → PreferencesTab-DarNzYdF.js} +1 -1
  24. package/dist/assets/{ProjectPage-BNKL-iOz.js → ProjectPage-BbYuFPDW.js} +1 -1
  25. package/dist/assets/{PromptInjectionsTab-Bmn1iSpB.js → PromptInjectionsTab-KMsWE-dW.js} +1 -1
  26. package/dist/assets/{RolesTab-DHxLatAl.js → RolesTab-DpN3MOih.js} +1 -1
  27. package/dist/assets/{ScheduledTab-NHSyQ677.js → ScheduledTab-BBofaJj5.js} +1 -1
  28. package/dist/assets/{ServiceAccountsTab-CKV8crhK.js → ServiceAccountsTab-CSIwvppo.js} +1 -1
  29. package/dist/assets/{SubAgentReportsTab-BWfXOTck.js → SubAgentReportsTab-BoNbdt38.js} +1 -1
  30. package/dist/assets/{ThemeShowroom-Do9I3hrR.js → ThemeShowroom-DdUZV2nA.js} +1 -1
  31. package/dist/assets/{TimeRangePicker-BZtw1JkM.js → TimeRangePicker-jsNw51TL.js} +1 -1
  32. package/dist/assets/{TimezoneCombobox-CeRN4N3z.js → TimezoneCombobox-zOqV7dxe.js} +1 -1
  33. package/dist/assets/{TracesTab-BNWFPad2.js → TracesTab-Dg_eyLYF.js} +1 -1
  34. package/dist/assets/{TrashTab-D5irFeF0.js → TrashTab-Dwjjxu8X.js} +1 -1
  35. package/dist/assets/{UsersTab-CHs3CRev.js → UsersTab-eQY9UCh5.js} +1 -1
  36. package/dist/assets/{VoiceTab-DRvjgMdZ.js → VoiceTab-BFVfbSld.js} +1 -1
  37. package/dist/assets/{alert-dialog-BcJMHbhI.js → alert-dialog-C6NSAwQv.js} +1 -1
  38. package/dist/assets/{api-CWqdeSbN.js → api-D64JTta1.js} +1 -1
  39. package/dist/assets/{badge-ChMMFtuW.js → badge-DwWXPxwl.js} +1 -1
  40. package/dist/assets/{button-C_rIPtCv.js → button-DeHzYOzP.js} +1 -1
  41. package/dist/assets/{card-BV8NO76j.js → card-WAOfM0PL.js} +1 -1
  42. package/dist/assets/check-pVsND9oZ.js +1 -0
  43. package/dist/assets/{checkbox-DPxJTQjc.js → checkbox-BuTZzFvU.js} +1 -1
  44. package/dist/assets/chevron-left-CjQ1kn0w.js +1 -0
  45. package/dist/assets/chevron-right-DkaFdk2G.js +1 -0
  46. package/dist/assets/chevron-up-s_deZUWR.js +1 -0
  47. package/dist/assets/chevrons-up-down-uk0IvxY8.js +1 -0
  48. package/dist/assets/{compatView-Cz5KNXa-.js → compatView-Db657dNx.js} +1 -1
  49. package/dist/assets/convexApi-DxRiI80M.js +1 -0
  50. package/dist/assets/{copy-DbstFM9Q.js → copy-4wREwP-V.js} +1 -1
  51. package/dist/assets/{cronDescribe-CkiSvbCK.js → cronDescribe-B-ifUeLg.js} +1 -1
  52. package/dist/assets/{deliveryRecorder-B_kVKMkR.js → deliveryRecorder-owdOglrQ.js} +1 -1
  53. package/dist/assets/{dialog-CPAskUwF.js → dialog-awuZdW9M.js} +1 -1
  54. package/dist/assets/{dispatchErrorInfo-7H2cJGwt.js → dispatchErrorInfo-C4Qh_2oR.js} +1 -1
  55. package/dist/assets/{dist-Bu9sqVcp.js → dist-B4zBnzNF.js} +1 -1
  56. package/dist/assets/{dist-BjZo0sql.js → dist-BtzRSR0_.js} +1 -1
  57. package/dist/assets/{dist-CzmY6YrA.js → dist-C0V3m4aH.js} +1 -1
  58. package/dist/assets/{dist-Uf18yR_a.js → dist-D4a9D7kU.js} +1 -1
  59. package/dist/assets/{dist-CYh9BuQS.js → dist-mViq22LZ.js} +1 -1
  60. package/dist/assets/{download-BaebAe6Z.js → download-BUlwPQI8.js} +1 -1
  61. package/dist/assets/{dropdown-menu-BVKVjups.js → dropdown-menu-C5VrCGFe.js} +1 -1
  62. package/dist/assets/{eye-LggiM6Z5.js → eye-BU60QIdS.js} +1 -1
  63. package/dist/assets/{format-AQELUhPa.js → format-g5Z3Txjl.js} +1 -1
  64. package/dist/assets/{groupManageView-DC3eSLA1.js → groupManageView-CKEYC6zY.js} +1 -1
  65. package/dist/assets/{index-Dq26_OeV.js → index-MNxzNMLb.js} +3 -3
  66. package/dist/assets/{input-CSZu-bVE.js → input-CZ0jp9Rx.js} +1 -1
  67. package/dist/assets/{list-obbqPBzD.js → list-Bb0MIh_I.js} +1 -1
  68. package/dist/assets/loader-circle-1XN8tjq6.js +1 -0
  69. package/dist/assets/{lock-BlVhOk85.js → lock-xfEfLa2G.js} +1 -1
  70. package/dist/assets/{pencil-K7SBkvHL.js → pencil-CHRZ3__S.js} +1 -1
  71. package/dist/assets/plus-DrzxZ4iS.js +1 -0
  72. package/dist/assets/{popover-C-Y_Yoco.js → popover-UJtu3EZ6.js} +1 -1
  73. package/dist/assets/roleDescriptions-BW3e0J2_.js +1 -0
  74. package/dist/assets/rotate-ccw-CiOuaG2h.js +1 -0
  75. package/dist/assets/{search-Dz6sLH0-.js → search-NOJ0tWl2.js} +1 -1
  76. package/dist/assets/{select-CjcMQhwm.js → select-wXM6h61N.js} +1 -1
  77. package/dist/assets/{server-DcInl3Nh.js → server-C5TTb6-A.js} +1 -1
  78. package/dist/assets/{speech-ehUcmGCg.js → speech-BPCrvnrE.js} +1 -1
  79. package/dist/assets/{star-5ysDlx3k.js → star-N2N0cbAA.js} +1 -1
  80. package/dist/assets/{switch--NPD3Vp0.js → switch-Beq0wUQ_.js} +1 -1
  81. package/dist/assets/{table-rRR3TpMc.js → table-CegX53gV.js} +1 -1
  82. package/dist/assets/{tabs-B8emuY1B.js → tabs-CfQK0-wk.js} +1 -1
  83. package/dist/assets/{toast-C_YfUacM.js → toast-DtA87VYn.js} +1 -1
  84. package/dist/assets/{tooltip-Ct0TGxtk.js → tooltip-Dpar43UD.js} +1 -1
  85. package/dist/assets/{trash-2-xhtrhYsd.js → trash-2-CqKGt3lC.js} +1 -1
  86. package/dist/assets/{trashPage-3suR6eIy.js → trashPage-D9B1uAuS.js} +1 -1
  87. package/dist/assets/{trashView-CwUC01r_.js → trashView-TIQT30u4.js} +1 -1
  88. package/dist/assets/{triangle-alert-DoL9TI6v.js → triangle-alert-nUld87-H.js} +1 -1
  89. package/dist/assets/{usageView-BuRtXekW.js → usageView-DIPUGYx9.js} +1 -1
  90. package/dist/assets/{useChart-bV4rotdu.js → useChart-BTVKxdLu.js} +1 -1
  91. package/dist/assets/{useFontScale-DiSkEM6I.js → useFontScale-P_rNok04.js} +1 -1
  92. package/dist/assets/{useStartNewChat-8wVLrYnZ.js → useStartNewChat-GAbwTTkG.js} +1 -1
  93. package/dist/assets/{use_paginated_query-CebdO_HQ.js → use_paginated_query-C-Aw4n8b.js} +1 -1
  94. package/dist/assets/{users-CRbE186D.js → users-BUu1wJNm.js} +1 -1
  95. package/dist/assets/x-BNU-sWkh.js +1 -0
  96. package/dist/index.html +53 -53
  97. package/package.json +1 -1
  98. package/dist/assets/check-DdmANHSb.js +0 -1
  99. package/dist/assets/chevron-left-ByEQraEh.js +0 -1
  100. package/dist/assets/chevron-right-DMqzlhWH.js +0 -1
  101. package/dist/assets/chevron-up-B3KYmtzo.js +0 -1
  102. package/dist/assets/chevrons-up-down-CITEfz7_.js +0 -1
  103. package/dist/assets/convexApi-G20_TNBS.js +0 -1
  104. package/dist/assets/loader-circle-BqKiW3X9.js +0 -1
  105. package/dist/assets/plus-DTL4K-j9.js +0 -1
  106. package/dist/assets/roleDescriptions-DHny6e80.js +0 -1
  107. package/dist/assets/rotate-ccw-CvefWwHW.js +0 -1
  108. package/dist/assets/x-CcIT4ync.js +0 -1
@@ -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-DHxLatAl.js","assets/bundle-mjs-C73ZY4La.js","assets/api-CWqdeSbN.js","assets/lock-BlVhOk85.js","assets/checkbox-DPxJTQjc.js","assets/check-DdmANHSb.js","assets/dist-DDCmobc1.js","assets/dist-CYh9BuQS.js","assets/button-C_rIPtCv.js","assets/input-CSZu-bVE.js","assets/convexApi-G20_TNBS.js","assets/toast-C_YfUacM.js","assets/x-CcIT4ync.js","assets/badge-ChMMFtuW.js","assets/ConfirmDialog-B7k0wvSi.js","assets/alert-dialog-BcJMHbhI.js","assets/dist-Uf18yR_a.js","assets/dialog-CPAskUwF.js","assets/EntitySheet-DRzkWKlH.js","assets/loader-circle-BqKiW3X9.js","assets/roleDescriptions-DHny6e80.js","assets/InstancesTab-031fn2Jt.js","assets/FieldLabel-imj_Z0rZ.js","assets/tooltip-Ct0TGxtk.js","assets/select-CjcMQhwm.js","assets/dist-CzmY6YrA.js","assets/chevron-up-B3KYmtzo.js","assets/dist-BjZo0sql.js","assets/popover-C-Y_Yoco.js","assets/locales-CPjguROj.js","assets/curation-CQksaIbm.js","assets/groupManageView-DC3eSLA1.js","assets/DataTableShell-DvtkASQG.js","assets/chevrons-up-down-CITEfz7_.js","assets/dropdown-menu-BVKVjups.js","assets/dist-Bu9sqVcp.js","assets/plus-DTL4K-j9.js","assets/trash-2-xhtrhYsd.js","assets/table-rRR3TpMc.js","assets/useTableLayout-Cmwnuzxb.js","assets/measureClone-CHN0WNEY.js","assets/BridgeTab-Bnu9R5N4.js","assets/useNavigate-D3GIoxyW.js","assets/chevron-right-DMqzlhWH.js","assets/usageView-BuRtXekW.js","assets/server-DcInl3Nh.js","assets/triangle-alert-DoL9TI6v.js","assets/tabs-B8emuY1B.js","assets/format-AQELUhPa.js","assets/appHost-CH3EGcJw.js","assets/FilterBar-DCCuFxDn.js","assets/search-Dz6sLH0-.js","assets/rotate-ccw-CvefWwHW.js","assets/TimeRangePicker-BZtw1JkM.js","assets/compatView-Cz5KNXa-.js","assets/dispatchErrorInfo-7H2cJGwt.js","assets/PromptInjectionsTab-Bmn1iSpB.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-BpNy5aSd.css","assets/GroupsTab-DbayDYbZ.js","assets/chevron-left-ByEQraEh.js","assets/users-CRbE186D.js","assets/star-5ysDlx3k.js","assets/DetailChips-DDAtgnjA.js","assets/IntegrationsTab-1whhDsmk.js","assets/FeedbacksTab-D4LKaB_2.js","assets/SubAgentReportsTab-BWfXOTck.js","assets/TrashTab-D5irFeF0.js","assets/use_paginated_query-CebdO_HQ.js","assets/fileMetaView-Ci5C4w9Q.js","assets/trashView-CwUC01r_.js","assets/trashPage-3suR6eIy.js","assets/trashPage-B7NvDkP2.css","assets/DeletedChatsTab-CnaK-AH0.js","assets/FilesTab-D3XWSI2t.js","assets/download-BaebAe6Z.js","assets/ScheduledTab-NHSyQ677.js","assets/list-obbqPBzD.js","assets/cronDescribe-CkiSvbCK.js","assets/pencil-K7SBkvHL.js","assets/TimezoneCombobox-CeRN4N3z.js","assets/AgentFilesTab-Dfkkm3Fw.js","assets/capabilities-CASxhKEd.js","assets/PreferencesTab-B5h49bYq.js","assets/useFontScale-DiSkEM6I.js","assets/switch--NPD3Vp0.js","assets/ChatDefaultsTab-CxmayDqi.js","assets/KnobRow-D6kXWvVI.js","assets/AccessTab-D8xdWzT5.js","assets/ThemeShowroom-Do9I3hrR.js","assets/useChart-bV4rotdu.js","assets/card-BV8NO76j.js","assets/AdvancedFilter-Cod8SSd6.js","assets/ProjectPage-BNKL-iOz.js","assets/useStartNewChat-8wVLrYnZ.js","assets/useStartNewChat-DgQf_3y0.css","assets/eye-LggiM6Z5.js","assets/ProjectPage-D3DrzSxV.css","assets/TracesTab-BNWFPad2.js","assets/copy-DbstFM9Q.js","assets/deliveryRecorder-B_kVKMkR.js","assets/searchSchemas-Dm-Qg010.js","assets/VoiceTab-DRvjgMdZ.js","assets/speech-ehUcmGCg.js","assets/AuditTab-Dh6gO6j5.js","assets/AnomaliesTab-DlZ5M2UC.js","assets/KpiTab-2Vk6EtCf.js","assets/ServiceAccountsTab-CKV8crhK.js","assets/UsersTab-CHs3CRev.js","assets/AdminSettings-CtNcFhMz.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{$E as s,$H as c,$N as l,$O as u,$T as d,$U as f,$V as p,$W as m,$Y as h,$_ as g,$a as _,$c as v,$d as y,$g as b,$i as x,$l as S,$m as C,$n as w,$r as T,$s as E,$t as D,$w as O,$y as k,$z as A,AC as j,AD as M,AE as N,AH as P,AM as F,AN as I,AQ as ee,AU as L,AV as R,AW as z,AX as B,A_ as V,Aa as te,Ab as ne,Ac as re,Ad as ie,Af as ae,Ag as oe,Ai as se,Ak as ce,Am as le,Ao as ue,Ar as de,As as fe,At as pe,Au as me,BC as he,BE as ge,BH as _e,BJ as ve,BM as ye,BN as be,BT as xe,BU as Se,BV as Ce,BW as we,B_ as Te,Ba as Ee,Bb as De,Bc as Oe,Bi as ke,Bk as Ae,Bl as je,Bm as Me,Bn as Ne,Bo as Pe,Br as Fe,Bs as Ie,By as Le,CB as Re,CC as ze,CE as Be,CH as Ve,CM as He,CO as Ue,CQ as We,CT as Ge,CU as Ke,CV as qe,CW as Je,CX as Ye,C_ as Xe,Ca as Ze,Cb as Qe,Cc as $e,Cf as et,Cg as tt,Ch as nt,Ci as rt,Ck as it,Cm as at,Co as ot,Cp as st,Ct as ct,Cu as lt,Cv as ut,DC as dt,DD as ft,DE as pt,DH as mt,DM as ht,DN as gt,DQ as _t,DT as vt,DU as yt,DV as bt,DW as xt,DX as St,D_ as Ct,Da as wt,Db as Tt,Dc as Et,Dd as Dt,Df as Ot,Dg as kt,Di as At,Dk as jt,Dm as Mt,Do as Nt,Dp as Pt,Dr as Ft,Ds as It,Dt as Lt,Du as Rt,Dv as zt,EB as Bt,EC as Vt,ED as Ht,EE as Ut,EH as Wt,EM as Gt,EQ as Kt,ET as qt,EU as Jt,EV as Yt,EW as Xt,EX as Zt,E_ as Qt,Ea as $t,Eb as en,Ec as tn,Ed as nn,Ef as rn,Eg as an,Ei as on,Ek as sn,Em as cn,Eo as ln,Ep as un,Er as dn,Es as fn,Et as pn,Eu as mn,Ev as hn,FC as gn,FD as _n,FE as vn,FH as yn,FJ as bn,FM as xn,FN as Sn,FO as Cn,FU as wn,FV as Tn,FW as En,F_ as Dn,Fa as On,Fc as kn,Fd as An,Fg as jn,Fi as Mn,Fk as Nn,Fm as Pn,Fn,Fo as In,Fr as Ln,Fs as Rn,Ft as zn,Fu as Bn,GC as Vn,GE as Hn,GH as Un,GN as Wn,GT as Gn,GU as Kn,GV as qn,GW as Jn,G_ as Yn,Ga as Xn,Gc as Zn,Gi as Qn,Gl as $n,Gm as er,Gn as tr,Gr as nr,Gs as rr,Gt as ir,Gy as ar,Gz as or,HC as sr,HE as cr,HH as lr,HJ as ur,HM as dr,HN as fr,HT as pr,HU as mr,HV as hr,HW as gr,H_ as _r,Ha as vr,Hc as yr,Hi as br,Hl as xr,Hm as Sr,Hn as Cr,Hr as wr,Hs as Tr,Hy as Er,IC as Dr,ID as Or,IE as kr,IH as Ar,IJ as jr,IM as Mr,IN as Nr,IO as Pr,IU as Fr,IV as Ir,IW as Lr,I_ as Rr,Ia as zr,Ic as Br,Id as Vr,Ig as Hr,Ii as Ur,Ik as Wr,Il as Gr,Im as Kr,In as qr,Io as Jr,Ir as Yr,Iy as Xr,JC as Zr,JE as Qr,JH as $r,JN as ei,JT as ti,JU as ni,JV as ri,JW as ii,JY as ai,J_ as oi,Ja as si,Jc as ci,Ji as li,Jl as ui,Jm as di,Jn as fi,Jr as pi,Js as mi,Jt as hi,Jz as gi,KC as _i,KE as vi,KH as yi,KN as bi,KT as xi,KU as Si,KV as Ci,KW as wi,K_ as Ti,Ka as Ei,Kc as Di,Ki as Oi,Kl as ki,Km as Ai,Kn as ji,Ko as Mi,Kr as Ni,Ks as Pi,Kt as Fi,Ky as Ii,Kz as Li,LC as Ri,LE as zi,LH as Bi,LM as Vi,LN as Hi,LT as Ui,LU as Wi,LV as Gi,LW as Ki,L_ as qi,La as Ji,Lc as Yi,Ld as Xi,Lg as Zi,Li as Qi,Lk as $i,Ll as ea,Lm as ta,Ln as na,Lo as ra,Lr as ia,Ly as aa,MC as oa,MD as sa,ME as ca,MH as la,MM as ua,MN as da,MO as fa,MU as pa,MV as ma,MW as ha,M_ as ga,Ma as _a,Mc as va,Md as ya,Mf as ba,Mg as xa,Mi as Sa,Mk as Ca,Mm as wa,Mo as Ta,Mr as Ea,Ms as Da,Mt as Oa,Mu as ka,NC as Aa,ND as ja,NE as Ma,NH as Na,NM as Pa,NN as Fa,NO as Ia,NU as La,NV as Ra,NW as za,NX as Ba,N_ as Va,Na as Ha,Nc as Ua,Nd as Wa,Nf as Ga,Ng as Ka,Ni as qa,Nk as Ja,Nm as Ya,No as Xa,Nr as Za,Nt as Qa,Nu as $a,O as eo,OC as to,OD as no,OE as ro,OH as io,OM as ao,ON as oo,OQ as so,OT as co,OU as lo,OV as uo,OW as fo,OX as po,O_ as mo,Oa as ho,Ob as go,Oc as _o,Od as vo,Of as yo,Og as bo,Oi as xo,Ok as So,Om as Co,Oo as wo,Op as To,Or as Eo,Os as Do,Ot as Oo,Ou as ko,PC as Ao,PD as jo,PE as Mo,PH as No,PM as Po,PN as Fo,PO as Io,PU as Lo,PV as Ro,PW as zo,PX as Bo,P_ as Vo,Pa as Ho,Pc as Uo,Pd as Wo,Pf as Go,Pg as Ko,Pi as qo,Pk as Jo,Pm as Yo,Po as Xo,Pr as Zo,Ps as Qo,Pt as $o,Pu as es,QC as ts,QE as ns,QH as rs,QN as is,QT as as,QU as os,QV as ss,QW as cs,QY as ls,Q_ as us,Qa as ds,Qc as fs,Qd as ps,Qg as ms,Qi as hs,Ql as gs,Qm as _s,Qn as vs,Qr as ys,Qs as bs,Qt as xs,Qw as Ss,Qz as Cs,RC as ws,RE as Ts,RH as Es,RJ as Ds,RM as Os,RN as ks,RT as As,RU as js,RV as Ms,RW as Ns,R_ as Ps,Ra as Fs,Rc as Is,Rd as Ls,Rg as Rs,Ri as zs,Rk as Bs,Rl as Vs,Rm as Hs,Rn as Us,Ro as Ws,Rr as Gs,Rs as Ks,Ry as qs,S as Js,SB as Ys,SD as Xs,SE as Zs,SH as Qs,SM as $s,SO as ec,SQ as tc,ST as nc,SU as rc,SV as ic,SW as ac,SX as oc,S_ as sc,Sa as cc,Sf as lc,Sh as uc,Si as dc,Sk as fc,Sm as pc,So as mc,Sp as hc,St as gc,Su as _c,Sv as vc,TB as yc,TC as bc,TE as xc,TH as Sc,TM as Cc,TO as wc,TQ as Tc,TT as Ec,TU as Dc,TV as Oc,TW as kc,TX as Ac,T_ as jc,Ta as Mc,Tb as Nc,Tc as Pc,Td as Fc,Tf as Ic,Tg as Lc,Ti as Rc,Tk as zc,Tm as Bc,To as Vc,Tp as Hc,Tt as Uc,Tu as Wc,Tv as Gc,UC as Kc,UE as qc,UH as Jc,UN as Yc,UT as Xc,UU as Zc,UV as Qc,UW as $c,U_ as el,Ua as tl,Uc as nl,Ui as rl,Um as il,Un as al,Uo as ol,Ur as sl,Us as cl,Uy as ll,Uz as ul,VC as dl,VE as fl,VH as pl,VJ as ml,VM as hl,VN as gl,VT as _l,VU as vl,VV as yl,VW as bl,V_ as xl,Va as Sl,Vc as Cl,Vi as wl,Vk as Tl,Vl as El,Vm as Dl,Vn as Ol,Vr as kl,Vs as Al,Vy as jl,WC as Ml,WE as Nl,WH as Pl,WN as Fl,WT as Il,WU as Ll,WV as Rl,WW as zl,W_ as Bl,Wa as Vl,Wc as Hl,Wi as Ul,Wl,Wm as Gl,Wn as Kl,Wr as ql,Ws as Jl,Wy as Yl,Wz as Xl,XC as Zl,XE as Ql,XH as $l,XN as eu,XO as tu,XT as nu,XU as ru,XV as iu,XW as au,XY as ou,X_ as su,Xa as cu,Xc as lu,Xd as uu,Xg as du,Xi as fu,Xl as pu,Xm as mu,Xn as hu,Xr as gu,Xs as _u,Xt as vu,Xy as yu,Xz as bu,YC as xu,YE as Su,YH as Cu,YN as wu,YO as Tu,YT as Eu,YU as Du,YV as Ou,YW as ku,YY as Au,Y_ as ju,Ya as Mu,Yc as Nu,Yd as Pu,Yi as Fu,Yl as Iu,Ym as Lu,Yn as Ru,Yo as zu,Yr as Bu,Ys as Vu,Yt as Hu,Yz as Uu,ZC as Wu,ZE as Gu,ZH as Ku,ZN as qu,ZT as Ju,ZU as Yu,ZV as Xu,ZW as Zu,ZY as Qu,Z_ as $u,Za as ed,Zc as td,Zd as nd,Zg as rd,Zi as id,Zl as ad,Zm as od,Zn as sd,Zr as cd,Zs as ld,Zt as ud,Zy as dd,Zz as fd,_B as pd,_D as md,_E as hd,_H as gd,_M as _d,_O as vd,_Q as yd,_T as bd,_U as xd,_V as Sd,_W as Cd,_X as wd,__ as Td,_a as Ed,_c as Dd,_f as Od,_h as kd,_i as Ad,_k as jd,_l as Md,_m as Nd,_o as Pd,_p as Fd,_t as Id,_u as Ld,_v as Rd,a as zd,aB as Bd,aD as Vd,aE as Hd,aH as Ud,aQ as Wd,aT as Gd,aU as Kd,aW as qd,aX as Jd,a_ as Yd,aa as Xd,ab as Zd,ac as Qd,af as $d,ai as ef,ak as tf,al as nf,an as rf,ao as af,ar as of,as as sf,at as cf,au as lf,av as uf,b as df,bB as ff,bD as pf,bE as mf,bH as hf,bM as gf,bO as _f,bQ as H,bT as vf,bU as yf,bV as bf,bW as xf,bX as Sf,b_ as Cf,ba as wf,bb as Tf,bf as Ef,bh as Df,bi as Of,bk as kf,bm as Af,bo as jf,bp as Mf,bt as Nf,bu as Pf,bv as Ff,cB as If,cD as Lf,cE as Rf,cH as zf,cQ as Bf,cT as Vf,cU as Hf,cW as Uf,cX as Wf,c_ as Gf,ca as Kf,cb as qf,cc as Jf,cd as Yf,cf as Xf,ci as Zf,cn as Qf,co as $f,cr as ep,cs as tp,ct as np,cu as rp,cv as ip,dB as ap,dD as op,dE as sp,dH as cp,dM as lp,dQ as up,dT as dp,dU as fp,dW as pp,dX as mp,d_ as hp,da as gp,db as _p,dc as vp,df as yp,dh as bp,di as xp,dk as Sp,dm as Cp,do as wp,dp as Tp,dr as Ep,dt as Dp,du as Op,dv as kp,eB as Ap,eD as jp,eE as Mp,eG as Np,eH as Pp,eT as Fp,eU as Ip,eW as Lp,eX as Rp,e_ as zp,ea as Bp,ec as Vp,ef as Hp,eh as Up,ei as Wp,el as Gp,em as Kp,en as qp,eo as Jp,er as Yp,eu as Xp,ev as Zp,fB as Qp,fD as $p,fE as em,fH as tm,fM as nm,fQ as rm,fT as im,fU as am,fW as om,fX as sm,f_ as cm,fa as lm,fb as um,fc as dm,ff as fm,fh as pm,fi as mm,fk as hm,fm as gm,fo as _m,fp as vm,fr as ym,ft as bm,fu as xm,fv as Sm,gB as Cm,gD as wm,gE as Tm,gH as Em,gM as Dm,gO as Om,gQ as km,gT as Am,gU as jm,gW as Mm,gX as Nm,g_ as Pm,ga as Fm,gc as Im,gf as Lm,gh as Rm,gi as zm,gk as Bm,gm as Vm,go as Hm,gp as Um,gt as Wm,gu as Gm,gv as Km,hB as qm,hD as Jm,hE as Ym,hH as Xm,hM as Zm,hQ as Qm,hT as $m,hU as eh,hW as th,hX as nh,hY as rh,h_ as ih,ha as ah,hc as oh,hd as sh,hf as ch,hh as lh,hi as uh,hk as dh,hm as fh,ho as ph,hp as mh,hr as hh,ht as gh,hu as _h,hv as vh,i as yh,iB as bh,iD as xh,iE as Sh,iH as Ch,iQ as wh,iU as Th,iW as Eh,iX as eee,i_ as tee,ia as nee,ib as ree,ic as iee,if as Dh,ii as Oh,il as kh,im as aee,in as oee,io as see,ir as cee,iu as lee,iv as Ah,jC as uee,jD as dee,jE as jh,jH as fee,jI as pee,jM as mee,jN as hee,jO as gee,jU as _ee,jV as vee,jW as yee,jX as bee,j_ as Mh,ja as Nh,jb as xee,jc as See,jd as Ph,jf as Fh,jg as Cee,ji as Ih,jk as wee,jm as Lh,jo as Rh,jr as zh,js as Bh,jt as Tee,ju as Vh,k as U,kC as Hh,kD as Uh,kE as Wh,kH as Gh,kM as Kh,kN as qh,kQ as Jh,kT as Yh,kV as Xh,kW as Zh,kX as Eee,k_ as Qh,ka as $h,kb as Dee,kc as Oee,kd as kee,kf as Aee,kg as jee,ki as Mee,kk as Nee,km as Pee,ko as Fee,kr as eg,ks as tg,kt as ng,ku as rg,lB as ig,lD as ag,lE as og,lH as sg,lQ as cg,lT as lg,lU as ug,lW as dg,lX as fg,l_ as pg,la as mg,lb as hg,lc as gg,ld as _g,lf as vg,li as yg,lk as bg,lo as xg,lr as Sg,lt as Cg,lu as wg,lv as Tg,mB as Eg,mD as Dg,mE as Og,mH as kg,mM as Ag,mQ as jg,mT as Mg,mU as Ng,mW as Pg,mX as Fg,m_ as Ig,ma as Lg,mc as Rg,mf as zg,mh as Bg,mi as Vg,mk as Hg,mm as Ug,mo as Wg,mp as Gg,mr as Kg,mt as qg,mu as Jg,mv as Yg,nB as Xg,nD as Zg,nE as Qg,nG as $g,nH as e_,nU as t_,nW as n_,nX as r_,n_ as i_,na as a_,nb as o_,nc as s_,nf as c_,ni as l_,nl as u_,nn as d_,no as f_,nr as p_,nu as m_,nv as h_,o as g_,oB as __,oD as v_,oE as y_,oH as b_,oQ as x_,oT as S_,oU as C_,oW as w_,oX as T_,o_ as E_,oa as D_,ob as O_,oc as k_,of as A_,oi as j_,ok as M_,ol as N_,om as P_,on as F_,oo as I_,or as L_,os as R_,ot as z_,ou as B_,ov as Iee,pB as Lee,pD as Ree,pE as zee,pH as Bee,pM as Vee,pQ as Hee,pT as Uee,pU as Wee,pW as Gee,pX as Kee,p_ as qee,pa as Jee,pc as Yee,pf as Xee,ph as Zee,pi as Qee,pk as $ee,pm as V_,po as ete,pp as tte,pr as nte,pt as rte,pu as ite,pv as ate,qC as ote,qE as ste,qH as cte,qN as H_,qT as lte,qU as ute,qV as dte,qW as U_,q_ as W_,qa as fte,qc as pte,qi as mte,ql as hte,qm as gte,qn as _te,qr as G_,qs as K_,qt as vte,qz as yte,r as bte,rB as xte,rD as Ste,rE as Cte,rG as wte,rH as q_,rQ as J_,rU as Tte,rW as Ete,rX as Dte,r_ as Ote,ra as Y_,rb as kte,rc as Ate,rf as X_,ri as jte,rl as Z_,rn as Q_,ro as $_,rr as ev,ru as tv,rv as nv,sB as rv,sD as iv,sE as av,sH as ov,sQ as sv,sT as cv,sU as lv,sW as uv,sX as dv,s_ as fv,sa as pv,sb as mv,sc as hv,sf as gv,si as _v,sl as vv,sm as yv,sn as bv,so as xv,sr as Sv,ss as Cv,st as wv,su as Tv,sv as Ev,t as W,tB as Dv,tD as Ov,tE as kv,tG as Av,tH as jv,tU as Mv,tW as Nv,tX as Pv,t_ as Fv,ta as Iv,tb as Lv,tc as Rv,tf as zv,ti as Bv,tl as Vv,tm as Hv,tn as Uv,to as Wv,tr as Gv,tu as Kv,tv as qv,uB as Jv,uD as Yv,uE as Xv,uH as Zv,uM as Qv,uQ as $v,uT as ey,uU as ty,uW as ny,uX as ry,u_ as iy,ua as ay,ub as oy,uc as sy,uf as cy,ui as ly,uk as uy,um as dy,uo as fy,up as py,ur as my,ut as hy,uu as gy,uv as _y,vB as vy,vD as yy,vE as by,vH as xy,vM as Sy,vO as Cy,vQ as wy,vT as Ty,vU as Ey,vV as Dy,vW as Oy,vX as ky,v_ as Ay,va as jy,vb as My,vc as Ny,vf as Py,vh as Fy,vi as Iy,vk as Ly,vl as Ry,vm as zy,vo as By,vp as Vy,vt as Hy,vu as Uy,vv as Wy,w as Gy,wB as Ky,wC as qy,wE as Jy,wH as Yy,wM as Xy,wO as Zy,wQ as Qy,wT as $y,wU as eb,wV as tb,wW as nb,wX as rb,w_ as ib,wa as ab,wb as ob,wc as sb,wf as cb,wg as lb,wh as ub,wi as db,wk as fb,wm as pb,wo as mb,wp as hb,wt as gb,wu as _b,wv as vb,x as yb,xB as bb,xD as xb,xE as Sb,xH as Cb,xM as wb,xO as Tb,xQ as Eb,xT as Db,xU as Ob,xV as kb,xW as Ab,xX as jb,x_ as Mb,xa as Nb,xf as Pb,xh as Fb,xi as Ib,xk as Lb,xm as Rb,xo as zb,xp as Bb,xt as Vb,xu as Hb,xv as Ub,y as Wb,yB as Gb,yD as Kb,yE as qb,yH as Jb,yM as Yb,yO as Xb,yQ as G,yT as Zb,yU as Qb,yV as $b,yW as ex,yX as tx,y_ as nx,ya as rx,yf as ix,yh as ax,yi as ox,yk as sx,yl as cx,ym as lx,yo as ux,yp as dx,yt as fx,yu as px,yv as mx,zA as hx,zC as gx,zE as _x,zH as vx,zJ as yx,zM as bx,zN as xx,zT as Sx,zU as Cx,zV as wx,zW as Tx,z_ as Ex,za as Dx,zc as Ox,zd as kx,zg as Ax,zi as jx,zk as Mx,zl as Nx,zm as Px,zn as Fx,zo as Ix,zr as Lx,zs as Rx,zy as zx}from"./api-CWqdeSbN.js";import{S as Bx,_ as Vx,a as Hx,b as Ux,c as Wx,d as Gx,f as Kx,g as qx,h as Jx,i as Yx,l as Xx,m as Zx,n as Qx,o as $x,p as eS,r as tS,s as nS,t as rS,u as iS,v as aS,x as oS,y as sS}from"./useNavigate-D3GIoxyW.js";import{B as cS,C as lS,D as uS,E as dS,F as fS,G as pS,H as mS,I as hS,J as gS,K as _S,L as vS,M as yS,N as bS,O as xS,P as SS,R as CS,T as wS,U as TS,V as ES,_ as DS,a as OS,b as kS,c as AS,d as jS,f as MS,g as NS,h as PS,i as FS,k as IS,l as LS,m as RS,n as zS,o as BS,p as VS,q as HS,r as US,s as WS,t as Mte,v as Nte,w as GS,x as KS,y as Pte,z as qS}from"./useStartNewChat-8wVLrYnZ.js";import{a as JS,c as Fte,d as YS,f as Ite,i as Lte,l as Rte,m as XS,n as zte,o as ZS,p as QS,r as $S,s as eC,u as tC}from"./speech-ehUcmGCg.js";import{t as nC}from"./check-DdmANHSb.js";import{r as rC}from"./dist-CzmY6YrA.js";import{t as Bte}from"./chevron-left-ByEQraEh.js";import{t as iC}from"./chevron-right-DMqzlhWH.js";import{t as aC}from"./chevron-up-B3KYmtzo.js";import{n as Vte,t as Hte}from"./usageView-BuRtXekW.js";import{_ as Ute,a as oC,c as sC,d as Wte,f as Gte,g as cC,h as Kte,i as lC,l as qte,m as Jte,n as uC,o as dC,p as Yte,r as fC,s as pC,t as mC,u as Xte}from"./dropdown-menu-BVKVjups.js";import{n as hC,t as gC}from"./search-Dz6sLH0-.js";import{t as _C}from"./copy-DbstFM9Q.js";import{t as vC}from"./download-BaebAe6Z.js";import{n as yC,t as bC}from"./eye-LggiM6Z5.js";import{a as Zte,i as Qte,n as xC,o as $te,t as SC}from"./deliveryRecorder-B_kVKMkR.js";import{t as CC}from"./loader-circle-BqKiW3X9.js";import{t as wC}from"./lock-BlVhOk85.js";import{t as TC}from"./checkbox-DPxJTQjc.js";import{a as ene,i as tne,n as nne,r as EC,t as rne}from"./cronDescribe-CkiSvbCK.js";import{t as DC}from"./pencil-K7SBkvHL.js";import{t as OC}from"./plus-DTL4K-j9.js";import{t as ine}from"./rotate-ccw-CvefWwHW.js";import{t as kC}from"./server-DcInl3Nh.js";import{i as AC,n as jC,r as MC,t as NC}from"./users-CRbE186D.js";import{t as PC}from"./trash-2-xhtrhYsd.js";import{t as FC}from"./triangle-alert-DoL9TI6v.js";import{i as IC,n as LC,t as RC}from"./useChart-bV4rotdu.js";import{t as zC}from"./x-CcIT4ync.js";import{a as ane,i as BC,n as VC,o as HC,r as UC,s as WC,t as GC}from"./tooltip-Ct0TGxtk.js";import{a as KC,i as qC,n as JC,r as YC,t as XC}from"./select-CjcMQhwm.js";import{a as ZC,c as QC,i as $C,n as ew,o as tw,r as nw,s as rw,t as iw}from"./alert-dialog-BcJMHbhI.js";import{n as aw,r as ow,t as sw}from"./popover-C-Y_Yoco.js";import{a as cw,i as lw,n as uw,o as dw,r as fw,t as pw}from"./tabs-B8emuY1B.js";import{t as K}from"./button-C_rIPtCv.js";import{t as mw}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{a as hw,c as gw,d as _w,i as vw,l as yw,n as bw,o as xw,r as Sw,s as Cw}from"./useFontScale-DiSkEM6I.js";import{n as ww,r as Tw,t as Ew}from"./toast-C_YfUacM.js";import{t as Dw}from"./badge-ChMMFtuW.js";import{c as Ow,d as kw,f as Aw,l as jw,o as Mw,r as Nw,s as Pw,u as Fw}from"./chunk-7TTQLYRW-ByhoRIPY.js";import{t as Iw}from"./preload-helper-Czpn1I53.js";import{a as Lw,i as Rw,n as zw,r as Bw}from"./format-AQELUhPa.js";import{a as Vw,i as Hw,n as Uw,o as Ww,r as Gw,t as Kw}from"./dialog-CPAskUwF.js";import{a as qw,d as Jw,f as Yw,h as Xw,i as Zw,l as Qw,m as $w,p as eT,r as tT}from"./searchSchemas-Dm-Qg010.js";import{n as nT,r as rT,t as iT}from"./appHost-CH3EGcJw.js";import{n as aT,r as oT,t as sT}from"./ConfirmDialog-B7k0wvSi.js";import{a as cT,c as lT,i as uT,n as dT,o as fT,r as pT,s as mT,t as hT}from"./EntitySheet-DRzkWKlH.js";import{a as gT,c as _T,d as vT,f as yT,g as bT,h as xT,i as ST,l as CT,m as wT,n as TT,o as ET,p as DT,r as OT,s as kT,u as AT}from"./KnobRow-D6kXWvVI.js";import{s as jT}from"./groupManageView-DC3eSLA1.js";import{n as MT,r as NT,t as PT}from"./fileMetaView-Ci5C4w9Q.js";import{n as FT,r as IT,t as LT}from"./measureClone-CHN0WNEY.js";import{r as RT,t as zT}from"./trashView-CwUC01r_.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-CtNcFhMz.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)?Qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Qd(t),e=$d(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=$d(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),cp._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-DpN3MOih.js","assets/bundle-mjs-C73ZY4La.js","assets/api-D64JTta1.js","assets/lock-xfEfLa2G.js","assets/checkbox-BuTZzFvU.js","assets/check-pVsND9oZ.js","assets/dist-DDCmobc1.js","assets/dist-mViq22LZ.js","assets/button-DeHzYOzP.js","assets/input-CZ0jp9Rx.js","assets/convexApi-DxRiI80M.js","assets/toast-DtA87VYn.js","assets/x-BNU-sWkh.js","assets/badge-DwWXPxwl.js","assets/ConfirmDialog-Bfi4_Ti8.js","assets/alert-dialog-C6NSAwQv.js","assets/dist-D4a9D7kU.js","assets/dialog-awuZdW9M.js","assets/EntitySheet-D8Vdib4B.js","assets/loader-circle-1XN8tjq6.js","assets/roleDescriptions-BW3e0J2_.js","assets/InstancesTab-DiW-4KlM.js","assets/FieldLabel-Ce8urE01.js","assets/tooltip-Dpar43UD.js","assets/select-wXM6h61N.js","assets/dist-C0V3m4aH.js","assets/chevron-up-s_deZUWR.js","assets/dist-BtzRSR0_.js","assets/popover-UJtu3EZ6.js","assets/locales-CPjguROj.js","assets/curation-CQksaIbm.js","assets/groupManageView-CKEYC6zY.js","assets/DataTableShell-1ZsZ0a2J.js","assets/chevrons-up-down-uk0IvxY8.js","assets/dropdown-menu-C5VrCGFe.js","assets/dist-B4zBnzNF.js","assets/plus-DrzxZ4iS.js","assets/trash-2-CqKGt3lC.js","assets/table-CegX53gV.js","assets/useTableLayout-Cmwnuzxb.js","assets/measureClone-CHN0WNEY.js","assets/BridgeTab-Cv2Co6h7.js","assets/useNavigate-D3GIoxyW.js","assets/chevron-right-DkaFdk2G.js","assets/usageView-DIPUGYx9.js","assets/server-C5TTb6-A.js","assets/triangle-alert-nUld87-H.js","assets/tabs-CfQK0-wk.js","assets/format-g5Z3Txjl.js","assets/appHost-CH3EGcJw.js","assets/FilterBar-DtNuk6dI.js","assets/search-NOJ0tWl2.js","assets/rotate-ccw-CiOuaG2h.js","assets/TimeRangePicker-jsNw51TL.js","assets/compatView-Db657dNx.js","assets/dispatchErrorInfo-C4Qh_2oR.js","assets/PromptInjectionsTab-KMsWE-dW.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-BpNy5aSd.css","assets/GroupsTab-CQrEUZSF.js","assets/chevron-left-CjQ1kn0w.js","assets/users-BUu1wJNm.js","assets/star-N2N0cbAA.js","assets/DetailChips-DkRU5HQ5.js","assets/IntegrationsTab-DqWlrC3M.js","assets/FeedbacksTab-YFBk45oU.js","assets/SubAgentReportsTab-BoNbdt38.js","assets/TrashTab-Dwjjxu8X.js","assets/use_paginated_query-C-Aw4n8b.js","assets/fileMetaView-Ci5C4w9Q.js","assets/trashView-TIQT30u4.js","assets/trashPage-D9B1uAuS.js","assets/trashPage-B7NvDkP2.css","assets/DeletedChatsTab-By_xLvEC.js","assets/FilesTab-DL27Krkt.js","assets/download-BUlwPQI8.js","assets/ScheduledTab-BBofaJj5.js","assets/list-Bb0MIh_I.js","assets/cronDescribe-B-ifUeLg.js","assets/pencil-CHRZ3__S.js","assets/TimezoneCombobox-zOqV7dxe.js","assets/AgentFilesTab-BM2NUWub.js","assets/capabilities-CASxhKEd.js","assets/PreferencesTab-DarNzYdF.js","assets/useFontScale-P_rNok04.js","assets/switch-Beq0wUQ_.js","assets/ChatDefaultsTab-Dr-czhQm.js","assets/KnobRow-4WODwFrS.js","assets/AccessTab-B2bpNynj.js","assets/ThemeShowroom-DdUZV2nA.js","assets/useChart-BTVKxdLu.js","assets/card-WAOfM0PL.js","assets/AdvancedFilter-DYTsdqhC.js","assets/ProjectPage-BbYuFPDW.js","assets/useStartNewChat-GAbwTTkG.js","assets/useStartNewChat-DgQf_3y0.css","assets/eye-BU60QIdS.js","assets/ProjectPage-D3DrzSxV.css","assets/TracesTab-Dg_eyLYF.js","assets/copy-4wREwP-V.js","assets/deliveryRecorder-owdOglrQ.js","assets/searchSchemas-Dm-Qg010.js","assets/VoiceTab-BFVfbSld.js","assets/speech-BPCrvnrE.js","assets/AuditTab-CqpDXgVz.js","assets/AnomaliesTab-BWiKxnXQ.js","assets/KpiTab-BXC9YG9_.js","assets/ServiceAccountsTab-CSIwvppo.js","assets/UsersTab-eQY9UCh5.js","assets/AdminSettings-C2bsOn0u.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{$E as s,$H as c,$N as l,$O as u,$T as d,$U as f,$V as p,$W as m,$Y as h,$_ as g,$a as _,$c as v,$d as y,$g as b,$i as x,$l as S,$m as C,$n as w,$r as T,$s as E,$t as D,$w as O,$y as k,$z as A,AC as j,AD as M,AE as N,AH as P,AM as F,AN as I,AQ as ee,AU as L,AV as R,AW as z,AX as B,A_ as V,Aa as te,Ab as ne,Ac as re,Ad as ie,Af as ae,Ag as oe,Ai as se,Ak as ce,Am as le,Ao as ue,Ar as de,As as fe,At as pe,Au as me,BC as he,BE as ge,BH as _e,BJ as ve,BM as ye,BN as be,BT as xe,BU as Se,BV as Ce,BW as we,B_ as Te,Ba as Ee,Bb as De,Bc as Oe,Bi as ke,Bk as Ae,Bl as je,Bm as Me,Bn as Ne,Bo as Pe,Br as Fe,Bs as Ie,By as Le,CB as Re,CC as ze,CE as Be,CH as Ve,CM as He,CO as Ue,CQ as We,CT as Ge,CU as Ke,CV as qe,CW as Je,CX as Ye,C_ as Xe,Ca as Ze,Cb as Qe,Cc as $e,Cf as et,Cg as tt,Ch as nt,Ci as rt,Ck as it,Cm as at,Co as ot,Cp as st,Ct as ct,Cu as lt,Cv as ut,DC as dt,DD as ft,DE as pt,DH as mt,DM as ht,DN as gt,DQ as _t,DT as vt,DU as yt,DV as bt,DW as xt,DX as St,D_ as Ct,Da as wt,Db as Tt,Dc as Et,Dd as Dt,Df as Ot,Dg as kt,Di as At,Dk as jt,Dm as Mt,Do as Nt,Dp as Pt,Dr as Ft,Ds as It,Dt as Lt,Du as Rt,Dv as zt,EB as Bt,EC as Vt,ED as Ht,EE as Ut,EH as Wt,EM as Gt,EQ as Kt,ET as qt,EU as Jt,EV as Yt,EW as Xt,EX as Zt,E_ as Qt,Ea as $t,Eb as en,Ec as tn,Ed as nn,Ef as rn,Eg as an,Ei as on,Ek as sn,Em as cn,Eo as ln,Ep as un,Er as dn,Es as fn,Et as pn,Eu as mn,Ev as hn,FC as gn,FD as _n,FE as vn,FH as yn,FJ as bn,FM as xn,FN as Sn,FO as Cn,FU as wn,FV as Tn,FW as En,F_ as Dn,Fa as On,Fc as kn,Fd as An,Fg as jn,Fi as Mn,Fk as Nn,Fm as Pn,Fn,Fo as In,Fr as Ln,Fs as Rn,Ft as zn,Fu as Bn,GC as Vn,GE as Hn,GH as Un,GN as Wn,GT as Gn,GU as Kn,GV as qn,GW as Jn,G_ as Yn,Ga as Xn,Gc as Zn,Gi as Qn,Gl as $n,Gm as er,Gn as tr,Gr as nr,Gs as rr,Gt as ir,Gy as ar,Gz as or,HC as sr,HE as cr,HH as lr,HJ as ur,HM as dr,HN as fr,HT as pr,HU as mr,HV as hr,HW as gr,H_ as _r,Ha as vr,Hc as yr,Hi as br,Hl as xr,Hm as Sr,Hn as Cr,Hr as wr,Hs as Tr,Hy as Er,IC as Dr,ID as Or,IE as kr,IH as Ar,IJ as jr,IM as Mr,IN as Nr,IO as Pr,IU as Fr,IV as Ir,IW as Lr,I_ as Rr,Ia as zr,Ic as Br,Id as Vr,Ig as Hr,Ii as Ur,Ik as Wr,Il as Gr,Im as Kr,In as qr,Io as Jr,Ir as Yr,Iy as Xr,JC as Zr,JE as Qr,JH as $r,JN as ei,JT as ti,JU as ni,JV as ri,JW as ii,JY as ai,J_ as oi,Ja as si,Jc as ci,Ji as li,Jl as ui,Jm as di,Jn as fi,Jr as pi,Js as mi,Jt as hi,Jz as gi,KC as _i,KE as vi,KH as yi,KN as bi,KT as xi,KU as Si,KV as Ci,KW as wi,K_ as Ti,Ka as Ei,Kc as Di,Ki as Oi,Kl as ki,Km as Ai,Kn as ji,Ko as Mi,Kr as Ni,Ks as Pi,Kt as Fi,Ky as Ii,Kz as Li,LC as Ri,LE as zi,LH as Bi,LM as Vi,LN as Hi,LT as Ui,LU as Wi,LV as Gi,LW as Ki,L_ as qi,La as Ji,Lc as Yi,Ld as Xi,Lg as Zi,Li as Qi,Lk as $i,Ll as ea,Lm as ta,Ln as na,Lo as ra,Lr as ia,Ly as aa,MC as oa,MD as sa,ME as ca,MH as la,MM as ua,MN as da,MO as fa,MU as pa,MV as ma,MW as ha,M_ as ga,Ma as _a,Mc as va,Md as ya,Mf as ba,Mg as xa,Mi as Sa,Mk as Ca,Mm as wa,Mo as Ta,Mr as Ea,Ms as Da,Mt as Oa,Mu as ka,NC as Aa,ND as ja,NE as Ma,NH as Na,NM as Pa,NN as Fa,NO as Ia,NU as La,NV as Ra,NW as za,NX as Ba,N_ as Va,Na as Ha,Nc as Ua,Nd as Wa,Nf as Ga,Ng as Ka,Ni as qa,Nk as Ja,Nm as Ya,No as Xa,Nr as Za,Nt as Qa,Nu as $a,O as eo,OC as to,OD as no,OE as ro,OH as io,OM as ao,ON as oo,OQ as so,OT as co,OU as lo,OV as uo,OW as fo,OX as po,O_ as mo,Oa as ho,Ob as go,Oc as _o,Od as vo,Of as yo,Og as bo,Oi as xo,Ok as So,Om as Co,Oo as wo,Op as To,Or as Eo,Os as Do,Ot as Oo,Ou as ko,PC as Ao,PD as jo,PE as Mo,PH as No,PM as Po,PN as Fo,PO as Io,PU as Lo,PV as Ro,PW as zo,PX as Bo,P_ as Vo,Pa as Ho,Pc as Uo,Pd as Wo,Pf as Go,Pg as Ko,Pi as qo,Pk as Jo,Pm as Yo,Po as Xo,Pr as Zo,Ps as Qo,Pt as $o,Pu as es,QC as ts,QE as ns,QH as rs,QN as is,QT as as,QU as os,QV as ss,QW as cs,QY as ls,Q_ as us,Qa as ds,Qc as fs,Qd as ps,Qg as ms,Qi as hs,Ql as gs,Qm as _s,Qn as vs,Qr as ys,Qs as bs,Qt as xs,Qw as Ss,Qz as Cs,RC as ws,RE as Ts,RH as Es,RJ as Ds,RM as Os,RN as ks,RT as As,RU as js,RV as Ms,RW as Ns,R_ as Ps,Ra as Fs,Rc as Is,Rd as Ls,Rg as Rs,Ri as zs,Rk as Bs,Rl as Vs,Rm as Hs,Rn as Us,Ro as Ws,Rr as Gs,Rs as Ks,Ry as qs,S as Js,SB as Ys,SD as Xs,SE as Zs,SH as Qs,SM as $s,SO as ec,SQ as tc,ST as nc,SU as rc,SV as ic,SW as ac,SX as oc,S_ as sc,Sa as cc,Sf as lc,Sh as uc,Si as dc,Sk as fc,Sm as pc,So as mc,Sp as hc,St as gc,Su as _c,Sv as vc,TB as yc,TC as bc,TE as xc,TH as Sc,TM as Cc,TO as wc,TQ as Tc,TT as Ec,TU as Dc,TV as Oc,TW as kc,TX as Ac,T_ as jc,Ta as Mc,Tb as Nc,Tc as Pc,Td as Fc,Tf as Ic,Tg as Lc,Ti as Rc,Tk as zc,Tm as Bc,To as Vc,Tp as Hc,Tt as Uc,Tu as Wc,Tv as Gc,UC as Kc,UE as qc,UH as Jc,UN as Yc,UT as Xc,UU as Zc,UV as Qc,UW as $c,U_ as el,Ua as tl,Uc as nl,Ui as rl,Um as il,Un as al,Uo as ol,Ur as sl,Us as cl,Uy as ll,Uz as ul,VC as dl,VE as fl,VH as pl,VJ as ml,VM as hl,VN as gl,VT as _l,VU as vl,VV as yl,VW as bl,V_ as xl,Va as Sl,Vc as Cl,Vi as wl,Vk as Tl,Vl as El,Vm as Dl,Vn as Ol,Vr as kl,Vs as Al,Vy as jl,WC as Ml,WE as Nl,WH as Pl,WN as Fl,WT as Il,WU as Ll,WV as Rl,WW as zl,W_ as Bl,Wa as Vl,Wc as Hl,Wi as Ul,Wl,Wm as Gl,Wn as Kl,Wr as ql,Ws as Jl,Wy as Yl,Wz as Xl,XC as Zl,XE as Ql,XH as $l,XN as eu,XO as tu,XT as nu,XU as ru,XV as iu,XW as au,XY as ou,X_ as su,Xa as cu,Xc as lu,Xd as uu,Xg as du,Xi as fu,Xl as pu,Xm as mu,Xn as hu,Xr as gu,Xs as _u,Xt as vu,Xy as yu,Xz as bu,YC as xu,YE as Su,YH as Cu,YN as wu,YO as Tu,YT as Eu,YU as Du,YV as Ou,YW as ku,YY as Au,Y_ as ju,Ya as Mu,Yc as Nu,Yd as Pu,Yi as Fu,Yl as Iu,Ym as Lu,Yn as Ru,Yo as zu,Yr as Bu,Ys as Vu,Yt as Hu,Yz as Uu,ZC as Wu,ZE as Gu,ZH as Ku,ZN as qu,ZT as Ju,ZU as Yu,ZV as Xu,ZW as Zu,ZY as Qu,Z_ as $u,Za as ed,Zc as td,Zd as nd,Zg as rd,Zi as id,Zl as ad,Zm as od,Zn as sd,Zr as cd,Zs as ld,Zt as ud,Zy as dd,Zz as fd,_B as pd,_D as md,_E as hd,_H as gd,_M as _d,_O as vd,_Q as yd,_T as bd,_U as xd,_V as Sd,_W as Cd,_X as wd,__ as Td,_a as Ed,_c as Dd,_f as Od,_h as kd,_i as Ad,_k as jd,_l as Md,_m as Nd,_o as Pd,_p as Fd,_t as Id,_u as Ld,_v as Rd,a as zd,aB as Bd,aD as Vd,aE as Hd,aH as Ud,aQ as Wd,aT as Gd,aU as Kd,aW as qd,aX as Jd,a_ as Yd,aa as Xd,ab as Zd,ac as Qd,af as $d,ai as ef,ak as tf,al as nf,an as rf,ao as af,ar as of,as as sf,at as cf,au as lf,av as uf,b as df,bB as ff,bD as pf,bE as mf,bH as hf,bM as gf,bO as _f,bQ as H,bT as vf,bU as yf,bV as bf,bW as xf,bX as Sf,b_ as Cf,ba as wf,bb as Tf,bf as Ef,bh as Df,bi as Of,bk as kf,bm as Af,bo as jf,bp as Mf,bt as Nf,bu as Pf,bv as Ff,cB as If,cD as Lf,cE as Rf,cH as zf,cQ as Bf,cT as Vf,cU as Hf,cW as Uf,cX as Wf,c_ as Gf,ca as Kf,cb as qf,cc as Jf,cd as Yf,cf as Xf,ci as Zf,cn as Qf,co as $f,cr as ep,cs as tp,ct as np,cu as rp,cv as ip,dB as ap,dD as op,dE as sp,dH as cp,dM as lp,dQ as up,dT as dp,dU as fp,dW as pp,dX as mp,d_ as hp,da as gp,db as _p,dc as vp,df as yp,dh as bp,di as xp,dk as Sp,dm as Cp,do as wp,dp as Tp,dr as Ep,dt as Dp,du as Op,dv as kp,eB as Ap,eD as jp,eE as Mp,eG as Np,eH as Pp,eT as Fp,eU as Ip,eW as Lp,eX as Rp,e_ as zp,ea as Bp,ec as Vp,ef as Hp,eh as Up,ei as Wp,el as Gp,em as Kp,en as qp,eo as Jp,er as Yp,eu as Xp,ev as Zp,fB as Qp,fD as $p,fE as em,fH as tm,fM as nm,fQ as rm,fT as im,fU as am,fW as om,fX as sm,f_ as cm,fa as lm,fb as um,fc as dm,ff as fm,fh as pm,fi as mm,fk as hm,fm as gm,fo as _m,fp as vm,fr as ym,ft as bm,fu as xm,fv as Sm,gB as Cm,gD as wm,gE as Tm,gH as Em,gM as Dm,gO as Om,gQ as km,gT as Am,gU as jm,gW as Mm,gX as Nm,g_ as Pm,ga as Fm,gc as Im,gf as Lm,gh as Rm,gi as zm,gk as Bm,gm as Vm,go as Hm,gp as Um,gt as Wm,gu as Gm,gv as Km,hB as qm,hD as Jm,hE as Ym,hH as Xm,hM as Zm,hQ as Qm,hT as $m,hU as eh,hW as th,hX as nh,hY as rh,h_ as ih,ha as ah,hc as oh,hd as sh,hf as ch,hh as lh,hi as uh,hk as dh,hm as fh,ho as ph,hp as mh,hr as hh,ht as gh,hu as _h,hv as vh,i as yh,iB as bh,iD as xh,iE as Sh,iH as Ch,iQ as wh,iU as Th,iW as Eh,iX as eee,i_ as tee,ia as nee,ib as ree,ic as iee,if as Dh,ii as Oh,il as kh,im as aee,in as oee,io as see,ir as cee,iu as lee,iv as Ah,jC as uee,jD as dee,jE as jh,jH as fee,jI as pee,jM as mee,jN as hee,jO as gee,jU as _ee,jV as vee,jW as yee,jX as bee,j_ as Mh,ja as Nh,jb as xee,jc as See,jd as Ph,jf as Fh,jg as Cee,ji as Ih,jk as wee,jm as Lh,jo as Rh,jr as zh,js as Bh,jt as Tee,ju as Vh,k as U,kC as Hh,kD as Uh,kE as Wh,kH as Gh,kM as Kh,kN as qh,kQ as Jh,kT as Yh,kV as Xh,kW as Zh,kX as Eee,k_ as Qh,ka as $h,kb as Dee,kc as Oee,kd as kee,kf as Aee,kg as jee,ki as Mee,kk as Nee,km as Pee,ko as Fee,kr as eg,ks as tg,kt as ng,ku as rg,lB as ig,lD as ag,lE as og,lH as sg,lQ as cg,lT as lg,lU as ug,lW as dg,lX as fg,l_ as pg,la as mg,lb as hg,lc as gg,ld as _g,lf as vg,li as yg,lk as bg,lo as xg,lr as Sg,lt as Cg,lu as wg,lv as Tg,mB as Eg,mD as Dg,mE as Og,mH as kg,mM as Ag,mQ as jg,mT as Mg,mU as Ng,mW as Pg,mX as Fg,m_ as Ig,ma as Lg,mc as Rg,mf as zg,mh as Bg,mi as Vg,mk as Hg,mm as Ug,mo as Wg,mp as Gg,mr as Kg,mt as qg,mu as Jg,mv as Yg,nB as Xg,nD as Zg,nE as Qg,nG as $g,nH as e_,nU as t_,nW as n_,nX as r_,n_ as i_,na as a_,nb as o_,nc as s_,nf as c_,ni as l_,nl as u_,nn as d_,no as f_,nr as p_,nu as m_,nv as h_,o as g_,oB as __,oD as v_,oE as y_,oH as b_,oQ as x_,oT as S_,oU as C_,oW as w_,oX as T_,o_ as E_,oa as D_,ob as O_,oc as k_,of as A_,oi as j_,ok as M_,ol as N_,om as P_,on as F_,oo as I_,or as L_,os as R_,ot as z_,ou as B_,ov as Iee,pB as Lee,pD as Ree,pE as zee,pH as Bee,pM as Vee,pQ as Hee,pT as Uee,pU as Wee,pW as Gee,pX as Kee,p_ as qee,pa as Jee,pc as Yee,pf as Xee,ph as Zee,pi as Qee,pk as $ee,pm as V_,po as ete,pp as tte,pr as nte,pt as rte,pu as ite,pv as ate,qC as ote,qE as ste,qH as cte,qN as H_,qT as lte,qU as ute,qV as dte,qW as U_,q_ as W_,qa as fte,qc as pte,qi as mte,ql as hte,qm as gte,qn as _te,qr as G_,qs as K_,qt as vte,qz as yte,r as bte,rB as xte,rD as Ste,rE as Cte,rG as wte,rH as q_,rQ as J_,rU as Tte,rW as Ete,rX as Dte,r_ as Ote,ra as Y_,rb as kte,rc as Ate,rf as X_,ri as jte,rl as Z_,rn as Q_,ro as $_,rr as ev,ru as tv,rv as nv,sB as rv,sD as iv,sE as av,sH as ov,sQ as sv,sT as cv,sU as lv,sW as uv,sX as dv,s_ as fv,sa as pv,sb as mv,sc as hv,sf as gv,si as _v,sl as vv,sm as yv,sn as bv,so as xv,sr as Sv,ss as Cv,st as wv,su as Tv,sv as Ev,t as W,tB as Dv,tD as Ov,tE as kv,tG as Av,tH as jv,tU as Mv,tW as Nv,tX as Pv,t_ as Fv,ta as Iv,tb as Lv,tc as Rv,tf as zv,ti as Bv,tl as Vv,tm as Hv,tn as Uv,to as Wv,tr as Gv,tu as Kv,tv as qv,uB as Jv,uD as Yv,uE as Xv,uH as Zv,uM as Qv,uQ as $v,uT as ey,uU as ty,uW as ny,uX as ry,u_ as iy,ua as ay,ub as oy,uc as sy,uf as cy,ui as ly,uk as uy,um as dy,uo as fy,up as py,ur as my,ut as hy,uu as gy,uv as _y,vB as vy,vD as yy,vE as by,vH as xy,vM as Sy,vO as Cy,vQ as wy,vT as Ty,vU as Ey,vV as Dy,vW as Oy,vX as ky,v_ as Ay,va as jy,vb as My,vc as Ny,vf as Py,vh as Fy,vi as Iy,vk as Ly,vl as Ry,vm as zy,vo as By,vp as Vy,vt as Hy,vu as Uy,vv as Wy,w as Gy,wB as Ky,wC as qy,wE as Jy,wH as Yy,wM as Xy,wO as Zy,wQ as Qy,wT as $y,wU as eb,wV as tb,wW as nb,wX as rb,w_ as ib,wa as ab,wb as ob,wc as sb,wf as cb,wg as lb,wh as ub,wi as db,wk as fb,wm as pb,wo as mb,wp as hb,wt as gb,wu as _b,wv as vb,x as yb,xB as bb,xD as xb,xE as Sb,xH as Cb,xM as wb,xO as Tb,xQ as Eb,xT as Db,xU as Ob,xV as kb,xW as Ab,xX as jb,x_ as Mb,xa as Nb,xf as Pb,xh as Fb,xi as Ib,xk as Lb,xm as Rb,xo as zb,xp as Bb,xt as Vb,xu as Hb,xv as Ub,y as Wb,yB as Gb,yD as Kb,yE as qb,yH as Jb,yM as Yb,yO as Xb,yQ as G,yT as Zb,yU as Qb,yV as $b,yW as ex,yX as tx,y_ as nx,ya as rx,yf as ix,yh as ax,yi as ox,yk as sx,yl as cx,ym as lx,yo as ux,yp as dx,yt as fx,yu as px,yv as mx,zA as hx,zC as gx,zE as _x,zH as vx,zJ as yx,zM as bx,zN as xx,zT as Sx,zU as Cx,zV as wx,zW as Tx,z_ as Ex,za as Dx,zc as Ox,zd as kx,zg as Ax,zi as jx,zk as Mx,zl as Nx,zm as Px,zn as Fx,zo as Ix,zr as Lx,zs as Rx,zy as zx}from"./api-D64JTta1.js";import{S as Bx,_ as Vx,a as Hx,b as Ux,c as Wx,d as Gx,f as Kx,g as qx,h as Jx,i as Yx,l as Xx,m as Zx,n as Qx,o as $x,p as eS,r as tS,s as nS,t as rS,u as iS,v as aS,x as oS,y as sS}from"./useNavigate-D3GIoxyW.js";import{B as cS,C as lS,D as uS,E as dS,F as fS,G as pS,H as mS,I as hS,J as gS,K as _S,L as vS,M as yS,N as bS,O as xS,P as SS,R as CS,T as wS,U as TS,V as ES,_ as DS,a as OS,b as kS,c as AS,d as jS,f as MS,g as NS,h as PS,i as FS,k as IS,l as LS,m as RS,n as zS,o as BS,p as VS,q as HS,r as US,s as WS,t as Mte,v as Nte,w as GS,x as KS,y as Pte,z as qS}from"./useStartNewChat-GAbwTTkG.js";import{a as JS,c as Fte,d as YS,f as Ite,i as Lte,l as Rte,m as XS,n as zte,o as ZS,p as QS,r as $S,s as eC,u as tC}from"./speech-BPCrvnrE.js";import{t as nC}from"./check-pVsND9oZ.js";import{r as rC}from"./dist-C0V3m4aH.js";import{t as Bte}from"./chevron-left-CjQ1kn0w.js";import{t as iC}from"./chevron-right-DkaFdk2G.js";import{t as aC}from"./chevron-up-s_deZUWR.js";import{n as Vte,t as Hte}from"./usageView-DIPUGYx9.js";import{_ as Ute,a as oC,c as sC,d as Wte,f as Gte,g as cC,h as Kte,i as lC,l as qte,m as Jte,n as uC,o as dC,p as Yte,r as fC,s as pC,t as mC,u as Xte}from"./dropdown-menu-C5VrCGFe.js";import{n as hC,t as gC}from"./search-NOJ0tWl2.js";import{t as _C}from"./copy-4wREwP-V.js";import{t as vC}from"./download-BUlwPQI8.js";import{n as yC,t as bC}from"./eye-BU60QIdS.js";import{a as Zte,i as Qte,n as xC,o as $te,t as SC}from"./deliveryRecorder-owdOglrQ.js";import{t as CC}from"./loader-circle-1XN8tjq6.js";import{t as wC}from"./lock-xfEfLa2G.js";import{t as TC}from"./checkbox-BuTZzFvU.js";import{a as ene,i as tne,n as nne,r as EC,t as rne}from"./cronDescribe-B-ifUeLg.js";import{t as DC}from"./pencil-CHRZ3__S.js";import{t as OC}from"./plus-DrzxZ4iS.js";import{t as ine}from"./rotate-ccw-CiOuaG2h.js";import{t as kC}from"./server-C5TTb6-A.js";import{i as AC,n as jC,r as MC,t as NC}from"./users-BUu1wJNm.js";import{t as PC}from"./trash-2-CqKGt3lC.js";import{t as FC}from"./triangle-alert-nUld87-H.js";import{i as IC,n as LC,t as RC}from"./useChart-BTVKxdLu.js";import{t as zC}from"./x-BNU-sWkh.js";import{a as ane,i as BC,n as VC,o as HC,r as UC,s as WC,t as GC}from"./tooltip-Dpar43UD.js";import{a as KC,i as qC,n as JC,r as YC,t as XC}from"./select-wXM6h61N.js";import{a as ZC,c as QC,i as $C,n as ew,o as tw,r as nw,s as rw,t as iw}from"./alert-dialog-C6NSAwQv.js";import{n as aw,r as ow,t as sw}from"./popover-UJtu3EZ6.js";import{a as cw,i as lw,n as uw,o as dw,r as fw,t as pw}from"./tabs-CfQK0-wk.js";import{t as K}from"./button-DeHzYOzP.js";import{t as mw}from"./input-CZ0jp9Rx.js";import"./convexApi-DxRiI80M.js";import{a as hw,c as gw,d as _w,i as vw,l as yw,n as bw,o as xw,r as Sw,s as Cw}from"./useFontScale-P_rNok04.js";import{n as ww,r as Tw,t as Ew}from"./toast-DtA87VYn.js";import{t as Dw}from"./badge-DwWXPxwl.js";import{c as Ow,d as kw,f as Aw,l as jw,o as Mw,r as Nw,s as Pw,u as Fw}from"./chunk-7TTQLYRW-ByhoRIPY.js";import{t as Iw}from"./preload-helper-Czpn1I53.js";import{a as Lw,i as Rw,n as zw,r as Bw}from"./format-g5Z3Txjl.js";import{a as Vw,i as Hw,n as Uw,o as Ww,r as Gw,t as Kw}from"./dialog-awuZdW9M.js";import{a as qw,d as Jw,f as Yw,h as Xw,i as Zw,l as Qw,m as $w,p as eT,r as tT}from"./searchSchemas-Dm-Qg010.js";import{n as nT,r as rT,t as iT}from"./appHost-CH3EGcJw.js";import{n as aT,r as oT,t as sT}from"./ConfirmDialog-Bfi4_Ti8.js";import{a as cT,c as lT,i as uT,n as dT,o as fT,r as pT,s as mT,t as hT}from"./EntitySheet-D8Vdib4B.js";import{a as gT,c as _T,d as vT,f as yT,g as bT,h as xT,i as ST,l as CT,m as wT,n as TT,o as ET,p as DT,r as OT,s as kT,u as AT}from"./KnobRow-4WODwFrS.js";import{s as jT}from"./groupManageView-CKEYC6zY.js";import{n as MT,r as NT,t as PT}from"./fileMetaView-Ci5C4w9Q.js";import{n as FT,r as IT,t as LT}from"./measureClone-CHN0WNEY.js";import{r as RT,t as zT}from"./trashView-TIQT30u4.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-C2bsOn0u.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)?Qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Qd(t),e=$d(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=$d(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),cp._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&&!YS())return null;let u=JS(e.lang,rm()),d=t.active?.messageId===i,f=d&&t.active?.phase===`loading`,p=d&&t.active?.phase===`playing`,m=()=>{C7();let o=tC(c);if(l){let n=ZS(o,{lang:u,rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(n?{messageId:i,phase:`playing`}:null);return}if(!a)return;let s=S7;t.setActive({messageId:i,phase:`loading`}),n({chatId:a,text:o.slice(0,1500)}).then(({mime:n,audioBase64:r})=>{if(s!==S7)return;let a=Lte(r,n,{rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(a?{messageId:i,phase:`playing`}:null)}).catch(e=>{s===S7&&(r.error(cx(),e),t.setActive(null))})};return(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn${d?` oc-iconbtn--reading`:``}`,title:d?es():Bn(),"aria-label":d?es():Bn(),"aria-pressed":d,"aria-busy":f,onClick:()=>{if(d){C7(),t.setActive(null);return}m()},children:f?(0,J.jsx)(CC,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}):p?(0,J.jsx)(koe,{}):(0,J.jsx)(Ooe,{})})}function Doe(){let e=(0,q.useContext)(x7);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)(CC,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,J.jsx)(Ite,{size:14,className:`oc-reading-banner__pulse`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:t?Ry():Md()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-reading-banner__stop`,onClick:()=>{C7(),e.setActive(null)},children:es()})]})}function Ooe(){return(0,J.jsxs)(z7,{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 koe(){return(0,J.jsxs)(z7,{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 V7(){return(0,J.jsxs)(z7,{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 H7(){return(0,J.jsx)(z7,{children:(0,J.jsx)(`path`,{d:`M20 6 9 17l-5-5`})})}function Aoe({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 U7={File:Fie,Text:Aoe},joe={...U7,Text:oJ,data:{by_name:{widget:H0,thinking:qre,commentary:Yre}},tools:{by_name:{__turn_flow__:Lre,__delegated_reply__:Ioe}}};function W7({kind:e}){let t=$(e=>$6(e.metadata?.custom)),n=G(W.messages.deleteMessage).withOptimisticUpdate(z8),r=aT(),i=Tw(),a=(0,q.useContext)(E7),[o,s]=(0,q.useState)(!1),c=RV(e=>e.isRunning);if(!t)return null;async function l(){if(await r(e===`assistant`?{title:Ob(),description:yf(),confirmLabel:Qb(),cancelLabel:Ey(),destructive:!0}:{title:xd(),description:jm(),confirmLabel:eh(),cancelLabel:Ey(),destructive:!0})){s(!0),e===`assistant`&&a?.begin();try{await n({messageId:t})}catch(t){e===`assistant`&&a?.cancel(),i.error(fp(),t)}finally{s(!1)}}}return(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-iconbtn--danger`,title:c?yv():e===`assistant`?Ng():Wee(),"aria-label":am(),"aria-busy":o,disabled:o||c,onClick:()=>void l(),children:o?(0,J.jsx)(CC,{size:15,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,J.jsx)(PC,{size:15,"aria-hidden":!0})})}function G7(){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??K7),i=H(W.subAgents.listSubAgents,e===``&&t?{chatId:t}:`skip`),a=e===``?H$(i??[],m5(r),n).find(e=>e.status===`done`&&e.resultText)?.resultText??``:``,o=e===``&&a!==``,s=e===``?a:e,[c,l]=(0,q.useState)(!1),u=[...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?Qs({count:u}):u>1?Ve({count:u}):Yy({count:u})}),(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:Cb(),"aria-label":Cb(),onClick:()=>{navigator.clipboard?.writeText(s).then(()=>{l(!0),window.setTimeout(()=>l(!1),1200)})},children:c?(0,J.jsx)(H7,{}):(0,J.jsx)(V7,{})})]}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:s.length>0?s:hf()})]})}function Moe({active:e,onToggle:t}){return(0,J.jsx)(`button`,{type:`button`,className:`oc-iconbtn${e?` is-on`:``}`,onClick:t,"aria-pressed":e,title:e?Jb():xy(),"aria-label":gd(),children:(0,J.jsx)(SA,{size:15,"aria-hidden":!0})})}function Noe(){let[e,t]=(0,q.useState)(!1),n=T7(),r=$(e=>e.id.startsWith(`optimistic-`)),i=WC(),a=$(e=>e.isLast),o=$(e=>e.metadata?.custom?.queued===!0),s=$(e=>e.id),c=$(e=>e.metadata?.custom?.custody??null),l=$(e=>e.metadata?.custom?.chatId??null),{can:u}=OT(c===`queued`?l:null),d=$(e=>e.metadata?.custom?.quotedRefs??null),f=Tw(),p=$(e=>e.metadata?.custom?.authorName??null);return(0,J.jsx)(yG.Root,{className:`oc-msg oc-msg--user${r?` is-sending`:``}${o?` is-queued`:``}`,"data-message-id":s,children:(0,J.jsxs)(`div`,{className:`oc-msg__col oc-msg__col--user`,children:[(0,J.jsx)(XK,{}),p===null?null:(0,J.jsx)(`div`,{className:`oc-msg__author`,children:fn({name:p})}),d?.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,className:`oc-msg__quote`,title:Hc(),onClick:e.messageId?()=>J7(e.messageId,e.blockIndex,f):void 0,children:[(0,J.jsx)(uj,{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)(G7,{}):(0,J.jsx)(yG.Parts,{components:U7})}),r?(0,J.jsxs)(`span`,{className:`oc-msg__sending`,role:`status`,children:[(0,J.jsx)(`span`,{className:`oc-msg__sending-spin`,"aria-hidden":!0}),Xm()]}):o?(0,J.jsxs)(`span`,{className:`oc-msg__queued`,role:`status`,children:[(0,J.jsx)(hC,{size:12,"aria-hidden":!0}),kg()]}):(0,J.jsxs)(J.Fragment,{children:[w8(c)===null?null:(0,J.jsx)(Qre,{custody:c,messageId:s,canWithdraw:u(`discardPendingInput`)}),(0,J.jsxs)(_H.Root,{className:`oc-msg__actions oc-msg__actions--user`,autohide:`never`,"data-reveal":x5(i,a),children:[(0,J.jsx)(eq,{}),n.copyUser?(0,J.jsxs)(_H.Copy,{className:`oc-iconbtn`,title:Em(),children:[(0,J.jsx)(yG.If,{copied:!0,children:(0,J.jsx)(H7,{})}),(0,J.jsx)(yG.If,{copied:!1,children:(0,J.jsx)(V7,{})})]}):null,n.showSource?(0,J.jsx)(Moe,{active:e,onToggle:()=>t(e=>!e)}):null,n.showReport?(0,J.jsx)(A5,{}):null,n.showDelete?(0,J.jsx)(W7,{kind:`user`}):null]})]})]})})}function Poe({pool:e,agent:t}){let n=$2(e,t),r=n?.displayName??t.agentId;return(0,J.jsxs)(`span`,{className:`oc-chip oc-chip--agent oc-msg__agent`,title:zl({name:r}),children:[n?.emoji?(0,J.jsx)(`span`,{className:`oc-chip__emoji`,"aria-hidden":!0,children:n.emoji}):(0,J.jsx)(HS,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-chip__label`,children:r})]})}var K7=[],Foe=[];function q7(){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 Ioe(e){let t=$(e=>e.metadata?.custom?.chatId),n=$(e=>e.metadata?.custom?.messageId),r=sie(H(W.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)(wA,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:du({agent:e.agentId})})]}):null,(0,J.jsx)(aJ,{text:e.resultText})]},e.childSessionKey))})}function Loe({show:e}){let t=$(e=>e.metadata?.custom?.status),n=$(e=>{let t=e.metadata?.custom;return t5(t?.interruption,t?.status)}),r=$(e=>e.metadata?.custom?.steerSegment===!0),i=$(e=>e.metadata?.custom?.chatId),a=$(e=>y$(e.content)),o=$(e=>e.content.some(e=>e?.type===`file`||e?.type===`data`&&e.name===`widget`)),s=$(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??K7),c=H(W.subAgents.listSubAgents,i?{chatId:i}:`skip`),l=$(e=>e.metadata?.custom?.messageId),u=$(e=>e.metadata?.custom?.settledAt??void 0),d=$(e=>e.metadata?.custom?.hasContinuation===!0),f=$(e=>e.metadata?.custom?.answeredChildRunIds??Foe),p=$(e=>e.metadata?.custom?.handOff??null),m=$(e=>e.metadata?.custom?.repeatWithheld===!0),[,h]=(0,q.useState)(0),g=y5({status:t,hasText:a||m,hasMedia:o,settledAt:u,delegatedInline:d,answeredChildRunIds:f,...p===null?{}:{projected:p.projected,resumedChildRunIds:p.resumedChildRunIds,resumedChildKeys:p.resumedChildKeys,laterUserTurn:p.laterUserTurn}},s,c,l),_=g.kind===`composing`||g.kind===`waiting`?g.recheckAt??null:null;return(0,q.useEffect)(()=>{if(_===null)return;let e=window.setTimeout(()=>h(e=>e+1),Math.max(_-Date.now(),0)+250);return()=>window.clearTimeout(e)},[_]),g.kind===`none`||r||n||p?.projected===!0&&(g.kind===`composing`||g.kind===`waiting`)?null:g.kind===`composing`?(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,J.jsx)(q7,{}),(0,J.jsx)(CC,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:g.taskName?zp({task:g.taskName}):Fv()})]}):g.kind===`failed`?e&&g.cardSilent!==!0?null:(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--failed`,role:`status`,children:[(0,J.jsx)(HS,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:g.taskName?ms({task:g.taskName,reason:g.reason}):b({reason:g.reason})})]}):g.kind===`waiting`?e&&g.recheckAt===void 0?null:(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,J.jsx)(q7,{}),(0,J.jsx)(CC,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:g.taskName?i_({task:g.taskName}):Ote()})]}):g.kind===`done`?g.resultText?(0,J.jsxs)(J.Fragment,{children:[g.agentId?(0,J.jsxs)(`div`,{className:`oc-empty-answer__from`,role:`note`,children:[(0,J.jsx)(wA,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:du({agent:g.agentId})})]}):null,(0,J.jsx)(aJ,{text:g.resultText})]}):null:(0,J.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--generic`,role:`status`,children:[(0,J.jsx)(HS,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-empty-answer__text`,children:rd()})]})}function Roe(){let[e,t]=(0,q.useState)(!1),n=T7(),r=WC(),i=$(e=>e.isLast),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=zK(),u=F2(),d=$(e=>e.id),f=$(e=>e.metadata?.custom?.groupMembers??null),p=$(e=>e.status?.type===`running`),m=(0,q.useMemo)(()=>TK(d,p,f),[d,p,f]),h=l?.byMessage,g=(0,q.useMemo)(()=>new Set(m.flatMap(e=>(h?.get(e)??[]).flatMap(t=>t.blockIndex===null?[]:[EK(e,t.blockIndex)]))),[h,m]),_=(0,q.useContext)(A7),v=Tw(),y=(0,q.useCallback)((e,t)=>iK(OM(e,t)),[]),b=$(e=>e.metadata?.custom?.groupText??e.metadata?.custom?.rawText??``),x=$(e=>e.status?.type===`running`),S=$(e=>e.metadata?.custom?.chatId),C=$(e=>e.metadata?.custom?.messageId),w=$(e=>e.metadata?.custom?.status),T=$(e=>e.content.some(e=>e?.type===`file`)),E=$(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??K7),D=H(W.subAgents.listSubAgents,b===``&&S?{chatId:S}:`skip`),O=b===``?y5({status:w,hasText:!1,hasMedia:T},E,D,C):null,k=b===``?O?.kind===`done`?O.resultText??``:``:b,A=(0,q.useContext)(X8),j=A!==null&&A.messageId===d?A:null,M=$(e=>e.metadata?.custom?.status),N=(0,q.useContext)(l5),P=$(e=>xie(e.metadata?.custom?.steerSegment===!0,e.content)),F=$(e=>e.metadata?.custom?.groupFollows===!0),I=$(e=>e.metadata?.custom?.groupContinues===!0);Toe($(e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
156
156
  `)));let ee=M7(),L=ee&&ee.perTurnRouting?ee.messageAgents.has(d)?ee.messageAgents.get(d)??ee.primary:ee.fallbackAgent:null,R=ee?.pool,z=$(e=>e.metadata?.custom?.importedAgentLabel??null),B=(0,q.useMemo)(()=>{if(z!==null)return{...u,agentName:z,agentEmoji:null};if(!L)return u;let e=$2(R??[],L);return{...u,agentName:e?.displayName??L.agentId,agentEmoji:e?.emoji??null}},[z,L,u,R]);return M===void 0&&N||P&&!n.showTools?null:(0,J.jsxs)(yG.Root,{className:`oc-msg oc-msg--assistant oc-reveal-host${F?` oc-msg--group-follow`:``}${I?` oc-msg--group-continues`:``}`,"data-message-id":d,children:[F?(0,J.jsx)(`span`,{className:`oc-msg__avatar oc-msg__avatar--group`,"aria-hidden":!0}):(0,J.jsx)(N7,{className:`oc-msg__avatar`}),(0,J.jsxs)(`div`,{className:`oc-msg__col`,children:[F?null:(0,J.jsxs)(`div`,{className:`oc-msg__name`,children:[L?(0,J.jsx)(Poe,{pool:ee.pool,agent:L}):(0,J.jsxs)(J.Fragment,{children:[u.agentEmoji?(0,J.jsx)(`span`,{className:`oc-msg__name-emoji`,"aria-hidden":!0,children:u.agentEmoji}):null,I2(u)]}),(0,J.jsx)(eq,{header:!0}),_!==null&&!d.startsWith(`optimistic-`)&&!x&&k!==``?(0,J.jsx)(`button`,{type:`button`,className:`oc-bmk-headbtn oc-reveal oc-hit`,title:Pt(),"aria-label":Pt(),onClick:()=>{let e=bK(k,280);if(e===``)return;let t=y(_,{messageId:d,blockIndex:null,excerpt:e});t!==null&&v.error(t)},children:(0,J.jsx)(uj,{size:13})}):null]}),(0,J.jsxs)(`div`,{className:`oc-msg__body`,children:[(0,J.jsx)(lre,{}),(0,J.jsx)(`div`,{className:`oc-msg__meta oc-msg__meta--cron`,children:(0,J.jsx)(lq,{})}),n.showTools?(0,J.jsxs)(`div`,{className:`oc-msg__meta`,children:[(0,J.jsx)(L4,{}),(0,J.jsx)(fie,{}),(0,J.jsx)($re,{}),(0,J.jsx)(gY,{})]}):null,(0,J.jsx)(hie,{}),(0,J.jsx)(_ie,{}),e?(0,J.jsx)(G7,{}):(0,J.jsx)(yG.Parts,{components:joe}),(0,J.jsx)(vie,{}),(0,J.jsx)(yie,{}),e?null:(0,J.jsx)(Loe,{show:n.showTools}),(0,J.jsx)(Qae,{}),(0,J.jsx)(P2.Provider,{value:B,children:(0,J.jsx)(G8,{})}),j===null?null:(0,J.jsx)(F7,{quiet:j.quiet===!0,running:j.running,since:j.workingSince,progress:j.progressSummary??null,anchored:!0})]}),_!==null&&!d.startsWith(`optimistic-`)&&!I?(0,J.jsx)(T5,{kind:`quote`,open:a,onOpenChange:o,messageId:d,sources:m,onPick:e=>y(_,{messageId:e.messageId,blockIndex:e.blockIndex,excerpt:e.excerpt})}):null,l!==null&&!d.startsWith(`optimistic-`)&&!I?(0,J.jsx)(T5,{kind:`bookmark`,open:s,onOpenChange:c,messageId:d,sources:m,marked:g,onPick:e=>l.toggle(e.messageId,e.blockIndex).then(oK)}):null,(0,J.jsx)(XK,{messageLevelMarkers:!1,onReplyToBlock:_!==null&&!d.startsWith(`optimistic-`)?(e,t)=>y(_,{messageId:d,blockIndex:e,excerpt:t}):void 0}),I?null:(0,J.jsxs)(_H.Root,{className:`oc-msg__actions`,autohide:`never`,"data-reveal":x5(r,i),children:[n.copyAssistant?(0,J.jsx)(woe,{}):null,(0,J.jsx)(Eoe,{}),n.showReport?(0,J.jsx)(A5,{}):null,n.showDelete?(0,J.jsx)(W7,{kind:`assistant`}):null,(0,J.jsx)(Soe,{sourceShown:n.showSource,sourceActive:e,onToggleSource:()=>t(e=>!e),onPickBlock:_!==null&&!d.startsWith(`optimistic-`)&&m.length>0&&k!==``?()=>o(!0):void 0,onPickBookmarkBlock:l!==null&&!d.startsWith(`optimistic-`)&&m.length>0&&k!==``?()=>c(!0):void 0})]})]})]})}function zoe(){let e=$(e=>e.id);return(0,J.jsx)(yG.Root,{className:`oc-msg oc-msg--system`,"data-message-id":e,children:(0,J.jsx)(`div`,{className:`oc-msg__body`,children:(0,J.jsx)(yG.Parts,{components:U7})})})}function J7(e,t,n){if(document.querySelector(`[data-message-id="${CSS.escape(e)}"]`)===null&&document.querySelector(`[data-message-id]`)!==null){n.error(un());return}BK(e,t,`smooth`)}function Boe({chatId:e}){let t=FM(e),n=Tw();return t.length===0?null:(0,J.jsx)(`div`,{className:`oc-composer__quotes`,role:`group`,"aria-label":hb(),children:t.map(t=>(0,J.jsxs)(`div`,{className:`oc-composer__quote`,children:[(0,J.jsx)(uj,{size:13,"aria-hidden":!0,className:`oc-composer__quote-ico`}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__quote-text`,title:Hc(),onClick:()=>J7(t.messageId,t.blockIndex,n),children:t.excerpt}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__quote-x`,"aria-label":st(),onClick:()=>kM(e,AM(t)),children:(0,J.jsx)(zC,{size:13,"aria-hidden":!0})})]},AM(t)))})}function Voe(){let e=NV(e=>e.status?.type),t=NV(e=>e.type),n=NV(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&&IJ(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)(FH.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)(vA,{size:14}):t===`image`?(0,J.jsx)(VA,{size:14}):(0,J.jsx)(cj,{size:14})}),r&&!a?null:(0,J.jsx)(`span`,{className:`oc-attach__name`,children:(0,J.jsx)(FH.Name,{})}),a?(0,J.jsx)(`span`,{className:`oc-attach__state`,children:Ir()}):null,!a&&(f||r)?(0,J.jsx)(`button`,{type:`button`,className:`oc-attach__view`,"aria-label":ma(),title:ma(),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
- `+R():n)}).catch(()=>{d.current===e&&u(null)})}},children:(0,J.jsx)(bC,{size:13,"aria-hidden":!0})}):null,(0,J.jsx)(FH.Remove,{className:`oc-attach__remove`,"aria-label":Ra(),children:(0,J.jsx)(zC,{size:13,"aria-hidden":!0})}),(0,J.jsx)(Kw,{open:s,onOpenChange:c,children:(0,J.jsxs)(Uw,{className:`oc-attach__dialog`,children:[(0,J.jsx)(Vw,{children:(0,J.jsx)(Ww,{className:`oc-attach__dialog-title`,children:n?.name??ma()})}),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 Hoe(){let e=(0,q.useSyncExternalStore)(q0.subscribe,q0.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)(CC,{className:`oc-upload__spin`,size:14,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:e.count>1?Ro({count:e.count,percent:e.percent}):Tn({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 Uoe({reason:e}){let t=(0,q.useContext)(D7),n=PV(),r=FV(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?gi():qm(),title:r?i?yte():Eg():i?Uu():Cm(),onClick:()=>{if(t===null)return;let e=n.getState().text;e.trim()!==``&&t(e).then(e=>{e&&n.setText(``)})},children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})}function Y7(){let e=(0,q.useContext)(O7);return e===null?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send oc-composer__stop`,"aria-label":ff(),title:Gb(),onClick:()=>void e(),children:(0,J.jsx)(Cj,{size:14,"aria-hidden":!0})})}function Woe({chatId:e,gate:t,onManage:n}){let r=M7(),i=H(W.chatAgents.listChatAgents,{chatId:e}),a=i?z2(i.viewerRoomRole):!1,o=Tw(),[s,c]=(0,q.useState)(!1),l=(0,q.useRef)(null),[u,d]=(0,q.useState)(`agents`),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(`member`),g=U2(i?.viewerRoomRole),_=W2(m,i?.viewerRoomRole),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1);(0,q.useEffect)(()=>{h(`member`),p(``),y(!1),x(!1)},[e]);let S=H(W.chatParticipants.listInvitable,a&&s&&u===`people`?{chatId:e}:`skip`),C=G(W.chatParticipants.addMember),w=G(W.chatParticipants.removeMember),T=t=>{w({chatId:e,memberId:t.userId}).then(()=>o.success(my({name:t.name}))).catch(()=>o.error(Cv()))},E=H(W.chatAgents.listAddableAgents,a&&s&&u===`agents`?{chatId:e}:`skip`),D=G(W.chatAgents.addChatAgent),k=G(W.chatAgents.removeChatAgent),A=t=>{let n=t.displayName??t.agentId;k({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).then(e=>{e.removed&&o.success(my({name:n}))}).catch(()=>o.error(Ih()))},j=t=>{D({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?jT(e)?De():Za():zs({count:Number(n[1])}))})},[M,N]=(0,q.useState)(``),P=H(W.chatParticipants.listMembers,{chatId:e}),F=PV(),I=r?.pool??[],ee=r?.roomAgents??[],L=i==null?r?.primary??null:i.primary?{instanceName:i.primary.instanceName,agentId:i.primary.agentId}:null,R=(0,q.useMemo)(()=>a4(I,i?[i.primary,...i.agents]:[]),[I,i]),{room:z,others:B}=(0,q.useMemo)(()=>n4(IS(R,M),L,ee),[R,M,ee,L]),V=(0,q.useMemo)(()=>r4([...R,...E??[]]),[R,E]),te=t.onCall!=null&&!I.some(e=>G2(e,t.onCall));if(!r||t.hidden&&!n)return null;let ne=!t.hidden,{disabled:re}=t,ie=t=>{let n=S3(String(e),F.getState().text,{instanceName:t.instanceName,agentId:t.agentId},i3(t.displayName??t.agentId));n!==null&&F.setText(n)},ae=t.onCall??r.primary,oe=$2(I,ae),se=new Set((E??[]).map(e=>`${e.instanceName}\u0000${e.agentId}`)),ce=M.trim().toLocaleLowerCase(),le=u4(R,E??[],M),ue=le.slice(0,8),fe=B.length+le.length,pe=c4({unfolded:v,searching:ce!==``,hereCount:z.length}),me=e=>{let t=V.has(`${e.instanceName}\u0000${e.agentId}`),n=se.has(`${e.instanceName}\u0000${e.agentId}`),r=i4(i?.viewerRoomRole,e,L,ee),a=(0,J.jsxs)(`button`,{type:`button`,role:`option`,className:`oc-agentrow`,disabled:e.state===`deleted`||re||!ne,title:e.state===`deleted`?Ss():Sg({name:e.displayName??e.agentId}),onClick:()=>{ie(e),c(!1),N(``)},children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,title:e.kind===`hermes`?`Hermes`:`OpenClaw`,children:(0,J.jsx)(V4,{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,G2(e,L)?(0,J.jsx)(EA,{size:12,className:`oc-agentrow__primary`,"aria-label":ep(),children:(0,J.jsx)(`title`,{children:ep()})}):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)(fA,{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:Zo(),"aria-label":Zo(),onClick:()=>j(e),children:(0,J.jsx)(OC,{size:14,"aria-hidden":!0})}):null,r?(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Ep({name:o}),"aria-label":Ep({name:o}),onClick:()=>A(e),children:(0,J.jsx)(zC,{size:14,"aria-hidden":!0})}):null]},`${e.instanceName}/${e.agentId}`)},he=+!!L+ee.length,ge=P?.length??1,_e=Lx({agents:he,people:ge,next:ae?`${oe?.displayName??ae.agentId}${(V.has(`${ae.instanceName}\u0000${ae.agentId}`)||te)&&ae?` (${ae.instanceName})`:``}`:`—`}),ve=(0,J.jsxs)(J.Fragment,{children:[ne&&I.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:M,onChange:e=>N(e.target.value),placeholder:Fp(),"aria-label":O()})]}):null,re?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:t.reason===`call-active`?$c():gr()}):null,(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`listbox`,children:[z.map(e=>me(e)),z.length>0&&fe>0?(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentlist__divider oc-agentlist__toggle`,"aria-expanded":pe,onClick:()=>y(!pe),children:[(0,J.jsx)(iC,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:jx()}),(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:fe})]}):null,pe?(0,J.jsx)(J.Fragment,{children:B.map(e=>{let t=`${e.instanceName}\u0000${e.agentId}`,n=se.has(t);return(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow oc-agentrow--outside`,disabled:!n,onClick:()=>j(e),title:n?Zo():Sv(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V4,{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]}),V.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)(OC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`}):null]},`other/${e.instanceName}/${e.agentId}`)})}):null,pe&&ue.length>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-agentlist__divider`,role:`presentation`,children:Ea()}),ue.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow`,onClick:()=>j(e),title:Zo(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V4,{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]}),V.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)(OC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`add/${e.instanceName}/${e.agentId}`))]}):null]})]}),ye=(t,n)=>{let r=x3(String(e),F.getState().text,String(n),i3(t));r!==null&&F.setText(r),c(!1)},be=f.trim().toLocaleLowerCase(),xe=(P??[]).filter(e=>be===``||e.name.toLocaleLowerCase().includes(be)),Se=(S??[]).filter(e=>e.name.toLocaleLowerCase().includes(be)||(e.detail??``).toLocaleLowerCase().includes(be)),Ce=Se.slice(0,8),we=c4({unfolded:b,searching:be!==``,hereCount:xe.filter(e=>!e.isSelf).length}),Te=t=>{C({chatId:e,memberId:t.userId,role:_}).then(()=>p(``)).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/participants_limit:(\d+)/.exec(t);o.error(n===null?Cv():tp({count:Number(n[1])}))})},Ee=(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:f,onChange:e=>p(e.target.value),placeholder:a?de():zh(),"aria-label":a?de():zh()})]}),(0,J.jsx)(`div`,{className:`oc-agentlist__caption`,children:ia()}),(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`list`,children:[xe.map(e=>{let t=(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,disabled:e.isSelf,onClick:()=>ye(e.name,e.userId),title:e.isSelf?void 0:Yr({name:e.name}),children:[(0,J.jsx)(B4,{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:dn()}):null]}),(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(Goe,{role:e.roomRole})})]}),(0,J.jsx)(fA,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId));return H2(i?.viewerRoomRole,e)?(0,J.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[t,(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Ep({name:e.name}),"aria-label":Ep({name:e.name}),onClick:()=>T(e),children:(0,J.jsx)(zC,{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":we,onClick:()=>x(!we),children:[(0,J.jsx)(iC,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:eg()}),S!==void 0&&Se.length>0?(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:Se.length}):null]}),we?(0,J.jsxs)(`label`,{className:`oc-invite-as`,children:[(0,J.jsx)(`span`,{children:j_()}),(0,J.jsxs)(XC,{value:_,onValueChange:e=>h(e),children:[(0,J.jsx)(qC,{size:`sm`,className:`oc-invite-as__trigger`,children:(0,J.jsx)(KC,{})}),(0,J.jsx)(JC,{children:g.map(e=>(0,J.jsx)(YC,{value:e,children:q4(e)},e))})]})]}):null]}),we?S===void 0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Eo()}):Ce.length===0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:It()}):Ce.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,onClick:()=>Te(e),title:Ft({name:e.name,role:q4(_)}),children:[(0,J.jsx)(B4,{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)(jC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId))):null,we&&Se.length>Ce.length?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:ym({count:Se.length-Ce.length})}):null]}):null]})]});return(0,J.jsxs)(`span`,{className:`oc-roompill`,children:[(0,J.jsxs)(sw,{open:s,onOpenChange:e=>{c(e),e||(N(``),y(!1),x(!1))},children:[(0,J.jsx)(ow,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-roompill__main`,title:t.reason===`call-active`?$c():_e,"aria-label":_e,children:[(0,J.jsx)(NC,{size:16,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-roompill__count`,children:he+ge})]})}),(0,J.jsxs)(aw,{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":u===`agents`,className:`oc-roomtabs__tab`,onClick:()=>d(`agents`),children:[(0,J.jsx)(HS,{size:14,"aria-hidden":!0}),kl(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:he})]}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":u===`people`,className:`oc-roomtabs__tab`,onClick:()=>d(`people`),children:[(0,J.jsx)(NC,{size:14,"aria-hidden":!0}),Fe(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:ge})]})]}),u===`agents`?ve:Ee]})]}),n?(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsx)(`button`,{ref:l,type:`button`,className:`oc-roompill__chev`,title:Gs(),"aria-label":Gs(),"data-overflow":`room-settings`,children:(0,J.jsx)(rC,{size:13,"aria-hidden":!0})})}),(0,J.jsx)(uC,{align:`end`,className:`oc-roommenu`,returnFocus:()=>{let{more:e,field:t}=Q0(l.current);return[e,t]},children:(0,J.jsxs)(fC,{onSelect:()=>n(`agents`,null),children:[(0,J.jsx)(mj,{"aria-hidden":!0}),Oh()]})})]}):null]})}function Goe({role:e}){let t=e===`owner`?Bu():e===`manager`?pi():e===`viewer`?Ni():G_();return(0,J.jsxs)(`span`,{className:`oc-rolemark`,title:t,children:[(0,J.jsx)(e===`owner`?EA:e===`manager`?AC:e===`viewer`?bC:Dj,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:t})]})}function Koe(e){let t=(0,q.useContext)(b7),n=PV(),r=Tw(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(e);f.current=e;let p=(0,q.useRef)({chatId:()=>f.current.chatId,getText:()=>n.getState().text,setText:e=>n.setText(e)}),m=(0,q.useSyncExternalStore)(qj,Jj),h=m!==null&&m.targetChatId===e.chatId;(0,q.useEffect)(()=>()=>{u.current!==null&&d.current!==null&&(d.current.stale=!0);let e=d.current;e!==null&&e.finalizing===!0&&!e.boundToHold&&(e.stale=!0,e.h?.discard()),u.current?.discard(),u.current=null,a(!1),s(!1),l(``)},[e.chatId]);let g=(0,q.useCallback)(()=>{requestAnimationFrame(()=>{let t=e.rootRef.current?.querySelector(`.oc-composer__input`);t&&(t.scrollTop=t.scrollHeight)})},[]),_=JS(t.lang,rm()),v=(0,q.useRef)(_);v.current=_;let y=(0,q.useRef)(e.voiceInput);y.current=e.voiceInput;let b=(0,q.useCallback)(()=>{let e=bM();e!==``&&n.setText(SM(n.getState().text,e,!1))},[]),x=(0,q.useCallback)(()=>{let e=Jj();e!==null&&e.targetChatId===f.current.chatId&&b();let t=d.current,n=u.current!==null&&t!==null&&t.h===u.current;n&&(t.finalizing=!0,t.recording=!1),u.current?.stop(),u.current=null,a(!1),n?s(!0):l(``)},[]),S=(0,q.useCallback)(()=>{if(!$S()){r.error(Vs());return}let e=Jj();if(e!==null&&e.targetChatId!==f.current.chatId&&e.recording){r.error(xm());return}let t=f.current.chatId,i={h:null,boundToHold:!1,startedChatId:t,stale:!1,recording:!1};Eae(d.current,p.current),d.current=i,s(!1),l(``);let o=eC({lang:_,onText:(e,r)=>{if(i.holdGen!==void 0&&i.holdGen!==tM()||i.stale)return;let a=Jj();if(a!==null&&a.targetChatId===t){if(nM(e,r.paragraph),f.current.chatId===t){let e=Jj();e!==null&&(n.setText(e.text),g())}return}wae(i,d.current,p.current,e,r.paragraph)&&g()},onInterim:e=>{if(i.holdGen!==void 0&&i.holdGen!==tM()||i.stale)return;i.lastInterim=e;let n=Jj();n!==null&&n.targetChatId===t&&rM(e),Tae(i,d.current,p.current)&&l(e)},onEnd:()=>{i.finalizing=!1,i.recording=!1,i.ended=!0,i.boundToHold&&pM(i.holdGen),!(i.stale||u.current!==null&&u.current!==i.h)&&(u.current=null,a(!1),s(!1),l(``))},onError:e=>{i.boundToHold&&pM(i.holdGen),!(i.stale||u.current!==null&&u.current!==i.h)&&(u.current=null,a(!1),s(!1),l(``),e===`not-allowed`||e===`service-not-allowed`?r.error(Nx()):e===`engine-gave-up`?r.error(Gr()):e!==`no-speech`&&e!==`aborted`&&r.error(ea({code:e})))}});if(o===null){r.error(Vs());return}i.h=o;let c=Jj();if(c!==null&&c.targetChatId===t){i.boundToHold=!0,eM(()=>o.stop()),i.holdGen=tM(),a(!0);return}u.current=o,i.recording=!0,a(!0)},[_,r]),C=(0,q.useCallback)(()=>{if(n.getState().attachments.length>0||Z0()){r.error(ite());return}let e=u.current,t=d.current;e===null&&e7(t)&&t7(t,p.current),$j({targetChatId:f.current.chatId,targetLabel:f.current.chatTitle,text:n.getState().text,interim:e!==null&&t!==null&&t.h===e&&!t.stale?t.lastInterim??``:``,voiceEnabled:y.current,voiceLang:v.current,recording:e!==null,...e===null?{}:{stop:()=>e.stop()}})&&(e!==null&&d.current?.h===e&&(d.current.boundToHold=!0,d.current.holdGen=tM()),u.current=null,a(!1),s(!1),l(``),n.setText(``))},[r]),w=(0,q.useCallback)(()=>{let e=t7(d.current,p.current);return u.current=null,a(!1),s(!1),l(``),e},[]);return{recording:i||h&&m!==null&&m.recording,ownsSend:(i||o)&&!h,interim:h&&m!==null?m.interim:c,held:h,canPin:m===null,pinned:m!==null,pinnedHere:h,pinnedLabel:m?.targetLabel??``,pinnedTargetChatId:m?.targetChatId??null,pendingSend:h?m?.pendingSend??null:null,pendingSendId:h?m?.pendingSendId??0:0,pendingRestore:h?m?.pendingRestore??null:null,start:S,stop:x,hold:C,flushForSend:w,releaseHereKeepingWords:b}}function qoe({recording:e,onStart:t,onStop:n}){let r=H(W.me.getMe,{host:iT})?.dictationShortcut??null,i=(0,q.useRef)(()=>{});(0,q.useEffect)(()=>{if(!r)return;let e=e=>{e.repeat||yw(e,r)&&(e.preventDefault(),i.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=r?` (${_w(r,gw())})`:``;return(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${e?` oc-composer__icon--rec`:``}`,"data-overflow":`mic`,title:(e?je():El())+a,"aria-label":e?je():El(),"aria-pressed":e,ref:e=>{i.current=()=>e?.click()},onClick:()=>e?n():t(),children:(0,J.jsx)(QS,{size:18,"aria-hidden":!0})})}function Joe({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}=OT(e),f=u||!d||l(`inboundAttachments`),p=T7().voiceInput,m=F2(),h=M7(),[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?$2(h?.pool??[],T)?.displayName??T.agentId:I2(m),O=RV(e=>e.isRunning),k=u5(e),A=k!==null&&l(`followUpModes`),j=Tie({turnRunning:O,hasRunningSubAgent:!A&&c}),M=j.mode===`queue`,N=(0,q.useContext)(D7),P=PV(),F=wy(),I=(0,q.useRef)(null),ee=rS(),L=Koe({chatId:e,chatTitle:t===``?D:t,voiceInput:p,rootRef:I}),[R,z]=(0,q.useState)(!1),B=L.pendingSendId,V=Tw(),te=(0,q.useRef)(0);(0,q.useEffect)(()=>{if(B===0||te.current===B)return;te.current=B;let e=Jj(),t=e?.pendingSend??``,n=e?.holdId??-1;if(sM(),i){cM(n),V.error(yl());return}if(t.trim()===``){lM(n);return}M&&N!==null?N(t).then(e=>{e?Jj()?.holdId===n&&(xM(),P.setText(``)):cM(n)}):Jj()?.holdId===n&&(xM(),P.setText(t),P.send())},[B]);let ne=L.pendingRestore;(0,q.useEffect)(()=>{ne!==null&&(P.setText(ne),fM(),xM())},[ne]),(0,q.useEffect)(()=>{if(!R)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),z(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[R]);let re=(0,q.useContext)(AJ);(0,q.useEffect)(()=>{if(re!==null)return re.current={canAttach:f&&!M&&!L.pinned,attachFile:e=>L.pinned?Promise.resolve():(se(e=>e+1),P.addAttachment(e).then(()=>{le(``),requestAnimationFrame(()=>le(kn()))}).finally(()=>se(e=>Math.max(0,e-1)))),insertText:e=>{let t=P.getState();P.setText(t.text+e),le(``),requestAnimationFrame(()=>le(Uo()))}},()=>{re.current=null}},[re,f,M,P,L.pinned]);let ie=(0,q.useRef)(1),ae=Tw(),[oe,se]=(0,q.useState)(0),[ce,le]=(0,q.useState)(``),ue=oe>0,de=e=>{if((e.clipboardData?.files?.length??0)>0)return;let t=e.clipboardData?.getData(`text/plain`)??``;if(!t)return;let n=Cie(t);if(n!==null&&f&&!M){e.preventDefault();let r=e.currentTarget,i=r.selectionStart??null,a=r.selectionEnd??null,o=P.getState().text,s=()=>{let e=P.getState();e.text===o&&i!==null&&a!==null?P.setText(o.slice(0,i)+t+o.slice(a)):P.setText(e.text+t)};se(e=>e+1),F.query(W.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 FJ(n),P.addAttachment(n).then(()=>{le(``),requestAnimationFrame(()=>le(Hl()))})}).catch(()=>{s(),ae.error(nl())}).finally(()=>se(e=>Math.max(0,e-1)));return}let r=NJ(t,ie.current);if(r.kind!==`file`||!f)return;if(e.preventDefault(),M){ae.error(gm());return}ie.current+=1;let i=new File([t],r.filename??`texte-colle.txt`,{type:`text/plain; charset=utf-8`});FJ(i),se(e=>e+1),P.addAttachment(i).then(()=>{le(``),requestAnimationFrame(()=>le(dy({lines:String(r.lines)})))}).catch(e=>{console.error(`[paste] attachment routing failed:`,e),ae.error(Cp())}).finally(()=>se(e=>Math.max(0,e-1)))},fe=(e,t)=>{if(N===null||e.trim()===``)return;let n=A?S8(k?.preference??null,k?.serverMode??null):null,r=n===null?void 0:t?C8(n):n.mode;N(e,n===null?void 0:{...r?{mode:r}:{},immediate:r!==`queue`}).then(e=>{e&&P.setText(``)})},pe=FV(e=>e.text),he=FV(e=>e.attachments.length>0),ge=(_M(pe,L.interim)||he&&!M)&&!ue,_e=e=>{if(i||ue)return;let t=L.flushForSend();if(M){fe(t,e);return}t.trim()===``&&P.getState().attachments.length===0||P.send()},ve=e=>{if(ue&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation();return}if(!(e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)){if(L.ownsSend){e.preventDefault(),e.stopPropagation(),_e(e.metaKey||e.ctrlKey);return}!M||N===null||(e.preventDefault(),e.stopPropagation(),fe(P.getState().text,e.metaKey||e.ctrlKey))}},ye=L.ownsSend?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,"aria-label":bb(),disabled:!ge||M&&N===null,onClick:()=>_e(!1),children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})}):null,be=ane(),[xe,Se]=(0,q.useState)({settings:!1,start:!1}),[we,Te]=(0,q.useState)(!1),Ee=jie({hold:L.canPin||L.held,expand:!0,talkSettings:xe.settings,perm:we,tools:!R,roomSettings:h!=null,talkStart:xe.start,mic:p,recording:L.recording}),De=(0,q.useMemo)(()=>Mie(Ee),[Ee.join(` `)]),Oe=(0,q.useRef)(null),ke=Nie(De,IT(()=>{let e=Oe.current;if(!e)return null;let t=e.getBoundingClientRect().width;return t>0?{available:t,required:LT(e,De.slice(0,-1).map(e=>t=>{for(let[n,r]of Object.entries(E5(e)))t.setAttribute(n,r)}),`oc-composer__bar--measure`)}:null},()=>[Oe.current],[De,be,R])),Ae=new Set(ke.moved),[je,Me]=(0,q.useState)(!1),[Ne,Pe]=(0,q.useState)(null),[Fe,Ie]=(0,q.useState)(null);(0,q.useEffect)(()=>{ke.moved.length===0&&Me(!1)},[ke.moved.length]);let Le=(0,q.useRef)(null),Re=IT(()=>{let e=Le.current;if(!e)return null;let t=e.getBoundingClientRect().width;return t>0?{available:t,required:LT(e,[e=>e.setAttribute(`data-labels`,`on`)],`oc-composer__exphead--measure`)}:null},()=>[Le.current],[R,be]),ze=h?.perTurnRouting===!0||(h?.roomAgents?.length??0)>0,Be=(0,J.jsxs)(J.Fragment,{children:[R?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__backdrop`,"aria-label":mn(),onClick:()=>z(!1)}):null,(0,J.jsxs)(bW.Root,{ref:I,className:`oc-composer${i?` oc-composer--disabled`:``}${L.recording?` oc-composer--dictation`:``}${R?` oc-composer--expanded`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-composer__body`,children:[R?(0,J.jsxs)(`div`,{className:`oc-composer__exphead`,ref:Le,"data-labels":Re===0?`on`:`off`,children:[(0,J.jsx)(`span`,{className:`oc-composer__exptitle`,children:$a()}),(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__expclose`,title:mn(),"aria-label":mn(),onClick:()=>z(!1),children:[(0,J.jsx)(nj,{size:15,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-composer__expclose-label`,children:mn()})]})]}):null,e?(0,J.jsx)(e3,{chatId:e,onOpen:()=>C(`people`,null)}):null,e?(0,J.jsx)(t3,{chatId:e,routing:h,open:g,onOpenChange:_,tab:v,onTabChange:y,intent:b,onIntentDone:S}):null,(0,J.jsx)(Boe,{chatId:e}),(0,J.jsx)(`div`,{className:`oc-attachrow`,children:(0,J.jsx)(bW.Attachments,{components:{Attachment:Voe}})}),(0,J.jsx)(`span`,{className:`oc-sr-only`,role:`status`,"aria-live":`polite`,children:ce}),(0,J.jsx)(Hoe,{}),(0,J.jsx)(bW.Input,{className:`oc-composer__input`,placeholder:i?yl():E?Gi({name:D}):Ce({name:D}),autoFocus:S5(be),unstable_focusOnRunStart:S5(be),unstable_focusOnScrollToBottom:S5(be),unstable_focusOnThreadSwitched:S5(be),rows:1,disabled:i,onKeyDownCapture:ve,onPaste:de,autoCorrect:`off`,autoCapitalize:be?`sentences`:`off`,autoComplete:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`}),(L.recording||L.ownsSend)&&L.interim!==``?(0,J.jsxs)(`div`,{className:`oc-composer__interim`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`oc-composer__interim-dot`}),(0,J.jsx)(`span`,{className:`oc-composer__interim-text`,children:L.interim})]}):null]}),(0,J.jsxs)(`div`,{className:`oc-composer__bar`,ref:Oe,...E5(ke),children:[(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(bae,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,attachmentsSupported:f,attachDisabled:M||i}),R?null:(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__tools${n?` is-on`:``}`,onClick:r,"aria-pressed":n,title:n?Xh():uo(),"data-overflow":`tools`,children:[(0,J.jsx)(MC,{size:15,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-composer__tools-label`,children:bt()})]}),(0,J.jsx)(Woe,{chatId:e,gate:a,onManage:C}),(0,J.jsx)(fae,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,multiAgent:ze,onVisibleChange:Te})]}),(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(xae,{open:je,onOpenChange:Me,moved:Ae,hold:{held:L.held,disabled:!L.canPin||ue,onHold:L.hold,onRelease:L.releaseHereKeepingWords},expand:{expanded:R,onToggle:()=>z(e=>!e)},tools:{shown:n,onToggle:r},onManageConversation:()=>C(`agents`,null),onDictate:L.start,permission:Ae.has(`perm`)?(0,J.jsx)(H5,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,multiAgent:ze}):null,talkSettingsSlot:Pe,talkStartSlot:Ie}),(0,J.jsx)(`span`,{className:`oc-composer__voiceslot${L.canPin||L.held?` is-shown`:``}`,"aria-hidden":!L.canPin&&!L.held,"data-overflow":`hold`,children:L.held?(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__heldchip`,title:xr(),"aria-label":xr(),onClick:L.releaseHereKeepingWords,children:[(0,J.jsx)(cS,{size:12,"aria-hidden":!0}),Hb(),(0,J.jsx)(zC,{size:11,"aria-hidden":!0})]}):(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon oc-composer__hold`,title:ka(),"aria-label":ka(),onClick:L.hold,disabled:!L.canPin||ue,tabIndex:!L.canPin||ue?-1:0,children:(0,J.jsx)(cS,{size:16,"aria-hidden":!0})})}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${R?` is-on`:``}`,title:R?mn():Rt(),"aria-label":R?mn():Rt(),"aria-pressed":R,onClick:()=>z(e=>!e),"data-overflow":`expand`,children:R?(0,J.jsx)(nj,{size:16,"aria-hidden":!0}):(0,J.jsx)(QA,{size:16,"aria-hidden":!0})}),p?(0,J.jsx)(qoe,{recording:L.recording,onStart:L.start,onStop:L.stop}):null,(0,J.jsx)(D2,{chatId:e,onCallActiveChange:o,serverCallSessionId:s,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,onPresenceChange:Se,more:{moved:{settings:Ae.has(`talk-settings`),start:Ae.has(`talk`)},settingsSlot:Ne,startSlot:Fe,onDone:()=>Me(!1)}},e),i?(0,J.jsxs)(J.Fragment,{children:[j.mode===`queue`?(0,J.jsx)(Y7,{}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!0,"aria-label":Ys(),children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})]}):j.mode===`queue`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y7,{}),ye??(A?(0,J.jsx)(Zre,{chatId:e,queueSend:N===null?null:(e,t)=>N(e,{...t?{mode:t}:{},immediate:t!==`queue`})}):(0,J.jsx)(Uoe,{reason:j.reason}))]}):A&&c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y7,{}),ye??(0,J.jsx)(bW.Send,{className:`oc-composer__send`,"aria-label":bb(),disabled:ue,children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})]}):ye??(0,J.jsx)(bW.Send,{className:`oc-composer__send`,"aria-label":bb(),disabled:ue,children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})]})]})]})]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Doe,{}),L.pinned?(0,J.jsxs)(`div`,{className:`oc-composer__pinnednote`,role:`note`,children:[(0,J.jsx)(cS,{size:14,"aria-hidden":!0}),L.pinnedHere?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:Vh()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>uM(),children:me()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:rg({chat:L.pinnedLabel||Ld()})}),L.pinnedTargetChatId?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>{ee({to:`/chat/$chatId`,params:{chatId:L.pinnedTargetChatId}})},children:ko()}):null]})]}):R?(0,Tk.createPortal)(Be,document.body):Be]})}function Yoe({chatId:e}){let t=U5(e);return t.offered?(0,J.jsxs)(fC,{disabled:t.pending,"data-widgets-toggle":!0,onSelect:()=>t.set(!t.enabled),children:[(0,J.jsx)(GA,{}),t.enabled?Fi():ir()]}):null}var X7=67324752,Z7=33639248,Q7=101010256,$7=0,e9=2048,t9=class extends Error{reason;constructor(e,t){super(t===void 0?e:`${e}: ${t}`),this.reason=e,this.name=`ZipError`}},Xoe=(()=>{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 n9(e){let t=4294967295;for(let n of e)t=Xoe[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function Zoe(e){if(e.length>65535)throw new t9(`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=n9(a.bytes),s=new Uint8Array(30+e.length),c=new DataView(s.buffer);c.setUint32(0,X7,!0),c.setUint16(4,20,!0),c.setUint16(6,e9,!0),c.setUint16(8,$7,!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,Z7,!0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,e9,!0),u.setUint16(10,$7,!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,Q7,!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 Qoe(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)===Q7){r=n;break}if(r===-1)throw new t9(`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)!==Z7)throw new t9(`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!==$7)throw new t9(`unsupported_method`,p);if((r&e9)===0)throw new t9(`unsupported_encoding`,p);if(f+30>e.length||t.getUint32(f,!0)!==X7)throw new t9(`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 t9(`corrupt`,p);let _=e.slice(g,g+c);if(n9(_)!==s)throw new t9(`checksum_mismatch`,p);o.push({name:p,bytes:_}),a+=46+l+u+d}return o}var r9=`manifest.json`,i9=`chats/`,$oe=`sections/`,a9=`blobs/`,ese=512*1024*1024,tse=1e4,nse=76,rse=600*1e3;function ise(e,t){return e.filter(e=>t-e.updatedAt>rse)}var ase=class extends Error{bytes;constructor(e){super(`archive exceeds ${ese} bytes`),this.bytes=e,this.name=`ArchiveTooLarge`}};async function o9(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+nse+2*e.length,o>536870912)throw new ase(o);a.push({name:e,bytes:t})},d=[];for(let a of t){let t=await e.chat(a);u(`${i9}${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(`${$oe}${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(`${a9}${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 ${tse} pages`)}}return n?.({phase:`packing`,done:a.length,total:a.length}),a.unshift({name:r9,bytes:r.encode(JSON.stringify({...i,missingBlobs:d}))}),{archive:Zoe(a),manifest:i,blobCount:s,missingBlobs:d}}async function ose(e,t,n,r){let i=new TextDecoder,a=Qoe(t);r?.({phase:`reading`,done:a.length,total:a.length});let o=new Map(a.map(e=>[e.name,e.bytes])).get(r9);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(a9)).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(i9));for(let t of n){let n=JSON.parse(i.decode(t.bytes)),r=await e.batch(c,`chats`,[n],s9([n],d));l+=r.written,c9([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)=>l9(e.name)-l9(t.name));for(let a of n){let n=JSON.parse(i.decode(a.bytes)),o=await e.batch(c,t,n,s9(n,d));l+=o.written,r?.({phase:`writing`,done:l,total:null}),c9(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 s9(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 c9(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 l9(e){let t=/\/(\d+)\.json$/.exec(e);return t===null?0:Number(t[1])}function u9(e){return`atrium-${e.normalize(`NFKD`).replace(/[^\p{Letter}\p{Number}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}.zip`}function d9(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 sse(){let e=wy(),[t,n]=(0,q.useState)({running:!1,progress:null}),r=(0,q.useRef)(!1),i=(0,q.useCallback)(()=>({manifest:()=>e.action(W.archiveExport.exportManifest,{}),chat:t=>e.query(W.archiveExport.exportChat,{chatId:t}),section:(t,n,r)=>e.query(W.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(W.archiveImport.beginImport,{manifest:t,targetProjectId:n??null}),batch:(t,n,r,i)=>e.mutation(W.archiveImport.importBatch,{importId:t,section:n,rows:r,blobs:i.map(e=>({key:e.key,storageId:e.storageId}))}),finish:t=>e.mutation(W.archiveImport.finishImport,{importId:t}),abandon:t=>e.mutation(W.archiveImport.abandonImport,{importId:t}),upload:async t=>{let n=await e.mutation(W.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(W.uploads.registerUpload,{storageId:r}),r},registerBlob:async(t,n)=>{await e.mutation(W.archiveImport.registerImportBlob,{importId:t,storageId:n})},discardUpload:async(t,n)=>{await e.mutation(W.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 o9(i(),e,n);return d9(r,u9(t)),{missingBlobs:a}}),[o,i]),c=(0,q.useCallback)((t,n)=>o(async r=>{let a=await e.query(W.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(W.archiveExport.exportFolderChats,{projectId:t._id,cursor:n});o.push(...r.chatIds),n=r.cursor}while(n!==null)}let{archive:s,missingBlobs:c}=await o9(i(),o,r);return d9(s,u9(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 ose(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(W.archiveImport.listOpenImports,{});for(let r of ise(n,Date.now())){let n=!1;for(let i=0;i<1e3&&!n&&!t;i+=1)n=(await e.mutation(W.archiveImport.abandonImport,{importId:r.importId})).done}}catch{}})(),()=>{t=!0}},[e]),{state:t,exportChats:s,exportFolder:c,importArchive:l}}var f9=(0,q.createContext)(null);function cse({children:e}){let t=sse(),n=Tw(),r=(e,t)=>{let r=e instanceof Error?e.message:String(e);if(r.includes(`folder_too_large`)){n.error(Jl());return}if(r.includes(`already running`)){n.error(cl());return}if(r.includes(`archive_too_large`)){n.error(Rx());return}if(r.includes(`not_a_zip`)||r.includes(`no manifest`)){n.error(Ie());return}n.error(t,e)},i={state:t.state,exportChat:(e,i)=>{t.exportChats([e],i).then(({missingBlobs:e})=>{e.length>0?n.error(K_({count:e.length})):n.success(mi())}).catch(e=>r(e,Al()))},exportFolder:(e,i)=>{t.exportFolder(e,i).then(({missingBlobs:e})=>{e.length>0?n.error(K_({count:e.length})):n.success(mi())}).catch(e=>r(e,Al()))},importArchive:(e,i)=>{t.importArchive(e,i).then(({written:e,purged:t})=>{n.success(Pi({count:e}),t?void 0:rr())}).catch(e=>r(e,Tr()))}},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)(f9.Provider,{value:a,children:e})}function p9(){return(0,q.useContext)(f9)}function lse(e){if(!e.running)return null;let t=e.progress;if(t===null)return bs();switch(t.phase){case`sections`:return Vp({count:t.done});case`blobs`:return E({count:t.done});case`packing`:return bs();case`reading`:return ld({count:t.done});case`uploading`:return _u({done:t.done,total:t.total??t.done});case`writing`:return Vu({count:t.done})}}function use(e,t){return e===null?t:`${e}-${t}`}var dse=e=>{let{transform:t}=e;return{...t,y:0}};function fse(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 pse=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:fse(n,t,i)},mse=e=>{let{transform:t}=e;return{...t,x:0}},m9=`project:none`,hse=e=>`project:${e}`,h9=`projhead:`,g9=e=>`${h9}${e}`,_9=`oc.noproject.collapsed`,v9=`oc.shared.collapsed`,gse=[`full`,`label`,`icon`];function y9(){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 b9=(0,q.createContext)(new Map);function _se({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=H(W.messages.listChats,{}),a=H(W.projects.listProjects,{}),o=H(W.me.getMe,{host:iT})?.ui?.effective?.showChatAge??!0,s=H(W.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=H(W.chatReads.myBusyChats,{}),u=(0,q.useMemo)(()=>new Set(l??[]),[l]),{byChat:d}=CS(l??null),f=H(W.agentRequests.pendingByChat,{}),p=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[])e.set(t.chatId,t.kinds.includes(`approval`)?`approval`:t.kinds.includes(`credential`)?`credential`:`question`);return e},[f]),m=H(W.chatBookmarks.myBookmarkedChats,{}),h=H(W.chatExport.referenceLabel,{}),g=(0,q.useMemo)(()=>new Set(m??[]),[m]),_=(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]),[v,y]=(0,q.useState)(0);(0,q.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>y(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let b=G(W.projects.createProject),x=G(W.projects.setProjectCollapsed),S=G(W.projects.setProjectSidebar),C=G(W.chats.reorderChat),w=G(W.projects.reorderProject),T=G(W.chats.moveChatToProject),E=oT(),D=jt(),O=(0,q.useRef)(null),k=(0,q.useRef)(null),A=(0,q.useRef)(null),j=gse[IT(()=>{let e=O.current;return e?{available:e.clientWidth,required:[k.current?.offsetWidth??0,A.current?.offsetWidth??0]}:null},()=>[O.current],[D,r])],[M,N]=(0,q.useState)(null),P=(0,q.useRef)(!1);(0,q.useEffect)(()=>{!P.current&&i&&N(i)},[i]);let F=M??i??[],I=F.filter(e=>e.sidebarHidden!==!0),ee=F.filter(e=>e.sidebarHidden===!0),L=i===void 0&&M===null,[R,z]=(0,q.useState)(null),[B,V]=(0,q.useState)(()=>localStorage.getItem(_9)===`1`),[te,ne]=(0,q.useState)(()=>localStorage.getItem(v9)===`1`);function re(){ne(e=>(localStorage.setItem(v9,e?`0`:`1`),!e))}function ie(){V(e=>(localStorage.setItem(_9,e?`0`:`1`),!e))}let ae=M4();(0,q.useEffect)(()=>{if(!ae?.expand)return;let e=I.find(e=>e._id===ae.chatId);if(!e)return;let t=e.projectId??null;if(t===null){B&&(localStorage.setItem(_9,`0`),V(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&x({projectId:t,collapsed:!1})},[ae,I,a,B,x]);let oe=wS(GS(DS,{activationConstraint:{distance:4}}),GS(Pte,{activationConstraint:{delay:250,tolerance:8}}),GS(NS,{coordinateGetter:jS})),se=(0,q.useRef)(!1),ce=()=>{se.current=!0,setTimeout(()=>{se.current=!1},0)},le=(0,q.useCallback)(e=>String(e.active.id).startsWith(h9)?KS({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(h9))}):KS(e),[]),ue=I.filter(e=>e.pinned),de=I.filter(e=>!e.pinned&&e.role===`participant`),fe=I.filter(e=>!e.pinned&&e.role!==`participant`),pe=e=>fe.filter(t=>(t.projectId??null)===e),me=rS(),he=(0,q.useMemo)(()=>SS(a??[]),[a]),ge=(0,q.useMemo)(()=>he.filter(e=>!e.sidebarHidden),[he]),_e=(0,q.useMemo)(()=>he.filter(e=>e.sidebarHidden),[he]),ve=(0,q.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,bS(e,t._id)]))},[a]),ye=(0,q.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),be=e=>fe.filter(t=>t.projectId!==null&&(ve.get(t.projectId)??t.projectId)===e);function xe(e){return I.find(t=>t._id===e)}async function Se(e){z(null),ce();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(h9)){let e=r.slice(9),t=ge,n=null;if(i.startsWith(h9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==m9)n=i.slice(8);else{let e=xe(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 w({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=xe(r);if(!a||a.role===`participant`)return;if(i.startsWith(h9)){let e=i.slice(9);if((a.projectId??null)===e)return;P.current=!0,N(t=>(t??I).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await T({chatId:a._id,projectId:e})}finally{P.current=!1}return}if(i.startsWith(`project:`)){let e=i===m9?null:i.slice(8);if((a.projectId??null)===e)return;P.current=!0,N(t=>(t??I).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await T({chatId:a._id,projectId:e})}finally{P.current=!1}return}let o=xe(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;P.current=!0,N(e=>(e??I).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await T({chatId:a._id,projectId:o.projectId??null})}finally{P.current=!1}return}let s=o.pinned?ue:pe(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;P.current=!0,N(e=>[...(e??I).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await C({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{P.current=!1}}let Ce=p9(),we=Ce?lse(Ce.state):null,[Te,Ee]=(0,q.useState)(!1),De=R?xe(R):null;return(0,J.jsx)(b9.Provider,{value:p,children:(0,J.jsx)(fS.Provider,{value:d,children:(0,J.jsxs)(`aside`,{className:`oc-sidebar`+(Te?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Ee(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Ee(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Ee(!1);let t=e.dataTransfer.files[0];t!==void 0&&Ce?.importArchive(t,null)},children:[Te?(0,J.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,J.jsx)(IC,{className:`size-4`}),(0,J.jsx)(`span`,{children:Rv()})]}):null,we===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:we})]}),(0,J.jsxs)(`div`,{className:`oc-sidebar__top`,ref:O,children:[(0,J.jsxs)(K,{className:j===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,"data-focus-key":`sidebar:new-chat`,title:`${D} (${r})`,"aria-label":D,children:[(0,J.jsx)(OC,{}),j===`icon`?null:(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:D}),j===`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:k,children:[(0,J.jsxs)(K,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,J.jsx)(OC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:D}),(0,J.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(pS,{})})]})}),(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)(OC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:D})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(pS,{})})]})}),(0,J.jsx)(K,{className:`oc-newproject`,"data-focus-key":`sidebar:new-folder`,variant:`outline`,size:`icon`,"aria-label":sn(),title:sn(),onClick:async()=>{let e=await E({title:sn(),label:zc(),placeholder:fb(),confirmLabel:it()});e&&await b({name:e})},children:(0,J.jsx)(pS,{})})]}),(0,J.jsxs)(RS,{sensors:oe,collisionDetection:le,modifiers:[mse,pse],onDragStart:e=>z(String(e.active.id)),onDragCancel:()=>{z(null),ce()},onDragEnd:Se,children:[(0,J.jsx)(`div`,{className:`oc-sidebar__scroll`,children:L?(0,J.jsx)(y9,{}):(0,J.jsxs)(J.Fragment,{children:[ue.length>0?(0,J.jsx)(x9,{label:fc(),chats:ue,children:ue.map(n=>(0,J.jsx)(S9,{chat:n,active:n._id===e,unread:_.has(n._id),busy:u.has(n._id),bookmarked:g.has(n._id),referenceLabel:h,ageTick:v,suppressClick:se,onSelect:t},n._id))}):null,(0,J.jsx)(WS,{items:ge.map(e=>g9(e._id)),strategy:VS,children:ge.map(n=>{let r=be(n._id);return(0,J.jsx)(x9,{label:n.name,dropId:hse(n._id),sortId:g9(n._id),suppressClick:se,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>u.has(e._id)),unread:r.some(e=>_.has(e._id)),onToggle:()=>void x({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void me({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,J.jsx)(`div`,{className:`oc-sidebar__empty`,children:Lb()}):r.map(r=>(0,J.jsx)(S9,{chat:r,active:r._id===e,unread:_.has(r._id),busy:u.has(r._id),bookmarked:g.has(r._id),referenceLabel:h,domainLabel:r.projectId!==null&&r.projectId!==n._id?ye.get(r.projectId)??null:null,ageTick:v,suppressClick:se,onSelect:t},r._id))},n._id)})}),_e.length>0?(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,"data-focus-key":`sidebar:hidden-folders`,children:[(0,J.jsx)(yC,{className:`size-3.5`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:Ks({count:_e.length})})]})}),(0,J.jsx)(uC,{align:`start`,className:`w-56`,children:_e.map(e=>(0,J.jsxs)(fC,{onSelect:()=>void S({projectId:e._id,hidden:!1}),children:[(0,J.jsx)(_S,{}),` `,e.name]},e._id))})]}):null,de.length>0||ee.length>0?(0,J.jsxs)(x9,{label:Ib(),chats:de,collapsible:!0,collapsed:te,busy:de.some(e=>u.has(e._id)),unread:de.some(e=>_.has(e._id)),onToggle:re,children:[te?null:de.map(n=>(0,J.jsx)(S9,{chat:n,active:n._id===e,unread:_.has(n._id),busy:u.has(n._id),bookmarked:g.has(n._id),referenceLabel:h,ageTick:v,suppressClick:se,onSelect:t},n._id)),!te&&ee.length>0?(0,J.jsx)(vse,{chats:ee}):null]}):null,(0,J.jsx)(x9,{label:kf(),dropId:m9,chats:pe(null),collapsible:!0,collapsed:B,busy:pe(null).some(e=>u.has(e._id)),unread:pe(null).some(e=>_.has(e._id)),onToggle:ie,children:B?null:pe(null).map(n=>(0,J.jsx)(S9,{chat:n,active:n._id===e,unread:_.has(n._id),busy:u.has(n._id),bookmarked:g.has(n._id),referenceLabel:h,ageTick:v,suppressClick:se,onSelect:t},n._id))})]})}),(0,J.jsxs)(PS,{children:[R?.startsWith(h9)?(()=>{let e=(a??[]).find(e=>g9(e._id)===R);return e?(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":BS(e)},children:[(0,J.jsx)(rC,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,J.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,De?(0,J.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[OS(De.color)?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:OS(De.color)}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsx)(`span`,{className:`oc-chatitem__label`,children:De.title||sx()})]}):null]})]})]})})})}function x9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:l,unread:u,onToggle:d,onOpen:f,children:p}){let m=G(W.projects.setProjectSidebar),h=p9(),g=(0,q.useContext)(fS),_=o.map(e=>g.get(e._id)).find(e=>e!==void 0)??null,v=G(W.projects.deleteProject),y=G(W.projects.renameProject),b=G(W.projects.setProjectColor),x=G(W.projects.moveProject),S=aT(),C=RT(),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(e),[O,k]=(0,q.useState)(!1),A=H(W.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:j,isOver:M}=lS({id:t??`static:${e}`}),N=MS({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:P,...F}=N.listeners??{},I=f??d,ee=e=>{e.target===e.currentTarget&&s&&I&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I())},L=a?BS(a):null;return(0,J.jsxs)(`div`,{ref:e=>{t&&j(e),n&&N.setNodeRef(e)},className:`oc-sidebar__group`+(M?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...L?{"--proj-hue":L}:{},...n?{transform:dS.Transform.toString(N.transform),transition:N.transition,opacity:N.isDragging?.35:1}:{}},children:[(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head oc-reveal-host group/head`+(s?` oc-sidebar__group-head--btn`:``),title:c&&l&&_?vS(_):void 0,...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||I?.()},onKeyDown:ee}:{},...n?F:{},children:[s?f?(0,J.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn oc-hit`,"aria-label":c?tu():Tu(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&d?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,J.jsx)(iC,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(rC,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,J.jsx)(iC,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(rC,{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":Zy(),onClick:e=>e.stopPropagation(),...N.attributes,onKeyDown:P,children:(0,J.jsx)(LA,{className:`size-3.5`})}):null,c&&l?(0,J.jsx)(`span`,{className:hS(_,Ly()).className,title:hS(_,Ly()).label,"aria-label":hS(_,Ly()).label}):null,c&&u?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:hm(),"aria-label":hm()}):null,i?(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":Bm(),className:`oc-sidebar__group-menu oc-reveal oc-hit`,"data-focus-key":`sidebar:folder-menu:${i}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(cC,{})})}),(0,J.jsxs)(uC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[f?(0,J.jsxs)(fC,{onSelect:()=>f(),children:[(0,J.jsx)(_S,{}),` `,M_()]}):null,(0,J.jsxs)(fC,{onSelect:()=>{D(e),T(!0)},children:[(0,J.jsx)(DC,{}),` `,ec()]}),(0,J.jsxs)(fC,{onSelect:()=>k(!0),children:[(0,J.jsx)(pS,{}),` `,Ia()]}),a!==void 0&&a.parentId===null?(0,J.jsxs)(fC,{onSelect:()=>void m({projectId:a._id,hidden:!0}),children:[(0,J.jsx)(yC,{}),` `,tf()]}):null,h&&a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(fC,{disabled:h.state.running,onSelect:()=>h.exportFolder(a._id,e),children:[(0,J.jsx)(vC,{}),` `,Ate()]}),(0,J.jsxs)(fC,{disabled:h.state.running,onSelect:()=>h.pickAndImport(a._id),children:[(0,J.jsx)(IC,{}),` `,s_()]})]}):null,(0,J.jsx)(lC,{children:Xb()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void b({projectId:i,color:null}),"aria-label":Cy(),children:`✕`}),FS.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 b({projectId:i,color:e.value})},e.value))]}),(0,J.jsx)(pC,{}),(0,J.jsxs)(fC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=A?.folders??0,n=A?.chats??0;await S({title:bg({name:e}),description:zT({folders:t,chats:n,days:C}),confirmWord:wc(),confirmLabel:uy(),destructive:!0})&&await v({projectId:i})})},children:[(0,J.jsx)(PC,{}),` `,wc()]})]})]}):null]}),(0,J.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,J.jsx)(WS,{items:o.map(e=>e._id),strategy:VS,children:p})}),i?(0,J.jsx)(hT,{open:w,onOpenChange:T,title:dh(),canSubmit:E.trim().length>0,onSubmit:async()=>{await y({projectId:i,name:E.trim()}),T(!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:_n()}),(0,J.jsx)(mw,{value:E,onChange:e=>D(e.target.value),autoFocus:!0})]})})}):null,i&&O?(0,J.jsx)(US,{open:O,onOpenChange:k,title:gee(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void x({projectId:i,parentId:e})}):null]})}var S9=(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)(b9).get(e._id),d=(0,q.useContext)(fS).get(e._id)??null,f=p9(),{attributes:p,listeners:m,setNodeRef:h,transform:g,transition:_,isDragging:v}=MS({id:e._id}),{onKeyDown:y,...b}=m??{},S=G(W.chats.renameChat),C=Tw(),w=()=>{if(a===void 0)return;let t=use(a,e._id);navigator.clipboard.writeText(t).then(()=>C.success(Di({reference:t})),()=>C.error(Zn()))},T=G(W.chats.deleteChat),E=G(W.chats.pinChat),D=G(W.chats.setChatColor),O=G(W.chats.moveChatToProject),k=G(W.chats.setChatSidebar),A=G(W.chatParticipants.leaveChat),j=e.role===`participant`,M=rS(),[N,P]=(0,q.useState)(!1),F=H(W.me.getMe,{host:iT})?.ui?.effective?.showChatAge??!0,I=aT(),ee=RT(),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(e.title??``),V=M4()?.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(()=>j4(e._id),2600);return()=>clearTimeout(n)},[V,e._id]);let ne={transform:dS.Transform.toString(g),transition:_,opacity:+!v},re=OS(e.color);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{ref:e=>{h(e),te.current=e},style:ne,className:`oc-chatitem oc-reveal-host group/row`+(t?` oc-chatitem--active`:``)+(V?` oc-chatitem--flash`:``),title:r&&d?vS(d):void 0,onClick:()=>{s.current||c(e._id)},...b,onAnimationEnd:t=>{V&&t.animationName===`oc-chatitem-flash`&&j4(e._id)},children:[(0,J.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Zy(),onClick:e=>e.stopPropagation(),...p,onKeyDown:y,children:(0,J.jsx)(LA,{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)(NC,{className:`oc-chatitem__group`,size:12,"aria-label":Ad()}):null,e.title||sx()]}),e.role===`participant`&&e.ownerName?(0,J.jsx)(`span`,{className:`oc-chatitem__domain`,children:Iy({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:x(),"aria-label":x(),children:l===`approval`?(0,J.jsx)(AC,{size:11,"aria-hidden":!0}):l===`credential`?(0,J.jsx)(WA,{size:11,"aria-hidden":!0}):(0,J.jsx)(ej,{size:11,"aria-hidden":!0})}),r?(0,J.jsx)(`span`,{className:hS(d,jd()).className,title:hS(d,jd()).label,"aria-label":hS(d,jd()).label}):null,n?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:hm(),"aria-label":hm()}):null,e.readOnly?(0,J.jsx)(`span`,{className:`oc-chatitem__readonly`,title:Sp(),children:(0,J.jsx)(wC,{size:12,"aria-label":Sp()})}):null,i?(0,J.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Nu(),children:(0,J.jsx)(hA,{size:12,"aria-label":Nu()})}):null,F?(0,J.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:zw(e.updatedAt),children:zS(e.updatedAt,Date.now())}):null,(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":Ue(),className:`oc-reveal oc-hit`,"data-focus-key":`sidebar:chat-menu:${e._id}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(cC,{})})}),(0,J.jsxs)(uC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[j?null:(0,J.jsxs)(fC,{onSelect:()=>{B(e.title??``),R(!0)},children:[(0,J.jsx)(DC,{}),` `,ec()]}),f&&!j?(0,J.jsxs)(fC,{disabled:f.state.running,onSelect:()=>f.exportChat(e._id,e.title??kf()),children:[(0,J.jsx)(vC,{}),` `,iee()]}):null,(0,J.jsxs)(fC,{onSelect:()=>void E({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,J.jsx)(qS,{}):(0,J.jsx)(cS,{}),e.pinned?Tb():_f()]}),j?null:(0,J.jsx)(Yoe,{chatId:e._id}),j?null:(0,J.jsxs)(fC,{onSelect:w,disabled:a===void 0,children:[(0,J.jsx)(qA,{}),` `,pte()]}),j?null:(0,J.jsxs)(fC,{onSelect:()=>P(!0),children:[(0,J.jsx)(_S,{}),` `,Io()]}),e.projectId===null?null:(0,J.jsxs)(fC,{onSelect:()=>void M({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,J.jsx)(PA,{}),` `,u()]}),e.pinned?null:(0,J.jsxs)(fC,{onSelect:()=>void k({chatId:e._id,hidden:!0}),children:[(0,J.jsx)(ES,{}),` `,tf()]}),j?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(pC,{}),(0,J.jsxs)(fC,{variant:`destructive`,onSelect:()=>void A({chatId:e._id}),children:[(0,J.jsx)(ZA,{}),` `,tg()]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lC,{children:Xb()}),(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":Cy(),children:`✕`}),FS.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)(pC,{}),(0,J.jsxs)(fC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await I({title:vd(),description:Om({days:ee}),confirmLabel:wc(),destructive:!0})&&await T({chatId:e._id})})},children:[(0,J.jsx)(PC,{}),` `,wc()]})]})]})]})]}),(0,J.jsx)(hT,{open:L,onOpenChange:R,title:Or(),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:_n()}),(0,J.jsx)(mw,{value:z,onChange:e=>B(e.target.value),autoFocus:!0})]})})}),N?(0,J.jsx)(US,{open:N,onOpenChange:P,title:fa(),currentId:e.projectId,onPick:t=>void O({chatId:e._id,projectId:t})}):null]})});function vse({chats:e}){let[t,n]=(0,q.useState)(!1),r=G(W.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)(rC,{size:12,"aria-hidden":!0}):(0,J.jsx)(iC,{size:12,"aria-hidden":!0}),Of({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??kf()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-hiddenshared__show`,onClick:()=>void r({chatId:e._id,hidden:!1}),children:ox()})]},e._id))}):null]})}var C9=null,w9=0,yse=400;function bse(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!C9)try{C9=new e}catch{return null}return C9}function T9(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 E9(e){let t=Date.now();if(t-w9<yse)return;let n=bse();if(!n)return;w9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function xse(){E9(e=>{T9(e,660,0,.16,.12),T9(e,440,.14,.2,.1)})}function Sse(){E9(e=>{T9(e,880,0,.14,.08)})}function Cse({activeChatId:e}){let t=H(W.messages.listChats,{}),n=G(W.chatReads.markChatSeen),r=H(W.me.getMe,{host:iT}),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&&A4(t))}l&&i&&Sse()},[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 D9=[`admin`,`user`,`pending`];function O9(){let e=H(W.me.authProviders)?.anonymous===!0,[t,n]=(0,q.useState)(!1),r=H(W.dev.listUsersDev,e?{}:`skip`),i=H(W.me.getImpersonation),a=G(W.dev.setMyRole),o=G(W.dev.setRole),s=G(W.admin.startImpersonation),c=G(W.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:Tl(),children:[(0,J.jsx)(Oj,{size:13}),`DEV`]}),(0,J.jsx)(Kw,{open:t,onOpenChange:n,children:(0,J.jsxs)(Uw,{children:[(0,J.jsxs)(Vw,{children:[(0,J.jsx)(Ww,{children:Ae()}),(0,J.jsx)(Gw,{children:Mx()})]}),(0,J.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,J.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[Bs({canonical:l?.canonical??`…`}),` `,(0,J.jsx)(Dw,{variant:`outline`,children:l?.role??`…`})]}),(0,J.jsx)(`div`,{className:`oc-devsw__roles`,children:D9.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`?$i():e===`user`?Wr():Nn()},e))})]}),d?(0,J.jsxs)(`div`,{className:`oc-devsw__imp`,children:[Jo(),` `,(0,J.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,J.jsx)(K,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Ja()})]}):null,(0,J.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,J.jsx)(`p`,{className:`oc-devsw__empty`,children:Ca()}):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:D9.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`?ce():Nee():wee(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:So()})]},e.profileId))})]})})]})}var k9=`atrium.authelia-login`;function wse(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 Tse(e,t){let n;return{start(r,i=!1){if(n)return n;try{let t=e.getItem(k9);if(!i&&t!==null)return Promise.resolve(t===`signed-out`?`signed-out`:`failed`);e.setItem(k9,`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(k9,`signed-out`)}catch{}},authenticated(){try{e.removeItem(k9)}catch{}}}}var A9;function j9(){return A9??=Tse({getItem:e=>window.sessionStorage.getItem(e),setItem:(e,t)=>window.sessionStorage.setItem(e,t),removeItem:e=>window.sessionStorage.removeItem(e)},()=>wse(window.location)),A9}function M9({label:e,mode:t,minimal:n=!1,compact:r=!1}){let{signOut:i}=IE();async function a(){j9().signedOut(),await i()}let o=G(W.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(W.me.getMe,{host:iT});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(W.me.getMe,{host:iT},{...n,themeMode:t,resolvedThemeMode:r})}),s=t??`default`;return(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:r?(0,J.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":e,title:e,children:(0,J.jsx)(xA,{})}):(0,J.jsxs)(K,{variant:`ghost`,size:`sm`,className:`oc-usermenu__trigger min-w-0 shrink gap-1.5`,"aria-label":e,title:e,children:[(0,J.jsx)(xA,{className:`oc-usermenu__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-usermenu__label`,children:e}),(0,J.jsx)(rC,{className:`oc-usermenu__chev opacity-60`,"aria-hidden":!0})]})}),(0,J.jsx)(uC,{side:r?`right`:`bottom`,align:`end`,className:`w-52`,children:n?(0,J.jsxs)(fC,{onClick:()=>void a(),children:[(0,J.jsx)(ZA,{}),` `,J_()]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lC,{children:Bf()}),(0,J.jsxs)(oC,{value:s,onValueChange:e=>void o({mode:e==="default"?null:e}),children:[(0,J.jsxs)(dC,{value:`light`,children:[(0,J.jsx)(wj,{}),` `,sv()]}),(0,J.jsxs)(dC,{value:`dark`,children:[(0,J.jsx)(ij,{}),` `,x_()]}),(0,J.jsxs)(dC,{value:`system`,children:[(0,J.jsx)(rj,{}),` `,Wd()]}),(0,J.jsx)(dC,{value:`default`,children:wh()})]}),(0,J.jsx)(pC,{}),(0,J.jsxs)(fC,{onClick:()=>void a(),children:[(0,J.jsx)(ZA,{}),` `,J_()]})]})})]})}var N9=[`full`,`logo`,`icon`],P9=[`full`,`logo`];function Ese({providers:e,children:t}){return e===void 0?(0,J.jsx)(`div`,{className:`oc-boot`,children:dr()}):e.autheliaOnly?(0,J.jsx)(Ose,{enabled:e.authelia}):t}function Dse({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`?Mr():e===`signed-out`?xn():e===`unavailable`?ua():Po()}),e===`failed`||e===`signed-out`?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider`,onClick:t,children:Vi()}):null]})})}function Ose({enabled:e}){let{signIn:t}=IE(),[n,r]=(0,q.useState)(e?`redirecting`:`unavailable`);return(0,q.useEffect)(()=>{let n=!0;return e?j9().start(t).then(e=>{n&&r(e)}):r(`unavailable`),()=>{n=!1}},[e,t]),(0,J.jsx)(Dse,{state:n,retry:()=>{r(`redirecting`),j9().start(t,!0).then(r)}})}var kse={altered_words:()=>Hh(),incorrect:()=>to(),incoherence:()=>dt(),formatting:()=>Vt(),latency:()=>bc(),api_error:()=>qy(),other:()=>ze()},F9=e=>kse[e]?.()??e,Ase={anomaly_open:FC,anomaly_resolved:Vte,feedback_reply:mS,feedback_resolved:mS,feedback_new:mS,curation:AA,operator_announcement:$A,mention:fA,agent_request:ej,chat_added:NC,group_invite:jC},jse={atrium:()=>sy(),assistants:()=>gg(),platform:()=>Jf()},Mse={investigating:()=>hv(),monitoring:()=>k_(),resolved:()=>Qd()},I9=e=>(e?jse[e]:void 0)?.()??`?`,Nse=e=>(e?Mse[e]:void 0)?.()??`?`,L9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(rm()):`?`},Pse={notif_feedback_reply_admin:()=>({title:Aa(),body:oa()}),notif_feedback_reply:()=>({title:Aa(),body:oa()}),notif_feedback_resolved:()=>({title:Hv(),body:Kp()}),notif_feedback_new:e=>({title:uee(),body:j({reference:e.reference??`?`,category:F9(e.category??`other`)})}),notif_mention:e=>({title:se(),body:dc({chat:e.chat??``})}),notif_chat_added:e=>({title:Mee({by:e.by??`?`}),body:dc({chat:e.chat??``})}),notif_group_invite_request:e=>({title:xo(),body:At({by:e.by??`?`,group:e.group??`?`})}),notif_group_invite_approved:e=>({title:on(),body:Rc({email:e.email??`?`,group:e.group??`?`})}),notif_group_invite_rejected:e=>({title:db(),body:rt({email:e.email??`?`,group:e.group??`?`})}),notif_agent_request_question:e=>({title:hs(),body:Fu({chat:e.chat??``})}),notif_agent_request_approval:e=>({title:id(),body:Fu({chat:e.chat??``})}),notif_agent_request_credential:e=>({title:fu(),body:Fu({chat:e.chat??``})}),notif_curation_proposed:e=>({title:kx(),body:Ls({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:Xi(),body:Vr({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:An(),body:Wo({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Wa({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:ya({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:Ny(),body:Dd({service:I9(e.service),startsAt:L9(e.starts_at),endsAt:L9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:Im(),body:oh({service:I9(e.service),completedAt:L9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Rg(),body:Yee({service:I9(e.service),status:Nse(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:dm(),body:vp({plan:e.plan??`?`,effectiveAt:L9(e.effective_at)})})};function R9(e){let t=e.messageKey?Pse[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:Aa(),body:oa()}:e.kind===`feedback_resolved`?{title:Hv(),body:Kp()}:{title:e.title,body:e.body}}function Fse(){let e=H(W.notifications.myUnreadCount)??0,t=H(W.notifications.myNotifications),n=H(W.feedback.myFeedback),r=G(W.notifications.markRead),i=G(W.notifications.markAllRead),a=G(W.notifications.clearOne),o=G(W.notifications.clearAll),s=G(W.feedback.closeMyFeedback),c=rS(),[l,u]=(0,q.useState)(!1),d=H(W.me.getMe,{host:iT}),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&&xse(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=R9(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)(mC,{open:l,onOpenChange:u,children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?ts({count:e}):Wu(),children:[(0,J.jsx)(pA,{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)(uC,{align:`end`,className:`oc-notif`,children:[(0,J.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,J.jsx)(`span`,{children:Zl()}),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:xu()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Zr()})]}):null]}),t===void 0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:cg()}):t.length===0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:ote()}):(0,J.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=Ase[e.kind]??pA,{title:n,body:i}=R9(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:_i(),"aria-label":_i(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,J.jsx)(nC,{size:13})}):null,(0,J.jsx)(`button`,{type:`button`,title:Vn(),"aria-label":Vn(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,J.jsx)(zC,{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(rm())})]},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:Ml()}),(0,J.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,J.jsx)(Ise,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function Ise({it:e,onClose:t,onNavigate:n}){let r=Tw(),[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(Ri(),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:F9(e.category)}),(0,J.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?aee():e.answered?Kc():sr()})]}),(0,J.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(rm())}),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`?dl():e.authorRole===`agent`?P_():he()}),(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)(rC,{size:13,"aria-hidden":!0}):(0,J.jsx)(iC,{size:13,"aria-hidden":!0}),ws()]}),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:gx()}),o?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:Ri()})]}),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:Dr()}),(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:gn()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:Ao()})]})]}):null]})}var z9=2,Lse=180;function Rse(){let e=rS(),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)(``),[l,u]=(0,q.useState)(0),d=(0,q.useMemo)(()=>_w(Cw,gw()),[]);(0,q.useEffect)(()=>{let e=setTimeout(()=>c(a),Lse);return()=>clearTimeout(e)},[a]);let f=s.trim(),p=H(W.search.searchConversations,f.length>=z9?{query:f}:`skip`),m=p??[],h=f.length>=z9&&p===void 0;(0,q.useEffect)(()=>{let e=e=>{yw(e,Cw)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,q.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,q.useEffect)(()=>{u(0)},[p]),(0,q.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let g=(0,q.useCallback)((t,n)=>{i(!1),n&&a.trim()&&uS(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":Zb(),children:[(0,J.jsx)(gC,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-search-trigger__label`,children:Ty()}),(0,J.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,J.jsx)(Kw,{open:r,onOpenChange:i,children:(0,J.jsxs)(Uw,{showCloseButton:!1,className:`oc-search-palette translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,J.jsx)(Ww,{className:`sr-only`,children:bd()}),(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(),u(e=>Math.min(e+1,m.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=m[l];t&&g(t.chatId,t.messageId)}},placeholder:Am(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":$m()})]}),(0,J.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<z9?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:Mg({count:z9})}):h?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:Uee()}):m.length===0?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:im({term:f})}):m.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:g_(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>g(e.chatId,e.messageId),children:[(0,J.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,J.jsx)(RA,{size:15}):(0,J.jsx)(mS,{size:15})}),(0,J.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,J.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||dp()}),e.projectPath&&e.projectPath.length>0?(0,J.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":Cn(),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`?ey():lg()})]},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:`↓`}),` `,Vf()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↵`}),` `,cv()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:S_()}),` `,Gd()]})]})]})})]})}var B9=[{id:`personal`,label:()=>Tt(),tabs:[`preferences`,`theme`,`files`,`scheduled`,`deletedChats`]},{id:`agents`,label:()=>en(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>Nc(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`,`trash`]},{id:`observability`,label:()=>ob(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],zse=new Map(B9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function V9(e){let t=zse.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function Bse(e,t){return e.find(e=>V9(e)===t)}B9.flatMap(e=>[...e.tabs]);function Vse(){let e=H(W.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?hx({count:t}):`${co()}${e.checkedAt?vt({time:Lw(e.checkedAt)}):``}`:qt({reason:e.reason??`?`}):Yh();return(0,J.jsx)(UC,{delayDuration:150,children:(0,J.jsxs)(GC,{children:[(0,J.jsx)(BC,{asChild:!0,children:(0,J.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,J.jsx)(VC,{children:r})]})})}function H9(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 Hse(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function Use({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)(Vse,{}):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 Wse({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=MS({id:e});return(0,J.jsxs)(`div`,{ref:i,style:{transform:dS.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item oc-reveal-host`,role:`presentation`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip oc-reveal`,"aria-label":xee(),...n,...r,children:(0,J.jsx)(LA,{size:14,"aria-hidden":!0})}),(0,J.jsx)(Use,{tab:e,active:t})]})}function Gse(){let e=H(W.me.getMe,{host:iT}),t=G(W.me.setSettingsTabOrder),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:V9(n),i=(0,q.useMemo)(()=>H9(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)&&V9(e)===r),[a,s,r]),l=wS(GS(Nte,{activationConstraint:{distance:5}}),GS(NS,{coordinateGetter:jS})),u=(0,q.useRef)(null);if((0,q.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>dw(e,e.querySelector(`[role="tab"][aria-selected="true"]`));t();let n=new ResizeObserver(t);n.observe(e);for(let t of Array.from(e.children))n.observe(t);let r=t=>cw(e,t.target,`[role="tab"]`);return e.addEventListener(`focusin`,r),()=>{n.disconnect(),e.removeEventListener(`focusin`,r)}},[n,c.length]),r===void 0||c.length===0)return null;let d=B9.find(e=>e.id===r);function f(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=Hse(a,AS(c,i,s));o(l),t({order:l})}return(0,J.jsx)(`div`,{ref:u,className:`oc-settings-tabs`,role:`tablist`,"aria-label":d?.label(),children:(0,J.jsx)(RS,{sensors:l,collisionDetection:kS,modifiers:[dse],onDragEnd:f,children:(0,J.jsx)(WS,{items:c,strategy:LS,children:c.map(e=>(0,J.jsx)(Wse,{tab:e,active:e===n},e))})})})}function Kse(){let e=H(W.me.getMe,{host:iT}),t=rS(),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:V9(n),i=(0,q.useMemo)(()=>new Set(UT(e?.permissions??[])),[e?.permissions]),a=(0,q.useMemo)(()=>H9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=B9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=Bse(a,e.id);n&&t({to:KT(n)})}return(0,J.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ne(),children:[(0,J.jsx)(Lk,{to:`/`,className:`oc-settings-nav__back`,children:Dee()}),(0,J.jsx)(`div`,{className:`oc-settings-nav__title`,children:go()}),(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 qse=`trash`,Jse=`deletedChats`;function Yse(){throw ID({to:`/settings/$tab`,params:{tab:Jse},replace:!0})}var U9=`oc.theme`;function W9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function G9(e){(0,q.useEffect)(()=>{let t=e??localStorage.getItem(U9)??`system`;if(localStorage.setItem(U9,t),W9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>W9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function Xse(e){(0,q.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=rm()}catch{t=void 0}t!==e&&Hee(e)},[e])}var Zse=(0,q.lazy)(()=>Iw(()=>import(`./RolesTab-DHxLatAl.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]))),Qse=(0,q.lazy)(()=>Iw(()=>import(`./InstancesTab-031fn2Jt.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([23,3,4,24,25,26,7,27,28,8,29,9,30,31,32,6,10,11,12,13,14,15,19,18,16,17,20,21,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]))),$se=(0,q.lazy)(()=>Iw(()=>import(`./PromptInjectionsTab-Bmn1iSpB.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([58,3,4,24,25,26,7,27,28,8,29,9,30,31,32,6,10,13,14,51,59,60]))),ece=(0,q.lazy)(()=>Iw(()=>import(`./GroupsTab-DbayDYbZ.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([61,3,4,62,45,6,7,8,9,47,63,64,14,26,27,28,29,49,37,10,11,12,13,15,19,18,51,16,17,20,21,33,52,53,54,55,30,50,34,35,36,38,39,40,41,42,65]))),tce=(0,q.lazy)(()=>Iw(()=>import(`./IntegrationsTab-1whhDsmk.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([66,3,4,6,7,8,9,26,27,28,29,10,11,12,15]))),nce=(0,q.lazy)(()=>Iw(()=>import(`./FeedbacksTab-D4LKaB_2.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([67,3,4,10,12,50,16,17,18,11,19,14,34,27,28,35,36,29,9,37,30,6,7,8,38,39,40,41,42]))),rce=(0,q.lazy)(()=>Iw(()=>import(`./SubAgentReportsTab-BWfXOTck.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([68,3,4,10,12,50,16,17,18,11,19,14,34,27,28,35,36,29,9,37,30,6,7,8,38,39,40,41,42]))),ice=(0,q.lazy)(()=>Iw(()=>import(`./TrashTab-D5irFeF0.js`).then(e=>({default:e.TrashTab})),__vite__mapDeps([69,3,4,70,39,10,12,13,14,50,16,17,18,11,19,71,72,73,54,74]))),ace=(0,q.lazy)(()=>Iw(()=>import(`./DeletedChatsTab-CnaK-AH0.js`).then(e=>({default:e.DeletedChatsTab})),__vite__mapDeps([75,3,4,70,10,12,16,17,18,11,19,14,72,73,54,39,50,74]))),oce=(0,q.lazy)(()=>Iw(()=>import(`./FilesTab-D3XWSI2t.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([76,3,4,36,27,29,9,37,30,77,6,7,8,54,39,26,28,17,18,10,12,13,14,15,40]))),sce=(0,q.lazy)(()=>Iw(()=>import(`./ScheduledTab-NHSyQ677.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([78,3,4,62,45,79,21,80,81,54,39,26,7,27,28,8,29,9,17,18,10,30,11,12,13,14,15,19,51,42,40,52,53,55,50,41,82,35,60]))),cce=(0,q.lazy)(()=>Iw(()=>import(`./AgentFilesTab-Dfkkm3Fw.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([83,3,4,48,26,7,27,28,8,29,9,17,18,10,12,13,14,15,19,51,84,42,32,56,60]))),lce=(0,q.lazy)(()=>Iw(()=>import(`./PreferencesTab-B5h49bYq.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([85,3,4,6,7,8,9,26,27,28,29,10,11,12,86,51,13,14,15,59,31,87,82,35,30,60]))),uce=(0,q.lazy)(()=>Iw(()=>import(`./ChatDefaultsTab-CxmayDqi.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([88,3,4,70,21,6,7,8,9,38,48,26,27,28,29,30,10,11,12,89,54,84,56,87,60]))),dce=(0,q.lazy)(()=>Iw(()=>import(`./AccessTab-D8xdWzT5.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([90,3,4,26,7,27,28,8,29,9,12,15]))),fce=(0,q.lazy)(()=>Iw(()=>import(`./ThemeShowroom-Do9I3hrR.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([91,3,4,7,36,27,29,9,37,30,77,6,8,92,14,26,28,10,11,12,15,51,59,31,93,40,55,53,50,52,54,94,38])));function pce(){let{isAuthenticated:e}=iE();return(0,q.useEffect)(()=>{e&&j9().authenticated()},[e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(uE,{children:(0,J.jsx)(`div`,{className:`oc-boot`,children:dr()})}),(0,J.jsx)(lE,{children:(0,J.jsx)(hce,{})}),(0,J.jsx)(cE,{children:(0,J.jsx)(Ew,{children:(0,J.jsx)(cse,{children:(0,J.jsx)(_ce,{})})})})]})}function mce(){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 hce(){let{signIn:e}=IE();G9(void 0),bw(void 0);let t=H(W.charts.brandForHost,{host:iT}),n=nT(iT),r=t??n??null,i=LC(void 0);RC(r?.tokens??null,i),(0,q.useEffect)(()=>{t&&rT(iT,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?k2(a,i):null,s=a?.label??`Atrium`,c=H(W.me.authProviders),[l,u]=(0,q.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(hl())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.authelia&&!c.anonymous;return(0,J.jsx)(Ese,{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:ye()}),(0,J.jsx)(`p`,{className:`oc-signin__subtitle`,children:bx()}),(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)(mce,{}),(0,J.jsx)(`span`,{children:Os()})]}):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:Pa()})}):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:Vi()})}):null]}),l?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:ua()}):null,c?.anonymous?(0,J.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:mee()}):null]})]})})}function gce(){let{width:e,collapsed:t,isMobile:n}=tJ();return(0,J.jsx)(`div`,{className:`oc-shell`,children:(0,J.jsxs)(`div`,{className:`oc-shell__body`,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)(y9,{})]})}):null,(0,J.jsx)(`main`,{className:`oc-main`})]})]})})}function _ce(){let e=H(W.me.getMe,{host:iT}),t=G(W.me.bootstrap),n=rS();(0,q.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),G9(e?.resolvedThemeMode),bw(e?.resolvedFontScale);let r=LC(e?.resolvedThemeMode);RC(e?.resolvedChartTokens,r),Xse(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)(gce,{});let a=e.name||e.email||F();return e.role===`pending`?(0,J.jsxs)(`div`,{className:`oc-shell`,children:[(0,J.jsx)(K9,{}),(0,J.jsx)(O9,{}),(0,J.jsx)(vce,{userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand}),(0,J.jsxs)(`div`,{className:`oc-pending`,children:[(0,J.jsx)(`h1`,{className:`oc-pending__title`,children:Kh()}),(0,J.jsx)(`p`,{className:`oc-pending__body`,children:ao()})]})]}):(0,J.jsx)(xce,{canOpenSettings:UT(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function K9(){let e=H(W.me.getImpersonation),t=G(W.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:[ht(),` `,(0,J.jsx)(`strong`,{children:e.targetLabel}),Gt(),(0,J.jsx)(`strong`,{children:e.realLabel}),Cc()]}),(0,J.jsx)(K,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Xy()})]})}function q9(e){return e?.label??`Atrium`}function J9({brand:e,resolvedThemeMode:t}){let n=LC(t),r=q9(e),i=e?.isDefault??!0,a=k2(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)(N2,{className:`oc-brand__logo`}):null,(0,J.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function vce({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r}){let i=(0,q.useRef)(null),a=N9[IT(()=>{let e=i.current;if(e===null||!(e.clientWidth>0))return null;let t=LT(e,N9.slice(0,-1).map(e=>t=>t.setAttribute(`data-fit`,e)),`oc-topbar--measure`);return{available:e.clientWidth,required:t}},()=>[i.current],[])];return(0,J.jsxs)(`header`,{ref:i,className:`oc-topbar`,"data-fit":a,children:[(0,J.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,J.jsx)(J9,{brand:r,resolvedThemeMode:n})}),(0,J.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,J.jsx)(M9,{label:e,mode:t,minimal:!0})})]})}function yce({brand:e,resolvedThemeMode:t}){let n=(0,q.useRef)(null),r=P9[IT(()=>{let e=n.current;if(e===null||!(e.clientWidth>0))return null;let t=LT(e,P9.slice(0,-1).map(e=>t=>t.setAttribute(`data-fit`,e)),`oc-drawer__head--measure`);return{available:e.clientWidth,required:t}},()=>[n.current],[])];return(0,J.jsxs)(`div`,{ref:n,className:`oc-drawer__head`,"data-fit":r,children:[(0,J.jsx)(lT,{className:`sr-only`,children:Yb()}),(0,J.jsx)(Lk,{to:`/`,className:`oc-topbar__brand`,"aria-label":q9(e),children:(0,J.jsx)(J9,{brand:e,resolvedThemeMode:t})}),(0,J.jsx)(pT,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":Qe(),children:(0,J.jsx)(zC,{})})})]})}function bce({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,sidebarOpen:i,onToggleSidebar:a,toggleRef:o,rail:s}){let c=(0,q.useRef)(null),l=N9[IT(()=>{let e=c.current;if(s||e===null||!(e.clientWidth>0))return null;let t=LT(e,N9.slice(0,-1).map(e=>t=>t.setAttribute(`data-fit`,e)),`oc-topbar--measure`);return{available:e.clientWidth,required:t}},()=>[c.current],[s])];return(0,J.jsxs)(`header`,{ref:c,className:s?`oc-topbar oc-topbar--rail`:`oc-topbar`,"data-fit":s?void 0:l,children:[(0,J.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,J.jsx)(K,{ref:o,variant:`ghost`,size:`icon-sm`,"aria-label":i?$s():He(),onClick:a,children:i?(0,J.jsx)(ES,{}):(0,J.jsx)(sj,{})}),(0,J.jsx)(Lk,{to:`/`,className:`oc-topbar__brand`,"aria-label":q9(r),children:(0,J.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,J.jsx)(`div`,{className:`oc-topbar__search`,children:(0,J.jsx)(Rse,{})}),(0,J.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,J.jsx)(Fse,{}),(0,J.jsx)(M9,{label:e,mode:t,compact:s})]})]})}function xce({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:s,collapsed:c,startResize:l,isMobile:u,drawerOpen:d,setDrawerOpen:f,toggleSidebar:p,closeDrawer:m}=tJ(),h=Zq(),g=(0,q.useRef)(null),_=nA(),v=gS({strict:!1}),y=rS(),b=!!_({to:`/settings`,fuzzy:!0});(0,q.useEffect)(()=>{m()},[cA({select:e=>e.pathname}),m]);let x=(0,q.useCallback)(e=>{y({to:`/chat/$chatId`,params:{chatId:e}})},[y]),{startNewChat:S,picker:C}=Mte(x),w=(0,q.useMemo)(()=>_w(xw,gw()),[]);(0,q.useEffect)(()=>{let e=e=>{yw(e,xw)&&(e.preventDefault(),S())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S]);let T=b?(0,J.jsx)(Kse,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_se,{activeChatId:v.chatId??null,onSelect:x,onNewChat:()=>void S(),newChatShortcut:w}),(0,J.jsx)(K,{variant:`ghost`,className:`oc-sidebar__shortcut mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,J.jsx)(_A,{"aria-hidden":!0}),$ee()]})}),(0,J.jsx)(K,{variant:`ghost`,className:`oc-sidebar__shortcut mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,J.jsx)(KA,{"aria-hidden":!0}),Hg()]})}),e?(0,J.jsx)(K,{variant:`ghost`,className:`oc-sidebar__shortcut mx-2 mb-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings`,children:[(0,J.jsx)(hj,{"aria-hidden":!0}),wb()]})}):null]});return(0,J.jsxs)(`div`,{className:h?`oc-shell oc-shell--short`:`oc-shell`,children:[C,(0,J.jsx)(Cse,{activeChatId:v.chatId??null}),(0,J.jsx)(K9,{}),(0,J.jsx)(O9,{}),(0,J.jsxs)(`div`,{className:`oc-shell__body`,children:[(0,J.jsx)(bce,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,sidebarOpen:u?d:!c,onToggleSidebar:p,toggleRef:g,rail:h}),(0,J.jsxs)(`div`,{className:u?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[u?(0,J.jsx)(dT,{open:d,onOpenChange:f,children:(0,J.jsxs)(uT,{side:`left`,className:h?`oc-drawer oc-drawer--short`:`oc-drawer`,overlayClassName:`oc-drawer-overlay`,showCloseButton:!1,"aria-describedby":void 0,returnFocus:()=>[g.current],children:[(0,J.jsx)(yce,{brand:a,resolvedThemeMode:i}),(0,J.jsx)(`div`,{className:`oc-sidebar-col oc-sidebar-col--drawer`,children:T})]})}):c?null:(0,J.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{s.current=e},style:{width:o,flex:`0 0 ${o}px`},children:[T,(0,J.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:l,role:`separator`,"aria-orientation":`vertical`,"aria-label":gf()})]}),(0,J.jsx)(`main`,{className:`oc-main`,children:(0,J.jsx)(Qk,{})}),(0,J.jsx)(j1,{viewerUserId:t,currentChatId:v.chatId??null})]})]}),(0,J.jsx)(rq,{})]})}function Sce(){let e=H(W.me.getMe,{host:iT}),t=rS(),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:dr()});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)(Gse,{}),(0,J.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,J.jsx)(Cce,{}):(0,J.jsx)(Qk,{})})]})}function Cce(){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)(FC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:Sy()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:_d()})]})}function wce(){let e=H(W.me.getMe,{host:iT}),t=rS();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:dr()})}function Tce(e){switch(e){case`groups`:return(0,J.jsx)(ece,{});case`integrations`:return(0,J.jsx)(tce,{});case`instances`:return(0,J.jsx)(Qse,{});case`injections`:return(0,J.jsx)($se,{});case`theme`:return(0,J.jsx)(fce,{});case`feedbacks`:return(0,J.jsx)(nce,{});case`subagentReports`:return(0,J.jsx)(rce,{});case`files`:return(0,J.jsx)(oce,{});case`scheduled`:return(0,J.jsx)(sce,{});case`agentFiles`:return(0,J.jsx)(cce,{});case`preferences`:return(0,J.jsx)(lce,{});case`chatDefaults`:return(0,J.jsx)(uce,{});case`access`:return(0,J.jsx)(dce,{});case`trash`:return(0,J.jsx)(ice,{});case`deletedChats`:return(0,J.jsx)(ace,{});default:return(0,J.jsx)(Zse,{})}}function Ece(){let{tab:e}=gS({from:`/settings/$tab`});return(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:Tce(e)})}function Dce(){let{chatId:e}=gS({from:`/chat/$chatId`}),{m:t}=Qx({from:`/chat/$chatId`});return(0,q.useEffect)(()=>{N1(e)},[e]),(0,J.jsx)(P7,{chatId:e,focusMessageId:t??null})}function Oce(){let e=rS(),t=P1(),n=H(W.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:dr()}):(0,J.jsx)(P7,{chatId:null})}var Y9=Hk({component:pce}),kce=Bk({getParentRoute:()=>Y9,path:`/`,component:Oce}),Ace=Bk({getParentRoute:()=>Y9,path:`chat/$chatId`,component:Dce,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),jce=Bk({getParentRoute:()=>Y9,path:`project/$projectId`,component:Uk(()=>Iw(()=>import(`./ProjectPage-BNKL-iOz.js`),__vite__mapDeps([95,3,4,44,96,7,47,64,11,12,15,19,14,18,10,97,27,45,36,29,9,37,30,98,79,81,39,13,16,17,20,21,42,72,99])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),Mce=Bk({getParentRoute:()=>Y9,path:qse,beforeLoad:Yse}),X9=Bk({getParentRoute:()=>Y9,path:`settings`,component:Sce}),Nce=Bk({getParentRoute:()=>X9,path:`/`,component:wce}),Pce=Bk({getParentRoute:()=>X9,path:`traces`,validateSearch:Yw,component:Uk(()=>Iw(()=>import(`./TracesTab-BNWFPad2.js`),__vite__mapDeps([100,3,4,44,7,101,98,102,14,26,27,28,8,29,9,49,37,10,12,15,50,19,18,103,51,55,53,30,11,52,54,94,38,34,35,36,6,39,40,41,42])),`TracesTab`)}),Fce=Bk({getParentRoute:()=>X9,path:`bridge`,validateSearch:qw,component:Uk(()=>Iw(()=>import(`./BridgeTab-Bnu9R5N4.js`),__vite__mapDeps([43,3,4,24,25,26,7,27,28,8,29,9,30,31,32,44,45,35,46,21,6,47,48,49,37,10,11,12,13,14,15,50,19,18,51,40,52,53,54,55,56,57])),`BridgeTab`)}),Ice=Bk({getParentRoute:()=>X9,path:`voice`,validateSearch:$w,component:Uk(()=>Iw(()=>import(`./VoiceTab-DRvjgMdZ.js`),__vite__mapDeps([104,3,4,44,105,6,7,8,9,26,27,28,29,49,37,10,12,15,51,60])),`VoiceTab`)}),Lce=Bk({getParentRoute:()=>X9,path:`audit`,validateSearch:Zw,component:Uk(()=>Iw(()=>import(`./AuditTab-Dh6gO6j5.js`),__vite__mapDeps([106,3,4,44,26,7,27,28,8,29,9,12,50,103,55,53,30,10,11,52,54,94,38,14,34,35,36,37,6,39,40,41,42])),`AuditTab`)}),Rce=Bk({getParentRoute:()=>X9,path:`anomalies`,validateSearch:tT,component:Uk(()=>Iw(()=>import(`./AnomaliesTab-DlZ5M2UC.js`),__vite__mapDeps([107,3,4,44,26,7,27,28,8,29,9,12,13,14,15,50,19,18,10,103,51,16,17,11,55,53,30,52,54,34,35,36,37,6,38,39,40,41,42,57])),`AnomaliesTab`)}),zce=Bk({getParentRoute:()=>X9,path:`kpi`,validateSearch:Qw,component:Uk(()=>Iw(()=>import(`./KpiTab-2Vk6EtCf.js`),__vite__mapDeps([108,3,4,44,12,103,51,93,55,53,30,29,9,10,11,50])),`KpiTab`)}),Bce=Bk({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:Jw,component:Uk(()=>Iw(()=>import(`./ServiceAccountsTab-CKV8crhK.js`),__vite__mapDeps([109,3,4,44,7,27,45,101,26,28,8,29,9,10,11,12,13,14,15,50,19,18,16,17,20,21,52,53,54,55,30,34,35,36,37,6,38,39,40,41,42,22])),`ServiceAccountsTab`)}),Vce=Bk({getParentRoute:()=>X9,path:`users`,validateSearch:eT,component:Uk(()=>Iw(()=>import(`./UsersTab-CHs3CRev.js`),__vite__mapDeps([110,3,4,44,36,27,29,9,37,30,6,7,8,47,64,26,28,10,12,13,14,15,19,18,51,16,17,11,33,111,52,53,54,55,50,34,35,38,39,40,41,42,65])),`UsersTab`)}),Hce=Bk({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw ID({to:`/settings/$tab`,params:{tab:GT.uiprefs},replace:!0})}}),Uce=Bk({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Xw([...WT]).catch(`roles`).parse(e.tab)}),component:Ece});function Wce({error:e,reset:t}){let n=rS(),r=F1(e),[i]=(0,q.useState)(()=>r&&z1(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:Dm()})}):(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)(FC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:Zm()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Ag()}),(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:Vee()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:nm()})]})]})}function Gce(){let e=rS();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)(CA,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:lp()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Qv()}),(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:nm()})})]})}var Z9=iA({routeTree:Y9.addChildren([kce,Ace,jce,Mce,X9.addChildren([Nce,Pce,Ice,Fce,Lce,Rce,zce,Bce,Vce,Hce,Uce])]),defaultPreload:`intent`,defaultErrorComponent:Wce,defaultNotFoundComponent:Gce}),Kce=()=>null;function Q9({children:e}){return(0,J.jsx)(`div`,{style:{display:`flex`,minHeight:`100dvh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}Ij(),bte();var $9=dE.createRoot(document.getElementById(`root`));$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(Q9,{children:cg()})})),U1().then(e=>{m0(document,f0(d0(q1(),window.location.origin,[G1(),K1()])));let t=new km(e);$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(LE,{client:t,children:(0,J.jsxs)(sT,{children:[(0,J.jsx)(Kie,{children:(0,J.jsx)(sA,{router:Z9})}),(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(Kce,{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:[ba(),` `,e instanceof Error?e.message:String(e)]})}))});
158
+ `+R():n)}).catch(()=>{d.current===e&&u(null)})}},children:(0,J.jsx)(bC,{size:13,"aria-hidden":!0})}):null,(0,J.jsx)(FH.Remove,{className:`oc-attach__remove`,"aria-label":Ra(),children:(0,J.jsx)(zC,{size:13,"aria-hidden":!0})}),(0,J.jsx)(Kw,{open:s,onOpenChange:c,children:(0,J.jsxs)(Uw,{className:`oc-attach__dialog`,children:[(0,J.jsx)(Vw,{children:(0,J.jsx)(Ww,{className:`oc-attach__dialog-title`,children:n?.name??ma()})}),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 Hoe(){let e=(0,q.useSyncExternalStore)(q0.subscribe,q0.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)(CC,{className:`oc-upload__spin`,size:14,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:e.count>1?Ro({count:e.count,percent:e.percent}):Tn({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 Uoe({reason:e}){let t=(0,q.useContext)(D7),n=PV(),r=FV(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?gi():qm(),title:r?i?yte():Eg():i?Uu():Cm(),onClick:()=>{if(t===null)return;let e=n.getState().text;e.trim()!==``&&t(e).then(e=>{e&&n.setText(``)})},children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})}function Y7(){let e=(0,q.useContext)(O7);return e===null?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send oc-composer__stop`,"aria-label":ff(),title:Gb(),onClick:()=>void e(),children:(0,J.jsx)(Cj,{size:14,"aria-hidden":!0})})}function Woe({chatId:e,gate:t,onManage:n}){let r=M7(),i=H(W.chatAgents.listChatAgents,{chatId:e}),a=i?z2(i.viewerRoomRole):!1,o=Tw(),[s,c]=(0,q.useState)(!1),l=(0,q.useRef)(null),[u,d]=(0,q.useState)(`agents`),[f,p]=(0,q.useState)(``),[m,h]=(0,q.useState)(`member`),g=U2(i?.viewerRoomRole),_=W2(m,i?.viewerRoomRole),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1);(0,q.useEffect)(()=>{h(`member`),p(``),y(!1),x(!1)},[e]);let S=H(W.chatParticipants.listInvitable,a&&s&&u===`people`?{chatId:e}:`skip`),C=G(W.chatParticipants.addMember),w=G(W.chatParticipants.removeMember),T=t=>{w({chatId:e,memberId:t.userId}).then(()=>o.success(my({name:t.name}))).catch(()=>o.error(Cv()))},E=H(W.chatAgents.listAddableAgents,a&&s&&u===`agents`?{chatId:e}:`skip`),D=G(W.chatAgents.addChatAgent),k=G(W.chatAgents.removeChatAgent),A=t=>{let n=t.displayName??t.agentId;k({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).then(e=>{e.removed&&o.success(my({name:n}))}).catch(()=>o.error(Ih()))},j=t=>{D({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?jT(e)?De():Za():zs({count:Number(n[1])}))})},[M,N]=(0,q.useState)(``),P=H(W.chatParticipants.listMembers,{chatId:e}),F=PV(),I=r?.pool??[],ee=r?.roomAgents??[],L=i==null?r?.primary??null:i.primary?{instanceName:i.primary.instanceName,agentId:i.primary.agentId}:null,R=(0,q.useMemo)(()=>a4(I,i?[i.primary,...i.agents]:[]),[I,i]),{room:z,others:B}=(0,q.useMemo)(()=>n4(IS(R,M),L,ee),[R,M,ee,L]),V=(0,q.useMemo)(()=>r4([...R,...E??[]]),[R,E]),te=t.onCall!=null&&!I.some(e=>G2(e,t.onCall));if(!r||t.hidden&&!n)return null;let ne=!t.hidden,{disabled:re}=t,ie=t=>{let n=S3(String(e),F.getState().text,{instanceName:t.instanceName,agentId:t.agentId},i3(t.displayName??t.agentId));n!==null&&F.setText(n)},ae=t.onCall??r.primary,oe=$2(I,ae),se=new Set((E??[]).map(e=>`${e.instanceName}\u0000${e.agentId}`)),ce=M.trim().toLocaleLowerCase(),le=u4(R,E??[],M),ue=le.slice(0,8),fe=B.length+le.length,pe=c4({unfolded:v,searching:ce!==``,hereCount:z.length}),me=e=>{let t=V.has(`${e.instanceName}\u0000${e.agentId}`),n=se.has(`${e.instanceName}\u0000${e.agentId}`),r=i4(i?.viewerRoomRole,e,L,ee),a=(0,J.jsxs)(`button`,{type:`button`,role:`option`,className:`oc-agentrow`,disabled:e.state===`deleted`||re||!ne,title:e.state===`deleted`?Ss():Sg({name:e.displayName??e.agentId}),onClick:()=>{ie(e),c(!1),N(``)},children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,title:e.kind===`hermes`?`Hermes`:`OpenClaw`,children:(0,J.jsx)(V4,{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,G2(e,L)?(0,J.jsx)(EA,{size:12,className:`oc-agentrow__primary`,"aria-label":ep(),children:(0,J.jsx)(`title`,{children:ep()})}):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)(fA,{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:Zo(),"aria-label":Zo(),onClick:()=>j(e),children:(0,J.jsx)(OC,{size:14,"aria-hidden":!0})}):null,r?(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Ep({name:o}),"aria-label":Ep({name:o}),onClick:()=>A(e),children:(0,J.jsx)(zC,{size:14,"aria-hidden":!0})}):null]},`${e.instanceName}/${e.agentId}`)},he=+!!L+ee.length,ge=P?.length??1,_e=Lx({agents:he,people:ge,next:ae?`${oe?.displayName??ae.agentId}${(V.has(`${ae.instanceName}\u0000${ae.agentId}`)||te)&&ae?` (${ae.instanceName})`:``}`:`—`}),ve=(0,J.jsxs)(J.Fragment,{children:[ne&&I.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:M,onChange:e=>N(e.target.value),placeholder:Fp(),"aria-label":O()})]}):null,re?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:t.reason===`call-active`?$c():gr()}):null,(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`listbox`,children:[z.map(e=>me(e)),z.length>0&&fe>0?(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentlist__divider oc-agentlist__toggle`,"aria-expanded":pe,onClick:()=>y(!pe),children:[(0,J.jsx)(iC,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:jx()}),(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:fe})]}):null,pe?(0,J.jsx)(J.Fragment,{children:B.map(e=>{let t=`${e.instanceName}\u0000${e.agentId}`,n=se.has(t);return(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow oc-agentrow--outside`,disabled:!n,onClick:()=>j(e),title:n?Zo():Sv(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V4,{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]}),V.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)(OC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`}):null]},`other/${e.instanceName}/${e.agentId}`)})}):null,pe&&ue.length>0?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-agentlist__divider`,role:`presentation`,children:Ea()}),ue.map(e=>(0,J.jsxs)(`button`,{type:`button`,className:`oc-agentrow`,onClick:()=>j(e),title:Zo(),children:[(0,J.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,J.jsx)(V4,{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]}),V.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)(OC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`add/${e.instanceName}/${e.agentId}`))]}):null]})]}),ye=(t,n)=>{let r=x3(String(e),F.getState().text,String(n),i3(t));r!==null&&F.setText(r),c(!1)},be=f.trim().toLocaleLowerCase(),xe=(P??[]).filter(e=>be===``||e.name.toLocaleLowerCase().includes(be)),Se=(S??[]).filter(e=>e.name.toLocaleLowerCase().includes(be)||(e.detail??``).toLocaleLowerCase().includes(be)),Ce=Se.slice(0,8),we=c4({unfolded:b,searching:be!==``,hereCount:xe.filter(e=>!e.isSelf).length}),Te=t=>{C({chatId:e,memberId:t.userId,role:_}).then(()=>p(``)).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/participants_limit:(\d+)/.exec(t);o.error(n===null?Cv():tp({count:Number(n[1])}))})},Ee=(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:f,onChange:e=>p(e.target.value),placeholder:a?de():zh(),"aria-label":a?de():zh()})]}),(0,J.jsx)(`div`,{className:`oc-agentlist__caption`,children:ia()}),(0,J.jsxs)(`div`,{className:`oc-agentlist`,role:`list`,children:[xe.map(e=>{let t=(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,disabled:e.isSelf,onClick:()=>ye(e.name,e.userId),title:e.isSelf?void 0:Yr({name:e.name}),children:[(0,J.jsx)(B4,{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:dn()}):null]}),(0,J.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,J.jsx)(Goe,{role:e.roomRole})})]}),(0,J.jsx)(fA,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId));return H2(i?.viewerRoomRole,e)?(0,J.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[t,(0,J.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Ep({name:e.name}),"aria-label":Ep({name:e.name}),onClick:()=>T(e),children:(0,J.jsx)(zC,{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":we,onClick:()=>x(!we),children:[(0,J.jsx)(iC,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,J.jsx)(`span`,{children:eg()}),S!==void 0&&Se.length>0?(0,J.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:Se.length}):null]}),we?(0,J.jsxs)(`label`,{className:`oc-invite-as`,children:[(0,J.jsx)(`span`,{children:j_()}),(0,J.jsxs)(XC,{value:_,onValueChange:e=>h(e),children:[(0,J.jsx)(qC,{size:`sm`,className:`oc-invite-as__trigger`,children:(0,J.jsx)(KC,{})}),(0,J.jsx)(JC,{children:g.map(e=>(0,J.jsx)(YC,{value:e,children:q4(e)},e))})]})]}):null]}),we?S===void 0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Eo()}):Ce.length===0?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:It()}):Ce.map(e=>(0,J.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,onClick:()=>Te(e),title:Ft({name:e.name,role:q4(_)}),children:[(0,J.jsx)(B4,{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)(jC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId))):null,we&&Se.length>Ce.length?(0,J.jsx)(`p`,{className:`oc-agentpicker__hint`,children:ym({count:Se.length-Ce.length})}):null]}):null]})]});return(0,J.jsxs)(`span`,{className:`oc-roompill`,children:[(0,J.jsxs)(sw,{open:s,onOpenChange:e=>{c(e),e||(N(``),y(!1),x(!1))},children:[(0,J.jsx)(ow,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-roompill__main`,title:t.reason===`call-active`?$c():_e,"aria-label":_e,children:[(0,J.jsx)(NC,{size:16,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-roompill__count`,children:he+ge})]})}),(0,J.jsxs)(aw,{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":u===`agents`,className:`oc-roomtabs__tab`,onClick:()=>d(`agents`),children:[(0,J.jsx)(HS,{size:14,"aria-hidden":!0}),kl(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:he})]}),(0,J.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":u===`people`,className:`oc-roomtabs__tab`,onClick:()=>d(`people`),children:[(0,J.jsx)(NC,{size:14,"aria-hidden":!0}),Fe(),(0,J.jsx)(`span`,{className:`oc-roomtabs__count`,children:ge})]})]}),u===`agents`?ve:Ee]})]}),n?(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsx)(`button`,{ref:l,type:`button`,className:`oc-roompill__chev`,title:Gs(),"aria-label":Gs(),"data-overflow":`room-settings`,children:(0,J.jsx)(rC,{size:13,"aria-hidden":!0})})}),(0,J.jsx)(uC,{align:`end`,className:`oc-roommenu`,returnFocus:()=>{let{more:e,field:t}=Q0(l.current);return[e,t]},children:(0,J.jsxs)(fC,{onSelect:()=>n(`agents`,null),children:[(0,J.jsx)(mj,{"aria-hidden":!0}),Oh()]})})]}):null]})}function Goe({role:e}){let t=e===`owner`?Bu():e===`manager`?pi():e===`viewer`?Ni():G_();return(0,J.jsxs)(`span`,{className:`oc-rolemark`,title:t,children:[(0,J.jsx)(e===`owner`?EA:e===`manager`?AC:e===`viewer`?bC:Dj,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:t})]})}function Koe(e){let t=(0,q.useContext)(b7),n=PV(),r=Tw(),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(``),u=(0,q.useRef)(null),d=(0,q.useRef)(null),f=(0,q.useRef)(e);f.current=e;let p=(0,q.useRef)({chatId:()=>f.current.chatId,getText:()=>n.getState().text,setText:e=>n.setText(e)}),m=(0,q.useSyncExternalStore)(qj,Jj),h=m!==null&&m.targetChatId===e.chatId;(0,q.useEffect)(()=>()=>{u.current!==null&&d.current!==null&&(d.current.stale=!0);let e=d.current;e!==null&&e.finalizing===!0&&!e.boundToHold&&(e.stale=!0,e.h?.discard()),u.current?.discard(),u.current=null,a(!1),s(!1),l(``)},[e.chatId]);let g=(0,q.useCallback)(()=>{requestAnimationFrame(()=>{let t=e.rootRef.current?.querySelector(`.oc-composer__input`);t&&(t.scrollTop=t.scrollHeight)})},[]),_=JS(t.lang,rm()),v=(0,q.useRef)(_);v.current=_;let y=(0,q.useRef)(e.voiceInput);y.current=e.voiceInput;let b=(0,q.useCallback)(()=>{let e=bM();e!==``&&n.setText(SM(n.getState().text,e,!1))},[]),x=(0,q.useCallback)(()=>{let e=Jj();e!==null&&e.targetChatId===f.current.chatId&&b();let t=d.current,n=u.current!==null&&t!==null&&t.h===u.current;n&&(t.finalizing=!0,t.recording=!1),u.current?.stop(),u.current=null,a(!1),n?s(!0):l(``)},[]),S=(0,q.useCallback)(()=>{if(!$S()){r.error(Vs());return}let e=Jj();if(e!==null&&e.targetChatId!==f.current.chatId&&e.recording){r.error(xm());return}let t=f.current.chatId,i={h:null,boundToHold:!1,startedChatId:t,stale:!1,recording:!1};Eae(d.current,p.current),d.current=i,s(!1),l(``);let o=eC({lang:_,onText:(e,r)=>{if(i.holdGen!==void 0&&i.holdGen!==tM()||i.stale)return;let a=Jj();if(a!==null&&a.targetChatId===t){if(nM(e,r.paragraph),f.current.chatId===t){let e=Jj();e!==null&&(n.setText(e.text),g())}return}wae(i,d.current,p.current,e,r.paragraph)&&g()},onInterim:e=>{if(i.holdGen!==void 0&&i.holdGen!==tM()||i.stale)return;i.lastInterim=e;let n=Jj();n!==null&&n.targetChatId===t&&rM(e),Tae(i,d.current,p.current)&&l(e)},onEnd:()=>{i.finalizing=!1,i.recording=!1,i.ended=!0,i.boundToHold&&pM(i.holdGen),!(i.stale||u.current!==null&&u.current!==i.h)&&(u.current=null,a(!1),s(!1),l(``))},onError:e=>{i.boundToHold&&pM(i.holdGen),!(i.stale||u.current!==null&&u.current!==i.h)&&(u.current=null,a(!1),s(!1),l(``),e===`not-allowed`||e===`service-not-allowed`?r.error(Nx()):e===`engine-gave-up`?r.error(Gr()):e!==`no-speech`&&e!==`aborted`&&r.error(ea({code:e})))}});if(o===null){r.error(Vs());return}i.h=o;let c=Jj();if(c!==null&&c.targetChatId===t){i.boundToHold=!0,eM(()=>o.stop()),i.holdGen=tM(),a(!0);return}u.current=o,i.recording=!0,a(!0)},[_,r]),C=(0,q.useCallback)(()=>{if(n.getState().attachments.length>0||Z0()){r.error(ite());return}let e=u.current,t=d.current;e===null&&e7(t)&&t7(t,p.current),$j({targetChatId:f.current.chatId,targetLabel:f.current.chatTitle,text:n.getState().text,interim:e!==null&&t!==null&&t.h===e&&!t.stale?t.lastInterim??``:``,voiceEnabled:y.current,voiceLang:v.current,recording:e!==null,...e===null?{}:{stop:()=>e.stop()}})&&(e!==null&&d.current?.h===e&&(d.current.boundToHold=!0,d.current.holdGen=tM()),u.current=null,a(!1),s(!1),l(``),n.setText(``))},[r]),w=(0,q.useCallback)(()=>{let e=t7(d.current,p.current);return u.current=null,a(!1),s(!1),l(``),e},[]);return{recording:i||h&&m!==null&&m.recording,ownsSend:(i||o)&&!h,interim:h&&m!==null?m.interim:c,held:h,canPin:m===null,pinned:m!==null,pinnedHere:h,pinnedLabel:m?.targetLabel??``,pinnedTargetChatId:m?.targetChatId??null,pendingSend:h?m?.pendingSend??null:null,pendingSendId:h?m?.pendingSendId??0:0,pendingRestore:h?m?.pendingRestore??null:null,start:S,stop:x,hold:C,flushForSend:w,releaseHereKeepingWords:b}}function qoe({recording:e,onStart:t,onStop:n}){let r=H(W.me.getMe,{host:iT})?.dictationShortcut??null,i=(0,q.useRef)(()=>{});(0,q.useEffect)(()=>{if(!r)return;let e=e=>{e.repeat||yw(e,r)&&(e.preventDefault(),i.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=r?` (${_w(r,gw())})`:``;return(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${e?` oc-composer__icon--rec`:``}`,"data-overflow":`mic`,title:(e?je():El())+a,"aria-label":e?je():El(),"aria-pressed":e,ref:e=>{i.current=()=>e?.click()},onClick:()=>e?n():t(),children:(0,J.jsx)(QS,{size:18,"aria-hidden":!0})})}function Joe({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}=OT(e),f=u||!d||l(`inboundAttachments`),p=T7().voiceInput,m=F2(),h=M7(),[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?$2(h?.pool??[],T)?.displayName??T.agentId:I2(m),O=RV(e=>e.isRunning),k=u5(e),A=k!==null&&l(`followUpModes`),j=Tie({turnRunning:O,hasRunningSubAgent:!A&&c}),M=j.mode===`queue`,N=(0,q.useContext)(D7),P=PV(),F=wy(),I=(0,q.useRef)(null),ee=rS(),L=Koe({chatId:e,chatTitle:t===``?D:t,voiceInput:p,rootRef:I}),[R,z]=(0,q.useState)(!1),B=L.pendingSendId,V=Tw(),te=(0,q.useRef)(0);(0,q.useEffect)(()=>{if(B===0||te.current===B)return;te.current=B;let e=Jj(),t=e?.pendingSend??``,n=e?.holdId??-1;if(sM(),i){cM(n),V.error(yl());return}if(t.trim()===``){lM(n);return}M&&N!==null?N(t).then(e=>{e?Jj()?.holdId===n&&(xM(),P.setText(``)):cM(n)}):Jj()?.holdId===n&&(xM(),P.setText(t),P.send())},[B]);let ne=L.pendingRestore;(0,q.useEffect)(()=>{ne!==null&&(P.setText(ne),fM(),xM())},[ne]),(0,q.useEffect)(()=>{if(!R)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),z(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[R]);let re=(0,q.useContext)(AJ);(0,q.useEffect)(()=>{if(re!==null)return re.current={canAttach:f&&!M&&!L.pinned,attachFile:e=>L.pinned?Promise.resolve():(se(e=>e+1),P.addAttachment(e).then(()=>{le(``),requestAnimationFrame(()=>le(kn()))}).finally(()=>se(e=>Math.max(0,e-1)))),insertText:e=>{let t=P.getState();P.setText(t.text+e),le(``),requestAnimationFrame(()=>le(Uo()))}},()=>{re.current=null}},[re,f,M,P,L.pinned]);let ie=(0,q.useRef)(1),ae=Tw(),[oe,se]=(0,q.useState)(0),[ce,le]=(0,q.useState)(``),ue=oe>0,de=e=>{if((e.clipboardData?.files?.length??0)>0)return;let t=e.clipboardData?.getData(`text/plain`)??``;if(!t)return;let n=Cie(t);if(n!==null&&f&&!M){e.preventDefault();let r=e.currentTarget,i=r.selectionStart??null,a=r.selectionEnd??null,o=P.getState().text,s=()=>{let e=P.getState();e.text===o&&i!==null&&a!==null?P.setText(o.slice(0,i)+t+o.slice(a)):P.setText(e.text+t)};se(e=>e+1),F.query(W.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 FJ(n),P.addAttachment(n).then(()=>{le(``),requestAnimationFrame(()=>le(Hl()))})}).catch(()=>{s(),ae.error(nl())}).finally(()=>se(e=>Math.max(0,e-1)));return}let r=NJ(t,ie.current);if(r.kind!==`file`||!f)return;if(e.preventDefault(),M){ae.error(gm());return}ie.current+=1;let i=new File([t],r.filename??`texte-colle.txt`,{type:`text/plain; charset=utf-8`});FJ(i),se(e=>e+1),P.addAttachment(i).then(()=>{le(``),requestAnimationFrame(()=>le(dy({lines:String(r.lines)})))}).catch(e=>{console.error(`[paste] attachment routing failed:`,e),ae.error(Cp())}).finally(()=>se(e=>Math.max(0,e-1)))},fe=(e,t)=>{if(N===null||e.trim()===``)return;let n=A?S8(k?.preference??null,k?.serverMode??null):null,r=n===null?void 0:t?C8(n):n.mode;N(e,n===null?void 0:{...r?{mode:r}:{},immediate:r!==`queue`}).then(e=>{e&&P.setText(``)})},pe=FV(e=>e.text),he=FV(e=>e.attachments.length>0),ge=(_M(pe,L.interim)||he&&!M)&&!ue,_e=e=>{if(i||ue)return;let t=L.flushForSend();if(M){fe(t,e);return}t.trim()===``&&P.getState().attachments.length===0||P.send()},ve=e=>{if(ue&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation();return}if(!(e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)){if(L.ownsSend){e.preventDefault(),e.stopPropagation(),_e(e.metaKey||e.ctrlKey);return}!M||N===null||(e.preventDefault(),e.stopPropagation(),fe(P.getState().text,e.metaKey||e.ctrlKey))}},ye=L.ownsSend?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,"aria-label":bb(),disabled:!ge||M&&N===null,onClick:()=>_e(!1),children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})}):null,be=ane(),[xe,Se]=(0,q.useState)({settings:!1,start:!1}),[we,Te]=(0,q.useState)(!1),Ee=jie({hold:L.canPin||L.held,expand:!0,talkSettings:xe.settings,perm:we,tools:!R,roomSettings:h!=null,talkStart:xe.start,mic:p,recording:L.recording}),De=(0,q.useMemo)(()=>Mie(Ee),[Ee.join(` `)]),Oe=(0,q.useRef)(null),ke=Nie(De,IT(()=>{let e=Oe.current;if(!e)return null;let t=e.getBoundingClientRect().width;return t>0?{available:t,required:LT(e,De.slice(0,-1).map(e=>t=>{for(let[n,r]of Object.entries(E5(e)))t.setAttribute(n,r)}),`oc-composer__bar--measure`)}:null},()=>[Oe.current],[De,be,R])),Ae=new Set(ke.moved),[je,Me]=(0,q.useState)(!1),[Ne,Pe]=(0,q.useState)(null),[Fe,Ie]=(0,q.useState)(null);(0,q.useEffect)(()=>{ke.moved.length===0&&Me(!1)},[ke.moved.length]);let Le=(0,q.useRef)(null),Re=IT(()=>{let e=Le.current;if(!e)return null;let t=e.getBoundingClientRect().width;return t>0?{available:t,required:LT(e,[e=>e.setAttribute(`data-labels`,`on`)],`oc-composer__exphead--measure`)}:null},()=>[Le.current],[R,be]),ze=h?.perTurnRouting===!0||(h?.roomAgents?.length??0)>0,Be=(0,J.jsxs)(J.Fragment,{children:[R?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__backdrop`,"aria-label":mn(),onClick:()=>z(!1)}):null,(0,J.jsxs)(bW.Root,{ref:I,className:`oc-composer${i?` oc-composer--disabled`:``}${L.recording?` oc-composer--dictation`:``}${R?` oc-composer--expanded`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-composer__body`,children:[R?(0,J.jsxs)(`div`,{className:`oc-composer__exphead`,ref:Le,"data-labels":Re===0?`on`:`off`,children:[(0,J.jsx)(`span`,{className:`oc-composer__exptitle`,children:$a()}),(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__expclose`,title:mn(),"aria-label":mn(),onClick:()=>z(!1),children:[(0,J.jsx)(nj,{size:15,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-composer__expclose-label`,children:mn()})]})]}):null,e?(0,J.jsx)(e3,{chatId:e,onOpen:()=>C(`people`,null)}):null,e?(0,J.jsx)(t3,{chatId:e,routing:h,open:g,onOpenChange:_,tab:v,onTabChange:y,intent:b,onIntentDone:S}):null,(0,J.jsx)(Boe,{chatId:e}),(0,J.jsx)(`div`,{className:`oc-attachrow`,children:(0,J.jsx)(bW.Attachments,{components:{Attachment:Voe}})}),(0,J.jsx)(`span`,{className:`oc-sr-only`,role:`status`,"aria-live":`polite`,children:ce}),(0,J.jsx)(Hoe,{}),(0,J.jsx)(bW.Input,{className:`oc-composer__input`,placeholder:i?yl():E?Gi({name:D}):Ce({name:D}),autoFocus:S5(be),unstable_focusOnRunStart:S5(be),unstable_focusOnScrollToBottom:S5(be),unstable_focusOnThreadSwitched:S5(be),rows:1,disabled:i,onKeyDownCapture:ve,onPaste:de,autoCorrect:`off`,autoCapitalize:be?`sentences`:`off`,autoComplete:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`}),(L.recording||L.ownsSend)&&L.interim!==``?(0,J.jsxs)(`div`,{className:`oc-composer__interim`,"aria-hidden":!0,children:[(0,J.jsx)(`span`,{className:`oc-composer__interim-dot`}),(0,J.jsx)(`span`,{className:`oc-composer__interim-text`,children:L.interim})]}):null]}),(0,J.jsxs)(`div`,{className:`oc-composer__bar`,ref:Oe,...E5(ke),children:[(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(bae,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,attachmentsSupported:f,attachDisabled:M||i}),R?null:(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__tools${n?` is-on`:``}`,onClick:r,"aria-pressed":n,title:n?Xh():uo(),"data-overflow":`tools`,children:[(0,J.jsx)(MC,{size:15,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-composer__tools-label`,children:bt()})]}),(0,J.jsx)(Woe,{chatId:e,gate:a,onManage:C}),(0,J.jsx)(fae,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,multiAgent:ze,onVisibleChange:Te})]}),(0,J.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,J.jsx)(xae,{open:je,onOpenChange:Me,moved:Ae,hold:{held:L.held,disabled:!L.canPin||ue,onHold:L.hold,onRelease:L.releaseHereKeepingWords},expand:{expanded:R,onToggle:()=>z(e=>!e)},tools:{shown:n,onToggle:r},onManageConversation:()=>C(`agents`,null),onDictate:L.start,permission:Ae.has(`perm`)?(0,J.jsx)(H5,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,multiAgent:ze}):null,talkSettingsSlot:Pe,talkStartSlot:Ie}),(0,J.jsx)(`span`,{className:`oc-composer__voiceslot${L.canPin||L.held?` is-shown`:``}`,"aria-hidden":!L.canPin&&!L.held,"data-overflow":`hold`,children:L.held?(0,J.jsxs)(`button`,{type:`button`,className:`oc-composer__heldchip`,title:xr(),"aria-label":xr(),onClick:L.releaseHereKeepingWords,children:[(0,J.jsx)(cS,{size:12,"aria-hidden":!0}),Hb(),(0,J.jsx)(zC,{size:11,"aria-hidden":!0})]}):(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon oc-composer__hold`,title:ka(),"aria-label":ka(),onClick:L.hold,disabled:!L.canPin||ue,tabIndex:!L.canPin||ue?-1:0,children:(0,J.jsx)(cS,{size:16,"aria-hidden":!0})})}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__icon${R?` is-on`:``}`,title:R?mn():Rt(),"aria-label":R?mn():Rt(),"aria-pressed":R,onClick:()=>z(e=>!e),"data-overflow":`expand`,children:R?(0,J.jsx)(nj,{size:16,"aria-hidden":!0}):(0,J.jsx)(QA,{size:16,"aria-hidden":!0})}),p?(0,J.jsx)(qoe,{recording:L.recording,onStart:L.start,onStop:L.stop}):null,(0,J.jsx)(D2,{chatId:e,onCallActiveChange:o,serverCallSessionId:s,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,onPresenceChange:Se,more:{moved:{settings:Ae.has(`talk-settings`),start:Ae.has(`talk`)},settingsSlot:Ne,startSlot:Fe,onDone:()=>Me(!1)}},e),i?(0,J.jsxs)(J.Fragment,{children:[j.mode===`queue`?(0,J.jsx)(Y7,{}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!0,"aria-label":Ys(),children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})]}):j.mode===`queue`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y7,{}),ye??(A?(0,J.jsx)(Zre,{chatId:e,queueSend:N===null?null:(e,t)=>N(e,{...t?{mode:t}:{},immediate:t!==`queue`})}):(0,J.jsx)(Uoe,{reason:j.reason}))]}):A&&c?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Y7,{}),ye??(0,J.jsx)(bW.Send,{className:`oc-composer__send`,"aria-label":bb(),disabled:ue,children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})]}):ye??(0,J.jsx)(bW.Send,{className:`oc-composer__send`,"aria-label":bb(),disabled:ue,children:(0,J.jsx)(dA,{size:18,"aria-hidden":!0})})]})]})]})]});return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Doe,{}),L.pinned?(0,J.jsxs)(`div`,{className:`oc-composer__pinnednote`,role:`note`,children:[(0,J.jsx)(cS,{size:14,"aria-hidden":!0}),L.pinnedHere?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:Vh()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>uM(),children:me()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:rg({chat:L.pinnedLabel||Ld()})}),L.pinnedTargetChatId?(0,J.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>{ee({to:`/chat/$chatId`,params:{chatId:L.pinnedTargetChatId}})},children:ko()}):null]})]}):R?(0,Tk.createPortal)(Be,document.body):Be]})}function Yoe({chatId:e}){let t=U5(e);return t.offered?(0,J.jsxs)(fC,{disabled:t.pending,"data-widgets-toggle":!0,onSelect:()=>t.set(!t.enabled),children:[(0,J.jsx)(GA,{}),t.enabled?Fi():ir()]}):null}var X7=67324752,Z7=33639248,Q7=101010256,$7=0,e9=2048,t9=class extends Error{reason;constructor(e,t){super(t===void 0?e:`${e}: ${t}`),this.reason=e,this.name=`ZipError`}},Xoe=(()=>{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 n9(e){let t=4294967295;for(let n of e)t=Xoe[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function Zoe(e){if(e.length>65535)throw new t9(`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=n9(a.bytes),s=new Uint8Array(30+e.length),c=new DataView(s.buffer);c.setUint32(0,X7,!0),c.setUint16(4,20,!0),c.setUint16(6,e9,!0),c.setUint16(8,$7,!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,Z7,!0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,e9,!0),u.setUint16(10,$7,!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,Q7,!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 Qoe(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)===Q7){r=n;break}if(r===-1)throw new t9(`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)!==Z7)throw new t9(`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!==$7)throw new t9(`unsupported_method`,p);if((r&e9)===0)throw new t9(`unsupported_encoding`,p);if(f+30>e.length||t.getUint32(f,!0)!==X7)throw new t9(`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 t9(`corrupt`,p);let _=e.slice(g,g+c);if(n9(_)!==s)throw new t9(`checksum_mismatch`,p);o.push({name:p,bytes:_}),a+=46+l+u+d}return o}var r9=`manifest.json`,i9=`chats/`,$oe=`sections/`,a9=`blobs/`,ese=512*1024*1024,tse=1e4,nse=76,rse=600*1e3;function ise(e,t){return e.filter(e=>t-e.updatedAt>rse)}var ase=class extends Error{bytes;constructor(e){super(`archive exceeds ${ese} bytes`),this.bytes=e,this.name=`ArchiveTooLarge`}};async function o9(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+nse+2*e.length,o>536870912)throw new ase(o);a.push({name:e,bytes:t})},d=[];for(let a of t){let t=await e.chat(a);u(`${i9}${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(`${$oe}${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(`${a9}${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 ${tse} pages`)}}return n?.({phase:`packing`,done:a.length,total:a.length}),a.unshift({name:r9,bytes:r.encode(JSON.stringify({...i,missingBlobs:d}))}),{archive:Zoe(a),manifest:i,blobCount:s,missingBlobs:d}}async function ose(e,t,n,r){let i=new TextDecoder,a=Qoe(t);r?.({phase:`reading`,done:a.length,total:a.length});let o=new Map(a.map(e=>[e.name,e.bytes])).get(r9);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(a9)).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(i9));for(let t of n){let n=JSON.parse(i.decode(t.bytes)),r=await e.batch(c,`chats`,[n],s9([n],d));l+=r.written,c9([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)=>l9(e.name)-l9(t.name));for(let a of n){let n=JSON.parse(i.decode(a.bytes)),o=await e.batch(c,t,n,s9(n,d));l+=o.written,r?.({phase:`writing`,done:l,total:null}),c9(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 s9(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 c9(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 l9(e){let t=/\/(\d+)\.json$/.exec(e);return t===null?0:Number(t[1])}function u9(e){return`atrium-${e.normalize(`NFKD`).replace(/[^\p{Letter}\p{Number}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}.zip`}function d9(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 sse(){let e=wy(),[t,n]=(0,q.useState)({running:!1,progress:null}),r=(0,q.useRef)(!1),i=(0,q.useCallback)(()=>({manifest:()=>e.action(W.archiveExport.exportManifest,{}),chat:t=>e.query(W.archiveExport.exportChat,{chatId:t}),section:(t,n,r)=>e.query(W.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(W.archiveImport.beginImport,{manifest:t,targetProjectId:n??null}),batch:(t,n,r,i)=>e.mutation(W.archiveImport.importBatch,{importId:t,section:n,rows:r,blobs:i.map(e=>({key:e.key,storageId:e.storageId}))}),finish:t=>e.mutation(W.archiveImport.finishImport,{importId:t}),abandon:t=>e.mutation(W.archiveImport.abandonImport,{importId:t}),upload:async t=>{let n=await e.mutation(W.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(W.uploads.registerUpload,{storageId:r}),r},registerBlob:async(t,n)=>{await e.mutation(W.archiveImport.registerImportBlob,{importId:t,storageId:n})},discardUpload:async(t,n)=>{await e.mutation(W.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 o9(i(),e,n);return d9(r,u9(t)),{missingBlobs:a}}),[o,i]),c=(0,q.useCallback)((t,n)=>o(async r=>{let a=await e.query(W.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(W.archiveExport.exportFolderChats,{projectId:t._id,cursor:n});o.push(...r.chatIds),n=r.cursor}while(n!==null)}let{archive:s,missingBlobs:c}=await o9(i(),o,r);return d9(s,u9(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 ose(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(W.archiveImport.listOpenImports,{});for(let r of ise(n,Date.now())){let n=!1;for(let i=0;i<1e3&&!n&&!t;i+=1)n=(await e.mutation(W.archiveImport.abandonImport,{importId:r.importId})).done}}catch{}})(),()=>{t=!0}},[e]),{state:t,exportChats:s,exportFolder:c,importArchive:l}}var f9=(0,q.createContext)(null);function cse({children:e}){let t=sse(),n=Tw(),r=(e,t)=>{let r=e instanceof Error?e.message:String(e);if(r.includes(`folder_too_large`)){n.error(Jl());return}if(r.includes(`already running`)){n.error(cl());return}if(r.includes(`archive_too_large`)){n.error(Rx());return}if(r.includes(`not_a_zip`)||r.includes(`no manifest`)){n.error(Ie());return}n.error(t,e)},i={state:t.state,exportChat:(e,i)=>{t.exportChats([e],i).then(({missingBlobs:e})=>{e.length>0?n.error(K_({count:e.length})):n.success(mi())}).catch(e=>r(e,Al()))},exportFolder:(e,i)=>{t.exportFolder(e,i).then(({missingBlobs:e})=>{e.length>0?n.error(K_({count:e.length})):n.success(mi())}).catch(e=>r(e,Al()))},importArchive:(e,i)=>{t.importArchive(e,i).then(({written:e,purged:t})=>{n.success(Pi({count:e}),t?void 0:rr())}).catch(e=>r(e,Tr()))}},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)(f9.Provider,{value:a,children:e})}function p9(){return(0,q.useContext)(f9)}function lse(e){if(!e.running)return null;let t=e.progress;if(t===null)return bs();switch(t.phase){case`sections`:return Vp({count:t.done});case`blobs`:return E({count:t.done});case`packing`:return bs();case`reading`:return ld({count:t.done});case`uploading`:return _u({done:t.done,total:t.total??t.done});case`writing`:return Vu({count:t.done})}}function use(e,t){return e===null?t:`${e}-${t}`}var dse=e=>{let{transform:t}=e;return{...t,y:0}};function fse(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 pse=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:fse(n,t,i)},mse=e=>{let{transform:t}=e;return{...t,x:0}},m9=`project:none`,hse=e=>`project:${e}`,h9=`projhead:`,g9=e=>`${h9}${e}`,_9=`oc.noproject.collapsed`,v9=`oc.shared.collapsed`,gse=[`full`,`label`,`icon`];function y9(){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 b9=(0,q.createContext)(new Map);function _se({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=H(W.messages.listChats,{}),a=H(W.projects.listProjects,{}),o=H(W.me.getMe,{host:iT})?.ui?.effective?.showChatAge??!0,s=H(W.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=H(W.chatReads.myBusyChats,{}),u=(0,q.useMemo)(()=>new Set(l??[]),[l]),{byChat:d}=CS(l??null),f=H(W.agentRequests.pendingByChat,{}),p=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[])e.set(t.chatId,t.kinds.includes(`approval`)?`approval`:t.kinds.includes(`credential`)?`credential`:`question`);return e},[f]),m=H(W.chatBookmarks.myBookmarkedChats,{}),h=H(W.chatExport.referenceLabel,{}),g=(0,q.useMemo)(()=>new Set(m??[]),[m]),_=(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]),[v,y]=(0,q.useState)(0);(0,q.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>y(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let b=G(W.projects.createProject),x=G(W.projects.setProjectCollapsed),S=G(W.projects.setProjectSidebar),C=G(W.chats.reorderChat),w=G(W.projects.reorderProject),T=G(W.chats.moveChatToProject),E=oT(),D=jt(),O=(0,q.useRef)(null),k=(0,q.useRef)(null),A=(0,q.useRef)(null),j=gse[IT(()=>{let e=O.current;return e?{available:e.clientWidth,required:[k.current?.offsetWidth??0,A.current?.offsetWidth??0]}:null},()=>[O.current],[D,r])],[M,N]=(0,q.useState)(null),P=(0,q.useRef)(!1);(0,q.useEffect)(()=>{!P.current&&i&&N(i)},[i]);let F=M??i??[],I=F.filter(e=>e.sidebarHidden!==!0),ee=F.filter(e=>e.sidebarHidden===!0),L=i===void 0&&M===null,[R,z]=(0,q.useState)(null),[B,V]=(0,q.useState)(()=>localStorage.getItem(_9)===`1`),[te,ne]=(0,q.useState)(()=>localStorage.getItem(v9)===`1`);function re(){ne(e=>(localStorage.setItem(v9,e?`0`:`1`),!e))}function ie(){V(e=>(localStorage.setItem(_9,e?`0`:`1`),!e))}let ae=M4();(0,q.useEffect)(()=>{if(!ae?.expand)return;let e=I.find(e=>e._id===ae.chatId);if(!e)return;let t=e.projectId??null;if(t===null){B&&(localStorage.setItem(_9,`0`),V(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&x({projectId:t,collapsed:!1})},[ae,I,a,B,x]);let oe=wS(GS(DS,{activationConstraint:{distance:4}}),GS(Pte,{activationConstraint:{delay:250,tolerance:8}}),GS(NS,{coordinateGetter:jS})),se=(0,q.useRef)(!1),ce=()=>{se.current=!0,setTimeout(()=>{se.current=!1},0)},le=(0,q.useCallback)(e=>String(e.active.id).startsWith(h9)?KS({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(h9))}):KS(e),[]),ue=I.filter(e=>e.pinned),de=I.filter(e=>!e.pinned&&e.role===`participant`),fe=I.filter(e=>!e.pinned&&e.role!==`participant`),pe=e=>fe.filter(t=>(t.projectId??null)===e),me=rS(),he=(0,q.useMemo)(()=>SS(a??[]),[a]),ge=(0,q.useMemo)(()=>he.filter(e=>!e.sidebarHidden),[he]),_e=(0,q.useMemo)(()=>he.filter(e=>e.sidebarHidden),[he]),ve=(0,q.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,bS(e,t._id)]))},[a]),ye=(0,q.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),be=e=>fe.filter(t=>t.projectId!==null&&(ve.get(t.projectId)??t.projectId)===e);function xe(e){return I.find(t=>t._id===e)}async function Se(e){z(null),ce();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(h9)){let e=r.slice(9),t=ge,n=null;if(i.startsWith(h9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==m9)n=i.slice(8);else{let e=xe(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 w({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=xe(r);if(!a||a.role===`participant`)return;if(i.startsWith(h9)){let e=i.slice(9);if((a.projectId??null)===e)return;P.current=!0,N(t=>(t??I).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await T({chatId:a._id,projectId:e})}finally{P.current=!1}return}if(i.startsWith(`project:`)){let e=i===m9?null:i.slice(8);if((a.projectId??null)===e)return;P.current=!0,N(t=>(t??I).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await T({chatId:a._id,projectId:e})}finally{P.current=!1}return}let o=xe(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;P.current=!0,N(e=>(e??I).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await T({chatId:a._id,projectId:o.projectId??null})}finally{P.current=!1}return}let s=o.pinned?ue:pe(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;P.current=!0,N(e=>[...(e??I).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await C({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{P.current=!1}}let Ce=p9(),we=Ce?lse(Ce.state):null,[Te,Ee]=(0,q.useState)(!1),De=R?xe(R):null;return(0,J.jsx)(b9.Provider,{value:p,children:(0,J.jsx)(fS.Provider,{value:d,children:(0,J.jsxs)(`aside`,{className:`oc-sidebar`+(Te?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Ee(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Ee(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Ee(!1);let t=e.dataTransfer.files[0];t!==void 0&&Ce?.importArchive(t,null)},children:[Te?(0,J.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,J.jsx)(IC,{className:`size-4`}),(0,J.jsx)(`span`,{children:Rv()})]}):null,we===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:we})]}),(0,J.jsxs)(`div`,{className:`oc-sidebar__top`,ref:O,children:[(0,J.jsxs)(K,{className:j===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,"data-focus-key":`sidebar:new-chat`,title:`${D} (${r})`,"aria-label":D,children:[(0,J.jsx)(OC,{}),j===`icon`?null:(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:D}),j===`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:k,children:[(0,J.jsxs)(K,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,J.jsx)(OC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:D}),(0,J.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(pS,{})})]})}),(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)(OC,{}),(0,J.jsx)(`span`,{className:`oc-newchat__label`,children:D})]}),(0,J.jsx)(K,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,J.jsx)(pS,{})})]})}),(0,J.jsx)(K,{className:`oc-newproject`,"data-focus-key":`sidebar:new-folder`,variant:`outline`,size:`icon`,"aria-label":sn(),title:sn(),onClick:async()=>{let e=await E({title:sn(),label:zc(),placeholder:fb(),confirmLabel:it()});e&&await b({name:e})},children:(0,J.jsx)(pS,{})})]}),(0,J.jsxs)(RS,{sensors:oe,collisionDetection:le,modifiers:[mse,pse],onDragStart:e=>z(String(e.active.id)),onDragCancel:()=>{z(null),ce()},onDragEnd:Se,children:[(0,J.jsx)(`div`,{className:`oc-sidebar__scroll`,children:L?(0,J.jsx)(y9,{}):(0,J.jsxs)(J.Fragment,{children:[ue.length>0?(0,J.jsx)(x9,{label:fc(),chats:ue,children:ue.map(n=>(0,J.jsx)(S9,{chat:n,active:n._id===e,unread:_.has(n._id),busy:u.has(n._id),bookmarked:g.has(n._id),referenceLabel:h,ageTick:v,suppressClick:se,onSelect:t},n._id))}):null,(0,J.jsx)(WS,{items:ge.map(e=>g9(e._id)),strategy:VS,children:ge.map(n=>{let r=be(n._id);return(0,J.jsx)(x9,{label:n.name,dropId:hse(n._id),sortId:g9(n._id),suppressClick:se,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>u.has(e._id)),unread:r.some(e=>_.has(e._id)),onToggle:()=>void x({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void me({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,J.jsx)(`div`,{className:`oc-sidebar__empty`,children:Lb()}):r.map(r=>(0,J.jsx)(S9,{chat:r,active:r._id===e,unread:_.has(r._id),busy:u.has(r._id),bookmarked:g.has(r._id),referenceLabel:h,domainLabel:r.projectId!==null&&r.projectId!==n._id?ye.get(r.projectId)??null:null,ageTick:v,suppressClick:se,onSelect:t},r._id))},n._id)})}),_e.length>0?(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,"data-focus-key":`sidebar:hidden-folders`,children:[(0,J.jsx)(yC,{className:`size-3.5`,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:Ks({count:_e.length})})]})}),(0,J.jsx)(uC,{align:`start`,className:`w-56`,children:_e.map(e=>(0,J.jsxs)(fC,{onSelect:()=>void S({projectId:e._id,hidden:!1}),children:[(0,J.jsx)(_S,{}),` `,e.name]},e._id))})]}):null,de.length>0||ee.length>0?(0,J.jsxs)(x9,{label:Ib(),chats:de,collapsible:!0,collapsed:te,busy:de.some(e=>u.has(e._id)),unread:de.some(e=>_.has(e._id)),onToggle:re,children:[te?null:de.map(n=>(0,J.jsx)(S9,{chat:n,active:n._id===e,unread:_.has(n._id),busy:u.has(n._id),bookmarked:g.has(n._id),referenceLabel:h,ageTick:v,suppressClick:se,onSelect:t},n._id)),!te&&ee.length>0?(0,J.jsx)(vse,{chats:ee}):null]}):null,(0,J.jsx)(x9,{label:kf(),dropId:m9,chats:pe(null),collapsible:!0,collapsed:B,busy:pe(null).some(e=>u.has(e._id)),unread:pe(null).some(e=>_.has(e._id)),onToggle:ie,children:B?null:pe(null).map(n=>(0,J.jsx)(S9,{chat:n,active:n._id===e,unread:_.has(n._id),busy:u.has(n._id),bookmarked:g.has(n._id),referenceLabel:h,ageTick:v,suppressClick:se,onSelect:t},n._id))})]})}),(0,J.jsxs)(PS,{children:[R?.startsWith(h9)?(()=>{let e=(a??[]).find(e=>g9(e._id)===R);return e?(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":BS(e)},children:[(0,J.jsx)(rC,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,J.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,De?(0,J.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[OS(De.color)?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:OS(De.color)}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsx)(`span`,{className:`oc-chatitem__label`,children:De.title||sx()})]}):null]})]})]})})})}function x9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:l,unread:u,onToggle:d,onOpen:f,children:p}){let m=G(W.projects.setProjectSidebar),h=p9(),g=(0,q.useContext)(fS),_=o.map(e=>g.get(e._id)).find(e=>e!==void 0)??null,v=G(W.projects.deleteProject),y=G(W.projects.renameProject),b=G(W.projects.setProjectColor),x=G(W.projects.moveProject),S=aT(),C=RT(),[w,T]=(0,q.useState)(!1),[E,D]=(0,q.useState)(e),[O,k]=(0,q.useState)(!1),A=H(W.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:j,isOver:M}=lS({id:t??`static:${e}`}),N=MS({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:P,...F}=N.listeners??{},I=f??d,ee=e=>{e.target===e.currentTarget&&s&&I&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),I())},L=a?BS(a):null;return(0,J.jsxs)(`div`,{ref:e=>{t&&j(e),n&&N.setNodeRef(e)},className:`oc-sidebar__group`+(M?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...L?{"--proj-hue":L}:{},...n?{transform:dS.Transform.toString(N.transform),transition:N.transition,opacity:N.isDragging?.35:1}:{}},children:[(0,J.jsxs)(`div`,{className:`oc-sidebar__group-head oc-reveal-host group/head`+(s?` oc-sidebar__group-head--btn`:``),title:c&&l&&_?vS(_):void 0,...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||I?.()},onKeyDown:ee}:{},...n?F:{},children:[s?f?(0,J.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn oc-hit`,"aria-label":c?tu():Tu(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&d?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,J.jsx)(iC,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(rC,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,J.jsx)(iC,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,J.jsx)(rC,{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":Zy(),onClick:e=>e.stopPropagation(),...N.attributes,onKeyDown:P,children:(0,J.jsx)(LA,{className:`size-3.5`})}):null,c&&l?(0,J.jsx)(`span`,{className:hS(_,Ly()).className,title:hS(_,Ly()).label,"aria-label":hS(_,Ly()).label}):null,c&&u?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:hm(),"aria-label":hm()}):null,i?(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":Bm(),className:`oc-sidebar__group-menu oc-reveal oc-hit`,"data-focus-key":`sidebar:folder-menu:${i}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(cC,{})})}),(0,J.jsxs)(uC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[f?(0,J.jsxs)(fC,{onSelect:()=>f(),children:[(0,J.jsx)(_S,{}),` `,M_()]}):null,(0,J.jsxs)(fC,{onSelect:()=>{D(e),T(!0)},children:[(0,J.jsx)(DC,{}),` `,ec()]}),(0,J.jsxs)(fC,{onSelect:()=>k(!0),children:[(0,J.jsx)(pS,{}),` `,Ia()]}),a!==void 0&&a.parentId===null?(0,J.jsxs)(fC,{onSelect:()=>void m({projectId:a._id,hidden:!0}),children:[(0,J.jsx)(yC,{}),` `,tf()]}):null,h&&a?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(fC,{disabled:h.state.running,onSelect:()=>h.exportFolder(a._id,e),children:[(0,J.jsx)(vC,{}),` `,Ate()]}),(0,J.jsxs)(fC,{disabled:h.state.running,onSelect:()=>h.pickAndImport(a._id),children:[(0,J.jsx)(IC,{}),` `,s_()]})]}):null,(0,J.jsx)(lC,{children:Xb()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void b({projectId:i,color:null}),"aria-label":Cy(),children:`✕`}),FS.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 b({projectId:i,color:e.value})},e.value))]}),(0,J.jsx)(pC,{}),(0,J.jsxs)(fC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=A?.folders??0,n=A?.chats??0;await S({title:bg({name:e}),description:zT({folders:t,chats:n,days:C}),confirmWord:wc(),confirmLabel:uy(),destructive:!0})&&await v({projectId:i})})},children:[(0,J.jsx)(PC,{}),` `,wc()]})]})]}):null]}),(0,J.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,J.jsx)(WS,{items:o.map(e=>e._id),strategy:VS,children:p})}),i?(0,J.jsx)(hT,{open:w,onOpenChange:T,title:dh(),canSubmit:E.trim().length>0,onSubmit:async()=>{await y({projectId:i,name:E.trim()}),T(!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:_n()}),(0,J.jsx)(mw,{value:E,onChange:e=>D(e.target.value),autoFocus:!0})]})})}):null,i&&O?(0,J.jsx)(US,{open:O,onOpenChange:k,title:gee(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void x({projectId:i,parentId:e})}):null]})}var S9=(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)(b9).get(e._id),d=(0,q.useContext)(fS).get(e._id)??null,f=p9(),{attributes:p,listeners:m,setNodeRef:h,transform:g,transition:_,isDragging:v}=MS({id:e._id}),{onKeyDown:y,...b}=m??{},S=G(W.chats.renameChat),C=Tw(),w=()=>{if(a===void 0)return;let t=use(a,e._id);navigator.clipboard.writeText(t).then(()=>C.success(Di({reference:t})),()=>C.error(Zn()))},T=G(W.chats.deleteChat),E=G(W.chats.pinChat),D=G(W.chats.setChatColor),O=G(W.chats.moveChatToProject),k=G(W.chats.setChatSidebar),A=G(W.chatParticipants.leaveChat),j=e.role===`participant`,M=rS(),[N,P]=(0,q.useState)(!1),F=H(W.me.getMe,{host:iT})?.ui?.effective?.showChatAge??!0,I=aT(),ee=RT(),[L,R]=(0,q.useState)(!1),[z,B]=(0,q.useState)(e.title??``),V=M4()?.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(()=>j4(e._id),2600);return()=>clearTimeout(n)},[V,e._id]);let ne={transform:dS.Transform.toString(g),transition:_,opacity:+!v},re=OS(e.color);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{ref:e=>{h(e),te.current=e},style:ne,className:`oc-chatitem oc-reveal-host group/row`+(t?` oc-chatitem--active`:``)+(V?` oc-chatitem--flash`:``),title:r&&d?vS(d):void 0,onClick:()=>{s.current||c(e._id)},...b,onAnimationEnd:t=>{V&&t.animationName===`oc-chatitem-flash`&&j4(e._id)},children:[(0,J.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":Zy(),onClick:e=>e.stopPropagation(),...p,onKeyDown:y,children:(0,J.jsx)(LA,{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)(NC,{className:`oc-chatitem__group`,size:12,"aria-label":Ad()}):null,e.title||sx()]}),e.role===`participant`&&e.ownerName?(0,J.jsx)(`span`,{className:`oc-chatitem__domain`,children:Iy({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:x(),"aria-label":x(),children:l===`approval`?(0,J.jsx)(AC,{size:11,"aria-hidden":!0}):l===`credential`?(0,J.jsx)(WA,{size:11,"aria-hidden":!0}):(0,J.jsx)(ej,{size:11,"aria-hidden":!0})}),r?(0,J.jsx)(`span`,{className:hS(d,jd()).className,title:hS(d,jd()).label,"aria-label":hS(d,jd()).label}):null,n?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:hm(),"aria-label":hm()}):null,e.readOnly?(0,J.jsx)(`span`,{className:`oc-chatitem__readonly`,title:Sp(),children:(0,J.jsx)(wC,{size:12,"aria-label":Sp()})}):null,i?(0,J.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:Nu(),children:(0,J.jsx)(hA,{size:12,"aria-label":Nu()})}):null,F?(0,J.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:zw(e.updatedAt),children:zS(e.updatedAt,Date.now())}):null,(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon-xs`,"aria-label":Ue(),className:`oc-reveal oc-hit`,"data-focus-key":`sidebar:chat-menu:${e._id}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,J.jsx)(cC,{})})}),(0,J.jsxs)(uC,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[j?null:(0,J.jsxs)(fC,{onSelect:()=>{B(e.title??``),R(!0)},children:[(0,J.jsx)(DC,{}),` `,ec()]}),f&&!j?(0,J.jsxs)(fC,{disabled:f.state.running,onSelect:()=>f.exportChat(e._id,e.title??kf()),children:[(0,J.jsx)(vC,{}),` `,iee()]}):null,(0,J.jsxs)(fC,{onSelect:()=>void E({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,J.jsx)(qS,{}):(0,J.jsx)(cS,{}),e.pinned?Tb():_f()]}),j?null:(0,J.jsx)(Yoe,{chatId:e._id}),j?null:(0,J.jsxs)(fC,{onSelect:w,disabled:a===void 0,children:[(0,J.jsx)(qA,{}),` `,pte()]}),j?null:(0,J.jsxs)(fC,{onSelect:()=>P(!0),children:[(0,J.jsx)(_S,{}),` `,Io()]}),e.projectId===null?null:(0,J.jsxs)(fC,{onSelect:()=>void M({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,J.jsx)(PA,{}),` `,u()]}),e.pinned?null:(0,J.jsxs)(fC,{onSelect:()=>void k({chatId:e._id,hidden:!0}),children:[(0,J.jsx)(ES,{}),` `,tf()]}),j?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(pC,{}),(0,J.jsxs)(fC,{variant:`destructive`,onSelect:()=>void A({chatId:e._id}),children:[(0,J.jsx)(ZA,{}),` `,tg()]})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lC,{children:Xb()}),(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":Cy(),children:`✕`}),FS.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)(pC,{}),(0,J.jsxs)(fC,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await I({title:vd(),description:Om({days:ee}),confirmLabel:wc(),destructive:!0})&&await T({chatId:e._id})})},children:[(0,J.jsx)(PC,{}),` `,wc()]})]})]})]})]}),(0,J.jsx)(hT,{open:L,onOpenChange:R,title:Or(),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:_n()}),(0,J.jsx)(mw,{value:z,onChange:e=>B(e.target.value),autoFocus:!0})]})})}),N?(0,J.jsx)(US,{open:N,onOpenChange:P,title:fa(),currentId:e.projectId,onPick:t=>void O({chatId:e._id,projectId:t})}):null]})});function vse({chats:e}){let[t,n]=(0,q.useState)(!1),r=G(W.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)(rC,{size:12,"aria-hidden":!0}):(0,J.jsx)(iC,{size:12,"aria-hidden":!0}),Of({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??kf()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-hiddenshared__show`,onClick:()=>void r({chatId:e._id,hidden:!1}),children:ox()})]},e._id))}):null]})}var C9=null,w9=0,yse=400;function bse(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!C9)try{C9=new e}catch{return null}return C9}function T9(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 E9(e){let t=Date.now();if(t-w9<yse)return;let n=bse();if(!n)return;w9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function xse(){E9(e=>{T9(e,660,0,.16,.12),T9(e,440,.14,.2,.1)})}function Sse(){E9(e=>{T9(e,880,0,.14,.08)})}function Cse({activeChatId:e}){let t=H(W.messages.listChats,{}),n=G(W.chatReads.markChatSeen),r=H(W.me.getMe,{host:iT}),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&&A4(t))}l&&i&&Sse()},[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 D9=[`admin`,`user`,`pending`];function O9(){let e=H(W.me.authProviders)?.anonymous===!0,[t,n]=(0,q.useState)(!1),r=H(W.dev.listUsersDev,e?{}:`skip`),i=H(W.me.getImpersonation),a=G(W.dev.setMyRole),o=G(W.dev.setRole),s=G(W.admin.startImpersonation),c=G(W.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:Tl(),children:[(0,J.jsx)(Oj,{size:13}),`DEV`]}),(0,J.jsx)(Kw,{open:t,onOpenChange:n,children:(0,J.jsxs)(Uw,{children:[(0,J.jsxs)(Vw,{children:[(0,J.jsx)(Ww,{children:Ae()}),(0,J.jsx)(Gw,{children:Mx()})]}),(0,J.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,J.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[Bs({canonical:l?.canonical??`…`}),` `,(0,J.jsx)(Dw,{variant:`outline`,children:l?.role??`…`})]}),(0,J.jsx)(`div`,{className:`oc-devsw__roles`,children:D9.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`?$i():e===`user`?Wr():Nn()},e))})]}),d?(0,J.jsxs)(`div`,{className:`oc-devsw__imp`,children:[Jo(),` `,(0,J.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,J.jsx)(K,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Ja()})]}):null,(0,J.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,J.jsx)(`p`,{className:`oc-devsw__empty`,children:Ca()}):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:D9.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`?ce():Nee():wee(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:So()})]},e.profileId))})]})})]})}var k9=`atrium.authelia-login`;function wse(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 Tse(e,t){let n;return{start(r,i=!1){if(n)return n;try{let t=e.getItem(k9);if(!i&&t!==null)return Promise.resolve(t===`signed-out`?`signed-out`:`failed`);e.setItem(k9,`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(k9,`signed-out`)}catch{}},authenticated(){try{e.removeItem(k9)}catch{}}}}var A9;function j9(){return A9??=Tse({getItem:e=>window.sessionStorage.getItem(e),setItem:(e,t)=>window.sessionStorage.setItem(e,t),removeItem:e=>window.sessionStorage.removeItem(e)},()=>wse(window.location)),A9}function M9({label:e,mode:t,minimal:n=!1,compact:r=!1}){let{signOut:i}=IE();async function a(){j9().signedOut(),await i()}let o=G(W.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(W.me.getMe,{host:iT});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(W.me.getMe,{host:iT},{...n,themeMode:t,resolvedThemeMode:r})}),s=t??`default`;return(0,J.jsxs)(mC,{children:[(0,J.jsx)(sC,{asChild:!0,children:r?(0,J.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":e,title:e,children:(0,J.jsx)(xA,{})}):(0,J.jsxs)(K,{variant:`ghost`,size:`sm`,className:`oc-usermenu__trigger min-w-0 shrink gap-1.5`,"aria-label":e,title:e,children:[(0,J.jsx)(xA,{className:`oc-usermenu__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-usermenu__label`,children:e}),(0,J.jsx)(rC,{className:`oc-usermenu__chev opacity-60`,"aria-hidden":!0})]})}),(0,J.jsx)(uC,{side:r?`right`:`bottom`,align:`end`,className:`w-52`,children:n?(0,J.jsxs)(fC,{onClick:()=>void a(),children:[(0,J.jsx)(ZA,{}),` `,J_()]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(lC,{children:Bf()}),(0,J.jsxs)(oC,{value:s,onValueChange:e=>void o({mode:e==="default"?null:e}),children:[(0,J.jsxs)(dC,{value:`light`,children:[(0,J.jsx)(wj,{}),` `,sv()]}),(0,J.jsxs)(dC,{value:`dark`,children:[(0,J.jsx)(ij,{}),` `,x_()]}),(0,J.jsxs)(dC,{value:`system`,children:[(0,J.jsx)(rj,{}),` `,Wd()]}),(0,J.jsx)(dC,{value:`default`,children:wh()})]}),(0,J.jsx)(pC,{}),(0,J.jsxs)(fC,{onClick:()=>void a(),children:[(0,J.jsx)(ZA,{}),` `,J_()]})]})})]})}var N9=[`full`,`logo`,`icon`],P9=[`full`,`logo`];function Ese({providers:e,children:t}){return e===void 0?(0,J.jsx)(`div`,{className:`oc-boot`,children:dr()}):e.autheliaOnly?(0,J.jsx)(Ose,{enabled:e.authelia}):t}function Dse({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`?Mr():e===`signed-out`?xn():e===`unavailable`?ua():Po()}),e===`failed`||e===`signed-out`?(0,J.jsx)(`button`,{type:`button`,className:`oc-provider`,onClick:t,children:Vi()}):null]})})}function Ose({enabled:e}){let{signIn:t}=IE(),[n,r]=(0,q.useState)(e?`redirecting`:`unavailable`);return(0,q.useEffect)(()=>{let n=!0;return e?j9().start(t).then(e=>{n&&r(e)}):r(`unavailable`),()=>{n=!1}},[e,t]),(0,J.jsx)(Dse,{state:n,retry:()=>{r(`redirecting`),j9().start(t,!0).then(r)}})}var kse={altered_words:()=>Hh(),incorrect:()=>to(),incoherence:()=>dt(),formatting:()=>Vt(),latency:()=>bc(),api_error:()=>qy(),other:()=>ze()},F9=e=>kse[e]?.()??e,Ase={anomaly_open:FC,anomaly_resolved:Vte,feedback_reply:mS,feedback_resolved:mS,feedback_new:mS,curation:AA,operator_announcement:$A,mention:fA,agent_request:ej,chat_added:NC,group_invite:jC},jse={atrium:()=>sy(),assistants:()=>gg(),platform:()=>Jf()},Mse={investigating:()=>hv(),monitoring:()=>k_(),resolved:()=>Qd()},I9=e=>(e?jse[e]:void 0)?.()??`?`,Nse=e=>(e?Mse[e]:void 0)?.()??`?`,L9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(rm()):`?`},Pse={notif_feedback_reply_admin:()=>({title:Aa(),body:oa()}),notif_feedback_reply:()=>({title:Aa(),body:oa()}),notif_feedback_resolved:()=>({title:Hv(),body:Kp()}),notif_feedback_new:e=>({title:uee(),body:j({reference:e.reference??`?`,category:F9(e.category??`other`)})}),notif_mention:e=>({title:se(),body:dc({chat:e.chat??``})}),notif_chat_added:e=>({title:Mee({by:e.by??`?`}),body:dc({chat:e.chat??``})}),notif_group_invite_request:e=>({title:xo(),body:At({by:e.by??`?`,group:e.group??`?`})}),notif_group_invite_approved:e=>({title:on(),body:Rc({email:e.email??`?`,group:e.group??`?`})}),notif_group_invite_rejected:e=>({title:db(),body:rt({email:e.email??`?`,group:e.group??`?`})}),notif_agent_request_question:e=>({title:hs(),body:Fu({chat:e.chat??``})}),notif_agent_request_approval:e=>({title:id(),body:Fu({chat:e.chat??``})}),notif_agent_request_credential:e=>({title:fu(),body:Fu({chat:e.chat??``})}),notif_curation_proposed:e=>({title:kx(),body:Ls({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:Xi(),body:Vr({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:An(),body:Wo({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:Wa({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:ya({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:Ny(),body:Dd({service:I9(e.service),startsAt:L9(e.starts_at),endsAt:L9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:Im(),body:oh({service:I9(e.service),completedAt:L9(e.completed_at)})}),notif_operator_incident_update:e=>({title:Rg(),body:Yee({service:I9(e.service),status:Nse(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:dm(),body:vp({plan:e.plan??`?`,effectiveAt:L9(e.effective_at)})})};function R9(e){let t=e.messageKey?Pse[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:Aa(),body:oa()}:e.kind===`feedback_resolved`?{title:Hv(),body:Kp()}:{title:e.title,body:e.body}}function Fse(){let e=H(W.notifications.myUnreadCount)??0,t=H(W.notifications.myNotifications),n=H(W.feedback.myFeedback),r=G(W.notifications.markRead),i=G(W.notifications.markAllRead),a=G(W.notifications.clearOne),o=G(W.notifications.clearAll),s=G(W.feedback.closeMyFeedback),c=rS(),[l,u]=(0,q.useState)(!1),d=H(W.me.getMe,{host:iT}),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&&xse(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=R9(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)(mC,{open:l,onOpenChange:u,children:[(0,J.jsx)(sC,{asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?ts({count:e}):Wu(),children:[(0,J.jsx)(pA,{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)(uC,{align:`end`,className:`oc-notif`,children:[(0,J.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,J.jsx)(`span`,{children:Zl()}),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:xu()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Zr()})]}):null]}),t===void 0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:cg()}):t.length===0?(0,J.jsx)(`div`,{className:`oc-notif__empty`,children:ote()}):(0,J.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=Ase[e.kind]??pA,{title:n,body:i}=R9(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:_i(),"aria-label":_i(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,J.jsx)(nC,{size:13})}):null,(0,J.jsx)(`button`,{type:`button`,title:Vn(),"aria-label":Vn(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,J.jsx)(zC,{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(rm())})]},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:Ml()}),(0,J.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,J.jsx)(Ise,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function Ise({it:e,onClose:t,onNavigate:n}){let r=Tw(),[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(Ri(),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:F9(e.category)}),(0,J.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?aee():e.answered?Kc():sr()})]}),(0,J.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(rm())}),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`?dl():e.authorRole===`agent`?P_():he()}),(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)(rC,{size:13,"aria-hidden":!0}):(0,J.jsx)(iC,{size:13,"aria-hidden":!0}),ws()]}),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:gx()}),o?null:(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:Ri()})]}),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:Dr()}),(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:gn()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:Ao()})]})]}):null]})}var z9=2,Lse=180;function Rse(){let e=rS(),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)(``),[l,u]=(0,q.useState)(0),d=(0,q.useMemo)(()=>_w(Cw,gw()),[]);(0,q.useEffect)(()=>{let e=setTimeout(()=>c(a),Lse);return()=>clearTimeout(e)},[a]);let f=s.trim(),p=H(W.search.searchConversations,f.length>=z9?{query:f}:`skip`),m=p??[],h=f.length>=z9&&p===void 0;(0,q.useEffect)(()=>{let e=e=>{yw(e,Cw)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,q.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,q.useEffect)(()=>{u(0)},[p]),(0,q.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let g=(0,q.useCallback)((t,n)=>{i(!1),n&&a.trim()&&uS(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":Zb(),children:[(0,J.jsx)(gC,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`oc-search-trigger__label`,children:Ty()}),(0,J.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,J.jsx)(Kw,{open:r,onOpenChange:i,children:(0,J.jsxs)(Uw,{showCloseButton:!1,className:`oc-search-palette translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,J.jsx)(Ww,{className:`sr-only`,children:bd()}),(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(),u(e=>Math.min(e+1,m.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=m[l];t&&g(t.chatId,t.messageId)}},placeholder:Am(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":$m()})]}),(0,J.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<z9?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:Mg({count:z9})}):h?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:Uee()}):m.length===0?(0,J.jsx)(`div`,{className:`oc-search-palette__hint`,children:im({term:f})}):m.map((e,t)=>(0,J.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:g_(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>g(e.chatId,e.messageId),children:[(0,J.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,J.jsx)(RA,{size:15}):(0,J.jsx)(mS,{size:15})}),(0,J.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,J.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||dp()}),e.projectPath&&e.projectPath.length>0?(0,J.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":Cn(),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`?ey():lg()})]},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:`↓`}),` `,Vf()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:`↵`}),` `,cv()]}),(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`kbd`,{children:S_()}),` `,Gd()]})]})]})})]})}var B9=[{id:`personal`,label:()=>Tt(),tabs:[`preferences`,`theme`,`files`,`scheduled`,`deletedChats`]},{id:`agents`,label:()=>en(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>Nc(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`,`trash`]},{id:`observability`,label:()=>ob(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],zse=new Map(B9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function V9(e){let t=zse.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function Bse(e,t){return e.find(e=>V9(e)===t)}B9.flatMap(e=>[...e.tabs]);function Vse(){let e=H(W.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?hx({count:t}):`${co()}${e.checkedAt?vt({time:Lw(e.checkedAt)}):``}`:qt({reason:e.reason??`?`}):Yh();return(0,J.jsx)(UC,{delayDuration:150,children:(0,J.jsxs)(GC,{children:[(0,J.jsx)(BC,{asChild:!0,children:(0,J.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,J.jsx)(VC,{children:r})]})})}function H9(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 Hse(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function Use({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)(Vse,{}):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 Wse({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=MS({id:e});return(0,J.jsxs)(`div`,{ref:i,style:{transform:dS.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item oc-reveal-host`,role:`presentation`,children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip oc-reveal`,"aria-label":xee(),...n,...r,children:(0,J.jsx)(LA,{size:14,"aria-hidden":!0})}),(0,J.jsx)(Use,{tab:e,active:t})]})}function Gse(){let e=H(W.me.getMe,{host:iT}),t=G(W.me.setSettingsTabOrder),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:V9(n),i=(0,q.useMemo)(()=>H9(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)&&V9(e)===r),[a,s,r]),l=wS(GS(Nte,{activationConstraint:{distance:5}}),GS(NS,{coordinateGetter:jS})),u=(0,q.useRef)(null);if((0,q.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>dw(e,e.querySelector(`[role="tab"][aria-selected="true"]`));t();let n=new ResizeObserver(t);n.observe(e);for(let t of Array.from(e.children))n.observe(t);let r=t=>cw(e,t.target,`[role="tab"]`);return e.addEventListener(`focusin`,r),()=>{n.disconnect(),e.removeEventListener(`focusin`,r)}},[n,c.length]),r===void 0||c.length===0)return null;let d=B9.find(e=>e.id===r);function f(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=Hse(a,AS(c,i,s));o(l),t({order:l})}return(0,J.jsx)(`div`,{ref:u,className:`oc-settings-tabs`,role:`tablist`,"aria-label":d?.label(),children:(0,J.jsx)(RS,{sensors:l,collisionDetection:kS,modifiers:[dse],onDragEnd:f,children:(0,J.jsx)(WS,{items:c,strategy:LS,children:c.map(e=>(0,J.jsx)(Wse,{tab:e,active:e===n},e))})})})}function Kse(){let e=H(W.me.getMe,{host:iT}),t=rS(),n=VT(cA({select:e=>e.pathname})),r=n===void 0?void 0:V9(n),i=(0,q.useMemo)(()=>new Set(UT(e?.permissions??[])),[e?.permissions]),a=(0,q.useMemo)(()=>H9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=B9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=Bse(a,e.id);n&&t({to:KT(n)})}return(0,J.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":ne(),children:[(0,J.jsx)(Lk,{to:`/`,className:`oc-settings-nav__back`,children:Dee()}),(0,J.jsx)(`div`,{className:`oc-settings-nav__title`,children:go()}),(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 qse=`trash`,Jse=`deletedChats`;function Yse(){throw ID({to:`/settings/$tab`,params:{tab:Jse},replace:!0})}var U9=`oc.theme`;function W9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function G9(e){(0,q.useEffect)(()=>{let t=e??localStorage.getItem(U9)??`system`;if(localStorage.setItem(U9,t),W9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>W9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}function Xse(e){(0,q.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=rm()}catch{t=void 0}t!==e&&Hee(e)},[e])}var Zse=(0,q.lazy)(()=>Iw(()=>import(`./RolesTab-DpN3MOih.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]))),Qse=(0,q.lazy)(()=>Iw(()=>import(`./InstancesTab-DiW-4KlM.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([23,3,4,24,25,26,7,27,28,8,29,9,30,31,32,6,10,11,12,13,14,15,19,18,16,17,20,21,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]))),$se=(0,q.lazy)(()=>Iw(()=>import(`./PromptInjectionsTab-KMsWE-dW.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([58,3,4,24,25,26,7,27,28,8,29,9,30,31,32,6,10,13,14,51,59,60]))),ece=(0,q.lazy)(()=>Iw(()=>import(`./GroupsTab-CQrEUZSF.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([61,3,4,62,45,6,7,8,9,47,63,64,14,26,27,28,29,49,37,10,11,12,13,15,19,18,51,16,17,20,21,33,52,53,54,55,30,50,34,35,36,38,39,40,41,42,65]))),tce=(0,q.lazy)(()=>Iw(()=>import(`./IntegrationsTab-DqWlrC3M.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([66,3,4,6,7,8,9,26,27,28,29,10,11,12,15]))),nce=(0,q.lazy)(()=>Iw(()=>import(`./FeedbacksTab-YFBk45oU.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([67,3,4,10,12,50,16,17,18,11,19,14,34,27,28,35,36,29,9,37,30,6,7,8,38,39,40,41,42]))),rce=(0,q.lazy)(()=>Iw(()=>import(`./SubAgentReportsTab-BoNbdt38.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([68,3,4,10,12,50,16,17,18,11,19,14,34,27,28,35,36,29,9,37,30,6,7,8,38,39,40,41,42]))),ice=(0,q.lazy)(()=>Iw(()=>import(`./TrashTab-Dwjjxu8X.js`).then(e=>({default:e.TrashTab})),__vite__mapDeps([69,3,4,70,39,10,12,13,14,50,16,17,18,11,19,71,72,73,54,74]))),ace=(0,q.lazy)(()=>Iw(()=>import(`./DeletedChatsTab-By_xLvEC.js`).then(e=>({default:e.DeletedChatsTab})),__vite__mapDeps([75,3,4,70,10,12,16,17,18,11,19,14,72,73,54,39,50,74]))),oce=(0,q.lazy)(()=>Iw(()=>import(`./FilesTab-DL27Krkt.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([76,3,4,36,27,29,9,37,30,77,6,7,8,54,39,26,28,17,18,10,12,13,14,15,40]))),sce=(0,q.lazy)(()=>Iw(()=>import(`./ScheduledTab-BBofaJj5.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([78,3,4,62,45,79,21,80,81,54,39,26,7,27,28,8,29,9,17,18,10,30,11,12,13,14,15,19,51,42,40,52,53,55,50,41,82,35,60]))),cce=(0,q.lazy)(()=>Iw(()=>import(`./AgentFilesTab-BM2NUWub.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([83,3,4,48,26,7,27,28,8,29,9,17,18,10,12,13,14,15,19,51,84,42,32,56,60]))),lce=(0,q.lazy)(()=>Iw(()=>import(`./PreferencesTab-DarNzYdF.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([85,3,4,6,7,8,9,26,27,28,29,10,11,12,86,51,13,14,15,59,31,87,82,35,30,60]))),uce=(0,q.lazy)(()=>Iw(()=>import(`./ChatDefaultsTab-Dr-czhQm.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([88,3,4,70,21,6,7,8,9,38,48,26,27,28,29,30,10,11,12,89,54,84,56,87,60]))),dce=(0,q.lazy)(()=>Iw(()=>import(`./AccessTab-B2bpNynj.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([90,3,4,26,7,27,28,8,29,9,12,15]))),fce=(0,q.lazy)(()=>Iw(()=>import(`./ThemeShowroom-DdUZV2nA.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([91,3,4,7,36,27,29,9,37,30,77,6,8,92,14,26,28,10,11,12,15,51,59,31,93,40,55,53,50,52,54,94,38])));function pce(){let{isAuthenticated:e}=iE();return(0,q.useEffect)(()=>{e&&j9().authenticated()},[e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(uE,{children:(0,J.jsx)(`div`,{className:`oc-boot`,children:dr()})}),(0,J.jsx)(lE,{children:(0,J.jsx)(hce,{})}),(0,J.jsx)(cE,{children:(0,J.jsx)(Ew,{children:(0,J.jsx)(cse,{children:(0,J.jsx)(_ce,{})})})})]})}function mce(){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 hce(){let{signIn:e}=IE();G9(void 0),bw(void 0);let t=H(W.charts.brandForHost,{host:iT}),n=nT(iT),r=t??n??null,i=LC(void 0);RC(r?.tokens??null,i),(0,q.useEffect)(()=>{t&&rT(iT,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?k2(a,i):null,s=a?.label??`Atrium`,c=H(W.me.authProviders),[l,u]=(0,q.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(hl())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.authelia&&!c.anonymous;return(0,J.jsx)(Ese,{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:ye()}),(0,J.jsx)(`p`,{className:`oc-signin__subtitle`,children:bx()}),(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)(mce,{}),(0,J.jsx)(`span`,{children:Os()})]}):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:Pa()})}):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:Vi()})}):null]}),l?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,J.jsx)(`p`,{className:`oc-signin__error`,children:ua()}):null,c?.anonymous?(0,J.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:mee()}):null]})]})})}function gce(){let{width:e,collapsed:t,isMobile:n}=tJ();return(0,J.jsx)(`div`,{className:`oc-shell`,children:(0,J.jsxs)(`div`,{className:`oc-shell__body`,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)(y9,{})]})}):null,(0,J.jsx)(`main`,{className:`oc-main`})]})]})})}function _ce(){let e=H(W.me.getMe,{host:iT}),t=G(W.me.bootstrap),n=rS();(0,q.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),G9(e?.resolvedThemeMode),bw(e?.resolvedFontScale);let r=LC(e?.resolvedThemeMode);RC(e?.resolvedChartTokens,r),Xse(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)(gce,{});let a=e.name||e.email||F();return e.role===`pending`?(0,J.jsxs)(`div`,{className:`oc-shell`,children:[(0,J.jsx)(K9,{}),(0,J.jsx)(O9,{}),(0,J.jsx)(vce,{userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand}),(0,J.jsxs)(`div`,{className:`oc-pending`,children:[(0,J.jsx)(`h1`,{className:`oc-pending__title`,children:Kh()}),(0,J.jsx)(`p`,{className:`oc-pending__body`,children:ao()})]})]}):(0,J.jsx)(xce,{canOpenSettings:UT(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function K9(){let e=H(W.me.getImpersonation),t=G(W.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:[ht(),` `,(0,J.jsx)(`strong`,{children:e.targetLabel}),Gt(),(0,J.jsx)(`strong`,{children:e.realLabel}),Cc()]}),(0,J.jsx)(K,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Xy()})]})}function q9(e){return e?.label??`Atrium`}function J9({brand:e,resolvedThemeMode:t}){let n=LC(t),r=q9(e),i=e?.isDefault??!0,a=k2(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)(N2,{className:`oc-brand__logo`}):null,(0,J.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function vce({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r}){let i=(0,q.useRef)(null),a=N9[IT(()=>{let e=i.current;if(e===null||!(e.clientWidth>0))return null;let t=LT(e,N9.slice(0,-1).map(e=>t=>t.setAttribute(`data-fit`,e)),`oc-topbar--measure`);return{available:e.clientWidth,required:t}},()=>[i.current],[])];return(0,J.jsxs)(`header`,{ref:i,className:`oc-topbar`,"data-fit":a,children:[(0,J.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,J.jsx)(J9,{brand:r,resolvedThemeMode:n})}),(0,J.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,J.jsx)(M9,{label:e,mode:t,minimal:!0})})]})}function yce({brand:e,resolvedThemeMode:t}){let n=(0,q.useRef)(null),r=P9[IT(()=>{let e=n.current;if(e===null||!(e.clientWidth>0))return null;let t=LT(e,P9.slice(0,-1).map(e=>t=>t.setAttribute(`data-fit`,e)),`oc-drawer__head--measure`);return{available:e.clientWidth,required:t}},()=>[n.current],[])];return(0,J.jsxs)(`div`,{ref:n,className:`oc-drawer__head`,"data-fit":r,children:[(0,J.jsx)(lT,{className:`sr-only`,children:Yb()}),(0,J.jsx)(Lk,{to:`/`,className:`oc-topbar__brand`,"aria-label":q9(e),children:(0,J.jsx)(J9,{brand:e,resolvedThemeMode:t})}),(0,J.jsx)(pT,{asChild:!0,children:(0,J.jsx)(K,{variant:`ghost`,size:`icon`,"aria-label":Qe(),children:(0,J.jsx)(zC,{})})})]})}function bce({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,sidebarOpen:i,onToggleSidebar:a,toggleRef:o,rail:s}){let c=(0,q.useRef)(null),l=N9[IT(()=>{let e=c.current;if(s||e===null||!(e.clientWidth>0))return null;let t=LT(e,N9.slice(0,-1).map(e=>t=>t.setAttribute(`data-fit`,e)),`oc-topbar--measure`);return{available:e.clientWidth,required:t}},()=>[c.current],[s])];return(0,J.jsxs)(`header`,{ref:c,className:s?`oc-topbar oc-topbar--rail`:`oc-topbar`,"data-fit":s?void 0:l,children:[(0,J.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,J.jsx)(K,{ref:o,variant:`ghost`,size:`icon-sm`,"aria-label":i?$s():He(),onClick:a,children:i?(0,J.jsx)(ES,{}):(0,J.jsx)(sj,{})}),(0,J.jsx)(Lk,{to:`/`,className:`oc-topbar__brand`,"aria-label":q9(r),children:(0,J.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,J.jsx)(`div`,{className:`oc-topbar__search`,children:(0,J.jsx)(Rse,{})}),(0,J.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,J.jsx)(Fse,{}),(0,J.jsx)(M9,{label:e,mode:t,compact:s})]})]})}function xce({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:s,collapsed:c,startResize:l,isMobile:u,drawerOpen:d,setDrawerOpen:f,toggleSidebar:p,closeDrawer:m}=tJ(),h=Zq(),g=(0,q.useRef)(null),_=nA(),v=gS({strict:!1}),y=rS(),b=!!_({to:`/settings`,fuzzy:!0});(0,q.useEffect)(()=>{m()},[cA({select:e=>e.pathname}),m]);let x=(0,q.useCallback)(e=>{y({to:`/chat/$chatId`,params:{chatId:e}})},[y]),{startNewChat:S,picker:C}=Mte(x),w=(0,q.useMemo)(()=>_w(xw,gw()),[]);(0,q.useEffect)(()=>{let e=e=>{yw(e,xw)&&(e.preventDefault(),S())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S]);let T=b?(0,J.jsx)(Kse,{}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(_se,{activeChatId:v.chatId??null,onSelect:x,onNewChat:()=>void S(),newChatShortcut:w}),(0,J.jsx)(K,{variant:`ghost`,className:`oc-sidebar__shortcut mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,J.jsx)(_A,{"aria-hidden":!0}),$ee()]})}),(0,J.jsx)(K,{variant:`ghost`,className:`oc-sidebar__shortcut mx-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,J.jsx)(KA,{"aria-hidden":!0}),Hg()]})}),e?(0,J.jsx)(K,{variant:`ghost`,className:`oc-sidebar__shortcut mx-2 mb-2 justify-start`,asChild:!0,children:(0,J.jsxs)(Lk,{to:`/settings`,children:[(0,J.jsx)(hj,{"aria-hidden":!0}),wb()]})}):null]});return(0,J.jsxs)(`div`,{className:h?`oc-shell oc-shell--short`:`oc-shell`,children:[C,(0,J.jsx)(Cse,{activeChatId:v.chatId??null}),(0,J.jsx)(K9,{}),(0,J.jsx)(O9,{}),(0,J.jsxs)(`div`,{className:`oc-shell__body`,children:[(0,J.jsx)(bce,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,sidebarOpen:u?d:!c,onToggleSidebar:p,toggleRef:g,rail:h}),(0,J.jsxs)(`div`,{className:u?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[u?(0,J.jsx)(dT,{open:d,onOpenChange:f,children:(0,J.jsxs)(uT,{side:`left`,className:h?`oc-drawer oc-drawer--short`:`oc-drawer`,overlayClassName:`oc-drawer-overlay`,showCloseButton:!1,"aria-describedby":void 0,returnFocus:()=>[g.current],children:[(0,J.jsx)(yce,{brand:a,resolvedThemeMode:i}),(0,J.jsx)(`div`,{className:`oc-sidebar-col oc-sidebar-col--drawer`,children:T})]})}):c?null:(0,J.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{s.current=e},style:{width:o,flex:`0 0 ${o}px`},children:[T,(0,J.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:l,role:`separator`,"aria-orientation":`vertical`,"aria-label":gf()})]}),(0,J.jsx)(`main`,{className:`oc-main`,children:(0,J.jsx)(Qk,{})}),(0,J.jsx)(j1,{viewerUserId:t,currentChatId:v.chatId??null})]})]}),(0,J.jsx)(rq,{})]})}function Sce(){let e=H(W.me.getMe,{host:iT}),t=rS(),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:dr()});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)(Gse,{}),(0,J.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,J.jsx)(Cce,{}):(0,J.jsx)(Qk,{})})]})}function Cce(){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)(FC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:Sy()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:_d()})]})}function wce(){let e=H(W.me.getMe,{host:iT}),t=rS();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:dr()})}function Tce(e){switch(e){case`groups`:return(0,J.jsx)(ece,{});case`integrations`:return(0,J.jsx)(tce,{});case`instances`:return(0,J.jsx)(Qse,{});case`injections`:return(0,J.jsx)($se,{});case`theme`:return(0,J.jsx)(fce,{});case`feedbacks`:return(0,J.jsx)(nce,{});case`subagentReports`:return(0,J.jsx)(rce,{});case`files`:return(0,J.jsx)(oce,{});case`scheduled`:return(0,J.jsx)(sce,{});case`agentFiles`:return(0,J.jsx)(cce,{});case`preferences`:return(0,J.jsx)(lce,{});case`chatDefaults`:return(0,J.jsx)(uce,{});case`access`:return(0,J.jsx)(dce,{});case`trash`:return(0,J.jsx)(ice,{});case`deletedChats`:return(0,J.jsx)(ace,{});default:return(0,J.jsx)(Zse,{})}}function Ece(){let{tab:e}=gS({from:`/settings/$tab`});return(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:Tce(e)})}function Dce(){let{chatId:e}=gS({from:`/chat/$chatId`}),{m:t}=Qx({from:`/chat/$chatId`});return(0,q.useEffect)(()=>{N1(e)},[e]),(0,J.jsx)(P7,{chatId:e,focusMessageId:t??null})}function Oce(){let e=rS(),t=P1(),n=H(W.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:dr()}):(0,J.jsx)(P7,{chatId:null})}var Y9=Hk({component:pce}),kce=Bk({getParentRoute:()=>Y9,path:`/`,component:Oce}),Ace=Bk({getParentRoute:()=>Y9,path:`chat/$chatId`,component:Dce,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),jce=Bk({getParentRoute:()=>Y9,path:`project/$projectId`,component:Uk(()=>Iw(()=>import(`./ProjectPage-BbYuFPDW.js`),__vite__mapDeps([95,3,4,44,96,7,47,64,11,12,15,19,14,18,10,97,27,45,36,29,9,37,30,98,79,81,39,13,16,17,20,21,42,72,99])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),Mce=Bk({getParentRoute:()=>Y9,path:qse,beforeLoad:Yse}),X9=Bk({getParentRoute:()=>Y9,path:`settings`,component:Sce}),Nce=Bk({getParentRoute:()=>X9,path:`/`,component:wce}),Pce=Bk({getParentRoute:()=>X9,path:`traces`,validateSearch:Yw,component:Uk(()=>Iw(()=>import(`./TracesTab-Dg_eyLYF.js`),__vite__mapDeps([100,3,4,44,7,101,98,102,14,26,27,28,8,29,9,49,37,10,12,15,50,19,18,103,51,55,53,30,11,52,54,94,38,34,35,36,6,39,40,41,42])),`TracesTab`)}),Fce=Bk({getParentRoute:()=>X9,path:`bridge`,validateSearch:qw,component:Uk(()=>Iw(()=>import(`./BridgeTab-Cv2Co6h7.js`),__vite__mapDeps([43,3,4,24,25,26,7,27,28,8,29,9,30,31,32,44,45,35,46,21,6,47,48,49,37,10,11,12,13,14,15,50,19,18,51,40,52,53,54,55,56,57])),`BridgeTab`)}),Ice=Bk({getParentRoute:()=>X9,path:`voice`,validateSearch:$w,component:Uk(()=>Iw(()=>import(`./VoiceTab-BFVfbSld.js`),__vite__mapDeps([104,3,4,44,105,6,7,8,9,26,27,28,29,49,37,10,12,15,51,60])),`VoiceTab`)}),Lce=Bk({getParentRoute:()=>X9,path:`audit`,validateSearch:Zw,component:Uk(()=>Iw(()=>import(`./AuditTab-CqpDXgVz.js`),__vite__mapDeps([106,3,4,44,26,7,27,28,8,29,9,12,50,103,55,53,30,10,11,52,54,94,38,14,34,35,36,37,6,39,40,41,42])),`AuditTab`)}),Rce=Bk({getParentRoute:()=>X9,path:`anomalies`,validateSearch:tT,component:Uk(()=>Iw(()=>import(`./AnomaliesTab-BWiKxnXQ.js`),__vite__mapDeps([107,3,4,44,26,7,27,28,8,29,9,12,13,14,15,50,19,18,10,103,51,16,17,11,55,53,30,52,54,34,35,36,37,6,38,39,40,41,42,57])),`AnomaliesTab`)}),zce=Bk({getParentRoute:()=>X9,path:`kpi`,validateSearch:Qw,component:Uk(()=>Iw(()=>import(`./KpiTab-BXC9YG9_.js`),__vite__mapDeps([108,3,4,44,12,103,51,93,55,53,30,29,9,10,11,50])),`KpiTab`)}),Bce=Bk({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:Jw,component:Uk(()=>Iw(()=>import(`./ServiceAccountsTab-CSIwvppo.js`),__vite__mapDeps([109,3,4,44,7,27,45,101,26,28,8,29,9,10,11,12,13,14,15,50,19,18,16,17,20,21,52,53,54,55,30,34,35,36,37,6,38,39,40,41,42,22])),`ServiceAccountsTab`)}),Vce=Bk({getParentRoute:()=>X9,path:`users`,validateSearch:eT,component:Uk(()=>Iw(()=>import(`./UsersTab-eQY9UCh5.js`),__vite__mapDeps([110,3,4,44,36,27,29,9,37,30,6,7,8,47,64,26,28,10,12,13,14,15,19,18,51,16,17,11,33,111,52,53,54,55,50,34,35,38,39,40,41,42,65])),`UsersTab`)}),Hce=Bk({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw ID({to:`/settings/$tab`,params:{tab:GT.uiprefs},replace:!0})}}),Uce=Bk({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:Xw([...WT]).catch(`roles`).parse(e.tab)}),component:Ece});function Wce({error:e,reset:t}){let n=rS(),r=F1(e),[i]=(0,q.useState)(()=>r&&z1(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:Dm()})}):(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)(FC,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:Zm()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Ag()}),(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:Vee()}),(0,J.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:nm()})]})]})}function Gce(){let e=rS();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)(CA,{size:28})}),(0,J.jsx)(`h2`,{className:`oc-route-error__title`,children:lp()}),(0,J.jsx)(`p`,{className:`oc-route-error__body`,children:Qv()}),(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:nm()})})]})}var Z9=iA({routeTree:Y9.addChildren([kce,Ace,jce,Mce,X9.addChildren([Nce,Pce,Ice,Fce,Lce,Rce,zce,Bce,Vce,Hce,Uce])]),defaultPreload:`intent`,defaultErrorComponent:Wce,defaultNotFoundComponent:Gce}),Kce=()=>null;function Q9({children:e}){return(0,J.jsx)(`div`,{style:{display:`flex`,minHeight:`100dvh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}Ij(),bte();var $9=dE.createRoot(document.getElementById(`root`));$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(Q9,{children:cg()})})),U1().then(e=>{m0(document,f0(d0(q1(),window.location.origin,[G1(),K1()])));let t=new km(e);$9.render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(LE,{client:t,children:(0,J.jsxs)(sT,{children:[(0,J.jsx)(Kie,{children:(0,J.jsx)(sA,{router:Z9})}),(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(Kce,{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:[ba(),` `,e instanceof Error?e.message:String(e)]})}))});