@lacneu/atrium 0.13.1 → 0.14.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 (70) hide show
  1. package/dist/assets/AccessTab-De0sJr0t.js +1 -0
  2. package/dist/assets/{AdvancedFilter-Cjt4cP7-.js → AdvancedFilter-CO_XQQz0.js} +1 -1
  3. package/dist/assets/AgentFilesTab-BpgoJ9RY.js +3 -0
  4. package/dist/assets/AnomaliesTab-DMFRiLxu.js +1 -0
  5. package/dist/assets/AuditTab-BLsAgUqt.js +1 -0
  6. package/dist/assets/BridgeTab-BWExnIBq.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-DNy4hn4P.js +1 -0
  8. package/dist/assets/{DataTableShell-DY8nOACn.js → DataTableShell-B44W_69s.js} +1 -1
  9. package/dist/assets/{DetailChips-DTltyjOV.js → DetailChips-SZr2PERg.js} +1 -1
  10. package/dist/assets/FeedbacksTab-B3mTF8gA.js +1 -0
  11. package/dist/assets/{FieldLabel-BAi9qHY_.js → FieldLabel-Dn9ltnAG.js} +2 -2
  12. package/dist/assets/FilesTab-DrFmoPZJ.js +1 -0
  13. package/dist/assets/{FilterBar-B3HyBcMN.js → FilterBar-RytfYInF.js} +1 -1
  14. package/dist/assets/GroupsTab-NeGxwsGw.js +1 -0
  15. package/dist/assets/InstancesTab-D-zHqwWo.js +1 -0
  16. package/dist/assets/IntegrationsTab-BDbA-XQW.js +1 -0
  17. package/dist/assets/KpiTab-CD6Rk_3X.js +1 -0
  18. package/dist/assets/PreferencesTab-BAAGt839.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-Cb-uPfgC.js +2 -0
  20. package/dist/assets/RolesTab-BY0jkajs.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-BeNR30lB.js +1 -0
  22. package/dist/assets/ThemeShowroom-P8XIo-XT.js +1 -0
  23. package/dist/assets/{TimeRangePicker-B2SK3o8o.js → TimeRangePicker-BP0hPL2e.js} +1 -1
  24. package/dist/assets/TracesTab-CMVJpkgr.js +1 -0
  25. package/dist/assets/UsersTab-ZUaqS4l_.js +1 -0
  26. package/dist/assets/button-nO0gX-NR.js +1 -0
  27. package/dist/assets/{card-C0DYbnDZ.js → card-BZOj8vDF.js} +1 -1
  28. package/dist/assets/chevrons-up-down-BbTkkJkE.js +1 -0
  29. package/dist/assets/{compatView-Zpd8xEb0.js → compatView-xxuYVFiT.js} +1 -1
  30. package/dist/assets/dispatchErrorInfo-ByWow4dK.js +1 -0
  31. package/dist/assets/{dist-ONRHFnrv.js → dist-Cci6Ggjl.js} +1 -1
  32. package/dist/assets/{dist-CEr_Gjjt.js → dist-dF88UcEZ.js} +1 -1
  33. package/dist/assets/{dist-D9HKhjU9.js → dist-rCLg1WXy.js} +1 -1
  34. package/dist/assets/{dist-D0lueamf.js → dist-xA--peN1.js} +1 -1
  35. package/dist/assets/{highlighted-body-OFNGDK62-C4lDTBXi.js → highlighted-body-OFNGDK62-DNgOAHiR.js} +1 -1
  36. package/dist/assets/index-C6XDcLXH.js +226 -0
  37. package/dist/assets/{index-DE3I6s1g.css → index-nayepuF0.css} +1 -1
  38. package/dist/assets/mermaid-GHXKKRXX-DK3RngoE.js +1 -0
  39. package/dist/assets/roleDescriptions-BmCKM40P.js +1 -0
  40. package/dist/assets/{table-BrqjFLFP.js → table-CQttJ0e5.js} +1 -1
  41. package/dist/assets/tabs-D-DUf5Yr.js +1 -0
  42. package/dist/assets/x-VwKg9NoU.js +1 -0
  43. package/dist/index.html +8 -8
  44. package/package.json +1 -1
  45. package/dist/assets/AccessTab-Bl3z-oaJ.js +0 -1
  46. package/dist/assets/AgentFilesTab-BvWPXaPy.js +0 -3
  47. package/dist/assets/AnomaliesTab-Bt3rUt5h.js +0 -1
  48. package/dist/assets/AuditTab-BUDCT6C_.js +0 -1
  49. package/dist/assets/BridgeTab-CaRqpzhJ.js +0 -1
  50. package/dist/assets/ChatDefaultsTab-D2PUOgIG.js +0 -1
  51. package/dist/assets/FeedbacksTab-CQydUkCH.js +0 -1
  52. package/dist/assets/FilesTab-DedNE9vp.js +0 -1
  53. package/dist/assets/GroupsTab-BYuoTQ0m.js +0 -1
  54. package/dist/assets/InstancesTab-De8L8K_O.js +0 -1
  55. package/dist/assets/IntegrationsTab-ChkDnL5l.js +0 -1
  56. package/dist/assets/KpiTab-B60Mw6H3.js +0 -1
  57. package/dist/assets/PreferencesTab-BJVXFQZy.js +0 -1
  58. package/dist/assets/PromptInjectionsTab-BSMQl2wO.js +0 -2
  59. package/dist/assets/RolesTab-CTmqlMh1.js +0 -1
  60. package/dist/assets/ServiceAccountsTab-CLEU-Si6.js +0 -1
  61. package/dist/assets/ThemeShowroom-CkbK5_J1.js +0 -1
  62. package/dist/assets/TracesTab-Bm9mn32S.js +0 -1
  63. package/dist/assets/UsersTab-Di1rLX5R.js +0 -1
  64. package/dist/assets/button-B6rrzUWu.js +0 -1
  65. package/dist/assets/chevrons-up-down-ClxkhYiU.js +0 -1
  66. package/dist/assets/dispatchErrorInfo-CBRNT965.js +0 -1
  67. package/dist/assets/index-Ci__4cCS.js +0 -226
  68. package/dist/assets/mermaid-GHXKKRXX-CLDSlio9.js +0 -1
  69. package/dist/assets/roleDescriptions-DoeFMOcx.js +0 -1
  70. package/dist/assets/x-BKk70OzX.js +0 -1
@@ -0,0 +1 @@
1
+ import{T as e}from"./index-C6XDcLXH.js";export{e as Mermaid};
@@ -0,0 +1 @@
1
+ import{Bd as e,Hd as t,Ud as n,Vd as r,zd as i}from"./dist-Cci6Ggjl.js";var a={pending:n,user:t,admin:r,observer:e,agent:i};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-ONRHFnrv.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-Cci6Ggjl.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aw as r,Lw as i,Pw as a,Rw as o,jw as s,kw as c,n as l,t as u}from"./dist-Cci6Ggjl.js";import{t as d}from"./dist-dF88UcEZ.js";import{dt as f,ft as p,pt as m}from"./index-C6XDcLXH.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=s({prop:r,onChange:i,defaultProp:a??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(o.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(o.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:a=!1,...s}=e,c=S(E,n),l=b(n),u=A(c.baseId,r),d=j(c.baseId,r),p=r===c.value;return(0,g.jsx)(f,{asChild:!0,...l,focusable:!a,active:p,children:(0,g.jsx)(o.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:u,...s,ref:t,onMouseDown:i(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?c.onValueChange(r):e.preventDefault()}),onKeyDown:i(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&c.onValueChange(r)}),onFocus:i(e.onFocus,()=>{let e=c.activationMode!==`manual`;!p&&!a&&e&&c.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(r,{present:a||f,children:({present:n})=>(0,g.jsx)(o.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=u(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{Kw as e}from"./dist-Cci6Ggjl.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
package/dist/index.html CHANGED
@@ -38,15 +38,15 @@
38
38
  document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-Ci__4cCS.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-C6XDcLXH.js"></script>
42
42
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
43
- <link rel="modulepreload" crossorigin href="/assets/dist-ONRHFnrv.js">
44
- <link rel="modulepreload" crossorigin href="/assets/dist-CEr_Gjjt.js">
45
- <link rel="modulepreload" crossorigin href="/assets/dist-D9HKhjU9.js">
46
- <link rel="modulepreload" crossorigin href="/assets/dist-D0lueamf.js">
47
- <link rel="modulepreload" crossorigin href="/assets/x-BKk70OzX.js">
48
- <link rel="modulepreload" crossorigin href="/assets/button-B6rrzUWu.js">
49
- <link rel="stylesheet" crossorigin href="/assets/index-DE3I6s1g.css">
43
+ <link rel="modulepreload" crossorigin href="/assets/dist-Cci6Ggjl.js">
44
+ <link rel="modulepreload" crossorigin href="/assets/dist-dF88UcEZ.js">
45
+ <link rel="modulepreload" crossorigin href="/assets/dist-rCLg1WXy.js">
46
+ <link rel="modulepreload" crossorigin href="/assets/dist-xA--peN1.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/x-VwKg9NoU.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/button-nO0gX-NR.js">
49
+ <link rel="stylesheet" crossorigin href="/assets/index-nayepuF0.css">
50
50
  </head>
51
51
  <body>
52
52
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,Cr as i,Dr as a,Er as o,Ew as s,Nw as c,Sr as l,Tr as u,_r as d,br as f,gr as p,hr as m,mr as h,pr as g,vr as _,wr as v,xr as y,yr as b}from"./dist-ONRHFnrv.js";import{S as x,X as S,b as C,v as w,x as T,y as E}from"./index-Ci__4cCS.js";var D=t(e(),1);function O(e){return e===`user`?d():e===`all`?p():m({group:e.group})}function k(e){return e===`common`?h():e===`owner`?g():m({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=c(s.admin.listUsers,{}),[t,n]=(0,D.useState)(``),d=c(s.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":o(),children:(0,A.jsx)(x,{placeholder:o()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):d===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(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:v()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:d.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:d.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:i()}),d.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:d.groups.map(e=>(0,A.jsx)(S,{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:l()}),d.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:d.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)(S,{variant:`default`,children:_()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{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:y()}),d.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:d.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)(S,{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:f()}),d.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:d.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$C as i,Aw as a,B as o,Ew as s,F as c,G as l,Gt as u,Gv as d,H as f,I as p,J as m,K as h,L as g,Nw as _,Q as ee,R as v,U as y,Ut as te,V as b,W as x,X as ne,Y as S,Z as C,at as w,ct as re,et as ie,it as T,lt as ae,nt as oe,ot as E,q as D,rt as O,st as k,tt as se,tw as ce,ut as A,z as j}from"./dist-ONRHFnrv.js";import{t as M}from"./button-B6rrzUWu.js";import{$ as N,A as P,B as F,F as le,I as ue,L as de,N as fe,P as pe,Q as me,R as he,S as I,X as L,b as R,et as ge,g as z,mt as B,nt as _e,ot as V,rt as ve,v as H,x as U,y as W,z as ye}from"./index-Ci__4cCS.js";import{i as G}from"./compatView-Zpd8xEb0.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*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 be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(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<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=_(s.me.getMe,{host:V}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),o=_(s.admin.listInstances,e!==void 0&&t?{}:`skip`),[c,l]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!o||o.length===0||(!c||!o.some(e=>e.name===c))&&l(o[0].name)},[t,o,c]);let u=_(s.agents.listAgentsForInstance,t&&c?{instanceName:c}:`skip`),d=_(s.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return c===null||u===void 0?o!==void 0&&o.length===0?[]:void 0:u.agents.map(e=>({instanceName:c,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,c,u,o,d]),[p,m]=(0,K.useState)(null);(0,K.useEffect)(()=>{!f||f.length===0||(!p||!f.some(e=>$(e)===p))&&m($(f[0]))},[f,p]);let h=f?.find(e=>$(e)===p)??null,g=a(s.agentFiles.listAgentFiles),[v,y]=(0,K.useState)({status:`idle`}),b=h?.instanceName??null,x=h?.agentId??null,ne=_(s.compat.forInstance,n&&b!==null?{instanceName:b}:`skip`),S=n&&b!==null?z(ne,`agentFiles`):null,C=S===null?!1:S===`loading`?null:S.blocked,D=(0,K.useCallback)(async()=>{if(!(b===null||x===null)){y({status:`loading`});try{y({status:`done`,files:(await g({instanceName:b,agentId:x})).files})}catch{y({status:`error`})}}},[g,b,x]);(0,K.useEffect)(()=>{C===!1&&D()},[D,C]);let[j,N]=(0,K.useState)(null),P=ce(),F=(0,K.useMemo)(()=>new Intl.NumberFormat(P,{maximumFractionDigits:0}),[P]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(o?.length??0)>1?(0,Q.jsxs)(H,{value:c??``,onValueChange:e=>l(e),children:[(0,Q.jsx)(U,{size:`sm`,"aria-label":ae(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(W,{children:(o??[]).map(e=>(0,Q.jsx)(R,{value:e.name,children:e.name},e.name))})]}):null,f.length>0?(0,Q.jsxs)(H,{value:p??``,onValueChange:e=>m(e),children:[(0,Q.jsx)(U,{size:`sm`,"aria-label":re(),children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(W,{children:f.map(e=>(0,Q.jsx)(R,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()})]}),h===null?null:S===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):S!==null&&S.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(B,{size:14,"aria-hidden":!0}),` `,G(S.gatewayVersion)]}):v.status===`loading`||v.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):v.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[w(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:te()})]}):v.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:v.files.map(e=>{let n=Y(e.size),i=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)(L,{variant:`outline`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:O({size:Z(e.size,P)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` 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:oe({pct:F.format(n)})}),i?(0,Q.jsx)(B,{size:14,className:`oc-afiles__warn`,"aria-label":se()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>N(e),children:t?r():ee()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:Z(be(v.files),P),total:Z(J,P),pct:F.format(X(be(v.files)))})})]}),j&&h?(0,Q.jsx)(Te,{instanceName:h.instanceName,agentId:h.agentId,name:j.name,isAdmin:t,onClose:()=>N(null),onSaved:()=>void D()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:_,onSaved:ee}){let w=a(s.agentFiles.getAgentFile),re=a(s.agentFiles.setAgentFile),ie=P(),[T,ae]=(0,K.useState)(null),[oe,E]=(0,K.useState)(!1),[O,k]=(0,K.useState)(``),[se,A]=(0,K.useState)(!1),[I,L]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1),[B,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{E(!1);try{let i=await w({instanceName:e,agentId:t,name:n});ae({content:i.content,updatedAtMs:i.updatedAtMs}),r||k(i.content),z(!1)}catch{E(!0)}},[w,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(T!==null){L(!0),V(!1);try{await re({instanceName:e,agentId:t,name:n,content:O,baseUpdatedAtMs:T.updatedAtMs??void 0}),ie.success(l({name:n})),ee(),await H(!1)}catch(e){Ce(e)?z(!0):V(!0)}finally{L(!1)}}}let W=T!==null&&O!==T.content,G=(0,K.useMemo)(()=>T===null?null:Se(T.content,O),[T,O]),J=O.length>q,Y=ce(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(me,{open:!0,onOpenChange:e=>!e&&_(),children:(0,Q.jsxs)(N,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(ve,{children:C({name:n})}),(0,Q.jsxs)(ge,{children:[ne({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,S()]})]})]}),oe?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[y(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:te()})]}):T===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:O,readOnly:!r,spellCheck:!1,onChange:e=>k(e.target.value),"aria-label":C({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:m()}),R?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(M,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:b()})]}):null,B?(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${J?` is-over`:``}`,children:D({count:X.format(O.length),max:X.format(q)})}),r?(0,Q.jsx)(M,{size:`sm`,disabled:!W||I||R,onClick:()=>A(!0),children:I?u():h()}):null]})]}),(0,Q.jsx)(fe,{open:se,onOpenChange:A,children:(0,Q.jsxs)(ue,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(F,{children:o({name:n})}),(0,Q.jsx)(de,{children:j({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:v({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:g()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:p()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(he,{children:[(0,Q.jsx)(le,{children:d()}),(0,Q.jsx)(pe,{onClick:()=>void U(),children:c()})]})]})})]})})}export{we as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Au as i,Bu as ee,Du as a,Eu as o,Ew as s,Fu as te,Gu as c,Hu as ne,Iu as re,Ju as ie,Ku as l,Lu as u,Mu as d,Mw as f,Nu as p,Nw as m,Ou as h,Pu as ae,Qu as oe,Ru as se,Uu as g,Vu as _,Wu as ce,Xu as le,Yu as ue,Zu as de,ad as fe,cd as pe,dd as me,ed as he,fd as v,id as ge,ju as y,ku as b,ld as x,md as S,nd as C,od as w,pd as T,qu as E,rd as D,sd as O,td as k,ud as A,zu as j}from"./dist-ONRHFnrv.js";import{n as M}from"./TimeRangePicker-B2SK3o8o.js";import{A as N,At as P,S as F,X as I,a as L,b as R,j as _e,kt as z,ot as ve,r as ye,v as B,x as V,y as H}from"./index-Ci__4cCS.js";import{t as be}from"./FilterBar-B3HyBcMN.js";import{t as xe}from"./DataTableShell-DY8nOACn.js";import{t as U}from"./dispatchErrorInfo-CBRNT965.js";var W=t(e(),1),G=n(),K=`__all__`,Se=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ce(e){return e===`open`?S():e===`acknowledged`?T():v()}var we=[`info`,`warn`,`critical`],Te=[`detector`,`agent`],Ee={kind:`relative`,from:`now-30d`,to:`now`},De=200,q=`all`;function J(){let e=P({from:`/settings/anomalies`}),t=z({from:`/settings/anomalies`}),n=e.q??``,a=e.status===q?K:e.status,o=e.severity??K,h=e.kind??K,[v,b]=(0,W.useState)(K),S=ye(e.from,e.to),{from:T,to:U}=M(S),J=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Y=e=>void t({search:t=>({...t,status:e===K?q:e})}),Me=e=>void t({search:t=>({...t,severity:e===K?void 0:e})}),Ne=e=>void t({search:t=>({...t,kind:e===K?void 0:e})}),X=e=>void t({search:t=>({...t,...L(e)})}),Pe=_e(),Z=N(),Q=f(s.anomalies.resolveAnomaly),Fe=(m(s.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=m(s.anomalies.listAnomalies,{limit:De,filter:{q:n||void 0,from:T,to:U,anomalyStatus:a===K?void 0:a,severity:o===K?void 0:o,source:v===K?void 0:v,kind:h===K?void 0:h}}),Ie=(0,W.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||a!==`open`||o!==K||v!==K||h!==K||S.kind!==`relative`||S.from!==Ee.from;function Re(){b(K),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:me(),description:(0,G.jsxs)(G.Fragment,{children:[A(),` `,(0,G.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,x(),` `,(0,G.jsx)(`strong`,{children:pe()}),`.`,` `,O()]}),confirmLabel:w()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(fe(),e.kind)}catch(e){Z.error(ge(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(D(),e.kind)}catch(e){Z.error(C(),e)}}return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,G.jsx)(`strong`,{children:he()}),` `,r(),` `,(0,G.jsx)(`strong`,{children:oe()}),` `,de(),` `,(0,G.jsx)(`strong`,{children:le()}),` `,ue(),` `,(0,G.jsx)(`span`,{className:`oc-filter__window`,children:ie()})]}),(0,G.jsxs)(be,{q:n,onQChange:J,searchPlaceholder:E(),timeRange:S,onTimeRangeChange:X,onReset:Re,canReset:Le,children:[(0,G.jsxs)(B,{value:a,onValueChange:Y,children:[(0,G.jsx)(V,{size:`sm`,className:`w-36`,children:(0,G.jsx)(F,{})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:l()}),Se.map(e=>(0,G.jsx)(R,{value:e.value,children:Ce(e.value)},e.value))]})]}),(0,G.jsxs)(B,{value:o,onValueChange:Me,children:[(0,G.jsx)(V,{size:`sm`,className:`w-36`,children:(0,G.jsx)(F,{placeholder:c()})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:ce()}),we.map(e=>(0,G.jsx)(R,{value:e,children:e},e))]})]}),(0,G.jsxs)(B,{value:v,onValueChange:b,children:[(0,G.jsx)(V,{size:`sm`,className:`w-32`,children:(0,G.jsx)(F,{placeholder:g()})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:ne()}),Te.map(e=>(0,G.jsx)(R,{value:e,children:e},e))]})]}),(0,G.jsxs)(B,{value:h,onValueChange:Ne,children:[(0,G.jsx)(V,{size:`sm`,className:`w-36`,children:(0,G.jsx)(F,{placeholder:_()})}),(0,G.jsxs)(H,{children:[(0,G.jsx)(R,{value:K,children:ee()}),Ie.map(e=>(0,G.jsx)(R,{value:e,children:e},e))]})]})]}),(0,G.jsx)(xe,{title:j(),rows:$,emptyHint:a===`open`?se():u(),rowActions:e=>Fe&&e.status===`open`?[{label:re(),onSelect:()=>void ze(e)},{label:te(),onSelect:()=>void Be(e)}]:[],columns:[{header:ae(),cell:e=>(0,G.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:_(),cell:e=>(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:c(),cell:e=>(0,G.jsx)(ke,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:p(),cell:e=>(0,G.jsx)(Ae,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,G.jsx)(I,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:d(),cell:e=>(0,G.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:y(),cell:e=>(0,G.jsx)(Oe,{row:e}),sort:e=>e.evidence??null},{header:i(),cell:e=>e.correlationId?(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:je(e.correlationId)}):(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Y(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Oe({row:e}){let t=z(),n=Y(e);if(!n.dominantCode)return(0,G.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=U(n.dominantCode),i=n.sampleCorrelationId;return(0,G.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,G.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,G.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,G.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,G.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,G.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,b()]}):null]})}function ke({severity:e}){return(0,G.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ae({status:e}){return e===`open`?(0,G.jsx)(I,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,G.jsx)(I,{variant:`secondary`,children:a()}):(0,G.jsx)(I,{variant:`outline`,children:o()})}function je(e){return e.length>8?e.slice(0,8):e}export{J as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ew as r,Nw as i,_f as a,af as o,cf as s,df as c,ff as l,gf as u,hf as ee,lf as d,mf as f,of as p,pf as m,sf as h,uf as g,vf as _,yf as v}from"./dist-ONRHFnrv.js";import{n as y}from"./TimeRangePicker-B2SK3o8o.js";import{At as b,S as x,a as S,b as C,i as w,kt as T,o as E,r as D,t as O,v as k,x as A,y as j}from"./index-Ci__4cCS.js";import{t as M}from"./FilterBar-B3HyBcMN.js";import{t as N}from"./AdvancedFilter-Cjt4cP7-.js";import{t as P}from"./DataTableShell-DY8nOACn.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:O,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=b({from:`/settings/audit`}),t=T({from:`/settings/audit`}),n=e.q??``,O=e.action??R,B=e.impersonated??R,V=e.resource??R,H=D(e.from,e.to),U=(0,F.useMemo)(()=>E(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...S(e)})}),Z=e=>void t({search:t=>({...t,adv:w(e)}),replace:!0}),Q=i(r.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:O===R?void 0:O,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||O!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:a(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(k,{value:O,onValueChange:q,children:[(0,I.jsx)(A,{size:`sm`,className:`w-40`,children:(0,I.jsx)(x,{placeholder:u()})}),(0,I.jsxs)(j,{children:[(0,I.jsx)(C,{value:R,children:ee()}),$.map(e=>(0,I.jsx)(C,{value:e,children:e},e))]})]}),(0,I.jsxs)(k,{value:B,onValueChange:J,children:[(0,I.jsx)(A,{size:`sm`,className:`w-40`,children:(0,I.jsx)(x,{})}),(0,I.jsxs)(j,{children:[(0,I.jsx)(C,{value:R,children:f()}),(0,I.jsx)(C,{value:`yes`,children:m()}),(0,I.jsx)(C,{value:`no`,children:l()})]})]}),(0,I.jsxs)(k,{value:V,onValueChange:Y,children:[(0,I.jsx)(A,{size:`sm`,className:`w-40`,children:(0,I.jsx)(x,{placeholder:c()})}),(0,I.jsxs)(j,{children:[(0,I.jsx)(C,{value:R,children:g()}),te.map(e=>(0,I.jsx)(C,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:d(),rows:Q,emptyHint:s(),columns:[{header:h(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:u(),cell:e=>e.action,sort:e=>e.action},{header:p(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:o(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:c(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{As as r,Aw as i,Bs as a,Cc as o,Cs as s,Dc as c,Ds as l,Dw as u,Es as d,Ew as f,Fs as p,Gs as m,Hs as ee,Is as h,Ks as te,Ls as ne,Ms as g,Mw as re,Ns as ie,Nw as _,Oc as v,Os as y,Ps as ae,Rs as oe,Sc as se,Ss as b,Tc as ce,Ts as x,Us as le,Vs as ue,Ws as de,_ as S,_s as fe,a as pe,as as me,b as he,bc as ge,bs as _e,cs as ve,d as ye,ds as be,f as xe,fs as Se,g as Ce,gs as we,h as Te,hc as Ee,hs as De,is as C,js as w,ks as Oe,l as ke,ls as Ae,m as je,mc as Me,ms as Ne,os as T,p as Pe,ps as Fe,ss as Ie,u as Le,us as Re,v as ze,vc as Be,vs as E,wc as Ve,ws as He,xc as Ue,xs as We,y as Ge,yc as Ke,ys as qe,zs as Je}from"./dist-ONRHFnrv.js";import{i as D,r as Ye}from"./dist-CEr_Gjjt.js";import{t as Xe}from"./chevrons-up-down-ClxkhYiU.js";import{i as Ze,n as O,o as Qe,r as $e,s as et}from"./FieldLabel-BAi9qHY_.js";import{t as k}from"./button-B6rrzUWu.js";import{$ as tt,A as nt,D as rt,Dt as A,H as it,Ot as at,Q as ot,S as j,St as st,U as ct,V as lt,X as M,Z as N,_t as ut,b as P,et as dt,kt as ft,mt as F,nt as pt,ot as mt,rt as ht,v as I,x as L,y as R}from"./index-Ci__4cCS.js";import{a as gt,i as z,n as _t,o as B,r as V,t as vt}from"./table-BrqjFLFP.js";import{t as yt}from"./FilterBar-B3HyBcMN.js";import{a as H,n as bt,o as U,r as xt,s as St,t as Ct}from"./compatView-Zpd8xEb0.js";import{t as W}from"./dispatchErrorInfo-CBRNT965.js";var wt=u(`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`}]]),Tt=u(`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 Et(e){return e.filter(e=>e.state===`error`)}function Dt(e){return e.reachable&&Et(e.targets).length===0}function Ot(e){return e.state===`error`&&e.lastErrorCode!==null}function kt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function At(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function jt(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,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return At(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Mt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,Nt={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function Pt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ft(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 Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function It(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function Lt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*It(t.key,e,r)})}function Rt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function zt(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)=>Y(e.label,t.label))}function Bt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Y(e,t))}var Z=n();function Vt({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(Nt),[i,a]=(0,G.useState)(null),o=(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,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,G.useMemo)(()=>Rt(o),[o]),c=(0,G.useMemo)(()=>zt(o),[o]),l=(0,G.useMemo)(()=>Bt(o),[o]),u=(0,G.useMemo)(()=>Lt(Ft(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(yt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:qe(),onReset:()=>r(Nt),canReset:Pt(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:fe()})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(P,{value:q,children:E()}),s.map(e=>(0,Z.jsx)(P,{value:e,children:Ut(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:we()})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(P,{value:q,children:E()}),c.map(e=>(0,Z.jsx)(P,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:De()})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(P,{value:q,children:E()}),l.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))]})]})]}),u.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,Z.jsxs)(vt,{className:`oc-conn__table`,children:[(0,Z.jsx)(gt,{children:(0,Z.jsxs)(B,{children:[(0,Z.jsx)(Q,{label:Fe(),sortKey:`target`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Se(),sortKey:`state`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:be(),sortKey:`instance`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Re(),sortKey:`host`,sort:i,onSort:d}),(0,Z.jsx)(Q,{label:Ae(),sortKey:`version`,sort:i,onSort:d}),(0,Z.jsx)(z,{children:ve()}),(0,Z.jsx)(Q,{label:Ie(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Z.jsx)(_t,{children:u.map(e=>(0,Z.jsx)(Ht,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Ye,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Xe,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ht({r:e}){let t=Ot(e)?W(e.lastErrorCode):null,n=kt(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(B,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(V,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(Wt,{state:e.state})}),(0,Z.jsx)(V,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(V,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(V,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:We({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(V,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(B,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(V,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[_e({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Ut(e){return e===`connected`?T():e===`error`?me():C()}function Wt({state:e}){return e===`connected`?(0,Z.jsx)(M,{variant:`secondary`,children:T()}):e===`error`?(0,Z.jsx)(M,{variant:`destructive`,children:me()}):(0,Z.jsx)(M,{variant:`outline`,children:C()})}function Gt(){return _(f.bridgeHealth.getBridgeHealth,{})}function Kt(){let e=Gt(),t=_(f.compat.getBridgeCompat,{}),n=_(f.me.getMe,{host:mt})?.role===`admin`,r=_(f.admin.listInstances,n?{}:`skip`),i=ft(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=jt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&bt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(qt,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:g()}),o.map(e=>(0,Z.jsx)(Jt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):null]})}function qt({health:e,compat:t,onSeeAnomalies:n}){let i=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),` · `,ze(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?S():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:r()});let a=Et(e.targets),o=!e.reachable,s=Dt(e),c=s?`ok`:`error`,u=new Date(e.checkedAt).toLocaleString(`fr-FR`),f=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${c}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:s?(0,Z.jsx)(A,{size:22}):o?(0,Z.jsx)(Tt,{size:22}):(0,Z.jsx)(F,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:s?Oe():o?y():l({count:a.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(wt,{size:12,"aria-hidden":!0}),` `,d({time:u})]}),f?(0,Z.jsx)(`span`,{children:x({time:f})}):null,i]}),o?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:He()})]})}function Jt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?St(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:Ct(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(ut,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Mt(e)}),f?(0,Z.jsx)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:xt(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:he()}),(0,Z.jsx)(Yt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(at,{size:13,"aria-hidden":!0}),s({count:t.length})]}),p?(0,Z.jsx)(Vt,{connections:t,displayByInstance:c}):null]})}function Yt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:je()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Pe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:S()}),e?(0,Z.jsx)(Qt,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Z.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:xt(e.state)})]},e.instanceName))})]})}function Xt({instance:e,onClose:t}){return(0,Z.jsx)(ot,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(tt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(ht,{children:v({instance:e.displayName??e.name})}),(0,Z.jsx)(dt,{children:c()})]}),(0,Z.jsx)(Zt,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.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,Z.jsx)(A,{"aria-hidden":!0}):(0,Z.jsx)(F,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?h():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,p()]}):null}function Zt({instance:e,onClose:t}){let n=re(f.admin.upsertInstanceConfig),r=i(f.bridge.validateMediaPaths),s=nt(),[c,l]=(0,G.useState)(()=>Ze(e.config??{})),[u,d]=(0,G.useState)(!1),[p,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(null),v=c.inboundMediaMode===`shared-fs`,y=c.mediaMode===`shared-fs`,b=v||y;async function x(){h(!0),_(null);try{_(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){s.error(a(),e)}finally{h(!1)}}async function S(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:$e(c,r)}),t()}catch(e){s.error(ge(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ce(),help:Ke()}),(0,Z.jsxs)(I,{value:c.mediaMode,onValueChange:e=>l({...c,mediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(R,{children:et.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Ve(),help:Be()}),(0,Z.jsxs)(I,{value:c.inboundMediaMode,onValueChange:e=>l({...c,inboundMediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(R,{children:Qe.map(e=>(0,Z.jsx)(P,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:o(),help:Ee()}),(0,Z.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>l({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),b&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:te(),help:m()}),(0,Z.jsx)(N,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>l({...c,inboundAgentMount:e.target.value})})]}),y&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:de(),help:le()}),(0,Z.jsx)(N,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>l({...c,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(rt,{checked:c.rehydration,onCheckedChange:e=>l({...c,rehydration:e===!0})}),(0,Z.jsx)(O,{label:se(),help:Me()})]}),b&&g!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:g.reachable?!g.inbound&&!g.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(F,{"aria-hidden":!0}),ie({reason:g.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:oe(),result:g.inbound}),(0,Z.jsx)($,{label:ne(),result:g.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(F,{"aria-hidden":!0}),ae()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[b&&(0,Z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void x(),disabled:p,children:[p?(0,Z.jsx)(st,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ue():ee()]}),(0,Z.jsx)(k,{size:`sm`,onClick:()=>void S(),disabled:u,children:Ue()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(lt,{children:[(0,Z.jsx)(ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?xe():ye({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(it,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Le()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{Kt as BridgeTab,Xt as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,A as i,Aw as a,C as o,D as s,E as c,Ec as ee,Ew as l,Gt as te,Gv as ne,M as re,N as ie,Nw as u,O as ae,Rt as d,S as f,T as p,Ut as oe,j as m,k as h,lt as g,w as se,x as ce,zt as le}from"./dist-ONRHFnrv.js";import{t as _}from"./button-B6rrzUWu.js";import{A as ue,B as de,F as fe,I as pe,L as me,N as he,P as v,R as y,S as b,_ as x,b as S,g as C,h as w,mt as T,v as E,x as D,y as O,z as k}from"./index-Ci__4cCS.js";import{i as A}from"./compatView-Zpd8xEb0.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(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 P=n();function F(){let e=a(l.agentFiles.getChatDefaults),t=a(l.agentFiles.setChatDefaults),n=ue(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=u(l.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=u(l.compat.forInstance,U?{instanceName:U}:`skip`),K=U?C(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(c()),await X()}catch(e){n.error(p(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:x(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:le()},{id:`standard`,label:d()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,P.jsxs)(E,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(D,{size:`sm`,"aria-label":g(),children:(0,P.jsx)(b,{})}),(0,P.jsx)(O,{children:(H??[]).map(e=>(0,P.jsx)(S,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:ee()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(T,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ae(),` `,(0,P.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:oe()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:re()}),(0,P.jsx)(w,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:m()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,P.jsx)(w,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:h()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(_,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?te():s()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:se()})]}),(0,P.jsx)(he,{open:ge,onOpenChange:z,children:(0,P.jsxs)(pe,{children:[(0,P.jsxs)(k,{children:[(0,P.jsx)(de,{children:o()}),(0,P.jsx)(me,{children:f()})]}),(0,P.jsxs)(y,{children:[(0,P.jsx)(fe,{children:ne()}),(0,P.jsx)(v,{onClick:()=>void be(),children:ce()})]})]})})]})}export{F as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,Ah as i,Bm as a,Ch as o,Dh as s,Eh as c,Ew as l,Fh as u,Fm as d,Gm as f,Hm as p,Im as m,Jm as ee,Km as te,Lm as h,Mh as g,Mw as _,Nh as ne,Nw as re,Oh as ie,Ph as v,Pm as y,Qm as b,Rm as x,Sh as S,Th as C,Um as w,Vm as T,Wm as E,Xm as D,Ym as O,Zm as k,_h as A,ah as j,bh as M,ch as N,dh as P,eh as F,fh as I,gh as L,hh as R,ih as z,jh as B,kh as V,lh as ae,mh as H,nh as U,oh as W,ph as G,qm as K,rh as q,sh as J,th as oe,uh as se,vh as ce,wh as le,xh as ue,yh as de,zm as fe}from"./dist-ONRHFnrv.js";import{t as pe}from"./button-B6rrzUWu.js";import{j as me}from"./index-Ci__4cCS.js";import{t as he}from"./DataTableShell-DY8nOACn.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>u(),incorrect:()=>v(),incoherence:()=>ne(),formatting:()=>g(),latency:()=>B(),api_error:()=>i(),other:()=>V()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:s()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:c()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()})}function ge({data:e,closeReason:t}){let n=e.snapshot,r=_(l.feedback.respondToFeedback),[i,s]=(0,Y.useState)(e.thread),[c,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1);async function p(){let t=c.trim();if(!(!t||d)){f(!0);try{await r({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}let m=[];try{m=n.contextJson?JSON.parse(n.contextJson):[]}catch{m=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${C()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),i.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?S():ue()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:M()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:de(),value:c,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void p(),disabled:!c.trim()||d,children:d?ce():A()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||R()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||R()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,m.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I({count:n.contextCount??m.length,truncated:n.contextTruncated?P():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?J({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[W(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,j()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=re(l.feedback.listForAdmin,{}),t=_(l.feedback.readSnapshot),n=_(l.feedback.deleteFeedback),i=me(),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)({});async function u(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 g(e){await i({title:m(),description:d(),confirmLabel:y(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[z(),` `,(0,X.jsx)(`strong`,{children:q()}),` `,U()]}),(0,X.jsx)(he,{title:oe(),rows:e,emptyHint:F(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,X.jsx)(ge,{data:s[e._id],closeReason:e.userCloseReason}):null,columns:[{header:r(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:b(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:k(),cell:e=>e.messageRole===`user`?D():O(),sort:e=>e.messageRole},{header:ee(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${K({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:te(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:f(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:E(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:w()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:p()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:T()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?fe():x(),onSelect:()=>void u(e)},{label:h(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$S as ee,AC as te,CC as i,DC as a,EC as ne,Ew as o,Gv as s,Mw as c,Nw as re,OC as l,QS as ie,SC as ae,TC as oe,XS as se,ZS as ce,_C as u,aC as le,bC as d,cC as ue,dC as de,eC as fe,fC as pe,gC as f,hC as p,iC as m,jC as me,kC as he,lC as ge,mC as h,nC as _e,oC as ve,pC as ye,rC as be,sC as g,tC as _,tw as v,uC as y,vC as b,wC as x,xC as S,yC as C}from"./dist-ONRHFnrv.js";import{t as w}from"./button-B6rrzUWu.js";import{A as T,B as E,F as D,G as O,I as k,K as A,L as j,N as M,P as N,R as xe,S as P,Tt as F,W as Se,X as I,Y as Ce,b as L,ht as we,v as R,wt as Te,x as z,y as B,yt as Ee,z as De}from"./index-Ci__4cCS.js";import{a as Oe,i as V,n as ke,o as H,r as U,t as Ae}from"./table-BrqjFLFP.js";var W=t(e(),1),G=n(),K=`all`;function q(e){switch(e){case`image`:return d();case`audio`:return C();case`video`:return b();case`pdf`:return u();case`document`:return f();case`archive`:return p();default:return h()}}function J(){let[e,t]=(0,W.useState)(K),[n,u]=(0,W.useState)(K),[d,f]=(0,W.useState)(K),[p,h]=(0,W.useState)(K),[b,C]=(0,W.useState)(null),J=c(o.files.softDelete),Y=T();function je(){t(K),u(K),f(K),h(K)}async function Me(){let e=b;if(C(null),e)try{await J({fileId:e.id}),Y.success(be())}catch(e){Y.error(_e(),e)}}let X=re(o.files.listMine,{direction:e===K?void 0:e,chatId:n===K?void 0:n,instanceName:d===K?void 0:d,category:p===K?void 0:p}),Ne=(0,W.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:r()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=X,$=e!==K||n!==K||d!==K||p!==K;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,G.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,G.jsxs)(R,{value:e,onValueChange:t,children:[(0,G.jsx)(z,{size:`sm`,"aria-label":te(),children:(0,G.jsx)(P,{})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(L,{value:K,children:he()}),(0,G.jsx)(L,{value:`inbound`,children:l()}),(0,G.jsx)(L,{value:`outbound`,children:a()})]})]}),(0,G.jsxs)(R,{value:n,onValueChange:u,children:[(0,G.jsx)(z,{size:`sm`,"aria-label":ne(),children:(0,G.jsx)(P,{})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(L,{value:K,children:oe()}),Q.chats.map(e=>(0,G.jsx)(L,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,G.jsxs)(R,{value:d,onValueChange:f,children:[(0,G.jsx)(z,{size:`sm`,"aria-label":x(),children:(0,G.jsx)(P,{})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(L,{value:K,children:i()}),Q.instances.map(e=>(0,G.jsx)(L,{value:e,children:e},e))]})]}):null,(0,G.jsxs)(R,{value:p,onValueChange:h,children:[(0,G.jsx)(z,{size:`sm`,"aria-label":ae(),children:(0,G.jsx)(P,{})}),(0,G.jsxs)(B,{children:[(0,G.jsx)(L,{value:K,children:S()}),Q.categories.map(e=>(0,G.jsx)(L,{value:e,children:q(e)},e))]})]}),$?(0,G.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:je,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,G.jsx)(Ee,{size:14,"aria-hidden":!0}),ve()]}):null]}),Z.length===0?(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:$?ce():ie()}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ae,{children:[(0,G.jsx)(Oe,{children:(0,G.jsxs)(H,{children:[(0,G.jsx)(V,{children:ye()}),(0,G.jsx)(V,{children:pe()}),(0,G.jsx)(V,{children:de()}),(0,G.jsx)(V,{children:y()}),(0,G.jsx)(V,{children:ge()}),(0,G.jsx)(V,{className:`text-right`,children:ue()})]})}),(0,G.jsx)(ke,{children:Z.map(e=>(0,G.jsxs)(H,{children:[(0,G.jsx)(U,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,G.jsx)(U,{title:e.mimeType,children:q(e.category)}),(0,G.jsx)(U,{children:(0,G.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?l():a()})}),(0,G.jsx)(U,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,G.jsx)(U,{className:`whitespace-nowrap text-muted-foreground`,children:Ne.format(e.createdAt)}),(0,G.jsx)(U,{className:`text-right`,children:(0,G.jsxs)(Se,{children:[(0,G.jsx)(Ce,{asChild:!0,children:(0,G.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":le(),children:(0,G.jsx)(Te,{size:16})})}),(0,G.jsxs)(O,{align:`end`,children:[e.url?(0,G.jsx)(A,{asChild:!0,children:(0,G.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,G.jsx)(F,{size:14}),g()]})}):(0,G.jsxs)(A,{disabled:!0,children:[(0,G.jsx)(F,{size:14}),ee()]}),(0,G.jsxs)(A,{variant:`destructive`,onSelect:()=>C({id:e._id,filename:e.filename}),children:[(0,G.jsx)(we,{size:14}),m()]})]})]})})]},e._id))})]}),Pe?(0,G.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:se({cap:Fe})}):null]}),(0,G.jsx)(M,{open:b!==null,onOpenChange:e=>!e&&C(null),children:(0,G.jsxs)(k,{children:[(0,G.jsxs)(De,{children:[(0,G.jsx)(E,{children:_()}),(0,G.jsx)(j,{children:fe()})]}),(0,G.jsxs)(xe,{children:[(0,G.jsx)(D,{children:s()}),(0,G.jsx)(N,{onClick:()=>void Me(),children:m()})]})]})})]})}export{J as FilesTab};
@@ -1 +0,0 @@
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 a,Cn as o,Dn as s,Dw as c,En as l,Ew as u,Fn as d,Gn as f,Hn as p,In as m,Jn as h,Kn as g,Ln as _,Mn as v,Mw as y,Nn as b,Nw as x,On as S,Pn as C,Qn as w,Rn as ee,Sn as T,Tn as te,Un as ne,Vn as re,Wn as ie,Xn as E,Yn as ae,Zn as D,_n as O,an as oe,ar as k,bn as A,cn as se,cr as ce,dn as le,dr as ue,dw as j,er as M,fn as de,fr as fe,fw as N,gn as pe,hn as P,hw as me,in as he,ir as ge,jn as _e,kn as ve,ln as ye,lr as be,mn as xe,n as F,nr as Se,on as Ce,or as we,pn as Te,qn as Ee,rn as De,rr as Oe,sn as I,sr as ke,t as Ae,tr as je,un as Me,ur as Ne,uw as Pe,vn as Fe,vw as L,wn as Ie,xn as Le,yn as Re,yw as R,zn as ze}from"./dist-ONRHFnrv.js";import{t as Be}from"./dist-CEr_Gjjt.js";import{t as Ve}from"./x-BKk70OzX.js";import{t as z}from"./button-B6rrzUWu.js";import{$ as He,A as B,D as V,Ot as Ue,Q as We,S as Ge,X as H,Z as U,_t as W,b as Ke,dt as qe,et as Je,ft as Ye,gt as G,j as Xe,m as Ze,nt as Qe,ot as $e,pt as et,rt as tt,v as nt,x as rt,y as it}from"./index-Ci__4cCS.js";import{t as at}from"./FilterBar-B3HyBcMN.js";import{t as ot}from"./DataTableShell-DY8nOACn.js";import{t as K}from"./DetailChips-DTltyjOV.js";var st=c(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ct=c(`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=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),lt=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),J=t(e(),1),Y=n(),X=`Tabs`,[ut,dt]=me(X,[et]),ft=et(),[pt,Z]=ut(X),mt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Be(s),[d,f]=N({prop:r,onChange:i,defaultProp:a??``,caller:X});return(0,Y.jsx)(pt,{scope:n,baseId:Pe(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,Y.jsx)(R.div,{dir:u,"data-orientation":o,...l,ref:t})})});mt.displayName=X;var ht=`TabsList`,gt=J.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Z(ht,n),o=ft(n);return(0,Y.jsx)(Ye,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,Y.jsx)(R.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});gt.displayName=ht;var _t=`TabsTrigger`,vt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Z(_t,n),s=ft(n),c=xt(o.baseId,r),l=St(o.baseId,r),u=r===o.value;return(0,Y.jsx)(qe,{asChild:!0,...s,focusable:!i,active:u,children:(0,Y.jsx)(R.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:L(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:L(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:L(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});vt.displayName=_t;var yt=`TabsContent`,bt=J.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Z(yt,n),c=xt(s.baseId,r),l=St(s.baseId,r),u=r===s.value,d=J.useRef(u);return J.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,Y.jsx)(j,{present:i||u,children:({present:n})=>(0,Y.jsx)(R.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});bt.displayName=yt;function xt(e,t){return`${e}-trigger-${t}`}function St(e,t){return`${e}-content-${t}`}var Ct=mt,wt=gt,Tt=vt,Et=bt;function Dt(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function Ot(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function kt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function At(e){switch(e){case`admin`:return b();case`user`:return v();case`pending`:return _e();default:return e}}function jt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function Mt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}function Nt({className:e,orientation:t=`horizontal`,...n}){return(0,Y.jsx)(Ct,{"data-slot":`tabs`,"data-orientation":t,className:F(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Pt=Ae(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Ft({className:e,variant:t=`default`,...n}){return(0,Y.jsx)(wt,{"data-slot":`tabs-list`,"data-variant":t,className:F(Pt({variant:t}),e),...n})}function Q({className:e,...t}){return(0,Y.jsx)(Tt,{"data-slot":`tabs-trigger`,className:F(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function $({className:e,...t}){return(0,Y.jsx)(Et,{"data-slot":`tabs-content`,className:F(`flex-1 text-sm outline-none`,e),...t})}var It={name:``,description:``};function Lt(){let e=x(u.groups.listGroups,{}),t=x(u.me.getMe,{host:$e})?.role===`admin`,n=y(u.groups.createGroup),i=y(u.groups.updateGroup),a=y(u.groups.deleteGroup),o=Xe(),s=B(),[c,l]=(0,J.useState)(!1),[d,p]=(0,J.useState)(null),[m,_]=(0,J.useState)(It),[v,b]=(0,J.useState)(null),[S,C]=(0,J.useState)(``),ee=(0,J.useMemo)(()=>{if(!e)return e;let t=S.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,S]);function T(){p(null),_(It),l(!0)}function te(e){p(e),_({name:e.name,description:e.description??``}),l(!0)}async function ne(){try{d?await i({groupId:d._id,name:m.name,description:m.description}):await n({name:m.name,description:m.description||void 0}),_(It),p(null),l(!1)}catch(e){s.error(Ce(),e)}}async function re(e){if(await o({title:Ee({name:e.name}),description:g(),confirmWord:e.name,confirmLabel:f(),cancelLabel:r(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(oe(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(0,Y.jsx)(at,{q:S,onQChange:C,onReset:()=>C(``),canReset:S!==``,searchPlaceholder:ge()}),(0,Y.jsx)(ot,{title:fe(),rows:ee,addLabel:Ne(),onAdd:t?T:void 0,emptyHint:be(),columns:[{header:ce(),cell:e=>e.name,sort:e=>e.name},{header:ke(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(lt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Y.jsx)(q,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:we(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:k(),cell:e=>(0,Y.jsx)(K,{icon:(0,Y.jsx)(ct,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Y.jsx)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Oe(),onSelect:()=>b({groupId:e._id,name:e.name})},...t?[{label:Se(),onSelect:()=>te(e)},{label:je(),variant:`destructive`,onSelect:()=>void re(e)}]:[]]}),(0,Y.jsx)(Ze,{open:c,onOpenChange:l,title:d?D():w(),description:E(),canSubmit:!!m.name.trim(),onSubmit:ne,submitLabel:M(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,Y.jsx)(U,{value:m.name,onChange:e=>_({...m,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,Y.jsx)(U,{value:m.description,onChange:e=>_({...m,description:e.target.value})})]})]})}),(0,Y.jsx)(Bt,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||b(null)}})]})}var Rt=8;function zt({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Y.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Y.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Y.jsx)(st,{size:14,"aria-hidden":!0}),m()]}),(0,Y.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":C({page:e,pages:t}),children:[e,` / `,t]}),(0,Y.jsxs)(z,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[d(),(0,Y.jsx)(Ue,{size:14,"aria-hidden":!0})]})]})}function Bt({groupId:e,groupName:t,open:n,onOpenChange:r}){let o=x(u.groups.getGroup,n&&e?{groupId:e}:`skip`),s=x(u.groups.listAssignableInstances,n?{}:`skip`),c=x(u.groups.listAssignableUsers,n?{}:`skip`),d=y(u.groups.addMember),f=y(u.groups.removeMember),m=y(u.groups.bulkSetMembers),h=y(u.groups.setGroupManager),g=B(),[v,b]=(0,J.useState)(``),[C,w]=(0,J.useState)(``),[T,E]=(0,J.useState)(`members`),[ae,D]=(0,J.useState)(1),[O,oe]=(0,J.useState)(new Set),k=(0,J.useRef)(null),A=(0,J.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),ce=(0,J.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),ue=o?.viewerIsAdmin===!0,j=(0,J.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,J.useEffect)(()=>{b(``),w(``),E(`members`),D(1),k.current=null},[n,e]),(0,J.useEffect)(()=>{D(1)},[v]),(0,J.useEffect)(()=>{n&&o&&e&&k.current!==e&&(k.current=e,oe(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let M=(0,J.useMemo)(()=>c?Dt(c,v,O):[],[c,v,O]);async function de(t,n){if(e)try{n?await f({groupId:e,userId:t}):await d({groupId:e,userId:t})}catch(e){g.error(he(),e)}}async function fe(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(se(),e)}}let N=jt(M,e=>A.has(e.userId)),pe=M.filter(e=>A.has(e.userId)).length,P=Mt(M,ae,Rt);async function me(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await m({groupId:e,userIds:t,member:N!==`all`})}catch(e){g.error(he(),e)}}return(0,Y.jsx)(We,{open:n,onOpenChange:r,children:(0,Y.jsxs)(He,{className:`oc-access`,children:[(0,Y.jsxs)(Qe,{children:[(0,Y.jsx)(tt,{children:ie({name:t})}),(0,Y.jsx)(Je,{children:ne()})]}),(0,Y.jsxs)(Nt,{value:T,onValueChange:E,className:`oc-access__tabs`,children:[(0,Y.jsxs)(Ft,{className:`w-full`,children:[(0,Y.jsxs)(Q,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(lt,{size:13,"aria-hidden":!0}),p(),o?(0,Y.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Y.jsxs)(Q,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(W,{size:13,"aria-hidden":!0}),a(),o?(0,Y.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Y.jsxs)(Q,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(ct,{size:13,"aria-hidden":!0}),Re(),o?(0,Y.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Y.jsx)($,{value:`members`,children:c===void 0||o===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:S()}):c.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(U,{value:v,onChange:e=>b(e.target.value),placeholder:re(),className:`oc-access__search`}),M.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,Y.jsxs)(Y.Fragment,{children:[M.length>1?(0,Y.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Y.jsx)(V,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void me(),"aria-label":_()}),(0,Y.jsx)(`span`,{className:`oc-access__label`,children:_()}),(0,Y.jsxs)(H,{variant:`outline`,className:`oc-access__count`,children:[pe,` / `,M.length]})]}):null,(0,Y.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=A.has(e.userId),n=kt(e),r=ce.has(e.userId);return(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:t,onCheckedChange:()=>void de(e.userId,t),"aria-label":i({user:n.primary})}),(0,Y.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Y.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Y.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Y.jsx)(H,{variant:`outline`,className:`oc-access__role`,children:At(e.role)}),(0,Y.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ue?(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?ye():Me(),title:r?ye():Me(),onClick:()=>void fe(e.userId,r),children:(0,Y.jsx)(q,{size:15,"aria-hidden":!0})}):t&&r?(0,Y.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":le(),title:le(),children:(0,Y.jsx)(q,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Y.jsx)(zt,{page:P.page,pageCount:P.pageCount,onPage:D})]})]})}),(0,Y.jsx)($,{value:`agents`,children:s===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:S()}):s.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(U,{value:C,onChange:e=>w(e.target.value),placeholder:ze(),className:`oc-access__search`}),(0,Y.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Y.jsx)(Vt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:C},`${e}-${t._id}`))})]})}),(0,Y.jsx)($,{value:`charts`,children:(0,Y.jsx)(Ht,{groupId:e})})]})]})})}function Vt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=x(u.groups.listAssignableAgents,{instanceName:t}),c=y(u.groups.assignAgentToGroup),l=y(u.groups.removeAgentFromGroup),d=y(u.groups.bulkSetGroupAgents),f=B(),[p,m]=(0,J.useState)(1);if((0,J.useEffect)(()=>{m(1)},[i]),!e)return null;let h=Ot(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&h.length===0)return null;let v=h.filter(e=>e.presentInLastOk!==!1),b=jt(v,e=>r.has(`${t}/${e.agentId}`)),S=Mt(h,p,Rt);async function C(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){f.error(De(),e)}}async function w(){if(v.length===0)return;let n=v.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:b!==`all`})}catch(e){f.error(De(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Y.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Y.jsx)(W,{size:13,"aria-hidden":!0}),(0,Y.jsx)(`span`,{children:t}),(0,Y.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,Y.jsx)(H,{variant:`outline`,className:`oc-access__stale`,children:T()}):null]}),a===void 0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:s()}):h.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:g?o():Ie()}):(0,Y.jsxs)(Y.Fragment,{children:[v.length>1?(0,Y.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Y.jsx)(V,{checked:b===`all`?!0:b===`some`?`indeterminate`:!1,onCheckedChange:()=>void w(),"aria-label":_()}),(0,Y.jsx)(`span`,{className:`oc-access__label`,children:_()})]}):null,S.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:i,disabled:a&&!i,onCheckedChange:()=>void C(e.agentId,i),"aria-label":ve({name:e.displayName??e.agentId})}),(0,Y.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Y.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Y.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":A(),title:A(),children:(0,Y.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Y.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:Le()}):null]},e.agentId)}),(0,Y.jsx)(zt,{page:S.page,pageCount:S.pageCount,onPage:m})]})]})}function Ht({groupId:e}){let t=x(u.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=y(u.charts.assignChartToGroup),r=y(u.charts.removeChartFromGroup),i=y(u.charts.setGroupDefaultChart),a=y(u.charts.addChartToGroupPool),o=y(u.charts.removeChartFromGroupPool),s=B();if(!e)return null;if(t===void 0)return(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:S()});let{pool:c,addable:l,canManagePool:d}=t;if(c.length===0&&!d)return(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:Fe()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(I(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Y.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Y.jsx)(V,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":xe({name:e.name})}),(0,Y.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Y.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Te(),title:Te(),children:(0,Y.jsx)(G,{size:14,fill:`currentColor`})}):(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:de()}):null,d?(0,Y.jsx)(z,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Y.jsx)(Ve,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?l.length>0?(0,Y.jsxs)(nt,{value:``,onValueChange:e=>void m(e),children:[(0,Y.jsx)(rt,{size:`sm`,className:`oc-access__search`,children:(0,Y.jsx)(Ge,{placeholder:pe()})}),(0,Y.jsx)(it,{children:l.map(e=>(0,Y.jsx)(Ke,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Y.jsx)(`p`,{className:`oc-access__hint`,children:O()}):null:null]})}export{Lt as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,Af as a,Ap as o,Aw as s,Bf as c,Bp as l,Cf as u,Cp as d,Df as f,Dp as p,Ef as m,Ep as h,Ew as g,Ff as _,Fp as v,Gf as y,Gp as b,Hf as x,Hp as S,If as C,Ip as w,Jf as T,Jp as ee,Kf as E,Kp as D,Lf as te,Lp as ne,Mf as re,Mp as ie,Mw as O,Nf as ae,Np as oe,Nw as k,Ny as se,Of as ce,Op as le,Pf as ue,Pp as de,Py as fe,Qf as pe,Qp as me,Rf as he,Rp as ge,Sf as _e,Sp as ve,Tf as ye,Tp as be,Uf as xe,Up as Se,Vf as A,Vp as Ce,Wf as j,Wp as we,Xf as Te,Xp as Ee,Yf as De,Yp as Oe,Zf as ke,Zp as Ae,_c as je,_p as Me,am as Ne,ap as Pe,bf as Fe,bp as Ie,cp as Le,dp as Re,em as ze,ep as Be,fp as M,gc as Ve,gp as N,hp as He,im as Ue,ip as We,jf as Ge,jp as Ke,kf as qe,kp as Je,lp as Ye,mp as Xe,nm as Ze,np as Qe,om as $e,op as et,pp as tt,qf as nt,qp as rt,rm as it,rp as at,sp as ot,tm as st,tp as ct,up as lt,vp as ut,wf as dt,wp as ft,xf as P,xp as pt,yp as mt,zf as ht,zp as gt}from"./dist-ONRHFnrv.js";import{a as _t,c as vt}from"./FieldLabel-BAi9qHY_.js";import{t as F}from"./button-B6rrzUWu.js";import{$ as I,A as L,D as R,H as yt,Q as z,S as B,U as bt,V as xt,X as V,Z as H,b as U,et as W,j as St,m as Ct,nt as G,rt as K,v as q,x as J,y as wt}from"./index-Ci__4cCS.js";import{t as Tt}from"./DataTableShell-DY8nOACn.js";import{InstanceConfigDialog as Et}from"./BridgeTab-CaRqpzhJ.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Dt=new Set(X),Ot=`conversational`;function kt(e){let t=new Set((e??[]).filter(e=>Dt.has(e)));return t.size===0?[Ot]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:_t},At={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function jt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Mt(){let e=k(g.admin.listInstances,{}),t=k(g.agents.listAllInstanceAgents,{}),n=O(g.admin.upsertInstance),r=O(g.admin.deleteInstance),a=L(),[s,c]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null);async function T(){try{await n({instanceId:x??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),C(null),c(!1)}catch(e){a.error(Ue(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[it(),(0,Z.jsx)(`strong`,{children:Ze()}),st()]}),(0,Z.jsx)(Tt,{title:ze(),rows:e,addLabel:i(),onAdd:()=>{C(null),d(Q),c(!0)},emptyHint:me(),columns:[{header:Ae(),cell:e=>e.name,sort:e=>e.name},{header:Ee(),cell:e=>(0,Z.jsx)(V,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Oe(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ee(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:$e(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(V,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?P():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:we(),onSelect:()=>{C(e._id),d(jt(e)),c(!0)}},{label:Ne(),onSelect:()=>p(e.name)},{label:Je(),onSelect:()=>y(e)},{label:rt(),onSelect:()=>h(e)},{label:D(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:D(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ct,{open:s,onOpenChange:c,title:x?Se():b(),description:Ce(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:T,submitLabel:l(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:gt(),children:[(0,Z.jsx)(H,{value:u.name,disabled:x!==null,onChange:e=>d({...u,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:S()}):null]}),(0,Z.jsx)($,{label:ge(),children:(0,Z.jsxs)(q,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(J,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(U,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(U,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:ne(),children:(0,Z.jsx)(H,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:w(),children:(0,Z.jsx)(H,{value:u.bridgeUrl,placeholder:v(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:de(),children:(0,Z.jsx)(H,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:je(),children:[(0,Z.jsxs)(q,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(J,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(B,{})}),(0,Z.jsx)(wt,{children:vt.map(e=>(0,Z.jsx)(U,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ve()})]}),(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(H,{value:u.gatewayVersion,placeholder:ie(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ke(),children:(0,Z.jsx)(H,{value:u.gatewayHttpUrl,placeholder:o(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Ht,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Et,{instance:m,onClose:()=>h(null)},m._id):null,_?(0,Z.jsx)(Nt,{instance:_,onClose:()=>y(null)},_._id):null]})}function Nt({instance:e,onClose:t}){let n=k(g.instanceSecrets.listInstanceSecretStatus,{}),r=At[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(z,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(I,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:le({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:p()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(It,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ft,{instance:e})}),(0,Z.jsx)(Pt,{instance:e})]})})}function Pt({instance:e}){let t=s(g.instanceSync.forceInstanceSync),n=L(),[i,a]=(0,Y.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ot());break;case`no_agents`:n.success(Pe());break;case`no_bridge_url`:n.error(We());break;case`deploy_misconfigured`:n.error(at());break;case`unauthorized`:n.error(ct());break;case`not_served`:n.error(Be());break;default:n.error(Qe());break}}catch(e){n.error(et(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?Le():Ye()})})]})}function Ft({instance:e}){let t=k(g.bridgeAuth.listBridgeAuthStatus,{}),n=s(g.bridgeAuth.mintBridgeSecret),r=O(g.bridgeAuth.revokeBridgeSecret),i=L(),[a,o]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),[u,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(E(),e)}finally{o(!1)}}}async function _(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(nt())}catch(e){i.error(E(),e)}finally{o(!1)}}}async function v(){if(c)try{await navigator.clipboard.writeText(c),f(!0)}catch{}}return(0,Z.jsxs)($,{label:pe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:m?`outline`:`secondary`,children:m?`${d()} · ${p.prefix}…${p.lastFour}`:ve()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?De():Te()}),m?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:a,children:T()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:y()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:u?fe():se()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),f(!1)},children:j()})]}):null]})}function It({instanceId:e,field:t,updatedAt:n}){let r=s(g.instanceSecrets.setInstanceSecret),i=O(g.instanceSecrets.clearInstanceSecret),a=s(g.deviceIdentity.generateDeviceIdentity),o=L(),[c,l]=(0,Y.useState)(``),[u,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(!1),y=n!==null,b=t===`deviceIdentity`,x=t===`token`?h():t===`deviceIdentity`?be():ft();async function S(){if(!(!c.trim()||u)){f(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),m(null),v(!1),o.success(Me())}catch(e){o.error(N(),e)}finally{f(!1)}}}async function C(){if(!u){f(!0);try{await i({instanceId:e,field:t}),m(null),v(!1),o.success(He())}catch(e){o.error(N(),e)}finally{f(!1)}}}async function w(){if(!u){f(!0);try{m(await a({instanceId:e})),v(!1),o.success(M())}catch(e){o.error(lt(),e)}finally{f(!1)}}}let T=p?`openclaw devices approve ${p.id}`:``;async function ee(){if(T)try{await navigator.clipboard.writeText(T),v(!0)}catch{}}return(0,Z.jsxs)($,{label:x,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:y?`outline`:`secondary`,children:y?d():ve()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:y?Ie():pt(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void S(),disabled:u||c.trim().length===0,children:mt()}),b?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:u,children:Xe()}):null,y?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:u,children:ut()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:M()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:T}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void ee(),children:_?fe():se()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),v(!1)},children:j()})]}):null]})}var Lt={conversational:C,documentary:ue},Rt={conversational:_,documentary:ae},zt=e=>(Lt[e]??(()=>e))(),Bt=e=>(Rt[e]??(()=>``))();function Vt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:c()}),t.map(e=>(0,Z.jsx)(V,{variant:`secondary`,className:`oc-agenttype__chip`,title:Bt(e),children:zt(e)},e)),(0,Z.jsxs)(xt,{children:[(0,Z.jsx)(bt,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ht()})}),(0,Z.jsxs)(yt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:he()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:te()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(R,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:zt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Bt(r)})]})]},r)})})]})]})]})}function Ht({instanceName:e,open:t,onOpenChange:n}){let r=k(g.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=O(g.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(g.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(g.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=O(g.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(g.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(g.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=O(g.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(g.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=kt(r);e.setQuery(g.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=O(g.agents.removeInstanceAgent),l=St(),d=L();async function p(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(A(),e)}}async function h(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(A(),e)}}async function _(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){d.error(A(),e)}}async function v(t,n){if(e&&await l({title:a({name:n}),description:qe(),confirmLabel:ce(),destructive:!0}))try{await c({instanceName:e,agentId:t}),d.success(f())}catch(e){d.error(A(),e)}}return(0,Z.jsx)(z,{open:t,onOpenChange:n,children:(0,Z.jsxs)(I,{className:`oc-access`,children:[(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:xe({name:e??``})}),(0,Z.jsx)(W,{children:x()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ye():r.discovery.lastPollOk?dt():u({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(R,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void p(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:Fe()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:Ge()})]}):n?(0,Z.jsx)(V,{variant:`default`,children:P()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void h(e.agentId),children:re()})]}),e.enabled?(0,Z.jsx)(Vt,{agentId:e.agentId,types:a,onToggle:t=>void _(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Mt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,Cg as a,Dg as ee,Eg as o,Ew as s,Gh as te,Hh as c,Ih as l,Jh as u,Kh as d,Lh as ne,Mw as re,Nw as ie,Og as ae,Qh as oe,Rh as se,Sg as f,Tg as ce,Uh as le,Vh as ue,Wh as p,Xh as m,Yh as h,Zh as g,_g as _,ag as v,bg as y,cg as b,dg as x,eg as S,fg as C,gg as w,hg as T,ig as E,lg as D,mg as O,ng as k,og as A,pg as j,qh as M,rg as N,sg as P,tg as F,ug as I,vg as L,wg as R,xg as z,yg as B,zh as V}from"./dist-ONRHFnrv.js";import{D as H,S as U,X as W,Z as G,b as K,v as q,x as de,y as fe}from"./index-Ci__4cCS.js";import{t as pe}from"./DataTableShell-DY8nOACn.js";var J=t(e(),1),Y=n();function me(){let e=ie(s.integrations.status.status,{}),t=re(s.admin.setIntegrationConfig),[n,H]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&H(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ae()});let U=n,K=(e,t,n)=>H({...U,[e]:{...U[e],[t]:n}}),q=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,Y.jsx)(`strong`,{children:o()}),` `,ce()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(W,{variant:`secondary`,children:R()}):(0,Y.jsx)(W,{variant:`outline`,children:a()}):(0,Y.jsx)(W,{variant:`outline`,children:f()}),note:y(),children:[(0,Y.jsx)(Z,{label:L(),children:(0,Y.jsx)(G,{value:U.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>K(`langfuse`,`host`,e.target.value),onBlur:()=>q(`langfuse`,{host:U.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:O(),checked:U.langfuse.enabled??!0,onChange:e=>{K(`langfuse`,`enabled`,e),q(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(W,{variant:`secondary`,children:R()}):(0,Y.jsx)(W,{variant:`outline`,children:a()}):(0,Y.jsx)(W,{variant:`outline`,children:f()}),note:B(),children:[(0,Y.jsx)(Z,{label:_(),children:(0,Y.jsx)(G,{value:U.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>K(`opik`,`baseUrl`,e.target.value),onBlur:()=>q(`opik`,{baseUrl:U.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:w(),children:(0,Y.jsx)(G,{value:U.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||T(),onChange:e=>K(`opik`,`workspace`,e.target.value),onBlur:()=>q(`opik`,{workspace:U.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:O(),checked:U.opik.enabled??!0,onChange:e=>{K(`opik`,`enabled`,e),q(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:j(),status:(0,Y.jsx)(W,{variant:`outline`,children:z()}),note:C(),children:[(0,Y.jsx)(Z,{label:x(),children:(0,Y.jsx)($,{value:U.tts.auto??`off`,options:[[`off`,I()],[`always`,D()],[`inbound`,b()],[`tagged`,P()]],onChange:e=>{K(`tts`,`auto`,e),q(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:A(),children:(0,Y.jsx)($,{value:U.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,v()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{K(`tts`,`provider`,e),q(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:E(),children:(0,Y.jsx)(G,{value:U.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>K(`tts`,`model`,e.target.value),onBlur:()=>q(`tts`,{model:U.tts.model??``})})}),(0,Y.jsx)(Z,{label:N(),children:(0,Y.jsx)(G,{value:U.tts.voice??``,placeholder:k(),onChange:e=>K(`tts`,`voice`,e.target.value),onBlur:()=>q(`tts`,{voice:U.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:F(),status:(0,Y.jsx)(W,{variant:`outline`,children:z()}),note:e.secrets.openai?S():r(),children:[(0,Y.jsx)(Q,{label:oe(),checked:U.talk.enabled??!1,onChange:e=>{K(`talk`,`enabled`,e),q(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:g(),children:(0,Y.jsx)($,{value:U.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{K(`talk`,`realtimeProvider`,e),q(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:m(),children:(0,Y.jsx)(G,{value:U.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>K(`talk`,`realtimeModel`,e.target.value),onBlur:()=>q(`talk`,{realtimeModel:U.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:N(),children:(0,Y.jsx)(G,{value:U.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>K(`talk`,`voice`,e.target.value),onBlur:()=>q(`talk`,{voice:U.talk.voice??``})})}),(0,Y.jsx)(Z,{label:h(),children:(0,Y.jsx)($,{value:U.talk.transport??`webrtc`,options:[[`webrtc`,u()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{K(`talk`,`transport`,e),q(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:M(),children:(0,Y.jsx)(G,{value:U.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>K(`talk`,`speechLocale`,e.target.value),onBlur:()=>q(`talk`,{speechLocale:U.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:d(),checked:U.talk.interruptOnSpeech??!0,onChange:e=>{K(`talk`,`interruptOnSpeech`,e),q(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:te()}),(0,Y.jsx)(W,{variant:`outline`,children:p()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[le(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(pe,{title:c(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:ue(),columns:[{header:i(),cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:V(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:se(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:ne(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:l(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(H,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(q,{value:e,onValueChange:n,children:[(0,Y.jsx)(de,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(U,{})}),(0,Y.jsx)(fe,{children:t.map(([e,t])=>(0,Y.jsx)(K,{value:e,children:t},e))})]})}export{me as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bo as r,Ew as i,Fo as a,Ho as o,Io as s,Lo as c,Mo as l,No as u,Nw as d,Po as f,Ro as p,Uo as m,Vo as h,Wo as g,jo as _,zo as v}from"./dist-ONRHFnrv.js";import{n as y,t as b}from"./TimeRangePicker-B2SK3o8o.js";import{At as x,a as S,kt as C,n as w,r as T}from"./index-Ci__4cCS.js";import{a as E,n as D,o as O,r as k,t as A}from"./card-C0DYbnDZ.js";var j=t(e(),1),M=n(),N=[{metric:`api.calls`,label:g(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:m(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:o(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:h(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:r(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:v(),unit:`/h`,group:`Assistant`,isError:!0}],P=N.length,F=[`API`,`OpenClaw`,`Chat`,`Assistant`],I=1e3,L=36e5;function R(e,t){let n=Math.max(1,Math.ceil((t-e)/L)),r=Math.min(n*P,I);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/P))}}function z(){let e=x({from:`/settings/kpi`}),t=C({from:`/settings/kpi`}),n=T(e.from,e.to,w,`now`),r=e=>void t({search:t=>({...t,...S(e)})}),{from:o,to:l}=y(n),{rowLimit:u,buckets:f}=R(o,l),m=d(i.kpi.listKpis,{limit:u,filter:{from:o,to:l}}),h=(0,j.useMemo)(()=>{let e=new Map;for(let t of m??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>f&&e.set(t,n.slice(n.length-f));return e},[m,f]),g=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,M.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,M.jsx)(B,{value:n,onChange:r})]});return m===void 0?(0,M.jsxs)(M.Fragment,{children:[g,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):m.length===0?(0,M.jsxs)(M.Fragment,{children:[g,(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]}):(0,M.jsxs)(M.Fragment,{children:[g,F.map(e=>{let t=N.filter(t=>t.group===e);return t.some(e=>(h.get(e.metric)??[]).length>0)?(0,M.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,M.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,M.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,M.jsx)(V,{config:e,series:h.get(e.metric)??[]},e.metric))})]},e):null})]})}function B({value:e,onChange:t}){return(0,M.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,M.jsx)(b,{value:e,onChange:t})})}function V({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,M.jsxs)(A,{size:`sm`,className:`oc-kpi__card`,children:[(0,M.jsxs)(E,{children:[(0,M.jsx)(O,{className:`oc-kpi__card-title`,children:e.label}),(0,M.jsx)(k,{className:`oc-kpi__card-metric`,children:(0,M.jsx)(`code`,{children:e.metric})})]}),(0,M.jsxs)(D,{className:`oc-kpi__card-body`,children:[(0,M.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,M.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:K(r)}),(0,M.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,M.jsx)(G,{series:t,isError:e.isError,unit:e.unit}),(0,M.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,M.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:f({value:q(n.bucket)})}):(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:u()}),(0,M.jsx)(`span`,{className:`oc-kpi__muted`,children:l({count:t.length})})]})]})]})}var H=240,U=48,W=1;function G({series:e,isError:t,unit:n}){if(e.length===0)return(0,M.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=H/e.length,a=Math.max(i-W,1);return(0,M.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${H} ${U}`,preserveAspectRatio:`none`,role:`img`,"aria-label":_({max:K(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(U-1):0,c=o*i,l=U-s;return(0,M.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,M.jsxs)(`title`,{children:[q(e.bucket),` · `,K(e.value),` `,n]})},e.bucket)})})}function K(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function q(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{z as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$b as i,BC as a,Bp as o,Cx as s,Ew as c,FC as l,GC as u,HC as d,IC as ee,JC as te,Jb as f,Kb as p,LC as ne,Mw as m,NC as h,Nw as g,PC as re,Qb as _,RC as ie,Sx as v,Tx as y,UC as ae,VC as oe,WC as se,Xb as ce,Yb as le,Zb as ue,_x as de,ax as fe,bx as b,cx as x,dx as S,ex as C,fx as w,gx as T,hx as E,ix as D,lx as O,mx as k,nx as A,ox as j,px as M,qb as N,rx as P,sx as F,tx as I,ux as L,vx as R,wx as z,xx as B,yx as V,zC as pe}from"./dist-ONRHFnrv.js";import{t as H}from"./button-B6rrzUWu.js";import{A as me,D as U,O as he,S as ge,Z as W,b as G,ot as K,v as _e,x as ve,y as ye}from"./index-Ci__4cCS.js";var q=t(e(),1),J=[{id:`messages`,label:()=>y()},{id:`composer`,label:()=>z()},{id:`sidebar`,label:()=>s()},{id:`other`,label:()=>v()}],Y={showSource:{category:`messages`,label:()=>B(),help:()=>b()},showReport:{category:`messages`,label:()=>V(),help:()=>R()},copyAssistant:{category:`messages`,label:()=>de()},copyUser:{category:`messages`,label:()=>T()},showDelete:{category:`messages`,label:()=>E()},showTools:{category:`messages`,label:()=>k(),help:()=>M()},voiceInput:{category:`composer`,label:()=>w(),help:()=>S()},showChatAge:{category:`sidebar`,label:()=>L(),help:()=>O()},showChatProvider:{category:`sidebar`,label:()=>x(),help:()=>F()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>ce()};function De({prefKey:e,ui:t}){let n=m(c.admin.setUiPrefDefault),r=m(c.admin.setFeatureEnabled),a=Te(e),o=a?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:C()}),(0,$.jsxs)(_e,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(ve,{size:`sm`,className:`w-36`,children:(0,$.jsx)(ge,{})}),(0,$.jsxs)(ye,{children:[(0,$.jsx)(G,{value:`on`,children:f()}),(0,$.jsx)(G,{value:`off`,children:N()}),(0,$.jsx)(G,{value:`inherit`,children:p()})]})]}),a?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(U,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void r({key:a,enabled:e===!0}),"aria-label":i()}),i()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=g(c.me.getMe,{host:K}),o=a?.ui,s=Z(a?.role)&&n,l=m(c.me.setUiPref).withOptimisticUpdate(he),u=(0,q.useMemo)(()=>o?be(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(a?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(U,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":I()}),I()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:_()}),(0,$.jsx)(`p`,{children:ue()}),(0,$.jsx)(`p`,{children:le()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:j(),"aria-label":j(),className:`mb-2`}),u.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:fe()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],c=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${c&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:D()}):c?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:P()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&c?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:A()}):null,(0,$.jsx)(U,{checked:a,disabled:i,onCheckedChange:t=>void l({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:o}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:r()})}function ke(){let e=g(c.me.getMe,{host:K}),t=m(c.me.setLocale),n=m(c.me.setMyName),r=me(),i=e?.locale??`default`,s=e?.name??``,[f,p]=(0,q.useState)(null),_=f??s,v=_.trim()!==s.trim();async function y(){try{await n({name:_}),p(null),r.success(oe())}catch(e){r.error(a(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:u()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:_,maxLength:120,placeholder:ae(),onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&v&&(e.preventDefault(),y())}}),(0,$.jsx)(H,{size:`sm`,disabled:!v,onClick:()=>void y(),children:o()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?re():e===`en`?h():te()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -1,2 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Ew as i,Js as a,Mw as o,Nw as s,Qs as c,Xs as l,Ys as u,Zs as d,ac as f,bc as p,cc as m,dc as h,ec as g,fc as _,ic as v,lc as y,nc as b,oc as x,pc as S,rc as C,sc as w,tc as T,uc as E,xc as D}from"./dist-ONRHFnrv.js";import{d as O,f as k,i as A,l as j,n as M,r as N,t as P,u as F}from"./FieldLabel-BAi9qHY_.js";import{t as I}from"./button-B6rrzUWu.js";import{A as L,D as R,S as z,b as B,v as V,x as H,y as U}from"./index-Ci__4cCS.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:m,help:w},documentary_fetch:{label:x,help:f},inbound_files:{label:v,help:C}},q={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`},J={outboundDir:l,references:u,files:a};function Y(){let e=s(i.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:T()})});let r=e.find(e=>e._id===t)??e[0];return(0,G.jsxs)(`div`,{className:`oc-injtab`,children:[(0,G.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,G.jsx)(M,{label:S(),help:_()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:b()}),(0,G.jsxs)(V,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(H,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(z,{})}),(0,G.jsx)(U,{children:e.map(e=>(0,G.jsx)(B,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=o(i.admin.upsertInstanceConfig),n=L(),r=e.config??{},[a,s]=(0,W.useState)(()=>A(r)),[c,l]=(0,W.useState)(!1),u=a.promptInjections,d=(e,t)=>s({...a,promptInjections:{...u,[e]:{...u[e],...t}}});async function f(){l(!0);try{await t({instanceId:e._id,config:N(a,r)})}catch(e){n.error(p(),e)}finally{l(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[F.map(e=>(0,G.jsx)(Z,{injKey:e,def:j[e],i18n:K[e],row:u[e]??{enabled:!0,template:j[e].defaultTemplate},onChange:t=>d(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void f(),disabled:c,children:D()})})]})}function Z({injKey:e,def:t,i18n:n,row:i,onChange:a}){let[o,s]=(0,W.useState)(!1),l=i.template.trim()!==t.defaultTemplate,u=t.togglable&&!i.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),p=O(e,i),m=p?k(p,f):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(R,{checked:i.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),l&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:E()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:y()}),t.placeholders.map(e=>(0,G.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,G.jsx)(`code`,{children:`{${e}}`}),(0,G.jsx)(P,{text:(J[e]??(()=>e))()})]},e))]}),(0,G.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?r():g()}),l&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate}),children:h()})]})]}),o&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:c()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:d()})})]})}export{Y as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as ee,Bd as te,Cd as ne,Ew as i,Fd as a,Gd as o,Hd as re,Id as s,Jd as c,Kd as l,Ld as u,Md as d,Mw as f,Nd as p,Nw as m,Pd as h,Qd as g,Rd as _,Sd as v,Ud as y,Vd as b,Wd as ie,Xd as x,Yd as S,Zd as C,_d as w,bd as T,ef as E,gd as D,hd as O,if as k,jd as A,kd as j,nf as M,qd as N,rf as P,tf as F,vd as I,xd as L,yd as R,zd as ae}from"./dist-ONRHFnrv.js";import{t as z}from"./button-B6rrzUWu.js";import{A as B,D as V,X as H,Z as U,j as W,m as G,xt as K}from"./index-Ci__4cCS.js";import{t as q}from"./roleDescriptions-DoeFMOcx.js";var J=t(e(),1),Y=n(),X=[{group:()=>k(),keys:[{key:`traces.read`,label:()=>r()},{key:`traces.read.content`,label:()=>g(),phi:!0},{key:`traces.write`,label:()=>C()}]},{group:()=>P(),keys:[{key:`kpi.read`,label:()=>r()},{key:`kpi.write`,label:()=>C()}]},{group:()=>M(),keys:[{key:`openclaw.query`,label:()=>x()},{key:`anomalies.read`,label:()=>S()},{key:`anomalies.report`,label:()=>c()}]},{group:()=>F(),keys:[{key:`chats.read`,label:()=>r()},{key:`selfheal`,label:()=>l()}]},{group:()=>E(),keys:[{key:`admin.manage`,label:()=>N()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=m(i.apiKeys.listRoles,{}),t=f(i.apiKeys.createRole),n=f(i.apiKeys.ensureRolesSeeded),r=f(i.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(i.apiKeys.listRoles,{});r&&e.setQuery(i.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=W(),l=B(),[g,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(Q),[E,k]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{l.error(ie(),e)})},[n,l]);let M=e??[];async function N(e,t){if(Z(e.permissions)||E.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await c({title:y({name:e.name}),description:re(),confirmLabel:b()}))){k(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){l.error(te(),e)}finally{k(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function P(){try{await t({key:S.key,name:S.name,description:S.description||void 0,permissions:[]}),C(Q),x(!1)}catch(e){l.error(ae(),e)}}let F=e===void 0,$=!F&&M.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,u(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,s()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:a()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{C(Q),x(!0)},children:h()})})]}),F?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:A()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?o({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:M.map(e=>{let t=Z(e.permissions),n=E.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,ee()]}):(0,Y.jsx)(H,{variant:`secondary`,children:j()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ne():n?v():r,onCheckedChange:()=>void N(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:g,onOpenChange:x,title:L(),description:T(),canSubmit:!!(S.key&&S.name),onSubmit:P,submitLabel:R(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:I()}),(0,Y.jsx)(U,{value:S.key,placeholder:w(),onChange:e=>C({...S,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:D()}),(0,Y.jsx)(U,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,Y.jsx)(U,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ab as ee,Aw as te,Ay as i,Bb as a,By as o,Cb as ne,Db as re,Dy as s,Eb as ie,Ew as c,Ey as ae,Fb as oe,Fy as l,Gb as se,Gy as u,Hb as ce,Hy as d,Ib as le,Iy as f,Jy as p,Ky as m,Lb as ue,Ly as h,Mb as de,Mw as g,My as _,Nb as fe,Nw as v,Ny as pe,Ob as me,Oy as y,Pb as he,Py as b,Qy as ge,Rb as _e,Ry as ve,Sb as ye,Tb as be,Ty as x,Ub as xe,Uy as S,Vb as Se,Vy as C,Wb as Ce,Wy as w,Xy as we,Yy as Te,Zy as Ee,_b as De,ab as Oe,bb as ke,cb as Ae,db as je,eb as Me,fb as Ne,gb as Pe,hb as Fe,ib as Ie,jb as Le,jy as T,kb as Re,ky as E,lb as ze,mb as Be,nb as Ve,ob as He,pb as Ue,qy as D,rb as We,sb as Ge,tb as Ke,ub as qe,vb as Je,wb as Ye,xb as Xe,yb as Ze,zb as O,zy as k}from"./dist-ONRHFnrv.js";import{n as A}from"./dist-D0lueamf.js";import{i as Qe}from"./dist-CEr_Gjjt.js";import{t as j}from"./button-B6rrzUWu.js";import{$ as M,A as $e,At as et,Et as N,Ot as tt,Q as P,S as F,X as I,Z as L,b as R,et as z,j as nt,kt as rt,m as it,nt as B,rt as V,tt as H,v as U,x as W,y as G}from"./index-Ci__4cCS.js";import{t as at}from"./FilterBar-B3HyBcMN.js";import{t as ot}from"./DataTableShell-DY8nOACn.js";import{t as st}from"./roleDescriptions-DoeFMOcx.js";var K=t(e(),1),q=n(),ct=[{value:`never`,label:()=>T(),days:null},{value:`30`,label:()=>i(),days:30},{value:`90`,label:()=>E(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=et({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??J,[o,s]=(0,K.useState)(J),ae=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),u=v(c.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===J?void 0:o,disabled:i===J?void 0:i===`disabled`}}),d=v(c.apiKeys.listKeys,{}),f=v(c.apiKeys.listRoles,{}),p=g(c.apiKeys.createServiceAccount),m=g(c.apiKeys.updateServiceAccount),h=g(c.apiKeys.deleteServiceAccount),_=te(c.apiKeys.mintApiKey),pe=g(c.apiKeys.revokeApiKey),y=nt(),b=$e(),ve=n!==``||o!==J||i!==J;function x(){s(J),t({search:{},replace:!0})}let[S,C]=(0,K.useState)(!1),[w,T]=(0,K.useState)(Y),[E,D]=(0,K.useState)(null),[k,A]=(0,K.useState)(new Set),[M,N]=(0,K.useState)(null),P=(0,K.useRef)(!1),[z,B]=(0,K.useState)(new Set),[V,H]=(0,K.useState)({}),[lt,X]=(0,K.useState)(null),Z=(0,K.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await m({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),b.success(ze())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Y),D(null),C(!1)}catch(e){b.error(E?qe():je(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),C(!0)}async function $(e){if(P.current)return;P.current=!0;let t=V[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await _({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){b.error(Ae(),e)}finally{P.current=!1,N(null)}}async function mt(e){if(await y({title:Ge(),description:(0,q.jsxs)(q.Fragment,{children:[He(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Oe(),` `,(0,q.jsx)(`strong`,{children:Ie()}),` `,We()]}),confirmWord:e.name,confirmLabel:Ve(),destructive:!0}))try{await h({serviceAccountId:e._id}),b.success(Ke(),e.name)}catch(e){b.error(Me(),e)}}async function ht(e){if(await y({title:r(),description:(0,q.jsxs)(q.Fragment,{children:[ge(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ee()]}),confirmLabel:we(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await pe({keyId:e._id})}catch(e){b.error(Te(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,q.jsxs)(at,{q:n,onQChange:ae,searchPlaceholder:Ce(),onReset:x,canReset:ve,children:[(0,q.jsxs)(U,{value:o,onValueChange:s,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(F,{placeholder:xe()})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(R,{value:J,children:ce()}),(f??[]).map(e=>(0,q.jsx)(R,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(U,{value:i,onValueChange:l,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(F,{})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(R,{value:J,children:Se()}),(0,q.jsx)(R,{value:`active`,children:a()}),(0,q.jsx)(R,{value:`disabled`,children:O()})]})]})]}),(0,q.jsx)(ot,{title:_e(),rows:u,addLabel:ue(),onAdd:()=>{T(Y),D(null),C(!0)},emptyHint:le(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:de(),onSelect:()=>pt(e)},{label:oe(),onSelect:()=>void $(e)},{label:k.has(e._id)?he():fe(),onSelect:()=>Q(e._id)},{label:Le(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ee():Re(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,q.jsx)(Qe,{}):(0,q.jsx)(tt,{})})},{header:me(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:re(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:ie(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:O()}):(0,q.jsx)(I,{variant:`outline`,children:a()})},{header:be(),cell:e=>(0,q.jsxs)(U,{value:V[e._id]??`never`,onValueChange:t=>H(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(F,{})}),(0,q.jsx)(G,{children:ct.map(e=>(0,q.jsx)(R,{value:e.value,children:e.label()},e.value))})]})},{header:Ye(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?ne():ye({count:t})})}}]}),(0,q.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||D(null)},title:E?Xe():Je(),description:E?ke():De(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:E?Ze():Pe(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Fe()}),(0,q.jsx)(L,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Be()}),(0,q.jsxs)(U,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(F,{placeholder:Ue()})}),(0,q.jsx)(G,{children:(f??[]).map(e=>(0,q.jsxs)(R,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===w.roleKey),t=e?st(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ne()}),(0,q.jsx)(L,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[p(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:m()}),(0,q.jsx)(`th`,{children:u()}),(0,q.jsx)(`th`,{children:w()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:d()}),(0,q.jsx)(`th`,{children:C()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:Z(t.createdAt)}),(0,q.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:pt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?o():k()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function ee(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(P,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(M,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(B,{children:[(0,q.jsx)(V,{children:ve()}),(0,q.jsx)(z,{children:h({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:f()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void ee(),"aria-label":l(),children:[n?(0,q.jsx)(A,{}):(0,q.jsx)(N,{}),n?b():pe()]})]}),(0,q.jsx)(H,{children:(0,q.jsx)(j,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?y():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:s()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(I,{variant:`outline`,children:ae()}):(0,q.jsx)(I,{variant:`outline`,children:x()})}export{X as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AS as i,Aw as a,Ax as o,BS as s,Bx as c,CS as l,DS as u,Dw as d,Dx as f,ES as p,Ew as m,Ex as h,FS as g,Fx as ee,GS as te,Gx as ne,HS as re,Hx as ie,IS as ae,Ix as oe,JS as se,Jx as ce,KS as le,Kx as _,LS as ue,Lx as de,MS as fe,Mw as v,Mx as pe,NC as me,NS as he,Nw as y,Nx as ge,OS as _e,Ox as ve,PC as ye,PS as be,Px as b,Qx as xe,RS as x,Rx as Se,SS as Ce,TS as we,US as Te,Ux as Ee,VS as De,Vx as Oe,WS as ke,Wx as Ae,XC as je,Xx as S,YC as Me,Yx as Ne,ZC as Pe,Zx as Fe,_S as Ie,aS as Le,bS as Re,cS as ze,dS as C,eS as Be,fS as Ve,gS as He,hS as Ue,iS as We,jS as Ge,jx as Ke,kS as qe,kx as Je,lS as Ye,mS as Xe,n as Ze,nS as Qe,oS as $e,pS as et,qS as tt,qx as nt,rS as rt,sS as it,tS as at,uS as ot,vS as st,wS as ct,xS as lt,yS as ut,zS as dt,zx as ft}from"./dist-ONRHFnrv.js";import{n as w}from"./dist-D0lueamf.js";import{t as pt}from"./TimeRangePicker-B2SK3o8o.js";import{t as T}from"./x-BKk70OzX.js";import{t as E}from"./button-B6rrzUWu.js";import{D,G as mt,J as O,K as k,S as A,W as ht,X as j,Y as gt,Z as M,at as _t,b as N,it as vt,ot as P,q as yt,v as F,wt as I,x as L,y as R}from"./index-Ci__4cCS.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-C0DYbnDZ.js";import{a as Et,i as z,n as Dt,o as B,r as V,t as Ot}from"./table-BrqjFLFP.js";import{t as kt}from"./FilterBar-B3HyBcMN.js";import{t as At}from"./AdvancedFilter-Cjt4cP7-.js";var H=d(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),U=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function W(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ne());if(e.size>Rt)throw Error(ce());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(_());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(_());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);W(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=W(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await K(f,`image/webp`,Vt)??await K(f,`image/png`);if(!h)throw Error(ne());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return G(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return G(e)}async function G(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(nt())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function K(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var q=n(),J=`__all__`,Y={kind:`relative`,from:`now-24h`,to:`now`},X=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Z({title:e,description:t,children:n}){return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,q.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?Pe():e===`dark`?je():Me()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,q.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,q.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Q({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,q.jsxs)(`button`,{type:`button`,className:Ze(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,q.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,q.jsx)(w,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,q.jsx)(Kt,{tokens:r,mode:i}):(0,q.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,q.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=y(m.charts.listMyCharts),r=v(m.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:s()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:dt()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,q.jsx)(Q,{selected:e===null,title:x(),subtitle:ue(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?ae():n.via===`owner`?g():be({group:n.via.group});return(0,q.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:he()}):null]})}function Jt(){let e=v(m.charts.importChart),[t,n]=(0,U.useState)(``),[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(C())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Ye());return}let a;try{a=JSON.parse(r)}catch{o(C());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:ut()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(0,q.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,q.jsx)(M,{value:t,onChange:e=>n(e.target.value),placeholder:He(),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Xe(),rows:8,spellCheck:!1})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),et(),(0,q.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,q.jsx)(E,{size:`sm`,disabled:l,onClick:()=>void f(),children:Ve()})]}),a?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,q.jsx)(`p`,{className:`oc-chart-import__ok`,children:ot()}):null]})]})}function Yt({chart:e}){let t=a(m.charts.setChartLogo),n=v(m.charts.removeChartLogo),[i,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),l=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function u(n,r,i){if(e.chartId!==void 0){c(null),o(!0);try{let{blob:a,hasAlpha:o}=await Ht(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}async function d(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await u(e,n)}async function f(t){if(e.chartId!==void 0){c(null),o(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}async function p(e){let t=l(e===`light`?`dark`:`light`);if(t){c(null),o(!0);try{await u(e,await(await fetch(t)).blob(),e)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}}function h({mode:e}){let t=l(e),n=l(e===`light`?`dark`:`light`);return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Qe():at()}),(0,q.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,q.jsx)(`img`,{src:t,alt:``}):null}),(0,q.jsx)(E,{variant:`outline`,size:`sm`,asChild:!0,children:(0,q.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,q.jsx)(H,{className:`size-4`}),t?r():Be(),(0,q.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void d(e,t)})]})}),!t&&n?(0,q.jsx)(E,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void p(e),children:Fe()}):null,t?(0,q.jsx)(E,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(e),children:xe()}):null]})}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:rt()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,q.jsx)(h,{mode:`light`}),(0,q.jsx)(h,{mode:`dark`})]}),i?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:S()}):null,s?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})}function $({chart:e}){let t=y(m.me.getMe,{host:P}),n=v(m.charts.addChartDomain),r=v(m.charts.removeChartDomain),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(null),[l,u]=(0,U.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ae()}),(0,q.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:c()}):d.map(e=>(0,q.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ft({domain:e}),onClick:()=>void p(e),children:(0,q.jsx)(T,{className:`size-3`})})]},e))}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(M,{value:i,onChange:e=>a(e.target.value),placeholder:ie(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,q.jsx)(E,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:Oe()})]}),(0,q.jsx)(`span`,{className:`oc-show__desc`,children:Ee()}),o?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function Xt({chart:e}){let t=v(m.charts.updateChart),n=v(m.charts.deleteChart),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(e.name),[s,c]=(0,U.useState)(()=>JSON.stringify(e.tokens,null,2)),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1);function p(){o(e.name),c(JSON.stringify(e.tokens,null,2)),u(null),i(!0)}async function h(){if(e.chartId===void 0)return;u(null);let n;try{n=JSON.parse(s)}catch{u(C());return}f(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}}async function g(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(E,{variant:`outline`,size:`sm`,onClick:p,children:Le()}),(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:We()})]})})]}),r?(0,q.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:oe()}),(0,q.jsx)(M,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,q.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,q.jsx)(`span`,{className:`oc-chart-import__label`,children:ee()}),(0,q.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),l?(0,q.jsx)(`p`,{className:`oc-chart-import__error`,children:l}):null,(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{size:`sm`,disabled:d,onClick:()=>void h(),children:Se()}),(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:de()})]})]}):null,(0,q.jsx)(Yt,{chart:e}),(0,q.jsx)($,{chart:e})]})}function Zt(){let e=y(m.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:ze()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),e!==void 0&&t.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:$e()}):(0,q.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,q.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=v(m.charts.addChartToGroupPool),r=v(m.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function u(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function d(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(j,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?we():e.kind===`custom`&&e.scope===`personal`?o():p()}),e.isGlobalDefault?(0,q.jsx)(j,{variant:`default`,children:ct()}):null]}),(0,q.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,q.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ce()}),(a??[]).map(e=>(0,q.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,q.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Re({group:e.name}),onClick:()=>void d(e.groupId),children:(0,q.jsx)(T,{className:`size-3`})})]},e.groupId)),c.length>0?(0,q.jsxs)(F,{value:``,onValueChange:e=>void u(e),children:[(0,q.jsx)(L,{size:`sm`,className:`w-56`,children:(0,q.jsx)(A,{placeholder:lt()})}),(0,q.jsx)(R,{children:c.map(e=>(0,q.jsx)(N,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:l()}):null]})]})}function $t({chart:e}){let t=v(m.charts.promoteChartToCommon),n=v(m.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,q.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Je():o()}),e.ownerLabel?(0,q.jsx)(`span`,{className:`oc-show__desc`,children:Ke({owner:e.ownerLabel})}):null]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,q.jsx)(E,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ve()}):null,(0,q.jsx)(E,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:f()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=v(m.admin.setDefaultThemeMode),a=v(m.admin.setDefaultLocale),o=v(m.charts.setDefaultChart),s=y(m.charts.listChartsAdmin),c=y(m.groups.listGroups,{}),l=e??`system`,d=t??`fr`;return(0,q.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h2`,{className:`oc-show__title`,children:re()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:fe()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:x()}),_t.map(e=>(0,q.jsx)(E,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,q.jsx)(E,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:i()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,q.jsx)(Qt,{chart:e,groups:c??[]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:_e()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,q.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,q.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,q.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,q.jsx)($,{chart:e})]},e.key))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:ge()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,q.jsx)(`p`,{className:`oc-show__desc`,children:h()}):(0,q.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,q.jsx)($t,{chart:e},e.key))})})()]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:se()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:tt()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,q.jsx)(E,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Wt(e)},e))})]}),(0,q.jsxs)(`section`,{className:`oc-show__section`,children:[(0,q.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,q.jsx)(`h3`,{className:`oc-show__title`,children:le()}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,q.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,q.jsx)(E,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e}),children:e===`fr`?ye():me()},e))}),(0,q.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]})]})}function tn(){let e=y(m.me.getMe,{host:P}),t=vt(e?.resolvedThemeMode);return(0,q.jsxs)(`div`,{className:`oc-appearance`,children:[(0,q.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,q.jsx)(Jt,{}),(0,q.jsx)(Zt,{}),e?.role===`admin`?(0,q.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,U.useState)(!0),[n,r]=(0,U.useState)(`per-user`),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(J),[c,l]=(0,U.useState)(J),[u,d]=(0,U.useState)(Y),f=i!==``||o!==J||c!==J;function p(){a(``),s(J),l(J),d(Y)}return(0,q.jsxs)(`div`,{className:`oc-show`,children:[(0,q.jsx)(tn,{}),(0,q.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,q.jsx)(`summary`,{className:`oc-show__title`,children:Te()}),(0,q.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{children:`Default`}),(0,q.jsx)(E,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(E,{variant:`outline`,children:`Outline`}),(0,q.jsx)(E,{variant:`ghost`,children:`Ghost`}),(0,q.jsx)(E,{variant:`destructive`,children:`Destructive`}),(0,q.jsx)(E,{variant:`link`,children:`Link`})]}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(E,{size:`sm`,children:`Small`}),(0,q.jsx)(E,{children:`Default`}),(0,q.jsx)(E,{size:`lg`,children:`Large`}),(0,q.jsx)(E,{size:`icon`,"aria-label":`more`,children:(0,q.jsx)(I,{})}),(0,q.jsx)(E,{disabled:!0,children:`Disabled`})]})]}),(0,q.jsx)(Z,{title:`Badges`,children:(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(j,{children:`Default`}),(0,q.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,q.jsx)(j,{variant:`outline`,children:`Outline`}),(0,q.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,q.jsx)(Z,{title:`Inputs & selection`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(M,{placeholder:`Text input…`}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsxs)(F,{value:n,onValueChange:r,children:[(0,q.jsx)(L,{className:`w-56`,children:(0,q.jsx)(A,{placeholder:`Select…`})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(N,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,q.jsx)(N,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,q.jsxs)(`label`,{className:`oc-show__check`,children:[(0,q.jsx)(D,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,q.jsx)(Z,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,q.jsxs)(F,{value:o,onValueChange:s,children:[(0,q.jsx)(L,{size:`sm`,children:(0,q.jsx)(A,{})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(N,{value:J,children:`Toutes directions`}),(0,q.jsx)(N,{value:`inbound`,children:`inbound`}),(0,q.jsx)(N,{value:`outbound`,children:`outbound`}),(0,q.jsx)(N,{value:`internal`,children:`internal`})]})]}),(0,q.jsxs)(F,{value:c,onValueChange:l,children:[(0,q.jsx)(L,{size:`sm`,children:(0,q.jsx)(A,{})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(N,{value:J,children:`Toutes sévérités`}),(0,q.jsx)(N,{value:`info`,children:`info`}),(0,q.jsx)(N,{value:`warn`,children:`warn`}),(0,q.jsx)(N,{value:`critical`,children:`critical`})]})]})]}),(0,q.jsx)(At,{fields:X,onChange:()=>{}}),(0,q.jsxs)(`div`,{className:`oc-show__row`,children:[(0,q.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,q.jsx)(pt,{value:u,onChange:d})]})]})}),(0,q.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,q.jsxs)(ht,{children:[(0,q.jsx)(gt,{asChild:!0,children:(0,q.jsx)(E,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,q.jsx)(I,{})})}),(0,q.jsxs)(mt,{align:`start`,children:[(0,q.jsx)(yt,{children:`Actions`}),(0,q.jsx)(O,{}),(0,q.jsx)(k,{children:`Edit`}),(0,q.jsx)(k,{children:`Duplicate`}),(0,q.jsx)(O,{}),(0,q.jsx)(k,{variant:`destructive`,children:`Delete`})]})]})}),(0,q.jsx)(Z,{title:`Card`,children:(0,q.jsxs)(Tt,{className:`w-80`,children:[(0,q.jsxs)(bt,{children:[(0,q.jsx)(Ct,{children:`Instance`}),(0,q.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,q.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,q.jsxs)(xt,{className:`gap-2`,children:[(0,q.jsx)(E,{size:`sm`,children:`Save`}),(0,q.jsx)(E,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,q.jsx)(Z,{title:`Table`,children:(0,q.jsxs)(Ot,{children:[(0,q.jsx)(Et,{children:(0,q.jsxs)(B,{children:[(0,q.jsx)(z,{className:`w-8`,children:(0,q.jsx)(D,{"aria-label":`select all`})}),(0,q.jsx)(z,{children:`Name`}),(0,q.jsx)(z,{children:`Mode`}),(0,q.jsx)(z,{className:`text-right`,children:`Status`}),(0,q.jsx)(z,{className:`w-8`})]})}),(0,q.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,q.jsxs)(B,{children:[(0,q.jsx)(V,{children:(0,q.jsx)(D,{"aria-label":`select ${e.n}`})}),(0,q.jsx)(V,{className:`font-medium`,children:e.n}),(0,q.jsx)(V,{children:(0,q.jsx)(j,{variant:`secondary`,children:e.m})}),(0,q.jsx)(V,{className:`text-right`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,q.jsx)(w,{className:`size-3.5`}),` `,e.s]})}),(0,q.jsx)(V,{children:(0,q.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,q.jsx)(I,{})})})]},e.n))})]})}),(0,q.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,q.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,q.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,q.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,q.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,q.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,q.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,q.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,q.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,q.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,q.jsx)(`span`,{className:`oc-run-status__dot`}),(0,q.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{nn as ThemeShowroom};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Al as i,Bl as a,C_ as o,Cl as s,D_ as c,Dl as l,Dw as u,E_ as d,El as f,Ew as p,Fl as m,Gg as h,Gl as g,Hg as _,Hl as v,Il as ee,Jg as y,Jl as te,Kg as b,Kl as ne,Ll as re,Ml as ie,Mw as x,Nl as ae,Nw as S,Ol as oe,Pl as se,Qg as C,Ql as ce,Rl as le,S_ as w,Sl as ue,T_ as T,Tl as de,Ug as E,Ul as fe,Vl as pe,Wg as me,Wl as he,Xg as D,Xl as ge,Yg as O,Yl as _e,Zg as ve,Zl as ye,__ as be,_l as xe,a_ as Se,b_ as k,bl as Ce,c_ as A,d_ as j,e_ as M,f_ as we,g_ as N,gl as P,h_ as F,hl as I,i_ as L,jl as Te,kl as Ee,l_ as De,m_ as Oe,ml as ke,n_ as Ae,o_ as je,p_ as Me,qg as Ne,ql as Pe,r_ as R,s_ as Fe,t_ as z,u_ as Ie,v_ as Le,vl as Re,w_ as ze,wl as Be,x_ as Ve,xl as He,y_ as Ue,yl as We,zl as Ge}from"./dist-ONRHFnrv.js";import{n as Ke}from"./dist-D0lueamf.js";import{n as B}from"./TimeRangePicker-B2SK3o8o.js";import{t as qe}from"./x-BKk70OzX.js";import{t as V}from"./button-B6rrzUWu.js";import{$ as Je,At as Ye,Ct as Xe,Et as Ze,Q as Qe,S as H,X as U,a as $e,b as W,et,i as tt,k as nt,kt as rt,nt as it,o as at,ot,r as st,rt as ct,v as G,x as K,y as q}from"./index-Ci__4cCS.js";import{t as lt}from"./FilterBar-B3HyBcMN.js";import{t as ut}from"./AdvancedFilter-Cjt4cP7-.js";import{t as dt}from"./DataTableShell-DY8nOACn.js";var ft=u(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function pt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?A():n===`agent`?`${Fe()} - ${r}`:e}function mt(){let e=S(p.me.getMe,{host:ot})?.role===`admin`,t=S(p.deliveryTiming.getDeliveryStatus,{}),n=x(p.deliveryTiming.startDeliveryRecord),r=x(p.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[s,l]=(0,J.useState)(!1),u=t?.recording??!1,f=async()=>{l(!0);try{u?await r({}):await n({})}finally{l(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:c()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}),e?(0,Y.jsx)(V,{variant:u?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void f(),children:u?ze():T()}):null]}),u?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(U,{variant:`secondary`,children:o()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:w({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Ue():k()})}),i?(0,Y.jsx)(ht,{isAdmin:e}):null]})}function ht({isAdmin:e}){let t=S(p.deliveryTiming.listDeliverySessions,{}),n=x(p.deliveryTiming.deleteDeliverySessions),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(`all`),[s,c]=(0,J.useState)(X),[l,u]=(0,J.useState)(null),{from:d,to:f}=B(s),m=s.to===`now`?1/0:f,h=r.trim()!==``||a!==`all`||s!==X,g=()=>{i(``),o(`all`),c(X)},_=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=d&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,a,d,m]),v=e=>{let t=new Set((_??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),l!==null&&r.includes(l)&&u(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(_t,{sessions:t??[]}),(0,Y.jsx)(lt,{q:r,onQChange:i,searchPlaceholder:be(),timeRange:s,onTimeRangeChange:c,onReset:g,canReset:h,children:(0,Y.jsxs)(G,{value:a,onValueChange:e=>o(e),children:[(0,Y.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{value:`all`,children:N()}),(0,Y.jsx)(W,{value:`active`,children:F()}),(0,Y.jsx)(W,{value:`stopped`,children:Oe()})]})]})}),(0,Y.jsx)(dt,{title:Le(),rows:_,emptyHint:E(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":l===e.sessionId?Se():je(),onClick:()=>u(t=>t===e.sessionId?null:e.sessionId),children:l===e.sessionId?(0,Y.jsx)(ft,{size:15,"aria-hidden":!0}):(0,Y.jsx)(Xe,{size:15,"aria-hidden":!0})})},{header:Me(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:we(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:j(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:Ie(),sort:e=>e.startedBy,cell:e=>pt(e.startedBy)},{header:De(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(U,{variant:`secondary`,children:F()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:Oe()})}],rowActions:e?e=>[{label:L(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:L(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===l,renderExpanded:e=>(0,Y.jsx)(yt,{sessionId:e.sessionId})})]})}var gt=15;function _t({sessions:e}){let t=(0,J.useMemo)(()=>e.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,gt).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})),[e]);return t.length<2?null:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-border p-2`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:Ae()}),(0,Y.jsx)(vt,{series:t})]})}function vt({series:e}){if(e.length<2)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:R()});let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>66-e*60/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{style:{color:`var(--primary)`},children:[O(),` p50 `,Z(s.cP50),` `,z()]}),(0,Y.jsxs)(`span`,{children:[D(),` p50 `,Z(s.aP50),` `,z()]})]}),(0,Y.jsxs)(`svg`,{viewBox:`0 0 480 72`,className:`h-16 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":Ae(),children:[(0,Y.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,Y.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}function yt({sessionId:e}){let t=S(p.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(bt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(nt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function bt({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:R()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()});let i=e.segments,a=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,_()]}),(0,Y.jsxs)(V,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ke,{size:13,"aria-hidden":!0}):(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}),t?me():h()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:M()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:r()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:C()})]})}),(0,Y.jsxs)(`tbody`,{children:[a(ve(),i.bridge),a(D(),i.A),a(O(),i.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()})]})}var xt=[50,100,200,500],St=`all`,Q=`__all__`,Ct=[`2xx`,`4xx`,`5xx`],wt=[`user`,`service`,`system`],Tt=[`inbound`,`outbound`,`internal`],Et={kind:`relative`,from:`now-30d`,to:`now`},Dt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ot(){let e=Ye({from:`/settings/traces`}),t=rt({from:`/settings/traces`}),n=e.limit,r=e.kind,o=e.statusClass??Q,c=e.principalType??Q,u=e.direction??Q,d=e.roleKey??Q,h=e.q??``,_=st(e.from,e.to),y=(0,J.useMemo)(()=>at(e.adv),[e.adv]),{from:b,to:x}=B(_),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null),me=e=>void t({search:t=>({...t,limit:e})}),D=e=>void t({search:t=>({...t,kind:e})}),O=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ve=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),be=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),Se=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,...$e(e)})}),j=e=>void t({search:t=>({...t,adv:tt(e)}),replace:!0}),M=S(p.observability.listEvents,{limit:n}),we=S(p.observability.listEvents,{limit:n,kind:r===St?void 0:r,filter:{q:h||void 0,from:b,to:x,statusClass:o===Q?void 0:o,principalType:c===Q?void 0:c,direction:u===Q?void 0:u,roleKey:d===Q?void 0:d,advanced:y.length>0?y:void 0}}),N=(0,J.useMemo)(()=>{let e=new Set;for(let t of M??[])e.add(t.kind);return[...e].sort()},[M]),P=(0,J.useMemo)(()=>{let e=new Set;for(let t of M??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[M]),F=h!==``||o!==Q||c!==Q||u!==Q||d!==Q||y.length>0||_.kind!==`relative`||_.from!==Et.from;function I(){t({search:{limit:100,kind:`all`},replace:!0})}let L=C?M?.filter(e=>e.correlationId===C):we;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(mt,{}),(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ce(),(0,Y.jsx)(`strong`,{children:ye()}),ge(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:_e()})]}),(0,Y.jsxs)(lt,{q:h,onQChange:O,searchPlaceholder:te(),timeRange:_,onTimeRangeChange:A,onReset:I,canReset:F,children:[(0,Y.jsxs)(G,{value:o,onValueChange:ve,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:Pe()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{value:Q,children:ne()}),Ct.map(e=>(0,Y.jsx)(W,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:c,onValueChange:be,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:g()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{value:Q,children:he()}),wt.map(e=>(0,Y.jsx)(W,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:u,onValueChange:Se,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:fe()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{value:Q,children:v()}),Tt.map(e=>(0,Y.jsx)(W,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:d,onValueChange:k,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{placeholder:pe()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{value:Q,children:a()}),P.map(e=>(0,Y.jsx)(W,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:r,onValueChange:D,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(H,{placeholder:Ge()})}),(0,Y.jsxs)(q,{children:[(0,Y.jsx)(W,{value:St,children:le()}),N.map(e=>(0,Y.jsx)(W,{value:e,children:e},e))]})]}),(0,Y.jsxs)(G,{value:String(n),onValueChange:e=>me(Number(e)),children:[(0,Y.jsx)(K,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(q,{children:xt.map(e=>(0,Y.jsx)(W,{value:String(e),children:re({count:e})},e))})]})]}),(0,Y.jsx)(ut,{fields:Dt,seed:y,onChange:j}),C?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>w(null),title:ee(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[m(),(0,Y.jsx)(`code`,{children:$(C)})]}),(0,Y.jsx)(qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:se()})]})}):null,(0,Y.jsx)(dt,{title:ae(),rows:L,emptyHint:C?ie():Te(),columns:[{header:i(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:Ee(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(U,{variant:`secondary`,children:e.kind})},{header:oe(),sort:e=>At(e)??null,cell:e=>{let t=At(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":l(),children:`✓`})}},{header:f(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(U,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:de(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:Be(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:s(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ue(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${kt(e.status)}`,children:e.status})},{header:He(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Ce(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:We(),onClick:()=>w(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Re(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:xe()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(jt,{row:T,onClose:()=>E(null)})]})}function kt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function At(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function jt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(Qe,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(Je,{className:`max-w-lg`,children:[(0,Y.jsxs)(it,{children:[(0,Y.jsxs)(ct,{className:`oc-traces__meta-title`,children:[P(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(U,{variant:`outline`,children:I()})]}),(0,Y.jsx)(et,{children:ke()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ot as TracesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Am as i,Bc as a,Bp as o,Cm as s,Dm as c,Em as l,Ew as u,Fc as d,Ic as f,Lc as p,Mc as m,Mm as h,Mw as g,Nc as _,Nm as v,Nw as y,Om as b,Pc as x,Rc as S,Sm as C,Tm as ee,Vc as w,_m as te,am as ne,bm as re,cm as ie,dm as ae,fm as T,gm as E,hm as oe,jc as D,jm as O,kc as k,km as A,lm as se,mm as ce,om as le,pm as ue,sm as de,um as fe,vm as pe,wm as me,xm as he,ym as ge,zc as j}from"./dist-ONRHFnrv.js";import{t as M}from"./button-B6rrzUWu.js";import{$ as N,A as P,At as F,D as I,G as L,K as R,M as _e,Q as z,S as B,W as ve,X as V,Y as ye,_t as H,b as U,d as W,et as be,f as xe,gt as G,j as Se,kt as Ce,nt as we,ot as Te,p as K,q as Ee,rt as De,v as q,x as J,y as Y}from"./index-Ci__4cCS.js";import{t as X}from"./FilterBar-B3HyBcMN.js";import{t as Oe}from"./DataTableShell-DY8nOACn.js";import{t as ke}from"./DetailChips-DTltyjOV.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=y(u.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=y(u.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,d=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),f=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!d.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],m=new Map;for(let e of f){let t=m.get(e.instanceName)??[];t.push(e),m.set(e.instanceName,t)}return(0,Q.jsx)(z,{open:n,onOpenChange:r,children:(0,Q.jsxs)(N,{className:`oc-access`,children:[(0,Q.jsxs)(we,{children:[(0,Q.jsx)(De,{children:w({user:t})}),(0,Q.jsx)(be,{children:a()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?j():S()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()}):[...m.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:i,assigned:a,defaultKey:o}){let s=g(u.agents.assignAgent),c=g(u.agents.removeAgent),l=g(u.agents.setDefaultAgent),p=P();if(!e)return null;async function h(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){p.error(f(),e)}}async function v(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){p.error(d(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(H,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__kind`,children:n})]}),i.map(e=>{let n=`${t}/${e.agentId}`,i=a.has(n),s=o===n,c=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(I,{checked:i,disabled:c&&!i,onCheckedChange:()=>void h(e.agentId,i),"aria-label":_({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:m()}):null,e.outOfPool?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:D()}):null,i?s?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":r(),title:r(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(M,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":k(),title:k(),onClick:()=>void v(e.agentId),children:(0,Q.jsx)(G,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=W.filter(e=>n.has(K[e])).length;return(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?v():h({count:r})})}),(0,Q.jsxs)(L,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Ee,{children:O()}),W.map(e=>{let r=K[e];return(0,Q.jsxs)(R,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(I,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:xe[e]??e})]},e)})]})]})}function Ne(){let e=F({from:`/settings/users`}),t=Ce({from:`/settings/users`}),n=e.q??``,r=e.role??$,a=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),f=y(u.admin.listUsers,{filter:{q:n||void 0,role:r===$?void 0:r},withAgents:!0}),p=y(u.me.getMe,{host:Te}),m=g(u.admin.setRole),h=g(u.admin.setUserPermissions),_=g(u.admin.startImpersonation),v=g(u.admin.deleteUser),x=g(u.admin.setUserName),S=Se(),w=_e(),D=P(),[O,k]=(0,Z.useState)(null),j=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of f??[])e.add(t.role);return[...e]},[f]),M=n!==``||r!==$;function N(){t({search:{},replace:!0})}async function I(e){try{await m(e)}catch(e){D.error(i(),e)}}async function L(e){try{await h(e)}catch(e){D.error(A(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:C(),description:he({user:t}),confirmWord:re(),confirmLabel:ge(),destructive:!0}))try{await v({profileId:e._id}),D.success(te({user:t}))}catch(e){D.error(pe(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:oe(),label:ce({user:t}),placeholder:ue(),defaultValue:e.name??``,confirmLabel:o()});if(n!==null)try{await x({profileId:e._id,name:n}),D.success(T())}catch(e){D.error(ae(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{q:n,onQChange:a,searchPlaceholder:b(),onReset:N,canReset:M,children:(0,Q.jsxs)(q,{value:r,onValueChange:d,children:[(0,Q.jsx)(J,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(B,{})}),(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(U,{value:$,children:c()}),j.map(e=>(0,Q.jsx)(U,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:l(),rows:f,emptyHint:ee(),rowActions:e=>{let t=[{label:ne(),onSelect:()=>k({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:E(),onSelect:()=>void z(e)}];return e.userId!==p?.userId&&t.push({label:me(),onSelect:()=>void _({profileId:e._id})},{label:s(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:fe(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:se(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(q,{value:e.role,onValueChange:t=>void I({profileId:e._id,role:t}),children:[(0,Q.jsx)(J,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(B,{})}),(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(U,{value:`pending`,children:`pending`}),(0,Q.jsx)(U,{value:`user`,children:`user`}),(0,Q.jsx)(U,{value:`admin`,children:`admin`})]})]})},{header:ie(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:de()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),L({profileId:e._id,permissions:[...n]})}})},{header:le(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(H,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||k(null)}})]})}export{Ne as UsersTab};
@@ -1 +0,0 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n,t as r,xw as i}from"./dist-ONRHFnrv.js";e();var a=t(),o=r(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function s({className:e,variant:t=`default`,size:r=`default`,asChild:s=!1,...c}){return(0,a.jsx)(s?i:`button`,{"data-slot":`button`,"data-variant":t,"data-size":r,className:n(o({variant:t,size:r,className:e})),...c})}export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{Dw as e}from"./dist-ONRHFnrv.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
@@ -1 +0,0 @@
1
- import{Ai as e,Bi as t,Ci as n,Di as r,Ei as i,Fi as a,Hi as o,Ii as s,Li as c,Mi as l,Ni as u,Oi as d,Pi as f,Ri as p,Si as m,Ti as h,Ui as g,Vi as _,_i as v,bi as y,gi as b,hi as x,ji as S,ki as C,vi as w,wi as T,xi as E,yi as D,zi as O}from"./dist-ONRHFnrv.js";var k={AGENT_NOT_FOUND:()=>({label:g(),hint:o()}),AUTH_TOKEN_MISMATCH:()=>({label:_(),hint:t()}),DEVICE_SIGNING_FAILED:()=>({label:O(),hint:p()}),SESSION_SCOPE_DENIED:()=>({label:c(),hint:s()}),GATEWAY_TIMEOUT:()=>({label:a(),hint:f()}),GATEWAY_DISCONNECTED:()=>({label:u(),hint:l()}),ATTACHMENT_TOO_LARGE:()=>({label:C(),hint:d()}),ATTACHMENT_REJECTED:()=>({label:r(),hint:i()}),BRIDGE_UNREACHABLE:()=>({label:S(),hint:e()}),INVALID_REQUEST:()=>({label:h(),hint:T()}),NOT_CONFIGURED:()=>({label:n(),hint:m()}),UNROUTED:()=>({label:E(),hint:y()}),UPSTREAM_ERROR:()=>({label:D(),hint:w()}),UNKNOWN:()=>({label:v(),hint:b()})};function A(e){return e?k[e]?.()??{label:e,hint:x()}:k.UNKNOWN()}export{A as t};