@lacneu/atrium 0.102.1 → 0.103.0

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 (144) hide show
  1. package/dist/assets/AccessTab-gaTBs3lV.js +1 -0
  2. package/dist/assets/{AdminSettings-B8n1yLsD.js → AdminSettings-CMjix9zl.js} +1 -1
  3. package/dist/assets/{AdvancedFilter-Bb66m5kb.js → AdvancedFilter-5BMuHHt6.js} +1 -1
  4. package/dist/assets/AgentFilesTab-D3tMMo2R.js +3 -0
  5. package/dist/assets/AnomaliesTab-CdFgsRwT.js +1 -0
  6. package/dist/assets/AuditTab-Yw1LvjgD.js +1 -0
  7. package/dist/assets/BridgeTab-CBE4zTQ1.js +1 -0
  8. package/dist/assets/ChatDefaultsTab-CIX9WUCl.js +1 -0
  9. package/dist/assets/{ConfirmDialog-BXcki0Ee.js → ConfirmDialog-Dy8WCeAF.js} +1 -1
  10. package/dist/assets/{DataTableShell-DRFFBx_j.js → DataTableShell-2_QPZexc.js} +1 -1
  11. package/dist/assets/DeletedChatsTab-Fzk38aqT.js +1 -0
  12. package/dist/assets/{DetailChips-Cv1sxdhU.js → DetailChips-DaliQU_Q.js} +1 -1
  13. package/dist/assets/{EntitySheet-B2B48bss.js → EntitySheet-D-JZB54h.js} +1 -1
  14. package/dist/assets/FeedbacksTab-DWmslsAt.js +1 -0
  15. package/dist/assets/{FieldLabel-Tea3wyVe.js → FieldLabel-D63ry-fi.js} +1 -1
  16. package/dist/assets/FilesTab-DzHfzOnQ.js +1 -0
  17. package/dist/assets/{FilterBar-DTVwlDpF.js → FilterBar-Bynn2H7k.js} +1 -1
  18. package/dist/assets/GroupsTab-hxsjfQDc.js +1 -0
  19. package/dist/assets/InstancesTab-DsJ_BBfc.js +1 -0
  20. package/dist/assets/IntegrationsTab-Cf3lTCzz.js +1 -0
  21. package/dist/assets/KnobRow-3my9jz_H.js +1 -0
  22. package/dist/assets/KpiTab-C6dn6jVl.js +1 -0
  23. package/dist/assets/PreferencesTab-DiDi7mpY.js +1 -0
  24. package/dist/assets/ProjectPage-DDto6xkD.js +1 -0
  25. package/dist/assets/PromptInjectionsTab-D3drsS9C.js +4 -0
  26. package/dist/assets/RolesTab-DDYieLTF.js +1 -0
  27. package/dist/assets/ScheduledTab-D-yTTYHC.js +1 -0
  28. package/dist/assets/ServiceAccountsTab-fJYmH0eU.js +1 -0
  29. package/dist/assets/SubAgentReportsTab-GXHpWbrW.js +1 -0
  30. package/dist/assets/ThemeShowroom-uU3PL_6V.js +1 -0
  31. package/dist/assets/{TimeRangePicker-D3PJq1H8.js → TimeRangePicker-DzJYDik_.js} +1 -1
  32. package/dist/assets/{TimezoneCombobox-CPTpWNQm.js → TimezoneCombobox-BY91kPSf.js} +1 -1
  33. package/dist/assets/TracesTab-C7zX1NUU.js +1 -0
  34. package/dist/assets/TrashTab-BVZJggvr.js +1 -0
  35. package/dist/assets/UsersTab-HdsTBYR0.js +1 -0
  36. package/dist/assets/VoiceTab-CnZ-twTR.js +1 -0
  37. package/dist/assets/{alert-dialog-BoEv1f8g.js → alert-dialog-DRrmbZYC.js} +1 -1
  38. package/dist/assets/{api-DSJJn0d7.js → api-CUskDNHD.js} +5 -5
  39. package/dist/assets/{badge-C4po8DQ1.js → badge-TiMZiv59.js} +1 -1
  40. package/dist/assets/{button-Dio0PVrp.js → button-CbHyzXCb.js} +1 -1
  41. package/dist/assets/capabilities-CASxhKEd.js +1 -0
  42. package/dist/assets/{card-CerX9wDn.js → card-vUc-7TYj.js} +1 -1
  43. package/dist/assets/check-Da8rPJKX.js +1 -0
  44. package/dist/assets/{checkbox-CsI4ggnp.js → checkbox-Czxm5pNj.js} +1 -1
  45. package/dist/assets/chevron-left-DxPC6E1S.js +1 -0
  46. package/dist/assets/chevron-right-BjOti-z8.js +1 -0
  47. package/dist/assets/chevron-up-DfOJb3vW.js +1 -0
  48. package/dist/assets/chevrons-up-down-Bp7zuoEk.js +1 -0
  49. package/dist/assets/{compatView--1YlftIc.js → compatView-Dj1HQXxr.js} +1 -1
  50. package/dist/assets/confTabs-BzReq467.css +1 -0
  51. package/dist/assets/convexApi-BPSJUy2j.js +1 -0
  52. package/dist/assets/{copy-BaUCUMp2.js → copy-C1_4Ewod.js} +1 -1
  53. package/dist/assets/{cronDescribe-CAuRX7uW.js → cronDescribe-BC0AcJer.js} +1 -1
  54. package/dist/assets/{deliveryRecorder-C7NQZrrH.js → deliveryRecorder-CGhwQ1sg.js} +1 -1
  55. package/dist/assets/{dialog-BfrsWZiD.js → dialog-DpoEg_Ex.js} +1 -1
  56. package/dist/assets/dispatchErrorInfo-BOJ5cTZo.js +1 -0
  57. package/dist/assets/{dist-ClkJChBn.js → dist-BmXC8pZv.js} +1 -1
  58. package/dist/assets/{dist-D7doQlva.js → dist-BqsRl4o3.js} +1 -1
  59. package/dist/assets/{dist-D-RIDSJc.js → dist-CHsekWGV.js} +1 -1
  60. package/dist/assets/{dist-Cw3aN_jM.js → dist-Cv-LvOB4.js} +1 -1
  61. package/dist/assets/{dist-CkbybbG7.js → dist-DQawXTf-.js} +1 -1
  62. package/dist/assets/{dist-ChrIV8UV.js → dist-HZSdA3kh.js} +1 -1
  63. package/dist/assets/{download-DWgC7zCa.js → download-Do4pcXOL.js} +1 -1
  64. package/dist/assets/{dropdown-menu-DHMOOlaP.js → dropdown-menu-BWxfj48Z.js} +1 -1
  65. package/dist/assets/{eye-B-ipuYEd.js → eye-yUMVb9gl.js} +1 -1
  66. package/dist/assets/{format-DGKgJf2p.js → format-zM-c-1S6.js} +1 -1
  67. package/dist/assets/{groupManageView-BMBqgRhV.js → groupManageView-DY6vPM1h.js} +1 -1
  68. package/dist/assets/index-B7hQ_j0i.js +158 -0
  69. package/dist/assets/index-D8Eob_Mc.css +1 -0
  70. package/dist/assets/{input-BSpTsBA6.js → input-DCbMcJYs.js} +1 -1
  71. package/dist/assets/{list-eSch39T9.js → list-DIWFv1eJ.js} +1 -1
  72. package/dist/assets/loader-circle-BO0Lx5va.js +1 -0
  73. package/dist/assets/{lock-0lxfSnTE.js → lock-X9ZGk2P9.js} +1 -1
  74. package/dist/assets/{pencil-aUWxuLhy.js → pencil-1kZxxbnV.js} +1 -1
  75. package/dist/assets/plus-CSOLqt7C.js +1 -0
  76. package/dist/assets/{popover-DBaIbsBr.js → popover-DiT_Oo6e.js} +1 -1
  77. package/dist/assets/roleDescriptions-CmJBKAaf.js +1 -0
  78. package/dist/assets/rotate-ccw-C-v_7YX7.js +1 -0
  79. package/dist/assets/{search-BK6bzZNi.js → search-D9Un2NMX.js} +1 -1
  80. package/dist/assets/{select-qM3ZfTHx.js → select-DCBGpD8v.js} +1 -1
  81. package/dist/assets/{server-DLnWqkX-.js → server-BSDuYUUF.js} +1 -1
  82. package/dist/assets/{speech-CrNma2Ue.js → speech-CfxX6OY3.js} +1 -1
  83. package/dist/assets/{star-CM6J2w_J.js → star-DjK6DoNA.js} +1 -1
  84. package/dist/assets/switch-Dt_I92ZY.js +1 -0
  85. package/dist/assets/{table-D2SJC960.js → table-GXZ7yFCE.js} +1 -1
  86. package/dist/assets/{tabs-mZfLmn2f.js → tabs-dQ50HGoj.js} +1 -1
  87. package/dist/assets/{toast-xNFwDnUy.js → toast-C8rSAMgh.js} +1 -1
  88. package/dist/assets/{tooltip-v_AyOWn6.js → tooltip-D3qNpGhD.js} +1 -1
  89. package/dist/assets/{trash-2-B4WSfc7G.js → trash-2-8oRd823U.js} +1 -1
  90. package/dist/assets/trashPage-CoBMe_r-.js +1 -0
  91. package/dist/assets/{trashView-Ct0Xw-a9.js → trashView-CIgTWQjI.js} +1 -1
  92. package/dist/assets/{triangle-alert-BkDa-x8g.js → triangle-alert-DQoWKyu_.js} +1 -1
  93. package/dist/assets/{usageView-C9Y6E0Zu.js → usageView-B0Wg081i.js} +1 -1
  94. package/dist/assets/{useChart-CKFEN42T.js → useChart-xKc_wRHf.js} +1 -1
  95. package/dist/assets/{useFontScale-ByBFat3y.js → useFontScale-C03nea0B.js} +1 -1
  96. package/dist/assets/{useStartNewChat-BszDHUjD.js → useStartNewChat-B66bn5hT.js} +2 -2
  97. package/dist/assets/{use_paginated_query-CQj09xXv.js → use_paginated_query-BatXdmTn.js} +1 -1
  98. package/dist/assets/{users-BJqaWlH1.js → users-DHMAZ7v8.js} +1 -1
  99. package/dist/assets/x-6-84PEVq.js +1 -0
  100. package/dist/index.html +56 -56
  101. package/package.json +1 -1
  102. package/dist/assets/AccessTab-JmFp20Kp.js +0 -1
  103. package/dist/assets/AgentFilesTab-C3CUT4Ep.js +0 -3
  104. package/dist/assets/AnomaliesTab-CpiY8ZTC.js +0 -1
  105. package/dist/assets/AuditTab-D5YrLbTy.js +0 -1
  106. package/dist/assets/BridgeTab-D4RFq-Rb.js +0 -1
  107. package/dist/assets/ChatDefaultsTab-D0d9yEow.js +0 -1
  108. package/dist/assets/DeletedChatsTab-COYSFkNf.js +0 -1
  109. package/dist/assets/FeedbacksTab-6URuFdfg.js +0 -1
  110. package/dist/assets/FilesTab-esMtHJXt.js +0 -1
  111. package/dist/assets/GroupsTab-Io16XZHz.js +0 -1
  112. package/dist/assets/InstancesTab-BevtM68H.js +0 -1
  113. package/dist/assets/IntegrationsTab-DMY6VTUC.js +0 -1
  114. package/dist/assets/KnobRow-BsOT2O6U.js +0 -1
  115. package/dist/assets/KpiTab-DCfAwBfJ.js +0 -1
  116. package/dist/assets/PreferencesTab-DJ9p401L.js +0 -1
  117. package/dist/assets/ProjectPage-BxEF71jN.js +0 -1
  118. package/dist/assets/PromptInjectionsTab-Vdb1lF36.js +0 -4
  119. package/dist/assets/RolesTab-DU0g4d-R.js +0 -1
  120. package/dist/assets/ScheduledTab-B6gWc0HN.js +0 -1
  121. package/dist/assets/ServiceAccountsTab-Dmb_LH0V.js +0 -1
  122. package/dist/assets/SubAgentReportsTab-D9rclslo.js +0 -1
  123. package/dist/assets/ThemeShowroom-N4qzUtlq.js +0 -1
  124. package/dist/assets/TracesTab-DMdT_psj.js +0 -1
  125. package/dist/assets/TrashTab-BMSJ7ANC.js +0 -1
  126. package/dist/assets/UsersTab-BQaLsUCK.js +0 -1
  127. package/dist/assets/VoiceTab-BSh-05Ze.js +0 -1
  128. package/dist/assets/capabilities-BTqhMVxR.js +0 -1
  129. package/dist/assets/check-DmQzfrws.js +0 -1
  130. package/dist/assets/chevron-left-DQ9FCoo_.js +0 -1
  131. package/dist/assets/chevron-right-C_b_y922.js +0 -1
  132. package/dist/assets/chevron-up-Dsqj2Oaj.js +0 -1
  133. package/dist/assets/chevrons-up-down-Pva00Np5.js +0 -1
  134. package/dist/assets/confTabs-CCBW5ofF.css +0 -1
  135. package/dist/assets/convexApi-CyScjgcq.js +0 -1
  136. package/dist/assets/dispatchErrorInfo-Bb7JyJFO.js +0 -1
  137. package/dist/assets/index-CQk5TM8W.js +0 -158
  138. package/dist/assets/index-D6RuTaB7.css +0 -1
  139. package/dist/assets/loader-circle-BNhIFGdg.js +0 -1
  140. package/dist/assets/plus-Djbdyc2E.js +0 -1
  141. package/dist/assets/roleDescriptions-x3mUxTcX.js +0 -1
  142. package/dist/assets/rotate-ccw-BD-9XzMC.js +0 -1
  143. package/dist/assets/trashPage-WtAhGCt7.js +0 -1
  144. package/dist/assets/x-CK8d5DC1.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,CS as i,DS as a,ES as o,FZ as s,OS as c,SS as l,TS as u,TZ as d,_S as f,bS as p,jS as m,kS as h,t as g,vS as _,wS as v,xS as y,yS as b}from"./api-CUskDNHD.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-DCBGpD8v.js";import"./convexApi-BPSJUy2j.js";import{t as E}from"./badge-TiMZiv59.js";var D=t(e(),1);function O(e){return e===`user`?y():e===`all`?p():b({group:e.group})}function k(e){return e===`common`?_():e===`owner`?f():b({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=s(g.admin.listUsers,{}),[t,n]=(0,D.useState)(``),f=s(g.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":r(),children:(0,A.jsx)(x,{placeholder:r()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(w,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):f===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:f.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:f.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),f.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:f.groups.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),f.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:f.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(E,{variant:`default`,children:l()}):null,(0,A.jsx)(E,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(E,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:u()}),f.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:f.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(E,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),f.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:f.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{$x as e,Ch as t,FE as n,Jx as r,NX as i,PE as a,Qx as o,TY as s,V_ as c,Xx as l,Yk as u,Yx as d,Zx as f,aS as p,cX as m,eS as h,fu as g,iS as _,nS as v,pq as y,qx as b,rS as x,tS as S,vv as C}from"./api-DSJJn0d7.js";var w=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`,`deletedChats`],T=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`,`deletedChats`],E={users:()=>p(),groups:()=>r(),instances:()=>_(),bridge:()=>x(),injections:()=>u(),serviceAccounts:()=>v(),roles:()=>S(),access:()=>b(),traces:()=>h(),kpi:()=>e(),anomalies:()=>o(),files:()=>m(),scheduled:()=>s(),agentFiles:()=>C(),preferences:()=>i(),integrations:()=>f(),theme:()=>y(),chatDefaults:()=>c(),audit:()=>l(),feedbacks:()=>d(),subagentReports:()=>t(),voice:()=>g(),trash:()=>n(),deletedChats:()=>a()},D={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`,deletedChats:`chats.read`},O=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k(e){let t=new Set(e);return w.filter(e=>t.has(D[e]))}function A(e){return`/settings/${e}`}function j(e){let t=e.split(`/`)[2];return w.includes(t)?t:void 0}var M={uiprefs:`preferences`};export{E as a,j as c,w as i,k as l,T as n,D as o,M as r,A as s,O as t};
1
+ import{BS as e,Ev as t,FS as n,HS as r,IS as i,LS as a,MS as o,NS as s,PA as c,PS as l,Qq as u,RS as d,US as f,VS as p,WS as m,Zu as h,bD as g,cg as _,qX as v,ry as y,uX as b,vZ as x,yD as S,zS as C}from"./api-CUskDNHD.js";var w=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`,`deletedChats`],T=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`,`deletedChats`],E={users:()=>m(),groups:()=>s(),instances:()=>f(),bridge:()=>r(),injections:()=>c(),serviceAccounts:()=>p(),roles:()=>e(),access:()=>o(),traces:()=>C(),kpi:()=>d(),anomalies:()=>a(),files:()=>v(),scheduled:()=>b(),agentFiles:()=>y(),preferences:()=>x(),integrations:()=>i(),theme:()=>u(),chatDefaults:()=>t(),audit:()=>n(),feedbacks:()=>l(),subagentReports:()=>_(),voice:()=>h(),trash:()=>g(),deletedChats:()=>S()},D={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`,deletedChats:`chats.read`},O=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k(e){let t=new Set(e);return w.filter(e=>t.has(D[e]))}function A(e){return`/settings/${e}`}function j(e){let t=e.split(`/`)[2];return w.includes(t)?t:void 0}var M={uiprefs:`preferences`};export{E as a,j as c,w as i,k as l,T as n,D as o,M as r,A as s,O as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_w as r,dw as i,fw as a,gw as o,hw as s,mw as c,pw as l}from"./api-DSJJn0d7.js";import{r as u}from"./dist-ClkJChBn.js";import{t as d}from"./plus-Djbdyc2E.js";import{t as f}from"./x-CK8d5DC1.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-qM3ZfTHx.js";import{t as v}from"./button-Dio0PVrp.js";import{t as y}from"./input-BSpTsBA6.js";import{r as b}from"./TimeRangePicker-D3PJq1H8.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),o(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:c()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:l()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":a(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(v,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(d,{}),i()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Qw as i,Xw as a,Zw as o,eT as s,nT as c,tT as l}from"./api-CUskDNHD.js";import{r as u}from"./dist-BmXC8pZv.js";import{t as d}from"./plus-CSOLqt7C.js";import{t as f}from"./x-6-84PEVq.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-DCBGpD8v.js";import{t as v}from"./button-CbHyzXCb.js";import{t as y}from"./input-DCbMcJYs.js";import{r as b}from"./TimeRangePicker-DzJYDik_.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:c()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let c=(0,x.useRef)(t),w=!!(c.current&&c.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(c.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),l(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:r()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:i()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(v,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(d,{}),a()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ap as i,Av as a,Bv as o,By as s,Cp as c,DZ as l,Dp as u,Dv as d,Ep as f,FZ as p,Fv as m,Gf as h,Gv as g,Hf as _,Hv as v,Hy as y,IH as b,Iv as x,Jf as S,Jv as C,Kf as w,Kv as ee,Lv as te,MZ as T,Mv as E,Nv as D,Op as O,Ov as k,PZ as A,Pv as j,Qv as M,Rv as N,Sp as P,TZ as F,Tp as I,Uf as L,Uv as R,Vv as z,Wf as B,Wv as V,Xv as ne,Yv as re,Zv as H,_p as U,bp as W,dp as G,ey as ie,fp as K,gp as q,hp as ae,jv as oe,kp as se,kv as ce,mc as le,mp as ue,ny as de,pp as fe,qf as pe,qv as me,t as J,ty as he,up as ge,vp as _e,wp as ve,xp as ye,yp as be,zv as xe}from"./api-CUskDNHD.js";import{t as Se}from"./triangle-alert-DQoWKyu_.js";import{a as Ce,i as we,n as Te,r as Ee,t as De}from"./select-DCBGpD8v.js";import{a as Oe,c as ke,i as Ae,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./alert-dialog-DRrmbZYC.js";import{t as Y}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{r as Ie}from"./toast-C8rSAMgh.js";import{t as Le}from"./badge-TiMZiv59.js";import{a as Re,n as ze,o as Be,r as Ve,t as He}from"./dialog-DpoEg_Ex.js";import{t as Ue}from"./appHost-CH3EGcJw.js";import{n as We}from"./capabilities-CASxhKEd.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-Dj1HQXxr.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
2
+ `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
+ `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=p(J.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=p(J.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let c=p(J.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=p(J.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,d]),[h,_]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!h||!m.some(e=>$(e)===h))&&_($(m[0]))},[m,h]);let v=m?.find(e=>$(e)===h)??null,y=T(J.agentFiles.listAgentFiles),[b,x]=(0,X.useState)({status:`idle`}),S=v?.instanceName??null,w=v?.agentId??null,te=p(J.compat.forInstance,n&&S!==null?{instanceName:S}:`skip`),E=n&&S!==null?We(te,`agentFiles`):null,D=E===null?!1:E===`loading`?null:E.blocked,O=(0,X.useCallback)(async()=>{if(!(S===null||w===null)){x({status:`loading`});try{let e=await y({instanceName:S,agentId:w});x({status:`done`,files:e.files})}catch(e){x({status:`error`,dashboardAbsent:tt(e)})}}},[y,S,w]);(0,X.useEffect)(()=>{D===!1&&O()},[O,D]);let[k,A]=(0,X.useState)(null),j=p(J.agentFileCuration.listCurations,t&&S!==null&&w!==null?{instanceName:S,agentId:w}:`skip`),N=p(J.agentFileCuration.curationSettings,t&&S!==null?{instanceName:S}:`skip`),P=T(J.agentFileCuration.requestCuration),[L,R]=(0,X.useState)(null),[z,B]=(0,X.useState)(null),{toast:U}=Ie(),W=(0,X.useMemo)(()=>{let e=new Map;for(let t of j??[])e.has(t.name)||e.set(t.name,t);return e},[j]),G=(0,X.useCallback)(async e=>{if(!(S===null||w===null)){R(e);try{let t=await P({instanceName:S,agentId:w,name:e,trigger:`manual`});t.ok?U({title:u(),variant:`success`}):U({title:f({reason:t.reason??`unknown`}),variant:`error`})}catch{U({title:I(),variant:`error`})}finally{R(null)}}},[P,S,w,U]),K=l(),q=(0,X.useMemo)(()=>new Intl.NumberFormat(K,{maximumFractionDigits:0}),[K]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(De,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":he(),children:(0,Q.jsx)(Ce,{})}),(0,Q.jsx)(Te,{children:(i??[]).map(e=>(0,Q.jsx)(Ee,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(De,{value:h??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":ie(),children:(0,Q.jsx)(Ce,{})}),(0,Q.jsx)(Te,{children:m.map(e=>(0,Q.jsx)(Ee,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()})]}),v===null?null:E===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):E!==null&&E.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Se,{size:14,"aria-hidden":!0}),` `,qe(E.gatewayVersion,E.provider)]}):b.status===`loading`||b.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):b.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[b.dashboardAbsent?le():H(),` `,!b.dashboardAbsent&&(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:s()})]}):b.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:b.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Le,{variant:`outline`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:re({size:Z(e.size,K)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:C({pct:q.format(n)})}),r?(0,Q.jsx)(Se,{size:14,className:`oc-afiles__warn`,"aria-label":me()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>A(e),children:t?g():V()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:N?.budgetChars??null,enabled:N?.enabled??!1,curation:W.get(e.name)??null,inFlight:L===e.name,onCurate:()=>void G(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ee({used:Z(Qe(b.files),K),total:Z(Ye,K),pct:q.format(Ze(Qe(b.files)))})})]}),k&&v?(0,Q.jsx)(at,{instanceName:v.instanceName,agentId:v.agentId,name:k.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void O()}):null,z?(0,Q.jsx)(ot,{curationId:z,onClose:()=>B(null),onApplied:()=>{B(null),O()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(Y,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:se()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Le,{variant:`outline`,className:`oc-afiles__curate-status`,children:O()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:i()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:c}){let u=T(J.agentFiles.getAgentFile),f=T(J.agentFiles.setAgentFile),p=Ie(),[h,g]=(0,X.useState)(null),[_,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(``),[ee,O]=(0,X.useState)(!1),[A,M]=(0,X.useState)(!1),[P,I]=(0,X.useState)(!1),[L,B]=(0,X.useState)(!1),V=(0,X.useCallback)(async r=>{S(!1);try{let i=await u({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||w(i.content),I(!1)}catch{S(!0)}},[u,e,t,n]);(0,X.useEffect)(()=>{V(!1)},[V]);async function ne(){if(h!==null){M(!0),B(!1);try{await f({instanceName:e,agentId:t,name:n,content:C,baseUpdatedAtMs:h.updatedAtMs??void 0}),p.success(te({name:n})),c(),await V(!1)}catch(e){nt(e)?I(!0):B(!0)}finally{M(!1)}}}let re=h!==null&&C!==h.content,H=(0,X.useMemo)(()=>h===null?null:et(h.content,C),[h,C]),U=C.length>Je,W=l(),G=(0,X.useMemo)(()=>new Intl.NumberFormat(W),[W]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(ze,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Be,{children:R({name:n})}),(0,Q.jsxs)(Ve,{children:[v({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,z()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[m(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void V(!1),children:s()})]}):h===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:C,readOnly:!r,spellCheck:!1,onChange:e=>w(e.target.value),"aria-label":R({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:o()}),P?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void V(!0),children:D()})]}):null,L?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:x()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${U?` is-over`:``}`,children:xe({count:G.format(C.length),max:G.format(Je)})}),r?(0,Q.jsx)(Y,{size:`sm`,disabled:!re||A||P,onClick:()=>O(!0),children:A?y():N()}):null]})]}),(0,Q.jsx)(Fe,{open:ee,onOpenChange:O,children:(0,Q.jsxs)(Ae,{children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(ke,{children:E({name:n})}),(0,Q.jsx)(Oe,{children:oe({agent:t})})]}),H?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:a({added:H.added,removed:H.removed})}),H.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ce()}),H.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,H.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:k()}),H.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ne,{children:b()}),(0,Q.jsx)(je,{onClick:()=>void ne(),children:d()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=p(J.agentFileCuration.getProposal,{curationId:e}),i=T(J.agentFileCuration.approveCuration),a=A(J.agentFileCuration.rejectCuration),{toast:o}=Ie(),[s,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1),[m,g]=(0,X.useState)(``),v=l(),b=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function x(){u(`approve`);try{let t=await i({curationId:e});t.ok?(o({title:ve(),variant:`success`}),n()):o({title:t.reason===`conflict`?P():ye({reason:t.reason??`unknown`}),variant:`error`})}catch{o({title:I(),variant:`error`})}finally{u(null)}}async function C(n){u(`reject`);try{let r=m.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?o({title:n?L():c(),variant:`success`}):o({title:_e(),variant:`error`}),t()}catch{o({title:I(),variant:`error`})}finally{u(null)}}return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(ze,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Be,{children:r?W({name:r.name}):F()}),(0,Q.jsx)(Ve,{children:be()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[U({before:Z(r.beforeSize,v),after:Z(r.proposedSize,v)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Se,{size:13,"aria-hidden":!0}),` `,q()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ae({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:_({feedback:r.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ge()}),(0,Q.jsx)(`ul`,{children:b.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:G()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ue()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),d?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:S()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:pe(),value:m,onChange:e=>g(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`ghost`,onClick:()=>f(!1),disabled:s!==null,children:w()}),(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>void C(!1),disabled:s!==null,children:s===`reject`?y():h()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void C(!0),disabled:s!==null,children:s===`reject`?y():B()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>f(!0),disabled:s!==null||r==null,children:fe()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void x(),disabled:s!==null||r==null,children:s===`approve`?y():K()})]})]})})}export{rt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,BN as ee,CN as a,DN as te,EN as ne,FN as o,FZ as s,GN as re,HN as c,IN as ie,JN as ae,KN as oe,LN as l,MN as se,NN as ce,ON as le,PN as u,PZ as ue,QN as de,RN as fe,SN as d,TN as f,UN as pe,VN as me,WN as p,XN as he,YN as m,ZN as h,aP as g,bN as _,cP as ge,dP as v,eP as _e,fP as y,iP as ve,jN as ye,kN as be,lP as xe,nP as Se,oP as Ce,pP as b,qN as x,rP as S,sP as C,t as w,tP as T,uP as E,vN as D,wN as O,xN as k,yN as A,zN as j}from"./api-CUskDNHD.js";import{n as we,t as M}from"./useNavigate-D3GIoxyW.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-DCBGpD8v.js";import"./convexApi-BPSJUy2j.js";import{r as Te}from"./toast-C8rSAMgh.js";import{t as R}from"./badge-TiMZiv59.js";import{n as z}from"./format-zM-c-1S6.js";import{a as B,n as V,o as H,t as U}from"./dialog-DpoEg_Ex.js";import{c as Ee,o as De}from"./searchSchemas-Dm-Qg010.js";import{t as Oe}from"./appHost-CH3EGcJw.js";import{n as ke}from"./ConfirmDialog-Dy8WCeAF.js";import{n as Ae}from"./TimeRangePicker-DzJYDik_.js";import{t as je}from"./FilterBar-Bynn2H7k.js";import{t as Me}from"./DataTableShell-2_QPZexc.js";import{t as W}from"./dispatchErrorInfo-BOJ5cTZo.js";var G=t(e(),1),K=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),q=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function J(e){let t=q.has(e.kind);if(!K.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var Y=n(),X=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?b():e===`acknowledged`?y():v()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=we({from:`/settings/anomalies`}),t=M({from:`/settings/anomalies`}),n=e.q??``,a=e.status===Z?X:e.status,d=e.severity??X,f=e.kind??X,[_,v]=(0,G.useState)(X),y=De(e.from,e.to),{from:b,to:D}=Ae(y),O=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),k=e=>void t({search:t=>({...t,status:e===X?Z:e})}),A=e=>void t({search:t=>({...t,severity:e===X?void 0:e})}),B=e=>void t({search:t=>({...t,kind:e===X?void 0:e})}),V=e=>void t({search:t=>({...t,...Ee(e)})}),H=ke(),U=Te(),W=ue(w.anomalies.resolveAnomaly),K=(s(w.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),q=s(w.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:b,to:D,anomalyStatus:a===X?void 0:a,severity:d===X?void 0:d,source:_===X?void 0:_,kind:f===X?void 0:f}}),J=(0,G.useMemo)(()=>{let e=new Set;for(let t of q??[])e.add(t.kind);return[...e].sort()},[q]),Q=n!==``||a!==`open`||d!==X||_!==X||f!==X||y.kind!==`relative`||y.from!==Le.from;function $(){v(X),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:E(),description:(0,Y.jsxs)(Y.Fragment,{children:[xe(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ge(),` `,(0,Y.jsx)(`strong`,{children:C()}),`.`,` `,Ce()]}),confirmLabel:g()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(ve(),e.kind)}catch(e){U.error(S(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(Se(),e.kind)}catch(e){U.error(T(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[_e(),` `,(0,Y.jsx)(`strong`,{children:r()}),` `,de(),` `,(0,Y.jsx)(`strong`,{children:h()}),` `,he(),` `,(0,Y.jsx)(`strong`,{children:m()}),` `,ae(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,Y.jsxs)(je,{q:n,onQChange:O,searchPlaceholder:oe(),timeRange:y,onTimeRangeChange:V,onReset:$,canReset:Q,children:[(0,Y.jsxs)(L,{value:a,onValueChange:k,children:[(0,Y.jsx)(P,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(N,{})}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(I,{value:X,children:re()}),Ne.map(e=>(0,Y.jsx)(I,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,Y.jsxs)(L,{value:d,onValueChange:A,children:[(0,Y.jsx)(P,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(N,{placeholder:p()})}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(I,{value:X,children:ee()}),Fe.map(e=>(0,Y.jsx)(I,{value:e,children:e},e))]})]}),(0,Y.jsxs)(L,{value:_,onValueChange:v,children:[(0,Y.jsx)(P,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(N,{placeholder:j()})}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(I,{value:X,children:fe()}),Ie.map(e=>(0,Y.jsx)(I,{value:e,children:e},e))]})]}),(0,Y.jsxs)(L,{value:f,onValueChange:B,children:[(0,Y.jsx)(P,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(N,{placeholder:l()})}),(0,Y.jsxs)(F,{children:[(0,Y.jsx)(I,{value:X,children:ie()}),J.map(e=>(0,Y.jsx)(I,{value:e,children:e},e))]})]})]}),(0,Y.jsx)(Me,{title:o(),rows:q,emptyHint:a===`open`?u():ce(),rowActions:e=>K&&e.status===`open`?[{label:se(),onSelect:()=>void We(e)},{label:ye(),onSelect:()=>void Ge(e)}]:[],columns:[{header:i(),cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:l(),cell:e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:pe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,Y.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:me({when:z(e.firstAt)}),children:c({count:String(e.occurrenceCount)})}):(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:p(),cell:e=>(0,Y.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:be(),cell:e=>(0,Y.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:j(),cell:e=>(0,Y.jsx)(R,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:le(),cell:e=>(0,Y.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,Y.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:te(),cell:e=>(0,Y.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ne(),cell:e=>e.correlationId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=M();if(e.kind===`subagent.failure`){let n=$(e);return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,f()]}):null]})}let n=J(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,Y.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,f()]})}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,Y.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,f()]}):null]})}function Be({row:e}){let[t,n]=(0,G.useState)(!1),r=s(w.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[O(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,Y.jsx)(U,{open:t,onOpenChange:n,children:(0,Y.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,Y.jsx)(B,{children:(0,Y.jsx)(H,{children:a()})}),r===void 0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):r.length===0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:k()}):(0,Y.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,Y.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,Y.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,Y.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,Y.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,Y.jsx)(R,{variant:`destructive`,children:_()}):e===`acknowledged`?(0,Y.jsx)(R,{variant:`secondary`,children:A()}):(0,Y.jsx)(R,{variant:`outline`,children:D()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FZ as r,Fd as i,Id as a,Ld as o,Nd as s,Pd as c,Rd as l,_F as u,aF as d,cF as f,dF as p,fF as m,gF as h,hF as g,lF as _,mF as v,oF as y,pF as b,sF as x,t as S,uF as C,vF as w,yF as T}from"./api-CUskDNHD.js";import{n as E,t as D}from"./useNavigate-D3GIoxyW.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-DCBGpD8v.js";import"./convexApi-BPSJUy2j.js";import{n as N}from"./format-zM-c-1S6.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-Dm-Qg010.js";import{n as ee}from"./TimeRangePicker-DzJYDik_.js";import{t as z}from"./FilterBar-Bynn2H7k.js";import{t as B}from"./AdvancedFilter-5BMuHHt6.js";import{t as V}from"./DataTableShell-2_QPZexc.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:l()},{value:`realLabel`,label:o()},{value:`targetLabel`,label:a()},{value:`impersonated`,label:i()},{value:`resource`,label:c()},{value:`resourceId`,label:s()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,o=e.resource??G,s=F(e.from,e.to),c=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:l,to:L}=ee(s),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:I(e)}),replace:!0}),$=r(S.admin.listAudit,{filter:{q:n||void 0,from:l,to:L,action:i===G?void 0:i,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:c.length>0?c:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||a!==G||o!==G||c.length>0||s.kind!==`relative`||s.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:w()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:u(),timeRange:s,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:i,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:h()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:g()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:a,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:v()}),(0,U.jsx)(j,{value:`yes`,children:b()}),(0,U.jsx)(j,{value:`no`,children:m()})]})]}),(0,U.jsxs)(M,{value:o,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:p()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:C()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:c,onChange:Q}),(0,U.jsx)(V,{title:_(),rows:$,emptyHint:f(),columns:[{header:x(),cell:e=>N(e.at),sort:e=>e.at},{header:h(),cell:e=>e.action,sort:e=>e.action},{header:y(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:d(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:p(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,AA as i,Bk as a,CA as o,DA as s,E as c,EA as l,FZ as u,Fk as d,Gk as f,Go as p,Hk as m,Ik as h,Jk as g,Kk as _,Lk as v,MA as ee,MZ as te,NA as ne,OA as re,PZ as ie,Q_ as y,Qk as b,Rk as ae,SA as oe,TA as se,Uk as ce,Vk as le,Wk as ue,Xk as de,Yk as x,Zk as fe,_A as pe,aA as me,aj as he,av as ge,bA as _e,cA as ve,cj as ye,cv as be,dA as xe,dj as Se,dv as S,eA as Ce,ed as we,fA as Te,fj as Ee,fv as De,gA as Oe,gv as ke,hA as Ae,hc as je,hj as Me,hv as Ne,iA as Pe,id as Fe,iv as Ie,jA as Le,kA as Re,lA as ze,lj as Be,lv as Ve,mA as He,mj as Ue,mv as We,nA as Ge,nd as Ke,nj as qe,oA as Je,oj as Ye,ov as Xe,pA as Ze,pv as Qe,qk as $e,rA as et,rd as tt,sA as nt,sd as rt,sj as it,sv as at,t as C,tA as ot,td as st,tj as ct,uA as lt,uj as ut,uv as dt,vA as ft,wA as pt,xA as mt,yA as ht,zk as gt}from"./api-CUskDNHD.js";import{i as _t,n as w,o as vt,r as yt,s as bt}from"./FieldLabel-D63ry-fi.js";import{n as xt,t as T}from"./useNavigate-D3GIoxyW.js";import{r as E}from"./dist-BmXC8pZv.js";import{t as St}from"./chevron-right-BjOti-z8.js";import{t as Ct}from"./chevron-up-DfOJb3vW.js";import{t as wt}from"./chevrons-up-down-Bp7zuoEk.js";import{n as Tt,t as Et}from"./usageView-B0Wg081i.js";import{t as Dt}from"./loader-circle-BO0Lx5va.js";import{t as Ot}from"./checkbox-Czxm5pNj.js";import{t as D}from"./server-BSDuYUUF.js";import{t as O}from"./triangle-alert-DQoWKyu_.js";import{a as k,i as A,n as j,r as M,t as N}from"./select-DCBGpD8v.js";import{i as kt,n as At,r as jt,t as Mt}from"./tabs-dQ50HGoj.js";import{n as Nt,r as Pt,t as Ft}from"./popover-DiT_Oo6e.js";import{t as It}from"./button-CbHyzXCb.js";import{t as P}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{r as Lt}from"./toast-C8rSAMgh.js";import{t as F}from"./badge-TiMZiv59.js";import{a as I,n as L}from"./format-zM-c-1S6.js";import{a as Rt,n as zt,o as Bt,r as Vt,t as Ht}from"./dialog-DpoEg_Ex.js";import{t as Ut}from"./appHost-CH3EGcJw.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./table-GXZ7yFCE.js";import{t as Gt}from"./FilterBar-Bynn2H7k.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-Dj1HQXxr.js";import{t as W}from"./dispatchErrorInfo-BOJ5cTZo.js";var $t=c(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=c(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function K(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return K(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function vn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(un),[o,s]=(0,G.useState)(null),c=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),l=(0,G.useMemo)(()=>gn(c),[c]),u=(0,G.useMemo)(()=>_n(c),[c]),d=(0,G.useMemo)(()=>vn(c),[c]),p=(0,G.useMemo)(()=>hn(fn(c,n),o),[c,n,o]);function h(e){s(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>i(un),canReset:dn(n),children:[(0,Q.jsxs)(N,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:g()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{value:Y,children:x()}),l.map(e=>(0,Q.jsx)(M,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(N,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(k,{placeholder:$e()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{value:Y,children:x()}),u.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(N,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(k,{placeholder:_()})}),(0,Q.jsxs)(j,{children:[(0,Q.jsx)(M,{value:Y,children:x()}),d.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),p.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(U,{className:`oc-conn__table`,children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(V,{children:[(0,Q.jsx)($,{label:ue(),sortKey:`target`,sort:o,onSort:h}),(0,Q.jsx)($,{label:ce(),sortKey:`state`,sort:o,onSort:h}),(0,Q.jsx)($,{label:m(),sortKey:`instance`,sort:o,onSort:h}),(0,Q.jsx)($,{label:le(),sortKey:`host`,sort:o,onSort:h}),(0,Q.jsx)($,{label:a(),sortKey:`version`,sort:o,onSort:h}),(0,Q.jsx)(z,{children:gt()}),(0,Q.jsx)($,{label:ae(),sortKey:`lastOk`,sort:o,onSort:h})]})}),(0,Q.jsx)(B,{children:p.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(Ct,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(wt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=K(e)?W(e.lastErrorCode):null,n=an(e)?W(e.lastDownstreamRejectCode):null,r=on(e)?W(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(H,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(H,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(H,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:b({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(H,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:I(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${I(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[p({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${I(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[fe({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${I(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?v():e===`error`?h():d()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(F,{variant:`secondary`,children:v()}):e===`error`?(0,Q.jsx)(F,{variant:`destructive`,children:h()}):(0,Q.jsx)(F,{variant:`outline`,children:d()})}function Cn(){return u(C.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=u(C.compat.getBridgeCompat,{}),n=u(C.me.getMe,{host:Ut})?.role===`admin`,r=u(C.admin.listInstances,n?{}:`skip`),i=u(C.agents.usageForInstances,n?{}:`skip`),a=T(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=xt({from:`/settings/bridge`}),l=T({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Xt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ht()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:ft()}),(0,Q.jsxs)(U,{children:[(0,Q.jsx)(R,{children:(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{children:Fe()}),(0,Q.jsx)(z,{children:tt()}),(0,Q.jsx)(z,{children:Ke()}),(0,Q.jsx)(z,{children:st()}),(0,Q.jsx)(z,{children:we()})]})}),(0,Q.jsx)(B,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(V,{children:[(0,Q.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(H,{children:t.provider}),(0,Q.jsx)(H,{children:t.label}),(0,Q.jsx)(H,{children:(0,Q.jsxs)(F,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Mt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(jt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(D,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(At,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:We(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Qe({build:t.buildVersion??`?`})]}):null,` · `,De(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:lt()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ze()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=L(e.checkedAt),f=e.startedAt==null?null:L(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(Tt,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(O,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?ve():c===`gateways_unreachable`?Pe({count:l.length}):s?nt():Je({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)($t,{size:12,"aria-hidden":!0}),` `,me({time:d})]}),f?(0,Q.jsx)(`span`,{children:Ge({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:et({names:l.join(`, `)})}):null,s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ot()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(D,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),d?(0,Q.jsx)(F,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ke()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(St,{size:13,"aria-hidden":!0}),Ce({count:t.length})]}),f?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[pe(),i.length>0?(0,Q.jsx)(F,{variant:`destructive`,children:Ae({count:i.length})}):a>0?(0,Q.jsx)(F,{variant:`destructive`,children:He()}):(0,Q.jsx)(F,{variant:`secondary`,children:Oe()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ze({version:e.vendoredVersion}),r?` · `+Te({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:je({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(St,{size:13,"aria-hidden":!0}),xe({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:dt()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:rt({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:be({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:S()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(F,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(Ht,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(zt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Rt,{children:[(0,Q.jsx)(Bt,{children:Me({instance:e.displayName??e.name})}),(0,Q.jsx)(Vt,{children:Ue()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Tt,{"aria-hidden":!0}):(0,Q.jsx)(O,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?o():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,oe()]}):null}function jn({instance:e,onClose:t}){let n=ie(C.admin.upsertInstanceConfig),r=te(C.bridge.validateMediaPaths),a=Lt(),o=Wt(e.config?.contentLocale,void 0),[c,u]=(0,G.useState)(()=>_t(e.config??{},o)),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=c.inboundMediaMode===`shared-fs`,v=c.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){a.error(s(),e)}finally{m(!1)}}async function ae(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:yt(c,r,o)}),t()}catch(e){a.error(it(),e)}finally{f(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:Ee(),help:Ye()}),(0,Q.jsxs)(N,{value:c.mediaMode,onValueChange:e=>u({...c,mediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(j,{children:bt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:Se(),help:he()}),(0,Q.jsxs)(N,{value:c.inboundMediaMode,onValueChange:e=>u({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(A,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(k,{})}),(0,Q.jsx)(j,{children:vt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:ut(),help:qe()}),(0,Q.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>u({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:ne(),help:ee()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>u({...c,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:Le(),help:i()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>u({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Ot,{checked:c.rehydration,onCheckedChange:e=>u({...c,rehydration:e===!0})}),(0,Q.jsx)(w,{label:Be(),help:ct()})]}),y&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(O,{"aria-hidden":!0}),_e({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:se(),result:h.inbound}),(0,Q.jsx)(An,{label:pt(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(O,{"aria-hidden":!0}),mt()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(It,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Q.jsx)(Dt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?re():Re()]}),(0,Q.jsx)(It,{size:`sm`,onClick:()=>void ae(),disabled:d,children:ye()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?at():Xe({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Nt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ge()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(F,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Am as i,B as a,By as o,Cm as s,Cn as c,Cv as l,Dm as u,Dn as d,E as f,Em as p,En as m,F as h,FZ as g,Fy as _,G as v,H as y,Hy as b,I as ee,Iy as x,J as te,K as ne,L as re,M as ie,MZ as S,Mm as C,N as ae,Om as oe,On as w,P as se,PZ as T,R as ce,Sn as E,Sv as le,TZ as D,Tm as ue,Tn as de,Tv as fe,U as pe,V as me,W as he,X as ge,Y as _e,Z as ve,_n as ye,_v as O,an as be,bn as xe,bv as Se,cn as k,dn as Ce,et as A,fn as we,gn as Te,hn as Ee,in as De,j as Oe,jm as ke,km as j,kn as Ae,ln as je,mn as Me,od as Ne,on as Pe,pj as Fe,pn as Ie,q as Le,sn as Re,t as M,ty as N,un as ze,vn as Be,vv as P,wm as Ve,wn as He,wv as Ue,xn as We,xv as Ge,yn as Ke,yv as F,z as qe}from"./api-CUskDNHD.js";import{t as Je}from"./use_paginated_query-BatXdmTn.js";import{t as Ye}from"./loader-circle-BO0Lx5va.js";import{t as Xe}from"./checkbox-Czxm5pNj.js";import{t as Ze}from"./plus-CSOLqt7C.js";import{t as Qe}from"./triangle-alert-DQoWKyu_.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-DCBGpD8v.js";import{n as $e,r as et,t as tt}from"./popover-DiT_Oo6e.js";import{t as V}from"./button-CbHyzXCb.js";import{t as H}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{a as nt,t as U}from"./KnobRow-3my9jz_H.js";import{n as rt}from"./capabilities-CASxhKEd.js";import{a as it}from"./compatView-Dj1HQXxr.js";/* empty css */import{t as at}from"./switch-Dt_I92ZY.js";var ot=f(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),W=t(e(),1),st=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ct(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var lt=[`auto`,`hybrid`,`tool`,`off`];function ut(e){switch(e){case`auto`:return m();case`hybrid`:return de();case`tool`:return He();default:return c()}}function G(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function dt(e){return typeof e==`string`&&lt.includes(e)}function K(e){return{injection:dt(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function ft(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function pt(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?Be():mt(e)?k():null:Ke(),i=K(e),a=t.injection!==i.injection||!ft(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),s=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:s,invalidReason:s?null:We()}}function mt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function ht(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function gt(e){return e.ok?null:e.code===`scope_refused`?Be():e.code===`stale_default`?ye():e.code===`write_unknown`||e.code===`not_confirmed`?Me():e.code===`not_applied`?Ie():e.code===`default_too_large`?Pe():e.code===`allowlist_too_large`?Re():e.code===`plugin_too_old`?k():e.code===`source_not_allowed`?je():e.code===`plugin_config_lag`?ze():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?xe():Te({code:e.code})}function _t(e,t){let n=G(e),r=G(t);if(n.injection!==r.injection||!ft(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var q=n();function vt({instanceName:e,row:t,supported:n}){let r=S(M.knowledge.setAgentKnowledgeDefault),[i,a]=(0,W.useState)(t),[o,s]=(0,W.useState)(()=>K(t)),[c,l]=(0,W.useState)(`idle`),[u,f]=(0,W.useState)(null),[p,m]=(0,W.useState)(!1),h=e=>{a(e),s(K(e)),f(null)},g=_t(i,t);(0,W.useEffect)(()=>{p&&g&&(m(!1),h(t))},[p,g]);let _=pt(i,o,n),v=_.readOnlyReason===null;async function y(){l(`saving`),f(null);try{let n=gt(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:G(i)}));f(n),l(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(gt({ok:!1,code:String(e?.message??`error`).slice(0,60)})),l(`idle`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsxs)(B,{value:o.injection,onValueChange:e=>{dt(e)&&s({...o,injection:e})},disabled:!v,children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":d(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:lt.map(e=>(0,q.jsx)(z,{value:e,children:ut(e)},e))})]})}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),t.sources.map(e=>(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:v?`pointer`:`default`},title:e.description||void 0,children:[(0,q.jsx)(Xe,{checked:o.sources.includes(e.id),onCheckedChange:()=>s(ht(t,o,e.id)),disabled:!v,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,q.jsx)(`span`,{children:e.label})]},e.id)),g&&!p?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[be(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:De()})]}):null,t.overridesAllowed?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ee()}),v?(0,q.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,q.jsx)(V,{size:`sm`,disabled:!_.dirty||!_.valid||c===`saving`,onClick:()=>void y(),children:c===`saving`?b():F()})}):(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:_.readOnlyReason}),v&&_.dirty&&_.invalidReason!==null?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_.invalidReason}):null,c===`done`&&u===null?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,u===null?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:u})]})]})}function yt({instanceName:e}){let t=g(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Je(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,q.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":Ae(),children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Ae()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),t.supported?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:Ke()}),n.map(n=>(0,q.jsx)(vt,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:we({shown:n.length})}),(0,q.jsx)(V,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:Ce()})]}):null]})}function J(e){return e.displayName??e.agentId}function bt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function Y(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function xt(e,t){let n=Y(t);return n===``||Y(J(e)).includes(n)||Y(e.agentId).includes(n)}var St=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function X(e,t){return St.compare(J(e),J(t))||St.compare(e.agentId,t.agentId)}function Ct(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(X).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function wt(e,t){return Tt(e.length)?e.filter(e=>xt(e.agent,t)):[...e]}function Tt(e){return e>8}function Z(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&xt(e,t));return[...n.filter(e=>e.enabled).sort(X),...n.filter(e=>!e.enabled).sort(X)]}function Et(e){return!e}function Dt(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Ot(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function kt(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:Math.min(e+1,n-1);case`ArrowUp`:return e<=0?0:e-1;case`Home`:return 0;case`End`:return n-1;default:return Math.min(e,n-1)}}var Q=e=>e?A():r();function $(e,t){return e===null||e.kind!==t.kind?!1:e.kind===`instance`||t.kind===`agent`&&e.agentId===t.agentId}function At({instanceName:e}){let t=g(M.agents.listAgentsForInstance,{instanceName:e}),n=T(M.agents.setInstanceReasoningDefault),i=T(M.agents.setAgentReasoningDefault),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(``),[d,f]=(0,W.useState)(``),p=(0,W.useRef)(null),m=(0,W.useId)(),h=t?.showReasoningDefault===!0,_=t?.agents??[],y=(0,W.useMemo)(()=>Ct(_,h),[_,h]),x=wt(y,d),S=Z(_,``).length>0;async function C(e,t,n){o(e),c(null),u(``);try{return await t(),u(n),!0}catch{return c(e),!1}finally{o(t=>t===e?null:t)}}let oe=t=>void C({kind:`instance`},()=>n({instanceName:e,show:t}),se({value:Q(t)})),w=(t,n,r)=>C({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function ce(e){await w(e,null,Oe({agent:J(e)}))&&p.current?.focus()}let E=a!==null;return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ge()}),t===void 0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):_.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,q.jsx)(`label`,{htmlFor:m,className:`oc-rdefaults__default-label`,children:te()}),(0,q.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,q.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`}):Q(h)}),(0,q.jsx)(at,{id:m,checked:h,disabled:E,"aria-busy":a?.kind===`instance`,onCheckedChange:oe})]}),s?.kind===`instance`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null,(0,q.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:Le({count:y.length})}),(0,q.jsx)(jt,{agents:_,instanceDefault:h,disabled:!S,triggerRef:p,onPick:e=>{let t=Et(h);w(e,t,ae({agent:J(e),value:Q(t)}))}})]}),y.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()}):(0,q.jsxs)(q.Fragment,{children:[Tt(y.length)?(0,q.jsx)(H,{type:`search`,value:d,onChange:e=>f(e.target.value),placeholder:re(),"aria-label":re(),className:`oc-rdefaults__filter`}):null,x.length===0?(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()}):(0,q.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":Le({count:y.length}),children:x.map(({agent:e,show:t,sameAsDefault:n})=>{let i=J(e),o={kind:`agent`,agentId:e.agentId};return(0,q.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,q.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:i}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,q.jsx)(`span`,{className:`oc-rdefaults__same`,children:v()}):null]}),(0,q.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[$(a,o)?(0,q.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`,"aria-label":b()}):null,(0,q.jsx)(U,{field:`showReasoning`,ariaLabel:he({agent:i}),options:[{id:`on`,label:A()},{id:`off`,label:r()}],value:t?`on`:`off`,onChange:t=>void w(e,t===`on`,ie({agent:i,value:Q(t===`on`)})),disabled:E}),(0,q.jsx)(V,{variant:`ghost`,size:`icon`,disabled:E,"aria-label":pe({agent:i}),title:pe({agent:i}),onClick:()=>void ce(e),children:(0,q.jsx)(ot,{"aria-hidden":!0})})]}),$(s,o)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:O()}):null]},e.agentId)})})]}),s?.kind===`agent`&&!y.some(e=>e.agent.agentId===s.agentId)?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null]}),(0,q.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:l})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(null),f=(0,W.useId)(),p=(0,W.useRef)(null),m=Z(e,c),g=Dt(m,u),_=Z(e,``).length===0,v=e=>`${f}-opt-${e}`;function b(){s(!1),l(``),d(null)}function ee(e){d(e>=0?m[e].agentId:null),e>=0&&p.current?.querySelector(`#${CSS.escape(v(e))}`)?.scrollIntoView({block:`nearest`})}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),ee(kt(g,e.key,m.length));else if(e.key===`Enter`){e.preventDefault();let t=Ot(m,u);t===null?d(null):(b(),i(t))}}return(0,q.jsxs)(tt,{open:o,onOpenChange:e=>e?s(!0):b(),children:[(0,q.jsx)(et,{asChild:!0,children:(0,q.jsxs)(V,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,q.jsx)(Ze,{"aria-hidden":!0}),y()]})}),(0,q.jsxs)($e,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,q.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:me({value:Q(Et(t))})}),(0,q.jsx)(H,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":f,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<m.length?v(g):void 0,"aria-label":a(),placeholder:a(),value:c,onChange:e=>{l(e.target.value),d(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,q.jsx)(`div`,{id:f,ref:p,role:`listbox`,"aria-label":y(),className:`oc-rdefaults__options`,children:m.length===0?(0,q.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?ce():qe()}):m.map((e,t)=>(0,q.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>d(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{b(),i(e)},children:[(0,q.jsx)(`span`,{className:`oc-rdefaults__name`,children:J(e)}),bt(e)?(0,q.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,q.jsx)(`span`,{className:`oc-rdefaults__badge`,children:h()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=T(M.admin.upsertInstanceConfig),n=g(M.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,W.useState)(r),[o,s]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,l=i!==r;async function d(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let f=n?.agents??[];return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsxs)(B,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,q.jsx)(L,{className:`oc-cdefaults__select`,"aria-label":j(),children:(0,q.jsx)(I,{placeholder:u()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(z,{value:c,children:u()}),f.map(e=>(0,q.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,q.jsx)(V,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void d(),children:o===`saving`?b():F()})]}),o===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,o===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null]})}function Nt({instance:e}){let t=T(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,o]=(0,W.useState)(n),[s,c]=(0,W.useState)(r===null?``:String(r)),[l,u]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{o(n),c(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=s.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,m=!a||f===null||Number.isInteger(f)&&f>=4e3&&f<=6e4,h=a!==n||(f??null)!==r;async function g(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||f===null||Number.isNaN(f)?delete n.curationBudgetChars:n.curationBudgetChars=f,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(Xe,{checked:a,onCheckedChange:e=>o(e===!0),"aria-label":i()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!m,"aria-label":p(),disabled:!a}),(0,q.jsx)(V,{size:`sm`,disabled:!h||!m||l===`saving`,onClick:()=>void g(),children:l===`saving`?b():F()})]}),m?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:ue()}),l===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,l===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ve()})]})}function Pt({instance:e}){let t=T(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,W.useState)(n===null?``:String(n)),[a,o]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let c=r.trim(),l=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,u=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,d=(l??null)!==n;async function f(){o(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(H,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!u}),(0,q.jsx)(V,{size:`sm`,disabled:!d||!u||a===`saving`,onClick:()=>void f(),children:a===`saving`?b():F()})]}),u?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:s()}),a===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):null,a===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:O()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ke()})]})}function Ft(){let e=S(M.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),r=g(M.admin.listInstances,{}),[i,a]=(0,W.useState)(null);(0,W.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[r,i]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,u=g(M.compat.forInstance,i?{instanceName:i}:`skip`),d=i?rt(u,`configDefaults`):`loading`,f=d===`loading`?null:d.blocked,p=(0,W.useMemo)(()=>s&&i?{instanceName:i}:{},[s,i]),m=(0,W.useRef)(0),h=(0,W.useCallback)(async()=>{let t=++m.current;n({status:`loading`});try{let r=ct(await e(p));if(m.current!==t)return;n({status:`done`,current:r})}catch{if(m.current!==t)return;n({status:`error`})}},[e,p]);(0,W.useEffect)(()=>{f===!1&&(s&&!i||h())},[h,f,s,i]);let v=t.status===`done`?t.current:null,y=(0,W.useMemo)(()=>st.map(e=>({id:e,label:nt(e)})),[]),b=(0,W.useMemo)(()=>[{id:`fast`,label:x()},{id:`standard`,label:_()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}),s&&i?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,q.jsxs)(B,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(L,{size:`sm`,"aria-label":N(),children:(0,q.jsx)(I,{})}),(0,q.jsx)(R,{children:(r??[]).map(e=>(0,q.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:Fe()}):d===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):d.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(Qe,{size:14,"aria-hidden":!0}),` `,it(d.gatewayVersion,d.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Se(),` `,(0,q.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:o()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:Ue()}),(0,q.jsx)(U,{field:`thinkingLevel`,options:y,value:v?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:Ue()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:le()}),(0,q.jsx)(U,{field:`fastMode`,options:b,value:v===null||v.fastModeDefault===null?null:v.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:le()}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ge()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:Ne()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Pt,{instance:e}),(0,q.jsx)(Nt,{instance:e}),(0,q.jsx)(Mt,{instance:e}),(0,q.jsx)(At,{instanceName:e.name}),(0,q.jsx)(yt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gd as r,Jd as i,Kd as a,Wd as o,Yd as s,qd as c}from"./api-DSJJn0d7.js";import{a as l,c as u,i as d,o as f,r as p,s as m,t as h}from"./alert-dialog-BoEv1f8g.js";import{t as g}from"./button-Dio0PVrp.js";import{t as _}from"./input-BSpTsBA6.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-BfrsWZiD.js";var w=t(e(),1),T=n(),E=w.createContext(null);function D({children:e}){let[t,n]=w.useState(null),D=w.useRef(null),O=w.useRef(null),[k,A]=w.useState(``),j=w.useCallback(e=>{let t=D.current;D.current=null,n(null),t&&t(e)},[]),M=w.useMemo(()=>({confirm:e=>new Promise(t=>{D.current=t,A(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{D.current=t,A(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),N=t?.kind===`confirm`,P=t?.kind===`prompt`,F=t?.kind===`confirm`?t.opts.confirmWord:void 0,I=!F||k.trim().toLowerCase()===F.trim().toLowerCase(),L=k.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,R=e=>{e.preventDefault(),requestAnimationFrame(()=>O.current?.focus())};return(0,T.jsxs)(E.Provider,{value:M,children:[e,(0,T.jsx)(h,{open:N,onOpenChange:e=>{e||j(!1)},children:N?(0,T.jsxs)(d,{onOpenAutoFocus:F?R:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(u,{children:t.opts.title}),t.opts.description?(0,T.jsx)(l,{children:t.opts.description}):null]}),F?(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[a(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:o({word:F})}),` `,r()]}),(0,T.jsx)(_,{ref:O,value:k,placeholder:F,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I&&(e.preventDefault(),j(!0))}})]}):null,(0,T.jsxs)(f,{children:[(0,T.jsx)(p,{onClick:()=>j(!1),children:t.opts.cancelLabel??s()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??i()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(x,{children:t.opts.title}),t.opts.description?(0,T.jsx)(S,{children:t.opts.description}):null]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,T.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,T.jsx)(_,{ref:O,value:k,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&L&&(e.preventDefault(),j(k.trim()))}})]}),(0,T.jsxs)(y,{children:[(0,T.jsx)(g,{variant:`outline`,onClick:()=>j(null),children:t.opts.cancelLabel??s()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??c()})]})]}):null})]})}function O(){let e=w.useContext(E);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function k(){return O().confirm}function A(){return O().prompt}export{k as n,A as r,D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Mf as i,Nf as a,Pf as o,jf as s,kf as c}from"./api-CUskDNHD.js";import{a as l,c as u,i as d,o as f,r as p,s as m,t as h}from"./alert-dialog-DRrmbZYC.js";import{t as g}from"./button-CbHyzXCb.js";import{t as _}from"./input-DCbMcJYs.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-DpoEg_Ex.js";var w=t(e(),1),T=n(),E=w.createContext(null);function D({children:e}){let[t,n]=w.useState(null),D=w.useRef(null),O=w.useRef(null),[k,A]=w.useState(``),j=w.useCallback(e=>{let t=D.current;D.current=null,n(null),t&&t(e)},[]),M=w.useMemo(()=>({confirm:e=>new Promise(t=>{D.current=t,A(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{D.current=t,A(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),N=t?.kind===`confirm`,P=t?.kind===`prompt`,F=t?.kind===`confirm`?t.opts.confirmWord:void 0,I=!F||k.trim().toLowerCase()===F.trim().toLowerCase(),L=k.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,R=e=>{e.preventDefault(),requestAnimationFrame(()=>O.current?.focus())};return(0,T.jsxs)(E.Provider,{value:M,children:[e,(0,T.jsx)(h,{open:N,onOpenChange:e=>{e||j(!1)},children:N?(0,T.jsxs)(d,{onOpenAutoFocus:F?R:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(u,{children:t.opts.title}),t.opts.description?(0,T.jsx)(l,{children:t.opts.description}):null]}),F?(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[s(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:c({word:F})}),` `,r()]}),(0,T.jsx)(_,{ref:O,value:k,placeholder:F,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I&&(e.preventDefault(),j(!0))}})]}):null,(0,T.jsxs)(f,{children:[(0,T.jsx)(p,{onClick:()=>j(!1),children:t.opts.cancelLabel??o()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??a()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(x,{children:t.opts.title}),t.opts.description?(0,T.jsx)(S,{children:t.opts.description}):null]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,T.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,T.jsx)(_,{ref:O,value:k,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&L&&(e.preventDefault(),j(k.trim()))}})]}),(0,T.jsxs)(y,{children:[(0,T.jsx)(g,{variant:`outline`,onClick:()=>j(null),children:t.opts.cancelLabel??o()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??i()})]})]}):null})]})}function O(){let e=w.useContext(E);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function k(){return O().confirm}function A(){return O().prompt}export{k as n,A as r,D as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CC as r,DC as i,EC as a,OC as o,TC as s,kC as c,wC as l}from"./api-DSJJn0d7.js";import{r as u}from"./dist-ClkJChBn.js";import{t as d}from"./chevron-up-Dsqj2Oaj.js";import{t as f}from"./chevrons-up-down-Pva00Np5.js";import{c as p,g as m,n as h,r as g,s as _,t as v}from"./dropdown-menu-DHMOOlaP.js";import{t as y}from"./checkbox-CsI4ggnp.js";import{t as b}from"./plus-Djbdyc2E.js";import{t as x}from"./trash-2-B4WSfc7G.js";import{t as S}from"./button-Dio0PVrp.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-D2SJC960.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=c(),bulkActions:F,emptyHint:I=o(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(S,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(S,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(y,{"aria-label":a(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(y,{"aria-label":s(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(h,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(_,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cw as r,dw as i,fw as a,lw as o,mw as s,pw as c,uw as l}from"./api-CUskDNHD.js";import{r as u}from"./dist-BmXC8pZv.js";import{t as d}from"./chevron-up-DfOJb3vW.js";import{t as f}from"./chevrons-up-down-Bp7zuoEk.js";import{c as p,g as m,n as h,r as g,s as _,t as v}from"./dropdown-menu-BWxfj48Z.js";import{t as y}from"./checkbox-Czxm5pNj.js";import{t as b}from"./plus-CSOLqt7C.js";import{t as x}from"./trash-2-8oRd823U.js";import{t as S}from"./button-CbHyzXCb.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-GXZ7yFCE.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=s(),bulkActions:F,emptyHint:I=c(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(S,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(S,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(y,{"aria-label":i(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":r({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(y,{"aria-label":l(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(v,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(h,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(_,{}):null,(0,M.jsx)(g,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{ED as t,ND as n,PD as r,PZ as i,TD as a,oM as o,t as s,wD as c}from"./api-CUskDNHD.js";import{t as l}from"./use_paginated_query-BatXdmTn.js";import{t as u}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{n as d}from"./ConfirmDialog-Dy8WCeAF.js";import{r as f}from"./trashView-CIgTWQjI.js";import{n as p,t as m}from"./trashPage-CoBMe_r-.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(s.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=i(s.trash.restoreChat),b=i(s.trash.purgeChat),x=i(s.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:r({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:a(),description:c(),confirmLabel:t(),destructive:!0})&&await x({})},children:t()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:o()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:n()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-C4po8DQ1.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-TiMZiv59.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bd as r,Vd as i,oy as a,r as o}from"./api-DSJJn0d7.js";import{t as s}from"./loader-circle-BNhIFGdg.js";import{t as c}from"./x-CK8d5DC1.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CkbybbG7.js";import{t as g}from"./button-Dio0PVrp.js";var _=t(e(),1),v=n();function y({...e}){return(0,v.jsx)(f,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-portal`,...e})}function x({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function S({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,v.jsxs)(b,{children:[(0,v.jsx)(x,{}),(0,v.jsxs)(d,{"data-slot":`sheet-content`,"data-side":n,className:o(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,v.jsx)(h,{"data-slot":`sheet-close`,asChild:!0,children:(0,v.jsxs)(g,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,v.jsx)(c,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:a()})]})})]})]})}function C({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-0.5 p-4`,e),...t})}function w({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-footer`,className:o(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function T({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:o(`font-heading text-base font-medium text-foreground`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(p,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function D({open:e,onOpenChange:t,title:n,description:a,children:o,onSubmit:c,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,_.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await c()}finally{p(!1)}}return(0,v.jsx)(y,{open:e,onOpenChange:t,children:(0,v.jsxs)(S,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,v.jsxs)(C,{className:`border-b px-6 py-4`,children:[(0,v.jsx)(T,{children:n}),a?(0,v.jsx)(E,{children:a}):null]}),(0,v.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,v.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,v.jsxs)(w,{className:`border-t px-6 py-4`,children:[(0,v.jsxs)(g,{type:`submit`,disabled:!d||m,children:[m?(0,v.jsx)(s,{className:`size-4 animate-spin`}):null,l??i()]}),(0,v.jsx)(g,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:r()})]})]})]})})}export{w as a,E as i,y as n,C as o,S as r,T as s,D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ef as r,Gy as i,Tf as a,r as o}from"./api-CUskDNHD.js";import{t as s}from"./loader-circle-BO0Lx5va.js";import{t as c}from"./x-6-84PEVq.js";import{a as l,i as u,n as d,o as f,r as p,s as m,t as h}from"./dist-DQawXTf-.js";import{t as g}from"./button-CbHyzXCb.js";var _=t(e(),1),v=n();function y({...e}){return(0,v.jsx)(f,{"data-slot":`sheet`,...e})}function b({...e}){return(0,v.jsx)(l,{"data-slot":`sheet-portal`,...e})}function x({className:e,...t}){return(0,v.jsx)(u,{"data-slot":`sheet-overlay`,className:o(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function S({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...a}){return(0,v.jsxs)(b,{children:[(0,v.jsx)(x,{}),(0,v.jsxs)(d,{"data-slot":`sheet-content`,"data-side":n,className:o(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...a,children:[t,r&&(0,v.jsx)(h,{"data-slot":`sheet-close`,asChild:!0,children:(0,v.jsxs)(g,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,v.jsx)(c,{}),(0,v.jsx)(`span`,{className:`sr-only`,children:i()})]})})]})]})}function C({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-header`,className:o(`flex flex-col gap-0.5 p-4`,e),...t})}function w({className:e,...t}){return(0,v.jsx)(`div`,{"data-slot":`sheet-footer`,className:o(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function T({className:e,...t}){return(0,v.jsx)(m,{"data-slot":`sheet-title`,className:o(`font-heading text-base font-medium text-foreground`,e),...t})}function E({className:e,...t}){return(0,v.jsx)(p,{"data-slot":`sheet-description`,className:o(`text-sm text-muted-foreground`,e),...t})}function D({open:e,onOpenChange:t,title:n,description:i,children:o,onSubmit:c,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,_.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await c()}finally{p(!1)}}return(0,v.jsx)(y,{open:e,onOpenChange:t,children:(0,v.jsxs)(S,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,v.jsxs)(C,{className:`border-b px-6 py-4`,children:[(0,v.jsx)(T,{children:n}),i?(0,v.jsx)(E,{children:i}):null]}),(0,v.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,v.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,v.jsxs)(w,{className:`border-t px-6 py-4`,children:[(0,v.jsxs)(g,{type:`submit`,disabled:!d||m,children:[m?(0,v.jsx)(s,{className:`size-4 animate-spin`}):null,l??r()]}),(0,v.jsx)(g,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:a()})]})]})]})})}export{w as a,E as i,y as n,C as o,S as r,T as s,D as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AR as i,BR as a,CR as o,DR as s,ER as c,FR as l,FZ as u,GL as d,GR as f,HR as p,IR as m,Ip as ee,JL as h,KL as g,LR as _,MR as v,NR as te,OR as ne,PR as re,PZ as y,Pp as ie,QL as ae,RR as b,SR as x,TR as S,UL as C,UR as w,VR as T,WL as E,WR as D,XL as O,YL as k,ZL as A,_R as j,aR as M,bR as N,cR as P,dR as F,eR as I,fR as L,gR as R,hR as z,iR as B,jR as V,kR as H,lR as U,mR as oe,nR as W,oR as G,pR as K,qL as q,rR as se,sR as ce,t as J,tR as le,uR as ue,vR as de,wR as fe,xR as pe,yR as me,zR as he}from"./api-CUskDNHD.js";import{t as ge}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{n as _e}from"./format-zM-c-1S6.js";import{n as Y}from"./ConfirmDialog-Dy8WCeAF.js";import{t as ve}from"./DataTableShell-2_QPZexc.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>f(),incorrect:()=>D(),incoherence:()=>w(),formatting:()=>p(),latency:()=>T(),api_error:()=>a(),other:()=>he()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:_()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:m()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:b()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,a=y(J.feedback.respondToFeedback),[u,d]=(0,X.useState)(e.thread),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(!1);async function g(){let t=f.trim();if(!(!t||m)){h(!0);try{await a({feedbackId:e._id,text:t}),d(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),p(``)}finally{h(!1)}}}let _=[];try{_=r.contextJson?JSON.parse(r.contextJson):[]}catch{_=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${l()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:U(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),u.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:u.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?v():e.authorRole===`agent`?e.authorLabel??ee():V()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:i()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:H(),value:f,maxLength:2e3,rows:3,onChange:e=>p(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void g(),disabled:!f.trim()||m,children:m?ne():s()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||S()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||S()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,_.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x({count:r.contextCount??_.length,truncated:r.contextTruncated?pe():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:_.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:me()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?j({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[R(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,z()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=u(J.feedback.listForAdmin,{}),t=y(J.feedback.readSnapshot),n=y(J.feedback.deleteFeedback),i=Y(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function f(e){await i({title:d(),description:E(),confirmLabel:C(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),` `,(0,Z.jsx)(`strong`,{children:K()}),` `,L()]}),(0,Z.jsx)(ve,{title:F(),rows:e,emptyHint:ue(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:P(),cell:e=>_e(e.at),sort:e=>e.at},{header:ce(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:G(),cell:e=>e.messageRole===`user`?M():B(),sort:e=>e.messageRole},{header:se(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${W({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:le(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:I(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:r(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ae()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:A()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:O()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?h():q(),onSelect:()=>void l(e)},{label:g(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,rZ as n}from"./api-DSJJn0d7.js";import{a as r,i,n as a,o,r as s,t as c}from"./tooltip-v_AyOWn6.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=Object.defineProperty,u=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),f=`https://docs.convex.dev/error#undefined-validator`;function p(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${f} for details.`)}var m=class{constructor({isOptional:e}){d(this,`type`),d(this,`fieldPaths`),d(this,`isOptional`),d(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},h=class e extends m{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),d(this,`tableName`),d(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},g=class e extends m{constructor(){super(...arguments),d(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},_=class e extends m{constructor(){super(...arguments),d(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},v=class e extends m{constructor(){super(...arguments),d(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},y=class e extends m{constructor(){super(...arguments),d(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},b=class e extends m{constructor(){super(...arguments),d(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends m{constructor(){super(...arguments),d(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends m{constructor(){super(...arguments),d(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends m{constructor({isOptional:e,fields:t}){super({isOptional:e}),d(this,`fields`),d(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&p(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},w=class e extends m{constructor({isOptional:e,value:t}){if(super({isOptional:e}),d(this,`value`),d(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:n(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},T=class e extends m{constructor({isOptional:e,element:t}){super({isOptional:e}),d(this,`element`),d(this,`kind`,`array`),t===void 0&&p(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},E=class e extends m{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),d(this,`key`),d(this,`value`),d(this,`kind`,`record`),t===void 0&&p(`v.record()`,`key`),n===void 0&&p(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},D=class e extends m{constructor({isOptional:e,members:t}){super({isOptional:e}),d(this,`members`),d(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&p(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},O={id:e=>new h({isOptional:`required`,tableName:e}),null:()=>new x({isOptional:`required`}),number:()=>new g({isOptional:`required`}),float64:()=>new g({isOptional:`required`}),bigint:()=>new _({isOptional:`required`}),int64:()=>new _({isOptional:`required`}),boolean:()=>new v({isOptional:`required`}),string:()=>new b({isOptional:`required`}),bytes:()=>new y({isOptional:`required`}),literal:e=>new w({isOptional:`required`,value:e}),array:e=>new T({isOptional:`required`,element:e}),object:e=>new C({isOptional:`required`,fields:e}),record:(e,t)=>new E({isOptional:`required`,key:e,value:t}),union:(...e)=>new D({isOptional:`required`,members:e}),any:()=>new S({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>O.union(e,O.null())},k=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),A=[`gateway-http`,`shared-fs`,`off`],j=[`inline`,`shared-fs`],M=[`reactive`,`sse`],N=`reactive`;O.object({mediaMode:O.optional(O.union(O.literal(`gateway-http`),O.literal(`shared-fs`),O.literal(`off`))),inboundMediaMode:O.optional(O.union(O.literal(`inline`),O.literal(`shared-fs`))),rehydration:O.optional(O.boolean()),mediaMaxMb:O.optional(O.number()),attachmentFixAttested:O.optional(O.boolean()),summarizeThresholdChars:O.optional(O.number()),curationEnabled:O.optional(O.boolean()),curationBudgetChars:O.optional(O.number()),converterAgentId:O.optional(O.string()),voiceEnabled:O.optional(O.boolean()),talkEnabled:O.optional(O.boolean()),widgetsEnabled:O.optional(O.boolean()),widgetPromptConfirm:O.optional(O.boolean()),voiceEngine:O.optional(O.union(O.literal(`browser`),O.literal(`gateway`))),voiceLang:O.optional(O.string()),voiceRate:O.optional(O.number()),voiceAutoRead:O.optional(O.boolean()),contentLocale:O.optional(O.string()),inboundAgentMount:O.optional(O.string()),outboundAgentMount:O.optional(O.string()),transcriptProjection:O.optional(O.union(O.literal(`off`),O.literal(`shadow`),O.literal(`on`))),promptInjections:O.optional(O.record(O.string(),O.object({enabled:O.optional(O.boolean()),template:O.optional(O.string())})))});var P={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function F(e,t){let n={};for(let i of o){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function I(e,t){let n={};for(let i of o){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function L(e,t){return{mediaMode:e.mediaMode??P.mediaMode,inboundMediaMode:e.inboundMediaMode??P.inboundMediaMode,rehydration:e.rehydration??P.rehydration,mediaMaxMb:e.mediaMaxMb??P.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??P.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??P.outboundAgentMount,promptInjections:F(e.promptInjections,t)}}var R=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function z(e,t,n){let r={},i=n=>{(e[n]!==P[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=I(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of R){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var B=e();function V({text:e}){return(0,B.jsx)(s,{delayDuration:150,children:(0,B.jsxs)(c,{children:[(0,B.jsx)(i,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,B.jsx)(k,{"aria-hidden":!0})})}),(0,B.jsx)(a,{className:`max-w-xs text-pretty`,children:e})]})})}function H({label:e,help:t}){return(0,B.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,B.jsx)(V,{text:t})]})}export{N as a,M as c,L as i,H as n,j as o,z as r,A as s,V as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{E as t,HZ as n}from"./api-CUskDNHD.js";import{a as r,i,n as a,o,r as s,t as c}from"./tooltip-D3qNpGhD.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=Object.defineProperty,u=(e,t,n)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t,n)=>u(e,typeof t==`symbol`?t:t+``,n),f=`https://docs.convex.dev/error#undefined-validator`;function p(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${f} for details.`)}var m=class{constructor({isOptional:e}){d(this,`type`),d(this,`fieldPaths`),d(this,`isOptional`),d(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},h=class e extends m{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),d(this,`tableName`),d(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},g=class e extends m{constructor(){super(...arguments),d(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},_=class e extends m{constructor(){super(...arguments),d(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},v=class e extends m{constructor(){super(...arguments),d(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},y=class e extends m{constructor(){super(...arguments),d(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},b=class e extends m{constructor(){super(...arguments),d(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends m{constructor(){super(...arguments),d(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends m{constructor(){super(...arguments),d(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends m{constructor({isOptional:e,fields:t}){super({isOptional:e}),d(this,`fields`),d(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&p(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},w=class e extends m{constructor({isOptional:e,value:t}){if(super({isOptional:e}),d(this,`value`),d(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:n(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},T=class e extends m{constructor({isOptional:e,element:t}){super({isOptional:e}),d(this,`element`),d(this,`kind`,`array`),t===void 0&&p(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},E=class e extends m{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),d(this,`key`),d(this,`value`),d(this,`kind`,`record`),t===void 0&&p(`v.record()`,`key`),n===void 0&&p(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},D=class e extends m{constructor({isOptional:e,members:t}){super({isOptional:e}),d(this,`members`),d(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&p(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},O={id:e=>new h({isOptional:`required`,tableName:e}),null:()=>new x({isOptional:`required`}),number:()=>new g({isOptional:`required`}),float64:()=>new g({isOptional:`required`}),bigint:()=>new _({isOptional:`required`}),int64:()=>new _({isOptional:`required`}),boolean:()=>new v({isOptional:`required`}),string:()=>new b({isOptional:`required`}),bytes:()=>new y({isOptional:`required`}),literal:e=>new w({isOptional:`required`,value:e}),array:e=>new T({isOptional:`required`,element:e}),object:e=>new C({isOptional:`required`,fields:e}),record:(e,t)=>new E({isOptional:`required`,key:e,value:t}),union:(...e)=>new D({isOptional:`required`,members:e}),any:()=>new S({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>O.union(e,O.null())},k=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),A=[`gateway-http`,`shared-fs`,`off`],j=[`inline`,`shared-fs`],M=[`reactive`,`sse`],N=`reactive`;O.object({mediaMode:O.optional(O.union(O.literal(`gateway-http`),O.literal(`shared-fs`),O.literal(`off`))),inboundMediaMode:O.optional(O.union(O.literal(`inline`),O.literal(`shared-fs`))),rehydration:O.optional(O.boolean()),mediaMaxMb:O.optional(O.number()),attachmentFixAttested:O.optional(O.boolean()),summarizeThresholdChars:O.optional(O.number()),curationEnabled:O.optional(O.boolean()),curationBudgetChars:O.optional(O.number()),converterAgentId:O.optional(O.string()),voiceEnabled:O.optional(O.boolean()),talkEnabled:O.optional(O.boolean()),widgetsEnabled:O.optional(O.boolean()),widgetPromptConfirm:O.optional(O.boolean()),voiceEngine:O.optional(O.union(O.literal(`browser`),O.literal(`gateway`))),voiceLang:O.optional(O.string()),voiceRate:O.optional(O.number()),voiceAutoRead:O.optional(O.boolean()),contentLocale:O.optional(O.string()),inboundAgentMount:O.optional(O.string()),outboundAgentMount:O.optional(O.string()),transcriptProjection:O.optional(O.union(O.literal(`off`),O.literal(`shadow`),O.literal(`on`))),promptInjections:O.optional(O.record(O.string(),O.object({enabled:O.optional(O.boolean()),template:O.optional(O.string())})))});var P={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function F(e,t){let n={};for(let i of o){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function I(e,t){let n={};for(let i of o){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function L(e,t){return{mediaMode:e.mediaMode??P.mediaMode,inboundMediaMode:e.inboundMediaMode??P.inboundMediaMode,rehydration:e.rehydration??P.rehydration,mediaMaxMb:e.mediaMaxMb??P.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??P.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??P.outboundAgentMount,promptInjections:F(e.promptInjections,t)}}var R=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function z(e,t,n){let r={},i=n=>{(e[n]!==P[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=I(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of R){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var B=e();function V({text:e}){return(0,B.jsx)(s,{delayDuration:150,children:(0,B.jsxs)(c,{children:[(0,B.jsx)(i,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,B.jsx)(k,{"aria-hidden":!0})})}),(0,B.jsx)(a,{className:`max-w-xs text-pretty`,children:e})]})})}function H({label:e,help:t}){return(0,B.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,B.jsx)(V,{text:t})]})}export{N as a,M as c,L as i,H as n,j as o,z as r,A as s,V as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AX as r,BX as ee,Bp as i,CX as a,DX as te,DZ as ne,EX as re,FX as o,FZ as ie,GX as ae,HX as s,IH as c,IX as l,KX as u,LX as d,MX as f,NX as p,OX as oe,PX as m,PZ as se,RX as ce,SX as le,TX as ue,TZ as de,UX as h,VX as fe,WX as pe,_X as me,bX as he,dX as ge,fX as _e,gX as ve,hX as ye,jX as g,kX as _,mX as be,pX as xe,t as v,vX as y,wX as b,xX as x,yX as S,zX as C,zp as w}from"./api-CUskDNHD.js";import{c as T,g as E,n as D,r as O,t as k}from"./dropdown-menu-BWxfj48Z.js";import{t as A}from"./download-Do4pcXOL.js";import{t as j}from"./checkbox-Czxm5pNj.js";import{t as M}from"./rotate-ccw-C-v_7YX7.js";import{t as Se}from"./trash-2-8oRd823U.js";import{a as N,i as P,n as F,r as I,t as L}from"./select-DCBGpD8v.js";import{a as Ce,c as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./alert-dialog-DRrmbZYC.js";import{t as R}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{r as je}from"./toast-C8rSAMgh.js";import{t as z}from"./badge-TiMZiv59.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-GXZ7yFCE.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return o();case`audio`:return m();case`video`:return p();case`pdf`:return f();case`document`:return g();case`archive`:return r();default:return _()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[o,f]=(0,U.useState)(G),[p,m]=(0,U.useState)(G),[g,_]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=se(v.files.softDelete),Y=je();function Ie(){t(G),r(G),f(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(y())}catch(e){Y.error(me(),e)}}let X=ie(v.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:o===G?void 0:o,category:p===G?void 0:p,includeAutoGenerated:g||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ne(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:de()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||o!==G||p!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":ae(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:pe()}),(0,W.jsx)(I,{value:`inbound`,children:h()}),(0,W.jsx)(I,{value:`outbound`,children:s()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:r,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:ee()}),Q.chats.map(e=>(0,W.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:o,onValueChange:f,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":C(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:ce()}),Q.instances.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:p,onValueChange:m,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":d(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(I,{value:G,children:l()}),Q.categories.map(e=>(0,W.jsx)(I,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(j,{checked:g,onCheckedChange:e=>_(e===!0),"aria-label":i()}),(0,W.jsx)(`span`,{children:i()})]}),$?(0,W.jsxs)(R,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(M,{size:14,"aria-hidden":!0}),x()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?_e():xe()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:te()}),(0,W.jsx)(B,{children:re()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:b()}),(0,W.jsx)(B,{className:`text-right`,children:a()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(z,{variant:`outline`,style:{marginLeft:6},children:w()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(z,{variant:`secondary`,children:e.direction===`inbound`?h():s()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(k,{children:[(0,W.jsx)(T,{asChild:!0,children:(0,W.jsx)(R,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,W.jsx)(E,{size:16})})}),(0,W.jsxs)(D,{align:`end`,children:[e.url?(0,W.jsx)(O,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),le()]})}):(0,W.jsxs)(O,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),be()]}),(0,W.jsxs)(O,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Se,{size:14}),S()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ge({cap:Be})}):null]}),(0,W.jsx)(Ae,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Te,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(we,{children:ve()}),(0,W.jsx)(Ce,{children:ye()})]}),(0,W.jsxs)(De,{children:[(0,W.jsx)(Oe,{children:c()}),(0,W.jsx)(Ee,{onClick:()=>void Le(),children:S()})]})]})})]})}export{q as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,jC as i}from"./api-DSJJn0d7.js";import{t as a}from"./search-BK6bzZNi.js";import{t as o}from"./rotate-ccw-BD-9XzMC.js";import{t as s}from"./button-Dio0PVrp.js";import{t as c}from"./input-BSpTsBA6.js";import{t as l}from"./TimeRangePicker-D3PJq1H8.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(a,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(s,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{gw as r,hw as i}from"./api-CUskDNHD.js";import{t as a}from"./search-D9Un2NMX.js";import{t as o}from"./rotate-ccw-C-v_7YX7.js";import{t as s}from"./button-CbHyzXCb.js";import{t as c}from"./input-DCbMcJYs.js";import{t as l}from"./TimeRangePicker-DzJYDik_.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(a,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(s,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,Ab as a,Ax as o,Bb as s,Bx as c,Cb as l,Cx as u,Db as d,Dx as f,E as p,Eb as m,Ex as h,FZ as g,Fb as _,Gb as v,Gx as y,Hb as b,Hx as ee,Ib as x,Jb as S,Jx as C,Kb as w,Kx as te,Lb as T,Mb as ne,Mx as E,Nb as D,Nx as re,Ob as ie,Ox as O,PZ as k,Pb as A,Px as j,Qx as M,Rb as ae,Rx as N,Sb as P,Sx as oe,Tb as F,Tx as se,Ub as ce,Ux as le,Vb as ue,Vx as I,Wb as de,Wx as fe,Xx as L,Yb as R,Yx as z,Zx as pe,_b as B,_x as me,aS as he,ab as ge,ax as _e,bb as ve,bx as ye,cS as be,cx as xe,dS as Se,dx as Ce,eS as we,ex as Te,fS as Ee,fb as De,fx as V,gS as Oe,gb as ke,gx as Ae,hS as je,hb as Me,hx as Ne,iS as Pe,ib as Fe,ix as Ie,jb as Le,jx as Re,kb as ze,kx as Be,lS as Ve,lx as He,mS as Ue,mb as We,mx as Ge,nS as Ke,nx as qe,oS as Je,ob as Ye,ox as Xe,pS as Ze,pb as Qe,px as $e,qb as et,qx as tt,rS as nt,rb as rt,rx as it,sS as at,sx as ot,t as H,tS as st,tx as ct,uS as lt,ux as ut,vb as dt,vx as ft,wb as pt,wx as mt,xb as ht,xx as gt,yb as _t,yx as vt,zb as yt,zx as bt}from"./api-CUskDNHD.js";import{t as xt}from"./chevron-left-DxPC6E1S.js";import{t as St}from"./chevron-right-BjOti-z8.js";import{t as U}from"./checkbox-Czxm5pNj.js";import{t as Ct}from"./server-BSDuYUUF.js";import{i as wt,n as Tt,r as Et,t as Dt}from"./users-DHMAZ7v8.js";import{t as W}from"./star-DjK6DoNA.js";import{t as Ot}from"./x-6-84PEVq.js";import{a as kt,i as At,n as jt,r as Mt,t as Nt}from"./select-DCBGpD8v.js";import{i as Pt,n as Ft,r as It,t as Lt}from"./tabs-dQ50HGoj.js";import{t as G}from"./button-CbHyzXCb.js";import{t as K}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{r as q}from"./toast-C8rSAMgh.js";import{t as J}from"./badge-TiMZiv59.js";import{a as Rt,n as zt,o as Bt,r as Vt,t as Ht}from"./dialog-DpoEg_Ex.js";import{t as Ut}from"./appHost-CH3EGcJw.js";import{n as Wt}from"./ConfirmDialog-Dy8WCeAF.js";import{t as Gt}from"./EntitySheet-D-JZB54h.js";import{a as Y,c as Kt,d as qt,f as Jt,i as Yt,l as Xt,n as Zt,o as Qt,r as $t,t as X,u as en}from"./groupManageView-DY6vPM1h.js";import{t as tn}from"./FilterBar-Bynn2H7k.js";import{t as nn}from"./DataTableShell-2_QPZexc.js";import{t as Z}from"./DetailChips-DaliQU_Q.js";var rn=p(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Q=t(e(),1),$=n(),an={name:``,description:``};function on(){let e=g(H.groups.listGroups,{}),t=g(H.me.getMe,{host:Ut})?.role===`admin`,n=k(H.groups.createGroup),a=k(H.groups.updateGroup),o=k(H.groups.deleteGroup),s=Wt(),c=q(),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(an),[h,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(``),b=(0,Q.useMemo)(()=>{if(!e)return e;let t=v.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,v]);function ee(){f(null),m(an),u(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),u(!0)}async function S(){try{d?await a({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m(an),f(null),u(!1)}catch(e){c.error(Ce(),e)}}async function C(e){if(await s({title:pe({name:e.name}),description:L(),confirmWord:e.name,confirmLabel:z(),cancelLabel:nt(),destructive:!0}))try{await o({groupId:e._id})}catch(e){c.error(ut(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),t?(0,$.jsx)(pn,{}):null,(0,$.jsx)(tn,{q:v,onQChange:y,onReset:()=>y(``),canReset:v!==``,searchPlaceholder:be()}),(0,$.jsx)(nn,{title:Oe(),rows:b,addLabel:Ue(),onAdd:t?ee:void 0,emptyHint:Ze(),columns:[{header:Ee(),cell:e=>e.name,sort:e=>e.name},{header:Se(),cell:e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:(0,$.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(wt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,$.jsx)(J,{variant:`secondary`,children:r({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:lt(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ct,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ve(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(rn,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:at(),onSelect:()=>_({groupId:e._id,name:e.name})},...t?[{label:Je(),onSelect:()=>x(e)},{label:he(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,$.jsx)(Gt,{open:l,onOpenChange:u,title:d?st():Ke(),description:we(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:Pe(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,$.jsx)(K,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:M()}),(0,$.jsx)(K,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,$.jsx)(ln,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||_(null)}})]})}var sn=8;function cn({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(xt,{size:14,"aria-hidden":!0}),c()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":N({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[bt(),(0,$.jsx)(St,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=g(H.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,s=g(H.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),c=g(H.groups.listAssignableUsers,n&&a?{}:`skip`),l=k(H.groups.addMember),u=k(H.groups.removeMember),d=k(H.groups.bulkSetMembers),f=k(H.groups.setGroupManager),p=q(),[m,h]=(0,Q.useState)(``),[_,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(`members`),[w,T]=(0,Q.useState)(1),[ne,D]=(0,Q.useState)(null),[re,ie]=(0,Q.useState)(new Set),O=(0,Q.useRef)(null),M=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ae=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),N=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),P=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>X(e.instanceName,e.agentId))),[i]),oe=(0,Q.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?X(e.instanceName,e.agentId):null},[i]);(0,Q.useEffect)(()=>{h(``),b(``),S(`members`),T(1),D(null),O.current=null},[n,e]),(0,Q.useEffect)(()=>{T(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&O.current!==e&&(O.current=e,ie(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let F=(0,Q.useMemo)(()=>c?Yt(c,m,re):[],[c,m,re]);async function se(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){p.error(He(),Y(e))}}async function ue(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error($e(),e)}}let L=qt(F,e=>M.has(e.userId)),R=F.filter(e=>M.has(e.userId)).length,z=Xt(F,w,sn);async function pe(){if(!e||F.length===0)return;let t=F.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:L!==`all`})}catch(e){p.error(He(),Y(e))}}let B=(e,t)=>(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":de({user:t}),title:de({user:t}),onClick:()=>D({userId:e,label:t}),children:[(0,$.jsx)(Et,{size:13,"aria-hidden":!0}),v()]});return(0,$.jsx)(Ht,{open:n,onOpenChange:r,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:C({name:t})}),(0,$.jsx)(Vt,{children:i&&!a?ot():tt()})]}),(0,$.jsxs)(Lt,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,$.jsxs)(It,{className:`w-full`,children:[(0,$.jsxs)(Pt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Dt,{size:13,"aria-hidden":!0}),te(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(Pt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),fe(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,$.jsxs)(Pt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(rn,{size:13,"aria-hidden":!0}),mt(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(Ft,{value:`members`,children:i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:E()}):a?c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:E()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:m,onChange:e=>h(e.target.value),placeholder:y(),className:`oc-access__search`}),F.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,$.jsxs)($.Fragment,{children:[F.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:L===`all`||L===`some`&&`indeterminate`,onCheckedChange:()=>void pe(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[R,` / `,F.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:z.pageItems.map(e=>{let t=M.has(e.userId),n=Jt(e),r=ae.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:t,onCheckedChange:()=>void se(e.userId,t),"aria-label":j({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&N.has(e.userId)?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:ce()}):null,(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:en(e.role)}),t?B(e.userId,n.primary):null,(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Ge():Ne(),title:r?Ge():Ne(),onClick:()=>void ue(e.userId,r),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(cn,{page:z.page,pageCount:z.pageCount,onPage:T})]})]}):e?(0,$.jsx)(un,{groupId:e,members:i.members,agentsButton:B}):null}),(0,$.jsxs)(Ft,{value:`agents`,children:[i&&!a?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:A()}):null,s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:E()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Be()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:_,onChange:e=>b(e.target.value),placeholder:le(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,defaultKey:oe,viewerIsAdmin:a,query:_},`${e}-${t._id}`))})]})]}),(0,$.jsx)(Ft,{value:`charts`,children:(0,$.jsx)(mn,{groupId:e})})]}),(0,$.jsx)(dn,{groupId:e,member:ne,onOpenChange:e=>{e||D(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=g(H.groupInvites.listGroupInviteRequests,{groupId:e}),i=k(H.groupInvites.requestGroupInvite),a=k(H.groups.removeMember),o=Wt(),s=q(),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(1),f=Xt(t,u,sn);async function p(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(qe())}catch(e){s.error(ct(),e)}}async function m(t,n){if(await o({title:R({user:n}),description:et({user:n}),confirmLabel:w(),cancelLabel:nt(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(He(),Y(e))}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void p(e),children:[(0,$.jsx)(K,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:Ie(),"aria-label":Xe()}),(0,$.jsxs)(G,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),it()]})]}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}),t.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:b()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:f.pageItems.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:ce()}):null,n(e.userId,e.label),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Ae(),title:Ae(),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null}),(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":R({user:e.label}),title:e.manager?S():e.lastGroup?De():R({user:e.label}),onClick:()=>void m(e.userId,e.label),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,$.jsx)(cn,{page:f.page,pageCount:f.pageCount,onPage:d})]}),r!==void 0&&r.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:Te()}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsx)(J,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Qt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let r=g(H.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),i=k(H.groups.setMemberAgents),a=k(H.groups.setMemberDefaultAgent),o=q();async function s(e){try{await e()}catch(e){o.error(Qe(),e)}}let c=r?.agents??[],l=new Map(c.map(e=>[X(e.instanceName,e.agentId),e])),u=[...l.keys()],d=new Set(c.filter(e=>e.allowed).map(e=>X(e.instanceName,e.agentId)));function f(n){if(!e||!t||!r)return;let a=Kt(u,d,r.restricted,n).map(e=>{let t=l.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});s(()=>i({groupId:e,userId:t.userId,agents:a}))}return(0,$.jsx)(Ht,{open:t!==null,onOpenChange:n,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:P({user:t?.label??``})}),(0,$.jsx)(Vt,{children:ht()})]}),r===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:E()}):r===null||c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:We()}):(0,$.jsxs)($.Fragment,{children:[r.settable?null:(0,$.jsx)(`p`,{className:`oc-access__hint`,children:rt()}),r.adminNarrowed?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ye()}):null,r.restrictedByAdmin&&!r.viewerIsAdmin?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Fe()}):null,(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,children:r.restricted?_t():ve()}),r.restricted?(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin,onClick:()=>e&&t?void s(()=>i({groupId:e,userId:t.userId,agents:null})):void 0,children:dt()}):null]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(n=>{let i=X(n.instanceName,n.agentId),o=n.displayName??n.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:n.allowed,disabled:!r.settable||r.restrictedByAdmin&&!r.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>f(i),"aria-label":B({name:o})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:o,children:o}),n.limitedByAdmin?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:ge()}):null,n.state===`deleted`?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:se()}):null,n.allowed?n.isMemberDefault?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!r.settable,"aria-label":ke(),title:ke(),onClick:()=>e&&t?void s(()=>a({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,disabled:!r.settable,"aria-label":Me(),title:Me(),onClick:()=>e&&t?void s(()=>a({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,$.jsx)(W,{size:14})}):null]},i)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:o,query:s}){let c=g(H.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),u=k(H.groups.assignAgentToGroup),p=k(H.groups.removeAgentFromGroup),_=k(H.groups.bulkSetGroupAgents),v=k(H.groups.claimAgentForGroup),y=k(H.groups.setGroupDefaultAgent),b=q(),[ee,x]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{x(1)},[s]),!e)return null;let S=$t(c?.agents??[],s),C=c?.discovery&&!c.discovery.lastPollOk,w=e=>Zt({assigned:r.has(X(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},o),te=S.filter(e=>w(e)!==`claim`),T=S.filter(e=>w(e)===`claim`);if(s.trim()&&S.length===0)return null;let E=te.filter(e=>w(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),A=qt(E,e=>r.has(X(t,e.agentId))),j=Xt(te,ee,sn);async function M(n,r){try{r?await p({groupId:e,instanceName:t,agentId:n}):await u({groupId:e,instanceName:t,agentId:n})}catch(e){b.error(xe(),Y(e))}}async function ae(){if(E.length===0)return;let n=E.map(e=>e.agentId);try{await _({groupId:e,instanceName:t,agentIds:n,assigned:A!==`all`})}catch(e){b.error(xe(),Y(e))}}async function N(n){try{await v({groupId:e,instanceName:t,agentId:n})}catch(e){b.error(ze(),e)}}async function P(n){try{await y({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){b.error(l(),e)}}let oe=e=>e.reservedForGroup?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:ie()}):e.reserved?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?m():d({group:e.reservedGroupName})}):null;return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),C?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:h()}):null]}),c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Re()}):S.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:C?f():O()}):(0,$.jsxs)($.Fragment,{children:[E.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:A===`all`||A===`some`&&`indeterminate`,onCheckedChange:()=>void ae(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,j.pageItems.map(e=>{let n=X(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=w(e)===`locked`;return(0,$.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,$.jsx)(U,{checked:a,disabled:s&&!a,onCheckedChange:()=>void M(e.agentId,a),"aria-label":re({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,oe(e),o?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:se()}):null,a?i===n?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":F(),title:F(),onClick:()=>void P(null),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":pt(),title:pt(),onClick:()=>void P(e.agentId),children:(0,$.jsx)(W,{size:14})}):null]},e.agentId)}),(0,$.jsx)(cn,{page:j.page,pageCount:j.pageCount,onPage:x}),T.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:D()}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ne()}),T.map(e=>{let t=e.displayName??e.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":a({name:t}),onClick:()=>void N(e.agentId),children:Le()})]},e.agentId)})]}):null]})]})}function pn(){let e=g(H.groupInvites.listPendingInviteRequests,{}),t=k(H.groupInvites.decideGroupInvite),n=q();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(_(),e)}}return(0,$.jsxs)(`section`,{className:`oc-invites`,"aria-label":ue(),children:[(0,$.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),ue(),(0,$.jsx)(J,{variant:`secondary`,children:e.length})]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,s({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?T():x()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:yt()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:ae()})]},e._id))})]})}function mn({groupId:e}){let t=g(H.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=k(H.charts.assignChartToGroup),r=k(H.charts.removeChartFromGroup),i=k(H.charts.setGroupDefaultChart),a=k(H.charts.addChartToGroupPool),o=k(H.charts.removeChartFromGroupPool),s=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:E()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:u()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(V(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(V(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(V(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(V(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":vt({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":ft(),title:ft(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:me()}):null,d?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":ye({name:e.name}),title:ye({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,$.jsxs)(Nt,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(At,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(kt,{placeholder:gt()})}),(0,$.jsx)(jt,{children:l.map(e=>(0,$.jsx)(Mt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):null:null]})}export{on as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$I as i,AF as a,AI as o,AW as s,BF as c,BI as l,CF as u,CI as d,DF as f,DI as p,EF as m,EI as h,FF as g,FI as _,FZ as v,Ft as y,GF as b,GI as x,HF as S,HI as C,IF as w,II as T,It as ee,JF as te,JI as E,Jm as ne,KF as re,KI as ie,LF as ae,LI as oe,Lt as se,MF as ce,MI as D,MZ as O,Mt as le,NF as ue,NI as de,Nt as fe,OF as pe,OI as me,PF as he,PI as ge,PZ as k,Pt as _e,QF as ve,QI as ye,RF as be,RI as xe,Rt as Se,SF as Ce,SI as we,TF as Te,TI as Ee,UF as De,UI as Oe,VF as ke,VI as Ae,WF as je,WI as Me,XF as A,XI as Ne,Xm as Pe,YI as Fe,Ym as Ie,ZF as Le,ZI as Re,_I as ze,_r as Be,_s as Ve,aI as He,aL as Ue,as as We,bF as Ge,bI as Ke,br as qe,bs as Je,cI as Ye,cL as Xe,cs as Ze,dI as Qe,dL as $e,dd as et,dr as tt,ds as nt,eI as rt,eL as it,eb as at,fI as ot,fL as st,fr as ct,fs as lt,gI as ut,gr as dt,gs as ft,hI as pt,hL as mt,hr as ht,hs as gt,iI as _t,iL as vt,ij as yt,is as bt,jF as xt,jI as j,jW as M,jt as St,kF as Ct,kI as wt,lI as Tt,lL as Et,ld as Dt,ls as Ot,mI as kt,mL as At,mr as jt,ms as Mt,nI as Nt,nL as Pt,nb as Ft,oI as It,oL as Lt,os as Rt,pI as zt,pL as Bt,pr as Vt,ps as Ht,qF as Ut,qI as Wt,qm as Gt,rI as Kt,rL as qt,rj as Jt,sI as Yt,sL as Xt,ss as Zt,t as N,tI as P,tL as F,tb as Qt,uI as $t,uL as en,ud as tn,us as nn,vI as rn,vr as an,vs as on,wF as sn,wI as cn,xF as ln,xI as un,yI as dn,yr as fn,ys as pn,zF as mn,zI as hn,zt as gn}from"./api-CUskDNHD.js";import{a as _n,c as vn}from"./FieldLabel-D63ry-fi.js";import{t as yn}from"./checkbox-Czxm5pNj.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-DCBGpD8v.js";import{n as bn,r as xn,t as Sn}from"./popover-DiT_Oo6e.js";import{t as V}from"./button-CbHyzXCb.js";import{t as H}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{r as U}from"./toast-C8rSAMgh.js";import{t as W}from"./badge-TiMZiv59.js";import{a as G,n as K,o as q,r as Cn,t as wn}from"./dialog-DpoEg_Ex.js";import{n as Tn}from"./ConfirmDialog-Dy8WCeAF.js";import{t as En}from"./EntitySheet-D-JZB54h.js";import{a as Dn}from"./groupManageView-DY6vPM1h.js";import{t as On}from"./DataTableShell-2_QPZexc.js";import{InstanceConfigDialog as kn}from"./BridgeTab-CBE4zTQ1.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],An=new Set(Y),jn=`conversational`;function Mn(e){let t=new Set((e??[]).filter(e=>An.has(e)));return t.size===0?[jn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:_n,widgetsEnabled:!0,widgetPromptConfirm:!1},Nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Pn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Fn(){let e=v(N.admin.listInstances,{}),t=v(N.agents.listAllInstanceAgents,{}),n=k(N.admin.upsertInstance),r=k(N.widgets.setInstanceWidgets),a=k(N.admin.deleteInstance),o=U(),[s,c]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Z),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,b]=(0,J.useState)(null),[S,w]=(0,J.useState)(null);async function T(){try{let t=await n({instanceId:S??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,...u.kind===`openclaw`?{authMode:u.authMode,personScopes:u.personScopes,identitySource:u.identitySource,participantIdentity:u.participantIdentity,managePermissionModes:u.managePermissionModes,systemIdentity:u.systemIdentity||void 0}:{},streamTransport:u.streamTransport}),i=S===null?null:e?.find(e=>e._id===S),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;u.kind===`openclaw`&&(u.widgetsEnabled!==a||u.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:u.widgetsEnabled,promptConfirm:u.widgetPromptConfirm}),d(Z),w(null),c(!1)}catch(e){o.error(Bt(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[st(),(0,X.jsx)(`strong`,{children:$e()}),en()]}),(0,X.jsx)(On,{title:Et(),rows:e,addLabel:Xe(),onAdd:()=>{w(null),d(Z),c(!0)},emptyHint:Xt(),columns:[{header:Lt(),cell:e=>e.name,sort:e=>e.name},{header:Ue(),cell:e=>(0,X.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:vt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:qt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:mt(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?f():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:i(),onSelect:()=>{w(e._id),d(Pn(e)),c(!0)}},{label:At(),onSelect:()=>m(e.name)},{label:xe(),onSelect:()=>b(e)},{label:Pt(),onSelect:()=>g(e)},{label:F(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:F(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,X.jsx)(En,{open:s,onOpenChange:c,title:S?ye():it(),description:Ne(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:T,submitLabel:Fe(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:E(),children:[(0,X.jsx)(H,{value:u.name,disabled:S!==null,onChange:e=>d({...u,name:e.target.value})}),S?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Re()}):null]}),(0,X.jsx)($,{label:Wt(),children:(0,X.jsxs)(B,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,X.jsx)($,{label:et(),children:(0,X.jsxs)(B,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`ws`,children:tn()}),(0,X.jsx)(z,{value:`rest`,children:Dt()})]})]})}):null,(0,X.jsx)($,{label:ie(),children:(0,X.jsx)(H,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:x(),children:(0,X.jsx)(H,{value:u.bridgeUrl,placeholder:Me(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:Oe(),children:(0,X.jsx)(H,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,X.jsxs)($,{label:yt(),children:[(0,X.jsxs)(B,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsx)(R,{children:vn.map(e=>(0,X.jsx)(z,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Jt()})]}),(0,X.jsx)($,{label:C(),children:(0,X.jsx)(H,{value:u.gatewayVersion,placeholder:Ae(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),u.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:nn(),children:[(0,X.jsxs)(B,{value:u.authMode,onValueChange:e=>d({...u,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`token`,children:Ot()}),(0,X.jsx)(z,{value:`trusted-proxy`,children:Ze()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.authMode===`trusted-proxy`?Rt():Zt()})]}),u.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:Je(),children:[(0,X.jsxs)(B,{value:u.personScopes,onValueChange:e=>d({...u,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`capped`,children:pn()}),(0,X.jsx)(z,{value:`full`,children:on()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.personScopes===`full`?ft():Ve()})]}):null,u.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:gt(),children:[(0,X.jsxs)(B,{value:u.identitySource,onValueChange:e=>d({...u,identitySource:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`canonical`,children:Mt()}),(0,X.jsx)(z,{value:`email`,children:Ht()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.identitySource===`email`?nt():lt()})]}):null,u.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:qe(),children:[(0,X.jsxs)(B,{value:u.participantIdentity,onValueChange:e=>d({...u,participantIdentity:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`owner`,children:fn()}),(0,X.jsx)(z,{value:`self`,children:an()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.participantIdentity===`self`?tt():Be()})]}):null,u.kind===`openclaw`?(0,X.jsxs)($,{label:dt(),children:[(0,X.jsxs)(B,{value:u.managePermissionModes?`on`:`off`,onValueChange:e=>d({...u,managePermissionModes:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:ht()}),(0,X.jsx)(z,{value:`on`,children:jt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.managePermissionModes?ct():Vt()})]}):null,u.kind===`openclaw`?(0,X.jsxs)($,{label:gn(),children:[(0,X.jsxs)(B,{value:u.widgetsEnabled?`on`:`off`,onValueChange:e=>d({...u,widgetsEnabled:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`on`,children:Se()}),(0,X.jsx)(z,{value:`off`,children:se()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:u.widgetsEnabled?ee():y()})]}):null,u.kind===`openclaw`&&u.widgetsEnabled?(0,X.jsxs)($,{label:_e(),children:[(0,X.jsxs)(B,{value:u.widgetPromptConfirm?`on`:`off`,onValueChange:e=>d({...u,widgetPromptConfirm:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:fe()}),(0,X.jsx)(z,{value:`on`,children:le()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:St()})]}):null,u.authMode===`trusted-proxy`?(0,X.jsx)($,{label:We(),children:(0,X.jsx)(H,{value:u.systemIdentity,placeholder:bt(),onChange:e=>d({...u,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:l(),children:(0,X.jsx)(H,{value:u.gatewayHttpUrl,placeholder:hn(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(Wn,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,X.jsx)(kn,{instance:h,onClose:()=>g(null)},h._id):null,_?(0,X.jsx)(In,{instance:_,onClose:()=>b(null)},_._id):null]})}function In({instance:e,onClose:t}){let n=v(N.instanceSecrets.listInstanceSecretStatus,{}),r=Nn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:oe({instance:e.displayName??e.name})}),(0,X.jsx)(Cn,{children:T()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(zn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(Rn,{instance:e})}),(0,X.jsx)(Ln,{instance:e})]})})}function Ln({instance:e}){let t=O(N.instanceSync.forceInstanceSync),n=U(),[r,i]=(0,J.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ut());break;case`no_agents`:n.success(kt());break;case`no_bridge_url`:n.error(zt());break;case`deploy_misconfigured`:n.error(ot());break;case`unauthorized`:n.error($t());break;case`not_served`:n.error(Tt());break;default:n.error(Qe());break}}catch(e){n.error(pt(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?ze():rn()})})]})}function Rn({instance:e}){let t=v(N.bridgeAuth.listBridgeAuthStatus,{}),n=O(N.bridgeAuth.mintBridgeSecret),i=k(N.bridgeAuth.revokeBridgeSecret),a=U(),[o,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),[d,f]=(0,J.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!o){c(!0);try{let t=await n({instanceId:e._id});u(t.plaintext),f(!1)}catch(e){a.error(P(),e)}finally{c(!1)}}}async function g(){if(!o){c(!0);try{await i({instanceId:e._id}),u(null),a.success(Nt())}catch(e){a.error(P(),e)}finally{c(!1)}}}async function _(){if(l)try{await navigator.clipboard.writeText(l),f(!0)}catch{}}return(0,X.jsxs)($,{label:Yt(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:It()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:m?`outline`:`secondary`,children:m?`${D()} · ${p.prefix}…${p.lastFour}`:j()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void h(),disabled:o,children:m?_t():He()}),m?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:o,children:Kt()}):null]})]}),l?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:rt()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:d?M():s()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),f(!1)},children:r()})]}):null]})}function zn({instanceId:e,field:t,updatedAt:n}){let i=O(N.instanceSecrets.setInstanceSecret),a=k(N.instanceSecrets.clearInstanceSecret),c=O(N.deviceIdentity.generateDeviceIdentity),l=U(),[u,f]=(0,J.useState)(``),[m,g]=(0,J.useState)(!1),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(!1),S=n!==null,C=t===`deviceIdentity`,w=t===`token`?_():t===`deviceIdentity`?ge():de();async function T(){if(!(!u.trim()||m)){g(!0);try{await i({instanceId:e,field:t,plaintext:u}),f(``),y(null),x(!1),l.success(h())}catch(e){l.error(Ee(),e)}finally{g(!1)}}}async function ee(){if(!m){g(!0);try{await a({instanceId:e,field:t}),y(null),x(!1),l.success(cn())}catch(e){l.error(Ee(),e)}finally{g(!1)}}}async function te(){if(!m){g(!0);try{let t=await c({instanceId:e});y(t),x(!1),l.success(un())}catch(e){l.error(dn(),e)}finally{g(!1)}}}let E=v?`openclaw devices approve ${v.id}`:``;async function ne(){if(E)try{await navigator.clipboard.writeText(E),x(!0)}catch{}}return(0,X.jsxs)($,{label:w,children:[C?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:S?`outline`:`secondary`,children:S?D():j()}),(0,X.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:u,placeholder:S?wt():o(),onChange:e=>f(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void T(),disabled:m||u.trim().length===0,children:me()}),C?(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:m,children:d()}):null,S?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:m,children:p()}):null]})]}),v?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:un()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:b?M():s()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{y(null),x(!1)},children:r()})]}):null]})}var Bn={conversational:S,documentary:c,summarizer:Pe,curator:ne},Vn={conversational:ke,documentary:mn,summarizer:Ie,curator:Gt},Hn=e=>(Bn[e]??(()=>e))(),Q=e=>(Vn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:re()}),t.map(e=>(0,X.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:Hn(e)},e)),(0,X.jsxs)(Sn,{children:[(0,X.jsx)(xn,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:b()})}),(0,X.jsxs)(bn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:je()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:De()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(yn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Hn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=v(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=k(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=k(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Mn(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=k(N.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=k(N.agents.removeInstanceAgent),d=k(N.agents.setAgentReservation),p=v(N.groups.listGroupLabels,t?{}:`skip`),h=Tn(),_=U();async function y(t,n){if(e&&await h({title:u({name:n}),description:Ce(),confirmLabel:sn()}))try{await d({instanceName:e,agentId:t,groupId:null})}catch(e){_.error(A(),Dn(e))}}async function b(t,n,r){if(!e)return;let i=(p??[]).find(e=>e._id===r)?.name??`?`;if(await h({title:Ft({name:n,group:i}),description:Qt({group:i}),confirmLabel:at()}))try{await d({instanceName:e,agentId:t,groupId:r})}catch(e){_.error(A(),Dn(e))}}async function x(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){_.error(A(),e)}}async function S(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){_.error(A(),e)}}async function C(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){_.error(A(),e)}}async function T(t,n){if(e&&await h({title:w({name:n}),description:g(),confirmLabel:he(),destructive:!0}))try{await l({instanceName:e,agentId:t}),_.success(ue())}catch(e){_.error(A(),e)}}return(0,X.jsx)(wn,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:ve({name:e??``})}),(0,X.jsx)(Cn,{children:Le()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?xt():r.discovery.lastPollOk?a():Ct({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:pe()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(yn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void x(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,X.jsx)(W,{variant:`outline`,children:t.reserved.groupName===null?Te():m({group:t.reserved.groupName})}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:Ge()}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void T(t.agentId,a),children:ae()})]}):i?(0,X.jsx)(W,{variant:`default`,children:f()}):(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void S(t.agentId),children:be()})]}),t.reserved?(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void y(t.agentId,a),children:sn()}),(0,X.jsxs)(B,{value:``,onValueChange:e=>void b(t.agentId,a,e),children:[(0,X.jsx)(L,{size:`sm`,className:`h-7`,children:(0,X.jsx)(I,{placeholder:ln()})}),(0,X.jsx)(R,{children:(p??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,X.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void C(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){_.error(A(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(H,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:te(),"aria-label":Ut(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Fn as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,FZ as i,JR as a,MZ as o,PZ as s,QR as c,XR as l,YR as u,ZR as d,_g as f,az as p,dg as m,ez as h,fg as g,gg as _,hg as v,iz as y,lg as b,mg as x,nz as S,oz as C,pg as w,qR as T,rz as E,t as D,tz as O,ug as k}from"./api-CUskDNHD.js";import{t as A}from"./checkbox-Czxm5pNj.js";import"./select-DCBGpD8v.js";import{t as j}from"./button-CbHyzXCb.js";import{t as M}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{t as N}from"./badge-TiMZiv59.js";var P=t(e(),1),F=n();function I(){let e=i(D.integrations.status.status,{}),t=s(D.admin.setIntegrationConfig),[n,o]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&o(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:C()});let m=n,g=(e,t,n)=>o({...m,[e]:{...m[e],[t]:n}}),b=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,F.jsx)(`strong`,{children:y()}),` `,E()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:S()}):(0,F.jsx)(N,{variant:`outline`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:h()}),note:r(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(M,{value:m.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>g(`langfuse`,`host`,e.target.value),onBlur:()=>b(`langfuse`,{host:m.langfuse.host??``})})}),(0,F.jsx)(z,{label:T(),checked:m.langfuse.enabled??!0,onChange:e=>{g(`langfuse`,`enabled`,e),b(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:S()}):(0,F.jsx)(N,{variant:`outline`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:h()}),note:c(),children:[(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:m.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>g(`opik`,`baseUrl`,e.target.value),onBlur:()=>b(`opik`,{baseUrl:m.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:u(),children:(0,F.jsx)(M,{value:m.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||a(),onChange:e=>g(`opik`,`workspace`,e.target.value),onBlur:()=>b(`opik`,{workspace:m.opik.workspace??``})})}),(0,F.jsx)(z,{label:T(),checked:m.opik.enabled??!0,onChange:e=>{g(`opik`,`enabled`,e),b(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:S()}):(0,F.jsx)(N,{variant:`outline`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:f()}),note:_(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(M,{value:m.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>g(`otlp`,`endpoint`,e.target.value),onBlur:()=>b(`otlp`,{endpoint:m.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:T(),checked:m.otlp.enabled??!0,onChange:e=>{g(`otlp`,`enabled`,e),b(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(A,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=o(D.integrations.otlpSecret.setOtlpHeaders),n=s(D.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),d=async()=>{u(!0),c(null);try{await t({headersJson:r}),i(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?w():g(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(j,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void d(),children:m()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:k()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:b()})]})}export{I as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,A as i,By as a,D as o,FZ as s,Fy as c,Hy as l,Iy as u,Ly as d,O as f,PZ as p,Q as m,Ry as h,Sy as g,Uy as _,Vy as ee,Wy as te,_y as v,by as y,et as b,gy as x,hy as S,iW as C,k as w,t as T,tt as E,zy as D}from"./api-CUskDNHD.js";import{t as ne}from"./loader-circle-BO0Lx5va.js";import{t as re}from"./rotate-ccw-C-v_7YX7.js";import"./convexApi-BPSJUy2j.js";import{r as ie,t as O}from"./capabilities-CASxhKEd.js";var k=t(e(),1),A={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`,showReasoning:`segmented`};function j(e,t){return A[e]===`segmented`&&t<=5?`segmented`:`list`}function M(e,t){return e!=null&&e[t]!==void 0}var N=[`inherit`,`fast`,`standard`];function P(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function F(e){return e===`inherit`?d():e===`fast`?u():c()}function I(e){return e===`inherit`?null:e===`fast`}function L(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var z={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function B(e,t){return z[e]??t}function V(e){return H(e).used}function H(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function U(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function ae(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=V(e),n=U(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function W(e){return H(e).source}function G(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function K(e,t){let n=G(e,t);return n===null?null:g({pct:n,used:L(e),total:L(t)})}function q(e){return y({level:e??`full`})}function J(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?v({cost:e.toFixed(2),tokens:L(t)}):n?x({cost:e.toFixed(2)}):r?S({tokens:L(t)}):null}function oe(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function se(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=V(e),i=U(e);if(r===null||i===null)return null;let a=G(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function ce(e,t){let n=t?b():r();return e===`agent`?{inheritedLabel:i(),resetLabel:f({value:n})}:e===`instance`?{inheritedLabel:w(),resetLabel:o({value:n})}:{}}function Y(e,t){let n=s(T.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,k.useCallback)(e=>O(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}var X=n();function Z(e){let t=p(T.chats.setSessionKnob),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(null);return{apply:(0,k.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:n===`showReasoning`?o.showReasoning=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function Q({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:o,help:s,children:c,resettable:u=!0,inheritedLabel:d,resetLabel:f}){return(0,X.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,X.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,X.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,X.jsx)(ne,{size:13,className:`oc-spanel__spin`,"aria-label":l()}):t?u?(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:f??_(),"aria-label":f??_(),onClick:n,children:(0,X.jsx)(re,{size:12,"aria-hidden":!0})}):null:(0,X.jsx)(`span`,{className:`oc-spanel__badge`,children:d??te()})]}),(0,X.jsx)(`div`,{className:`oc-spanel__ctl`,children:c}),s?(0,X.jsx)(`p`,{className:`oc-spanel__help`,children:s}):null,i?(0,X.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[ee(),(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:o,children:a()})]}):null]})}function le({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,X.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__seg-btn${t===e.id?` is-active`:``}`,"aria-pressed":t===e.id,title:e.title??e.label,"aria-label":e.title??e.label,disabled:i,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function ue({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,X.jsxs)(`select`,{className:`oc-spanel__select`,value:t??``,disabled:r,"aria-label":i,onChange:e=>{e.target.value&&e.target.value!==t&&n(e.target.value)},children:[t===null?(0,X.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,X.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function $({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return j(e,t.length)===`list`?(0,X.jsx)(ue,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,X.jsx)(le,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function de({chatId:e,sm:t,settings:n}){let{apply:r,pending:i,error:a}=Z(e),{can:o}=Y(e),s=i!==null,c=(0,k.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),l=t?.thinkingLevels??[],u=t?.availableModels??[],d=P(n),f=ie(o,{hasModels:u.length>0,hasLevels:l.length>0,described:t!==null});return(0,X.jsxs)(X.Fragment,{children:[f.model?(0,X.jsx)(Q,{label:C(),overridden:M(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:c,resettable:f.reset,children:(0,X.jsx)($,{field:`model`,options:u,value:t?.model??null,onChange:e=>void r(`model`,e),disabled:s,ariaLabel:C()})}):null,f.thinking?(0,X.jsx)(Q,{label:D(),overridden:M(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:c,resettable:f.reset,children:(0,X.jsx)($,{field:`thinkingLevel`,ariaLabel:D(),options:l.map(e=>({id:e.id,label:B(e.id,R(e.label)),title:R(e.label)})),value:t?.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:s})}):null,(0,X.jsx)(fe,{chatId:e,overridden:M(n,`showReasoning`),onApply:e=>void r(`showReasoning`,e),pending:i===`showReasoning`,error:a?.field===`showReasoning`,onRetry:c,disabled:s}),f.speed?(0,X.jsx)(Q,{label:h(),overridden:M(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:c,resettable:f.reset,children:(0,X.jsx)($,{field:`fastMode`,ariaLabel:h(),options:N.map(e=>({id:e,label:F(e)})),value:d,onChange:e=>void r(`fastMode`,I(e)),disabled:s})}):null]})}function fe({chatId:e,overridden:t,onApply:n,pending:i,error:a,onRetry:o,disabled:c}){let l=s(T.messages.getSessionMeta,{chatId:e}),u=l?.showReasoning===!0,{inheritedLabel:d,resetLabel:f}=ce(l?.showReasoningDefaultSource,l?.showReasoningDefault===!0);return(0,X.jsx)(Q,{label:E(),overridden:t,inheritedLabel:d,resetLabel:f,onReset:()=>n(null),pending:i,error:a,onRetry:o,help:m(),children:(0,X.jsx)($,{field:`showReasoning`,ariaLabel:E(),options:[{id:`on`,label:b()},{id:`off`,label:r()}],value:l==null?null:u?`on`:`off`,onChange:e=>n(e===`on`),disabled:c})})}export{R as a,G as c,J as d,V as f,q as g,M as h,oe as i,se as l,L as m,de as n,K as o,U as p,Y as r,ae as s,$ as t,W as u};