@lacneu/atrium 0.71.0 → 0.71.2

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 (74) hide show
  1. package/dist/assets/{AccessTab-UMUL3D9_.js → AccessTab-CDi-2yXo.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-BWRt6Typ.js → AdvancedFilter-oNVoBmr5.js} +1 -1
  3. package/dist/assets/AgentFilesTab-YQT3_OHb.js +3 -0
  4. package/dist/assets/{AnomaliesTab-Bg2jWSsL.js → AnomaliesTab-BRIph00P.js} +1 -1
  5. package/dist/assets/{AuditTab-479r2EBG.js → AuditTab-CDR9vWDW.js} +1 -1
  6. package/dist/assets/BridgeTab-DeYPFNVq.js +1 -0
  7. package/dist/assets/{ChatDefaultsTab-dxsM8U7W.js → ChatDefaultsTab-V66EFWzF.js} +1 -1
  8. package/dist/assets/{DataTableShell-BkZGrlHw.js → DataTableShell-BbVvH8AP.js} +1 -1
  9. package/dist/assets/{DetailChips-Cxppydov.js → DetailChips-CEPfBJ3C.js} +1 -1
  10. package/dist/assets/FeedbacksTab-ShRJwRig.js +1 -0
  11. package/dist/assets/{FieldLabel-DhQrYKvK.js → FieldLabel-YPTLow_x.js} +2 -2
  12. package/dist/assets/FilesTab-DMUdEQ-m.js +1 -0
  13. package/dist/assets/{FilterBar-D9hGs8jl.js → FilterBar-BQxNZSAj.js} +1 -1
  14. package/dist/assets/GroupsTab-O4TXB1Ob.js +1 -0
  15. package/dist/assets/InstancesTab-Ct4hI8bm.js +1 -0
  16. package/dist/assets/{IntegrationsTab-CkmVHPuZ.js → IntegrationsTab-Ba2AWn_y.js} +1 -1
  17. package/dist/assets/{KpiTab-CvBV-wJx.js → KpiTab-DDTX8X_Y.js} +1 -1
  18. package/dist/assets/PreferencesTab-CxFocwvh.js +1 -0
  19. package/dist/assets/{ProjectPage-CshF4uwy.js → ProjectPage-DXNQdzDR.js} +1 -1
  20. package/dist/assets/PromptInjectionsTab-CFe9KSPE.js +4 -0
  21. package/dist/assets/RolesTab-DWLOWJub.js +1 -0
  22. package/dist/assets/ScheduledTab-KxaffW0K.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-D2kskvcN.js +1 -0
  24. package/dist/assets/{SubAgentReportsTab-BfPtn3Pi.js → SubAgentReportsTab-Bu0h7qO-.js} +1 -1
  25. package/dist/assets/ThemeShowroom-Drc8NJ8v.js +1 -0
  26. package/dist/assets/{TimeRangePicker-C5oWQ1bV.js → TimeRangePicker-zbyQlb0G.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-B7uN-QtE.js → TimezoneCombobox-673xwoei.js} +1 -1
  28. package/dist/assets/{TracesTab-DX5Ukj6q.js → TracesTab-DKr7xXLx.js} +1 -1
  29. package/dist/assets/{UsersTab-C48pcSUL.js → UsersTab-CO_GLnNQ.js} +1 -1
  30. package/dist/assets/VoiceTab-i90LqIO5.js +1 -0
  31. package/dist/assets/api-BASu8PYC.js +44 -0
  32. package/dist/assets/{button-BfHR-QFa.js → button-_UzA03A_.js} +1 -1
  33. package/dist/assets/{card-BwaW6OwI.js → card-BoGX4FTX.js} +1 -1
  34. package/dist/assets/check-BVOFzT6U.js +1 -0
  35. package/dist/assets/chevron-up-BiXGHpx6.js +1 -0
  36. package/dist/assets/chevrons-up-down-DHCh-E-T.js +1 -0
  37. package/dist/assets/{compatView-CwwpnhPX.js → compatView-DscksmHU.js} +1 -1
  38. package/dist/assets/{dispatchErrorInfo-CCvKYpif.js → dispatchErrorInfo-Cevbg9ej.js} +1 -1
  39. package/dist/assets/{dist-Cx6m07oR.js → dist-Bn5IE_M3.js} +1 -1
  40. package/dist/assets/{dist-Crom-_jQ.js → dist-CtimXARj.js} +1 -1
  41. package/dist/assets/{dist-DRVwMsgp.js → dist-Df0myUvd.js} +1 -1
  42. package/dist/assets/{highlighted-body-OFNGDK62-BJm-kV50.js → highlighted-body-OFNGDK62-DYD_5B4x.js} +1 -1
  43. package/dist/assets/index-D02RwoOe.js +238 -0
  44. package/dist/assets/{index-wDJo5MTQ.css → index-SBwQs_kQ.css} +1 -1
  45. package/dist/assets/{list-15dfaZSm.js → list-Cfz6xpiH.js} +1 -1
  46. package/dist/assets/mermaid-GHXKKRXX-5UTQL7SN.js +1 -0
  47. package/dist/assets/{pdf-CSsqEHsB.js → pdf-DWIi2vJu.js} +1 -1
  48. package/dist/assets/roleDescriptions-s4fc4FW8.js +1 -0
  49. package/dist/assets/{table-D-GuJvnN.js → table-ChZTpaGw.js} +1 -1
  50. package/dist/assets/{tabs-BE-jtUDZ.js → tabs-DkJ2Ivbq.js} +1 -1
  51. package/dist/assets/x-C5QQoypN.js +1 -0
  52. package/dist/index.html +10 -10
  53. package/package.json +1 -1
  54. package/dist/assets/AgentFilesTab-CR4dAGYo.js +0 -3
  55. package/dist/assets/BridgeTab-CzwuBHcJ.js +0 -1
  56. package/dist/assets/FeedbacksTab-DxLZBUVQ.js +0 -1
  57. package/dist/assets/FilesTab-Ok13trrC.js +0 -1
  58. package/dist/assets/GroupsTab-D09Awaxx.js +0 -1
  59. package/dist/assets/InstancesTab-C8Dao1AT.js +0 -1
  60. package/dist/assets/PreferencesTab-CdcdmZMc.js +0 -1
  61. package/dist/assets/PromptInjectionsTab-Bq1gLlkn.js +0 -4
  62. package/dist/assets/RolesTab-CDk7My17.js +0 -1
  63. package/dist/assets/ScheduledTab-DFMuVqYC.js +0 -1
  64. package/dist/assets/ServiceAccountsTab-BdNyNnQx.js +0 -1
  65. package/dist/assets/ThemeShowroom-BsLmpgqu.js +0 -1
  66. package/dist/assets/VoiceTab-BCCTf5rI.js +0 -1
  67. package/dist/assets/api-BZGL-EQ1.js +0 -44
  68. package/dist/assets/check-DVHDMfix.js +0 -1
  69. package/dist/assets/chevron-up-DqJUIpVq.js +0 -1
  70. package/dist/assets/chevrons-up-down-m0rvjPTx.js +0 -1
  71. package/dist/assets/index-B8D00xNa.js +0 -238
  72. package/dist/assets/mermaid-GHXKKRXX-D6S_VQR4.js +0 -1
  73. package/dist/assets/roleDescriptions-lmkJgty3.js +0 -1
  74. package/dist/assets/x-DU13TyPG.js +0 -1
@@ -0,0 +1 @@
1
+ import{CC as e,SC as t,TC as n,wC as r,xC as i}from"./api-BASu8PYC.js";var a={pending:n,user:r,admin:e,observer:t,agent:i};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-BZGL-EQ1.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{r as n}from"./api-BASu8PYC.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{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-BZGL-EQ1.js";import{t as d}from"./dist-Cx6m07oR.js";import{Gt as f,Kt as p,qt as m}from"./index-B8D00xNa.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),d=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=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:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-BASu8PYC.js";import{t as d}from"./dist-Bn5IE_M3.js";import{Gt as f,Kt as p,qt as m}from"./index-D02RwoOe.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),d=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=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:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./api-BASu8PYC.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
@@ -62,17 +62,17 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-B8D00xNa.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-D02RwoOe.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/api-BZGL-EQ1.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-Crom-_jQ.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-Cx6m07oR.js">
70
- <link rel="modulepreload" crossorigin href="/assets/dist-DRVwMsgp.js">
71
- <link rel="modulepreload" crossorigin href="/assets/check-DVHDMfix.js">
72
- <link rel="modulepreload" crossorigin href="/assets/chevron-up-DqJUIpVq.js">
73
- <link rel="modulepreload" crossorigin href="/assets/x-DU13TyPG.js">
74
- <link rel="modulepreload" crossorigin href="/assets/button-BfHR-QFa.js">
75
- <link rel="stylesheet" crossorigin href="/assets/index-wDJo5MTQ.css">
67
+ <link rel="modulepreload" crossorigin href="/assets/api-BASu8PYC.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-CtimXARj.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-Bn5IE_M3.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/dist-Df0myUvd.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/check-BVOFzT6U.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/chevron-up-BiXGHpx6.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/x-C5QQoypN.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/button-_UzA03A_.js">
75
+ <link rel="stylesheet" crossorigin href="/assets/index-SBwQs_kQ.css">
76
76
  </head>
77
77
  <body>
78
78
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.71.0",
3
+ "version": "0.71.2",
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,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aa as r,Au as i,Ca as a,Cd as o,Cu as s,Da as c,Du as l,Ea as u,Eu as d,Fu as f,GR as p,Gi as m,HA as h,HR as g,IR as _,Iu as v,Ji as y,Ki as b,Lu as x,Ma as S,Mu as C,Nu as w,O as T,Oa as E,Ou as ee,Pu as te,RR as ne,Ru as D,Sa as O,Su as k,Ta as A,Td as j,Tu as re,WR as M,Wi as N,Xi as P,Yi as F,_a as I,_u as L,ba as R,bu as z,du as ie,fa as B,fu as V,ga as H,gu as U,ha as ae,hu as oe,ja as W,ju as se,ka as ce,ku as le,ma as G,mu as ue,pa as de,pu as fe,qi as pe,t as K,uu as me,va as he,vu as ge,wa as _e,wu as ve,xa as ye,xu as be,ya as xe,yu as Se,zu as Ce}from"./api-BZGL-EQ1.js";import{t as q}from"./button-BfHR-QFa.js";import{$ as we,B as Te,Ct as Ee,Dt as J,Et as De,Q as Oe,St as ke,Tt as Ae,X as je,Z as Me,at as Ne,bt as Pe,et as Fe,nt as Ie,ot as Le,q as Re,rn as Y,rt as ze,tt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-B8D00xNa.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CwwpnhPX.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
2
- `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=p(K.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=p(K.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[t,r,a]);let u=p(K.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=p(K.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),m=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,u,r,d]),[h,y]=(0,X.useState)(null);(0,X.useEffect)(()=>{!m||m.length===0||(!h||!m.some(e=>$(e)===h))&&y($(m[0]))},[m,h]);let b=m?.find(e=>$(e)===h)??null,S=g(K.agentFiles.listAgentFiles),[O,k]=(0,X.useState)({status:`idle`}),A=b?.instanceName??null,j=b?.agentId??null,re=p(K.compat.forInstance,n&&A!==null?{instanceName:A}:`skip`),M=n&&A!==null?Te(re,`agentFiles`):null,N=M===null?!1:M===`loading`?null:M.blocked,P=(0,X.useCallback)(async()=>{if(!(A===null||j===null)){k({status:`loading`});try{k({status:`done`,files:(await S({instanceName:A,agentId:j})).files})}catch(e){k({status:`error`,dashboardAbsent:tt(e)})}}},[S,A,j]);(0,X.useEffect)(()=>{N===!1&&P()},[P,N]);let[F,I]=(0,X.useState)(null),L=p(K.agentFileCuration.listCurations,t&&A!==null&&j!==null?{instanceName:A,agentId:j}:`skip`),R=p(K.agentFileCuration.curationSettings,t&&A!==null?{instanceName:A}:`skip`),z=g(K.agentFileCuration.requestCuration),[ie,B]=(0,X.useState)(null),[V,H]=(0,X.useState)(null),{toast:U}=J(),ae=(0,X.useMemo)(()=>{let e=new Map;for(let t of L??[])e.has(t.name)||e.set(t.name,t);return e},[L]),oe=(0,X.useCallback)(async e=>{if(!(A===null||j===null)){B(e);try{let t=await z({instanceName:A,agentId:j,name:e,trigger:`manual`});t.ok?U({title:ce(),variant:`success`}):U({title:E({reason:t.reason??`unknown`}),variant:`error`})}catch{U({title:c(),variant:`error`})}finally{B(null)}}},[z,A,j,U]),W=ne(),G=(0,X.useMemo)(()=>new Intl.NumberFormat(W,{maximumFractionDigits:0}),[W]);return e===void 0||m===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(je,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:(r??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,m.length>0?(0,Q.jsxs)(je,{value:h??``,onValueChange:e=>y(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":x(),children:(0,Q.jsx)(Fe,{})}),(0,Q.jsx)(Me,{children:m.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}),b===null?null:M===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):M!==null&&M.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(M.gatewayVersion,M.provider)]}):O.status===`loading`||O.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):O.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O.dashboardAbsent?T():te(),` `,!O.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void P(),children:o()})]}):O.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:O.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(De,{variant:`outline`,children:w()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:C({size:Z(e.size,W)})}),(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:se({pct:G.format(n)})}),r?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":i()}):(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:()=>I(e),children:t?ee():l()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:R?.budgetChars??null,enabled:R?.enabled??!1,curation:ae.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void oe(e.name),onReview:e=>H(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:le({used:Z(Qe(O.files),W),total:Z(Ye,W),pct:G.format(Ze(Qe(O.files)))})})]}),F&&b?(0,Q.jsx)(at,{instanceName:b.instanceName,agentId:b.agentId,name:F.name,isAdmin:t,onClose:()=>I(null),onSaved:()=>void P()}):null,V?(0,Q.jsx)(ot,{curationId:V,onClose:()=>H(null),onApplied:()=>{H(null),P()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:i,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:W()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(De,{variant:`outline`,className:`oc-afiles__curate-status`,children:r()}):e&&i&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:S()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=g(K.agentFiles.getAgentFile),l=g(K.agentFiles.setAgentFile),u=J(),[f,p]=(0,X.useState)(null),[m,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),[T,E]=(0,X.useState)(!1),[ee,te]=(0,X.useState)(!1),D=(0,X.useCallback)(async r=>{v(!1);try{let i=await c({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||b(i.content),E(!1)}catch{v(!0)}},[c,e,t,n]);(0,X.useEffect)(()=>{D(!1)},[D]);async function O(){if(f!==null){w(!0),te(!1);try{await l({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:f.updatedAtMs??void 0}),u.success(z({name:n})),a(),await D(!1)}catch(e){nt(e)?E(!0):te(!0)}finally{w(!1)}}}let A=f!==null&&y!==f.content,M=(0,X.useMemo)(()=>f===null?null:et(f.content,y),[f,y]),N=y.length>Je,P=ne(),F=(0,X.useMemo)(()=>new Intl.NumberFormat(P),[P]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:d({name:n})}),(0,Q.jsxs)(ze,{children:[re({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ve()]})]})]}),m?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ge(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:o()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!r,spellCheck:!1,onChange:e=>b(e.target.value),"aria-label":d({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:s()}),T?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[L(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:U()})]}):null,ee?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:Se()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${N?` is-over`:``}`,children:k({count:F.format(y.length),max:F.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!A||C||T,onClick:()=>S(!0),children:C?j():be()}):null]})]}),(0,Q.jsx)(Ve,{open:x,onOpenChange:S,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(Ae,{children:oe({name:n})}),(0,Q.jsx)(ke,{children:ue({agent:t})})]}),M?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:fe({added:M.added,removed:M.removed})}),M.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:V()}),M.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,M.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ie()}),M.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(Pe,{children:h()}),(0,Q.jsx)(We,{onClick:()=>void O(),children:me()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=p(K.agentFileCuration.getProposal,{curationId:e}),i=g(K.agentFileCuration.approveCuration),o=M(K.agentFileCuration.rejectCuration),{toast:s}=J(),[l,d]=(0,X.useState)(null),[f,h]=(0,X.useState)(!1),[v,x]=(0,X.useState)(``),S=ne(),C=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function w(){d(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:u(),variant:`success`}),n()):s({title:t.reason===`conflict`?_e():a({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:c(),variant:`error`})}finally{d(null)}}async function T(n){d(`reject`);try{let r=v.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?m():A(),variant:`success`}):s({title:R(),variant:`error`}),t()}catch{s({title:c(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Le,{children:r?O({name:r.name}):_()}),(0,Q.jsx)(ze,{children:ye()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[xe({before:Z(r.beforeSize,S),after:Z(r.proposedSize,S)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,he()]}):null]}),C?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:I({added:C.added,removed:C.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:N({feedback:r.feedback})}):null,C&&C.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:B()}),(0,Q.jsx)(`ul`,{children:C.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:de()}),(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:H()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),f?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:P()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:F(),value:v,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:y()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void T(!1),disabled:l!==null,children:l===`reject`?j():pe()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void T(!0),disabled:l!==null,children:l===`reject`?j():b()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:ae()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void w(),disabled:l!==null||r==null,children:l===`approve`?j():G()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,$v as i,Ay as a,Bv as o,Cy as s,D as c,Dy as l,Ey as u,Fy as d,GR as f,Gl as p,Gv as m,HR as ee,Hl as h,Hv as g,Jl as _,Jv as v,Kl as y,Kv as b,Ll as x,Lv as S,My as te,Ny as ne,Oy as re,Py as ie,Ql as ae,Qv as oe,Rv as se,Sy as ce,Ty as le,Ul as ue,Uv as de,Vl as fe,Vv as pe,WR as me,Wl as he,Wv as ge,Xl as _e,Xv as ve,Yl as ye,Yv as be,Zl as xe,Zv as C,_b as Se,_y as Ce,ay as we,by as Te,cb as Ee,cy as De,db as Oe,dr as ke,dy as Ae,ey as je,fb as Me,fr as Ne,fy as w,gb as Pe,gr as Fe,gy as Ie,hy as Le,ib as Re,iy as ze,jy as Be,k as Ve,ky as He,lb as Ue,lr as We,ly as Ge,mb as Ke,my as qe,ny as Je,oy as Ye,pb as Xe,pr as Ze,py as Qe,ql as $e,qv as et,rb as tt,ry as nt,sb as rt,sy as it,t as T,ty as at,ub as ot,ur as st,uy as ct,vy as lt,wy as ut,xy as dt,yy as ft,zv as pt}from"./api-BZGL-EQ1.js";import{r as E}from"./dist-Cx6m07oR.js";import{t as mt}from"./chevron-up-DqJUIpVq.js";import{t as ht}from"./chevrons-up-down-m0rvjPTx.js";import{i as gt,n as D,o as _t,r as vt,s as yt}from"./FieldLabel-DhQrYKvK.js";import{i as bt,n as xt,r as St,t as Ct}from"./tabs-BE-jtUDZ.js";import{t as wt}from"./button-BfHR-QFa.js";import{$ as O,An as Tt,Bt as Et,Dt,Et as k,F as Ot,Fn as kt,Pn as A,Q as j,Rt as At,X as M,Z as N,at as jt,bn as Mt,ct as Nt,et as P,jn as Pt,jt as F,lt as I,nt as Ft,on as It,ot as Lt,q as Rt,rn as L,rt as zt,tt as Bt,ut as Vt,zt as Ht}from"./index-B8D00xNa.js";import{r as Ut}from"./locales-CPjguROj.js";import{a as Wt,i as R,n as Gt,o as z,r as B,t as V}from"./table-D-GuJvnN.js";import{t as Kt}from"./FilterBar-D9hGs8jl.js";import{a as H,n as qt,o as U,r as Jt,s as Yt,t as Xt}from"./compatView-CwwpnhPX.js";import{t as W}from"./dispatchErrorInfo-CCvKYpif.js";var Zt=c(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Qt=c(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function $t(e){return e.filter(e=>e.state===`error`)}function en(e){return e.reachable&&$t(e.targets).length===0}function tn(e){return en(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function nn(e){return e.state===`error`&&e.lastErrorCode!==null}function rn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function an(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function on(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return an(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Y={q:``,state:J,instance:J,version:J},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return U(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function pn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>U(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(Y),[i,a]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),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]),c=(0,G.useMemo)(()=>fn(s),[s]),l=(0,G.useMemo)(()=>pn(s),[s]),u=(0,G.useMemo)(()=>mn(s),[s]),d=(0,G.useMemo)(()=>dn(cn(s,n),i),[s,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,Q.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Kt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:oe(),onReset:()=>r(Y),canReset:sn(n),children:[(0,Q.jsxs)(M,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:ve()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:J,children:C()}),c.map(e=>(0,Q.jsx)(j,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(M,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:be()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:J,children:C()}),l.map(e=>(0,Q.jsx)(j,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(M,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:v()})}),(0,Q.jsxs)(N,{children:[(0,Q.jsx)(j,{value:J,children:C()}),u.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):(0,Q.jsxs)(V,{className:`oc-conn__table`,children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)($,{label:b(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:m(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:ge(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:de(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:g(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(R,{children:pe()}),(0,Q.jsx)($,{label:o(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Gt,{children:d.map(e=>(0,Q.jsx)(gn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(mt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ht,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=nn(e)?W(e.lastErrorCode):null,n=rn(e)?W(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(B,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(vn,{state:e.state})}),(0,Q.jsx)(B,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(B,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(B,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:je({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(B,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:I(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${I(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[i({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${I(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?pt():e===`error`?se():S()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(k,{variant:`secondary`,children:pt()}):e===`error`?(0,Q.jsx)(k,{variant:`destructive`,children:se()}):(0,Q.jsx)(k,{variant:`outline`,children:S()})}function yn(){return f(T.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=f(T.compat.getBridgeCompat,{}),n=f(T.me.getMe,{host:Rt})?.role===`admin`,r=f(T.admin.listInstances,n?{}:`skip`),i=f(T.agents.usageForInstances,n?{}:`skip`),a=A(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=on(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=kt({from:`/settings/bridge`}),l=A({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,p=u!==null&&qt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:dt()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Te()}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(Wt,{children:(0,Q.jsxs)(z,{children:[(0,Q.jsx)(R,{children:Ze()}),(0,Q.jsx)(R,{children:Ne()}),(0,Q.jsx)(R,{children:ke()}),(0,Q.jsx)(R,{children:st()}),(0,Q.jsx)(R,{children:We()})]})}),(0,Q.jsx)(Gt,{children:i.flatMap(e=>{let t=Ot(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(z,{children:[(0,Q.jsx)(B,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(B,{children:t.provider}),(0,Q.jsx)(B,{children:t.label}),(0,Q.jsx)(B,{children:(0,Q.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(B,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Ct,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(St,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(It,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(xt,{value:e.key,children:(0,Q.jsx)(Sn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):null]})}function xn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:xe(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,_e({build:t.buildVersion??`?`})]}):null,` · `,ye(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?_():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ae()});let o=$t(e.targets),s=!e.reachable,c=tn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=Nt(e.checkedAt),f=e.startedAt==null?null:Nt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(Tt,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Qt,{size:22}):(0,Q.jsx)(L,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?ct():c===`gateways_unreachable`?Ye({count:l.length}):s?Ge():De({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Zt,{size:12,"aria-hidden":!0}),` `,it({time:d})]}),f?(0,Q.jsx)(`span`,{children:ze({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:we({names:l.join(`, `)})}):null,s?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:nt()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:i,compatStatus:a,compatReachable:o,protocol:s}){let c=i?Yt(i,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Xt(t,e,i)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,ee]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(It,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),p?(0,Q.jsx)(k,{variant:p===`beyond`?`destructive`:`secondary`,children:Jt(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:r()}),(0,Q.jsx)(wn,{providerName:q(e),support:c,compatStatus:a,compatReachable:o,manifest:i,instanceRows:u}),s?(0,Q.jsx)(Cn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>ee(e=>!e),children:[m?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),Je({count:t.length})]}),m?(0,Q.jsx)(hn,{connections:t,displayByInstance:l}):null]})}function Cn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[ft(),i.length>0?(0,Q.jsx)(k,{variant:`destructive`,children:Ce({count:i.length})}):a>0?(0,Q.jsx)(k,{variant:`destructive`,children:Ie()}):(0,Q.jsx)(k,{variant:`secondary`,children:lt()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Le({version:e.vendoredVersion}),r?` · `+qe({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ve({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(E,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Pt,{size:13,"aria-hidden":!0}),Qe({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function wn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Fe({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:p({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:_()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:H(e.version)}),(0,Q.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Jt(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Bt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Ft,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(jt,{children:[(0,Q.jsx)(Lt,{children:Se({instance:e.displayName??e.name})}),(0,Q.jsx)(zt,{children:Pe()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Tt,{"aria-hidden":!0}):(0,Q.jsx)(L,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?le():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ut()]}):null}function Dn({instance:e,onClose:t}){let n=me(T.admin.upsertInstanceConfig),r=ee(T.bridge.validateMediaPaths),i=Dt(),o=Ut(e.config?.contentLocale,void 0),[c,f]=(0,G.useState)(()=>gt(e.config??{},o)),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(!1),[_,v]=(0,G.useState)(null),y=c.inboundMediaMode===`shared-fs`,b=c.mediaMode===`shared-fs`,x=y||b;async function S(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){i.error(He(),e)}finally{g(!1)}}async function ae(){m(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(c,r,o)}),t()}catch(e){i.error(Ue(),e)}finally{m(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Ke(),help:Ee()}),(0,Q.jsxs)(M,{value:c.mediaMode,onValueChange:e=>f({...c,mediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:yt.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Xe(),help:rt()}),(0,Q.jsxs)(M,{value:c.inboundMediaMode,onValueChange:e=>f({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(N,{children:_t.map(e=>(0,Q.jsx)(j,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:Me(),help:Re()}),(0,Q.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>f({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:d(),help:ie()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>f({...c,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(D,{label:ne(),help:te()}),(0,Q.jsx)(F,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>f({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Vt,{checked:c.rehydration,onCheckedChange:e=>f({...c,rehydration:e===!0})}),(0,Q.jsx)(D,{label:Oe(),help:tt()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),ce({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:l(),result:_.inbound}),(0,Q.jsx)(En,{label:u(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(L,{"aria-hidden":!0}),s()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(wt,{variant:`outline`,size:`sm`,onClick:()=>void S(),disabled:h,children:[h?(0,Q.jsx)(Mt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?a():Be()]}),(0,Q.jsx)(wt,{size:`sm`,onClick:()=>void ae(),disabled:p,children:ot()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Et,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?he():ue({count:e.length}),(0,Q.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ht,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:h()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AD as i,BE as a,CD as o,DD as s,ED as c,FD as l,FE as u,GE as d,GR as f,HE as p,ID as m,IE as h,Ia as g,JE as _,KE as ee,LE as te,MD as ne,ND as re,OD as ie,PD as ae,PE as v,QE as y,RE as b,Ra as x,SD as S,TD as C,UE as w,VE as T,WE as E,WR as D,XE as O,YE as k,ZE as A,_D as j,aD as M,bD as N,cD as P,dD as F,eD as I,fD as L,gD as R,hD as z,iD as B,jD as V,kD as oe,lD as H,mD as U,nD as W,oD as G,pD as K,qE as q,rD as se,sD as ce,t as J,tD as le,uD as ue,vD as de,wD as fe,xD as pe,yD as me,zE as he}from"./api-BZGL-EQ1.js";import{t as ge}from"./button-BfHR-QFa.js";import{U as _e,ct as Y}from"./index-B8D00xNa.js";import{t as ve}from"./DataTableShell-BkZGrlHw.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>m(),incorrect:()=>l(),incoherence:()=>ae(),formatting:()=>re(),latency:()=>ne(),api_error:()=>V(),other:()=>i()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ie()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:s()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:oe()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=D(J.feedback.respondToFeedback),[s,l]=(0,X.useState)(e.thread),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1);async function m(){let t=u.trim();if(!(!t||f)){p(!0);try{await i({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!1)}}}let h=[];try{h=r.contextJson?JSON.parse(r.contextJson):[]}catch{h=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${c()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:I(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.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`?o():e.authorRole===`agent`?e.authorLabel??x():S()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:pe()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:N(),value:u,maxLength:2e3,rows:3,onChange:e=>d(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void m(),disabled:!u.trim()||f,children:f?me():de()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||R()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||R()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,h.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:r.contextCount??h.length,truncated:r.contextTruncated?L():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:h.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?P({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ce(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,G()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=f(J.feedback.listForAdmin,{}),t=D(J.feedback.readSnapshot),n=D(J.feedback.deleteFeedback),i=_e(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function m(e){await i({title:h(),description:u(),confirmLabel:v(),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:[M(),` `,(0,Z.jsx)(`strong`,{children:B()}),` `,se()]}),(0,Z.jsx)(ve,{title:W(),rows:e,emptyHint:le(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:r(),cell:e=>Y(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:A(),cell:e=>e.messageRole===`user`?O():k(),sort:e=>e.messageRole},{header:_(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${q({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ee(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:E(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:w()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:p()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:g()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:T()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?he():b(),onSelect:()=>void l(e)},{label:te(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AL as i,BL as a,CL as ee,DL as te,EL as o,FL as s,GL as c,GR as ne,HA as re,HL as l,Ha as u,IL as d,IR as f,JL as p,KL as m,LL as ie,ML as ae,NL as oe,OL as se,PL as ce,QL as le,RL as ue,RR as de,SL as fe,TL as pe,UL as h,VL as g,Va as me,WL as _,WR as he,XL as ge,YL as _e,ZL as ve,eR as v,jL as ye,kL as be,nR as y,qL as b,rR as x,t as S,tR as C,wL as w,zL as T}from"./api-BZGL-EQ1.js";import{t as E}from"./button-BfHR-QFa.js";import{$ as D,Ct as O,Dn as k,Dt as A,En as j,Et as M,Lt as N,Mt as xe,Nt as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,cn as Ee,et as R,in as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-B8D00xNa.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-D-GuJvnN.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return m();case`audio`:return c();case`video`:return _();case`pdf`:return h();case`document`:return l();case`archive`:return g();default:return a()}}function K(){let[e,t]=(0,H.useState)(W),[n,a]=(0,H.useState)(W),[c,l]=(0,H.useState)(W),[m,h]=(0,H.useState)(W),[g,_]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=he(S.files.softDelete),Y=A();function Ie(){t(W),a(W),l(W),h(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(be())}catch(e){Y.error(se(),e)}}let X=ne(S.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:c===W?void 0:c,category:m===W?void 0:m,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(de(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:f()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||c!==W||m!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":y(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:C()}),(0,U.jsx)(F,{value:`inbound`,children:v()}),(0,U.jsx)(F,{value:`outbound`,children:r()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:a,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":le(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ve()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:c,onValueChange:l,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:_e()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:m,onValueChange:h,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":p(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:b()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:g,onCheckedChange:e=>_(e===!0),"aria-label":u()}),(0,U.jsx)(`span`,{children:u()})]}),$?(0,U.jsxs)(E,{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}),ae()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ee():w()}):(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:T()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{children:d()}),(0,U.jsx)(z,{children:s()}),(0,U.jsx)(z,{className:`text-right`,children:ce()})]})}),(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)(M,{variant:`outline`,style:{marginLeft:6},children:me()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(M,{variant:`secondary`,children:e.direction===`inbound`?v():r()})}),(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)(xe,{children:[(0,U.jsx)(N,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":ye(),children:(0,U.jsx)(j,{size:16})})}),(0,U.jsxs)(Se,{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)(k,{size:14}),oe()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),pe()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(De,{size:14}),i()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:fe({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:te()}),(0,U.jsx)(Ce,{children:o()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:re()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:i()})]})]})})]})}export{K as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Af as i,Bd as a,Bf as o,Cf as s,D as c,Df as l,Ef as u,Ff as d,GR as f,Gd as p,Gf as m,Hd as h,Hf as g,If as _,Jd as v,Kd as y,Kf as b,Ld as x,Lf as S,Mf as ee,Nf as C,Of as te,Pf as ne,Qd as w,Rd as T,Rf as E,Sf as D,Tf as re,Ud as O,Uf as ie,Vd as k,Vf as A,WR as j,Wd as M,Wf as ae,Xd as N,Yd as P,Zd as F,_f as I,af as oe,bf as se,cf as L,df as R,ef as z,ff as ce,gf as le,hf as ue,if as de,jf as fe,kf as pe,lf as me,mf as he,nf as ge,of as _e,pf as ve,qd as ye,rf as be,sf as xe,t as B,tf as Se,uf as Ce,vf as we,wf as Te,xf as Ee,yf as De,zd as Oe,zf as ke}from"./api-BZGL-EQ1.js";import{t as Ae}from"./x-DU13TyPG.js";import{i as V,n as H,r as je,t as Me}from"./tabs-BE-jtUDZ.js";import{t as U}from"./button-BfHR-QFa.js";import{$ as Ne,Dt as W,Et as G,Mn as Pe,Q as Fe,U as Ie,X as Le,Z as Re,_ as ze,an as K,at as Be,et as Ve,jn as He,jt as q,nt as Ue,on as J,ot as We,q as Ge,rt as Ke,tt as qe,ut as Y}from"./index-B8D00xNa.js";import{t as Je}from"./FilterBar-D9hGs8jl.js";import{t as Ye}from"./DataTableShell-BkZGrlHw.js";import{t as X}from"./DetailChips-Cxppydov.js";var 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 ve();case`user`:return ce();case`pending`:return R();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=f(B.groups.listGroups,{}),t=f(B.me.getMe,{host:Ge})?.role===`admin`,n=j(B.groups.createGroup),r=j(B.groups.updateGroup),s=j(B.groups.deleteGroup),c=Ie(),p=W(),[h,v]=(0,Q.useState)(!1),[y,x]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(it),[D,O]=(0,Q.useState)(null),[k,M]=(0,Q.useState)(``),N=(0,Q.useMemo)(()=>{if(!e)return e;let t=k.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,k]);function P(){x(null),T(it),v(!0)}function F(e){x(e),T({name:e.name,description:e.description??``}),v(!0)}async function I(){try{y?await r({groupId:y._id,name:w.name,description:w.description}):await n({name:w.name,description:w.description||void 0}),T(it),x(null),v(!1)}catch(e){p.error(a(),e)}}async function oe(e){if(await c({title:l({name:e.name}),description:u(),confirmWord:e.name,confirmLabel:re(),cancelLabel:C(),destructive:!0}))try{await s({groupId:e._id})}catch(e){p.error(Oe(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,$.jsx)(Je,{q:k,onQChange:M,onReset:()=>M(``),canReset:k!==``,searchPlaceholder:E()}),(0,$.jsx)(Ye,{title:b(),rows:N,addLabel:ae(),onAdd:t?P:void 0,emptyHint:ie(),columns:[{header:g(),cell:e=>e.name,sort:e=>e.name},{header:A(),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:o(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ke(),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)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:S(),onSelect:()=>O({groupId:e._id,name:e.name})},...t?[{label:_(),onSelect:()=>F(e)},{label:d(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,$.jsx)(ze,{open:h,onOpenChange:v,title:y?fe():ee(),description:i(),canSubmit:!!w.name.trim(),onSubmit:I,submitLabel:ne(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,$.jsx)(q,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,$.jsx)(q,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:D?.groupId??null,groupName:D?.name??``,open:D!==null,onOpenChange:e=>{e||O(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)(Pe,{size:14,"aria-hidden":!0}),le()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":he({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=f(B.groups.getGroup,n&&e?{groupId:e}:`skip`),o=f(B.groups.listAssignableInstances,n?{}:`skip`),c=f(B.groups.listAssignableUsers,n?{}:`skip`),l=j(B.groups.addMember),u=j(B.groups.removeMember),d=j(B.groups.bulkSetMembers),m=j(B.groups.setGroupManager),g=W(),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(`members`),[ee,C]=(0,Q.useState)(1),[te,ne]=(0,Q.useState)(new Set),w=(0,Q.useRef)(null),E=(0,Q.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),re=(0,Q.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ie=a?.viewerIsAdmin===!0,k=(0,Q.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Q.useEffect)(()=>{v(``),b(``),S(`members`),C(1),w.current=null},[n,e]),(0,Q.useEffect)(()=>{C(1)},[_]),(0,Q.useEffect)(()=>{n&&a&&e&&w.current!==e&&(w.current=e,ne(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let A=(0,Q.useMemo)(()=>c?Qe(c,_,te):[],[c,_,te]);async function ae(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){g.error(T(),e)}}async function N(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){g.error(h(),e)}}let P=nt(A,e=>E.has(e.userId)),F=A.filter(e=>E.has(e.userId)).length,R=rt(A,ee,ot);async function z(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){g.error(T(),e)}}return(0,$.jsx)(qe,{open:n,onOpenChange:i,children:(0,$.jsxs)(Ue,{className:`oc-access`,children:[(0,$.jsxs)(Be,{children:[(0,$.jsx)(We,{children:Te({name:t})}),(0,$.jsx)(Ke,{children:s()})]}),(0,$.jsxs)(Me,{value:x,onValueChange:S,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}),D(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),se(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),r(),a?(0,$.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:c===void 0||a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:_,onChange:e=>v(e.target.value),placeholder:Ee(),className:`oc-access__search`}),A.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,$.jsxs)($.Fragment,{children:[A.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void z(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,$.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,A.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=E.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":Ce({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)(G,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(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?O():M(),title:r?O():M(),onClick:()=>void N(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":p(),title:p(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:C})]})]})}),(0,$.jsx)(H,{value:`agents`,children:o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:y,onChange:e=>b(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:k,query:y},`${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=f(B.groups.listAssignableAgents,{instanceName:t}),o=j(B.groups.assignAgentToGroup),s=j(B.groups.removeAgentFromGroup),c=j(B.groups.bulkSetGroupAgents),l=W(),[u,d]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{d(1)},[i]),!e)return null;let p=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(p,u,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(x(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(x(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ge()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):p.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?be():de()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":I()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":me({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":z(),title:z(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Se()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=f(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=j(B.charts.assignChartToGroup),r=j(B.charts.removeChartFromGroup),i=j(B.charts.setGroupDefaultChart),a=j(B.charts.addChartToGroupPool),o=j(B.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:w()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(k(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":v({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":ye(),title:ye(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:y()}):null,u?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ve,{placeholder:N()})}),(0,$.jsx)(Re,{children:l.map(e=>(0,$.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):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{$T as r,$w as i,AT as a,Aw as o,BT as s,CT as c,Cw as l,DT as u,Dw as d,ET as f,Ew as p,FT as m,Fw as h,GR as g,GT as _,Gw as v,HR as y,HT as b,Hw as x,IT as S,Iw as C,JT as w,Jo as T,Jw as E,KT as ee,Kw as te,LT as ne,Lw as re,MT as ie,Mw as ae,NT as oe,Nw as se,OT as ce,Ow as le,PT as ue,Pw as de,QT as fe,Qw as pe,RT as me,Rw as he,ST as ge,Sw as _e,TT as ve,Tw as ye,UT as be,Uj as xe,Uw as Se,VT as Ce,Vw as D,WR as O,WT as we,Wj as k,Ww as A,XT as Te,Xo as Ee,Xw as De,YT as Oe,Yo as ke,Yw as Ae,ZT as je,Zw as Me,_T as Ne,_w as Pe,aE as Fe,aT as Ie,ab as Le,bT as Re,br as ze,bw as Be,cT as Ve,dT as He,eE as Ue,eT as We,fT as j,gT as M,hT as Ge,iE as Ke,iT as qe,jT as Je,jw as Ye,kT as Xe,kw as Ze,lT as Qe,mT as $e,nE as et,nT as tt,oE as nt,oT as rt,ob as it,pT as at,qT as ot,qo as st,qw as ct,rE as lt,rT as ut,sT as dt,t as N,tE as ft,tT as pt,uT as mt,vT as ht,vr as gt,vw as _t,wT as vt,ww as yt,xT as bt,xw as xt,yT as St,yr as Ct,yw as wt,zT as Tt,zw as Et}from"./api-BZGL-EQ1.js";import{a as Dt,c as Ot}from"./FieldLabel-DhQrYKvK.js";import{t as P}from"./button-BfHR-QFa.js";import{$ as F,Bt as kt,Dt as I,Et as L,Q as R,Rt as At,U as jt,X as z,Z as B,_ as Mt,at as V,et as H,jt as U,nt as W,ot as G,rt as K,tt as q,ut as J,zt as Nt}from"./index-B8D00xNa.js";import{t as Pt}from"./DataTableShell-BkZGrlHw.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-CzwuBHcJ.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Dt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=g(N.admin.listInstances,{}),t=g(N.agents.listAllInstanceAgents,{}),n=O(N.admin.upsertInstance),i=O(N.admin.deleteInstance),o=I(),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[h,v]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[C,T]=(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,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),T(null),l(!1)}catch(e){o.error(Ke(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[lt(),(0,Z.jsx)(`strong`,{children:et()}),ft()]}),(0,Z.jsx)(Pt,{title:Ue(),rows:e,addLabel:r(),onAdd:()=>{T(null),d(Q),l(!0)},emptyHint:fe(),columns:[{header:je(),cell:e=>e.name,sort:e=>e.name},{header:Te(),cell:e=>(0,Z.jsx)(L,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Oe(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:w(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:nt(),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)(L,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?_t():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:we(),onSelect:()=>{T(e._id),d(Bt(e)),l(!0)}},{label:Fe(),onSelect:()=>p(e.name)},{label:Xe(),onSelect:()=>x(e)},{label:ot(),onSelect:()=>v(e)},{label:ee(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:ee(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Mt,{open:c,onOpenChange:l,title:C?be():_(),description:Ce(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:s(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Tt(),children:[(0,Z.jsx)(U,{value:u.name,disabled:C!==null,onChange:e=>d({...u,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b()}):null]}),(0,Z.jsx)($,{label:me(),children:(0,Z.jsxs)(z,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:ze(),children:(0,Z.jsxs)(z,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`ws`,children:Ct()}),(0,Z.jsx)(R,{value:`rest`,children:gt()})]})]})}):null,(0,Z.jsx)($,{label:ne(),children:(0,Z.jsx)(U,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:S(),children:(0,Z.jsx)(U,{value:u.bridgeUrl,placeholder:m(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ue(),children:(0,Z.jsx)(U,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:it(),children:[(0,Z.jsxs)(z,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(B,{children:Ot.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Le()})]}),(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(U,{value:u.gatewayVersion,placeholder:ie(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Je(),children:(0,Z.jsx)(U,{value:u.gatewayHttpUrl,placeholder:a(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>v(null)},h._id):null,y?(0,Z.jsx)(Ht,{instance:y,onClose:()=>x(null)},y._id):null]})}function Ht({instance:e,onClose:t}){let n=g(N.instanceSecrets.listInstanceSecretStatus,{}),r=zt[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)(q,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:ce({instance:e.displayName??e.name})}),(0,Z.jsx)(K,{children:u()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=y(N.instanceSync.forceInstanceSync),n=I(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(dt());break;case`no_agents`:n.success(Ie());break;case`no_bridge_url`:n.error(qe());break;case`deploy_misconfigured`:n.error(ut());break;case`unauthorized`:n.error(pt());break;case`not_served`:n.error(We());break;default:n.error(tt());break}}catch(e){n.error(rt(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?Ve():Qe()})})]})}function Wt({instance:e}){let t=g(N.bridgeAuth.listBridgeAuthStatus,{}),n=y(N.bridgeAuth.mintBridgeSecret),r=O(N.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(te(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(ct())}catch(e){i.error(te(),e)}finally{o(!1)}}}async function _(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:pe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:p?`outline`:`secondary`,children:p?`${c()} · ${f.prefix}…${f.lastFour}`:ge()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?Ae():De()}),p?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:E()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:v()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?k():xe()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:A()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=y(N.instanceSecrets.setInstanceSecret),i=O(N.instanceSecrets.clearInstanceSecret),a=y(N.deviceIdentity.generateDeviceIdentity),o=I(),[s,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,b=t===`token`?f():t===`deviceIdentity`?ve():vt();async function x(){if(!(!s.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),l(``),m(null),g(!1),o.success(Ne())}catch(e){o.error(M(),e)}finally{d(!1)}}}async function S(){if(!u){d(!0);try{await i({instanceId:e,field:t}),m(null),g(!1),o.success(Ge())}catch(e){o.error(M(),e)}finally{d(!1)}}}async function C(){if(!u){d(!0);try{m(await a({instanceId:e})),g(!1),o.success(j())}catch(e){o.error(mt(),e)}finally{d(!1)}}}let w=p?`openclaw devices approve ${p.id}`:``;async function T(){if(w)try{await navigator.clipboard.writeText(w),g(!0)}catch{}}return(0,Z.jsxs)($,{label:b,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:_?`outline`:`secondary`,children:_?c():ge()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:_?Re():bt(),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 x(),disabled:u||s.trim().length===0,children:St()}),v?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void C(),disabled:u,children:$e()}):null,_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void S(),disabled:u,children:ht()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:j()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:He()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:w}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:h?k():xe()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:A()})]}):null]})}var Kt={conversational:se,documentary:Ye,summarizer:Ee,curator:T},qt={conversational:ae,documentary:o,summarizer:ke,curator:st},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:re()}),t.map(e=>(0,Z.jsx)(L,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(At,{children:[(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:C()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:h()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:de()}),(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)(J,{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:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=g(N.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=O(N.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=O(N.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=O(N.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=O(N.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(N.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(N.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=O(N.agents.removeInstanceAgent),u=jt(),f=I();async function m(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(D(),e)}}async function h(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(D(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){f.error(D(),e)}}async function v(t,n){if(e&&await u({title:d({name:n}),description:p(),confirmLabel:ye(),destructive:!0}))try{await c({instanceName:e,agentId:t}),f.success(yt())}catch(e){f.error(D(),e)}}return(0,Z.jsx)(q,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:Se({name:e??``})}),(0,Z.jsx)(K,{children:x()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?_e():r.discovery.lastPollOk?xt():Be({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:wt()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(J,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void m(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:Pe()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:le()})]}):i?(0,Z.jsx)(L,{variant:`default`,children:_t()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void h(t.agentId),children:Ze()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void _(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(D(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Et(),"aria-label":he(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}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{Vt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AN as r,BN as i,BT as a,CN as o,CR as s,Ct as c,DN as l,DR as u,EN as d,ER as ee,FN as f,GR as p,IN as m,IR as h,LN as g,Lt as _,MN as te,Mt as ne,NN as re,ON as ie,OR as ae,PN as oe,RN as se,Rt as ce,SN as le,SR as ue,St as de,TN as fe,TR as pe,VN as me,WR as v,_N as he,_R as ge,_t as y,aN as b,aR as x,bN as S,bR as C,bt as w,cN as T,cR as E,dN as D,dR as O,fN as k,fR as A,gN as j,gR as M,hN as N,hR as P,iN as F,jN as I,jR as L,kN as _e,lN as R,lR as ve,mN as ye,mR as be,nN as xe,oN as Se,oR as Ce,pN as we,pR as Te,r as z,rN as Ee,sN as De,sR as Oe,t as B,uN as ke,uR as Ae,vN as je,vR as Me,vt as Ne,wN as Pe,wR as Fe,wt as Ie,xN as Le,xR as Re,xt as ze,yN as Be,yR as Ve,yt as He,zN as Ue}from"./api-BZGL-EQ1.js";import{t as V}from"./button-BfHR-QFa.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-B8D00xNa.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-B7uN-QtE.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>me()},{id:`composer`,label:()=>i()},{id:`sidebar`,label:()=>Ue()},{id:`notifications`,label:()=>le()},{id:`other`,label:()=>se()}],X={showSource:{category:`messages`,label:()=>g(),help:()=>m()},showReport:{category:`messages`,label:()=>f(),help:()=>oe()},copyAssistant:{category:`messages`,label:()=>re()},copyUser:{category:`messages`,label:()=>te()},showDelete:{category:`messages`,label:()=>I()},showTools:{category:`messages`,label:()=>r(),help:()=>_e()},voiceInput:{category:`composer`,label:()=>ie(),help:()=>l()},showUsage:{category:`composer`,label:()=>d(),help:()=>fe()},autoReadAloud:{category:`composer`,label:()=>ce(),help:()=>_()},showChatAge:{category:`sidebar`,label:()=>Pe(),help:()=>o()},notifSound:{category:`notifications`,label:()=>Le(),help:()=>S()},notifSystem:{category:`notifications`,label:()=>Be(),help:()=>je()},replySound:{category:`notifications`,label:()=>he(),help:()=>j()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>Se()};function ut({prefKey:e,ui:t}){let n=v(B.admin.setUiPrefDefault),r=v(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ke()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:F()}),(0,J.jsx)(U,{value:`off`,children:Ee()}),(0,J.jsx)(U,{value:`inherit`,children:xe()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":R()}),R()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=v(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Ie(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?ze():r?de():c()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:y()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?Ne():e?He():w()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=p(B.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=v(B.me.setUiPref).withOptimisticUpdate(Je),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":D()}),D()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:T()}),(0,J.jsx)(`p`,{children:De()}),(0,J.jsx)(`p`,{children:b()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:N(),"aria-label":N(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ye()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:we()}):l?(0,J.jsx)(H,{variant:`secondary`,children:ne()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:k()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:h()})}var pt={sm:()=>M(),md:()=>P(),lg:()=>be(),xl:()=>Te(),"2xl":()=>A(),"3xl":()=>O()};function mt(){let e=p(B.me.getMe,{host:G}),t=v(B.me.setLocale),n=v(B.me.setTimezone),r=v(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:G});n&&e.setQuery(B.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=v(B.me.setMyName),o=Ke(),c=e?.locale??`default`,l=e?.name??``,[d,f]=(0,q.useState)(null),m=d??l,h=m.trim()!==l.trim();async function g(){try{await i({name:m}),f(null),o.success(Fe())}catch(e){o.error(s(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:m,maxLength:120,placeholder:ee(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),g())}}),(0,J.jsx)(V,{size:`sm`,disabled:!h,onClick:()=>void g(),children:a()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:L()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ae()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:E()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:x()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,$o as i,$y as a,By as o,Cr as s,GR as c,Gy as l,Hy as u,Jy as d,Ky as f,Ly as p,Qi as m,Qo as h,Qy as g,Ry as _,Sr as v,Uy as y,Vy as b,WR as x,Wy as S,Xy as ee,Yy as C,Zi as te,Zo as ne,Zy as re,ca as ie,da as ae,ea as oe,eb as se,es as ce,la as w,lb as T,nb as E,qy as D,t as O,ta as k,tb as A,ts as j,ua as M,ub as N,xr as P,zy as F}from"./api-BZGL-EQ1.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-DhQrYKvK.js";import{t as W}from"./button-BfHR-QFa.js";import{$ as G,Dt as le,Q as K,X as q,Z as J,et as Y,q as ue,ut as de}from"./index-B8D00xNa.js";import{r as X,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Z=t(e(),1),Q=n(),$={media_delivery:{label:re,help:ee},documentary_fetch:{label:C,help:d},inbound_files:{label:D,help:f},history_summary:{label:j,help:ce},file_curation:{label:ae,help:k},quote_reply:{label:M,help:w}},me={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`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},he={outboundDir:F,references:_,files:p,previous_summary:i,new_messages:h,max_chars:ne,file_name:oe,budget_chars:r,feedback:m,content:te,excerpt:ie};function ge(){let e=c(O.admin.listInstances,{}),[t,n]=(0,Z.useState)(null);if(e===void 0)return(0,Q.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Q.jsx)(`div`,{className:`oc-injtab`,children:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()})});let r=e.find(e=>e._id===t)??e[0];return(0,Q.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Q.jsx)(B,{label:E(),help:A()}),(0,Q.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Q.jsx)(`span`,{children:l()}),(0,Q.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Q.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(J,{children:e.map(e=>(0,Q.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Q.jsx)(_e,{instance:r},r._id)]})}function _e({instance:e}){let t=x(O.admin.upsertInstanceConfig),n=le(),r=c(O.me.getMe,{host:ue}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[o,l]=(0,Z.useState)(()=>R(i,a));(0,Z.useEffect)(()=>{l(R(i,a))},[a,e._id]);let[u,d]=(0,Z.useState)(!1),f=o.promptInjections,p=(e,t)=>l({...o,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){d(!0);try{await t({instanceId:e._id,config:V(o,i,a)})}catch(e){n.error(T(),e)}finally{d(!1)}}async function h(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(T(),e)}}let g=e.config?.contentLocale??`default`,_=fe[X(void 0,r?.defaultLocale??void 0)];return(0,Q.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,Q.jsx)(`span`,{children:s()}),(0,Q.jsxs)(q,{value:g,onValueChange:e=>void h(e),children:[(0,Q.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(K,{value:`default`,children:P({locale:_})}),pe().map(e=>(0,Q.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}),U.map(e=>(0,Q.jsx)(ve,{injKey:e,def:z[e],i18n:$[e],row:f[e]??{enabled:!0,template:z[e].defaultTemplate[a]},contentLocale:a,onChange:t=>p(e,t)},e)),(0,Q.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Q.jsx)(W,{size:`sm`,onClick:()=>void m(),disabled:u,children:N()})})]})}function ve({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:s}){let[c,l]=(0,Z.useState)(!1),d=r.template.trim()!==t.defaultTemplate[i],f=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,me[e]??`{${e}}`])),m=I(e,r,i),h=m?L(m,p):``;return(0,Q.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(de,{checked:r.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,Q.jsx)(B,{label:n.label(),help:n.help()})]}):(0,Q.jsx)(B,{label:n.label(),help:n.help()}),d&&(0,Q.jsx)(`span`,{className:`oc-injection__badge`,children:a()})]}),(0,Q.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>s({template:e.target.value})}),(0,Q.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:g()}),t.placeholders.map(e=>(0,Q.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Q.jsx)(`code`,{children:`{${e}}`}),(0,Q.jsx)(H,{text:(he[e]??(()=>e))()})]},e))]}),(0,Q.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Q.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?u():y()}),d&&(0,Q.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate[i]}),children:se()})]})]}),c&&(0,Q.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:b()})]}):(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:o()})})]})}export{ge as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as ee,DC as a,EC as o,FC as te,Fa as s,GC as c,GR as ne,HC as re,IC as l,JC as u,KC as d,LC as ie,MC as f,NC as p,OC as m,PC as h,QC as g,RC as _,UC as v,VC as y,WC as b,WR as x,XC as S,YC as C,ZC as w,_C as T,bC as E,ew as D,fC as O,gC as k,hC as A,jC as j,kC as M,mC as N,pC as P,qC as F,t as I,tw as L,vC as R,yC as ae,zC as z}from"./api-BZGL-EQ1.js";import{t as B}from"./button-BfHR-QFa.js";import{Dt as V,Et as H,U,_ as W,jt as G,ut as K,yn as q}from"./index-B8D00xNa.js";import{t as J}from"./roleDescriptions-lmkJgty3.js";var Y=t(e(),1),X=n(),Z=[{group:()=>L(),keys:[{key:`traces.read`,label:()=>S()},{key:`traces.read.content`,label:()=>C(),phi:!0},{key:`traces.write`,label:()=>u()}]},{group:()=>D(),keys:[{key:`kpi.read`,label:()=>S()},{key:`kpi.write`,label:()=>u()}]},{group:()=>r(),keys:[{key:`openclaw.query`,label:()=>F()},{key:`anomalies.read`,label:()=>d()},{key:`anomalies.report`,label:()=>c()}]},{group:()=>g(),keys:[{key:`chats.read`,label:()=>S()},{key:`selfheal`,label:()=>v()},{key:`feedback.respond`,label:()=>s()}]},{group:()=>w(),keys:[{key:`admin.manage`,label:()=>b()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=ne(I.apiKeys.listRoles,{}),t=x(I.apiKeys.createRole),n=x(I.apiKeys.ensureRolesSeeded),r=x(I.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(I.apiKeys.listRoles,{});r&&e.setQuery(I.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=U(),c=V(),[u,d]=(0,Y.useState)(!1),[g,v]=(0,Y.useState)($),[b,S]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(y(),e)})},[n,c]);let C=e??[];async function w(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:ee({name:e.name}),description:z(),confirmLabel:_()});return}if(b.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];S(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){c.error(ie(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function D(){try{await t({key:g.key,name:g.name,description:g.description||void 0,permissions:[]}),v($),d(!1)}catch(e){c.error(l(),e)}}let F=e===void 0,L=!F&&C.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,h(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,p()]}),(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:f()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{v($),d(!0)},children:j()})})]}),F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(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:m()}),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?re({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:C.map(e=>{let t=Q(e.permissions),n=b.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)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,a()]}):(0,X.jsx)(H,{variant:`secondary`,children:o()})]}),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)(K,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?E():n?ae():r,onCheckedChange:()=>void w(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:u,onOpenChange:d,title:R(),description:T(),canSubmit:!!(g.key&&g.name),onSubmit:D,submitLabel:k(),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:A()}),(0,X.jsx)(G,{value:g.key,placeholder:N(),onChange:e=>v({...g,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:P()}),(0,X.jsx)(G,{value:g.name,onChange:e=>v({...g,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:g.description,onChange:e=>v({...g,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{$F as r,AF as i,AI as a,BI as o,CF as s,D as c,DF as l,DI as u,EF as ee,FF as d,FI as f,GR as p,HI as m,HR as h,IF as te,IR as ne,JF as re,LF as ie,LI as ae,MF as oe,MI as se,NF as ce,NI as le,OF as ue,OI as de,PF as fe,PI as pe,QF as g,RI as me,RR as _,SF as he,SI as ge,TF as _e,VI as ve,XF as ye,YF as v,ZF as be,_I as xe,_L as Se,aI as Ce,bF as we,bI as Te,bL as Ee,cI as De,cL as Oe,dL as ke,eI as Ae,fL as je,gI as Me,gL as Ne,hI as Pe,hL as Fe,iI as y,jF as Ie,jI as Le,kF as Re,kI as ze,lL as Be,mF as Ve,mI as He,mL as Ue,nI as We,oI as Ge,oL as Ke,pI as qe,pL as Je,qF as Ye,rI as b,sI as Xe,sL as Ze,t as x,tI as Qe,uL as $e,vI as et,vL as tt,wF as nt,wI as rt,xF as it,xI as at,yI as ot,yL as st,zI as ct}from"./api-BZGL-EQ1.js";import{t as lt}from"./list-15dfaZSm.js";import{t as S}from"./button-BfHR-QFa.js";import{$ as C,Bt as w,Ct as ut,Dt as dt,Et as T,Mn as E,Q as D,Rt as O,St as ft,Tt as pt,X as k,Z as A,_t as mt,at as ht,bn as gt,bt as _t,cn as vt,et as j,gt as yt,in as bt,it as xt,jn as M,jt as St,mn as Ct,nt as wt,ot as Tt,pn as Et,q as Dt,rt as Ot,tn as kt,tt as At,un as jt,vt as Mt,wt as Nt,xt as Pt,yt as Ft,zt as N}from"./index-B8D00xNa.js";import{a as It,i as P,n as Lt,o as Rt,r as F,t as zt}from"./table-D-GuJvnN.js";import{t as Bt}from"./FilterBar-D9hGs8jl.js";/* empty css */import{a as I,c as Vt,i as Ht,l as Ut,n as Wt,o as Gt,r as Kt,s as L,t as qt}from"./TimezoneCombobox-B7uN-QtE.js";var Jt=c(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Yt=c(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),R=t(e(),1),z=n();function B(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt({value:e,onChange:t}){let n=Vt(e),r=(0,R.useMemo)(()=>new Date,[]),[i,a]=(0,R.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,R.useState)(!1),c=(0,R.useMemo)(()=>B(_()),[]),l=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{month:`long`,year:`numeric`}),[]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=L(i.year,i.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(Ut(e,n,r,i,a)),m=(e,t,n)=>{a({year:e,month:t}),p(e,t,n,d,f)},h=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},te=n===null?Xe():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,z.jsxs)(O,{modal:!0,open:o,onOpenChange:s,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":De(),children:[(0,z.jsx)(Jt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,z.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:te})]})}),(0,z.jsxs)(N,{align:`start`,className:`oc-dtp__pop`,children:[(0,z.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":Ge(),onClick:()=>h(-1),children:(0,z.jsx)(E,{size:15,"aria-hidden":!0})}),(0,z.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":Ce(),onClick:()=>h(1),children:(0,z.jsx)(M,{size:15,"aria-hidden":!0})})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>m(e.year,e.month,e.day),children:e.day},t)})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,z.jsxs)(k,{value:String(d),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),Number(e),f),children:[(0,z.jsx)(C,{size:`sm`,"aria-label":y(),children:(0,z.jsx)(j,{})}),(0,z.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,z.jsx)(D,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,z.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,z.jsxs)(k,{value:String(f),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,z.jsx)(C,{size:`sm`,"aria-label":b(),children:(0,z.jsx)(j,{})}),(0,z.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,z.jsx)(D,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function V(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Zt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Qt(e){let t=new Map;for(let n of e){let e=V(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function H(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Zt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function en(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var U=3;function nn({events:e,mode:t,cursor:n,onModeChange:i,onCursorChange:a,onEventClick:o,footnote:s}){let c=_(),l=(0,R.useMemo)(()=>Qt(e),[e]),u=(0,R.useMemo)(()=>$t(c),[c]),ee=(0,R.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),d=(0,R.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),f=(0,R.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),p=new Date,m=e=>{if(t===`year`){a({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);a({year:r.getFullYear(),month:r.getMonth()})},h=t===`year`?String(n.year):ee.format(new Date(n.year,n.month,1));return(0,z.jsxs)(`div`,{className:`oc-cal`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":ye(),onClick:()=>m(-1),children:(0,z.jsx)(E,{})}),(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":v(),onClick:()=>m(1),children:(0,z.jsx)(M,{})}),(0,z.jsx)(S,{variant:`ghost`,size:`sm`,onClick:()=>a({year:p.getFullYear(),month:p.getMonth()}),children:be()})]}),(0,z.jsx)(`span`,{className:`oc-cal__title`,children:h}),(0,z.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,z.jsx)(S,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>i(`month`),children:r()}),(0,z.jsx)(S,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>i(`year`),children:g()})]})]}),t===`month`?(0,z.jsx)(rn,{cursor:n,byDay:l,weekdays:u,timeFmt:f,now:p,onEventClick:o}):(0,z.jsx)(an,{year:n.year,byDay:l,monthShortFmt:d,now:p,onOpenMonth:e=>{a({year:n.year,month:e}),i(`month`)}}),s?(0,z.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,z.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Zt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,z.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,z.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,U).map(e=>(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,z.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,z.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>U?(0,z.jsx)(`span`,{className:`oc-cal__more`,children:re({count:o.length-U})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,z.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=H(t,e,o),c=L(e,o);return(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,z.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,z.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,z.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var W={h:36e5,min:6e4,s:1e3,ms:1};function on(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*W[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var q=new Map;function J(e){let t=q.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return q.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function sn(e,t){return`${e}\u0000${t}`}function cn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=sn(a.instanceName,e.id);i.set(o,a);let s=Z(e.enabled===!1?null:on(e.schedule),e.nextRunAtMs,t,n);for(let t of s)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:e.enabled===!1,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function ln(e){return e?.data?.code??`unknown`}function un({status:e}){switch(I(e)){case`ok`:return(0,z.jsx)(T,{variant:`secondary`,children:at()});case`error`:return(0,z.jsx)(T,{variant:`destructive`,children:ot()});case`running`:return(0,z.jsx)(T,{variant:`outline`,children:et()});case`other`:return(0,z.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function dn(){let e=h(x.scheduled.listMyCrons),t=h(x.scheduled.getCronDetail),n=h(x.scheduled.listCronRuns),r=h(x.scheduled.updateCron),c=h(x.scheduled.removeCron),re=h(x.scheduled.runCronNow),g=dt(),ye=p(x.me.getMe,{host:Dt})?.timezone,[v,be]=(0,R.useState)(null),[Ce,De]=(0,R.useState)(!1),[y,Ge]=(0,R.useState)(!1),[b,Xe]=(0,R.useState)(null),[w,E]=(0,R.useState)(null),[O,M]=(0,R.useState)(null),[N,I]=(0,R.useState)(null),[Vt,Ut]=(0,R.useState)(!1),[L,B]=(0,R.useState)(Wt),[V,Zt]=(0,R.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Qt=e=>{localStorage.setItem(`oc.sched.view`,e),Zt(e)},[H,$t]=(0,R.useState)(`month`),[U,rn]=(0,R.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,R.useMemo)(()=>{let e=[];for(let t of v??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ht(r,L)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[v,L]),W=(0,R.useMemo)(()=>H===`year`?tn(U.year):en(U.year,U.month),[H,U]),on=(0,R.useMemo)(()=>cn(an,W.startMs,W.endMs),[an,W]),G=e=>{let t=on.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||dn(t.instanceName,t.job)},K=(0,R.useCallback)(async()=>{De(!0),Ge(!1);try{be(await e({}))}catch{Ge(!0)}finally{De(!1)}},[e]);(0,R.useEffect)(()=>{K()},[K]);let q=(0,R.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,R.useRef)(null);(0,R.useEffect)(()=>{v!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[v]);let Y=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{Xe(e);try{await t(),g.success(n),await K()}catch(e){g.toast({variant:`error`,title:f({code:ln(e)})})}finally{Xe(null)}},Z=(0,R.useRef)(0),Q=(0,R.useRef)(0),sn=async(e,t)=>{if(t.id===null)return;let r=++Z.current;M({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;M({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;M(null),g.toast({variant:`error`,title:f({code:ln(e)})})}},dn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;I({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;I(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;I(null),g.toast({variant:`error`,title:f({code:ln(e)})})}},fn=async()=>{if(N===null)return;let e={};if(N.nameDirty&&N.name.trim()===``||N.messageDirty&&N.hasMessage&&N.message.trim()===``){g.toast({variant:`error`,title:we()});return}if(N.nameDirty&&N.name.trim()!==``&&(e.name=N.name.trim()),N.scheduleDirty){if(N.scheduleKind===`cron`&&N.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:N.cronExpr.trim(),...N.tz.trim()===``?{}:{tz:N.tz.trim()}};else if(N.scheduleKind===`every`){let t=Number(N.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[N.everyUnit])})}else if(N.scheduleKind===`at`&&N.at!==``){let t=Date.parse(N.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(N.scheduleDirty&&e.schedule===void 0){g.toast({variant:`error`,title:it()});return}if(N.messageDirty&&N.hasMessage&&N.message.trim()!==``&&(e.message=N.message.trim()),Object.keys(e).length===0){I(null);return}let t=Q.current;Ut(!0);try{await r({instanceName:N.instanceName,jobId:N.jobId,patch:e}),g.success(fe()),t===Q.current&&I(null),await K()}catch(e){g.toast({variant:`error`,title:f({code:ln(e)})})}finally{Ut(!1)}},pn=v?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Ee()}),(0,z.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":We(),children:[(0,z.jsx)(S,{variant:V===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Qe(),title:Qe(),"aria-pressed":V===`list`,onClick:()=>Qt(`list`),children:(0,z.jsx)(lt,{})}),(0,z.jsx)(S,{variant:V===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ae(),title:Ae(),"aria-pressed":V===`calendar`,onClick:()=>Qt(`calendar`),children:(0,z.jsx)(Jt,{})})]}),(0,z.jsxs)(S,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:Ce,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,z.jsx)(vt,{size:14,"aria-hidden":!0}),st()]})]}),v!==null&&pn>0?(0,z.jsxs)(Bt,{q:L.q,onQChange:e=>B(t=>({...t,q:e})),searchPlaceholder:Me(),onReset:()=>B(Wt),canReset:Kt(L),children:[(0,z.jsxs)(k,{value:L.state,onValueChange:e=>B(t=>({...t,state:e})),children:[(0,z.jsx)(C,{size:`sm`,className:`w-40`,children:(0,z.jsx)(j,{})}),(0,z.jsxs)(A,{children:[(0,z.jsx)(D,{value:`all`,children:Pe()}),(0,z.jsx)(D,{value:`active`,children:Ke()}),(0,z.jsx)(D,{value:`paused`,children:Ze()})]})]}),(0,z.jsxs)(k,{value:L.result,onValueChange:e=>B(t=>({...t,result:e})),children:[(0,z.jsx)(C,{size:`sm`,className:`w-40`,children:(0,z.jsx)(j,{})}),(0,z.jsxs)(A,{children:[(0,z.jsx)(D,{value:`all`,children:He()}),(0,z.jsx)(D,{value:`ok`,children:at()}),(0,z.jsx)(D,{value:`error`,children:ot()}),(0,z.jsx)(D,{value:`running`,children:et()}),(0,z.jsx)(D,{value:`none`,children:xe()})]})]})]}):null,v===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Ce,children:y?tt():ne()}):V===`calendar`?(0,z.jsxs)(z.Fragment,{children:[y?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):null,v.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,z.jsx)(nn,{events:on.events,mode:H,cursor:U,onModeChange:$t,onCursorChange:rn,onEventClick:G,footnote:Ye()})]}):(0,z.jsxs)(z.Fragment,{children:[y?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):null,v.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,v.map(e=>{let t=e.jobs.filter(e=>Ht(e,L)),n=Kt(L)&&e.jobs.length>0&&t.length===0;return(0,z.jsxs)(`section`,{style:{marginBottom:20},children:[v.length>1||e.error||!e.supported?(0,z.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,z.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe({code:e.error})}):e.jobs.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):n?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,z.jsxs)(zt,{children:[(0,z.jsx)(It,{children:(0,z.jsxs)(Rt,{children:[(0,z.jsx)(P,{children:Je()}),(0,z.jsx)(P,{children:je()}),(0,z.jsx)(P,{children:ke()}),(0,z.jsx)(P,{children:$e()}),(0,z.jsx)(P,{children:Be()}),(0,z.jsx)(P,{children:ge()}),(0,z.jsx)(P,{children:ie()})]})}),(0,z.jsx)(Lt,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=b===i,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,z.jsxs)(Rt,{ref:t.id!==null&&t.id===q?J:void 0,"data-state":t.id!==null&&t.id===q?`selected`:void 0,children:[(0,z.jsx)(F,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Oe()}),(0,z.jsx)(F,{children:(0,z.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,z.jsxs)(F,{className:`whitespace-nowrap`,children:[(0,z.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=yt(t.schedule),n=e===null?null:mt(e);return n===null?null:(0,z.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,z.jsx)(F,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,z.jsx)(F,{children:Gt(t.enabled)===`active`?(0,z.jsx)(T,{variant:`secondary`,children:Ke()}):Gt(t.enabled)===`paused`?(0,z.jsx)(T,{variant:`outline`,children:Ze()}):(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,z.jsxs)(F,{children:[(0,z.jsx)(un,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,z.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??m(),children:Te()}):null]}),(0,z.jsx)(F,{className:`whitespace-nowrap`,children:t.id===null?(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,z.jsx)(gt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,z.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:o(),"aria-label":o(),disabled:b!==null,onClick:()=>void X(i,async()=>{let n=await re({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},pe()),children:(0,z.jsx)(kt,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:t.enabled?ct():me(),"aria-label":t.enabled?ct():me(),disabled:b!==null,onClick:()=>void X(i,()=>r({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?le():se()),children:t.enabled?(0,z.jsx)(Ct,{size:14,"aria-hidden":!0}):(0,z.jsx)(jt,{size:14,"aria-hidden":!0})}):null,c?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:te(),"aria-label":te(),disabled:b!==null,onClick:()=>void dn(e.instanceName,t),children:(0,z.jsx)(Et,{size:14,"aria-hidden":!0})}):null,c?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:d(),"aria-label":d(),disabled:b!==null,onClick:()=>void sn(e.instanceName,t),children:(0,z.jsx)(Yt,{size:14,"aria-hidden":!0})}):null,s?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:ae(),"aria-label":ae(),disabled:b!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,z.jsx)(bt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()})]},e.instanceName)}),pn>0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Ve()}):null]}),(0,z.jsx)(Mt,{open:w!==null,onOpenChange:e=>{e||E(null)},children:(0,z.jsxs)(Pt,{children:[(0,z.jsxs)(Nt,{children:[(0,z.jsx)(pt,{children:a()}),(0,z.jsx)(ft,{children:ze({name:w?.name??``})})]}),(0,z.jsxs)(ut,{children:[(0,z.jsx)(_t,{children:de()}),(0,z.jsx)(Ft,{onClick:()=>{let e=w;E(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Le())},children:u()})]})]})}),(0,z.jsx)(At,{open:O!==null,onOpenChange:e=>{e||(Z.current++,M(null))},children:(0,z.jsxs)(wt,{style:{maxWidth:640},children:[(0,z.jsx)(ht,{children:(0,z.jsx)(Tt,{children:ce({name:O?.name??``})})}),O?.entries===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):O!==null&&O.entries.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):O===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:O.entries.map((e,t)=>(0,z.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,z.jsx)(un,{status:e.status}),(0,z.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,z.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[rt({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,z.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,z.jsx)(At,{open:N!==null,onOpenChange:e=>{e||(Q.current++,I(null))},children:(0,z.jsxs)(wt,{className:`oc-cronedit`,children:[(0,z.jsxs)(ht,{children:[(0,z.jsx)(Tt,{children:Ie()}),(0,z.jsx)(Ot,{children:i()})]}),N===null?null:N.loading?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Je()}),(0,z.jsx)(St,{value:N.name,maxLength:200,onChange:e=>I({...N,name:e.target.value,nameDirty:!0})})]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Re()}),(0,z.jsxs)(k,{value:N.scheduleKind,onValueChange:e=>I({...N,scheduleKind:e,scheduleDirty:!0}),children:[(0,z.jsx)(C,{children:(0,z.jsx)(j,{})}),(0,z.jsxs)(A,{children:[(0,z.jsx)(D,{value:`cron`,children:ue()}),(0,z.jsx)(D,{value:`every`,children:l()}),(0,z.jsx)(D,{value:`at`,children:ee()})]})]}),N.scheduleKind===`cron`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(St,{value:N.cronExpr,onChange:e=>I({...N,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,z.jsx)(qt,{value:N.tz,onChange:e=>I({...N,tz:e,scheduleDirty:!0}),fallbackTz:ye??void 0})]}):N.scheduleKind===`every`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(St,{type:`number`,min:1,value:N.everyValue,onChange:e=>I({...N,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,z.jsxs)(k,{value:N.everyUnit,onValueChange:e=>I({...N,everyUnit:e,scheduleDirty:!0}),children:[(0,z.jsx)(C,{style:{maxWidth:160},children:(0,z.jsx)(j,{})}),(0,z.jsxs)(A,{children:[(0,z.jsx)(D,{value:`minutes`,children:_e()}),(0,z.jsx)(D,{value:`hours`,children:nt()}),(0,z.jsx)(D,{value:`days`,children:s()})]})]})]}):(0,z.jsx)(Xt,{value:N.at,onChange:e=>I({...N,at:e,scheduleDirty:!0})})]}),N.hasMessage?(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ve()}),(0,z.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:N.message,onChange:e=>I({...N,message:e.target.value,messageDirty:!0})})]}):null]}),(0,z.jsxs)(xt,{children:[(0,z.jsx)(S,{variant:`ghost`,onClick:()=>I(null),children:de()}),(0,z.jsxs)(S,{onClick:()=>void fn(),disabled:N===null||N.loading||Vt,children:[Vt?(0,z.jsx)(gt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,he()]})]})]})})]})}export{dn as ScheduledTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,$j as i,AM as ee,BM as te,Bj as a,CM as ne,DM as re,EM as ie,FM as ae,Fj as o,GM as oe,GR as s,Gj as c,HM as se,HR as ce,Hj as l,IM as le,Ij as u,JM as ue,Jj as d,KM as de,Kj as f,LM as fe,Lj as p,MM as pe,NM as me,OM as he,PM as ge,QM as _e,Qj as ve,RM as ye,Rj as be,SM as xe,TM as Se,UM as Ce,Uj as we,VM as Te,Vj as Ee,WM as De,WR as m,Wj as h,XM as g,Xj as _,YM as v,Yj as y,ZM as Oe,Zj as b,_M as ke,aM as Ae,bM as je,cM as Me,dM as Ne,eM as x,eN as Pe,fM as Fe,gM as Ie,hM as Le,iM as S,jM as Re,kM as ze,lM as Be,mM as Ve,nM as C,oM as He,pM as Ue,qM as We,qj as w,rM as T,sM as Ge,t as E,tM as D,tN as Ke,uM as qe,vM as Je,wM as Ye,xM as Xe,yM as Ze,zM as Qe,zj as O}from"./api-BZGL-EQ1.js";import{t as k}from"./check-DVHDMfix.js";import{r as $e}from"./dist-Cx6m07oR.js";import{t as A}from"./button-BfHR-QFa.js";import{$ as j,Dt as et,Et as M,Fn as tt,On as N,Pn as nt,Q as P,U as rt,X as F,Z as I,_ as it,at as L,ct as R,et as z,it as B,jn as at,jt as V,nt as H,ot as U,rt as W,st as G,tt as K}from"./index-B8D00xNa.js";import{t as ot}from"./FilterBar-D9hGs8jl.js";import{t as st}from"./DataTableShell-BkZGrlHw.js";import{t as ct}from"./roleDescriptions-lmkJgty3.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>Ee(),days:null},{value:`30`,label:()=>a(),days:30},{value:`90`,label:()=>O(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=tt({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[a,o]=(0,q.useState)(X),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),u=s(E.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:i===X?void 0:i===`disabled`}}),d=s(E.apiKeys.listKeys,{}),f=s(E.apiKeys.listRoles,{}),p=m(E.apiKeys.createServiceAccount),ve=m(E.apiKeys.updateServiceAccount),be=m(E.apiKeys.deleteServiceAccount),we=ce(E.apiKeys.mintApiKey),Ee=m(E.apiKeys.revokeApiKey),h=rt(),_=et(),y=n!==``||a!==X||i!==X;function b(){o(X),t({search:{},replace:!0})}let[x,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(Z),[T,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(new Set),[N,L]=(0,q.useState)(null),R=(0,q.useRef)(!1),[B,H]=(0,q.useState)(new Set),[U,W]=(0,q.useState)({}),[G,K]=(0,q.useState)(null),Y=(0,q.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){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{T?(await ve({serviceAccountId:T,name:C.name,roleKey:C.roleKey,description:C.description}),_.success(Ze())):await p({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),w(Z),D(null),S(!1)}catch(e){_.error(T?je():Xe(),e)}}function pt(e){w({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),S(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=U[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;L(e._id);try{let t=await we({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(Je(),e)}finally{R.current=!1,L(null)}}async function $(e){if(await h({title:ke(),description:(0,J.jsxs)(J.Fragment,{children:[Ie(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Le(),` `,(0,J.jsx)(`strong`,{children:Ve()}),` `,Ue()]}),confirmWord:e.name,confirmLabel:Fe(),destructive:!0}))try{await be({serviceAccountId:e._id}),_.success(Ne(),e.name)}catch(e){_.error(qe(),e)}}async function ht(e){if(await h({title:Be(),description:(0,J.jsxs)(J.Fragment,{children:[Me(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ge()]}),confirmLabel:He(),destructive:!0})&&!B.has(e._id)){H(t=>new Set(t).add(e._id));try{await Ee({keyId:e._id})}catch(e){_.error(Ae(),e)}finally{H(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()}),(0,J.jsxs)(ot,{q:n,onQChange:c,searchPlaceholder:Pe(),onReset:b,canReset:y,children:[(0,J.jsxs)(F,{value:a,onValueChange:o,children:[(0,J.jsx)(j,{size:`sm`,className:`w-40`,children:(0,J.jsx)(z,{placeholder:r()})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(P,{value:X,children:_e()}),(f??[]).map(e=>(0,J.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(F,{value:i,onValueChange:l,children:[(0,J.jsx)(j,{size:`sm`,className:`w-36`,children:(0,J.jsx)(z,{})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(P,{value:X,children:Oe()}),(0,J.jsx)(P,{value:`active`,children:g()}),(0,J.jsx)(P,{value:`disabled`,children:v()})]})]})]}),(0,J.jsx)(st,{title:ue(),rows:u,addLabel:We(),onAdd:()=>{w(Z),D(null),S(!0)},emptyHint:de(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:se(),onSelect:()=>pt(e)},{label:oe(),onSelect:()=>void mt(e)},{label:O.has(e._id)?De():Ce(),onSelect:()=>Q(e._id)},{label:Te(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?te():Qe(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,J.jsx)($e,{}):(0,J.jsx)(at,{})})},{header:ye(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:fe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})},{header:le(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:v()}):(0,J.jsx)(M,{variant:`outline`,children:g()})},{header:ae(),cell:e=>(0,J.jsxs)(F,{value:U[e._id]??`never`,onValueChange:t=>W(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(j,{size:`sm`,className:`w-32`,children:(0,J.jsx)(z,{})}),(0,J.jsx)(I,{children:lt.map(e=>(0,J.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:ge(),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,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?me():pe({count:t})})}}]}),(0,J.jsx)(it,{open:x,onOpenChange:e=>{S(e),e||D(null)},title:T?Re():he(),description:T?ee():re(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:T?ze():ie(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Se()}),(0,J.jsx)(V,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Ye()}),(0,J.jsxs)(F,{value:C.roleKey||void 0,onValueChange:e=>w({...C,roleKey:e}),children:[(0,J.jsx)(j,{className:`w-full`,children:(0,J.jsx)(z,{placeholder:ne()})}),(0,J.jsx)(I,{children:(f??[]).map(e=>(0,J.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===C.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:xe()}),(0,J.jsx)(V,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:G,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[S(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:C()}),(0,J.jsx)(`th`,{children:D()}),(0,J.jsx)(`th`,{children:x()}),(0,J.jsx)(`th`,{children:i()}),(0,J.jsx)(`th`,{children:ve()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:R(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?_():y()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(H,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{children:d()}),(0,J.jsx)(W,{children:w({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:f()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":c(),children:[n?(0,J.jsx)(k,{}):(0,J.jsx)(N,{}),n?h():we()]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:l()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?be():R(e)}function mt(e){return e===null?`—`:G(e)}function $(e){return e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:p()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(M,{variant:`outline`,children:u()}):(0,J.jsx)(M,{variant:`outline`,children:o()})}export{Q as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as a,BP as o,CP as s,D as c,DP as l,EP as u,FP as d,GN as f,GP as p,GR as m,HN as h,HP as g,HR as _,IP as v,JN as y,JP as ee,KN as b,KP as te,LP as ne,MP as re,MR as ie,NP as ae,NR as oe,OP as se,PP as ce,PR as le,QN as ue,QP as de,RP as fe,SP as pe,TP as me,UN as he,UP as ge,VP as _e,WN as ve,WP as ye,WR as x,XN as S,XP as be,YN as xe,YP as Se,ZN as Ce,ZP as we,_P as Te,aF as Ee,aP as De,as as C,bP as Oe,cF as ke,cP as w,dP as Ae,eF as je,eP as Me,fP as Ne,gP as Pe,hP as Fe,iF as Ie,iP as Le,is as T,jP as Re,kP as ze,lF as Be,lP as Ve,mP as He,nF as Ue,nP as We,ns as Ge,oF as Ke,oP as qe,pP as Je,qN as Ye,qP as Xe,r as Ze,rF as Qe,rP as $e,rs as et,sF as tt,sP as nt,t as E,tF as rt,tP as it,uF as at,uP as ot,vP as st,wP as ct,xP as lt,yP as ut,zP as dt}from"./api-BZGL-EQ1.js";import{t as D}from"./check-DVHDMfix.js";import{t as O}from"./x-DU13TyPG.js";import{t as k}from"./button-BfHR-QFa.js";import{$ as A,Dn as ft,En as j,Et as M,Ft as pt,G as mt,It as N,K as ht,Lt as gt,Mt as _t,Nt as vt,Pt as P,Q as F,X as I,Z as L,et as R,jt as z,q as B,ut as V}from"./index-B8D00xNa.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-BwaW6OwI.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-D-GuJvnN.js";import{t as kt}from"./TimeRangePicker-C5oWQ1bV.js";import{t as At}from"./FilterBar-D9hGs8jl.js";import{t as jt}from"./AdvancedFilter-BWRt6Typ.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(Ae());if(e.size>zt)throw Error(ot());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(w());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(w());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(nt());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(Ve())),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`?le():e===`dark`?oe():ie()}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:Ze(`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":C(),title:C(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=m(E.charts.listMyCharts),r=x(E.charts.setMyChart);async function a(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:Ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:je(),subtitle:i(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?de():n.via===`owner`?we():be({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 a(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:Se()}):null]})}function Qt(){let e=x(E.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),f(!1);try{i(await t.text())}catch{s(l())}}}async function g(){if(s(null),f(!1),t.trim()===``){s(me());return}let a;try{a=JSON.parse(r)}catch{s(l());return}m(!0);try{await e({name:t.trim(),tokens:a}),f(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!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:d()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(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:ae()}),(0,X.jsx)(z,{value:t,onChange:e=>n(e.target.value),placeholder:re(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Re()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:a(),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`}),ze(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:p,onClick:()=>void g(),children:se()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:u()}):null]})]})}function $t({chart:e}){let t=_(E.charts.setChartLogo),n=x(E.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(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 l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(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 d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(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`?st():Te()}),(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?Fe():Pe(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Je()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:He()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ut()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ne()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=m(E.me.getMe,{host:B}),n=x(E.charts.addChartDomain),r=x(E.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(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:qe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:We()}):u.map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":it({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{value:i,onChange:e=>a(e.target.value),placeholder:Le(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:$e()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:De()}),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=x(E.charts.updateChart),n=x(E.charts.deleteChart),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(e.name),[c,u]=(0,K.useState)(()=>tn(e.tokens)),[d,f]=(0,K.useState)(e.tokens.bpm??0),[p,m]=(0,K.useState)(null),[h,g]=(0,K.useState)(!1);function _(){s(e.name),u(tn(e.tokens)),f(e.tokens.bpm??0),m(null),a(!0)}async function v(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(c)}catch{m(l());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(S()))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:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:_,children:lt()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:Oe()})]})})]}),i?(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:ue()}),(0,X.jsx)(z,{value:o,onChange:e=>s(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:T()}),(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:d,onChange:e=>f(Number(e.target.value)),"aria-label":T()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?et():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ge()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ce()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),p?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:p}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:h,onClick:()=>void v(),children:Me()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:r()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=m(E.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:ct()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()}):(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=x(E.charts.addChartToGroupPool),r=x(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(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)(M,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?_e():e.kind===`custom`&&e.scope===`personal`?b():g()}),e.isGlobalDefault?(0,X.jsx)(M,{variant:`default`,children:o()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:fe()}),(a??[]).map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":v({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(I,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(R,{placeholder:ne()})}),(0,X.jsx)(L,{children:c.map(e=>(0,X.jsx)(F,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:dt()}):null]})]})}function on({chart:e}){let t=x(E.charts.promoteChartToCommon),n=x(E.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(S()))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)(M,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?f():b()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ye({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:ve()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:he()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(E.admin.setDefaultThemeMode),i=x(E.admin.setDefaultLocale),a=x(E.charts.setDefaultChart),o=m(E.charts.listChartsAdmin),s=m(E.groups.listGroups,{}),c=e??`system`,l=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:Ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(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:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:je()}),ht.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({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:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:p()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:s??[]},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:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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:xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()}):(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:at()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({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:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:tt()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(k,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ke()})]})]})}function cn(){let e=m(E.me.getMe,{host:B}),t=mt(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:Ee()}),(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)(j,{})}),(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)(M,{children:`Default`}),(0,X.jsx)(M,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(M,{variant:`outline`,children:`Outline`}),(0,X.jsx)(M,{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)(z,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(I,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(R,{placeholder:`Select…`})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(F,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(V,{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)(I,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes directions`}),(0,X.jsx)(F,{value:`inbound`,children:`inbound`}),(0,X.jsx)(F,{value:`outbound`,children:`outbound`}),(0,X.jsx)(F,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(I,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(F,{value:`info`,children:`info`}),(0,X.jsx)(F,{value:`warn`,children:`warn`}),(0,X.jsx)(F,{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)(gt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(j,{})})}),(0,X.jsxs)(vt,{align:`start`,children:[(0,X.jsx)(pt,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(N,{}),(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)(V,{"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)(V,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(M,{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)(j,{})})})]},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{$n as r,At as i,Bn as a,Bt as o,Fn as s,Ft as c,GR as l,Gn as ee,HR as te,Hn as u,Ht as d,IR as f,In as p,It as m,Jn as h,Kn as g,LD as _,Ln as v,Nt as ne,Ot as re,Pt as ie,Qn as y,RR as ae,Rn as b,Td as x,Un as oe,Ut as S,Vn as C,Vt as w,WR as T,Wn as se,Xn as ce,Xt as le,Yn as ue,Zn as E,ar as de,er as D,eu as fe,gt as pe,ir as me,jt as O,kt as k,nr as A,nu as j,qn as M,rr as N,t as P,tr as F,zn as I,zt as L}from"./api-BZGL-EQ1.js";import{i as R,n as z,r as he,t as ge}from"./tabs-BE-jtUDZ.js";import{t as B}from"./button-BfHR-QFa.js";import{$ as V,$t as H,Et as U,Fn as _e,Jt as ve,Nn as ye,Pn as be,Q as W,Qt as G,X as K,Xt as xe,Yt as Se,Z as q,Zt as Ce,en as we,et as J,gn as Te,nn as Ee,q as De,ut as Y}from"./index-B8D00xNa.js";/* empty css */var X=t(e(),1),Z=n(),Q=[[`auto`,()=>y()],[`fr-FR`,()=>S()],[`en-US`,()=>d()],[`en-GB`,()=>w()],[`de-DE`,()=>o()],[`es-ES`,()=>L()]],Oe=[[`0.75`,()=>ce()],[`1`,()=>ue()],[`1.25`,()=>h()],[`1.5`,()=>M()]],$=0;function ke({instance:e}){let t=T(P.admin.upsertInstanceConfig),n=e.config??{},a={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[o,s]=(0,X.useState)(a),[c,l]=(0,X.useState)(`idle`),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),h=te(P.voice.gatewayTtsPreview);(0,X.useEffect)(()=>{s({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),l(`idle`)},[e._id]);let _=o.enabled!==a.enabled||o.engine!==a.engine||o.lang!==a.lang||o.rate!==a.rate||o.autoRead!==a.autoRead;async function v(){l(`saving`);try{let n={...e.config??{}};n.voiceEnabled=o.enabled,o.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,o.lang===`auto`?delete n.voiceLang:n.voiceLang=o.lang;let r=Number.parseFloat(o.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,o.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),l(`idle`)}catch{l(`error`)}}return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:o.enabled,onCheckedChange:e=>s({...o,enabled:e===!0}),"aria-label":D()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,Z.jsxs)(K,{value:o.engine,onValueChange:e=>s({...o,engine:e}),disabled:!o.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":O(),children:(0,Z.jsx)(J,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(W,{value:`browser`,children:i()}),e.kind===`hermes`?null:(0,Z.jsx)(W,{value:`gateway`,children:k()})]})]})]}),o.engine===`gateway`?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()}):null,o.engine===`gateway`?null:(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,Z.jsxs)(K,{value:o.lang,onValueChange:e=>s({...o,lang:e}),disabled:!o.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":r(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(q,{children:Q.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,Z.jsxs)(K,{value:o.rate,onValueChange:e=>s({...o,rate:e}),disabled:!o.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":E(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(q,{children:Oe.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),o.engine===`gateway`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:o.autoRead,onCheckedChange:e=>s({...o,autoRead:e===!0}),disabled:!o.enabled,"aria-label":g()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,Z.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Z.jsx)(B,{size:`sm`,disabled:!_||c===`saving`,onClick:()=>void v(),children:c===`saving`?x():j()}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,disabled:!o.enabled||d,onClick:()=>{let t=Number.parseFloat(o.rate)||1,n=++$;if(m(!1),H(),G(),o.engine!==`gateway`){Ce(u(),{lang:xe(o.lang,ae()),rate:t});return}f(!0),h({instanceName:e.name,text:u()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&m(!0)}).finally(()=>f(!1))},children:d?x():se()}),(0,Z.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{$++,f(!1),H(),G()},children:oe()})]}),c===`error`||p?(0,Z.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p?pe():fe()}):null]})}function Ae({stt:e}){let t=l(P.me.getMe,{host:De}),n=T(P.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:a()}),(0,Z.jsx)(U,{variant:e?`secondary`:`outline`,children:e?p():s()}),(0,Z.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?c():ie()})]}),i?(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":m()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}):null,(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]})}function je(){let e=l(P.admin.listInstances,{}),t=(0,X.useMemo)(()=>we(),[]),n=(0,X.useMemo)(()=>ve(),[]),{section:r}=_e({from:`/settings/voice`}),i=be({from:`/settings/voice`});return(0,Z.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,Z.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Z.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?me():N()}),(0,Z.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?A():F()})]}),(0,Z.jsxs)(ge,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Z.jsxs)(he,{className:`w-full`,children:[(0,Z.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Ee,{size:13,"aria-hidden":!0}),ne()]}),(0,Z.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Te,{size:13,"aria-hidden":!0}),a()]}),(0,Z.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(ye,{size:13,"aria-hidden":!0}),b()]})]}),(0,Z.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):e.map(e=>(0,Z.jsx)(ke,{instance:e},e._id))}),(0,Z.jsx)(z,{value:`dictation`,children:(0,Z.jsx)(Ae,{stt:n})}),(0,Z.jsxs)(z,{value:`talk`,children:[(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:b()})}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]}),e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):e.map(e=>(0,Z.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=T(P.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(U,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:le()}):(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":_()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]})]})}export{je as VoiceTab};