@lacneu/atrium 0.84.13 → 0.84.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/assets/{AccessTab-Ux9_A333.js → AccessTab-ceA9l4yI.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-Cb3K_VAC.js → AdvancedFilter-wBSRkhRK.js} +1 -1
  3. package/dist/assets/AgentFilesTab-btnz-Ng6.js +3 -0
  4. package/dist/assets/AnomaliesTab-CLaRj_GA.js +1 -0
  5. package/dist/assets/AuditTab-BZkm-14b.js +1 -0
  6. package/dist/assets/BridgeTab-BnH0wGiL.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-5foJ7HV2.js +1 -0
  8. package/dist/assets/{DataTableShell-zI9sCnce.js → DataTableShell-C0KlQvs4.js} +1 -1
  9. package/dist/assets/{DetailChips-DppLe33N.js → DetailChips-MAOvjTTm.js} +1 -1
  10. package/dist/assets/FeedbacksTab-DPIF7khV.js +1 -0
  11. package/dist/assets/{FieldLabel-BvZBcdkv.js → FieldLabel-DOCoCCdx.js} +1 -1
  12. package/dist/assets/FilesTab-bRQzcW-l.js +1 -0
  13. package/dist/assets/{FilterBar-CO_K6N4P.js → FilterBar-ZbtR7jVf.js} +1 -1
  14. package/dist/assets/GroupsTab-Dehl8FOm.js +1 -0
  15. package/dist/assets/InstancesTab--JDm2YQf.js +1 -0
  16. package/dist/assets/{IntegrationsTab-Cl2LvB7o.js → IntegrationsTab-CbE7g68k.js} +1 -1
  17. package/dist/assets/KpiTab-D4zOf8Sy.js +1 -0
  18. package/dist/assets/PreferencesTab-CRc2vEwg.js +1 -0
  19. package/dist/assets/ProjectPage-CvCcvXGa.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-ex9W_HRR.js +4 -0
  21. package/dist/assets/RolesTab-Ch3m2dkJ.js +1 -0
  22. package/dist/assets/ScheduledTab-LmLNufgA.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-uIi1Kuzv.js +1 -0
  24. package/dist/assets/{SubAgentReportsTab-D9IgsL33.js → SubAgentReportsTab-B5ou_Pk8.js} +1 -1
  25. package/dist/assets/ThemeShowroom-BeZ8bcqk.js +1 -0
  26. package/dist/assets/{TimeRangePicker-kPz5x0z6.js → TimeRangePicker-COejcd-8.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-DlnrjtgN.js → TimezoneCombobox-rotjKmob.js} +1 -1
  28. package/dist/assets/TracesTab-BJbCCJBI.js +1 -0
  29. package/dist/assets/UsersTab-C8U_LpD0.js +1 -0
  30. package/dist/assets/VoiceTab-CpDzYkp9.js +1 -0
  31. package/dist/assets/{api-2YAlX4o7.js → api-C-KgnMk9.js} +5 -5
  32. package/dist/assets/{button-CiAqEDbj.js → button-zmyXdvCj.js} +1 -1
  33. package/dist/assets/{card-BwlnvYU_.js → card-D7ceowfW.js} +1 -1
  34. package/dist/assets/chevrons-up-down-_d7Q2udT.js +1 -0
  35. package/dist/assets/{compatView-X-MUzsH-.js → compatView-foBv_TWJ.js} +1 -1
  36. package/dist/assets/{dispatchErrorInfo-CbdAfGpC.js → dispatchErrorInfo-Bzob_I-0.js} +1 -1
  37. package/dist/assets/{dist-CMls2LsU.js → dist-D4CJrMDC.js} +1 -1
  38. package/dist/assets/{dist-BIgQ232F.js → dist-lC4lznAg.js} +1 -1
  39. package/dist/assets/{highlighted-body-OFNGDK62-DuyrUXn3.js → highlighted-body-OFNGDK62-C9tAQakZ.js} +1 -1
  40. package/dist/assets/index-aphTfXVu.js +324 -0
  41. package/dist/assets/{list-CqoYNGdr.js → list-CK-jA3e7.js} +1 -1
  42. package/dist/assets/mermaid-GHXKKRXX-Bvq-UZTS.js +1 -0
  43. package/dist/assets/{pdf-LQqxoBM_.js → pdf-G9rcoDf3.js} +1 -1
  44. package/dist/assets/roleDescriptions-DH7vqm1n.js +1 -0
  45. package/dist/assets/{table-B1EQZE2q.js → table-DrtF5Lzg.js} +1 -1
  46. package/dist/assets/{tabs-D1yskdk7.js → tabs-Byk5wmtG.js} +1 -1
  47. package/dist/assets/x-Y8g-pkAL.js +1 -0
  48. package/dist/index.html +6 -6
  49. package/package.json +1 -1
  50. package/dist/assets/AgentFilesTab-Bm0RJBVj.js +0 -3
  51. package/dist/assets/AnomaliesTab-34k3A72j.js +0 -1
  52. package/dist/assets/AuditTab-DGEMnWZK.js +0 -1
  53. package/dist/assets/BridgeTab-CCi97G2S.js +0 -1
  54. package/dist/assets/ChatDefaultsTab-2pwvVUqY.js +0 -1
  55. package/dist/assets/FeedbacksTab-BAD3eP9F.js +0 -1
  56. package/dist/assets/FilesTab-XSh9OAlN.js +0 -1
  57. package/dist/assets/GroupsTab-CMMyN_rP.js +0 -1
  58. package/dist/assets/InstancesTab-m3vKgCQM.js +0 -1
  59. package/dist/assets/KpiTab-zniTnWkU.js +0 -1
  60. package/dist/assets/PreferencesTab-GjW05axK.js +0 -1
  61. package/dist/assets/ProjectPage-BYgvQTn1.js +0 -1
  62. package/dist/assets/PromptInjectionsTab-D5yVyQ35.js +0 -4
  63. package/dist/assets/RolesTab-JEZMwD4P.js +0 -1
  64. package/dist/assets/ScheduledTab-Dc1yemHV.js +0 -1
  65. package/dist/assets/ServiceAccountsTab-DId9VSeG.js +0 -1
  66. package/dist/assets/ThemeShowroom-BrjmW-Cj.js +0 -1
  67. package/dist/assets/TracesTab-BQpJGSAs.js +0 -1
  68. package/dist/assets/UsersTab-qmxtsUET.js +0 -1
  69. package/dist/assets/VoiceTab-W9PQ2x2e.js +0 -1
  70. package/dist/assets/chevrons-up-down-cL5vVQyN.js +0 -1
  71. package/dist/assets/index-ComRJ6Fm.js +0 -324
  72. package/dist/assets/mermaid-GHXKKRXX-BAOD4Vx4.js +0 -1
  73. package/dist/assets/roleDescriptions-B61uyDOF.js +0 -1
  74. package/dist/assets/x-BbEH3fbU.js +0 -1
@@ -0,0 +1 @@
1
+ import{_T as e,gT as t,hT as n,mT as r,pT as i}from"./api-C-KgnMk9.js";var a={pending:e,user:t,admin:n,observer:r,agent:i};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-2YAlX4o7.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-C-KgnMk9.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-2YAlX4o7.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-ComRJ6Fm.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-C-KgnMk9.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-aphTfXVu.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-C-KgnMk9.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-ComRJ6Fm.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-aphTfXVu.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/api-2YAlX4o7.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-CMls2LsU.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-BIgQ232F.js">
70
- <link rel="modulepreload" crossorigin href="/assets/x-BbEH3fbU.js">
71
- <link rel="modulepreload" crossorigin href="/assets/button-CiAqEDbj.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/api-C-KgnMk9.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-D4CJrMDC.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-lC4lznAg.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/x-Y8g-pkAL.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/button-zmyXdvCj.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.13",
3
+ "version": "0.84.14",
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{$d as r,$o as i,Co as a,Do as o,Eo as s,GB as c,Gd as l,Go as u,JM as d,Jd as f,Jo as p,Kd as m,Ko as h,Oo as g,QB as _,Qd as v,Qo as y,So as b,To as x,UB as S,Wd as C,Wo as w,Xd as T,Xo as E,YB as D,Yd as O,Yo as k,ZB as A,Zd as j,Zo as M,_f as N,af as P,an as F,ap as I,as as L,cf as R,cs as z,df as ee,ef as te,es as B,ff as ne,gf as V,hf as H,if as U,is as re,lf as ie,ls as ae,mf as oe,nf as se,ns as ce,of as le,os as ue,pf as de,qd as fe,qo as pe,rf as me,rp as he,rs as ge,sf as _e,ss as ve,t as W,tf as ye,ts as be,uf as xe,us as Se,vf as Ce,wo as we,yf as Te}from"./api-2YAlX4o7.js";import{t as G}from"./button-CiAqEDbj.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-ComRJ6Fm.js";import{n as qe,t as Je}from"./curation-CQksaIbm.js";import{a as Ye}from"./compatView-X-MUzsH-.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=_(W.me.getMe,{host:Be}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=_(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=_(W.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=_(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,J.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[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=D(W.agentFiles.listAgentFiles),[m,h]=(0,J.useState)({status:`idle`}),g=f?.instanceName??null,v=f?.agentId??null,y=_(W.compat.forInstance,n&&g!==null?{instanceName:g}:`skip`),b=n&&g!==null?De(y,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,C=(0,J.useCallback)(async()=>{if(!(g===null||v===null)){h({status:`loading`});try{h({status:`done`,files:(await p({instanceName:g,agentId:v})).files})}catch(e){h({status:`error`,dashboardAbsent:tt(e)})}}},[p,g,v]);(0,J.useEffect)(()=>{x===!1&&C()},[C,x]);let[w,T]=(0,J.useState)(null),E=_(W.agentFileCuration.listCurations,t&&g!==null&&v!==null?{instanceName:g,agentId:v}:`skip`),O=_(W.agentFileCuration.curationSettings,t&&g!==null?{instanceName:g}:`skip`),k=D(W.agentFileCuration.requestCuration),[A,j]=(0,J.useState)(null),[M,P]=(0,J.useState)(null),{toast:I}=K(),z=(0,J.useMemo)(()=>{let e=new Map;for(let t of E??[])e.has(t.name)||e.set(t.name,t);return e},[E]),te=(0,J.useCallback)(async e=>{if(!(g===null||v===null)){j(e);try{let t=await k({instanceName:g,agentId:v,name:e,trigger:`manual`});t.ok?I({title:ve(),variant:`success`}):I({title:ue({reason:t.reason??`unknown`}),variant:`error`})}catch{I({title:L(),variant:`error`})}finally{j(null)}}},[k,g,v,I]),B=c(),U=(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:S()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ne,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":Ce(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:(r??[]).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":N(),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:V()})]}),f===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,Ye(b.gatewayVersion,b.provider)]}):m.status===`loading`||m.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):m.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[m.dashboardAbsent?F():oe(),` `,!m.dashboardAbsent&&(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:he()})]}):m.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:m.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:de()}):(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:ee({pct:U.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":xe()}):(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:()=>T(e),children:t?R():_e()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Je.includes(e.name),size:e.size??0,budget:O?.budgetChars??null,enabled:O?.enabled??!1,curation:z.get(e.name)??null,inFlight:A===e.name,onCurate:()=>void te(e.name),onReview:e=>P(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:X($e(m.files),B),total:X(Xe,B),pct:U.format(Qe($e(m.files)))})})]}),w&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:w.name,isAdmin:t,onClose:()=>T(null),onSaved:()=>void C()}):null,M?(0,Q.jsx)(ot,{curationId:M,onClose:()=>P(null),onApplied:()=>{P(null),C()}}):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:ae()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:z()}):e&&r&&n!==null&&qe(t,n)?(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:Se()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:o}){let s=D(W.agentFiles.getAgentFile),u=D(W.agentFiles.setAgentFile),p=K(),[h,g]=(0,J.useState)(null),[_,y]=(0,J.useState)(!1),[b,x]=(0,J.useState)(``),[w,E]=(0,J.useState)(!1),[k,A]=(0,J.useState)(!1),[M,N]=(0,J.useState)(!1),[F,L]=(0,J.useState)(!1),R=(0,J.useCallback)(async r=>{y(!1);try{let i=await s({instanceName:e,agentId:t,name:n});g({content:i.content,updatedAtMs:i.updatedAtMs}),r||x(i.content),N(!1)}catch{y(!0)}},[s,e,t,n]);(0,J.useEffect)(()=>{R(!1)},[R]);async function z(){if(h!==null){A(!0),L(!1);try{await u({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:h.updatedAtMs??void 0}),p.success(te({name:n})),o(),await R(!1)}catch(e){nt(e)?N(!0):L(!0)}finally{A(!1)}}}let ee=h!==null&&b!==h.content,B=(0,J.useMemo)(()=>h===null?null:et(h.content,b),[h,b]),ne=b.length>Y,V=c(),H=(0,J.useMemo)(()=>new Intl.NumberFormat(V),[V]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:le({name:n})}),(0,Q.jsxs)(Ve,{children:[P({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,U()]})]})]}),_?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void R(!1),children:he()})]}):h===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!i,spellCheck:!1,onChange:e=>x(e.target.value),"aria-label":le({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:me()}),M?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void R(!0),children:T()})]}):null,F?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:r()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:se({count:H.format(b.length),max:H.format(Y)})}),i?(0,Q.jsx)(G,{size:`sm`,disabled:!ee||k||M,onClick:()=>E(!0),children:k?I():ye()}):null]})]}),(0,Q.jsx)(Ue,{open:w,onOpenChange:E,children:(0,Q.jsxs)(Ge,{children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Me,{children:O({name:n})}),(0,Q.jsx)(je,{children:f({agent:t})})]}),B?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:fe({added:B.added,removed:B.removed})}),B.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:m()}),B.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,B.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:l()}),B.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:d()}),(0,Q.jsx)(Ke,{onClick:()=>void z(),children:C()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=_(W.agentFileCuration.getProposal,{curationId:e}),l=D(W.agentFileCuration.approveCuration),d=A(W.agentFileCuration.rejectCuration),{toast:f}=K(),[m,v]=(0,J.useState)(null),[C,T]=(0,J.useState)(!1),[O,j]=(0,J.useState)(``),N=c(),P=(0,J.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function F(){v(`approve`);try{let t=await l({curationId:e});t.ok?(f({title:re(),variant:`success`}),n()):f({title:t.reason===`conflict`?ce():be({reason:t.reason??`unknown`}),variant:`error`})}catch{f({title:L(),variant:`error`})}finally{v(null)}}async function R(n){v(`reject`);try{let r=O.trim();(await d({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?f({title:n?a():ge(),variant:`success`}):f({title:y(),variant:`error`}),t()}catch{f({title:L(),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:r?B({name:r.name}):S()}),(0,Q.jsx)(Ve,{children:i()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[M({before:X(r.beforeSize,N),after:X(r.proposedSize,N)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,E()]}):null]}),P?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:k({added:P.added,removed:P.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:b({feedback:r.feedback})}):null,P&&P.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:w()}),(0,Q.jsx)(`ul`,{children:P.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:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:p()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),C?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:g()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:o(),value:O,onChange:e=>j(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`ghost`,onClick:()=>T(!1),disabled:m!==null,children:s()}),(0,Q.jsx)(G,{variant:`outline`,onClick:()=>void R(!1),disabled:m!==null,children:m===`reject`?I():x()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void R(!0),disabled:m!==null,children:m===`reject`?I():we()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`outline`,onClick:()=>T(!0),disabled:m!==null||r==null,children:pe()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void F(),disabled:m!==null||r==null,children:m===`approve`?I():h()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as ee,Cw as te,Dw as a,Ew as ne,Fw as re,Gw as ie,Hw as o,Iw as s,Jw as ae,Kw as oe,Lw as se,Mw as c,Nw as ce,Ow as le,Pw as ue,QB as l,Qw as de,Rw as fe,Sw as pe,Tw as u,Uw as me,Vw as he,Ww as ge,Xw as _e,Yw as d,ZB as f,Zw as p,_w as m,bw as ve,cw as h,dw as g,eT as _,fw as v,gw as ye,hw as be,jw as xe,kw as Se,lw as y,mw as b,ow as x,pw as S,qw as C,sw as w,t as T,tT as E,uw as D,vw as O,ww as k,xw as A,yw as j,zw as Ce}from"./api-2YAlX4o7.js";import{$ as M,Dt as we,Et as N,Gn as P,Kn as Te,Q as F,U as Ee,X as I,Z as L,at as R,ct as z,et as B,i as De,nt as V,o as Oe,ot as H,q as ke,tt as U}from"./index-ComRJ6Fm.js";import{n as Ae}from"./TimeRangePicker-kPz5x0z6.js";import{t as je}from"./FilterBar-CO_K6N4P.js";import{t as Me}from"./DataTableShell-zI9sCnce.js";import{t as W}from"./dispatchErrorInfo-CbdAfGpC.js";var G=t(e(),1),K=n(),q=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?E():e===`acknowledged`?_():r()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,J=`all`;function Y(){let e=Te({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,r=e.status===J?q:e.status,h=e.severity??q,g=e.kind??q,[_,v]=(0,G.useState)(q),y=De(e.from,e.to),{from:x,to:S}=Ae(y),w=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),E=e=>void t({search:t=>({...t,status:e===q?J:e})}),D=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),V=e=>void t({search:t=>({...t,...Oe(e)})}),H=Ee(),U=we(),W=f(T.anomalies.resolveAnomaly),Y=(l(T.me.getMe,{host:ke})?.permissions??[]).includes(`admin.manage`),X=l(T.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:x,to:S,anomalyStatus:r===q?void 0:r,severity:h===q?void 0:h,source:_===q?void 0:_,kind:g===q?void 0:g}}),Z=(0,G.useMemo)(()=>{let e=new Set;for(let t of X??[])e.add(t.kind);return[...e].sort()},[X]),Q=n!==``||r!==`open`||h!==q||_!==q||g!==q||y.kind!==`relative`||y.from!==Le.from;function Ue(){v(q),t({search:{status:`open`},replace:!0})}async function We(e){if(await H({title:de(),description:(0,K.jsxs)(K.Fragment,{children:[p(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,_e(),` `,(0,K.jsx)(`strong`,{children:d()}),`.`,` `,ae()]}),confirmLabel:C()}))try{await W({anomalyId:e._id,status:`resolved`}),U.success(oe(),e.kind)}catch(e){U.error(ie(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),U.success(ge(),e.kind)}catch(e){U.error(me(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,K.jsx)(`strong`,{children:he()}),` `,ee(),` `,(0,K.jsx)(`strong`,{children:Ce()}),` `,fe(),` `,(0,K.jsx)(`strong`,{children:se()}),` `,s(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:re()})]}),(0,K.jsxs)(je,{q:n,onQChange:w,searchPlaceholder:ue(),timeRange:y,onTimeRangeChange:V,onReset:Ue,canReset:Q,children:[(0,K.jsxs)(I,{value:r,onValueChange:E,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:ce()}),Ne.map(e=>(0,K.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,K.jsxs)(I,{value:h,onValueChange:D,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:c()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:le()}),Fe.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:_,onValueChange:v,children:[(0,K.jsx)(M,{size:`sm`,className:`w-32`,children:(0,K.jsx)(B,{placeholder:a()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:ne()}),Ie.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]}),(0,K.jsxs)(I,{value:g,onValueChange:R,children:[(0,K.jsx)(M,{size:`sm`,className:`w-36`,children:(0,K.jsx)(B,{placeholder:u()})}),(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{value:q,children:k()}),Z.map(e=>(0,K.jsx)(F,{value:e,children:e},e))]})]})]}),(0,K.jsx)(Me,{title:te(),rows:X,emptyHint:r===`open`?pe():A(),rowActions:e=>Y&&e.status===`open`?[{label:ve(),onSelect:()=>void We(e)},{label:j(),onSelect:()=>void Ge(e)}]:[],columns:[{header:O(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:u(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:xe(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,K.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:Se({when:z(e.firstAt)}),children:i({count:String(e.occurrenceCount)})}):(0,K.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:c(),cell:e=>(0,K.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:m(),cell:e=>(0,K.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:a(),cell:e=>(0,K.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ye(),cell:e=>(0,K.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,K.jsx)($,{row:e})]}),sort:e=>e.message},{header:be(),cell:e=>(0,K.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:b(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var X=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Z(e){if(!X.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=Q(e);return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,S()]}):null]})}let n=Z(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,K.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,S()]})}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,S()]}):null]})}function $({row:e}){let[t,n]=(0,G.useState)(!1),r=l(T.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[v(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,K.jsx)(U,{open:t,onOpenChange:n,children:(0,K.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,K.jsx)(R,{children:(0,K.jsx)(H,{children:g()})}),r===void 0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:D()}):r.length===0?(0,K.jsx)(`p`,{className:`oc-traces__muted`,children:y()}):(0,K.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,K.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,K.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,K.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,K.jsx)(N,{variant:`destructive`,children:h()}):e===`acknowledged`?(0,K.jsx)(N,{variant:`secondary`,children:w()}):(0,K.jsx)(N,{variant:`outline`,children:x()})}function He(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,Ca as i,JT as a,QB as o,QT as s,Sa as c,XT as l,YT as u,ZT as d,aE as f,ba as p,eE as m,iE as h,nE as g,oE as _,qT as v,rE as y,sE as b,t as x,tE as S,wa as C,xa as w,ya as T}from"./api-2YAlX4o7.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-ComRJ6Fm.js";import{n as ee}from"./TimeRangePicker-kPz5x0z6.js";import{t as z}from"./FilterBar-CO_K6N4P.js";import{t as B}from"./AdvancedFilter-Cb3K_VAC.js";import{t as V}from"./DataTableShell-zI9sCnce.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:C()},{value:`realLabel`,label:i()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:w()},{value:`resource`,label:p()},{value:`resourceId`,label:T()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,c=e.impersonated??G,p=e.resource??G,C=F(e.from,e.to),w=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:I}=ee(C),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=o(x.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:i===G?void 0:i,resource:p===G?void 0:p,impersonated:c===G?void 0:c===`yes`,advanced:w.length>0?w:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||c!==G||p!==G||w.length>0||C.kind!==`relative`||C.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[b(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:f(),timeRange:C,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:h()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:y()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:c,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:g()}),(0,U.jsx)(k,{value:`yes`,children:S()}),(0,U.jsx)(k,{value:`no`,children:m()})]})]}),(0,U.jsxs)(A,{value:p,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:r()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:s()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:w,onChange:Q}),(0,U.jsx)(V,{title:d(),rows:$,emptyHint:l(),columns:[{header:u(),cell:e=>N(e.at),sort:e=>e.at},{header:h(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:r(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,Ab as a,Ad as o,Bb as s,Cd as c,Cx as l,D as u,Db as d,Dd as f,Eb as p,Ed as m,Fb as h,Gb as g,Gi as _,Hb as v,Hi as y,Ib as ee,Jb as te,Ji as ne,Kb as re,Kx as ie,Lb as ae,Mb as oe,Md as se,Nb as ce,Nd as le,Ob as ue,Od as de,Pb as fe,QB as b,Qb as pe,Qx as me,Rb as he,Sd as ge,Sx as _e,Td as ve,Ub as ye,Ui as be,Vb as xe,Vi as Se,Wb as Ce,Wi as we,Xb as Te,Xx as Ee,YB as De,Yb as Oe,ZB as ke,Zb as Ae,Zx as je,_x as Me,aS as Ne,ax as Pe,bx as Fe,cx as Ie,dx as Le,eS as Re,ex as ze,fx as Be,gd as Ve,gx as He,hx as Ue,ix as We,j as Ge,jb as Ke,jd as qe,kb as Je,kd as Ye,lx as Xe,mx as Ze,nS as Qe,nx as $e,oS as et,on as tt,ox as nt,px as rt,qb as it,qx as at,rS as ot,rx as st,sx as ct,t as x,tS as lt,tx as S,ux as ut,vx as dt,wd as ft,wx as pt,xd as mt,xx as ht,yx as gt,zb as _t}from"./api-2YAlX4o7.js";import{t as vt}from"./chevrons-up-down-cL5vVQyN.js";import{i as yt,n as C,o as bt,r as xt,s as St}from"./FieldLabel-BvZBcdkv.js";import{i as Ct,n as wt,r as Tt,t as Et}from"./tabs-D1yskdk7.js";import{t as Dt}from"./button-CiAqEDbj.js";import{$ as w,Bn as T,Bt as Ot,Dn as kt,Dt as At,Et as E,F as jt,Gn as D,Hn as O,Kn as Mt,Q as k,Rn as Nt,Rt as Pt,X as A,Z as j,at as Ft,ct as M,et as N,jt as P,lt as F,nt as It,ot as Lt,pn as I,q as Rt,rt as zt,tt as Bt,un as L,ut as Vt,zn as Ht,zt as Ut}from"./index-ComRJ6Fm.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./table-B1EQZE2q.js";import{t as Gt}from"./FilterBar-CO_K6N4P.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-X-MUzsH-.js";import{t as W}from"./dispatchErrorInfo-CbdAfGpC.js";var $t=u(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=u(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[i,o]=(0,G.useState)(null),c=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),l=(0,G.useMemo)(()=>_n(c),[c]),u=(0,G.useMemo)(()=>vn(c),[c]),d=(0,G.useMemo)(()=>yn(c),[c]),f=(0,G.useMemo)(()=>gn(pn(c,n),i),[c,n,i]);function p(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:xe(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(N,{placeholder:_t()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(k,{value:J,children:s()}),l.map(e=>(0,Z.jsx)(k,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(w,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(N,{placeholder:he()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(k,{value:J,children:s()}),u.map(e=>(0,Z.jsx)(k,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(A,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(N,{placeholder:ae()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(k,{value:J,children:s()}),d.map(e=>(0,Z.jsx)(k,{value:e,children:e},e))]})]})]}),f.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,Z.jsxs)(U,{className:`oc-conn__table`,children:[(0,Z.jsx)(R,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(Q,{label:h(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:fe(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ce(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:oe(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:Ke(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(z,{children:a()}),(0,Z.jsx)(Q,{label:Je(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Z.jsx)(B,{children:f.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(z,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Ht,{size:13,"aria-hidden":!0}):(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(vt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(V,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(H,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(H,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(H,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(H,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:ye({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(H,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(V,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(H,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${F(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ge({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${F(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[v({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?ue():e===`error`?d():p()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(E,{variant:`secondary`,children:ue()}):e===`error`?(0,Z.jsx)(E,{variant:`destructive`,children:d()}):(0,Z.jsx)(E,{variant:`outline`,children:p()})}function wn(){return b(x.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=b(x.compat.getBridgeCompat,{}),n=b(x.me.getMe,{host:Rt})?.role===`admin`,r=b(x.admin.listInstances,n?{}:`skip`),i=b(x.agents.usageForInstances,n?{}:`skip`),a=D(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=D({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ut()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Xe()}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(R,{children:(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{children:_()}),(0,Z.jsx)(z,{children:we()}),(0,Z.jsx)(z,{children:be()}),(0,Z.jsx)(z,{children:y()}),(0,Z.jsx)(z,{children:Se()})]})}),(0,Z.jsx)(B,{children:i.flatMap(e=>{let t=jt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(H,{children:t.provider}),(0,Z.jsx)(H,{children:t.label}),(0,Z.jsx)(H,{children:(0,Z.jsxs)(E,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(H,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(Et,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(Tt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(Ct,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(wt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,s=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:qe(),children:[`(`,a,`)`]})]}):null,i?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,o({build:t.buildVersion??`?`})]}):null,` · `,Ye(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?de():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:ze()});let c=tn(e.targets),l=!e.reachable,u=rn(e),d=e.unreachableInstances??[],f=u===`ok`?`ok`:u===`gateways_unreachable`?`warn`:`error`,p=M(e.checkedAt),m=e.startedAt==null?null:M(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${f}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u===`ok`?(0,Z.jsx)(Nt,{size:22}):l||u===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(L,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:u===`ok`?r():u===`gateways_unreachable`?Oe({count:d.length}):l?pe():Ae({count:c.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,Te({time:p})]}),m?(0,Z.jsx)(`span`,{children:it({time:m})}):null,s]}),u===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:te({names:d.join(`, `)})}):null,l?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:re()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(I,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(E,{variant:d===`beyond`||d===`defective`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:le()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(T,{size:13,"aria-hidden":!0}),g({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ie(),i.length>0?(0,Z.jsx)(E,{variant:`destructive`,children:nt({count:i.length})}):a>0?(0,Z.jsx)(E,{variant:`destructive`,children:Pe()}):(0,Z.jsx)(E,{variant:`secondary`,children:ct()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[We({version:e.vendoredVersion}),r?` · `+st({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:tt({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(O,{size:13,"aria-hidden":!0}):(0,Z.jsx)(T,{size:13,"aria-hidden":!0}),$e({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ne({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ve({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:de()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:mt()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(E,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Bt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Lt,{children:et({instance:e.displayName??e.name})}),(0,Z.jsx)(zt,{children:Ne()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(Nt,{"aria-hidden":!0}):(0,Z.jsx)(L,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ze():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,rt()]}):null}function jn({instance:e,onClose:t}){let n=ke(x.admin.upsertInstanceConfig),r=De(x.bridge.validateMediaPaths),a=At(),o=Wt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>yt(e.config??{},o)),[u,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(dt(),e)}finally{p(!1)}}async function ee(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:xt(s,r,o)}),t()}catch(e){a.error(me(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(C,{label:ot(),help:je()}),(0,Z.jsxs)(A,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(j,{children:St.map(e=>(0,Z.jsx)(k,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(C,{label:Qe(),help:Ee()}),(0,Z.jsxs)(A,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(j,{children:bt.map(e=>(0,Z.jsx)(k,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(C,{label:lt(),help:at()}),(0,Z.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(C,{label:pt(),help:l()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(C,{label:_e(),help:ht()}),(0,Z.jsx)(P,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Vt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(C,{label:Re(),help:ie()})]}),v&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),Le({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:He(),result:m.inbound}),(0,Z.jsx)($,{label:Ue(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Me()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(L,{"aria-hidden":!0}),Be()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(Dt,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Z.jsx)(kt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?gt():Fe()]}),(0,Z.jsx)(Dt,{size:`sm`,onClick:()=>void ee(),disabled:u,children:i()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Pt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ft():c({count:e.length}),(0,Z.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ge()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(E,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,Bd as i,Fd as a,Hd as o,Id as s,Ld as c,Pd as l,QB as u,Qf as d,Rd as f,UB as p,Vd as m,YB as h,ZB as g,ac as _,ap as v,cc as y,iS as b,ic as x,lc as S,nc as C,oc as w,qi as T,rc as E,rp as D,sc as O,t as k,tc as A,uc as j,vf as M,zd as N}from"./api-2YAlX4o7.js";import{t as P}from"./button-CiAqEDbj.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,un as W,ut as G}from"./index-ComRJ6Fm.js";import{a as K}from"./compatView-X-MUzsH-.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=g(k.admin.upsertInstanceConfig),n=u(k.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,o]=(0,q.useState)(r),[c,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(r),d(`idle`)},[e._id,r]);let f=`__none__`,p=i!==r;async function m(){d(`saving`);try{let n={...e.config??{}};i===``||i===f?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}let h=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?f:i,onValueChange:e=>o(e===f?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":O(),children:(0,X.jsx)(H,{placeholder:_()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:f,children:_()}),h.map(e=>(0,X.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!p||c===`saving`,onClick:()=>void m(),children:c===`saving`?v():s()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null]})}function Q({instance:e}){let t=g(k.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,q.useState)(n),[c,u]=(0,q.useState)(r===null?``:String(r)),[d,f]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n),u(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let p=c.trim(),m=p===``?null:/^\d+$/.test(p)?Number.parseInt(p,10):NaN,h=!i||m===null||Number.isInteger(m)&&m>=4e3&&m<=6e4,_=i!==n||(m??null)!==r;async function b(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||m===null||Number.isNaN(m)?delete n.curationBudgetChars:n.curationBudgetChars=m,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":y()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>u(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!h,"aria-label":x(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!h||d===`saving`,onClick:()=>void b(),children:d===`saving`?v():s()})]}),h?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}),d===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,d===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]})}function $({instance:e}){let t=g(k.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[o,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let u=r.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=d===null||Number.isInteger(d)&&d>=1e3&&d<=2e5,p=(d??null)!==n;async function m(){c(`saving`);try{let n={...e.config??{}};d===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=d,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f}),(0,X.jsx)(P,{size:`sm`,disabled:!p||!f||o===`saving`,onClick:()=>void m(),children:o===`saving`?v():s()})]}),f?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:A()}),o===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:a()}):null,o===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:l()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]})}function ee(){let e=h(k.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),a=u(k.admin.listInstances,{}),[s,l]=(0,q.useState)(null);(0,q.useEffect)(()=>{!a||a.length===0||(!s||!a.some(e=>e.name===s))&&l(a[0].name)},[a,s]);let g=(a?.length??0)>1,_=a!==void 0&&a.length===0,v=u(k.compat.forInstance,s?{instanceName:s}:`skip`),y=s?I(v,`configDefaults`):`loading`,x=y===`loading`?null:y.blocked,S=(0,q.useMemo)(()=>g&&s?{instanceName:s}:{},[g,s]),C=(0,q.useRef)(0),w=(0,q.useCallback)(async()=>{let t=++C.current;n({status:`loading`});try{let r=Y(await e(S));if(C.current!==t)return;n({status:`done`,current:r})}catch{if(C.current!==t)return;n({status:`error`})}},[e,S]);(0,q.useEffect)(()=>{x===!1&&(g&&!s||w())},[w,x,g,s]);let E=t.status===`done`?t.current:null,O=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),A=(0,q.useMemo)(()=>[{id:`fast`,label:r()},{id:`standard`,label:d()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}),g&&s?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,X.jsxs)(B,{value:s,onValueChange:e=>l(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":M(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(a??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:b()}):y===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):y.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(y.gatewayVersion,y.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[c(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:D()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,X.jsx)(L,{field:`thinkingLevel`,options:O,value:E?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:m()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,X.jsx)(L,{field:`fastMode`,options:A,value:E===null||E.fastModeDefault===null?null:E.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:N()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:f()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:T()})]}),(()=>{let e=a?.find(e=>e.name===(s??a[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AO as i,BO as a,Ck as o,DO as s,Dk as c,EO as l,Ek as u,FO as d,GO as f,HO as p,IO as m,JO as ee,KO as h,LO as g,MO as te,NO as ne,OO as re,PO as ie,QB as ae,QO as _,RO as oe,Sk as v,TO as y,Tk as b,UO as x,VO as S,WO as C,XO as w,YO as T,ZB as E,ZO as D,_k as O,ak as k,bk as A,ck as j,dk as M,ek as N,fk as P,gk as F,gs as I,hk as L,ik as R,jO as z,kO as B,lk as V,mk as se,ms as H,nk as U,ok as W,pk as G,qO as K,rk as ce,sk as q,t as J,tk as le,uk as ue,vk as de,wk as fe,xk as pe,yk as me,zO as he}from"./api-2YAlX4o7.js";import{t as ge}from"./button-CiAqEDbj.js";import{U as _e,ct as Y}from"./index-ComRJ6Fm.js";import{t as ve}from"./DataTableShell-zI9sCnce.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>c(),incorrect:()=>u(),incoherence:()=>b(),formatting:()=>fe(),latency:()=>o(),api_error:()=>v(),other:()=>pe()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:me()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:A()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=E(J.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${O()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:f(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?se():e.authorRole===`agent`?e.authorLabel??I():G()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:P()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:M(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void p(),disabled:!c.trim()||u,children:u?ue():V()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||q()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||q()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R({count:i.contextCount??m.length,truncated:i.contextTruncated?ce():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?r({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[_(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,D()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=ae(J.feedback.listForAdmin,{}),t=E(J.feedback.readSnapshot),n=E(J.feedback.deleteFeedback),r=_e(),[o,c]=(0,X.useState)(null),[u,f]=(0,X.useState)({});async function _(e){if(o===e._id){c(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}c(e._id)}async function v(e){await r({title:s(),description:l(),confirmLabel:y(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[w(),` `,(0,Z.jsx)(`strong`,{children:T()}),` `,ee()]}),(0,Z.jsx)(ve,{title:K(),rows:e,emptyHint:h(),isExpanded:e=>o===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:C(),cell:e=>Y(e.at),sort:e=>e.at},{header:x(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?S():a(),sort:e=>e.messageRole},{header:he(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${oe({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:g(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:m(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ne()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:H()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:te()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?i():B(),onSelect:()=>void _(e)},{label:re(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$z as r,Az as ee,Bz as i,Fz as te,GB as ne,Gz as re,Hz as ie,Iz as ae,JM as oe,Jz as a,Kz as o,Lz as s,Mz as c,Nz as l,Pz as u,QB as d,Qz as f,Rz as se,UB as ce,Uz as le,Vz as ue,Wz as de,Xz as p,Yz as m,ZB as fe,Zz as h,aB as pe,bs as g,cB as me,eB as he,iB as ge,jz as _e,kz as ve,lB as ye,nB as be,oB as _,qz as v,rB as y,sB as b,t as x,tB as S,uB as C,ys as w,zz as T}from"./api-2YAlX4o7.js";import{t as E}from"./button-CiAqEDbj.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 we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-ComRJ6Fm.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-B1EQZE2q.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return r();case`audio`:return f();case`video`:return h();case`pdf`:return p();case`document`:return m();case`archive`:return a();default:return v()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[a,f]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[h,v]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=fe(x.files.softDelete),Y=k();function Ie(){t(W),r(W),f(W),m(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ae())}catch(e){Y.error(te(),e)}}let X=d(x.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:a===W?void 0:a,category:p===W?void 0:p,includeAutoGenerated:h||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ne(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||a!==W||p!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ye(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:me()}),(0,U.jsx)(F,{value:`inbound`,children:b()}),(0,U.jsx)(F,{value:`outbound`,children:_()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:r,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":pe(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ge()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:a,onValueChange:f,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":y(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:be()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:p,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":S(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:he()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:h,onCheckedChange:e=>v(e===!0),"aria-label":g()}),(0,U.jsx)(`span`,{children:g()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),T()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ee():_e()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:o()}),(0,U.jsx)(z,{children:re()}),(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:ie()}),(0,U.jsx)(z,{className:`text-right`,children:ue()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:w()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?b():_()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":se(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),i()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),c()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),s()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ve({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:u()}),(0,U.jsx)(Ce,{children:l()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:oe()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:s()})]})]})})]})}export{K as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Ap as i,Bp as a,Cm as o,Cp as s,D as c,Dp as l,Em as u,Ep as d,Fp as f,Gp as p,Hp as m,Ip as h,Jp as g,Kp as _,Lp as v,Mp as y,Np as b,Op as x,Pp as S,QB as C,Qp as ee,Rp as te,Sm as w,Sp as ne,Tm as T,Tp as re,Up as ie,Vp as E,Wp as ae,Xp as D,Yp as O,ZB as k,Zp as A,_m as oe,_p as j,am as M,bm as se,bp as ce,cm as N,dm as le,em as ue,fm as P,gm as de,hm as fe,im as pe,jp as me,kp as he,lm as ge,mm as _e,nm as ve,om as ye,pm as be,qp as xe,rm as Se,sm as Ce,t as F,tm as we,um as Te,vm as Ee,vp as I,wm as De,wp as Oe,xm as ke,xp as L,ym as Ae,yp as je,zp as Me}from"./api-2YAlX4o7.js";import{t as Ne}from"./x-BbEH3fbU.js";import{i as R,n as z,r as Pe,t as Fe}from"./tabs-D1yskdk7.js";import{t as B}from"./button-CiAqEDbj.js";import{$ as Ie,Bn as Le,Dt as V,Et as H,Q as Re,U as ze,Vn as Be,X as Ve,Z as He,_ as Ue,at as We,cn as Ge,et as Ke,fn as U,jt as W,nt as qe,ot as Je,pn as G,q as Ye,rt as Xe,tt as Ze,ut as K}from"./index-ComRJ6Fm.js";import{t as Qe}from"./FilterBar-CO_K6N4P.js";import{t as $e}from"./DataTableShell-zI9sCnce.js";import{t as q}from"./DetailChips-DppLe33N.js";var J=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Y=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),X=t(e(),1);function et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function tt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function nt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function rt(e){switch(e){case`admin`:return xe();case`user`:return _();case`pending`:return p();default:return e}}function it(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function at(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Z=n(),Q={name:``,description:``};function ot(){let e=C(F.groups.listGroups,{}),t=C(F.me.getMe,{host:Ye})?.role===`admin`,n=k(F.groups.createGroup),r=k(F.groups.updateGroup),i=k(F.groups.deleteGroup),a=ze(),s=V(),[c,l]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(Q),[h,g]=(0,X.useState)(null),[_,v]=(0,X.useState)(``),y=(0,X.useMemo)(()=>{if(!e)return e;let t=_.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,_]);function b(){f(null),m(Q),l(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),l(!0)}async function S(){try{d?await r({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m(Q),f(null),l(!1)}catch(e){s.error(ce(),e)}}async function ee(e){if(await a({title:Ce({name:e.name}),description:ye(),confirmWord:e.name,confirmLabel:M(),cancelLabel:be(),destructive:!0}))try{await i({groupId:e._id})}catch(e){s.error(je(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),(0,Z.jsx)(Qe,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:Ee()}),(0,Z.jsx)($e,{title:u(),rows:y,addLabel:De(),onAdd:t?b:void 0,emptyHint:o(),columns:[{header:w(),cell:e=>e.name,sort:e=>e.name},{header:ke(),cell:e=>(0,Z.jsx)(q,{icon:(0,Z.jsx)(Ge,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Z.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:se(),cell:e=>(0,Z.jsx)(q,{icon:(0,Z.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:Ae(),cell:e=>(0,Z.jsx)(q,{icon:(0,Z.jsx)(J,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Z.jsx)(U,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:oe(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:de(),onSelect:()=>x(e)},{label:fe(),variant:`destructive`,onSelect:()=>void ee(e)}]:[]]}),(0,Z.jsx)(Ue,{open:c,onOpenChange:l,title:d?le():P(),description:Te(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:_e(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:ge()}),(0,Z.jsx)(W,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,Z.jsx)(W,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Z.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var st=8;function $({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Z.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Z.jsx)(Be,{size:14,"aria-hidden":!0}),D()]}),(0,Z.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":g({page:e,pages:t}),children:[e,` / `,t]}),(0,Z.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[O(),(0,Z.jsx)(Le,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=C(F.groups.getGroup,n&&e?{groupId:e}:`skip`),c=C(F.groups.listAssignableInstances,n?{}:`skip`),l=C(F.groups.listAssignableUsers,n?{}:`skip`),u=k(F.groups.addMember),d=k(F.groups.removeMember),f=k(F.groups.bulkSetMembers),p=k(F.groups.setGroupManager),h=V(),[g,_]=(0,X.useState)(``),[v,y]=(0,X.useState)(``),[x,S]=(0,X.useState)(`members`),[te,w]=(0,X.useState)(1),[T,ie]=(0,X.useState)(new Set),E=(0,X.useRef)(null),D=(0,X.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),O=(0,X.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),oe=o?.viewerIsAdmin===!0,j=(0,X.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,X.useEffect)(()=>{_(``),y(``),S(`members`),w(1),E.current=null},[n,e]),(0,X.useEffect)(()=>{w(1)},[g]),(0,X.useEffect)(()=>{n&&o&&e&&E.current!==e&&(E.current=e,ie(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let M=(0,X.useMemo)(()=>l?et(l,g,T):[],[l,g,T]);async function se(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(I(),e)}}async function ce(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){h.error(ne(),e)}}let N=it(M,e=>D.has(e.userId)),le=M.filter(e=>D.has(e.userId)).length,P=at(M,te,st);async function de(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:N!==`all`})}catch(e){h.error(I(),e)}}return(0,Z.jsx)(Ze,{open:n,onOpenChange:i,children:(0,Z.jsxs)(qe,{className:`oc-access`,children:[(0,Z.jsxs)(We,{children:[(0,Z.jsx)(Je,{children:pe({name:t})}),(0,Z.jsx)(Xe,{children:Se()})]}),(0,Z.jsxs)(Fe,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,Z.jsxs)(Pe,{className:`w-full`,children:[(0,Z.jsxs)(R,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Ge,{size:13,"aria-hidden":!0}),ve(),o?(0,Z.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Z.jsxs)(R,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0}),ue(),o?(0,Z.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Z.jsxs)(R,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(J,{size:13,"aria-hidden":!0}),b(),o?(0,Z.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Z.jsx)(z,{value:`members`,children:l===void 0||o===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):l.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{value:g,onChange:e=>_(e.target.value),placeholder:we(),className:`oc-access__search`}),M.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,Z.jsxs)(Z.Fragment,{children:[M.length>1?(0,Z.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Z.jsx)(K,{checked:N===`all`?!0:N===`some`?`indeterminate`:!1,onCheckedChange:()=>void de(),"aria-label":A()}),(0,Z.jsx)(`span`,{className:`oc-access__label`,children:A()}),(0,Z.jsxs)(H,{variant:`outline`,className:`oc-access__count`,children:[le,` / `,M.length]})]}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=D.has(e.userId),n=nt(e),r=O.has(e.userId);return(0,Z.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Z.jsx)(K,{checked:t,onCheckedChange:()=>void se(e.userId,t),"aria-label":ae({user:n.primary})}),(0,Z.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Z.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Z.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__role`,children:rt(e.role)}),(0,Z.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&oe?(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?s():Oe(),title:r?s():Oe(),onClick:()=>void ce(e.userId,r),children:(0,Z.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Z.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":re(),title:re(),children:(0,Z.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Z.jsx)($,{page:P.page,pageCount:P.pageCount,onPage:w})]})]})}),(0,Z.jsx)(z,{value:`agents`,children:c===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):c.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Me()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(W,{value:v,onChange:e=>y(e.target.value),placeholder:r(),className:`oc-access__search`}),(0,Z.jsx)(`div`,{className:`oc-access__list`,children:c.map(t=>(0,Z.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:v},`${e}-${t._id}`))})]})}),(0,Z.jsx)(z,{value:`charts`,children:(0,Z.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=C(F.groups.listAssignableAgents,{instanceName:t}),o=k(F.groups.assignAgentToGroup),s=k(F.groups.removeAgentFromGroup),c=k(F.groups.bulkSetGroupAgents),l=V(),[u,d]=(0,X.useState)(1);if((0,X.useEffect)(()=>{d(1)},[i]),!e)return null;let p=tt(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let g=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=it(g,e=>r.has(`${t}/${e.agentId}`)),y=at(p,u,st);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(j(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){l.error(j(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__stale`,children:h()}):null]}),a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:E()}):p.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m?v():te()}):(0,Z.jsxs)(Z.Fragment,{children:[g.length>1?(0,Z.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Z.jsx)(K,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":A()}),(0,Z.jsx)(`span`,{className:`oc-access__label`,children:A()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Z.jsx)(K,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":ie({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S(),title:S(),children:(0,Z.jsx)(U,{size:14,fill:`currentColor`})}):null,a?(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:f()}):null]},e.agentId)}),(0,Z.jsx)($,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=C(F.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=k(F.charts.assignChartToGroup),r=k(F.charts.removeChartFromGroup),a=k(F.charts.setGroupDefaultChart),o=k(F.charts.addChartToGroupPool),s=k(F.charts.removeChartFromGroupPool),c=V();if(!e)return null;if(t===void 0)return(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:u,addable:f,canManagePool:p}=t;if(u.length===0&&!p)return(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:y()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__list`,children:u.map(e=>(0,Z.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Z.jsx)(K,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":x({name:e.name})}),(0,Z.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":l(),title:l(),children:(0,Z.jsx)(U,{size:14,fill:`currentColor`})}):(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:d()}):null,p?(0,Z.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":he({name:e.name}),title:he({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Z.jsx)(Ne,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,Z.jsxs)(Ve,{value:``,onValueChange:e=>void _(e),children:[(0,Z.jsx)(Ie,{size:`sm`,className:`oc-access__search`,children:(0,Z.jsx)(Ke,{placeholder:i()})}),(0,Z.jsx)(He,{children:f.map(e=>(0,Z.jsx)(Re,{value:e.chartKey,children:e.name},e.chartKey))})]}):u.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:me()}):null:null]})}export{ot as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$E as i,AD as a,AE as o,BD as s,BE as c,CD as l,CE as u,DD as d,DE as f,Dc as p,ED as m,EE as h,Ec as g,FD as ee,FE as _,G as te,GD as ne,GE as v,H as y,HD as re,HE as b,ID as ie,IE as x,J as ae,JD as oe,JE as S,Jx as se,K as ce,KD as le,KE as C,LD as w,LE as T,MD as ue,ME as E,ND as de,NE as fe,OD as pe,OE as me,Oc as he,PD as ge,PE as _e,Q as ve,QB as D,QE as ye,Qi as be,RD as xe,RE as Se,SD as Ce,SE as we,TD as Te,TE as Ee,Tc as De,U as Oe,UD as ke,UE as Ae,VD as je,VE as Me,W as Ne,WD as Pe,WE as Fe,X as Ie,XD as Le,XE as Re,XN as ze,Xi as Be,Y as Ve,YB as O,YD as He,YE as Ue,YN as k,Yx as We,Z as Ge,ZB as A,ZD as Ke,ZE as qe,Zi as Je,_D as Ye,_E as Xe,aD as Ze,bD as Qe,bE as $e,cD as et,cE as tt,dD as nt,dE as rt,eD as it,et as at,fD as ot,fE as st,gD as ct,gE as lt,hD as ut,hE as dt,iD as ft,it as pt,jD as mt,kD as ht,kE as gt,lD as _t,lE as j,mD as M,mE as vt,nD as yt,nt as bt,oD as xt,pD as N,pE as St,q as Ct,qD as wt,qE as Tt,rD as Et,rt as Dt,sD as Ot,t as P,tD as kt,tt as At,uD as jt,uE as Mt,vD as Nt,vE as Pt,wD as Ft,wE as It,xD as Lt,xE as Rt,yD as zt,yE as Bt,zD as Vt,zE as Ht}from"./api-2YAlX4o7.js";import{a as Ut,c as Wt}from"./FieldLabel-BvZBcdkv.js";import{t as F}from"./button-CiAqEDbj.js";import{$ as I,Bt as Gt,Dt as L,Et as R,Q as z,Rt as Kt,U as qt,X as B,Z as V,_ as Jt,at as H,et as U,jt as W,nt as G,ot as K,rt as q,tt as J,ut as Yt,zt as Xt}from"./index-ComRJ6Fm.js";import{t as Zt}from"./DataTableShell-zI9sCnce.js";import{InstanceConfigDialog as Qt}from"./BridgeTab-CCi97G2S.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],$t=new Set(X),en=`conversational`;function tn(e){let t=new Set((e??[]).filter(e=>$t.has(e)));return t.size===0?[en]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Ut},nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function rn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function an(){let e=D(P.admin.listInstances,{}),t=D(P.agents.listAllInstanceAgents,{}),n=A(P.admin.upsertInstance),i=A(P.admin.deleteInstance),o=L(),[c,u]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(Q),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null);async function T(){try{await n({instanceId:S??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),p(Q),C(null),u(!1)}catch(e){o.error(He(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[oe(),(0,Z.jsx)(`strong`,{children:wt()}),le()]}),(0,Z.jsx)(Zt,{title:ne(),rows:e,addLabel:Pe(),onAdd:()=>{C(null),p(Q),u(!0)},emptyHint:ke(),columns:[{header:re(),cell:e=>e.name,sort:e=>e.name},{header:je(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:s(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Vt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:Ke(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?j():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ee(),onSelect:()=>{C(e._id),p(rn(e)),u(!0)}},{label:Le(),onSelect:()=>g(e.name)},{label:Qe(),onSelect:()=>x(e)},{label:xe(),onSelect:()=>v(e)},{label:w(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:w(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Jt,{open:c,onOpenChange:u,title:S?ge():ie(),description:ue(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:T,submitLabel:mt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:a(),children:[(0,Z.jsx)(W,{value:f.name,disabled:S!==null,onChange:e=>p({...f,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:de()}):null]}),(0,Z.jsx)($,{label:ht(),children:(0,Z.jsxs)(B,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:be(),children:(0,Z.jsxs)(B,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`ws`,children:Je()}),(0,Z.jsx)(z,{value:`rest`,children:Be()})]})]})}):null,(0,Z.jsx)($,{label:pe(),children:(0,Z.jsx)(W,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:d(),children:(0,Z.jsx)(W,{value:f.bridgeUrl,placeholder:m(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Te(),children:(0,Z.jsx)(W,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:We(),children:[(0,Z.jsxs)(B,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(V,{children:Wt.map(e=>(0,Z.jsx)(z,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:se()})]}),(0,Z.jsx)($,{label:Ft(),children:(0,Z.jsx)(W,{value:f.gatewayVersion,placeholder:l(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:ae(),children:[(0,Z.jsxs)(B,{value:f.authMode,onValueChange:e=>p({...f,authMode:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`token`,children:Ct()}),(0,Z.jsx)(z,{value:`trusted-proxy`,children:ce()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?Ne():te()})]}),f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:pt(),children:[(0,Z.jsxs)(B,{value:f.personScopes,onValueChange:e=>p({...f,personScopes:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`capped`,children:Dt()}),(0,Z.jsx)(z,{value:`full`,children:bt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?at():At()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:r(),children:[(0,Z.jsxs)(B,{value:f.identitySource,onValueChange:e=>p({...f,identitySource:e}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(z,{value:`canonical`,children:ve()}),(0,Z.jsx)(z,{value:`email`,children:Ge()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?Ve():Ie()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:Oe(),children:(0,Z.jsx)(W,{value:f.systemIdentity,placeholder:y(),onChange:e=>p({...f,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:Ce(),children:(0,Z.jsx)(W,{value:f.gatewayHttpUrl,placeholder:Lt(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(hn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||g(null)}}),_?(0,Z.jsx)(Qt,{instance:_,onClose:()=>v(null)},_._id):null,b?(0,Z.jsx)(on,{instance:b,onClose:()=>x(null)},b._id):null]})}function on({instance:e,onClose:t}){let n=D(P.instanceSecrets.listInstanceSecretStatus,{}),r=nn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(J,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(G,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(K,{children:zt({instance:e.displayName??e.name})}),(0,Z.jsx)(q,{children:Nt()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(ln,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(cn,{instance:e})}),(0,Z.jsx)(sn,{instance:e})]})})}function sn({instance:e}){let t=O(P.instanceSync.forceInstanceSync),n=L(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ye());break;case`no_agents`:n.success(Re());break;case`no_bridge_url`:n.error(Ue());break;case`deploy_misconfigured`:n.error(S());break;case`unauthorized`:n.error(C());break;case`not_served`:n.error(v());break;default:n.error(Tt());break}}catch(e){n.error(qe(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?i():it()})})]})}function cn({instance:e}){let t=D(P.bridgeAuth.listBridgeAuthStatus,{}),n=O(P.bridgeAuth.mintBridgeSecret),r=A(P.bridgeAuth.revokeBridgeSecret),i=L(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(T(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(Se())}catch(e){i.error(T(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:Ae(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:p?`outline`:`secondary`,children:p?`${M()} · ${f.prefix}…${f.lastFour}`:N()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?c():Me()}),p?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:Ht()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:x()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?ze():k()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:_()})]}):null]})}function ln({instanceId:e,field:t,updatedAt:n}){let r=O(P.instanceSecrets.setInstanceSecret),i=A(P.instanceSecrets.clearInstanceSecret),a=O(P.deviceIdentity.generateDeviceIdentity),o=L(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),h=n!==null,g=t===`deviceIdentity`,ee=t===`token`?Ye():t===`deviceIdentity`?ct():ut();async function te(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),f(null),m(!1),o.success(et())}catch(e){o.error(Ot(),e)}finally{u(!1)}}}async function ne(){if(!l){u(!0);try{await i({instanceId:e,field:t}),f(null),m(!1),o.success(xt())}catch(e){o.error(Ot(),e)}finally{u(!1)}}}async function v(){if(!l){u(!0);try{f(await a({instanceId:e})),m(!1),o.success(Et())}catch(e){o.error(kt(),e)}finally{u(!1)}}}let y=d?`openclaw devices approve ${d.id}`:``;async function re(){if(y)try{await navigator.clipboard.writeText(y),m(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[g?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:h?`outline`:`secondary`,children:h?M():N()}),(0,Z.jsx)(W,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:h?nt():ot(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(F,{size:`sm`,onClick:()=>void te(),disabled:l||s.trim().length===0,children:jt()}),g?(0,Z.jsx)(F,{size:`sm`,variant:`outline`,onClick:()=>void v(),disabled:l,children:Ze()}):null,h?(0,Z.jsx)(F,{size:`sm`,variant:`destructive`,onClick:()=>void ne(),disabled:l,children:_t()}):null]})]}),d?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:Et()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:yt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:y}),(0,Z.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>void re(),children:p?ze():k()})]}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,onClick:()=>{f(null),m(!1)},children:_()})]}):null]})}var un={conversational:It,documentary:we,summarizer:he,curator:g},dn={conversational:u,documentary:Rt,summarizer:p,curator:De},fn=e=>(un[e]??(()=>e))(),pn=e=>(dn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:me()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:fn(e)},e)),(0,Z.jsxs)(Kt,{children:[(0,Z.jsx)(Gt,{asChild:!0,children:(0,Z.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:f()})}),(0,Z.jsxs)(Xt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:h()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ee()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(Yt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:fn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=D(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=A(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=A(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=A(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=tn(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=A(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=A(P.agents.removeInstanceAgent),l=qt(),u=L();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(E(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(E(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(E(),e)}}async function m(t,n){if(e&&await l({title:Pt({name:n}),description:Xe(),confirmLabel:lt(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(dt())}catch(e){u.error(E(),e)}}return(0,Z.jsx)(J,{open:t,onOpenChange:n,children:(0,Z.jsxs)(G,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(K,{children:_e({name:e??``})}),(0,Z.jsx)(q,{children:fe()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:vt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?St():r.discovery.lastPollOk?st():rt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Mt()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(Yt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void d(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:tt()}),(0,Z.jsx)(F,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void m(t.agentId,a),children:Bt()})]}):i?(0,Z.jsx)(R,{variant:`default`,children:j()}):(0,Z.jsx)(F,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void f(t.agentId),children:$e()})]}),t.enabled?(0,Z.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void p(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(E(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(W,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:o(),"aria-label":gt(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{an as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,CA as i,QB as a,Qy as o,SA as s,TA as c,XA as l,ab as u,cb as d,db as f,eb as p,fb as m,hA as ee,ib as h,lb as te,mA as ne,nb as g,ob as _,rb as v,sb as y,t as b,tb as x,ub as S,wA as C}from"./api-2YAlX4o7.js";import{Gn as w,Kn as T,i as re,o as ie,q as E,r as D}from"./index-ComRJ6Fm.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BwlnvYU_.js";import{n as N,t as P}from"./TimeRangePicker-kPz5x0z6.js";var F=t(e(),1),I={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`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=a(b.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=a(b.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:l()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:c()}),(0,R.jsx)(j,{children:i()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[ne(),` p50 `,B(s.cP50),` `,C()]}),(0,R.jsxs)(`span`,{children:[ee(),` p50 `,B(s.aP50),` `,C()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":c(),children:[(0,R.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:m(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:f(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:S(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:te(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:d(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:y(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:_(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function Y(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=re(e.from,e.to,D,`now`),r=e=>void t({search:t=>({...t,...ie(e)})}),{from:i,to:o}=N(n),{rowLimit:s,buckets:c}=J(i,o),l=a(b.kpi.listKpis,{limit:s,filter:{from:i,to:o}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){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>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,R.jsx)(ae,{value:n,onChange:r})]});return l===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}):l.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,i=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&i>0?` oc-kpi__value--error`:``),children:Q(i)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:x({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:p()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:r({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.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,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":o({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,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.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{Y as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,AB as i,AF as a,BF as o,CB as s,CF as c,DB as l,DF as u,EB as d,EF as f,FB as ee,FF as p,GF as m,HF as h,IF as g,Jn as te,KF as ne,LF as re,MB as ie,MF as ae,NB as oe,NF as se,OB as ce,OF as le,PB as ue,PF as de,QB as _,Qn as fe,RB as pe,RF as me,SB as he,SF as ge,TB as _e,TF as v,UB as y,UF as b,VF as x,WF as S,Xn as C,Yn as w,ZB as T,Zn as E,_B as D,_F as O,bB as k,bF as A,cF as j,dF as M,er as N,fB as P,fF as F,gB as I,gF as ve,hB as ye,hF as L,hr as be,jB as xe,jD as Se,jF as Ce,kB as we,kF as Te,lF as Ee,lr as De,mB as Oe,mF as ke,mr as Ae,pB as je,pF as Me,qF as Ne,r as R,t as z,tr as Pe,uF as Fe,vB as Ie,vF as Le,wB as Re,wF as ze,xB as Be,xF as B,yB as Ve,yF as He,zF as Ue}from"./api-2YAlX4o7.js";import{t as V}from"./button-CiAqEDbj.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-ComRJ6Fm.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-DlnrjtgN.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:R(`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:R(`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:()=>Ne()},{id:`composer`,label:()=>ne()},{id:`sidebar`,label:()=>m()},{id:`notifications`,label:()=>le()},{id:`other`,label:()=>S()}],X={showSource:{category:`messages`,label:()=>b(),help:()=>h()},showReport:{category:`messages`,label:()=>x(),help:()=>o()},copyAssistant:{category:`messages`,label:()=>Ue()},copyUser:{category:`messages`,label:()=>me()},showDelete:{category:`messages`,label:()=>re()},showTools:{category:`messages`,label:()=>g(),help:()=>p()},voiceInput:{category:`composer`,label:()=>de(),help:()=>se()},showUsage:{category:`composer`,label:()=>ae(),help:()=>Ce()},autoReadAloud:{category:`composer`,label:()=>be(),help:()=>Ae()},showChatAge:{category:`sidebar`,label:()=>a(),help:()=>Te()},notifSound:{category:`notifications`,label:()=>u(),help:()=>f()},notifSystem:{category:`notifications`,label:()=>v(),help:()=>ze()},replySound:{category:`notifications`,label:()=>c(),help:()=>ge()}};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:()=>F()};function ut({prefKey:e,ui:t}){let n=T(z.admin.setUiPrefDefault),r=T(z.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:ve()}),(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:Fe()}),(0,J.jsx)(U,{value:`off`,children:Ee()}),(0,J.jsx)(U,{value:`inherit`,children:j()})]})]}),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":L()}),L()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=T(z.me.setDictationShortcut),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!i)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)},[i,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:[Pe(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?fe():i?r():N()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:te()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?w():e?C():E()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=_(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=T(z.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":O()}),O()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ke()}),(0,J.jsx)(`p`,{children:Me()}),(0,J.jsx)(`p`,{children:M()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:A()}):(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:He()}):l?(0,J.jsx)(H,{variant:`secondary`,children:De()}):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:Le()}):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:y()})}var pt={sm:()=>s(),md:()=>he(),lg:()=>Be(),xl:()=>k(),"2xl":()=>Ve(),"3xl":()=>Ie()};function mt(){let e=_(z.me.getMe,{host:G}),t=T(z.me.setLocale),n=T(z.me.setTimezone),r=T(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=T(z.me.setMyName),o=Ke(),s=e?.locale??`default`,c=e?.name??``,[u,f]=(0,q.useState)(null),p=u??c,m=p.trim()!==c.trim();async function h(){try{await a({name:p}),f(null),o.success(xe())}catch(e){o.error(i(),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:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:p,maxLength:120,placeholder:oe(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!m,onClick:()=>void h(),children:Se()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(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:we()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:pe()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(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:D()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:I()})]}),(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:ye()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:d()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(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:Re()})]}),(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:je()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:P()})]}),(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,Av as i,Ct as a,D as o,Dv as s,Ey as c,Fg as l,Fv as u,Fy as d,Hv as ee,Iv as te,Jv as f,Kv as p,Lv as m,Mv as h,Nv as g,Ny as _,Ov as v,Oy as y,Py as ne,QB as b,Qv as x,St as re,Sy as S,Tv as C,Ty as ie,UB as w,Uv as ae,Vv as oe,Wv as se,Xv as ce,Yv as le,ZB as T,Zv as ue,_y as de,ay as E,by as fe,cy as pe,dy as me,ey as he,fy as ge,gy as D,iy as _e,jv as O,kv as ve,ky as k,my as A,ny as ye,oy as j,py as M,qv as be,ry as xe,sy as N,t as P,ty as Se,uy as Ce,vy as we,yy as Te}from"./api-2YAlX4o7.js";import{t as Ee}from"./list-CqoYNGdr.js";import{t as F}from"./button-CiAqEDbj.js";import{A as De,An as Oe,Bn as ke,C as Ae,D as je,Dt as Me,E as Ne,Ft as Pe,Gn as I,Hn as Fe,It as Ie,J as Le,Kn as Re,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as L,P as We,Pn as Ge,Pt as R,S as Ke,Sn as qe,T as Je,Tn as Ye,U as Xe,W as Ze,Y as Qe,_ as $e,b as z,bn as et,d as tt,dn as nt,f as rt,g as B,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-ComRJ6Fm.js";var ft=o(`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`}]]),pt=o(`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`}]]),mt=o(`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`}]]),Y=o(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":g(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ge,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=T(P.projects.renameProject),s=T(P.projects.setProjectColor),c=T(P.projects.moveProject),l=T(P.projects.deleteProject),ee=T(P.projects.createProject),f=Xe(),p=Ze(),[m,g]=(0,X.useState)(!1),[y,x]=(0,X.useState)(t),[re,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(!1),se=b(P.projects.projectTreeCount,C?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&w(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,D()]}),(0,Z.jsxs)(R,{onSelect:()=>{x(t),g(!0)},children:[(0,Z.jsx)(et,{}),` `,h()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await p({title:N(),label:d(),placeholder:ne(),confirmLabel:_()});t&&await ee({name:t,parentId:e})})},children:[(0,Z.jsx)(Oe,{}),` `,N()]}),(0,Z.jsxs)(R,{onSelect:()=>S(!0),children:[(0,Z.jsx)(pt,{}),` `,ae()]}),(0,Z.jsx)(Pe,{children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e,color:null}),"aria-label":v(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void s({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=se?.folders??0,r=se?.chats??0;await f({title:Te({name:t}),description:n>0?de({folders:n,chats:r}):r>0?we({count:r}):te(),confirmWord:u(),confirmLabel:fe(),destructive:!0})&&await l({projectId:e})})},children:[(0,Z.jsx)(nt,{}),` `,u()]})]})]}),(0,Z.jsx)($e,{open:m,onOpenChange:g,title:ie(),canSubmit:y.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:y.trim()}),g(!1)},submitLabel:h(),children:(0,Z.jsx)(W,{value:y,onChange:e=>x(e.target.value),autoFocus:!0})}),re?(0,Z.jsx)(ot,{open:re,onOpenChange:S,title:oe(),movingFolderId:e,currentId:r,onPick:t=>void c({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=T(P.chats.pinChat),a=T(P.chats.deleteChat),o=T(P.chats.renameChat),c=T(P.chats.setChatSidebar),l=T(P.chats.moveChatToProject),d=Xe(),[f,p]=(0,X.useState)(!1),[m,g]=(0,X.useState)(e.title??``),[_,v]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{g(e.title??``),p(!0)},children:[(0,Z.jsx)(et,{}),` `,h()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?O():i()]}),(0,Z.jsxs)(R,{onSelect:()=>v(!0),children:[(0,Z.jsx)(pt,{}),` `,se()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{}),e.inSidebar?M():A()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await d({title:s(),description:te(),confirmLabel:u(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,Z.jsx)(nt,{}),` `,u()]})]})]}),(0,Z.jsx)($e,{open:f,onOpenChange:p,title:C(),canSubmit:m.trim().length>0,onSubmit:async()=>{await o({chatId:e._id,title:m.trim()}),p(!1)},submitLabel:h(),children:(0,Z.jsx)(W,{value:m,onChange:e=>g(e.target.value),autoFocus:!0})}),_?(0,Z.jsx)(ot,{open:_,onOpenChange:v,title:ee(),currentId:t,onPick:t=>void l({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}=st({from:`/project/$projectId`}),t=I(),n=b(P.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:w()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:le()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:f()}),(0,Z.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:be()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=I(),n=Xe(),i=Ze(),o=Me(),s=T(P.projects.renameProject),ee=T(P.projects.setProjectColor),f=T(P.projects.deleteProject),g=T(P.projects.createProject),y=T(P.projects.moveProject),S=T(P.projects.setProjectSidebar),C=T(P.chats.moveChatToProject),w=T(P.chats.reorderChat),se=T(P.projects.reorderProject),le=b(P.projects.projectTreeCount,{projectId:e.project._id}),[E,he]=(0,X.useState)(xt),D=e=>{localStorage.setItem(bt,e),he(e)},O=b(P.projects.folderColumns,E===`columns`?{projectId:e.project._id}:`skip`),A=b(P.projects.projectTreeList,E===`list`?{projectId:e.project._id}:`skip`),{c:j}=Re({from:`/project/$projectId`}),M=b(P.projects.listProjects,{}),be=b(P.chatReads.myBusyChats,{}),Se=(0,X.useMemo)(()=>new Set(be??[]),[be]),ke=b(P.chatReads.myChatReads,{}),Fe=(0,X.useMemo)(()=>yt(e.chats,ke??[]),[e.chats,ke]),{startNewChat:L,picker:qe}=tt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,rt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=b(P.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=De(it(lt,{activationConstraint:{distance:4}}),it(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=O?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||k()}}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,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=je(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=je(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=je(n(`crumb:`));if(a.length>0)return a;let o=je(n(`col:`));return o.length>0?o:Ne(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(E===`columns`){for(let e of O?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(E===`list`){let e=A?.chats.find(e=>e._id===t);return e?{list:A.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(E===`columns`){for(let e of O?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(E===`list`){let e=A?.folders.find(e=>e._id===t);if(!e||!A)return null;let n=e.parentId??A.rootId;return{list:Qe(A.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 C({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(M??[],t,e)){o.error(pe());return}await y({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 C({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await w({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(!Le(M??[],e,n.parentId)){o.error(pe());return}await y({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({projectId:e,...a});return}}catch{o.error(pe())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=B(e.project),Bt=_t(e.chats,z),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":p(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:a(),onClick:()=>{S({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(He,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:re()}),(0,Z.jsx)(Be,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":ge(),children:[(0,Z.jsx)(F,{variant:E===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ge(),title:ge(),"aria-pressed":E===`cards`,onClick:()=>D(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(F,{variant:E===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":me(),title:me(),"aria-pressed":E===`columns`,onClick:()=>D(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(F,{variant:E===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ce(),title:Ce(),"aria-pressed":E===`list`,onClick:()=>D(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Ye,{}),ye()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:N(),label:d(),placeholder:ne(),confirmLabel:_()});t&&await g({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(Oe,{}),N()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),children:(0,Z.jsx)(Ge,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)(et,{}),` `,h()]}),(0,Z.jsxs)(R,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,ae()]}),(0,Z.jsx)(Pe,{children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void ee({projectId:e.project._id,color:null}),"aria-label":v(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void ee({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=le?.folders??0,a=le?.chats??0;await n({title:Te({name:e.project.name}),description:i>0?de({folders:i,chats:a}):a>0?we({count:a}):te(),confirmWord:u(),confirmLabel:fe(),destructive:!0})&&(await f({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(nt,{}),` `,u()]})]})]})]})]}),E===`columns`?(0,Z.jsx)(Ft,{data:O,currentId:e.project._id,busyIds:Se,suppressClick:$,locateChatId:j??null}):E===`list`?(0,Z.jsx)(Mt,{data:A,busyIds:Se,suppressClick:$,locateChatId:j??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:_e()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:xe()}),e.chats.length>0?(0,Z.jsx)(W,{value:z,onChange:e=>rt(e.target.value),placeholder:r(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?ue():ce()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:Se.has(t._id),unread:Fe.has(t._id),locate:t._id===j,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:m()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:x({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||l()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:ie(),canSubmit:U.trim().length>0,onSubmit:async()=>{await s({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:h(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:oe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void y({projectId:e.project._id,parentId:t})}):null,qe]}),(0,Z.jsx)(Ae,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Ct(e)});return(0,Z.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=I(),a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.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":B(e),transform:H.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,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{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,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?Se({count:e.folderCount})+` · `:``,he({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:rt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=T(P.chats.setChatSidebar),n=e.inSidebar?M():A();return(0,Z.jsx)(F,{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,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=I(),c=V(e.color),l=z({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||k()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:rt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:y(),"aria-label":y()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:S(),"aria-label":S()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.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,X.useState)(new Set),o=(0,X.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,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:w()});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=Qe(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.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,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ue()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=I(),c=z({id:`folder:${e._id}`}),l=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.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":B(e),transform:H.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,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?j():E(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(ke,{size:13}):(0,Z.jsx)(Fe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{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=I(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.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:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||k()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:w()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.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=I(),s=L({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.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,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.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,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:ce()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.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":B(e),transform:H.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,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{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=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.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:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||k()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,$x as i,Ac as a,Ao as o,Ax as s,Bo as c,Bx as l,Dx as u,Ex as d,Fx as f,Gx as p,Ho as m,Hx as h,Ix as g,Lx as _,Mc as ee,Mo as te,Mx as ne,Nc as v,No as y,Nx as b,Ox as x,Px as S,QB as C,Qx as w,Rx as T,Uo as E,Ux as D,Vo as re,Vx as ie,Wx as ae,ZB as oe,ea as O,jc as k,jo as A,jx as j,kc as M,ko as N,kx as P,t as F,ta as I,yt as L,zx as R}from"./api-2YAlX4o7.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-BvZBcdkv.js";import{t as U}from"./button-CiAqEDbj.js";import{$ as W,Dt as G,Q as K,Qt as se,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-ComRJ6Fm.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:l,help:R},documentary_fetch:{label:T,help:_},inbound_files:{label:g,help:f},history_summary:{label:v,help:ee},file_curation:{label:E,help:y},quote_reply:{label:m,help:re}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:x,references:u,files:d,previous_summary:k,new_messages:a,max_chars:M,file_name:te,budget_chars:A,feedback:o,content:N,excerpt:c};function _e(){let e=C(F.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:p(),help:ae()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:S()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=oe(F.admin.upsertInstanceConfig),n=G(),a=C(F.me.getMe,{host:ue}),o=e.config??{},s=Z(e.config?.contentLocale,a?.defaultLocale??void 0),[c,l]=(0,Q.useState)(()=>z(o,s));(0,Q.useEffect)(()=>{l(z(o,s))},[s,e._id]);let[u,d]=(0,Q.useState)(!1),f=c.promptInjections,p=(e,t)=>l({...c,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){d(!0);try{await t({instanceId:e._id,config:V(c,o,s)})}catch(e){n.error(w(),e)}finally{d(!1)}}async function h(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(w(),e)}}let g=e.config?.contentLocale??`default`,_=fe[Z(void 0,a?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:I()}),(0,$.jsxs)(q,{value:g,onValueChange:e=>void h(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(K,{value:`default`,children:r({locale:_})}),pe().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:O()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:f[e]??{enabled:!0,template:J[e].defaultTemplate[s]},contentLocale:s,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void m(),disabled:u,children:i()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=le(e,r,i),p=f?se(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:h()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ie()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:o?j():ne()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:D()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:L()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:P()})})]})}export{_e as PromptInjectionsTab};
@@ -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 o,FT as s,GT as c,HT as l,IT as u,KT as d,LT as f,MT as p,NT as m,OT as te,PT as h,QB as g,RT as _,ST as ne,TT as v,UT as y,VT as b,WT as x,ZB as S,_T as re,aT as ie,bT as ae,cT as oe,gT as C,iT as w,jT as T,kT as E,lT as D,nT as O,oT as k,ps as A,rT as j,sT as M,t as N,uT as P,vT as F,wT as I,xT as L,yT as R,zT as z}from"./api-2YAlX4o7.js";import{t as B}from"./button-CiAqEDbj.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-ComRJ6Fm.js";import{t as J}from"./roleDescriptions-B61uyDOF.js";var Y=t(e(),1),X=n(),Z=[{group:()=>d(),keys:[{key:`traces.read`,label:()=>b()},{key:`traces.read.content`,label:()=>i(),phi:!0},{key:`traces.write`,label:()=>z()}]},{group:()=>c(),keys:[{key:`kpi.read`,label:()=>b()},{key:`kpi.write`,label:()=>z()}]},{group:()=>x(),keys:[{key:`openclaw.query`,label:()=>_()},{key:`anomalies.read`,label:()=>f()},{key:`anomalies.report`,label:()=>u()}]},{group:()=>y(),keys:[{key:`chats.read`,label:()=>b()},{key:`selfheal`,label:()=>h()},{key:`media.repair`,label:()=>m()},{key:`feedback.respond`,label:()=>A()}]},{group:()=>l(),keys:[{key:`admin.manage`,label:()=>s()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=g(N.apiKeys.listRoles,{}),t=S(N.apiKeys.createRole),n=S(N.apiKeys.ensureRolesSeeded),i=S(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=W(),c=V(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[m,h]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(T(),e)})},[n,c]);let _=e??[];async function y(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:r({name:e.name}),description:E(),confirmLabel:te()});return}if(m.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];h(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(ee(),e)}finally{h(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function b(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),u(!1)}catch(e){c.error(o(),e)}}let x=e===void 0,A=!x&&_.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,I(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,a()]}),(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:ne()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{f($),u(!0)},children:L()})})]}),x?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):A?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(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:F()}),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?p({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:_.map(e=>{let t=Q(e.permissions),n=m.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,{}),` `,re()]}):(0,X.jsx)(U,{variant:`secondary`,children:C()})]}),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?P():n?D():r,onCheckedChange:()=>void y(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:l,onOpenChange:u,title:oe(),description:M(),canSubmit:!!(d.key&&d.name),onSubmit:b,submitLabel:k(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,X.jsx)(K,{value:d.key,placeholder:w(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,X.jsx)(K,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,X.jsx)(K,{value:d.description,onChange:e=>f({...d,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{$L as r,AL as i,AR as a,BL as o,BR as s,CR as c,Cz as l,D as u,DL as ee,DR as d,Dz as f,EL as p,ER as te,Ez as ne,FL as re,FR as ie,GB as m,GR as ae,HL as oe,IL as se,IR as ce,JR as le,KR as ue,LL as de,LR as fe,ML as pe,NL as me,NR as he,OL as ge,OR as _e,PL as ve,PR as ye,QB as be,RL as xe,RR as Se,SR as Ce,Sz as we,TR as Te,Tz as Ee,UB as De,UL as Oe,UR as ke,VL as Ae,VR as h,WR as je,YB as g,_z as Me,aR as Ne,bL as Pe,bR as Fe,bz as Ie,cR as Le,dR as Re,eR as _,fR as ze,fz as Be,gz as Ve,hz as He,iR as v,jL as Ue,kL as We,lR as Ge,mR as Ke,mz as qe,nR as Je,oR as Ye,pR as y,pz as Xe,qR as Ze,rR as Qe,sR as $e,t as b,tR as x,uR as et,vz as tt,wR as nt,wz as rt,xR as it,xz as at,yR as ot,yz as st,zL as ct,zR as lt}from"./api-2YAlX4o7.js";import{t as ut}from"./list-CqoYNGdr.js";import{t as S}from"./button-CiAqEDbj.js";import{$ as C,Bn as w,Bt as T,Ct as dt,Dn as ft,Dt as pt,Et as E,Q as D,Rt as O,St as mt,Tt as ht,Vn as k,X as A,Z as j,_n as gt,_t,at as vt,bn as yt,bt,dn as xt,et as M,gt as St,hn as Ct,it as wt,jt as Tt,nt as Et,on as Dt,ot as Ot,q as kt,rt as At,tt as jt,vt as Mt,wt as Nt,xn as Pt,xt as Ft,yt as It,zt as N}from"./index-ComRJ6Fm.js";import{a as Lt,i as P,n as Rt,o as zt,r as F,t as Bt}from"./table-B1EQZE2q.js";import{t as Vt}from"./FilterBar-CO_K6N4P.js";/* empty css */import{a as Ht,c as I,i as L,l as Ut,n as Wt,o as R,r as Gt,s as Kt,t as qt,u as z}from"./TimezoneCombobox-DlnrjtgN.js";var Jt=u(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Yt=u(`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`}]]),B=t(e(),1),V=n();function H(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt({value:e,onChange:t}){let n=Ut(e),r=(0,B.useMemo)(()=>new Date,[]),[i,a]=(0,B.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,B.useState)(!1),c=(0,B.useMemo)(()=>H(m()),[]),l=(0,B.useMemo)(()=>new Intl.DateTimeFormat(m(),{month:`long`,year:`numeric`}),[]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(m(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=I(i.year,i.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(z(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),p(e,t,n,d,f)},ne=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},re=n===null?y():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,V.jsxs)(O,{modal:!0,open:o,onOpenChange:s,children:[(0,V.jsx)(T,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":Ke(),children:[(0,V.jsx)(Jt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,V.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,V.jsxs)(N,{align:`start`,className:`oc-dtp__pop`,children:[(0,V.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ze(),onClick:()=>ne(-1),children:(0,V.jsx)(k,{size:15,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":Re(),onClick:()=>ne(1),children:(0,V.jsx)(w,{size:15,"aria-hidden":!0})})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,V.jsxs)(A,{value:String(d),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),Number(e),f),children:[(0,V.jsx)(C,{size:`sm`,"aria-label":et(),children:(0,V.jsx)(M,{})}),(0,V.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,V.jsx)(D,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,V.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,V.jsxs)(A,{value:String(f),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,V.jsx)(C,{size:`sm`,"aria-label":Ge(),children:(0,V.jsx)(M,{})}),(0,V.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,V.jsx)(D,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function U(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Zt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Qt(e){let t=new Map;for(let n of e){let e=U(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 $t(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Zt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function 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:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=m(),c=(0,B.useMemo)(()=>Qt(e),[e]),l=(0,B.useMemo)(()=>en(s),[s]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),d=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},te=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,V.jsxs)(`div`,{className:`oc-cal`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":Je(),onClick:()=>p(-1),children:(0,V.jsx)(k,{})}),(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":x(),onClick:()=>p(1),children:(0,V.jsx)(w,{})}),(0,V.jsx)(S,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:Qe()})]}),(0,V.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,V.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,V.jsx)(S,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:Ne()}),(0,V.jsx)(S,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:v()})]})]}),t===`month`?(0,V.jsx)(an,{cursor:n,byDay:c,weekdays:l,timeFmt:d,now:f,onEventClick:a}):(0,V.jsx)(on,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,V.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=I(e.year,e.month);return(0,V.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Zt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,V.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,V.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,V.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,V.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,V.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,V.jsx)(`span`,{className:`oc-cal__more`,children:_({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,V.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=$t(t,e,o),c=I(e,o);return(0,V.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,V.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,V.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,V.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var sn={h:36e5,min:6e4,s:1e3,ms:1};function cn(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])*sn[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var ln=new Map;function q(e){let t=ln.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 ln.set(e,n),n}function J(e,t){if(t!==null){let n=q(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 Y(e,t,n,r,i,a){if(a===null||q(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=J(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 X(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=J(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=Y(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=Y(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 Z=`crons`;function un(e,t){return`${e}\u0000${t}`}function dn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=un(a.instanceName,e.id);i.set(o,a);let s=R(e)!==`active`,c=X(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Z,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var Q={minutes:6e4,hours:36e5,days:864e5};function $(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Kt(e)){case`ok`:return(0,V.jsx)(E,{variant:`secondary`,children:d()});case`error`:return(0,V.jsx)(E,{variant:`destructive`,children:Te()});case`running`:return(0,V.jsx)(E,{variant:`outline`,children:nt()});case`other`:return(0,V.jsx)(E,{variant:`outline`,children:e});case`none`:return(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=g(b.scheduled.listMyCrons),t=g(b.scheduled.getCronDetail),n=g(b.scheduled.listCronRuns),u=g(b.scheduled.updateCron),Ne=g(b.scheduled.removeCron),Re=g(b.scheduled.runCronNow),_=pt(),ze=be(b.me.getMe,{host:kt})?.timezone,[v,Ge]=(0,B.useState)(null),[Ke,Je]=(0,B.useState)(!1),[y,Qe]=(0,B.useState)(!1),[x,et]=(0,B.useState)(null),[w,T]=(0,B.useState)(null),[O,k]=(0,B.useState)(null),[N,I]=(0,B.useState)(null),[Ut,Kt]=(0,B.useState)(!1),[z,H]=(0,B.useState)(Wt),[U,Zt]=(0,B.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Qt=e=>{localStorage.setItem(`oc.sched.view`,e),Zt(e)},[$t,en]=(0,B.useState)(`month`),[W,an]=(0,B.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,B.useMemo)(()=>{let e=[];for(let t of v??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ht(r,z)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[v,z]),sn=(0,B.useMemo)(()=>$t===`year`?nn(W.year):tn(W.year,W.month),[$t,W]),cn=(0,B.useMemo)(()=>dn(on,sn.startMs,sn.endMs),[on,sn]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,B.useCallback)(async()=>{Je(!0),Qe(!1);try{Ge(await e({}))}catch{Qe(!0)}finally{Je(!1)}},[e]);(0,B.useEffect)(()=>{K()},[K]);let ln=(0,B.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),q=(0,B.useRef)(null);(0,B.useEffect)(()=>{v!==null&&q.current!==null&&q.current.scrollIntoView({block:`center`})},[v]);let J=(0,B.useMemo)(()=>new Intl.DateTimeFormat(m(),{dateStyle:`medium`,timeStyle:`short`}),[]),Y=async(e,t,n)=>{et(e);try{await t(),_.success(n),await K()}catch(e){_.toast({variant:`error`,title:h({code:$(e)})})}finally{et(null)}},X=(0,B.useRef)(0),Z=(0,B.useRef)(0),un=async(e,t)=>{if(t.id===null)return;let r=++X.current;k({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==X.current)return;k({name:t.name??t.id,entries:i})}catch(e){if(r!==X.current)return;k(null),_.toast({variant:`error`,title:h({code:$(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Z.current;I({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%Q.days===0?(s=String(e/Q.days),c=`days`):e%Q.hours===0?(s=String(e/Q.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/Q.minutes))),c=`minutes`))}if(r!==Z.current)return;I(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Z.current)return;I(null),_.toast({variant:`error`,title:h({code:$(e)})})}},mn=async()=>{if(N===null)return;let e={};if(N.nameDirty&&N.name.trim()===``||N.messageDirty&&N.hasMessage&&N.message.trim()===``){_.toast({variant:`error`,title:p()});return}if(N.nameDirty&&N.name.trim()!==``&&(e.name=N.name.trim()),N.scheduleDirty){if(N.scheduleKind===`cron`&&N.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:N.cronExpr.trim(),...N.tz.trim()===``?{}:{tz:N.tz.trim()}};else if(N.scheduleKind===`every`){let t=Number(N.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*Q[N.everyUnit])})}else if(N.scheduleKind===`at`&&N.at!==``){let t=Date.parse(N.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(N.scheduleDirty&&e.schedule===void 0){_.toast({variant:`error`,title:ee()});return}if(N.messageDirty&&N.hasMessage&&N.message.trim()!==``&&(e.message=N.message.trim()),Object.keys(e).length===0){I(null);return}let t=Z.current;Kt(!0);try{await u({instanceName:N.instanceName,jobId:N.jobId,patch:e}),_.success(o()),t===Z.current&&I(null),await K()}catch(e){_.toast({variant:`error`,title:h({code:$(e)})})}finally{Kt(!1)}},hn=v?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:f()}),(0,V.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":Le(),children:[(0,V.jsx)(S,{variant:U===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":$e(),title:$e(),"aria-pressed":U===`list`,onClick:()=>Qt(`list`),children:(0,V.jsx)(ut,{})}),(0,V.jsx)(S,{variant:U===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ye(),title:Ye(),"aria-pressed":U===`calendar`,onClick:()=>Qt(`calendar`),children:(0,V.jsx)(Jt,{})})]}),(0,V.jsxs)(S,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:Ke,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,V.jsx)(Ct,{size:14,"aria-hidden":!0}),ne()]})]}),v!==null&&hn>0?(0,V.jsxs)(Vt,{q:z.q,onQChange:e=>H(t=>({...t,q:e})),searchPlaceholder:Ce(),onReset:()=>H(Wt),canReset:Gt(z),children:[(0,V.jsxs)(A,{value:z.state,onValueChange:e=>H(t=>({...t,state:e})),children:[(0,V.jsx)(C,{size:`sm`,className:`w-40`,children:(0,V.jsx)(M,{})}),(0,V.jsxs)(j,{children:[(0,V.jsx)(D,{value:`all`,children:it()}),(0,V.jsx)(D,{value:`active`,children:Xe()}),(0,V.jsx)(D,{value:`paused`,children:qe()}),(0,V.jsx)(D,{value:`auto-disabled`,children:Be()})]})]}),(0,V.jsxs)(A,{value:z.result,onValueChange:e=>H(t=>({...t,result:e})),children:[(0,V.jsx)(C,{size:`sm`,className:`w-40`,children:(0,V.jsx)(M,{})}),(0,V.jsxs)(j,{children:[(0,V.jsx)(D,{value:`all`,children:Fe()}),(0,V.jsx)(D,{value:`ok`,children:d()}),(0,V.jsx)(D,{value:`error`,children:Te()}),(0,V.jsx)(D,{value:`running`,children:nt()}),(0,V.jsx)(D,{value:`none`,children:c()})]})]})]}):null,v===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Ke,children:y?Ee():De()}):U===`calendar`?(0,V.jsxs)(V.Fragment,{children:[y?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):null,v.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:rt()}):(0,V.jsx)(rn,{events:cn.events,mode:$t,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:G,footnote:r()})]}):(0,V.jsxs)(V.Fragment,{children:[y?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):null,v.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:rt()}):null,v.map(e=>{let t=e.jobs.filter(e=>Ht(e,z)),n=Gt(z)&&e.jobs.length>0&&t.length===0;return(0,V.jsxs)(`section`,{style:{marginBottom:20},children:[v.length>1||e.error||!e.supported?(0,V.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,V.jsx)(E,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:we({code:e.error})}):e.jobs.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:at()}):n?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):(0,V.jsxs)(Bt,{children:[(0,V.jsx)(Lt,{children:(0,V.jsxs)(zt,{children:[(0,V.jsx)(P,{children:Ie()}),(0,V.jsx)(P,{children:st()}),(0,V.jsx)(P,{children:tt()}),(0,V.jsx)(P,{children:Me()}),(0,V.jsx)(P,{children:Ve()}),(0,V.jsx)(P,{children:_e()}),(0,V.jsx)(P,{children:Oe()})]})}),(0,V.jsx)(Rt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=x===r,a=e.manageSupported,o=e.kind===`openclaw`&&a;return(0,V.jsxs)(zt,{ref:t.id!==null&&t.id===ln?q:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,V.jsx)(F,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??He()}),(0,V.jsx)(F,{children:(0,V.jsx)(E,{variant:`secondary`,children:t.agentId})}),(0,V.jsxs)(F,{className:`whitespace-nowrap`,children:[(0,V.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=St(t.schedule),n=e===null?null:_t(e);return n===null?null:(0,V.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,V.jsx)(F,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:J.format(t.nextRunAtMs)}),(0,V.jsx)(F,{children:R(t)===`auto-disabled`?(0,V.jsx)(E,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${J.format(t.autoDisabledAtMs)}`}`,children:Be()}):R(t)===`active`?(0,V.jsx)(E,{variant:`secondary`,children:Xe()}):R(t)===`paused`?(0,V.jsx)(E,{variant:`outline`,children:qe()}):(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,V.jsxs)(F,{children:[(0,V.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,V.jsx)(E,{variant:`destructive`,title:t.lastDeliveryError??le(),children:te()}):null]}),(0,V.jsx)(F,{className:`whitespace-nowrap`,children:t.id===null?(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,V.jsx)(ft,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsxs)(`span`,{className:`oc-cronactions`,children:[o?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:ue(),"aria-label":ue(),disabled:x!==null,onClick:()=>void Y(r,async()=>{let n=await Re({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},s()),children:(0,V.jsx)(Dt,{size:14,"aria-hidden":!0})}):null,o&&t.enabled!==null?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:L(t)===`pause`?ae():je(),"aria-label":L(t)===`pause`?ae():je(),disabled:x!==null,onClick:()=>void Y(r,()=>u({instanceName:e.instanceName,jobId:t.id,patch:{enabled:L(t)===`resume`}}),L(t)===`pause`?lt():Se()),children:L(t)===`pause`?(0,V.jsx)(Pt,{size:14,"aria-hidden":!0}):(0,V.jsx)(gt,{size:14,"aria-hidden":!0})}):null,o?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:oe(),"aria-label":oe(),disabled:x!==null,onClick:()=>void pn(e.instanceName,t),children:(0,V.jsx)(yt,{size:14,"aria-hidden":!0})}):null,o?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:Ae(),"aria-label":Ae(),disabled:x!==null,onClick:()=>void un(e.instanceName,t),children:(0,V.jsx)(Yt,{size:14,"aria-hidden":!0})}):null,a?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:ke(),"aria-label":ke(),disabled:x!==null,onClick:()=>T({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,V.jsx)(xt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]},e.instanceName)}),hn>0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Pe()}):null]}),(0,V.jsx)(Mt,{open:w!==null,onOpenChange:e=>{e||T(null)},children:(0,V.jsxs)(Ft,{children:[(0,V.jsxs)(Nt,{children:[(0,V.jsx)(ht,{children:ce()}),(0,V.jsx)(mt,{children:ie({name:w?.name??``})})]}),(0,V.jsxs)(dt,{children:[(0,V.jsx)(bt,{children:ye()}),(0,V.jsx)(It,{onClick:()=>{let e=w;T(null),e!==null&&Y(`${e.instanceName}:${e.jobId}`,()=>Ne({instanceName:e.instanceName,jobId:e.jobId}),fe())},children:he()})]})]})}),(0,V.jsx)(jt,{open:O!==null,onOpenChange:e=>{e||(X.current++,k(null))},children:(0,V.jsxs)(Et,{style:{maxWidth:640},children:[(0,V.jsx)(vt,{children:(0,V.jsx)(Ot,{children:ct({name:O?.name??``})})}),O?.entries===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):O!==null&&O.entries.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):O===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:O.entries.map((e,t)=>(0,V.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,V.jsx)(fn,{status:e.status}),(0,V.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?J.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,V.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[a({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,V.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,V.jsx)(jt,{open:N!==null,onOpenChange:e=>{e||(Z.current++,I(null))},children:(0,V.jsxs)(Et,{className:`oc-cronedit`,children:[(0,V.jsxs)(vt,{children:[(0,V.jsx)(Ot,{children:de()}),(0,V.jsx)(At,{children:se()})]}),N===null?null:N.loading?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ie()}),(0,V.jsx)(Tt,{value:N.name,maxLength:200,onChange:e=>I({...N,name:e.target.value,nameDirty:!0})})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:re()}),(0,V.jsxs)(A,{value:N.scheduleKind,onValueChange:e=>I({...N,scheduleKind:e,scheduleDirty:!0}),children:[(0,V.jsx)(C,{children:(0,V.jsx)(M,{})}),(0,V.jsxs)(j,{children:[(0,V.jsx)(D,{value:`cron`,children:ve()}),(0,V.jsx)(D,{value:`every`,children:me()}),(0,V.jsx)(D,{value:`at`,children:pe()})]})]}),N.scheduleKind===`cron`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(Tt,{value:N.cronExpr,onChange:e=>I({...N,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,V.jsx)(qt,{value:N.tz,onChange:e=>I({...N,tz:e,scheduleDirty:!0}),fallbackTz:ze??void 0})]}):N.scheduleKind===`every`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(Tt,{type:`number`,min:1,value:N.everyValue,onChange:e=>I({...N,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,V.jsxs)(A,{value:N.everyUnit,onValueChange:e=>I({...N,everyUnit:e,scheduleDirty:!0}),children:[(0,V.jsx)(C,{style:{maxWidth:160},children:(0,V.jsx)(M,{})}),(0,V.jsxs)(j,{children:[(0,V.jsx)(D,{value:`minutes`,children:Ue()}),(0,V.jsx)(D,{value:`hours`,children:i()}),(0,V.jsx)(D,{value:`days`,children:We()})]})]})]}):(0,V.jsx)(Xt,{value:N.at,onChange:e=>I({...N,at:e,scheduleDirty:!0})})]}),N.hasMessage?(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ze()}),(0,V.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:N.message,onChange:e=>I({...N,message:e.target.value,messageDirty:!0})})]}):null]}),(0,V.jsxs)(wt,{children:[(0,V.jsx)(S,{variant:`ghost`,onClick:()=>I(null),children:ye()}),(0,V.jsxs)(S,{onClick:()=>void mn(),disabled:N===null||N.loading||Ut,children:[Ut?(0,V.jsx)(ft,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ge()]})]})]})})]})}export{pn as ScheduledTab};