@lacneu/atrium 0.34.0 → 0.36.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-Cr3ztAfe.js +1 -0
  2. package/dist/assets/AdvancedFilter-S-HO9nIN.js +1 -0
  3. package/dist/assets/AgentFilesTab-vFxwzq66.js +3 -0
  4. package/dist/assets/AnomaliesTab-r5VxDkWH.js +1 -0
  5. package/dist/assets/AuditTab-BGhAhpvt.js +1 -0
  6. package/dist/assets/BridgeTab-RozR95O-.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-hRkzEosi.js +1 -0
  8. package/dist/assets/{DataTableShell-DtT6IWK0.js → DataTableShell-0Ttkz82b.js} +1 -1
  9. package/dist/assets/DetailChips-DCOUgVDY.js +1 -0
  10. package/dist/assets/FeedbacksTab-3VcXRruH.js +1 -0
  11. package/dist/assets/{FieldLabel-DHRmFB5F.js → FieldLabel-BY0GU-yp.js} +2 -2
  12. package/dist/assets/FilesTab-mOXihu5T.js +1 -0
  13. package/dist/assets/{FilterBar-B58FmRXC.js → FilterBar-CkxsjoMo.js} +1 -1
  14. package/dist/assets/GroupsTab-Cpe1zCFE.js +1 -0
  15. package/dist/assets/InstancesTab-BxcnITXD.js +1 -0
  16. package/dist/assets/IntegrationsTab-DO__uVCz.js +1 -0
  17. package/dist/assets/{KpiTab-DjCx7clJ.js → KpiTab-DK6kxWKf.js} +1 -1
  18. package/dist/assets/PreferencesTab-CuphjTEb.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-Cfo4Mq-9.js +4 -0
  20. package/dist/assets/RolesTab-CDQcpiM5.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-Bx5Kbxar.js +1 -0
  22. package/dist/assets/{SubAgentReportsTab-BQfnnV0J.js → SubAgentReportsTab-CQuFTC8k.js} +1 -1
  23. package/dist/assets/ThemeShowroom-Bb62MCzH.js +1 -0
  24. package/dist/assets/{TimeRangePicker-fEd70Mzj.js → TimeRangePicker-Dtnfk3jk.js} +1 -1
  25. package/dist/assets/TracesTab-DKRy25rR.js +1 -0
  26. package/dist/assets/UsersTab-BLi7LEyO.js +1 -0
  27. package/dist/assets/{button-BIQxgso_.js → button-Bv-PK2-Y.js} +1 -1
  28. package/dist/assets/{card-CLaLoMG5.js → card-B1IlPRv3.js} +1 -1
  29. package/dist/assets/chevrons-up-down-Drx4hbha.js +1 -0
  30. package/dist/assets/{compatView-DZS9WLeu.js → compatView-dNW7KqXq.js} +1 -1
  31. package/dist/assets/{dispatchErrorInfo-Crx9497I.js → dispatchErrorInfo-BF7yQgVh.js} +1 -1
  32. package/dist/assets/dist-Cjlv3ZK-.js +44 -0
  33. package/dist/assets/{dist-BvWD6-xy.js → dist-DIuY2jzI.js} +1 -1
  34. package/dist/assets/{dist-BwdC4Hrz.js → dist-DqF6O0L8.js} +1 -1
  35. package/dist/assets/{dist-DQNUMYl3.js → dist-LRVQ8Aeg.js} +1 -1
  36. package/dist/assets/{highlighted-body-OFNGDK62-B4qPEZuN.js → highlighted-body-OFNGDK62-M3coudTw.js} +1 -1
  37. package/dist/assets/index-BWV7nAxJ.js +229 -0
  38. package/dist/assets/mermaid-GHXKKRXX-CHLSnVjI.js +1 -0
  39. package/dist/assets/roleDescriptions-Br5xnRg9.js +1 -0
  40. package/dist/assets/{table-UO-VP67W.js → table-Dv9jX9eF.js} +1 -1
  41. package/dist/assets/{tabs-C35PjHwb.js → tabs-BSiIDxTa.js} +1 -1
  42. package/dist/assets/x-3dY-o4JV.js +1 -0
  43. package/dist/index.html +7 -7
  44. package/package.json +1 -1
  45. package/dist/assets/AccessTab-CnkNBHPE.js +0 -1
  46. package/dist/assets/AdvancedFilter-DJqYfM0R.js +0 -1
  47. package/dist/assets/AgentFilesTab-CjDkTO5u.js +0 -3
  48. package/dist/assets/AnomaliesTab-Btl5l0cp.js +0 -1
  49. package/dist/assets/AuditTab-dPXojOCy.js +0 -1
  50. package/dist/assets/BridgeTab-D_OFclma.js +0 -1
  51. package/dist/assets/ChatDefaultsTab-mu8WEgdH.js +0 -1
  52. package/dist/assets/DetailChips-CN6cfq9J.js +0 -1
  53. package/dist/assets/FeedbacksTab-TimbsRl3.js +0 -1
  54. package/dist/assets/FilesTab-n8OF2Enb.js +0 -1
  55. package/dist/assets/GroupsTab-Cwo-lxzA.js +0 -1
  56. package/dist/assets/InstancesTab-BrrGQYPt.js +0 -1
  57. package/dist/assets/IntegrationsTab-CnNDTpE1.js +0 -1
  58. package/dist/assets/PreferencesTab-nTPJ_YRA.js +0 -1
  59. package/dist/assets/PromptInjectionsTab-VOGZ2T-K.js +0 -4
  60. package/dist/assets/RolesTab-BR5Wqpbu.js +0 -1
  61. package/dist/assets/ServiceAccountsTab-DjfJ3oP0.js +0 -1
  62. package/dist/assets/ThemeShowroom-D-NkvAhX.js +0 -1
  63. package/dist/assets/TracesTab-Dyb2I2EJ.js +0 -1
  64. package/dist/assets/UsersTab-lOVKdpIc.js +0 -1
  65. package/dist/assets/chevrons-up-down-CJIw8ui2.js +0 -1
  66. package/dist/assets/dist-DBtFWMbn.js +0 -44
  67. package/dist/assets/index-DIWGZqm3.js +0 -229
  68. package/dist/assets/mermaid-GHXKKRXX-QiEqdfOE.js +0 -1
  69. package/dist/assets/roleDescriptions-CrpgjGTq.js +0 -1
  70. package/dist/assets/x-CvI3xVho.js +0 -1
@@ -0,0 +1 @@
1
+ import{O as e}from"./index-BWV7nAxJ.js";export{e as Mermaid};
@@ -0,0 +1 @@
1
+ import{B_ as e,L_ as t,R_ as n,V_ as r,z_ as i}from"./dist-Cjlv3ZK-.js";var a={pending:r,user:e,admin:i,observer:n,agent:t};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-DBtFWMbn.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-Cjlv3ZK-.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 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-DBtFWMbn.js";import{t as d}from"./dist-BvWD6-xy.js";import{gt as f,ht as p,mt as m}from"./index-DIWGZqm3.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[f]),b=f(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=i({prop:r,onChange:a,defaultProp:o??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:s,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":s,...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),o=b(n);return(0,g.jsx)(p,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.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:i=!1,...a}=e,o=S(E,n),s=b(n),c=A(o.baseId,r),d=j(o.baseId,r),f=r===o.value;return(0,g.jsx)(m,{asChild:!0,...s,focusable:!i,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`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`;!f&&!i&&e&&o.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...s}=e,c=S(O,n),l=A(c.baseId,i),d=j(c.baseId,i),f=i===c.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)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});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:o(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`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:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`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:o(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-Cjlv3ZK-.js";import{t as d}from"./dist-DIuY2jzI.js";import{_t as f,gt as p,ht as m}from"./index-BWV7nAxJ.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[f]),b=f(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=i({prop:r,onChange:a,defaultProp:o??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:s,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":s,...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),o=b(n);return(0,g.jsx)(p,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.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:i=!1,...a}=e,o=S(E,n),s=b(n),c=A(o.baseId,r),d=j(o.baseId,r),f=r===o.value;return(0,g.jsx)(m,{asChild:!0,...s,focusable:!i,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`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`;!f&&!i&&e&&o.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...s}=e,c=S(O,n),l=A(c.baseId,i),d=j(c.baseId,i),f=i===c.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)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});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:o(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`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:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`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:o(`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{D as e}from"./dist-Cjlv3ZK-.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
@@ -42,14 +42,14 @@
42
42
  document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
43
43
  })();
44
44
  </script>
45
- <script type="module" crossorigin src="/assets/index-DIWGZqm3.js"></script>
45
+ <script type="module" crossorigin src="/assets/index-BWV7nAxJ.js"></script>
46
46
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
47
- <link rel="modulepreload" crossorigin href="/assets/dist-DBtFWMbn.js">
48
- <link rel="modulepreload" crossorigin href="/assets/dist-BvWD6-xy.js">
49
- <link rel="modulepreload" crossorigin href="/assets/dist-BwdC4Hrz.js">
50
- <link rel="modulepreload" crossorigin href="/assets/dist-DQNUMYl3.js">
51
- <link rel="modulepreload" crossorigin href="/assets/x-CvI3xVho.js">
52
- <link rel="modulepreload" crossorigin href="/assets/button-BIQxgso_.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/dist-Cjlv3ZK-.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/dist-DIuY2jzI.js">
49
+ <link rel="modulepreload" crossorigin href="/assets/dist-DqF6O0L8.js">
50
+ <link rel="modulepreload" crossorigin href="/assets/dist-LRVQ8Aeg.js">
51
+ <link rel="modulepreload" crossorigin href="/assets/x-3dY-o4JV.js">
52
+ <link rel="modulepreload" crossorigin href="/assets/button-Bv-PK2-Y.js">
53
53
  <link rel="stylesheet" crossorigin href="/assets/index-BJ8KUScf.css">
54
54
  </head>
55
55
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.34.0",
3
+ "version": "0.36.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{DA as r,E as i,_l as a,al as o,cl as s,dl as c,fl as l,gl as u,hl as d,ll as f,ml as p,ol as m,pl as h,sl as g,ul as _,vA as v,vl as y,yl as b}from"./dist-DBtFWMbn.js";import{$ as x,C as S,S as C,b as w,x as T,y as E}from"./index-DIWGZqm3.js";var D=t(e(),1);function O(e){return e===`user`?f():e===`all`?s():g({group:e.group})}function k(e){return e===`common`?m():e===`owner`?o():g({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=r(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),o=r(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,A.jsxs)(E,{value:t,onValueChange:n,children:[(0,A.jsx)(C,{size:`sm`,"aria-label":y(),children:(0,A.jsx)(S,{placeholder:y()})}),(0,A.jsx)(w,{children:(e??[]).map(e=>(0,A.jsx)(T,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):o===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(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:u()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:o.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:o.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),o.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.groups.map(e=>(0,A.jsx)(x,{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:p()}),o.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.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)(x,{variant:`default`,children:_()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{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:h()}),o.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:o.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)(x,{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:l()}),o.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:o.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Dd as i,Ed as a,Od as o,Td as s,kd as c,wd as l}from"./dist-DBtFWMbn.js";import{i as u}from"./dist-BvWD6-xy.js";import{t as d}from"./x-CvI3xVho.js";import{t as f}from"./button-BIQxgso_.js";import{C as p,Ct as m,S as h,b as g,et as _,x as v,y}from"./index-DIWGZqm3.js";import{r as b}from"./TimeRangePicker-fEd70Mzj.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:r()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let r=(0,x.useRef)(t),w=!!(r.current&&r.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(r.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),c(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(y,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(h,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:i()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(y,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(h,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),l()]})]}):null]})}export{D as t};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,$t as i,Ao as a,Bo as o,Bt as s,Ct as c,DA as l,Do as u,Dt as d,E as f,EA as p,Eo as m,Et as h,Fo as g,Fs as _,Ft as v,Go as y,Gt as b,Ho as x,Ht as S,Io as C,It as w,Jo as T,Jt as E,Ko as D,Kt as O,Lo as k,Ls as A,Lt as j,Mo as M,No as ee,Oo as te,Po as N,Pt as P,Qo as F,Qt as I,Ro as L,Rt as R,St as z,To as B,Tt as V,Uo as ne,Ut as H,Vo as re,Vt as ie,Wo as ae,Wt as oe,Xo as se,Xt as ce,Yo as le,Yt as U,Zo as ue,Zt as de,bA as W,dT as fe,en as pe,es as me,jo as he,ko as ge,qo as _e,qt as ve,vA as G,wA as K,wt as ye,xt as be,zo as xe,zt as Se}from"./dist-DBtFWMbn.js";import{t as q}from"./button-BIQxgso_.js";import{$ as Ce,B as we,C as Te,H as Ee,I as De,L as Oe,N as J,R as ke,S as Ae,U as je,V as Me,_t as Ne,at as Pe,b as Fe,lt as Ie,nt as Le,ot as Re,rt as ze,tt as Be,v as Ve,x as He,y as Ue,z as We}from"./index-DIWGZqm3.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-DZS9WLeu.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*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 Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=l(f.me.getMe,{host:Ie}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=l(f.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=l(f.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=l(f.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[d,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&p($(u[0]))},[u,d]);let m=u?.find(e=>$(e)===d)??null,h=K(f.agentFiles.listAgentFiles),[g,v]=(0,Y.useState)({status:`idle`}),b=m?.instanceName??null,S=m?.agentId??null,C=l(f.compat.forInstance,n&&b!==null?{instanceName:b}:`skip`),w=n&&b!==null?Ve(C,`agentFiles`):null,E=w===null?!1:w===`loading`?null:w.blocked,O=(0,Y.useCallback)(async()=>{if(!(b===null||S===null)){v({status:`loading`});try{v({status:`done`,files:(await h({instanceName:b,agentId:S})).files})}catch{v({status:`error`})}}},[h,b,S]);(0,Y.useEffect)(()=>{E===!1&&O()},[O,E]);let[k,A]=(0,Y.useState)(null),j=l(f.agentFileCuration.listCurations,t&&b!==null&&S!==null?{instanceName:b,agentId:S}:`skip`),M=l(f.agentFileCuration.curationSettings,t&&b!==null?{instanceName:b}:`skip`),ee=K(f.agentFileCuration.requestCuration),[te,N]=(0,Y.useState)(null),[P,I]=(0,Y.useState)(null),{toast:L}=J(),R=(0,Y.useMemo)(()=>{let e=new Map;for(let t of j??[])e.has(t.name)||e.set(t.name,t);return e},[j]),z=(0,Y.useCallback)(async e=>{if(!(b===null||S===null)){N(e);try{let t=await ee({instanceName:b,agentId:S,name:e,trigger:`manual`});t.ok?L({title:de(),variant:`success`}):L({title:ce({reason:t.reason??`unknown`}),variant:`error`})}catch{L({title:U(),variant:`error`})}finally{N(null)}}},[ee,b,S,L]),B=W(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ue,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ae,{size:`sm`,"aria-label":r(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(Fe,{children:(i??[]).map(e=>(0,Q.jsx)(He,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ue,{value:d??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(Ae,{size:`sm`,"aria-label":F(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(Fe,{children:u.map(e=>(0,Q.jsx)(He,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()})]}),m===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Ne,{size:14,"aria-hidden":!0}),` `,qe(w.gatewayVersion)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[le(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void O(),children:_()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ce,{variant:`outline`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:_e({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:D({pct:V.format(n)})}),r?(0,Q.jsx)(Ne,{size:14,className:`oc-afiles__warn`,"aria-label":y()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>A(e),children:t?ne():x()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:M?.budgetChars??null,enabled:M?.enabled??!1,curation:R.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void z(e.name),onReview:e=>I(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ae({used:Z(Ze(g.files),B),total:Z(Je,B),pct:V.format(Xe(Ze(g.files)))})})]}),k&&m?(0,Q.jsx)(rt,{instanceName:m.instanceName,agentId:m.agentId,name:k.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void O()}):null,P?(0,Q.jsx)(it,{curationId:P,onClose:()=>I(null),onApplied:()=>{I(null),O()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:i()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Ce,{variant:`outline`,className:`oc-afiles__curate-status`,children:I()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:pe()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:s}){let c=K(f.agentFiles.getAgentFile),l=K(f.agentFiles.setAgentFile),d=J(),[p,h]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(``),[S,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),[D,O]=(0,Y.useState)(!1),[j,P]=(0,Y.useState)(!1),F=(0,Y.useCallback)(async r=>{y(!1);try{let i=await c({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),O(!1)}catch{y(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{F(!1)},[F]);async function I(){if(p!==null){E(!0),P(!1);try{await l({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(g({name:n})),s(),await F(!1)}catch(e){et(e)?O(!0):P(!0)}finally{E(!1)}}}let R=p!==null&&b!==p.content,z=(0,Y.useMemo)(()=>p===null?null:$e(p.content,b),[p,b]),V=b.length>X,ne=W(),H=(0,Y.useMemo)(()=>new Intl.NumberFormat(ne),[ne]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:re({name:n})}),(0,Q.jsxs)(ze,{children:[o({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,xe()]})]})]}),v?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void F(!1),children:_()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!r,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":re({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:L()}),D?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[M(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void F(!0),children:he()})]}):null,j?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:N()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${V?` is-over`:``}`,children:k({count:H.format(b.length),max:H.format(X)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!R||T||D,onClick:()=>w(!0),children:T?A():C()}):null]})]}),(0,Q.jsx)(De,{open:S,onOpenChange:w,children:(0,Q.jsxs)(We,{children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:a({name:n})}),(0,Q.jsx)(we,{children:ge({agent:t})})]}),z?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:te({added:z.added,removed:z.removed})}),z.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:u()}),z.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,z.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:m()}),z.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(ke,{children:fe()}),(0,Q.jsx)(Oe,{onClick:()=>void I(),children:B()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=l(f.agentFileCuration.getProposal,{curationId:e}),i=K(f.agentFileCuration.approveCuration),a=p(f.agentFileCuration.rejectCuration),{toast:o}=J(),[u,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[y,x]=(0,Y.useState)(``),C=W(),T=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function D(){m(`approve`);try{let t=await i({curationId:e});t.ok?(o({title:E(),variant:`success`}),n()):o({title:t.reason===`conflict`?O():b({reason:t.reason??`unknown`}),variant:`error`})}catch{o({title:U(),variant:`error`})}finally{m(null)}}async function k(n){m(`reject`);try{let r=y.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?o({title:n?z():ve(),variant:`success`}):o({title:S(),variant:`error`}),t()}catch{o({title:U(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:r?oe({name:r.name}):G()}),(0,Q.jsx)(ze,{children:H()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:G()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[ie({before:Z(r.beforeSize,C),after:Z(r.proposedSize,C)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Ne,{size:13,"aria-hidden":!0}),` `,s()]}):null]}),T?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:Se({added:T.added,removed:T.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:be({feedback:r.feedback})}):null,T&&T.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:P()}),(0,Q.jsx)(`ul`,{children:T.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:v()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:R()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),g?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:d()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:h(),value:y,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>_(!1),disabled:u!==null,children:V()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void k(!1),disabled:u!==null,children:u===`reject`?A():ye()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void k(!0),disabled:u!==null,children:u===`reject`?A():c()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>_(!0),disabled:u!==null||r==null,children:j()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void D(),disabled:u!==null||r==null,children:u===`approve`?A():w()})]})]})})}export{tt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Bg as i,DA as a,E as o,EA as s,Fg as c,Gg as ee,Hg as l,Ig as u,Jg as te,Kg as ne,Lg as d,Pg as f,Qg as p,Rg as m,S_ as h,Ug as re,Vg as ie,Wg as ae,Xg as oe,Yg as g,Zg as _,__ as se,a_ as ce,b_ as v,c_ as le,d_ as ue,e_ as de,f_ as fe,g_ as pe,h_ as me,i_ as he,l_ as ge,m_ as y,n_ as b,o_ as x,p_ as S,qg as C,r_ as w,s_ as T,t_ as E,u_ as D,v_ as O,x_ as k,y_ as A,zg as j}from"./dist-DBtFWMbn.js";import{$ as M,C as N,Ft as P,N as F,P as I,Pt as L,S as R,a as _e,b as z,k as ve,lt as ye,r as be,x as B,y as V}from"./index-DIWGZqm3.js";import{n as xe}from"./TimeRangePicker-fEd70Mzj.js";import{t as Se}from"./FilterBar-B58FmRXC.js";import{t as Ce}from"./DataTableShell-DtT6IWK0.js";import{t as H}from"./dispatchErrorInfo-Crx9497I.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?h():e===`acknowledged`?k():v()}var Ee=[`info`,`warn`,`critical`],De=[`detector`,`agent`,`user`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=L({from:`/settings/anomalies`}),n=e.q??``,c=e.status===K?G:e.status,u=e.severity??G,d=e.kind??G,[f,h]=(0,U.useState)(G),v=be(e.from,e.to),{from:k,to:H}=xe(v),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Pe=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),Fe=e=>void t({search:t=>({...t,..._e(e)})}),Ie=I(),X=F(),Z=s(o.anomalies.resolveAnomaly),Le=(a(o.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),Q=a(o.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:k,to:H,anomalyStatus:c===G?void 0:c,severity:u===G?void 0:u,source:f===G?void 0:f,kind:d===G?void 0:d}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||c!==`open`||u!==G||f!==G||d!==G||v.kind!==`relative`||v.from!==Oe.from;function ze(){h(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:A(),description:(0,W.jsxs)(W.Fragment,{children:[O(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,se(),` `,(0,W.jsx)(`strong`,{children:pe()}),`.`,` `,me()]}),confirmLabel:y()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(S(),e.kind)}catch(e){X.error(fe(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(ue(),e.kind)}catch(e){X.error(D(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[ge(),` `,(0,W.jsx)(`strong`,{children:le()}),` `,T(),` `,(0,W.jsx)(`strong`,{children:x()}),` `,ce(),` `,(0,W.jsx)(`strong`,{children:he()}),` `,w(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:b()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:E(),timeRange:v,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(V,{value:c,onValueChange:J,children:[(0,W.jsx)(R,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(B,{value:G,children:de()}),we.map(e=>(0,W.jsx)(B,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(V,{value:u,onValueChange:Y,children:[(0,W.jsx)(R,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:r()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(B,{value:G,children:p()}),Ee.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:f,onValueChange:h,children:[(0,W.jsx)(R,{size:`sm`,className:`w-32`,children:(0,W.jsx)(N,{placeholder:_()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(B,{value:G,children:oe()}),De.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]}),(0,W.jsxs)(V,{value:d,onValueChange:Pe,children:[(0,W.jsx)(R,{size:`sm`,className:`w-36`,children:(0,W.jsx)(N,{placeholder:g()})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(B,{value:G,children:te()}),$.map(e=>(0,W.jsx)(B,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:C(),rows:Q,emptyHint:c===`open`?ne():ee(),rowActions:e=>Le&&e.status===`open`?[{label:ae(),onSelect:()=>void Be(e)},{label:re(),onSelect:()=>void Ve(e)}]:[],columns:[{header:l(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:ve(e.at)}),sort:e=>e.at},{header:g(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:r(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:ie(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,W.jsx)(M,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:i(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:j(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:m(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Ne(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(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 Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Ae({row:e}){let t=L();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,d()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,d()]}):null]})}function je({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Me({status:e}){return e===`open`?(0,W.jsx)(M,{variant:`destructive`,children:u()}):e===`acknowledged`?(0,W.jsx)(M,{variant:`secondary`,children:c()}):(0,W.jsx)(M,{variant:`outline`,children:f()})}function Ne(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,Cv as i,DA as a,Dv as o,E as s,Ev as c,J as l,Q as u,Sv as d,Tv as f,X as p,Y as m,Z as h,_v as g,bv as _,gv as v,hv as y,mv as b,pv as x,vv as S,wv as C,xv as w,yv as T}from"./dist-DBtFWMbn.js";import{C as E,Ft as D,Pt as O,S as k,a as A,b as j,i as M,k as N,o as P,r as F,t as I,x as L,y as R}from"./index-DIWGZqm3.js";import{n as ee}from"./TimeRangePicker-fEd70Mzj.js";import{t as z}from"./FilterBar-B58FmRXC.js";import{t as B}from"./AdvancedFilter-DJqYfM0R.js";import{t as V}from"./DataTableShell-DtT6IWK0.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:r()},{value:`realLabel`,label:u()},{value:`targetLabel`,label:h()},{value:`impersonated`,label:p()},{value:`resource`,label:m()},{value:`resourceId`,label:l()}];function q(){let e=D({from:`/settings/audit`}),t=O({from:`/settings/audit`}),n=e.q??``,r=e.action??G,l=e.impersonated??G,u=e.resource??G,p=F(e.from,e.to),m=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:h,to:I}=ee(p),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=a(s.admin.listAudit,{filter:{q:n||void 0,from:h,to:I,action:r===G?void 0:r,resource:u===G?void 0:u,impersonated:l===G?void 0:l===`yes`,advanced:m.length>0?m:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||r!==G||l!==G||u!==G||m.length>0||p.kind!==`relative`||p.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:f(),timeRange:p,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(R,{value:r,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(E,{placeholder:C()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(L,{value:G,children:i()}),te.map(e=>(0,U.jsx)(L,{value:e,children:e},e))]})]}),(0,U.jsxs)(R,{value:l,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(E,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(L,{value:G,children:d()}),(0,U.jsx)(L,{value:`yes`,children:w()}),(0,U.jsx)(L,{value:`no`,children:_()})]})]}),(0,U.jsxs)(R,{value:u,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(E,{placeholder:T()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(L,{value:G,children:S()}),ne.map(e=>(0,U.jsx)(L,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:m,onChange:Q}),(0,U.jsx)(V,{title:g(),rows:$,emptyHint:v(),columns:[{header:y(),cell:e=>N(e.at),sort:e=>e.at},{header:C(),cell:e=>e.action,sort:e=>e.action},{header:b(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:x(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:T(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,$p as i,Am as a,Ap as o,Bp as s,Cp as c,D as l,DA as u,Dm as d,Dp as f,E as p,EA as m,Em as ee,Ep as h,Fm as g,Fp as _,Gp as te,Hp as v,Ip as y,Jp as ne,Kp as re,Lp as b,Mm as ie,Mp as x,Np as S,Om as ae,Op as C,Pm as oe,Pp as se,Qa as ce,Qp as le,Rp as ue,Sm as de,Sp as fe,Tm as pe,Tp as me,Up as he,Vp as ge,Wp as _e,Xp as ve,Yp as ye,Za as be,Zp as xe,_p as Se,ao as w,ap as T,bp as Ce,co as we,cp as Te,dp as Ee,eo as De,fp as Oe,gp as ke,hp as Ae,io as je,jm as Me,jp as Ne,km as Pe,kp as Fe,lo as Ie,lp as Le,mp as Re,no as ze,oo as Be,op as E,pp as Ve,qa as He,qp as Ue,ro as We,so as Ge,sp as D,to as Ke,uo as qe,up as Je,vp as Ye,wA as Xe,wp as Ze,xm as Qe,xp as $e,yp as O,zp as et}from"./dist-DBtFWMbn.js";import{i as k,r as tt}from"./dist-BvWD6-xy.js";import{t as nt}from"./chevrons-up-down-CJIw8ui2.js";import{i as rt,n as A,o as it,r as at,s as ot}from"./FieldLabel-DHRmFB5F.js";import{t as j}from"./button-BIQxgso_.js";import{$ as M,A as N,C as P,G as st,K as ct,Mt as F,N as lt,Nt as I,Pt as ut,S as L,Tt as dt,W as ft,_ as pt,_t as R,at as mt,b as z,bt as ht,et as B,k as gt,lt as _t,nt as vt,ot as yt,rt as bt,tt as xt,x as V,y as H}from"./index-DIWGZqm3.js";import{r as St}from"./locales-CPjguROj.js";import{a as Ct,i as wt,n as Tt,o as U,r as W,t as Et}from"./table-UO-VP67W.js";import{t as Dt}from"./FilterBar-B58FmRXC.js";import{a as Ot,n as kt,o as At,r as jt,s as Mt,t as Nt}from"./compatView-DZS9WLeu.js";import{t as G}from"./dispatchErrorInfo-Crx9497I.js";var Pt=l(`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`}]]),Ft=l(`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`}]]),K=t(e(),1);function It(e){return e.filter(e=>e.state===`error`)}function Lt(e){return e.reachable&&It(e.targets).length===0}function Rt(e){return e.state===`error`&&e.lastErrorCode!==null}function zt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Bt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Vt(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Bt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function Ht(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Ut={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function Wt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Gt(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 X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Kt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function qt(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return At(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function Jt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Kt(t.key,e),a=Kt(t.key,r);return i&&a?0:i?1:a?-1:n*qt(t.key,e,r)})}function Yt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function Xt(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)=>X(e.label,t.label))}function Zt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>At(e,t)??X(e,t))}var Z=n();function Qt({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(Ut),[i,a]=(0,K.useState)(null),o=(0,K.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,K.useMemo)(()=>Yt(o),[o]),l=(0,K.useMemo)(()=>Xt(o),[o]),u=(0,K.useMemo)(()=>Zt(o),[o]),d=(0,K.useMemo)(()=>Jt(Gt(o,n),i),[o,n,i]);function f(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:c()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Dt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ce(),onReset:()=>r(Ut),canReset:Wt(n),children:[(0,Z.jsxs)(H,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(P,{placeholder:Ye()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:J,children:O()}),s.map(e=>(0,Z.jsx)(V,{value:e,children:en(e)},e))]})]}),(0,Z.jsxs)(H,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(P,{placeholder:Se()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:J,children:O()}),l.map(e=>(0,Z.jsx)(V,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(H,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(P,{placeholder:ke()})}),(0,Z.jsxs)(z,{children:[(0,Z.jsx)(V,{value:J,children:O()}),u.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}):(0,Z.jsxs)(Et,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(U,{children:[(0,Z.jsx)(Q,{label:Re(),sortKey:`target`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Ve(),sortKey:`state`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Oe(),sortKey:`instance`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Ee(),sortKey:`host`,sort:i,onSort:f}),(0,Z.jsx)(Q,{label:Je(),sortKey:`version`,sort:i,onSort:f}),(0,Z.jsx)(wt,{children:Le()}),(0,Z.jsx)(Q,{label:Te(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Z.jsx)(Tt,{children:d.map(e=>(0,Z.jsx)($t,{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)(wt,{"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)(tt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(nt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function $t({r:e}){let t=Rt(e)?G(e.lastErrorCode):null,n=zt(e)?G(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(K.Fragment,{children:[(0,Z.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(W,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(W,{children:(0,Z.jsx)(tn,{state:e.state})}),(0,Z.jsx)(W,{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)(W,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(W,{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)(W,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:fe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(W,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:N(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(W,{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?` · ${N(e.lastErrorAt)}`:``,(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?` · ${N(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function en(e){return e===`connected`?D():e===`error`?E():T()}function tn({state:e}){return e===`connected`?(0,Z.jsx)(M,{variant:`secondary`,children:D()}):e===`error`?(0,Z.jsx)(M,{variant:`destructive`,children:E()}):(0,Z.jsx)(M,{variant:`outline`,children:T()})}function nn(){return u(p.bridgeHealth.getBridgeHealth,{})}function rn(){let e=nn(),t=u(p.compat.getBridgeCompat,{}),n=u(p.me.getMe,{host:_t})?.role===`admin`,r=u(p.admin.listInstances,n?{}:`skip`),i=ut(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Vt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&kt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(an,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:et()}),o.map(e=>(0,Z.jsx)(on,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):null]})}function an({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ot(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:we(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Ge({build:t.buildVersion??`?`})]}):null,` · `,Be(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ne()});let s=It(e.targets),c=!e.reachable,l=Lt(e),u=l?`ok`:`error`,d=gt(e.checkedAt),p=e.startedAt==null?null:gt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l?(0,Z.jsx)(F,{size:22}):c?(0,Z.jsx)(Ft,{size:22}):(0,Z.jsx)(R,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l?o():c?Fe():C({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Pt,{size:12,"aria-hidden":!0}),` `,f({time:d})]}),p?(0,Z.jsx)(`span`,{children:h({time:p})}):null,a]}),c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:me()})]})}function on({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Mt(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:Nt(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,K.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)(ht,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Ht(e)}),f?(0,Z.jsx)(M,{variant:f===`beyond`?`destructive`:`secondary`,children:jt(f)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:qe()}),(0,Z.jsx)(cn,{support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(sn,{protocol:o}):null,(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)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),Ze({count:t.length})]}),p?(0,Z.jsx)(Qt,{connections:t,displayByInstance:c}):null]})}function sn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[ue(),i.length>0?(0,Z.jsx)(M,{variant:`destructive`,children:y({count:i.length})}):(0,Z.jsx)(M,{variant:`secondary`,children:b()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[_({version:e.vendoredVersion}),r?` · `+se({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),S({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ze()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Ke({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(dn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(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:Ot(e.version)}),(0,Z.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:jt(e.state)})]},e.instanceName))})]})}function ln({instance:e,onClose:t}){return(0,Z.jsx)(xt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(vt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(mt,{children:[(0,Z.jsx)(yt,{children:g({instance:e.displayName??e.name})}),(0,Z.jsx)(bt,{children:oe()})]}),(0,Z.jsx)(un,{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)(F,{"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?he():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,v()]}):null}function un({instance:e,onClose:t}){let n=m(p.admin.upsertInstanceConfig),r=Xe(p.bridge.validateMediaPaths),o=lt(),c=St(e.config?.contentLocale,void 0),[l,u]=(0,K.useState)(()=>rt(e.config??{},c)),[f,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(null),b=l.inboundMediaMode===`shared-fs`,x=l.mediaMode===`shared-fs`,S=b||x;async function C(){_(!0),y(null);try{y(await r({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(Ue(),e)}finally{_(!1)}}async function oe(){h(!0);try{let r=e.config??{};await n({instanceId:e._id,config:at(l,r,c)}),t()}catch(e){o.error(d(),e)}finally{h(!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)(A,{label:ie(),help:ee()}),(0,Z.jsxs)(H,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(P,{})}),(0,Z.jsx)(z,{children:ot.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:Me(),help:pe()}),(0,Z.jsxs)(H,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(P,{})}),(0,Z.jsx)(z,{children:it.map(e=>(0,Z.jsx)(V,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:a(),help:de()}),(0,Z.jsx)(B,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),S&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[b&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:i(),help:le()}),(0,Z.jsx)(B,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),x&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(A,{label:xe(),help:ve()}),(0,Z.jsx)(B,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(pt,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(A,{label:Pe(),help:Qe()})]}),S&&v!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:v.reachable?!v.inbound&&!v.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),s({reason:v.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:te(),result:v.inbound}),(0,Z.jsx)($,{label:_e(),result:v.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:re()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(R,{"aria-hidden":!0}),ge()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[S&&(0,Z.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void C(),disabled:g,children:[g?(0,Z.jsx)(dt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?ne():ye()]}),(0,Z.jsx)(j,{size:`sm`,onClick:()=>void oe(),disabled:f,children:ae()})]})]})})}function dn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?De():r({count:e.length}),(0,Z.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(st,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{rn as BridgeTab,ln as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,As as i,Bn as a,Co as o,DA as s,E as c,EA as l,Fs as u,Gn as d,Hn as f,Ls as p,Nm as m,So as h,Un as g,Vn as _,Wn as v,_o as y,bo as b,dT as x,do as S,fo as ee,go as C,ho as w,js as te,mo as T,po as ne,vA as E,vo as re,wA as D,xo as O,yo as k,zn as A}from"./dist-DBtFWMbn.js";import{t as j}from"./button-BIQxgso_.js";import{B as ie,C as ae,H as oe,I as M,L as se,N as ce,R as le,S as ue,U as de,V as fe,_ as N,_t as P,b as F,et as I,g as L,h as R,v as z,x as B,y as V,z as pe}from"./index-DIWGZqm3.js";import{i as me}from"./compatView-DZS9WLeu.js";/* empty css */var H=t(e(),1),he=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ge(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 U=n();function _e({instance:e}){let t=l(c.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,H.useState)(n),[s,u]=(0,H.useState)(r===null?``:String(r)),[d,m]=(0,H.useState)(`idle`);(0,H.useEffect)(()=>{o(n),u(r===null?``:String(r)),m(`idle`)},[e._id,n,r]);let h=s.trim(),v=h===``?null:/^\d+$/.test(h)?Number.parseInt(h,10):NaN,b=!i||v===null||Number.isInteger(v)&&v>=4e3&&v<=6e4,x=i!==n||(v??null)!==r;async function S(){m(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||v===null||Number.isNaN(v)?delete n.curationBudgetChars:n.curationBudgetChars=v,await t({instanceId:e._id,config:n}),m(`done`)}catch{m(`error`)}}return(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,U.jsx)(N,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":g()}),(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]}),(0,U.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,U.jsx)(I,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!b,"aria-label":f(),disabled:!i}),(0,U.jsx)(j,{size:`sm`,disabled:!x||!b||d===`saving`,onClick:()=>void S(),children:d===`saving`?p():y()})]}),b?null:(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_()}),d===`done`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,d===`error`?(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]})}function ve({instance:e}){let t=l(c.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,H.useState)(n===null?``:String(n)),[a,o]=(0,H.useState)(`idle`);(0,H.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),u=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,f=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function h(){o(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,U.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,U.jsx)(I,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,U.jsx)(j,{size:`sm`,disabled:!m||!f||a===`saving`,onClick:()=>void h(),children:a===`saving`?p():y()})]}),f?null:(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:A()}),a===`done`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):null,a===`error`?(0,U.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]})}function W(){let e=D(c.agentFiles.getChatDefaults),t=D(c.agentFiles.setChatDefaults),n=ce(),[a,l]=(0,H.useState)({status:`loading`}),[d,f]=(0,H.useState)({thinkingDefault:null,fastModeDefault:null}),[g,_]=(0,H.useState)(!1),[v,A]=(0,H.useState)(!1),N=s(c.admin.listInstances,{}),[I,W]=(0,H.useState)(null);(0,H.useEffect)(()=>{!N||N.length===0||(!I||!N.some(e=>e.name===I))&&W(N[0].name)},[N,I]);let G=(N?.length??0)>1,ye=N!==void 0&&N.length===0,be=s(c.compat.forInstance,I?{instanceName:I}:`skip`),K=I?z(be,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,H.useMemo)(()=>G&&I?{instanceName:I}:{},[G,I]),Y=(0,H.useRef)(0),X=(0,H.useCallback)(async()=>{let t=++Y.current;l({status:`loading`});try{let n=ge(await e(J));if(Y.current!==t)return;l({status:`done`,current:n}),f(n)}catch{if(Y.current!==t)return;l({status:`error`})}},[e,J]);(0,H.useEffect)(()=>{q===!1&&(G&&!I||X())},[X,q,G,I]);let Z=a.status===`done`?a.current:null,Q=Z!==null&&d.thinkingDefault!==null&&d.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&d.fastModeDefault!==null&&d.fastModeDefault!==Z.fastModeDefault,xe=Q||$;async function Se(){A(!0);try{await t({...J,...Q?{thinkingDefault:d.thinkingDefault}:{},...$?{fastModeDefault:d.fastModeDefault}:{}}),n.success(C()),await X()}catch(e){n.error(w(),e)}finally{A(!1)}}let Ce=(0,H.useMemo)(()=>he.map(e=>({id:e,label:L(e)})),[]),we=(0,H.useMemo)(()=>[{id:`fast`,label:te()},{id:`standard`,label:i()}],[]);return(0,U.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),G&&I?(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,U.jsxs)(V,{value:I,onValueChange:e=>W(e),disabled:v,children:[(0,U.jsx)(ue,{size:`sm`,"aria-label":r(),children:(0,U.jsx)(ae,{})}),(0,U.jsx)(F,{children:(N??[]).map(e=>(0,U.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,ye?(0,U.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:m()}):K===`loading`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):K.blocked?(0,U.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,U.jsx)(P,{size:14,"aria-hidden":!0}),` `,me(K.gatewayVersion)]}):a.status===`loading`?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):a.status===`error`?(0,U.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[re(),` `,(0,U.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:u()})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,U.jsx)(R,{options:Ce,value:d.thinkingDefault,onChange:e=>f({...d,thinkingDefault:e}),disabled:v}),(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:O()})]}),(0,U.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,U.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,U.jsx)(R,{options:we,value:d.fastModeDefault===null?null:d.fastModeDefault?`fast`:`standard`,onChange:e=>f({...d,fastModeDefault:e===`fast`}),disabled:v}),(0,U.jsx)(`p`,{className:`oc-cdefaults__help`,children:k()})]}),(0,U.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,U.jsx)(j,{size:`sm`,disabled:!xe||v,onClick:()=>_(!0),children:v?p():y()})}),(0,U.jsx)(`p`,{className:`oc-cdefaults__note`,children:T()})]}),(()=>{let e=N?.find(e=>e.name===(I??N[0]?.name));return e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ve,{instance:e}),(0,U.jsx)(_e,{instance:e})]}):null})(),(0,U.jsx)(M,{open:g,onOpenChange:_,children:(0,U.jsxs)(pe,{children:[(0,U.jsxs)(oe,{children:[(0,U.jsx)(de,{children:ne()}),(0,U.jsx)(ie,{children:ee()})]}),(0,U.jsxs)(fe,{children:[(0,U.jsx)(le,{children:x()}),(0,U.jsx)(se,{onClick:()=>void Se(),children:S()})]})]})})]})}export{W as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{$ as t}from"./index-DIWGZqm3.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ax as i,Bx as a,Cx as o,DA as s,Dx as c,E as l,EA as u,Ex as d,Fx as f,Gb as p,Hb as m,Hx as h,Ix as g,Jb as ee,Kb as _,Lx as te,Mx as ne,Nx as re,Ox as ie,Px as v,Qb as y,Rx as b,Sx as x,Tx as S,Ub as C,Ux as w,Vx as T,Wb as E,Xb as D,Yb as O,Zb as k,_x as A,ax as j,bx as M,cx as N,dx as P,ex as F,fx as I,gx as L,hx as R,in as z,ix as B,jx as V,kx as ae,lx as H,mx as U,nx as W,on as G,ox as K,px as q,qb as J,rx as oe,sx as se,tx as ce,ux as le,vx as ue,wx as de,xx as fe,yx as pe,zx as me}from"./dist-DBtFWMbn.js";import{t as he}from"./button-BIQxgso_.js";import{P as ge,k as _e}from"./index-DIWGZqm3.js";import{t as Y}from"./DataTableShell-DtT6IWK0.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>w(),incorrect:()=>h(),incoherence:()=>T(),formatting:()=>a(),latency:()=>me(),api_error:()=>b(),other:()=>te()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:f()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:v()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:g()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=u(l.feedback.respondToFeedback),[a,s]=(0,X.useState)(e.thread),[f,p]=(0,X.useState)(``),[m,h]=(0,X.useState)(!1);async function g(){let t=f.trim();if(!(!t||m)){h(!0);try{await r({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),p(``)}finally{h(!1)}}}let _=[];try{_=n.contextJson?JSON.parse(n.contextJson):[]}catch{_=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${re()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ee()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?i():e.authorRole===`agent`?e.authorLabel??G():ae()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ie()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:c(),value:f,maxLength:2e3,rows:3,onChange:e=>p(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void g(),disabled:!f.trim()||m,children:m?d():S()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||o()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||o()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,_.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M({count:n.contextCount??_.length,truncated:n.contextTruncated?pe():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:_.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.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,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?R({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,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[U(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,q()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=s(l.feedback.listForAdmin,{}),t=u(l.feedback.readSnapshot),n=u(l.feedback.deleteFeedback),i=ge(),[a,o]=(0,X.useState)(null),[c,d]=(0,X.useState)({});async function f(e){if(a===e._id){o(null);return}if(!c[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}o(e._id)}async function h(e){await i({title:E(),description:C(),confirmLabel:m(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[I(),` `,(0,Z.jsx)(`strong`,{children:P()}),` `,le()]}),(0,Z.jsx)(Y,{title:H(),rows:e,emptyHint:N(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Z.jsx)(ye,{data:c[e._id],closeReason:e.userCloseReason}):null,columns:[{header:se(),cell:e=>_e(e.at),sort:e=>e.at},{header:K(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:j(),cell:e=>e.messageRole===`user`?B():oe(),sort:e=>e.messageRole},{header:W(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ce({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:F(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:r(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:y(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:k()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:D()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:z()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:O()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?J():_(),onSelect:()=>void f(e)},{label:p(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ak as r,Bk as i,Ck as ee,DA as a,Dk as o,E as s,EA as te,Ek as ne,Fk as c,Gk as re,Hk as l,Ik as u,Jk as d,Kk as f,Lk as p,Mk as ie,Nk as ae,Ok as oe,Pk as se,Qk as ce,Rk as m,Sk as le,Tk as h,Uk as ue,Vk as g,Wk as de,Xk as fe,Yk as _,Zk as pe,_k as me,bA as he,bk as ge,dT as _e,jk as ve,kk as ye,ln as be,qk as xe,un as v,vA as y,vk as b,wk as x,xk as S,yk as C,zk as w}from"./dist-DBtFWMbn.js";import{t as T}from"./button-BIQxgso_.js";import{$ as E,B as D,C as O,H as k,I as A,J as j,L as M,N as Se,Ot as Ce,Q as we,R as Te,S as N,St as Ee,U as De,V as Oe,Y as P,_ as ke,b as F,kt as I,q as Ae,vt as je,x as L,y as R,z as Me}from"./index-DIWGZqm3.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-UO-VP67W.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return g();case`audio`:return i();case`video`:return w();case`pdf`:return m();case`document`:return p();case`archive`:return u();default:return c()}}function K(){let[e,t]=(0,H.useState)(W),[n,i]=(0,H.useState)(W),[c,u]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[g,w]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=te(s.files.softDelete),Y=Se();function Ie(){t(W),i(W),u(W),m(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(x())}catch(e){Y.error(ee(),e)}}let X=a(s.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:c===W?void 0:c,category:p===W?void 0:p,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(he(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:y()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||c!==W||p!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(R,{value:e,onValueChange:t,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":pe(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(F,{children:[(0,U.jsx)(L,{value:W,children:fe()}),(0,U.jsx)(L,{value:`inbound`,children:_()}),(0,U.jsx)(L,{value:`outbound`,children:d()})]})]}),(0,U.jsxs)(R,{value:n,onValueChange:i,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":xe(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(F,{children:[(0,U.jsx)(L,{value:W,children:f()}),Q.chats.map(e=>(0,U.jsx)(L,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(R,{value:c,onValueChange:u,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":re(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(F,{children:[(0,U.jsx)(L,{value:W,children:de()}),Q.instances.map(e=>(0,U.jsx)(L,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(R,{value:p,onValueChange:m,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":ue(),children:(0,U.jsx)(O,{})}),(0,U.jsxs)(F,{children:[(0,U.jsx)(L,{value:W,children:l()}),Q.categories.map(e=>(0,U.jsx)(L,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(ke,{checked:g,onCheckedChange:e=>w(e===!0),"aria-label":v()}),(0,U.jsx)(`span`,{children:v()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Ee,{size:14,"aria-hidden":!0}),o()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?b():C()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:se()}),(0,U.jsx)(z,{children:ae()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:ve()}),(0,U.jsx)(z,{children:r()}),(0,U.jsx)(z,{className:`text-right`,children:ye()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(E,{variant:`outline`,style:{marginLeft:6},children:be()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(E,{variant:`secondary`,children:e.direction===`inbound`?_():d()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ne(),children:(0,U.jsx)(Ce,{size:16})})}),(0,U.jsxs)(j,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(I,{size:14}),oe()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(I,{size:14}),ge()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(je,{size:14}),h()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:me({cap:Be})}):null]}),(0,U.jsx)(A,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(Me,{children:[(0,U.jsxs)(k,{children:[(0,U.jsx)(De,{children:le()}),(0,U.jsx)(D,{children:S()})]}),(0,U.jsxs)(Oe,{children:[(0,U.jsx)(Te,{children:_e()}),(0,U.jsx)(M,{onClick:()=>void Le(),children:h()})]})]})})]})}export{K as FilesTab};
@@ -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 i,Ac as a,Bc as o,Cc as s,D as c,DA as l,Dc as u,E as d,EA as f,Ec as p,Fc as m,Gc as h,Hc as g,Ic as _,Jc as v,Kc as y,Lc as b,Mc as x,Nc as S,Oc as C,Pc as w,Qc as ee,Qs as T,Rc as te,Sc as E,Tc as D,Uc as O,Vc as ne,Wc as k,Xc as A,Xs as j,Yc as re,Ys as M,Zc as N,Zs as P,_c as ie,ac as F,bc as I,cc as ae,dc as oe,ec as se,el as L,fc as R,gc as z,hc as ce,ic as le,il as ue,jc as de,kc as B,lc as fe,mc as pe,nc as me,nl as he,oc as ge,pc as _e,qc as ve,rc as ye,rl as be,sc as xe,tc as Se,tl as Ce,uc as we,vc as Te,wc as Ee,xc as De,yc as Oe,zc as ke}from"./dist-DBtFWMbn.js";import{t as Ae}from"./x-CvI3xVho.js";import{i as V,n as H,r as je,t as Me}from"./tabs-C35PjHwb.js";import{t as U}from"./button-BIQxgso_.js";import{$ as W,C as Ne,N as G,Nt as Pe,P as Fe,S as Ie,_ as K,at as Le,b as Re,bt as q,et as J,lt as ze,m as Be,nt as Ve,ot as He,rt as Ue,tt as We,x as Ge,y as Ke,yt as Y}from"./index-DIWGZqm3.js";import{t as qe}from"./FilterBar-B58FmRXC.js";import{t as Je}from"./DataTableShell-DtT6IWK0.js";import{t as X}from"./DetailChips-CN6cfq9J.js";var Ye=c(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Xe=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`}]]),Z=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`}]]),Ze=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`}]]),Q=t(e(),1);function Qe(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 $e(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 et(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 tt(e){switch(e){case`admin`:return D();case`user`:return Ee();case`pending`:return s();default:return e}}function nt(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 rt(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}}var $=n(),it={name:``,description:``};function at(){let e=l(d.groups.listGroups,{}),t=l(d.me.getMe,{host:ze})?.role===`admin`,n=f(d.groups.createGroup),i=f(d.groups.updateGroup),a=f(d.groups.deleteGroup),s=Fe(),c=G(),[u,p]=(0,Q.useState)(!1),[m,_]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(it),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(``),j=(0,Q.useMemo)(()=>{if(!e)return e;let t=E.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,E]);function M(){_(null),S(it),p(!0)}function ie(e){_(e),S({name:e.name,description:e.description??``}),p(!0)}async function F(){try{m?await i({groupId:m._id,name:x.name,description:x.description}):await n({name:x.name,description:x.description||void 0}),S(it),_(null),p(!1)}catch(e){c.error(T(),e)}}async function I(e){if(await s({title:ke({name:e.name}),description:te(),confirmWord:e.name,confirmLabel:b(),cancelLabel:h(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(P(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),(0,$.jsx)(qe,{q:E,onQChange:D,onReset:()=>D(``),canReset:E!==``,searchPlaceholder:A()}),(0,$.jsx)(Je,{title:ue(),rows:j,addLabel:he(),onAdd:t?M:void 0,emptyHint:Ce(),columns:[{header:L(),cell:e=>e.name,sort:e=>e.name},{header:r(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ee(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:N(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(Y,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:re(),onSelect:()=>w({groupId:e._id,name:e.name})},...t?[{label:v(),onSelect:()=>ie(e)},{label:ve(),variant:`destructive`,onSelect:()=>void I(e)}]:[]]}),(0,$.jsx)(Be,{open:u,onOpenChange:p,title:m?O():k(),description:g(),canSubmit:!!x.name.trim(),onSubmit:F,submitLabel:y(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,$.jsx)(J,{value:x.name,onChange:e=>S({...x,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,$.jsx)(J,{value:x.description,onChange:e=>S({...x,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:C?.groupId??null,groupName:C?.name??``,open:C!==null,onOpenChange:e=>{e||w(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Ye,{size:14,"aria-hidden":!0}),C()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":p({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[u(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=l(d.groups.getGroup,n&&e?{groupId:e}:`skip`),o=l(d.groups.listAssignableInstances,n?{}:`skip`),s=l(d.groups.listAssignableUsers,n?{}:`skip`),c=f(d.groups.addMember),u=f(d.groups.removeMember),p=f(d.groups.bulkSetMembers),h=f(d.groups.setGroupManager),g=G(),[v,y]=(0,Q.useState)(``),[b,C]=(0,Q.useState)(``),[ee,T]=(0,Q.useState)(`members`),[te,D]=(0,Q.useState)(1),[O,ne]=(0,Q.useState)(new Set),k=(0,Q.useRef)(null),A=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),re=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),M=i?.viewerIsAdmin===!0,N=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{y(``),C(``),T(`members`),D(1),k.current=null},[n,e]),(0,Q.useEffect)(()=>{D(1)},[v]),(0,Q.useEffect)(()=>{n&&i&&e&&k.current!==e&&(k.current=e,ne(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let P=(0,Q.useMemo)(()=>s?Qe(s,v,O):[],[s,v,O]);async function F(t,n){if(e)try{n?await u({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){g.error(j(),e)}}async function ae(t,n){if(e)try{await h({groupId:e,userId:t,manager:!n})}catch(e){g.error(se(),e)}}let L=nt(P,e=>A.has(e.userId)),R=P.filter(e=>A.has(e.userId)).length,z=rt(P,te,ot);async function ce(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:L!==`all`})}catch(e){g.error(j(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ve,{className:`oc-access`,children:[(0,$.jsxs)(Le,{children:[(0,$.jsx)(He,{children:_({name:t})}),(0,$.jsx)(Ue,{children:m()})]}),(0,$.jsxs)(Me,{value:ee,onValueChange:T,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),w(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),x(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),oe(),i?(0,$.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:s===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Te()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:v,onChange:e=>y(e.target.value),placeholder:S(),className:`oc-access__search`}),P.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,$.jsxs)($.Fragment,{children:[P.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(K,{checked:L===`all`?!0:L===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()}),(0,$.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[R,` / `,P.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:z.pageItems.map(e=>{let t=A.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:t,onCheckedChange:()=>void F(e.userId,t),"aria-label":E({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(W,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&M?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Se():me(),title:r?Se():me(),onClick:()=>void ae(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ye(),title:ye(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:z.page,pageCount:z.pageCount,onPage:D})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{value:b,onChange:e=>C(e.target.value),placeholder:de(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,query:b},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=l(d.groups.listAssignableAgents,{instanceName:t}),o=f(d.groups.assignAgentToGroup),s=f(d.groups.removeAgentFromGroup),c=f(d.groups.bulkSetGroupAgents),u=G(),[p,m]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{m(1)},[i]),!e)return null;let h=$e(a?.agents??[],i),g=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&h.length===0)return null;let _=h.filter(e=>e.presentInLastOk!==!1),v=nt(_,e=>r.has(`${t}/${e.agentId}`)),y=rt(h,p,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){u.error(M(),e)}}async function x(){if(_.length===0)return;let n=_.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){u.error(M(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(q,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),g?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:pe()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Oe()}):h.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:g?ce():z()}):(0,$.jsxs)($.Fragment,{children:[_.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(K,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":B()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:B()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":De({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":R(),title:R(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:_e()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:m})]})]})}function ut({groupId:e}){let t=l(d.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=f(d.charts.assignChartToGroup),r=f(d.charts.removeChartFromGroup),a=f(d.charts.setGroupDefaultChart),o=f(d.charts.addChartToGroupPool),s=f(d.charts.removeChartFromGroupPool),c=G();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:I()});let{pool:u,addable:p,canManagePool:m}=t;if(u.length===0&&!m)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()});async function h(t,a){try{a?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(i(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(K,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":ge({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":F(),title:F(),children:(0,$.jsx)(Y,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:le()}):null,m?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":xe({name:e.name}),title:xe({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),m?p.length>0?(0,$.jsxs)(Ke,{value:``,onValueChange:e=>void _(e),children:[(0,$.jsx)(Ie,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ne,{placeholder:ae()})}),(0,$.jsx)(Re,{children:p.map(e=>(0,$.jsx)(Ge,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):null:null]})}export{at as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,$y as i,Av as a,Ay as o,Bv as s,By as c,Cm as l,Cy as u,DA as d,Dy as f,E as p,EA as m,Ey as h,Fv as g,Fy as _,Gv as v,Gy as y,Hv as b,Hy as x,Iv as S,Iy as C,Jv as w,Jy as T,Kv as E,Ky as D,Lv as ee,Ly as te,Mv as ne,My as re,Nv as ie,Ny as ae,Ov as oe,Oy as se,Pv as ce,Py as le,Qv as ue,Qy as de,Rv as fe,Ry as pe,Sy as me,Ty as he,Uv as ge,Uy as _e,Vv as ve,Vy as ye,Wv as be,Wy as xe,Xv as Se,Xy as Ce,Yv as O,Yy as we,Zv as Te,Zy as Ee,_y as De,ab as Oe,ay as ke,by as k,cb as Ae,cr as je,cy as Me,db as Ne,dy as Pe,eE as A,eb as j,ey as M,fb as Fe,fy as Ie,gy as Le,hy as Re,ib as ze,iy as Be,jv as Ve,jy as He,kv as Ue,ky as We,lb as Ge,lr as Ke,ly as qe,mb as Je,my as Ye,nb as Xe,ny as Ze,ob as Qe,or as $e,oy as et,pb as tt,py as nt,qv as rt,qy as it,rb as at,ry as ot,sb as st,sr as ct,sy as lt,tE as ut,tb as dt,ty as ft,ub as pt,uy as mt,vy as ht,wA as N,wm as gt,wy as _t,xy as vt,yy as yt,zv as bt,zy as xt}from"./dist-DBtFWMbn.js";import{a as St,c as Ct}from"./FieldLabel-DHRmFB5F.js";import{t as P}from"./button-BIQxgso_.js";import{$ as F,C as I,G as wt,K as Tt,N as L,P as Et,S as R,W as Dt,_ as z,at as B,b as V,et as H,m as Ot,nt as U,ot as W,rt as G,tt as K,x as q,y as J}from"./index-DIWGZqm3.js";import{t as kt}from"./DataTableShell-DtT6IWK0.js";import{InstanceConfigDialog as At}from"./BridgeTab-D_OFclma.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],jt=new Set(X),Mt=`conversational`;function Nt(e){let t=new Set((e??[]).filter(e=>jt.has(e)));return t.size===0?[Mt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:St},Pt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Ft(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 It(){let e=d(p.admin.listInstances,{}),t=d(p.agents.listAllInstanceAgents,{}),n=m(p.admin.upsertInstance),r=m(p.admin.deleteInstance),a=L(),[o,s]=(0,Y.useState)(!1),[u,f]=(0,Y.useState)(Q),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[b,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null);async function E(){try{await n({instanceId:C??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}),f(Q),w(null),s(!1)}catch(e){a.error(Fe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ne(),(0,Z.jsx)(`strong`,{children:pt()}),Ge()]}),(0,Z.jsx)(kt,{title:Ae(),rows:e,addLabel:st(),onAdd:()=>{w(null),f(Q),s(!0)},emptyHint:Qe(),columns:[{header:Oe(),cell:e=>e.name,sort:e=>e.name},{header:ze(),cell:e=>(0,Z.jsx)(F,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:at(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Xe(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Je(),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)(F,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?Ue():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:de(),onSelect:()=>{w(e._id),f(Ft(e)),s(!0)}},{label:tt(),onSelect:()=>g(e.name)},{label:te(),onSelect:()=>S(e)},{label:dt(),onSelect:()=>v(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Ot,{open:o,onOpenChange:s,title:C?Ee():i(),description:we(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:T(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:it(),children:[(0,Z.jsx)(H,{value:u.name,disabled:C!==null,onChange:e=>f({...u,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ce()}):null]}),(0,Z.jsx)($,{label:D(),children:(0,Z.jsxs)(J,{value:u.kind,onValueChange:e=>f({...u,kind:e}),children:[(0,Z.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:y(),children:(0,Z.jsx)(H,{value:u.gatewayUrl,onChange:e=>f({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:xe(),children:(0,Z.jsx)(H,{value:u.bridgeUrl,placeholder:_e(),onChange:e=>f({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:x(),children:(0,Z.jsx)(H,{value:u.displayName,onChange:e=>f({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:gt(),children:[(0,Z.jsxs)(J,{value:u.streamTransport,onValueChange:e=>f({...u,streamTransport:e}),children:[(0,Z.jsx)(R,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(V,{children:Ct.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l()})]}),(0,Z.jsx)($,{label:ye(),children:(0,Z.jsx)(H,{value:u.gatewayVersion,placeholder:c(),onChange:e=>f({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:xt(),children:(0,Z.jsx)(H,{value:u.gatewayHttpUrl,placeholder:pe(),onChange:e=>f({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Kt,{instanceName:h,open:h!==null,onOpenChange:e=>{e||g(null)}}),_?(0,Z.jsx)(At,{instance:_,onClose:()=>v(null)},_._id):null,b?(0,Z.jsx)(Lt,{instance:b,onClose:()=>S(null)},b._id):null]})}function Lt({instance:e,onClose:t}){let n=d(p.instanceSecrets.listInstanceSecretStatus,{}),r=Pt[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)(K,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(U,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(W,{children:C({instance:e.displayName??e.name})}),(0,Z.jsx)(G,{children:_()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Bt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(zt,{instance:e})}),(0,Z.jsx)(Rt,{instance:e})]})})}function Rt({instance:e}){let t=N(p.instanceSync.forceInstanceSync),n=L(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Re());break;case`no_agents`:n.success(nt());break;case`no_bridge_url`:n.error(Ie());break;case`deploy_misconfigured`:n.error(Pe());break;case`unauthorized`:n.error(qe());break;case`not_served`:n.error(Me());break;default:n.error(mt());break}}catch(e){n.error(Ye(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Le():De()})})]})}function zt({instance:e}){let t=d(p.bridgeAuth.listBridgeAuthStatus,{}),n=N(p.bridgeAuth.mintBridgeSecret),i=m(p.bridgeAuth.revokeBridgeSecret),a=L(),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(!1),g=(t??[]).find(t=>t.instanceId===e._id),_=g!==void 0;async function v(){if(!s){c(!0);try{u((await n({instanceId:e._id})).plaintext),h(!1)}catch(e){a.error(M(),e)}finally{c(!1)}}}async function y(){if(!s){c(!0);try{await i({instanceId:e._id}),u(null),a.success(ft())}catch(e){a.error(M(),e)}finally{c(!1)}}}async function b(){if(l)try{await navigator.clipboard.writeText(l),h(!0)}catch{}}return(0,Z.jsxs)($,{label:et(),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)(F,{variant:_?`outline`:`secondary`,children:_?`${He()} · ${g.prefix}…${g.lastFour}`:o()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void v(),disabled:s,children:_?ot():Be()}),_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:s,children:Ze()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:r()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:f?ut():A()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),h(!1)},children:ue()})]}):null]})}function Bt({instanceId:e,field:t,updatedAt:n}){let r=N(p.instanceSecrets.setInstanceSecret),i=m(p.instanceSecrets.clearInstanceSecret),a=N(p.deviceIdentity.generateDeviceIdentity),s=L(),[c,l]=(0,Y.useState)(``),[d,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),x=n!==null,S=t===`deviceIdentity`,C=t===`token`?le():t===`deviceIdentity`?ae():re();async function w(){if(!(!c.trim()||d)){g(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),v(null),b(!1),s.success(he())}catch(e){s.error(_t(),e)}finally{g(!1)}}}async function T(){if(!d){g(!0);try{await i({instanceId:e,field:t}),v(null),b(!1),s.success(u())}catch(e){s.error(_t(),e)}finally{g(!1)}}}async function E(){if(!d){g(!0);try{v(await a({instanceId:e})),b(!1),s.success(k())}catch(e){s.error(ht(),e)}finally{g(!1)}}}let D=_?`openclaw devices approve ${_.id}`:``;async function ee(){if(D)try{await navigator.clipboard.writeText(D),b(!0)}catch{}}return(0,Z.jsxs)($,{label:C,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:vt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(F,{variant:x?`outline`:`secondary`,children:x?He():o()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:x?se():We(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void w(),disabled:d||c.trim().length===0,children:f()}),S?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void E(),disabled:d,children:me()}):null,x?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void T(),disabled:d,children:h()}):null]})]}),_?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:k()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:D}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void ee(),children:y?ut():A()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{v(null),b(!1)},children:ue()})]}):null]})}var Vt={conversational:be,documentary:b,summarizer:Ke,curator:ct},Ht={conversational:ge,documentary:ve,summarizer:je,curator:$e},Ut=e=>(Vt[e]??(()=>e))(),Wt=e=>(Ht[e]??(()=>``))();function Gt({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:w()}),t.map(e=>(0,Z.jsx)(F,{variant:`secondary`,className:`oc-agenttype__chip`,title:Wt(e),children:Ut(e)},e)),(0,Z.jsxs)(Dt,{children:[(0,Z.jsx)(Tt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:rt()})}),(0,Z.jsxs)(wt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:E()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:v()}),(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)(z,{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:Ut(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Wt(r)})]})]},r)})})]})]})]})}function Kt({instanceName:e,open:t,onOpenChange:n}){let r=d(p.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=m(p.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=m(p.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=m(p.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Nt(r);e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=m(p.agents.removeInstanceAgent),u=Et(),f=L();async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(O(),e)}}async function _(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){f.error(O(),e)}}async function v(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){f.error(O(),e)}}async function y(t,n){if(e&&await u({title:fe({name:n}),description:ee(),confirmLabel:S(),destructive:!0}))try{await l({instanceName:e,agentId:t}),f.success(g())}catch(e){f.error(O(),e)}}return(0,Z.jsx)(K,{open:t,onOpenChange:n,children:(0,Z.jsxs)(U,{className:`oc-access`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(W,{children:Te({name:e??``})}),(0,Z.jsx)(G,{children:Se()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ie():r.discovery.lastPollOk?ne():Ve({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(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)(z,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void h(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)(F,{variant:`outline`,className:`oc-access__gone`,children:oe()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void y(e.agentId,i),children:bt()})]}):n?(0,Z.jsx)(F,{variant:`default`,children:Ue()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void _(e.agentId),children:s()})]}),e.enabled?(0,Z.jsx)(Gt,{agentId:e.agentId,types:a,onToggle:t=>void v(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{It as InstancesTab};
@@ -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,Ai as a,CS as o,Ci as s,DA as c,DS as l,Di as u,E as d,EA as f,ES as p,Ei as m,FS as h,Gx as ee,IS as g,Jx as te,Kx as ne,MS as _,NS as v,OS as y,Oi as re,PS as ie,Qx as ae,SS as b,Si as x,TS as oe,Ti as se,Wx as ce,Xx as le,Yx as S,Zx as C,_S as w,aS as T,bS as E,cS as D,dS as O,eS as k,fS as A,gS as j,hS as M,iS as N,jS as P,kS as F,ki as I,lS as L,mS as R,nS as z,oS as B,pS as V,qx as H,rS as U,sS as W,tS as ue,uS as de,vS as fe,wA as pe,wS as me,wi as he,xS as ge,yS as _e}from"./dist-DBtFWMbn.js";import{t as G}from"./button-BIQxgso_.js";import{$ as K,C as ve,S as ye,_ as be,b as xe,et as q,k as Se,x as Ce,y as we}from"./index-DIWGZqm3.js";import{t as Te}from"./DataTableShell-DtT6IWK0.js";var J=t(e(),1),Y=n();function Ee(){let e=c(d.integrations.status.status,{}),t=f(d.admin.setIntegrationConfig),[n,s]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:g()});let u=n,m=(e,t,n)=>s({...u,[e]:{...u[e],[t]:n}}),x=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,Y.jsx)(`strong`,{children:ie()}),` `,v()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:_()}):(0,Y.jsx)(K,{variant:`outline`,children:P()}):(0,Y.jsx)(K,{variant:`outline`,children:i()}),note:y(),children:[(0,Y.jsx)(Z,{label:p(),children:(0,Y.jsx)(q,{value:u.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>x(`langfuse`,{host:u.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:b(),checked:u.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),x(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:_()}):(0,Y.jsx)(K,{variant:`outline`,children:P()}):(0,Y.jsx)(K,{variant:`outline`,children:i()}),note:l(),children:[(0,Y.jsx)(Z,{label:oe(),children:(0,Y.jsx)(q,{value:u.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>x(`opik`,{baseUrl:u.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:me(),children:(0,Y.jsx)(q,{value:u.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||o(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>x(`opik`,{workspace:u.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:b(),checked:u.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),x(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:_()}):(0,Y.jsx)(K,{variant:`outline`,children:P()}):(0,Y.jsx)(K,{variant:`outline`,children:a()}),note:I(),children:[(0,Y.jsx)(Z,{label:re(),children:(0,Y.jsx)(q,{value:u.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>x(`otlp`,{endpoint:u.otlp.endpoint??``})})}),(0,Y.jsx)(De,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:b(),checked:u.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),x(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:ge(),status:(0,Y.jsx)(K,{variant:`outline`,children:F()}),note:E(),children:[(0,Y.jsx)(Z,{label:_e(),children:(0,Y.jsx)($,{value:u.tts.auto??`off`,options:[[`off`,fe()],[`always`,w()],[`inbound`,j()],[`tagged`,M()]],onChange:e=>{m(`tts`,`auto`,e),x(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:R(),children:(0,Y.jsx)($,{value:u.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,V()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{m(`tts`,`provider`,e),x(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:A(),children:(0,Y.jsx)(q,{value:u.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>m(`tts`,`model`,e.target.value),onBlur:()=>x(`tts`,{model:u.tts.model??``})})}),(0,Y.jsx)(Z,{label:O(),children:(0,Y.jsx)(q,{value:u.tts.voice??``,placeholder:de(),onChange:e=>m(`tts`,`voice`,e.target.value),onBlur:()=>x(`tts`,{voice:u.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:L(),status:(0,Y.jsx)(K,{variant:`outline`,children:F()}),note:e.secrets.openai?D():W(),children:[(0,Y.jsx)(Q,{label:B(),checked:u.talk.enabled??!1,onChange:e=>{m(`talk`,`enabled`,e),x(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:T(),children:(0,Y.jsx)($,{value:u.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{m(`talk`,`realtimeProvider`,e),x(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:N(),children:(0,Y.jsx)(q,{value:u.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>m(`talk`,`realtimeModel`,e.target.value),onBlur:()=>x(`talk`,{realtimeModel:u.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:O(),children:(0,Y.jsx)(q,{value:u.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>m(`talk`,`voice`,e.target.value),onBlur:()=>x(`talk`,{voice:u.talk.voice??``})})}),(0,Y.jsx)(Z,{label:U(),children:(0,Y.jsx)($,{value:u.talk.transport??`webrtc`,options:[[`webrtc`,z()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{m(`talk`,`transport`,e),x(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:ue(),children:(0,Y.jsx)(q,{value:u.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>m(`talk`,`speechLocale`,e.target.value),onBlur:()=>x(`talk`,{speechLocale:u.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:k(),checked:u.talk.interruptOnSpeech??!0,onChange:e=>{m(`talk`,`interruptOnSpeech`,e),x(`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:r()}),(0,Y.jsx)(K,{variant:`outline`,children:ae()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[C(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(Te,{title:le(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:S(),columns:[{header:te(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:H(),cell:e=>e.lastAt>0?Se(e.lastAt):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:ne(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:ee(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:ce(),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)(be,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(we,{value:e,onValueChange:n,children:[(0,Y.jsx)(ye,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ve,{})}),(0,Y.jsx)(xe,{children:t.map(([e,t])=>(0,Y.jsx)(Ce,{value:e,children:t},e))})]})}function De({headersSet:e}){let t=pe(d.integrations.otlpSecret.setOtlpHeaders),n=f(d.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),p=async()=>{l(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,Y.jsxs)(Z,{label:u(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?m():se(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void p(),children:he()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:s()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:x()})]})}export{Ee as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AD as r,BD as i,CD as a,DA as o,DD as s,E as c,EA as l,ED as u,FD as d,GD as f,HD as p,ID as m,Jy as ee,KD as h,LD as g,MD as te,ND as ne,OD as re,PD as ie,RD as ae,SD as _,TD as oe,UD as se,VD as ce,WD as le,_D as ue,aA as v,bD as y,cA as b,eA as x,gD as S,hD as C,iA as w,jD as T,kD as E,lA as D,mD as O,nA as k,oA as A,pA as j,pD as M,rA as N,sA as P,tA as F,uA as I,vA as L,vD as R,wD as z,xD as B,yD as V,zD as de}from"./dist-DBtFWMbn.js";import{t as H}from"./button-BIQxgso_.js";import{C as fe,N as pe,S as me,_ as U,b as he,et as W,j as ge,lt as G,x as K,y as _e}from"./index-DIWGZqm3.js";import{t as ve}from"./localePickerView-C2RmOS86.js";var q=t(e(),1),J=[{id:`messages`,label:()=>h()},{id:`composer`,label:()=>f()},{id:`sidebar`,label:()=>le()},{id:`other`,label:()=>se()}],Y={showSource:{category:`messages`,label:()=>p(),help:()=>ce()},showReport:{category:`messages`,label:()=>i(),help:()=>de()},copyAssistant:{category:`messages`,label:()=>ae()},copyUser:{category:`messages`,label:()=>g()},showDelete:{category:`messages`,label:()=>m()},showTools:{category:`messages`,label:()=>d(),help:()=>ie()},voiceInput:{category:`composer`,label:()=>ne(),help:()=>te()},showChatAge:{category:`sidebar`,label:()=>T(),help:()=>r()},showChatProvider:{category:`sidebar`,label:()=>E(),help:()=>re()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function ye(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 be=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`],xe={voiceInput:`voiceInput`};function Se(e){return be.includes(e)}function Z(e){return e===`admin`}function Ce(e){return e===!0?`on`:e===!1?`off`:`inherit`}function we(e){return e===`on`?!0:e===`off`?!1:null}function Q(e){return Se(e)?xe[e]:void 0}var $=n(),Te={voiceInput:()=>ue()};function Ee({prefKey:e,ui:t}){let n=l(c.admin.setUiPrefDefault),r=l(c.admin.setFeatureEnabled),i=Q(e),a=i?Te[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:B()}),(0,$.jsxs)(_e,{value:Ce(t.defaults[e]),onValueChange:t=>void n({key:e,value:we(t)}),children:[(0,$.jsx)(me,{size:`sm`,className:`w-36`,children:(0,$.jsx)(fe,{})}),(0,$.jsxs)(he,{children:[(0,$.jsx)(K,{value:`on`,children:C()}),(0,$.jsx)(K,{value:`off`,children:O()}),(0,$.jsx)(K,{value:`inherit`,children:M()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(U,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":y()}),y()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function De(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=o(c.me.getMe,{host:G}),d=i?.ui,f=Z(i?.role)&&n,p=l(c.me.setUiPref).withOptimisticUpdate(ge),m=(0,q.useMemo)(()=>d?ye(Object.keys(d.effective),e):[],[d,e]);return d?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(U,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,f?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:V()}),(0,$.jsx)(`p`,{children:R()}),(0,$.jsx)(`p`,{children:S()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:s(),"aria-label":s(),className:`mb-2`}),m.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:u()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:m.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=d.locked[e],o=d.effective[e],s=d.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${s&&!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:oe()}):s?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:z()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void p({key:e,value:null}),children:a()}):null,(0,$.jsx)(U,{checked:o,disabled:i,onCheckedChange:t=>void p({key:e,value:t===!0}),"aria-label":n})]}),f?(0,$.jsx)(Ee,{prefKey:e,ui:d}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:L()})}function Oe(){let e=o(c.me.getMe,{host:G}),t=l(c.me.setLocale),n=l(c.me.setMyName),r=pe(),i=e?.locale??`default`,a=e?.name??``,[s,u]=(0,q.useState)(null),d=s??a,f=d.trim()!==a.trim();async function p(){try{await n({name:d}),u(null),r.success(A())}catch(e){r.error(v(),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:I()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:d,maxLength:120,placeholder:b(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,$.jsx)(H,{size:`sm`,disabled:!f,onClick:()=>void p(),children:ee()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:P()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:w()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:N()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[ve().map(e=>(0,$.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:j()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:F()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(0,$.jsx)(De,{})]})]})}export{Oe as PreferencesTab};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,At as i,DA as a,Dm as o,E as s,EA as c,Mt as l,Nt as u,O as d,Om as f,Ot as p,_m as m,am as h,bm as g,cm as _,dm as v,dr as y,fm as b,fr as x,gm as S,hm as C,im as w,jt as T,k as E,kt as D,lm as O,mm as ee,mr as te,nm as ne,om as re,pm as ie,pr as ae,rm as oe,sm as k,tm as A,um as j,ur as M,vm as N,ym as P}from"./dist-DBtFWMbn.js";import{d as F,f as I,i as L,l as R,n as z,r as B,t as V,u as H}from"./FieldLabel-DHRmFB5F.js";import{t as U}from"./button-BIQxgso_.js";import{C as W,N as se,S as G,_ as K,b as q,lt as ce,x as J,y as Y}from"./index-DIWGZqm3.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:C,help:ee},documentary_fetch:{label:ie,help:b},inbound_files:{label:v,help:j},history_summary:{label:te,help:ae},file_curation:{label:u,help:l}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:oe,references:ne,files:A,previous_summary:x,new_messages:y,max_chars:M,file_name:T,budget_chars:i,feedback:D,content:p};function pe(){let e=a(s.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:_()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(z,{label:g(),help:P()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:O()}),(0,$.jsxs)(Y,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(J,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=c(s.admin.upsertInstanceConfig),n=se(),i=a(s.me.getMe,{host:ce}),l=e.config??{},u=X(e.config?.contentLocale,i?.defaultLocale??void 0),[p,m]=(0,Q.useState)(()=>L(l,u));(0,Q.useEffect)(()=>{m(L(l,u))},[u,e._id]);let[h,g]=(0,Q.useState)(!1),_=p.promptInjections,v=(e,t)=>m({...p,promptInjections:{..._,[e]:{..._[e],...t}}});async function y(){g(!0);try{await t({instanceId:e._id,config:B(p,l,u)})}catch(e){n.error(o(),e)}finally{g(!1)}}async function b(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(o(),e)}}let x=e.config?.contentLocale??`default`,S=Z[X(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:r()}),(0,$.jsxs)(Y,{value:x,onValueChange:e=>void b(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(W,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(J,{value:`default`,children:d({locale:S})}),le().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:E()})]}),H.map(e=>(0,$.jsx)(he,{injKey:e,def:R[e],i18n:ue[e],row:_[e]??{enabled:!0,template:R[e].defaultTemplate[u]},contentLocale:u,onChange:t=>v(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void y(),disabled:h,children:f()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),d=F(e,r,i),f=d?I(d,u):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(K,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:m()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:S()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?re():k()}),c&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:N()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:h()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,A_ as i,B_ as a,C_ as o,DA as s,D_ as ee,E as c,EA as l,E_ as u,G_ as d,H_ as f,J_ as p,K_ as m,L_ as h,O_ as g,Q_ as te,R_ as ne,T_ as re,U_ as ie,V_ as _,W_ as v,X_ as y,Y_ as b,Z_ as x,av as S,cv as C,dv as w,ev as T,fv as E,iv as D,j_ as O,k_ as k,lv as A,nv as j,ov as M,q_ as N,rn as P,rv as F,sv as I,tv as L,uv as R,w_ as z,z_ as ae}from"./dist-DBtFWMbn.js";import{t as B}from"./button-BIQxgso_.js";import{$ as V,N as H,P as U,_ as W,et as G,m as K,wt as q}from"./index-DIWGZqm3.js";import{t as J}from"./roleDescriptions-CrpgjGTq.js";var Y=t(e(),1),X=n(),Z=[{group:()=>E(),keys:[{key:`traces.read`,label:()=>I()},{key:`traces.read.content`,label:()=>M(),phi:!0},{key:`traces.write`,label:()=>S()}]},{group:()=>w(),keys:[{key:`kpi.read`,label:()=>I()},{key:`kpi.write`,label:()=>S()}]},{group:()=>R(),keys:[{key:`openclaw.query`,label:()=>D()},{key:`anomalies.read`,label:()=>F()},{key:`anomalies.report`,label:()=>j()}]},{group:()=>A(),keys:[{key:`chats.read`,label:()=>I()},{key:`selfheal`,label:()=>T()},{key:`feedback.respond`,label:()=>P()}]},{group:()=>C(),keys:[{key:`admin.manage`,label:()=>L()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=s(c.apiKeys.listRoles,{}),t=l(c.apiKeys.createRole),n=l(c.apiKeys.ensureRolesSeeded),S=l(c.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(c.apiKeys.listRoles,{});r&&e.setQuery(c.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),C=U(),w=H(),[T,E]=(0,Y.useState)(!1),[D,A]=(0,Y.useState)($),[j,M]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{w.error(te(),e)})},[n,w]);let P=e??[];async function F(e,t){if(Q(e.permissions)||j.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:x({name:e.name}),description:y(),confirmLabel:b()}))){M(t=>new Set(t).add(e._id));try{await S({roleId:e._id,permissions:n})}catch(e){w.error(p(),e)}finally{M(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:D.key,name:D.name,description:D.description||void 0,permissions:[]}),A($),E(!1)}catch(e){w.error(N(),e)}}let L=e===void 0,R=!L&&P.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,d(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,v()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:ie()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{A($),E(!0)},children:f()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ae()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?r({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:P.map(e=>{let t=Q(e.permissions),n=j.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,ne()]}):(0,X.jsx)(V,{variant:`secondary`,children:h()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(W,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?O():n?i():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:T,onOpenChange:E,title:k(),description:g(),canSubmit:!!(D.key&&D.name),onSubmit:I,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,X.jsx)(G,{value:D.key,placeholder:re(),onChange:e=>A({...D,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:z()}),(0,X.jsx)(G,{value:D.name,onChange:e=>A({...D,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,X.jsx)(G,{value:D.description,onChange:e=>A({...D,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AE as a,BE as ee,CE as te,DA as o,DE as ne,E as s,EA as c,EE as re,FE as ie,GE as ae,HE as oe,IE as se,JE as ce,JT as l,KE as le,KT as u,LE as ue,ME as de,NE as fe,OE as pe,PE as me,QE as he,QT as ge,RE as _e,SE as ve,TE as ye,UE as be,VE as xe,WE as Se,XE as Ce,XT as we,YE as Te,YT as Ee,ZE as De,ZT as d,_E as Oe,aD as ke,aE as f,bE as Ae,cD as je,cE as p,dD as Me,dE as m,eD as Ne,eE as h,fD as Pe,fE as g,gE as Fe,hE as _,iD as Ie,iE as v,jE as Le,kE as Re,lD as ze,lE as y,mE as b,nD as Be,nE as x,oD as S,oE as C,pE as w,qE as Ve,qT as T,rD as He,rE as E,sD as D,sE as O,tD as Ue,tE as k,uD as We,uE as A,vE as Ge,wA as Ke,wE as qe,xE as Je,yE as Ye,zE as Xe}from"./dist-DBtFWMbn.js";import{n as j}from"./dist-DQNUMYl3.js";import{i as Ze}from"./dist-BvWD6-xy.js";import{t as M}from"./button-BIQxgso_.js";import{$ as N,At as P,C as F,Ft as Qe,N as $e,Nt as et,O as I,P as tt,Pt as nt,S as L,at as R,b as z,et as rt,it as B,k as V,m as it,nt as H,ot as at,rt as ot,tt as U,x as W,y as G}from"./index-DIWGZqm3.js";import{t as st}from"./FilterBar-B58FmRXC.js";import{t as ct}from"./DataTableShell-DtT6IWK0.js";import{t as lt}from"./roleDescriptions-CrpgjGTq.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>ge(),days:null},{value:`30`,label:()=>d(),days:30},{value:`90`,label:()=>we(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=Qe({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[l,u]=(0,K.useState)(X),ge=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),we=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),Ee=o(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:l===X?void 0:l,disabled:i===X?void 0:i===`disabled`}}),d=o(s.apiKeys.listKeys,{}),f=o(s.apiKeys.listRoles,{}),p=c(s.apiKeys.createServiceAccount),m=c(s.apiKeys.updateServiceAccount),h=c(s.apiKeys.deleteServiceAccount),g=Ke(s.apiKeys.mintApiKey),_=c(s.apiKeys.revokeApiKey),v=tt(),y=$e(),b=n!==``||l!==X||i!==X;function x(){u(X),t({search:{},replace:!0})}let[C,w]=(0,K.useState)(!1),[T,E]=(0,K.useState)(Z),[O,k]=(0,K.useState)(null),[A,j]=(0,K.useState)(new Set),[P,I]=(0,K.useState)(null),R=(0,K.useRef)(!1),[B,V]=(0,K.useState)(new Set),[H,at]=(0,K.useState)({}),[ot,U]=(0,K.useState)(null),Y=(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){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{O?(await m({serviceAccountId:O,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(a())):await p({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Z),k(null),w(!1)}catch(e){y.error(O?Le():de(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),w(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=H[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(Re(),e)}finally{R.current=!1,I(null)}}async function $(e){if(await v({title:pe(),description:(0,q.jsxs)(q.Fragment,{children:[ne(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,re(),` `,(0,q.jsx)(`strong`,{children:ye()}),` `,qe()]}),confirmWord:e.name,confirmLabel:te(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(ve(),e.name)}catch(e){y.error(Je(),e)}}async function ht(e){if(await v({title:Ae(),description:(0,q.jsxs)(q.Fragment,{children:[Ye(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ge()]}),confirmLabel:Oe(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(Fe(),e)}finally{V(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:Pe()}),(0,q.jsxs)(st,{q:n,onQChange:ge,searchPlaceholder:Me(),onReset:x,canReset:b,children:[(0,q.jsxs)(G,{value:l,onValueChange:u,children:[(0,q.jsx)(L,{size:`sm`,className:`w-40`,children:(0,q.jsx)(F,{placeholder:We()})}),(0,q.jsxs)(z,{children:[(0,q.jsx)(W,{value:X,children:ze()}),(f??[]).map(e=>(0,q.jsx)(W,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:i,onValueChange:we,children:[(0,q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,q.jsx)(F,{})}),(0,q.jsxs)(z,{children:[(0,q.jsx)(W,{value:X,children:je()}),(0,q.jsx)(W,{value:`active`,children:D()}),(0,q.jsx)(W,{value:`disabled`,children:S()})]})]})]}),(0,q.jsx)(ct,{title:ke(),rows:Ee,addLabel:Ie(),onAdd:()=>{E(Z),k(null),w(!0)},emptyHint:He(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:r(),onSelect:()=>pt(e)},{label:Be(),onSelect:()=>void mt(e)},{label:A.has(e._id)?Ue():Ne(),onSelect:()=>Q(e._id)},{label:he(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?De():Ce(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,q.jsx)(Ze,{}):(0,q.jsx)(et,{})})},{header:Te(),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:ce(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:Ve(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(N,{variant:`destructive`,children:S()}):(0,q.jsx)(N,{variant:`outline`,children:D()})},{header:le(),cell:e=>(0,q.jsxs)(G,{value:H[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(L,{size:`sm`,className:`w-32`,children:(0,q.jsx)(F,{})}),(0,q.jsx)(z,{children:J.map(e=>(0,q.jsx)(W,{value:e.value,children:e.label()},e.value))})]})},{header:ae(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?Se():be({count:t})})}}]}),(0,q.jsx)(it,{open:C,onOpenChange:e=>{w(e),e||k(null)},title:O?oe():Xe(),description:O?xe():_e(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:O?ee():ue(),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:se()}),(0,q.jsx)(rt,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,q.jsxs)(G,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,q.jsx)(L,{className:`w-full`,children:(0,q.jsx)(F,{placeholder:me()})}),(0,q.jsx)(z,{children:(f??[]).map(e=>(0,q.jsxs)(W,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?lt(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:fe()}),(0,q.jsx)(rt,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:ot,onClose:()=>U(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:[_(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:w()}),(0,q.jsx)(`th`,{children:g()}),(0,q.jsx)(`th`,{children:m()}),(0,q.jsx)(`th`,{children:A()}),(0,q.jsx)(`th`,{children:y()}),(0,q.jsx)(`th`,{children:p()}),(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)(N,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:V(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?O():C()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function a(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(U,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(H,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(R,{children:[(0,q.jsx)(at,{children:f()}),(0,q.jsx)(ot,{children:v({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:E()}),(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)(M,{variant:`outline`,size:`sm`,onClick:()=>void a(),"aria-label":x(),children:[n?(0,q.jsx)(j,{}):(0,q.jsx)(P,{}),n?k():h()]})]}),(0,q.jsx)(B,{children:(0,q.jsx)(M,{onClick:()=>{r(!1),t()},children:i()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?Ee():V(e)}function mt(e){return e===null?`—`:I(e)}function $(e){return e.disabled?(0,q.jsx)(N,{variant:`destructive`,children:l()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(N,{variant:`outline`,children:T()}):(0,q.jsx)(N,{variant:`outline`,children:u()})}export{Q as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$O as i,AO as a,BO as o,CO as s,D as c,DA as l,DO as u,E as d,EA as f,EO as p,FO as m,GO as h,HO as g,IO as _,JD as v,JO as y,KO as b,LO as ee,MO as x,NO as te,OO as ne,PO as re,QD as ie,QO as ae,RO as oe,SO as se,TO as ce,UO as le,VO as ue,WO as de,XD as fe,XO as pe,YD as me,YO as he,ZD as S,ZO as ge,_O as _e,_r as C,aO as ve,ak as w,bO as ye,cO as be,ck as xe,dO as Se,dk as Ce,eO as we,ek as Te,fO as Ee,fk as De,gA as Oe,gO as ke,gr as Ae,hA as je,hO as Me,hk as Ne,hr as Pe,iO as Fe,ik as Ie,jO as Le,kO as Re,lO as ze,lk as Be,mA as Ve,mO as He,mk as Ue,n as We,nO as Ge,nk as Ke,oO as qe,ok as Je,pO as T,pk as Ye,qD as Xe,qO as Ze,rO as Qe,rk as $e,sO as et,sk as tt,tO as E,tk as nt,uO as rt,uk as it,vO as at,vr as ot,wA as st,wO as ct,xO as lt,yO as ut,zO as dt}from"./dist-DBtFWMbn.js";import{n as D}from"./dist-DQNUMYl3.js";import{t as O}from"./x-CvI3xVho.js";import{t as k}from"./button-BIQxgso_.js";import{$ as A,C as j,J as ft,Ot as M,Q as pt,S as N,X as mt,Y as P,Z as F,_ as I,b as L,ct as ht,et as R,kt as gt,lt as z,q as _t,st as vt,x as B,y as V}from"./index-DIWGZqm3.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-CLaLoMG5.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-UO-VP67W.js";import{t as kt}from"./TimeRangePicker-fEd70Mzj.js";import{t as At}from"./FilterBar-B58FmRXC.js";import{t as jt}from"./AdvancedFilter-DJqYfM0R.js";var G=c(`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`}]]),K=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(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 It(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 q(e,t,n){return It(e,t,n)>=Mt}function Lt(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 Rt(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 zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ke());if(e.size>zt)throw Error(Me());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/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(T());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(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(T());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);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error(Ee());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(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 J(e)}async function J(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(He())),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 Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Oe():e===`dark`?je():Ve()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:We(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":ot(),title:ot(),children:(0,X.jsx)(gt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=l(d.charts.listMyCharts),r=f(d.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:w(),subtitle:Ie(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?$e():n.via===`owner`?Ke():nt({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Te()}):null]})}function Qt(){let e=f(d.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[s,c]=(0,K.useState)(null),[l,u]=(0,K.useState)(!1),[p,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){c(null),u(!1);try{i(await t.text())}catch{c(x())}}}async function v(){if(c(null),u(!1),t.trim()===``){c(a());return}let o;try{o=JSON.parse(r)}catch{c(x());return}h(!0);try{await e({name:t.trim(),tokens:o}),u(!0),n(``),i(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{h(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:o()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:dt()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:oe()}),(0,X.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:ee(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:_()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:m(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),re(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:p,onClick:()=>void v(),children:te()})]}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null,l?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Le()}):null]})]})}function $t({chart:e}){let t=st(d.charts.setChartLogo),n=f(d.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ut(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function p(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function m(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function h({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?s():se()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?ye():lt(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:at()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:ut()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ct()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(h,{mode:`light`}),(0,X.jsx)(h,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:_e()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=l(d.me.getMe,{host:z}),n=f(d.charts.addChartDomain),r=f(d.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,u]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let p=e.domains??[];async function m(){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 h(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Se()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:p.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()}):p.map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":qe({domain:e}),onClick:()=>void h(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:ze(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void m(),children:be()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:rt()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=f(d.charts.updateChart),n=f(d.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>tn(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1);function v(){o(e.name),c(tn(e.tokens)),u(e.tokens.bpm??0),h(null),i(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(s)}catch{h(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:v,children:p()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:ce()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Qe()}),(0,X.jsx)(R,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:C()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":C()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Ae():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Pe()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ge()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:g,onClick:()=>void y(),children:ve()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Fe()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=l(d.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Re()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=f(d.charts.addChartToGroupPool),r=f(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?b():e.kind===`custom`&&e.scope===`personal`?S():Ze()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:h()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:le()}),(a??[]).map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ue({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(j,{placeholder:g()})}),(0,X.jsx)(L,{children:s.map(e=>(0,X.jsx)(B,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:de()}):null]})]})}function on({chart:e}){let t=f(d.charts.promoteChartToCommon),n=f(d.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(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?fe():S()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ie({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:me()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:v()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let a=f(d.admin.setDefaultThemeMode),o=f(d.admin.setDefaultLocale),s=f(d.charts.setDefaultChart),c=l(d.charts.listChartsAdmin),u=l(d.groups.listGroups,{}),p=e??`system`,m=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Be()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:i()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void s({name:null}),children:w()}),ht.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:u??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:he()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:we()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ne()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:p===e?`default`:`outline`,size:`sm`,onClick:()=>void a({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(k,{variant:m===e.value?`default`:`outline`,size:`sm`,onClick:()=>void o({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]})]})}function cn(){let e=l(d.me.getMe,{host:z}),t=vt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:it()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(R,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(N,{className:`w-56`,children:(0,X.jsx)(j,{placeholder:`Select…`})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(B,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(B,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(I,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{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,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(j,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes directions`}),(0,X.jsx)(B,{value:`inbound`,children:`inbound`}),(0,X.jsx)(B,{value:`outbound`,children:`outbound`}),(0,X.jsx)(B,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(j,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(B,{value:`info`,children:`info`}),(0,X.jsx)(B,{value:`warn`,children:`warn`}),(0,X.jsx)(B,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(kt,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(_t,{children:[(0,X.jsx)(pt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(ft,{align:`start`,children:[(0,X.jsx)(mt,{children:`Actions`}),(0,X.jsx)(F,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(F,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(I,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(I,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(M,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,AC as i,Ah as a,BC as o,Bh as s,CC as c,Ch as l,D as u,DA as d,DC as f,Dh as p,E as m,EA as h,EC as g,Eh as _,FC as v,Fh as y,G as b,GC as x,Gh as S,HC as C,Hh as ee,IC as w,Ih as te,Jh as ne,K as T,KC as re,Kh as ie,LC as ae,Lh as oe,MC as E,Mh as se,NC as D,Nh as ce,OC as le,Oh as ue,PC as O,Ph as de,Qh as fe,RC as pe,Rh as me,SC as k,Sh as A,TC as j,Th as he,UC as M,Uh as ge,VC as N,Vh as _e,WC as P,Wh as ve,Xh as ye,Yh as be,Zh as xe,_C as Se,aC as F,ag as Ce,cC as we,dC as Te,eg as Ee,fC as De,gC as Oe,hC as I,iC as ke,ig as Ae,jC as je,jh as Me,kC as Ne,kh as Pe,lC as Fe,mC as Ie,ng as Le,oC as Re,og as ze,pC as Be,q as Ve,qh as He,rC as Ue,rg as We,sC as Ge,tg as Ke,uC as qe,wC as Je,wh as Ye,zC as Xe,zh as Ze}from"./dist-DBtFWMbn.js";import{n as Qe}from"./dist-DQNUMYl3.js";import{t as $e}from"./x-CvI3xVho.js";import{i as L,n as R,r as et,t as tt}from"./tabs-C35PjHwb.js";import{t as z}from"./button-BIQxgso_.js";import{$ as B,A as nt,At as rt,C as V,Dt as it,Et as at,Ft as ot,M as st,Pt as ct,S as H,a as lt,at as ut,b as U,i as dt,k as W,lt as ft,nt as pt,o as mt,ot as ht,r as gt,rt as _t,tt as vt,x as G,y as K}from"./index-DIWGZqm3.js";import{n as q}from"./TimeRangePicker-fEd70Mzj.js";import{t as yt}from"./FilterBar-B58FmRXC.js";import{t as bt}from"./AdvancedFilter-DJqYfM0R.js";import{t as xt}from"./DataTableShell-DtT6IWK0.js";var St=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`}]]),Ct=u(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?f():n===`agent`?`${g()} - ${r}`:e}function Tt(){let e=d(m.me.getMe,{host:ft})?.role===`admin`,t=d(m.deliveryTiming.getDeliveryStatus,{}),n=h(m.deliveryTiming.startDeliveryRecord),r=h(m.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!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:re()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}),e?(0,Y.jsx)(z,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?M():P()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(B,{variant:`secondary`,children:C()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:N({time:nt(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?pe():Xe()})}),i?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=d(m.deliveryTiming.listDeliverySessions,{}),n=h(m.deliveryTiming.deleteDeliverySessions),[r,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[f,p]=(0,J.useState)(null),{from:g,to:_}=q(l),y=l.to===`now`?1/0:_,b=r.trim()!==``||o!==`all`||l!==X,x=()=>{a(``),s(`all`),u(X)},S=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=g&&t.startedAt<=y).map(e=>({...e,_id:e.sessionId}))},[t,r,o,g,y]),C=e=>{let t=new Set((S??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),f!==null&&r.includes(f)&&p(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:r,onQChange:a,searchPlaceholder:w(),timeRange:l,onTimeRangeChange:u,onReset:x,canReset:b,children:(0,Y.jsxs)(K,{value:o,onValueChange:e=>s(e),children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(V,{})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(G,{value:`all`,children:v()}),(0,Y.jsx)(G,{value:`active`,children:O()}),(0,Y.jsx)(G,{value:`stopped`,children:D()})]})]})}),(0,Y.jsx)(xt,{title:ae(),rows:S,emptyHint:ke(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":f===e.sessionId?Je():j(),onClick:()=>p(t=>t===e.sessionId?null:e.sessionId),children:f===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(it,{size:15,"aria-hidden":!0})})},{header:E(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:W(e.startedAt)})},{header:je(),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:W(e.stoppedAt)})},{header:i(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:Ne(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:le(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(B,{variant:`secondary`,children:O()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:D()})}],rowActions:e?e=>[{label:c(),variant:`destructive`,onSelect:()=>C([e.sessionId])}]:void 0,bulkActions:e?[{label:c(),variant:`destructive`,onSelect:e=>C(e)}]:void 0,isExpanded:e=>e.sessionId===f,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=d(m.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(st(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let r=e.segments,i=(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,` `,Ue()]}),(0,Y.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,Y.jsx)(rt,{size:13,"aria-hidden":!0}),t?F():Re()]})]}),(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:I()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Ie()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Be()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(De(),r.bridge),i(Te(),r.A),i(qe(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:we()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Ve()},{value:`principalType`,label:T()},{value:`direction`,label:`direction`},{value:`roleKey`,label:b()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=ot({from:`/settings/traces`}),t=ct({from:`/settings/traces`}),n=e.limit,i=e.kind,o=e.statusClass??Q,c=e.principalType??Q,l=e.direction??Q,u=e.roleKey??Q,f=e.q??``,h=gt(e.from,e.to),g=(0,J.useMemo)(()=>mt(e.adv),[e.adv]),{from:v,to:b}=q(h),[x,C]=(0,J.useState)(null),[w,T]=(0,J.useState)(null),re=e=>void t({search:t=>({...t,limit:e})}),ae=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...lt(e)})}),A=e=>void t({search:t=>({...t,adv:dt(e)}),replace:!0}),j=d(m.observability.listEvents,{limit:n}),M=d(m.observability.listEvents,{limit:n,kind:i===At?void 0:i,filter:{q:f||void 0,from:v,to:b,statusClass:o===Q?void 0:o,principalType:c===Q?void 0:c,direction:l===Q?void 0:l,roleKey:u===Q?void 0:u,advanced:g.length>0?g:void 0}}),N=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),P=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),F=f!==``||o!==Q||c!==Q||l!==Q||u!==Q||g.length>0||h.kind!==`relative`||h.from!==Pt.from;function we(){t({search:{limit:100,kind:`all`},replace:!0})}let Te=x?j?.filter(e=>e.correlationId===x):M,[De,I]=(0,J.useState)(`events`);return(0,Y.jsxs)(tt,{value:De,onValueChange:e=>I(e),children:[(0,Y.jsxs)(et,{className:`w-full`,children:[(0,Y.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(at,{size:13,"aria-hidden":!0}),Se()]}),(0,Y.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),Oe()]})]}),(0,Y.jsx)(R,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[ze(),(0,Y.jsx)(`strong`,{children:Ce()}),Ae(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:We()})]}),(0,Y.jsxs)(yt,{q:f,onQChange:E,searchPlaceholder:Le(),timeRange:h,onTimeRangeChange:k,onReset:we,canReset:F,children:[(0,Y.jsxs)(K,{value:o,onValueChange:D,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(V,{placeholder:Ke()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(G,{value:Q,children:Ee()}),jt.map(e=>(0,Y.jsx)(G,{value:e,children:e},e))]})]}),(0,Y.jsxs)(K,{value:c,onValueChange:le,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(V,{placeholder:r()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(G,{value:Q,children:fe()}),Mt.map(e=>(0,Y.jsx)(G,{value:e,children:e},e))]})]}),(0,Y.jsxs)(K,{value:l,onValueChange:O,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(V,{placeholder:xe()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(G,{value:Q,children:ye()}),Nt.map(e=>(0,Y.jsx)(G,{value:e,children:e},e))]})]}),(0,Y.jsxs)(K,{value:u,onValueChange:pe,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(V,{placeholder:be()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(G,{value:Q,children:ne()}),P.map(e=>(0,Y.jsx)(G,{value:e,children:e},e))]})]}),(0,Y.jsxs)(K,{value:i,onValueChange:ae,children:[(0,Y.jsx)(H,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(V,{placeholder:He()})}),(0,Y.jsxs)(U,{children:[(0,Y.jsx)(G,{value:At,children:ie()}),N.map(e=>(0,Y.jsx)(G,{value:e,children:e},e))]})]}),(0,Y.jsxs)(K,{value:String(n),onValueChange:e=>re(Number(e)),children:[(0,Y.jsx)(H,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(V,{})}),(0,Y.jsx)(U,{children:kt.map(e=>(0,Y.jsx)(G,{value:String(e),children:S({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:g,onChange:A}),x?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:ve(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ge(),(0,Y.jsx)(`code`,{children:$(x)})]}),(0,Y.jsx)($e,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ee()})]})}):null,(0,Y.jsx)(xt,{title:_e(),rows:Te,emptyHint:x?s():Ze(),columns:[{header:me(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:W(e.at)})},{header:oe(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(B,{variant:`secondary`,children:e.kind})},{header:te(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(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":y(),children:`✓`})}},{header:de(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(B,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ce(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(B,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:se(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(B,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Me(),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:a(),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 ${Lt(e.status)}`,children:e.status})},{header:Pe(),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:ue(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:p(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:_(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>T(e),children:he()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:w,onClose:()=>T(null)})]})]})}function Lt(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 Rt(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 zt({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)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(pt,{className:`max-w-lg`,children:[(0,Y.jsxs)(ut,{children:[(0,Y.jsxs)(ht,{className:`oc-traces__meta-title`,children:[Ye(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(B,{variant:`outline`,children:l()})]}),(0,Y.jsx)(_t,{children:A()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};