@lacneu/atrium 0.84.17 → 0.84.18

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 (63) hide show
  1. package/dist/assets/{AccessTab-DhFQZGzx.js → AccessTab-C4qktb9N.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-DhMwg7nB.js → AdvancedFilter-DzABuYe4.js} +1 -1
  3. package/dist/assets/AgentFilesTab-tv2KHmyO.js +3 -0
  4. package/dist/assets/{AnomaliesTab-DRPqd0B0.js → AnomaliesTab-POfetzRk.js} +1 -1
  5. package/dist/assets/{AuditTab-CoJzgU4A.js → AuditTab-DNtJSFCG.js} +1 -1
  6. package/dist/assets/{BridgeTab-Cyq6ii7O.js → BridgeTab-CzyyKpM3.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-ffTdOd77.js → ChatDefaultsTab-B0YNJjM5.js} +1 -1
  8. package/dist/assets/{DataTableShell-C0MSDiic.js → DataTableShell-DGGSIwCx.js} +1 -1
  9. package/dist/assets/{DetailChips-V2Qp_G9Y.js → DetailChips-DTzXBtIX.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-4P7NTQHQ.js → FeedbacksTab-BJvVbEdR.js} +1 -1
  11. package/dist/assets/{FieldLabel-CrPuHD7O.js → FieldLabel-CEa671vG.js} +1 -1
  12. package/dist/assets/FilesTab-B79u5xo1.js +1 -0
  13. package/dist/assets/{FilterBar-Of8GWz2N.js → FilterBar-D_6ObXjr.js} +1 -1
  14. package/dist/assets/{GroupsTab-JG0ZRFjT.js → GroupsTab-FU1hfvWY.js} +1 -1
  15. package/dist/assets/{InstancesTab-Z4FtEPKO.js → InstancesTab-D0YmHvV-.js} +1 -1
  16. package/dist/assets/{IntegrationsTab-Cwaeqx7m.js → IntegrationsTab-BEVGWeVW.js} +1 -1
  17. package/dist/assets/KpiTab-BLkA1s66.js +1 -0
  18. package/dist/assets/PreferencesTab-D56grf46.js +1 -0
  19. package/dist/assets/ProjectPage-C9wOIZOD.js +1 -0
  20. package/dist/assets/{PromptInjectionsTab-netn591W.js → PromptInjectionsTab-X6VRyQUy.js} +2 -2
  21. package/dist/assets/RolesTab-Dunonnsb.js +1 -0
  22. package/dist/assets/ScheduledTab-DCpRYvbc.js +1 -0
  23. package/dist/assets/{ServiceAccountsTab-CfyqKLAB.js → ServiceAccountsTab-D2TjT-Y0.js} +1 -1
  24. package/dist/assets/{SubAgentReportsTab-Z3ozWsvu.js → SubAgentReportsTab-C0O27eOL.js} +1 -1
  25. package/dist/assets/{ThemeShowroom-CJH5AUOa.js → ThemeShowroom-CbWueTmW.js} +1 -1
  26. package/dist/assets/{TimeRangePicker-Cq_PGNzt.js → TimeRangePicker-DVMsYipt.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-n6rUGOTZ.js → TimezoneCombobox-D1Wotasq.js} +1 -1
  28. package/dist/assets/TracesTab-CHxsnBQk.js +1 -0
  29. package/dist/assets/{UsersTab-B3TSVToM.js → UsersTab-OinNV3dC.js} +1 -1
  30. package/dist/assets/VoiceTab-C-4Z4mUZ.js +1 -0
  31. package/dist/assets/api-Dawxt_aS.js +44 -0
  32. package/dist/assets/{button-CTuIl1H-.js → button-alklyZ2M.js} +1 -1
  33. package/dist/assets/{card-Bf8slN_1.js → card-CDvn9R5v.js} +1 -1
  34. package/dist/assets/chevrons-up-down-CFK9IaHn.js +1 -0
  35. package/dist/assets/{compatView-DGV2AVAR.js → compatView-C9_KgDNH.js} +1 -1
  36. package/dist/assets/{dispatchErrorInfo-ZyhGCDRg.js → dispatchErrorInfo-d7ehNfS4.js} +1 -1
  37. package/dist/assets/{dist-BA_3OmOa.js → dist-C3BrQPF_.js} +1 -1
  38. package/dist/assets/{dist-uRF7WBqM.js → dist-DlDq3K4D.js} +1 -1
  39. package/dist/assets/{highlighted-body-OFNGDK62-PQt_lrzL.js → highlighted-body-OFNGDK62-BytsI_cI.js} +1 -1
  40. package/dist/assets/{index-D48cFy6f.js → index-C-ySA5Hs.js} +61 -61
  41. package/dist/assets/{list-CntaIhDp.js → list-Bs_wfimY.js} +1 -1
  42. package/dist/assets/mermaid-GHXKKRXX-CBJEr4Xn.js +1 -0
  43. package/dist/assets/{pdf-BpJ-W-U1.js → pdf-DRZjZEuv.js} +1 -1
  44. package/dist/assets/roleDescriptions-C21oVyp7.js +1 -0
  45. package/dist/assets/{table-D0yilGWI.js → table-CJ3_5RvQ.js} +1 -1
  46. package/dist/assets/{tabs-KQ0HdNTL.js → tabs-D-3HavQe.js} +1 -1
  47. package/dist/assets/x-BSVAMcNy.js +1 -0
  48. package/dist/index.html +6 -6
  49. package/package.json +1 -1
  50. package/dist/assets/AgentFilesTab-4sCRfaeL.js +0 -3
  51. package/dist/assets/FilesTab-DhNYdwv6.js +0 -1
  52. package/dist/assets/KpiTab-CW4PL5Q2.js +0 -1
  53. package/dist/assets/PreferencesTab-CWPxzO4u.js +0 -1
  54. package/dist/assets/ProjectPage-DMyEKLjd.js +0 -1
  55. package/dist/assets/RolesTab-BEQu-Exi.js +0 -1
  56. package/dist/assets/ScheduledTab-DwU5L2Il.js +0 -1
  57. package/dist/assets/TracesTab-DNfS8ryM.js +0 -1
  58. package/dist/assets/VoiceTab-DiKi0oXO.js +0 -1
  59. package/dist/assets/api-DRlXTl06.js +0 -44
  60. package/dist/assets/chevrons-up-down-BCCw67LL.js +0 -1
  61. package/dist/assets/mermaid-GHXKKRXX-CiGFgQis.js +0 -1
  62. package/dist/assets/roleDescriptions-CoFSIkRg.js +0 -1
  63. package/dist/assets/x-BM-3QiyY.js +0 -1
@@ -0,0 +1 @@
1
+ import{_T as e,bT as t,vT as n,xT as r,yT as i}from"./api-Dawxt_aS.js";var a={pending:r,user:t,admin:i,observer:n,agent:e};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-DRlXTl06.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-Dawxt_aS.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-DRlXTl06.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-D48cFy6f.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:d=`automatic`,...p}=e,m=f(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:d,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),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"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-Dawxt_aS.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-C-ySA5Hs.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:d=`automatic`,...p}=e,m=f(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:d,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),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"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-Dawxt_aS.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,13 +62,13 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-D48cFy6f.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-C-ySA5Hs.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/api-DRlXTl06.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-uRF7WBqM.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-BA_3OmOa.js">
70
- <link rel="modulepreload" crossorigin href="/assets/x-BM-3QiyY.js">
71
- <link rel="modulepreload" crossorigin href="/assets/button-CTuIl1H-.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/api-Dawxt_aS.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-DlDq3K4D.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-C3BrQPF_.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/x-BSVAMcNy.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/button-alklyZ2M.js">
72
72
  <link rel="stylesheet" crossorigin href="/assets/index-9JURmeVM.css">
73
73
  </head>
74
74
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.84.17",
3
+ "version": "0.84.18",
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{$B as r,$d as i,$o as a,Ao as o,Do as s,Eo as c,Jd as l,Jo as u,Oo as d,Qd as f,Qo as p,Sf as m,To as h,Xd as g,Xo as _,Yd as v,Yo as y,ZB as b,Zd as x,Zo as S,_f as C,aV as w,af as T,an as E,as as D,bf as O,cf as k,cp as A,cs as j,df as M,ds as N,ef as ee,es as P,ff as te,fs as F,gf as I,hf as ne,if as L,is as R,jo as z,ko as re,lf as B,ls as ie,mf as ae,nf as V,ns as oe,oV as H,of as se,op as ce,os as le,pf as ue,ps as de,qd as fe,qo as pe,rV as U,rf as me,rs as he,sf as ge,ss as _e,t as W,tN as ve,tf as ye,ts as be,uf as xe,us as Se,vf as Ce,xf as we,yf as Te}from"./api-DRlXTl06.js";import{t as G}from"./button-CTuIl1H-.js";import{$ as Ee,B as De,Ct as Oe,Dt as K,Et as ke,Q as Ae,St as je,Tt as Me,X as Ne,Z as Pe,at as Fe,bt as Ie,et as Le,nt as Re,ot as ze,q as Be,rt as Ve,tt as He,un as q,vt as Ue,wt as We,xt as Ge,yt as Ke}from"./index-D48cFy6f.js";import{n as qe,t as Je}from"./curation-CQksaIbm.js";import{a as Ye}from"./compatView-DGV2AVAR.js";/* empty css */var J=t(e(),1),Y=2e4,Xe=6e4;function Ze(e){return typeof e!=`number`||e<=0?0:Math.round(e/Y*100)}function Qe(e){return e<=0?0:Math.round(e/Xe*100)}function X(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function $e(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Z=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<Z&&a.push(e)):t>0&&(i+=t,o.length<Z&&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=H(W.me.getMe,{host:Be}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=H(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,J.useState)(null);(0,J.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=H(W.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=H(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,J.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[u,d]=(0,J.useState)(null);(0,J.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&d($(l[0]))},[l,u]);let f=l?.find(e=>$(e)===u)??null,p=U(W.agentFiles.listAgentFiles),[h,g]=(0,J.useState)({status:`idle`}),_=f?.instanceName??null,v=f?.agentId??null,y=H(W.compat.forInstance,n&&_!==null?{instanceName:_}:`skip`),x=n&&_!==null?De(y,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,w=(0,J.useCallback)(async()=>{if(!(_===null||v===null)){g({status:`loading`});try{g({status:`done`,files:(await p({instanceName:_,agentId:v})).files})}catch(e){g({status:`error`,dashboardAbsent:tt(e)})}}},[p,_,v]);(0,J.useEffect)(()=>{S===!1&&w()},[w,S]);let[T,D]=(0,J.useState)(null),k=H(W.agentFileCuration.listCurations,t&&_!==null&&v!==null?{instanceName:_,agentId:v}:`skip`),A=H(W.agentFileCuration.curationSettings,t&&_!==null?{instanceName:_}:`skip`),N=U(W.agentFileCuration.requestCuration),[ee,P]=(0,J.useState)(null),[F,L]=(0,J.useState)(null),{toast:R}=K(),z=(0,J.useMemo)(()=>{let e=new Map;for(let t of k??[])e.has(t.name)||e.set(t.name,t);return e},[k]),re=(0,J.useCallback)(async e=>{if(!(_===null||v===null)){P(e);try{let t=await N({instanceName:_,agentId:v,name:e,trigger:`manual`});t.ok?R({title:Se(),variant:`success`}):R({title:ie({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:j(),variant:`error`})}finally{P(null)}}},[N,_,v,R]),B=r(),V=(0,J.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":we(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:(i??[]).map(e=>(0,Q.jsx)(Ae,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Ne,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":O(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:l.map(e=>(0,Q.jsx)(Ae,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]}),f===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,Ye(x.gatewayVersion,x.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?E():C(),` `,!h.dashboardAbsent&&(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:ce()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Ze(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)(ke,{variant:`outline`,children:I()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ne({size:X(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ae({pct:V.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":ue()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>D(e),children:t?M():xe()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Je.includes(e.name),size:e.size??0,budget:A?.budgetChars??null,enabled:A?.enabled??!1,curation:z.get(e.name)??null,inFlight:ee===e.name,onCurate:()=>void re(e.name),onReview:e=>L(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:te({used:X($e(h.files),B),total:X(Xe,B),pct:V.format(Qe($e(h.files)))})})]}),T&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:T.name,isAdmin:t,onClose:()=>D(null),onSaved:()=>void w()}):null,F?(0,Q.jsx)(ot,{curationId:F,onClose:()=>L(null),onApplied:()=>{L(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(G,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:F()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:N()}):e&&r&&n!==null&&qe(t,n)?(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:de()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:o,onSaved:s}){let c=U(W.agentFiles.getAgentFile),u=U(W.agentFiles.setAgentFile),d=K(),[p,m]=(0,J.useState)(null),[h,_]=(0,J.useState)(!1),[y,S]=(0,J.useState)(``),[C,w]=(0,J.useState)(!1),[E,D]=(0,J.useState)(!1),[O,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(!1),P=(0,J.useCallback)(async r=>{_(!1);try{let i=await c({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),j(!1)}catch{_(!0)}},[c,e,t,n]);(0,J.useEffect)(()=>{P(!1)},[P]);async function te(){if(p!==null){D(!0),N(!1);try{await u({instanceName:e,agentId:t,name:n,content:y,baseUpdatedAtMs:p.updatedAtMs??void 0}),d.success(me({name:n})),s(),await P(!1)}catch(e){nt(e)?j(!0):N(!0)}finally{D(!1)}}}let F=p!==null&&y!==p.content,I=(0,J.useMemo)(()=>p===null?null:et(p.content,y),[p,y]),ne=y.length>Y,R=r(),z=(0,J.useMemo)(()=>new Intl.NumberFormat(R),[R]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&o(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:B({name:n})}),(0,Q.jsxs)(Ve,{children:[k({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ge()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ye(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void P(!1),children:ce()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:y,readOnly:!a,spellCheck:!1,onChange:e=>S(e.target.value),"aria-label":B({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:se()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void P(!0),children:i()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:V()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:T({count:z.format(y.length),max:z.format(Y)})}),a?(0,Q.jsx)(G,{size:`sm`,disabled:!F||E||O,onClick:()=>w(!0),children:E?A():L()}):null]})]}),(0,Q.jsx)(Ue,{open:C,onOpenChange:w,children:(0,Q.jsxs)(Ge,{children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Me,{children:f({name:n})}),(0,Q.jsx)(je,{children:x({agent:t})})]}),I?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:g({added:I.added,removed:I.removed})}),I.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),I.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,I.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),I.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(Ie,{children:ve()}),(0,Q.jsx)(Ke,{onClick:()=>void te(),children:fe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=H(W.agentFileCuration.getProposal,{curationId:e}),l=U(W.agentFileCuration.approveCuration),f=w(W.agentFileCuration.rejectCuration),{toast:m}=K(),[g,v]=(0,J.useState)(null),[x,C]=(0,J.useState)(!1),[T,E]=(0,J.useState)(``),O=r(),k=(0,J.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function M(){v(`approve`);try{let t=await l({curationId:e});t.ok?(m({title:_e(),variant:`success`}),n()):m({title:t.reason===`conflict`?D():R({reason:t.reason??`unknown`}),variant:`error`})}catch{m({title:j(),variant:`error`})}finally{v(null)}}async function N(n){v(`reject`);try{let r=T.trim();(await f({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?m({title:n?c():le(),variant:`success`}):m({title:be(),variant:`error`}),t()}catch{m({title:j(),variant:`error`})}finally{v(null)}}return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:i?he({name:i.name}):b()}),(0,Q.jsx)(Ve,{children:oe()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[P({before:X(i.beforeSize,O),after:X(i.proposedSize,O)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,a()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:p({added:k.added,removed:k.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:h({feedback:i.feedback})}):null,k&&k.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:pe()}),(0,Q.jsx)(`ul`,{children:k.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:u()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:S()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),x?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:z()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:o(),value:T,onChange:e=>E(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`ghost`,onClick:()=>C(!1),disabled:g!==null,children:re()}),(0,Q.jsx)(G,{variant:`outline`,onClick:()=>void N(!1),disabled:g!==null,children:g===`reject`?A():d()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void N(!0),disabled:g!==null,children:g===`reject`?A():s()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`outline`,onClick:()=>C(!0),disabled:g!==null||i==null,children:_()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void M(),disabled:g!==null||i==null,children:g===`approve`?A():y()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as ee,$z as te,Bz as r,Cs as i,Gz as a,Hz as ne,Jz as o,Kz as s,Lz as re,Qz as ie,Rz as ae,Ss as oe,Uz as se,Vz as ce,Wz as le,Xz as ue,Yz as de,ZB as fe,Zz as pe,_B as me,aB as c,aV as he,cB as ge,dB as l,eB as u,fB as _e,gB as d,hB as f,iB as p,lB as m,mB as h,nB as g,oB as _,oV as ve,pB as ye,qz as be,rB as v,sB as y,t as b,tB as x,tN as S,uB as C,vB as w,zz as T}from"./api-DRlXTl06.js";import{t as E}from"./button-CTuIl1H-.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as I,X as L,Z as R,bt as we,dn as Te,et as z,hn as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-D48cFy6f.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-D0yilGWI.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return y();case`audio`:return _();case`video`:return c();case`pdf`:return p();case`document`:return v();case`archive`:return g();default:return x()}}function q(){let[e,t]=(0,U.useState)(G),[n,c]=(0,U.useState)(G),[p,g]=(0,U.useState)(G),[_,v]=(0,U.useState)(G),[y,x]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=he(b.files.softDelete),Y=k();function Ie(){t(G),c(G),g(G),v(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(le())}catch(e){Y.error(se(),e)}}let X=ve(b.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:p===G?void 0:p,category:_===G?void 0:_,includeAutoGenerated:y||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ee(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:fe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||p!==G||_!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":me(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:d()}),(0,W.jsx)(F,{value:`inbound`,children:f()}),(0,W.jsx)(F,{value:`outbound`,children:h()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:c,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":ye(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:_e()}),Q.chats.map(e=>(0,W.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:p,onValueChange:g,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":l(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:C()}),Q.instances.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:_,onValueChange:v,children:[(0,W.jsx)(D,{size:`sm`,"aria-label":m(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(F,{value:G,children:ge()}),Q.categories.map(e=>(0,W.jsx)(F,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:y,onCheckedChange:e=>x(e===!0),"aria-label":i()}),(0,W.jsx)(`span`,{children:i()})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Ee,{size:14,"aria-hidden":!0}),be()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?ae():T()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:u()}),(0,W.jsx)(B,{children:te()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:pe()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{className:`text-right`,children:de()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:oe()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?f():h()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(N,{children:[(0,W.jsx)(M,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":s(),children:(0,W.jsx)(Se,{size:16})})}),(0,W.jsxs)(xe,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(j,{size:14}),o()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(j,{size:14}),r()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),a()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:re({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(I,{children:ne()}),(0,W.jsx)(Ce,{children:ce()})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(we,{children:S()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:a()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,MA as i,SA as a,_b as o,ab as s,cb as c,db as l,fb as u,gb as d,hb as f,ib as p,jA as m,kA as h,lb as g,mb as _,oV as v,ob as ee,pb as te,rj as y,sb as b,t as x,ub as S,vb as C,xA as w}from"./api-DRlXTl06.js";import{Gn as T,Kn as E,i as D,o as O,q as ne,r as re}from"./index-D48cFy6f.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-Bf8slN_1.js";import{n as P,t as F}from"./TimeRangePicker-Cq_PGNzt.js";var I=t(e(),1),L={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=v(x.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=v(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:y()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:i()}),(0,z.jsx)(M,{children:r()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/r,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[w(),` p50 `,V(l.cP50),` `,m()]}),(0,z.jsxs)(`span`,{children:[a(),` p50 `,V(l.aP50),` `,m()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),children:[(0,z.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:o(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:f(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:_(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:te(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:u(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=E({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...O(e)})}),{from:i,to:a}=P(n),{rowLimit:o,buckets:s}=Y(i,a),u=v(x.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[u,s]),f=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:S()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:b({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:ee()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:s({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":p({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$n as i,AB as a,AF as o,BB as s,BF as c,CB as l,CF as u,DB as d,DF as f,EB as p,EF as m,FB as h,FF as ee,GF as te,HB as ne,HF as re,IB as ie,IF as ae,JF as oe,Jn as se,KB as ce,KF as le,LB as ue,LD as de,LF as fe,MB as pe,MF as me,NB as he,NF as ge,OB as _e,OF as ve,PB as g,PF as _,QF as v,Qn as y,RB as b,RF as x,SB as S,SF as C,TB as w,TF as T,UB as E,UF as D,VB as O,VF as k,WF as A,XF as j,Xn as M,YF as N,Yn as P,ZB as F,ZF as ye,Zn as be,_F as xe,aV as I,bB as Se,bF as Ce,eI as we,er as Te,gF as Ee,hr as De,jB as Oe,jF as ke,kB as Ae,kF as L,lr as je,mr as Me,oV as R,qF as Ne,r as z,t as B,tI as Pe,tr as Fe,vF as Ie,wB as Le,wF as Re,xB as ze,xF as Be,yF as Ve,zB as He,zF as Ue}from"./api-DRlXTl06.js";import{t as V}from"./button-CTuIl1H-.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-D48cFy6f.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-n6rUGOTZ.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:()=>Pe()},{id:`composer`,label:()=>we()},{id:`sidebar`,label:()=>r()},{id:`notifications`,label:()=>ae()},{id:`other`,label:()=>v()}],X={showSource:{category:`messages`,label:()=>ye(),help:()=>j()},showReport:{category:`messages`,label:()=>N(),help:()=>oe()},copyAssistant:{category:`messages`,label:()=>Ne()},copyUser:{category:`messages`,label:()=>le()},showDelete:{category:`messages`,label:()=>te()},showTools:{category:`messages`,label:()=>A(),help:()=>D()},voiceInput:{category:`composer`,label:()=>re(),help:()=>k()},showUsage:{category:`composer`,label:()=>c(),help:()=>Ue()},autoReadAloud:{category:`composer`,label:()=>De(),help:()=>Me()},showChatAge:{category:`sidebar`,label:()=>x(),help:()=>fe()},notifSound:{category:`notifications`,label:()=>ee(),help:()=>_()},notifSystem:{category:`notifications`,label:()=>ge(),help:()=>me()},replySound:{category:`notifications`,label:()=>ke(),help:()=>o()}};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:()=>Ce()};function ut({prefKey:e,ui:t}){let n=I(B.admin.setUiPrefDefault),r=I(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:Re()}),(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:Ie()}),(0,J.jsx)(U,{value:`off`,children:xe()}),(0,J.jsx)(U,{value:`inherit`,children:Ee()})]})]}),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":u()}),u()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=I(B.me.setDictationShortcut),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!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:[Fe(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?y():r?i():Te()})]}),(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:se()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?P():e?M():be()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=R(B.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=I(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":T()}),T()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:C()}),(0,J.jsx)(`p`,{children:Be()}),(0,J.jsx)(`p`,{children:Ve()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:L(),"aria-label":L(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ve()}):(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:f()}):l?(0,J.jsx)(H,{variant:`secondary`,children:je()}):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:m()}):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:F()})}var pt={sm:()=>Oe(),md:()=>a(),lg:()=>Ae(),xl:()=>_e(),"2xl":()=>d(),"3xl":()=>p()};function mt(){let e=R(B.me.getMe,{host:G}),t=I(B.me.setLocale),n=I(B.me.setTimezone),r=I(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=I(B.me.setMyName),a=Ke(),o=e?.locale??`default`,c=e?.name??``,[u,d]=(0,q.useState)(null),f=u??c,p=f.trim()!==c.trim();async function m(){try{await i({name:f}),d(null),a.success(He())}catch(e){a.error(b(),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:E()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:O(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:de()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(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:ie()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ce()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(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:w()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(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:l()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(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:g()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(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: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:ze()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,By as i,Ct as a,Cy as o,D as s,Ey as c,Fv as l,Fy as u,Hv as d,Iv as f,Jv as p,Lv as ee,My as m,Nv as te,Oy as h,Pv as g,Py as _,Qv as v,Rg as y,Rv as b,St as ne,Sy as re,Ty as ie,Uv as ae,Vv as x,Vy as oe,Xv as se,Yv as ce,ZB as S,_y as le,aV as C,ay as ue,by as de,cy as fe,dy as w,ey as pe,fy as T,gy as me,iy as he,jv as E,jy as ge,ly as _e,my as ve,ny as ye,oV as D,oy as O,py as k,qv as be,ry as xe,sy as A,t as j,ty as M,uy as Se,vy as Ce,wy as we,yy as N,zv as Te,zy as Ee}from"./api-DRlXTl06.js";import{t as De}from"./list-CntaIhDp.js";import{t as P}from"./button-CTuIl1H-.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as Me,Dt as Ne,E as Pe,Ft as Fe,Gn as F,Hn as Ie,It as Le,J as Re,Kn as ze,Lt as Be,Mn as Ve,Mt as He,Nn as Ue,Nt as We,O as I,P as Ge,Pn as Ke,Pt as L,S as qe,Sn as Je,T as Ye,Tn as Xe,U as Ze,W as Qe,Y as $e,_ as et,b as R,bn as tt,d as nt,dn as rt,f as it,g as z,h as B,j as V,jn as H,jt as U,k as at,kn as W,m as ot,p as st,qn as ct,v as G,vn as lt,w as ut,wn as dt,x as K,y as ft,yn as q}from"./index-D48cFy6f.js";var pt=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),mt=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ht=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),J=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function gt({className:e}){return(0,X.jsx)(Be,{asChild:!0,children:(0,X.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":Te(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(Ke,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:r,className:a,onOpen:s}){let u=C(j.projects.renameProject),f=C(j.projects.setProjectColor),p=C(j.projects.moveProject),ee=C(j.projects.deleteProject),m=C(j.projects.createProject),te=Ze(),h=Qe(),[_,v]=(0,Y.useState)(!1),[y,ne]=(0,Y.useState)(t),[ae,se]=(0,Y.useState)(!1),[S,le]=(0,Y.useState)(!1),ue=D(j.projects.projectTreeCount,S?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(He,{onOpenChange:e=>e&&le(!0),children:[(0,X.jsx)(gt,{className:a}),(0,X.jsxs)(We,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(L,{onSelect:()=>s(),children:[(0,X.jsx)(H,{}),` `,re()]}),(0,X.jsxs)(L,{onSelect:()=>{ne(t),v(!0)},children:[(0,X.jsx)(tt,{}),` `,b()]}),(0,X.jsxs)(L,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:k(),label:oe(),placeholder:i(),confirmLabel:Ee()});t&&await m({name:t,parentId:e})})},children:[(0,X.jsx)(ke,{}),` `,k()]}),(0,X.jsxs)(L,{onSelect:()=>se(!0),children:[(0,X.jsx)(mt,{}),` `,ce()]}),(0,X.jsx)(Fe,{children:l()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e,color:null}),"aria-label":g(),children:`✕`}),ot.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void f({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(Le,{}),(0,X.jsxs)(L,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ue?.folders??0,r=ue?.chats??0;await te({title:ie({name:t}),description:n>0?o({folders:n,chats:r}):r>0?we({count:r}):d(),confirmWord:x(),confirmLabel:c(),destructive:!0})&&await ee({projectId:e})})},children:[(0,X.jsx)(rt,{}),` `,x()]})]})]}),(0,X.jsx)(et,{open:_,onOpenChange:v,title:ge(),canSubmit:y.trim().length>0,onSubmit:async()=>{await u({projectId:e,name:y.trim()}),v(!1)},submitLabel:b(),children:(0,X.jsx)(U,{value:y,onChange:e=>ne(e.target.value),autoFocus:!0})}),ae?(0,X.jsx)(st,{open:ae,onOpenChange:se,title:be(),movingFolderId:e,currentId:r,onPick:t=>void p({projectId:e,parentId:t})}):null]})}function Q({chat:e,currentFolderId:t,className:n}){let r=C(j.chats.pinChat),i=C(j.chats.deleteChat),a=C(j.chats.renameChat),o=C(j.chats.setChatSidebar),s=C(j.chats.moveChatToProject),c=Ze(),[l,u]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(e.title??``),[g,_]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(He,{children:[(0,X.jsx)(gt,{className:n}),(0,X.jsxs)(We,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(L,{onSelect:()=>{h(e.title??``),u(!0)},children:[(0,X.jsx)(tt,{}),` `,b()]}),(0,X.jsxs)(L,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(lt,{}):(0,X.jsx)(q,{}),e.pinned?ee():f()]}),(0,X.jsxs)(L,{onSelect:()=>_(!0),children:[(0,X.jsx)(mt,{}),` `,se()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(L,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(Je,{}):(0,X.jsx)(J,{}),e.inSidebar?N():de()]}),(0,X.jsx)(Le,{}),(0,X.jsxs)(L,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:te(),description:d(),confirmLabel:x(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,X.jsx)(rt,{}),` `,x()]})]})]}),(0,X.jsx)(et,{open:l,onOpenChange:u,title:E(),canSubmit:m.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:m.trim()}),u(!1)},submitLabel:b(),children:(0,X.jsx)(U,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),g?(0,X.jsx)(st,{open:g,onOpenChange:_,title:p(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=ct({from:`/project/$projectId`}),t=F(),n=D(j.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:M()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:pe()}),(0,X.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:r()})]}):(0,X.jsx)(Et,{page:n})})}function Et({page:e}){let t=F(),n=Ze(),r=Qe(),s=Ne(),f=C(j.projects.renameProject),p=C(j.projects.setProjectColor),ee=C(j.projects.deleteProject),te=C(j.projects.createProject),h=C(j.projects.moveProject),_=C(j.projects.setProjectSidebar),re=C(j.chats.moveChatToProject),se=C(j.chats.reorderChat),S=C(j.projects.reorderProject),de=D(j.projects.projectTreeCount,{projectId:e.project._id}),[w,pe]=(0,Y.useState)(xt),T=e=>{localStorage.setItem(bt,e),pe(e)},E=D(j.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),O=D(j.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:A}=ze({from:`/project/$projectId`}),M=D(j.projects.listProjects,{}),N=D(j.chatReads.myBusyChats,{}),Te=(0,Y.useMemo)(()=>new Set(N??[]),[N]),Ae=D(j.chatReads.myChatReads,{}),Ie=(0,Y.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:I,picker:Je}=nt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[R,it]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(!1),[H,ct]=(0,Y.useState)(e.project.name),[lt,q]=(0,Y.useState)(!1),[J,gt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>gt(R.trim()),180);return()=>clearTimeout(e)},[R]);let Z=D(j.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),Q=Oe(at(ut,{activationConstraint:{distance:4}}),at(Ye,{activationConstraint:{delay:250,tolerance:8}})),$=(0,Y.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,Y.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=E?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||u()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(M??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=Me(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=Me(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=Me(n(`crumb:`));if(a.length>0)return a;let o=Me(n(`col:`));return o.length>0?o:Pe(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`columns`){for(let e of E?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=O?.chats.find(e=>e._id===t);return e?{list:O.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(w===`columns`){for(let e of E?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:$e(O.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(a)await re({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Re(M??[],t,e)){s.error(ve());return}await h({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await re({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Re(M??[],e,n.parentId)){s.error(ve());return}await h({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await S({projectId:e,...a});return}}catch{s.error(ve())}},[,Lt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=z(e.project),Bt=_t(e.chats,R),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,X.jsxs)(qe,{sensors:Q,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":v(),children:[Vt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(Dt,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:a(),onClick:()=>{_({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)(Ue,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:ne()}),(0,X.jsx)(Ve,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":Ce(),children:[(0,X.jsx)(P,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ce(),title:Ce(),"aria-pressed":w===`cards`,onClick:()=>T(`cards`),children:(0,X.jsx)(ht,{})}),(0,X.jsx)(P,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":le(),title:le(),"aria-pressed":w===`columns`,onClick:()=>T(`columns`),children:(0,X.jsx)(pt,{})}),(0,X.jsx)(P,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":me(),title:me(),"aria-pressed":w===`list`,onClick:()=>T(`list`),children:(0,X.jsx)(De,{})})]}),(0,X.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void I({projectId:e.project._id}),children:[(0,X.jsx)(Xe,{}),fe()]}),(0,X.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:k(),label:oe(),placeholder:i(),confirmLabel:Ee()});t&&await te({name:t,parentId:e.project._id})},children:[(0,X.jsx)(ke,{}),k()]}),(0,X.jsxs)(He,{children:[(0,X.jsx)(Be,{asChild:!0,children:(0,X.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":m(),children:(0,X.jsx)(Ke,{})})}),(0,X.jsxs)(We,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(L,{onSelect:()=>{ct(e.project.name),V(!0)},children:[(0,X.jsx)(tt,{}),` `,b()]}),(0,X.jsxs)(L,{onSelect:()=>q(!0),children:[(0,X.jsx)(mt,{}),` `,ce()]}),(0,X.jsx)(Fe,{children:l()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void p({projectId:e.project._id,color:null}),"aria-label":g(),children:`✕`}),ot.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void p({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(Le,{}),(0,X.jsxs)(L,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=de?.folders??0,a=de?.chats??0;await n({title:ie({name:e.project.name}),description:i>0?o({folders:i,chats:a}):a>0?we({count:a}):d(),confirmWord:x(),confirmLabel:c(),destructive:!0})&&(await ee({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(rt,{}),` `,x()]})]})]})]})]}),w===`columns`?(0,X.jsx)(Ft,{data:E,currentId:e.project._id,busyIds:Te,suppressClick:$,locateChatId:A??null}):w===`list`?(0,X.jsx)(Mt,{data:O,busyIds:Te,suppressClick:$,locateChatId:A??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:Se()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(G,{items:e.children.map(e=>`folder:${e._id}`),strategy:ft,children:e.children.map(t=>(0,X.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:_e()}),e.chats.length>0?(0,X.jsx)(U,{value:R,onChange:e=>it(e.target.value),placeholder:ue(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?xe():ye()}):Bt.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:he({term:R.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(G,{items:Bt.map(e=>`chat:${e._id}`),strategy:K,children:Bt.map(t=>(0,X.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:Te.has(t._id),unread:Ie.has(t._id),locate:t._id===A,suppressClick:$},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ae()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:he({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Ge(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(dt,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||y()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(et,{open:B,onOpenChange:V,title:ge(),canSubmit:H.trim().length>0,onSubmit:async()=>{await f({projectId:e.project._id,name:H.trim()}),V(!1)},submitLabel:b(),children:(0,X.jsx)(U,{value:H,onChange:e=>ct(e.target.value),autoFocus:!0})}),lt?(0,X.jsx)(st,{open:lt,onOpenChange:q,title:be(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void h({projectId:e.project._id,parentId:t})}):null,Je]}),(0,X.jsx)(je,{children:Ct?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,X.jsx)(W,{size:13,"aria-hidden":!0}):(0,X.jsx)(dt,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=I({id:Ct(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=F(),a=R({id:`folder:${e._id}`}),o=I({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":z(e),transform:V.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(W,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?A({count:e.folderCount})+` · `:``,O({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:it(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=C(j.chats.setChatSidebar),n=e.inSidebar?N():de();return(0,X.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(Je,{}):(0,X.jsx)(J,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=F(),c=B(e.color),l=R({id:`chat:${e._id}`}),d=jt(a);return(0,X.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:V.Transform.toString(l.transform),transition:l.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||u()}),e.pinned?(0,X.jsx)(q,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:it(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,title:_(),"aria-label":_()}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:h(),"aria-label":h()}):null]}),(0,X.jsx)(kt,{chat:e}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:S()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=$e(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{items:u.map(e=>`chat:${e._id}`),strategy:K,children:u.map(e=>(0,X.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(G,{items:d.map(e=>`folder:${e._id}`),strategy:K,children:d.map(t=>(0,X.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&$e(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:xe()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=F(),c=R({id:`folder:${e._id}`}),l=I({id:$(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":z(e),transform:V.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?T():w(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(Ae,{size:13}):(0,X.jsx)(Ie,{size:13})}),(0,X.jsx)(W,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=F(),o=R({id:`chat:${e._id}`}),s=jt(r),c=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:V.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||u()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=F(),s=I({id:St(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(G,{items:e.folders.map(e=>`folder:${e._id}`),strategy:K,children:e.folders.map(t=>(0,X.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(G,{items:e.chats.map(e=>`chat:${e._id}`),strategy:K,children:e.chats.map(t=>(0,X.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:ye()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=R({id:`folder:${e._id}`}),o=I({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":z(e),transform:V.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(W,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=R({id:`chat:${e._id}`}),s=jt(r),c=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:V.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||u()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BT as i,CT as a,DT as ee,ET as te,FT as o,GT as s,HT as c,IT as ne,JT as l,KT as u,LT as d,MT as f,NT as p,OT as m,PT as re,QT as h,RT as ie,ST as ae,TT as g,UT as _,VT as v,WT as y,XT as b,YT as x,ZT as S,aV as C,cT as w,dT as T,fT as E,gT as D,gs as O,hT as k,jT as A,kT as j,lT as M,mT as N,oV as P,pT as F,qT as I,t as L,uT as R,wT as oe,zT as z}from"./api-DRlXTl06.js";import{t as B}from"./button-CTuIl1H-.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-D48cFy6f.js";import{t as J}from"./roleDescriptions-CoFSIkRg.js";var Y=t(e(),1),X=n(),Z=[{group:()=>h(),keys:[{key:`traces.read`,label:()=>I()},{key:`traces.read.content`,label:()=>u(),phi:!0},{key:`traces.write`,label:()=>s()}]},{group:()=>S(),keys:[{key:`kpi.read`,label:()=>I()},{key:`kpi.write`,label:()=>s()}]},{group:()=>b(),keys:[{key:`openclaw.query`,label:()=>y()},{key:`anomalies.read`,label:()=>_()},{key:`anomalies.report`,label:()=>c()}]},{group:()=>x(),keys:[{key:`chats.read`,label:()=>I()},{key:`selfheal`,label:()=>i()},{key:`media.repair`,label:()=>z()},{key:`feedback.respond`,label:()=>O()}]},{group:()=>l(),keys:[{key:`admin.manage`,label:()=>v()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=P(L.apiKeys.listRoles,{}),t=C(L.apiKeys.createRole),n=C(L.apiKeys.ensureRolesSeeded),i=C(L.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(L.apiKeys.listRoles,{});r&&e.setQuery(L.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=W(),c=V(),[l,u]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)($),[v,y]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(d(),e)})},[n,c]);let b=e??[];async function x(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:ne({name:e.name}),description:o(),confirmLabel:re()});return}if(v.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];y(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(p(),e)}finally{y(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function S(){try{await t({key:h.key,name:h.name,description:h.description||void 0,permissions:[]}),_($),u(!1)}catch(e){c.error(f(),e)}}let O=e===void 0,I=!O&&b.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[A(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,j()]}),(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:m()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{_($),u(!0)},children:ee()})})]}),O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):I?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(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:oe()}),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?ie({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:b.map(e=>{let t=Q(e.permissions),n=v.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)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,a()]}):(0,X.jsx)(U,{variant:`secondary`,children:ae()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?D():n?k():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:l,onOpenChange:u,title:N(),description:F(),canSubmit:!!(h.key&&h.name),onSubmit:S,submitLabel:E(),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:T()}),(0,X.jsx)(K,{value:h.key,placeholder:R(),onChange:e=>_({...h,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:M()}),(0,X.jsx)(K,{value:h.name,onChange:e=>_({...h,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:w()}),(0,X.jsx)(K,{value:h.description,onChange:e=>_({...h,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,$R as i,AR as a,Az as o,BL as s,Cz as c,D as l,DR as u,Dz as ee,Ez as te,FL as d,FR as f,Fz as p,GL as ne,GR as re,HL as ie,HR as ae,IL as oe,IR as se,JL as ce,JR as le,KL as ue,KR as de,LL as fe,MR as pe,Mz as me,NR as he,Nz as ge,OL as _e,OR as ve,Oz as ye,PL as be,PR as xe,Pz as Se,QR as Ce,RL as we,RR as Te,SR as Ee,Sz as De,Tz as Oe,UL as ke,UR as Ae,VL as je,VR as Me,WL as Ne,WR as Pe,XL as Fe,YL as Ie,YR as m,ZB as Le,ZL as Re,ZR as ze,_R as Be,bR as h,bz as Ve,cR as He,dR as g,ez as Ue,fR as We,gR as Ge,hR as Ke,jR as qe,jz as Je,kR as Ye,kz as Xe,lR as Ze,mR as Qe,nz as $e,oV as et,pR as tt,qL as nt,qR as rt,rV as _,sR as it,t as v,tz as at,uR as y,vR as ot,wz as st,xR as b,xz as ct,yR as lt,zL as ut}from"./api-DRlXTl06.js";import{t as dt}from"./list-CntaIhDp.js";import{t as x}from"./button-CTuIl1H-.js";import{$ as S,Bn as C,Bt as w,Ct as ft,Dn as pt,Dt as mt,Et as T,Q as E,Rt as D,St as ht,Tt as gt,Vn as O,X as k,Z as A,_n as _t,_t as vt,at as yt,bn as bt,bt as xt,dn as St,et as j,gt as Ct,hn as wt,it as Tt,jt as Et,nt as Dt,on as Ot,ot as kt,q as At,rt as jt,tt as Mt,vt as Nt,wt as Pt,xn as Ft,xt as It,yt as Lt,zt as M}from"./index-D48cFy6f.js";import{a as Rt,i as N,n as zt,o as Bt,r as P,t as Vt}from"./table-D0yilGWI.js";import{t as Ht}from"./FilterBar-Of8GWz2N.js";/* empty css */import{a as Ut,c as F,i as I,l as Wt,n as Gt,o as L,r as Kt,s as qt,t as Jt,u as R}from"./TimezoneCombobox-n6rUGOTZ.js";var Yt=l(`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`}]]),Xt=l(`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`}]]),z=t(e(),1),B=n();function V(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 Zt({value:e,onChange:t}){let n=Wt(e),i=(0,z.useMemo)(()=>new Date,[]),[a,o]=(0,z.useState)(()=>({year:n?.year??i.getFullYear(),month:n?.month??i.getMonth()})),[s,c]=(0,z.useState)(!1),l=(0,z.useMemo)(()=>V(r()),[]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(r(),{month:`long`,year:`numeric`}),[]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(r(),{dateStyle:`medium`,timeStyle:`short`}),[]),te=F(a.year,a.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(R(e,n,r,i,a)),ne=(e,t,n)=>{o({year:e,month:t}),p(e,t,n,d,f)},re=e=>{let t=new Date(a.year,a.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},ie=n===null?b():ee.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,B.jsxs)(D,{modal:!0,open:s,onOpenChange:c,children:[(0,B.jsx)(w,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":Ee(),children:[(0,B.jsx)(Yt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,B.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ie})]})}),(0,B.jsxs)(M,{align:`start`,className:`oc-dtp__pop`,children:[(0,B.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":h(),onClick:()=>re(-1),children:(0,B.jsx)(O,{size:15,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(a.year,a.month,1))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":lt(),onClick:()=>re(1),children:(0,B.jsx)(C,{size:15,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),te.map((e,t)=>{let r=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(r?` oc-dtp__day--sel`:``)+(a&&!r?` oc-dtp__day--today`:``),onClick:()=>ne(e.year,e.month,e.day),children:e.day},t)})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,B.jsxs)(k,{value:String(d),onValueChange:e=>p(a.year,a.month,n?.day??i.getDate(),Number(e),f),children:[(0,B.jsx)(S,{size:`sm`,"aria-label":ot(),children:(0,B.jsx)(j,{})}),(0,B.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,B.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,B.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,B.jsxs)(k,{value:String(f),onValueChange:e=>p(a.year,a.month,n?.day??i.getDate(),d,Number(e)),children:[(0,B.jsx)(S,{size:`sm`,"aria-label":Be(),children:(0,B.jsx)(j,{})}),(0,B.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,B.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function H(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Qt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function $t(e){let t=new Map;for(let n of e){let e=H(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 U(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(Qt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(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 tn(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 nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:i,onCursorChange:a,onEventClick:o,footnote:s}){let c=r(),l=(0,z.useMemo)(()=>$t(e),[e]),u=(0,z.useMemo)(()=>en(c),[c]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),te=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),f=new Date,p=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()})},ne=t===`year`?String(n.year):ee.format(new Date(n.year,n.month,1));return(0,B.jsxs)(`div`,{className:`oc-cal`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":y(),onClick:()=>p(-1),children:(0,B.jsx)(O,{})}),(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":Ze(),onClick:()=>p(1),children:(0,B.jsx)(C,{})}),(0,B.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>a({year:f.getFullYear(),month:f.getMonth()}),children:g()})]}),(0,B.jsx)(`span`,{className:`oc-cal__title`,children:ne}),(0,B.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,B.jsx)(x,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>i(`month`),children:tt()}),(0,B.jsx)(x,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>i(`year`),children:We()})]})]}),t===`month`?(0,B.jsx)(an,{cursor:n,byDay:l,weekdays:u,timeFmt:d,now:f,onEventClick:o}):(0,B.jsx)(on,{year:n.year,byDay:l,monthShortFmt:te,now:f,onOpenMonth:e=>{a({year:n.year,month:e}),i(`month`)}}),s?(0,B.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=F(e.year,e.month);return(0,B.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Qt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,B.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,B.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,B.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,B.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,B.jsx)(`span`,{className:`oc-cal__more`,children:He({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,B.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=U(t,e,o),c=F(e,o);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,B.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,B.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,B.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var G={h:36e5,min:6e4,s:1e3,ms:1};function sn(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])*G[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 K(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 q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(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 cn=new Map;function J(e){let t=cn.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 cn.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=q(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 ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=L(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(qt(e)){case`ok`:return(0,B.jsx)(T,{variant:`secondary`,children:f()});case`error`:return(0,B.jsx)(T,{variant:`destructive`,children:he()});case`running`:return(0,B.jsx)(T,{variant:`outline`,children:pe()});case`other`:return(0,B.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=_(v.scheduled.listMyCrons),t=_(v.scheduled.getCronDetail),n=_(v.scheduled.listCronRuns),l=_(v.scheduled.updateCron),Ee=_(v.scheduled.removeCron),Be=_(v.scheduled.runCronNow),h=mt(),He=et(v.me.getMe,{host:At})?.timezone,[g,We]=(0,z.useState)(null),[Ze,tt]=(0,z.useState)(!1),[y,ot]=(0,z.useState)(!1),[b,lt]=(0,z.useState)(null),[C,w]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),[M,F]=(0,z.useState)(null),[Wt,qt]=(0,z.useState)(!1),[R,V]=(0,z.useState)(Gt),[H,Qt]=(0,z.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),$t=e=>{localStorage.setItem(`oc.sched.view`,e),Qt(e)},[U,en]=(0,z.useState)(`month`),[W,an]=(0,z.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,z.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ut(r,R)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,R]),G=(0,z.useMemo)(()=>U===`year`?nn(W.year):tn(W.year,W.month),[U,W]),sn=(0,z.useMemo)(()=>un(on,G.startMs,G.endMs),[on,G]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,z.useCallback)(async()=>{tt(!0),ot(!1);try{We(await e({}))}catch{ot(!0)}finally{tt(!1)}},[e]);(0,z.useEffect)(()=>{q()},[q]);let cn=(0,z.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,z.useRef)(null);(0,z.useEffect)(()=>{g!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[g]);let Y=(0,z.useMemo)(()=>new Intl.DateTimeFormat(r(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{lt(e);try{await t(),h.success(n),await q()}catch(e){h.toast({variant:`error`,title:m({code:dn(e)})})}finally{lt(null)}},Z=(0,z.useRef)(0),Q=(0,z.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;O({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;O({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;O(null),h.toast({variant:`error`,title:m({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;F({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;F(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;F(null),h.toast({variant:`error`,title:m({code:dn(e)})})}},mn=async()=>{if(M===null)return;let e={};if(M.nameDirty&&M.name.trim()===``||M.messageDirty&&M.hasMessage&&M.message.trim()===``){h.toast({variant:`error`,title:be()});return}if(M.nameDirty&&M.name.trim()!==``&&(e.name=M.name.trim()),M.scheduleDirty){if(M.scheduleKind===`cron`&&M.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:M.cronExpr.trim(),...M.tz.trim()===``?{}:{tz:M.tz.trim()}};else if(M.scheduleKind===`every`){let t=Number(M.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[M.everyUnit])})}else if(M.scheduleKind===`at`&&M.at!==``){let t=Date.parse(M.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(M.scheduleDirty&&e.schedule===void 0){h.toast({variant:`error`,title:d()});return}if(M.messageDirty&&M.hasMessage&&M.message.trim()!==``&&(e.message=M.message.trim()),Object.keys(e).length===0){F(null);return}let t=Q.current;qt(!0);try{await l({instanceName:M.instanceName,jobId:M.jobId,patch:e}),h.success(ce()),t===Q.current&&F(null),await q()}catch(e){h.toast({variant:`error`,title:m({code:dn(e)})})}finally{qt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:p()}),(0,B.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":Ge(),children:[(0,B.jsx)(x,{variant:H===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ke(),title:Ke(),"aria-pressed":H===`list`,onClick:()=>$t(`list`),children:(0,B.jsx)(dt,{})}),(0,B.jsx)(x,{variant:H===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Qe(),title:Qe(),"aria-pressed":H===`calendar`,onClick:()=>$t(`calendar`),children:(0,B.jsx)(Yt,{})})]}),(0,B.jsxs)(x,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Ze,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(wt,{size:14,"aria-hidden":!0}),Se()]})]}),g!==null&&hn>0?(0,B.jsxs)(Ht,{q:R.q,onQChange:e=>V(t=>({...t,q:e})),searchPlaceholder:a(),onReset:()=>V(Gt),canReset:Kt(R),children:[(0,B.jsxs)(k,{value:R.state,onValueChange:e=>V(t=>({...t,state:e})),children:[(0,B.jsx)(S,{size:`sm`,className:`w-40`,children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`all`,children:Ye()}),(0,B.jsx)(E,{value:`active`,children:ct()}),(0,B.jsx)(E,{value:`paused`,children:De()}),(0,B.jsx)(E,{value:`auto-disabled`,children:Ve()})]})]}),(0,B.jsxs)(k,{value:R.result,onValueChange:e=>V(t=>({...t,result:e})),children:[(0,B.jsx)(S,{size:`sm`,className:`w-40`,children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`all`,children:ve()}),(0,B.jsx)(E,{value:`ok`,children:f()}),(0,B.jsx)(E,{value:`error`,children:he()}),(0,B.jsx)(E,{value:`running`,children:pe()}),(0,B.jsx)(E,{value:`none`,children:qe()})]})]})]}):null,g===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Ze,children:y?ge():Le()}):H===`calendar`?(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,B.jsx)(rn,{events:sn.events,mode:U,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:K,footnote:it()})]}):(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null,g.map(e=>{let t=e.jobs.filter(e=>Ut(e,R)),n=Kt(R)&&e.jobs.length>0&&t.length===0;return(0,B.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,B.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,B.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:o({code:e.error})}):e.jobs.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):n?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,B.jsxs)(Vt,{children:[(0,B.jsx)(Rt,{children:(0,B.jsxs)(Bt,{children:[(0,B.jsx)(N,{children:ye()}),(0,B.jsx)(N,{children:ee()}),(0,B.jsx)(N,{children:te()}),(0,B.jsx)(N,{children:Oe()}),(0,B.jsx)(N,{children:st()}),(0,B.jsx)(N,{children:se()}),(0,B.jsx)(N,{children:Re()})]})}),(0,B.jsx)(zt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,a=b===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,B.jsxs)(Bt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,B.jsx)(P,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??c()}),(0,B.jsx)(P,{children:(0,B.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,B.jsxs)(P,{className:`whitespace-nowrap`,children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Ct(t.schedule),n=e===null?null:vt(e);return n===null?null:(0,B.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,B.jsx)(P,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,B.jsx)(P,{children:L(t)===`auto-disabled`?(0,B.jsx)(T,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:Ve()}):L(t)===`active`?(0,B.jsx)(T,{variant:`secondary`,children:ct()}):L(t)===`paused`?(0,B.jsx)(T,{variant:`outline`,children:De()}):(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,B.jsxs)(P,{children:[(0,B.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,B.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??$e(),children:xe()}):null]}),(0,B.jsx)(P,{className:`whitespace-nowrap`,children:t.id===null?(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,B.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Ue(),"aria-label":Ue(),disabled:b!==null,onClick:()=>void X(r,async()=>{let n=await Be({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},le()),children:(0,B.jsx)(Ot,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:I(t)===`pause`?i():Ce(),"aria-label":I(t)===`pause`?i():Ce(),disabled:b!==null,onClick:()=>void X(r,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:I(t)===`resume`}}),I(t)===`pause`?rt():de()),children:I(t)===`pause`?(0,B.jsx)(Ft,{size:14,"aria-hidden":!0}):(0,B.jsx)(_t,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Fe(),"aria-label":Fe(),disabled:b!==null,onClick:()=>void pn(e.instanceName,t),children:(0,B.jsx)(bt,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:b!==null,onClick:()=>void ln(e.instanceName,t),children:(0,B.jsx)(Xt,{size:14,"aria-hidden":!0})}):null,o?(0,B.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:ze(),"aria-label":ze(),disabled:b!==null,onClick:()=>w({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,B.jsx)(St,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Je()})]},e.instanceName)}),hn>0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:_e()}):null]}),(0,B.jsx)(Nt,{open:C!==null,onOpenChange:e=>{e||w(null)},children:(0,B.jsxs)(It,{children:[(0,B.jsxs)(Pt,{children:[(0,B.jsx)(gt,{children:Pe()}),(0,B.jsx)(ht,{children:Ae({name:C?.name??``})})]}),(0,B.jsxs)(ft,{children:[(0,B.jsx)(xt,{children:ae()}),(0,B.jsx)(Lt,{onClick:()=>{let e=C;w(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>Ee({instanceName:e.instanceName,jobId:e.jobId}),re())},children:Me()})]})]})}),(0,B.jsx)(Mt,{open:D!==null,onOpenChange:e=>{e||(Z.current++,O(null))},children:(0,B.jsxs)(Dt,{style:{maxWidth:640},children:[(0,B.jsx)(yt,{children:(0,B.jsx)(kt,{children:nt({name:D?.name??``})})}),D?.entries===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):D!==null&&D.entries.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):D===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:D.entries.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,B.jsx)(fn,{status:e.status}),(0,B.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Te({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,B.jsx)(Mt,{open:M!==null,onOpenChange:e=>{e||(Q.current++,F(null))},children:(0,B.jsxs)(Dt,{className:`oc-cronedit`,children:[(0,B.jsxs)(yt,{children:[(0,B.jsx)(kt,{children:ne()}),(0,B.jsx)(jt,{children:Ne()})]}),M===null?null:M.loading?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ye()}),(0,B.jsx)(Et,{value:M.name,maxLength:200,onChange:e=>F({...M,name:e.target.value,nameDirty:!0})})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ke()}),(0,B.jsxs)(k,{value:M.scheduleKind,onValueChange:e=>F({...M,scheduleKind:e,scheduleDirty:!0}),children:[(0,B.jsx)(S,{children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`cron`,children:ie()}),(0,B.jsx)(E,{value:`every`,children:je()}),(0,B.jsx)(E,{value:`at`,children:s()})]})]}),M.scheduleKind===`cron`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(Et,{value:M.cronExpr,onChange:e=>F({...M,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,B.jsx)(Jt,{value:M.tz,onChange:e=>F({...M,tz:e,scheduleDirty:!0}),fallbackTz:He??void 0})]}):M.scheduleKind===`every`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(Et,{type:`number`,min:1,value:M.everyValue,onChange:e=>F({...M,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,B.jsxs)(k,{value:M.everyUnit,onValueChange:e=>F({...M,everyUnit:e,scheduleDirty:!0}),children:[(0,B.jsx)(S,{style:{maxWidth:160},children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`minutes`,children:ut()}),(0,B.jsx)(E,{value:`hours`,children:we()}),(0,B.jsx)(E,{value:`days`,children:fe()})]})]})]}):(0,B.jsx)(Zt,{value:M.at,onChange:e=>F({...M,at:e,scheduleDirty:!0})})]}),M.hasMessage?(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:at()}),(0,B.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:M.message,onChange:e=>F({...M,message:e.target.value,messageDirty:!0})})]}):null]}),(0,B.jsxs)(Tt,{children:[(0,B.jsx)(x,{variant:`ghost`,onClick:()=>F(null),children:ae()}),(0,B.jsxs)(x,{onClick:()=>void mn(),disabled:M===null||M.loading||Wt,children:[Wt?(0,B.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,oe()]})]})]})})]})}export{pn as ScheduledTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AC as i,BA as a,CA as o,CC as s,D as c,DA as l,DC as u,EA as d,EC as f,FA as p,FC as m,GA as h,HA as g,IA as _,IC as v,JA as ee,KA as te,LA as y,LC as b,MC as x,NA as S,NC as ne,OA as re,OC as ie,PA as C,PC as ae,QA as w,RA as oe,RC as se,SA as ce,SC as le,TA as T,TC as E,UA as D,VA as O,WA as k,XA as A,YA as ue,ZA as de,_A as j,_C as fe,aC as pe,aV as M,bA as me,bC as he,ba as ge,cC as _e,dC as ve,ej as ye,fC as be,gA as xe,gC as Se,hA as Ce,hC as we,iC as Te,jC as Ee,kC as De,lC as Oe,mA as N,mC as ke,nC as P,nj as Ae,oC as je,oV as F,pC as Me,qA as Ne,rC as Pe,rj as Fe,sC as Ie,t as I,tC as Le,tj as Re,uC as ze,vA as Be,vC as Ve,wA as He,wC as Ue,xA as We,xC as Ge,xa as Ke,yA as qe,yC as Je,ya as Ye,zA as Xe}from"./api-DRlXTl06.js";import{t as Ze}from"./x-BM-3QiyY.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-KQ0HdNTL.js";import{t as z}from"./button-CTuIl1H-.js";import{$ as B,Et as V,Gn as et,H as tt,In as nt,Kn as rt,Mn as it,Nn as at,On as ot,Q as H,Un as st,X as U,Z as W,a as ct,at as lt,ct as G,et as K,i as ut,lt as dt,nt as ft,o as pt,ot as mt,q as ht,rt as gt,s as _t,tt as vt}from"./index-D48cFy6f.js";import{n as yt}from"./TimeRangePicker-Cq_PGNzt.js";import{t as bt}from"./FilterBar-Of8GWz2N.js";import{t as xt}from"./AdvancedFilter-DhMwg7nB.js";import{t as St}from"./DataTableShell-C0MSDiic.js";var Ct=c(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?oe():n===`agent`?`${y()} - ${r}`:e}function Tt(){let e=F(I.me.getMe,{host:ht})?.role===`admin`,t=F(I.deliveryTiming.getDeliveryStatus,{}),n=M(I.deliveryTiming.startDeliveryRecord),i=M(I.deliveryTiming.stopDeliveryRecord),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:Fe()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()})]}),e?(0,J.jsx)(z,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?ye():Re()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:r()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:w({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?ue():A()})}),a?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=F(I.deliveryTiming.listDeliverySessions,{}),n=M(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:m}=yt(c),v=c.to===`now`?1/0:m,y=r.trim()!==``||o!==`all`||c!==Y,b=()=>{i(``),s(`all`),l(Y)},x=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=v).map(e=>({...e,_id:e.sessionId}))},[t,r,o,f,v]),S=e=>{let t=new Set((x??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:Ne(),timeRange:c,onTimeRangeChange:l,onReset:b,canReset:y,children:(0,J.jsxs)(U,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:`all`,children:te()}),(0,J.jsx)(H,{value:`active`,children:h()}),(0,J.jsx)(H,{value:`stopped`,children:k()})]})]})}),(0,J.jsx)(St,{title:ee(),rows:x,emptyHint:Ce(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?p():_(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:D(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:g(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:O(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:a(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Xe(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:h()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:k()})}],rowActions:e?e=>[{label:C(),variant:`destructive`,onSelect:()=>S([e.sessionId])}]:void 0,bulkActions:e?[{label:C(),variant:`destructive`,onSelect:e=>S(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=F(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(tt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:de()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,N()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(st,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?xe():j()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:d()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:T()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:He()})]})}),(0,J.jsxs)(`tbody`,{children:[i(o(),r.bridge),i(ce(),r.A),i(We(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:qe()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Ke()},{value:`principalType`,label:ge()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ye()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=rt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,o=e.principalType??Q,c=e.direction??Q,d=e.roleKey??Q,p=e.q??``,h=e.correlationId,g=ut(e.from,e.to),_=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:ee,to:te}=yt(g),[y,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),oe=e=>void t({search:t=>({...t,limit:e})}),ce=e=>void t({search:t=>({...t,kind:e})}),T=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,...pt(e)})}),de=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),j=F(I.observability.listEvents,{limit:n}),M=F(I.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...h?{correlationId:h}:{},filter:{q:p||void 0,from:ee,to:te,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:c===Q?void 0:c,roleKey:d===Q?void 0:d,advanced:_.length>0?_:void 0}}),me=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),ge=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),ye=p!==``||a!==Q||o!==Q||c!==Q||d!==Q||_.length>0||g.kind!==`relative`||g.from!==Nt.from;function xe(){t({search:{limit:100,kind:`all`},replace:!0})}let Ce=y?j?.filter(e=>e.correlationId===y):M,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:N,onValueChange:e=>P(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ot,{size:13,"aria-hidden":!0}),re()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),l()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),(0,J.jsx)(`strong`,{children:b()}),v(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,J.jsxs)(bt,{q:p,onQChange:T,searchPlaceholder:ae(),timeRange:g,onTimeRangeChange:ue,onReset:xe,canReset:ye,children:[(0,J.jsxs)(U,{value:a,onValueChange:D,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ne()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:x()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:o,onValueChange:O,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:Ee()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:i()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:k,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:De()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:ie()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:d,onValueChange:A,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:u()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:f()}),ge.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:r===Z?``:r,placeholder:E(),"aria-label":E(),onChange:e=>{let t=e.target.value.trim();ce(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:me.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>oe(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(K,{})}),(0,J.jsx)(W,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:Ue({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:_,onChange:de}),y?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:s(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[le(),(0,J.jsx)(`code`,{children:$(y)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:Ge()})]})}):null,(0,J.jsx)(St,{title:he(),rows:Ce,emptyHint:y?Je():Ve(),columns:[{header:fe(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:Se(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:we(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":ke(),children:`✓`})}},{header:Me(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(V,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:be(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ve(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ze(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Oe(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:_e(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Ie(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:je(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:pe(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:Te()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:C,onClose:()=>w(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ft,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(mt,{className:`oc-traces__meta-title`,children:[Pe(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:P()})]}),(0,J.jsx)(gt,{children:Le()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,Ai as i,Bi as a,Ci as o,Di as s,Dr as c,Ei as ee,Fi as l,Ii as u,Ld as te,Li as d,Mi as f,Ni as p,Oi as m,Pi as h,Pk as g,Ri as _,Si as v,Ti as y,ZB as b,_i as x,_r as S,aV as C,ar as ne,bi as re,br as ie,cp as w,cr as T,dr as ae,fr as oe,gi as E,gr as se,ji as ce,ki as D,oV as O,or as le,pr as k,qn as ue,rV as de,sr as fe,t as A,ur as pe,vi as me,vr as j,wi as M,xi as N,yi as P,yr as F,zd as I,zi as L}from"./api-DRlXTl06.js";import{i as R,n as z,r as he,t as ge}from"./tabs-KQ0HdNTL.js";import{t as B}from"./button-CTuIl1H-.js";import{$ as V,$t as H,Cn as _e,Et as U,Gn as ve,Kn as ye,Q as W,Wn as be,X as G,Z as K,an as xe,en as Se,et as q,in as J,nn as Ce,q as we,rn as Y,sn as Te,tn as Ee,ut as X}from"./index-D48cFy6f.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>p()],[`fr-FR`,()=>ie()],[`en-US`,()=>F()],[`en-GB`,()=>j()],[`de-DE`,()=>S()],[`es-ES`,()=>se()]],Oe=[[`0.75`,()=>ce()],[`1`,()=>i()],[`1.25`,()=>D()],[`1.5`,()=>m()]],$=0;function ke({instance:e}){let t=C(A.admin.upsertInstanceConfig),n=e.config??{},i={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},[a,c]=(0,Z.useState)(i),[u,d]=(0,Z.useState)(`idle`),[p,m]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),v=de(A.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{c({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}),d(`idle`)},[e._id]);let b=a.enabled!==i.enabled||a.engine!==i.engine||a.lang!==i.lang||a.rate!==i.rate||a.autoRead!==i.autoRead;async function x(){d(`saving`);try{let n={...e.config??{}};n.voiceEnabled=a.enabled,a.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,a.lang===`auto`?delete n.voiceLang:n.voiceLang=a.lang;let r=Number.parseFloat(a.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,a.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),d(`idle`)}catch{d(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:a.enabled,onCheckedChange:e=>c({...a,enabled:e===!0}),"aria-label":l()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,Q.jsxs)(G,{value:a.engine,onValueChange:e=>c({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":T(),children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(W,{value:`browser`,children:fe()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:le()})]})]})]}),a.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()}):null,a.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,Q.jsxs)(G,{value:a.lang,onValueChange:e=>c({...a,lang:e}),disabled:!a.enabled,children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":h(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,Q.jsxs)(G,{value:a.rate,onValueChange:e=>c({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":f(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),a.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:a.autoRead,onCheckedChange:e=>c({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":s()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(B,{size:`sm`,disabled:!b||u===`saving`,onClick:()=>void x(),children:u===`saving`?w():I()}),(0,Q.jsx)(B,{variant:`outline`,size:`sm`,disabled:!a.enabled||p,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(_(!1),J(),Y(),a.engine!==`gateway`){Ce(o(),{lang:Ee(a.lang,r()),rate:t});return}m(!0),v({instanceName:e.name,text:o()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&_(!0)}).finally(()=>m(!1))},children:p?w():y()}),(0,Q.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{$++,m(!1),J(),Y()},children:M()})]}),u===`error`||g?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g?ue():te()}):null]})}function Ae({stt:e}){let t=O(A.me.getMe,{host:we}),n=C(A.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:N()}),(0,Q.jsx)(U,{variant:e?`secondary`:`outline`,children:e?x():E()}),(0,Q.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?oe():ae()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]})}function je(){let e=O(A.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>H(),[]),{section:r}=ye({from:`/settings/voice`}),i=ve({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?L():_()}),(0,Q.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?d():u()})]}),(0,Q.jsxs)(ge,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(he,{className:`w-full`,children:[(0,Q.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),pe()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),N()]}),(0,Q.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),P()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(z,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(z,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:P()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=C(A.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":g()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]})]})}export{je as VoiceTab};