@lacneu/atrium 0.64.0 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/dist/assets/AccessTab-JCA7fZ9L.js +1 -0
  2. package/dist/assets/AdvancedFilter-CHaC3XqK.js +1 -0
  3. package/dist/assets/AgentFilesTab-DFl5KrJ6.js +3 -0
  4. package/dist/assets/AnomaliesTab-D_2rZvDm.js +1 -0
  5. package/dist/assets/AuditTab-pIPOy40q.js +1 -0
  6. package/dist/assets/BridgeTab-BHFEZ8Tf.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-D8voH6BO.js +1 -0
  8. package/dist/assets/DataTableShell-D21VGOsx.js +1 -0
  9. package/dist/assets/{DetailChips-KZ6IBAE_.js → DetailChips-BvOufdR5.js} +1 -1
  10. package/dist/assets/FeedbacksTab-D7EWcEXh.js +1 -0
  11. package/dist/assets/{FieldLabel-DSkWwP2e.js → FieldLabel-BkPn70WH.js} +8 -2
  12. package/dist/assets/FilesTab-DH_nWUT9.js +1 -0
  13. package/dist/assets/FilterBar-B2rdcXo-.js +1 -0
  14. package/dist/assets/GroupsTab-C5SRlaBh.js +1 -0
  15. package/dist/assets/InstancesTab-BbBfU2M8.js +1 -0
  16. package/dist/assets/IntegrationsTab-Bhrt_3mL.js +1 -0
  17. package/dist/assets/KpiTab-CqrNDV0R.js +1 -0
  18. package/dist/assets/PreferencesTab-cE6r_AZd.js +1 -0
  19. package/dist/assets/ProjectPage-CYltKiEJ.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-8XGCJFsP.js +4 -0
  21. package/dist/assets/RolesTab-D-h-9bci.js +1 -0
  22. package/dist/assets/ScheduledTab-DqKsYZCk.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-ugnT2ad6.js +1 -0
  24. package/dist/assets/SubAgentReportsTab-D6ctqPBm.js +1 -0
  25. package/dist/assets/ThemeShowroom-DJxNALnu.js +1 -0
  26. package/dist/assets/TimeRangePicker-hED8r05n.js +1 -0
  27. package/dist/assets/TimezoneCombobox-yOLv96pi.js +1 -0
  28. package/dist/assets/TracesTab-DxKuLnoV.js +1 -0
  29. package/dist/assets/UsersTab-wvWYaxpO.js +1 -0
  30. package/dist/assets/VoiceTab-DUevCd90.js +1 -0
  31. package/dist/assets/api-CtSSWr7U.js +44 -0
  32. package/dist/assets/button-wKI2Tt4J.js +1 -0
  33. package/dist/assets/card-CJ2aHkj_.js +1 -0
  34. package/dist/assets/check-C6IJbaM9.js +1 -0
  35. package/dist/assets/chevron-up-DXtuCSZO.js +1 -0
  36. package/dist/assets/chevrons-up-down-DThxT9O7.js +1 -0
  37. package/dist/assets/compatView-oAAoNQED.js +1 -0
  38. package/dist/assets/dispatchErrorInfo-BURg2cAZ.js +1 -0
  39. package/dist/assets/dist-BiYzLO8Z.js +1 -0
  40. package/dist/assets/dist-CQacamxA.js +5 -0
  41. package/dist/assets/dist-MF--QEbp.js +1 -0
  42. package/dist/assets/{highlighted-body-OFNGDK62-CB68xClL.js → highlighted-body-OFNGDK62-DyuLdYIi.js} +1 -1
  43. package/dist/assets/index-Dvtp4XJ3.css +1 -0
  44. package/dist/assets/index-gsM_dJLK.js +238 -0
  45. package/dist/assets/list-LOA_FvDd.js +1 -0
  46. package/dist/assets/mermaid-GHXKKRXX-C5M82A9X.js +1 -0
  47. package/dist/assets/{pdf-TGis77gc.js → pdf-1Br_HKW6.js} +1 -1
  48. package/dist/assets/roleDescriptions-xfA2NfTy.js +1 -0
  49. package/dist/assets/table-CzZqanD8.js +1 -0
  50. package/dist/assets/tabs-BqUPTpU0.js +1 -0
  51. package/dist/assets/x-Ce5BXizZ.js +1 -0
  52. package/dist/index.html +10 -10
  53. package/package.json +1 -1
  54. package/dist/assets/AccessTab-CBVHd2Iu.js +0 -1
  55. package/dist/assets/AdvancedFilter-Bt1eVvHP.js +0 -1
  56. package/dist/assets/AgentFilesTab-BohV-adj.js +0 -3
  57. package/dist/assets/AnomaliesTab-EQ_VT5g5.js +0 -1
  58. package/dist/assets/AuditTab-BNbnYz56.js +0 -1
  59. package/dist/assets/BridgeTab-BvWUat6m.js +0 -1
  60. package/dist/assets/ChatDefaultsTab-e5KaQK3Y.js +0 -1
  61. package/dist/assets/DataTableShell-C8TvrDnS.js +0 -1
  62. package/dist/assets/FeedbacksTab-CNE_EiBr.js +0 -1
  63. package/dist/assets/FilesTab-BVwtwtbk.js +0 -1
  64. package/dist/assets/FilterBar-D1X-NYiQ.js +0 -1
  65. package/dist/assets/GroupsTab-CCbkJsjt.js +0 -1
  66. package/dist/assets/InstancesTab-mcPK_zLE.js +0 -1
  67. package/dist/assets/IntegrationsTab-CelkZ3qy.js +0 -1
  68. package/dist/assets/KpiTab-Bci6HkZZ.js +0 -1
  69. package/dist/assets/PreferencesTab-C_G9wJMM.js +0 -1
  70. package/dist/assets/ProjectPage-Bzczemnc.js +0 -1
  71. package/dist/assets/PromptInjectionsTab-DB-9icKP.js +0 -4
  72. package/dist/assets/RolesTab-6KibifRX.js +0 -1
  73. package/dist/assets/ScheduledTab-D4HfwMsR.js +0 -1
  74. package/dist/assets/ServiceAccountsTab-BP5M1qoc.js +0 -1
  75. package/dist/assets/SubAgentReportsTab-clUXZIsv.js +0 -1
  76. package/dist/assets/ThemeShowroom-DObwBmje.js +0 -1
  77. package/dist/assets/TimeRangePicker-Cc-m21ii.js +0 -1
  78. package/dist/assets/TimezoneCombobox-bRTawtDX.js +0 -1
  79. package/dist/assets/TracesTab-BCArDQYw.js +0 -1
  80. package/dist/assets/UsersTab-htPZvQ3W.js +0 -1
  81. package/dist/assets/VoiceTab-DrlhpckV.js +0 -1
  82. package/dist/assets/button-9CDM33ms.js +0 -1
  83. package/dist/assets/card-cbtxUmVi.js +0 -1
  84. package/dist/assets/check-DP-dt0kl.js +0 -1
  85. package/dist/assets/chevron-up-Zim_BdlH.js +0 -1
  86. package/dist/assets/chevrons-up-down-Dynznz1g.js +0 -1
  87. package/dist/assets/compatView-zajsEi96.js +0 -1
  88. package/dist/assets/dispatchErrorInfo-BwVeZJIC.js +0 -1
  89. package/dist/assets/dist-BOEXkJhX.js +0 -1
  90. package/dist/assets/dist-CKeB-cox.js +0 -44
  91. package/dist/assets/dist-CVc9CU_a.js +0 -5
  92. package/dist/assets/dist-_mTpkDcR.js +0 -1
  93. package/dist/assets/index-Bjld8kqu.js +0 -238
  94. package/dist/assets/index-CjUx3yzx.css +0 -1
  95. package/dist/assets/list-AW1nQPBF.js +0 -1
  96. package/dist/assets/mermaid-GHXKKRXX-ms4fjIoL.js +0 -1
  97. package/dist/assets/roleDescriptions-BIxax60M.js +0 -1
  98. package/dist/assets/table-QZEG8lub.js +0 -1
  99. package/dist/assets/tabs-XFZCx7lK.js +0 -1
  100. package/dist/assets/x-DJVrcLrv.js +0 -1
@@ -0,0 +1 @@
1
+ import{aS as e,cS as t,iS as n,oS as r,sS as i}from"./api-CtSSWr7U.js";var a={pending:t,user:i,admin:r,observer:e,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -0,0 +1 @@
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-CtSSWr7U.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{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-CtSSWr7U.js";import{t as d}from"./dist-BiYzLO8Z.js";import{Gt as f,Kt as p,qt as m}from"./index-gsM_dJLK.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),d=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./api-CtSSWr7U.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
package/dist/index.html CHANGED
@@ -62,17 +62,17 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-Bjld8kqu.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-gsM_dJLK.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/dist-CKeB-cox.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-BOEXkJhX.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-_mTpkDcR.js">
70
- <link rel="modulepreload" crossorigin href="/assets/dist-CVc9CU_a.js">
71
- <link rel="modulepreload" crossorigin href="/assets/check-DP-dt0kl.js">
72
- <link rel="modulepreload" crossorigin href="/assets/chevron-up-Zim_BdlH.js">
73
- <link rel="modulepreload" crossorigin href="/assets/x-DJVrcLrv.js">
74
- <link rel="modulepreload" crossorigin href="/assets/button-9CDM33ms.js">
75
- <link rel="stylesheet" crossorigin href="/assets/index-CjUx3yzx.css">
67
+ <link rel="modulepreload" crossorigin href="/assets/api-CtSSWr7U.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-MF--QEbp.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-BiYzLO8Z.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/dist-CQacamxA.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/check-C6IJbaM9.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/chevron-up-DXtuCSZO.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/x-Ce5BXizZ.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/button-wKI2Tt4J.js">
75
+ <link rel="stylesheet" crossorigin href="/assets/index-Dvtp4XJ3.css">
76
76
  </head>
77
77
  <body>
78
78
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.64.0",
3
+ "version": "0.65.0",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Cf as i,Df as a,Ef as o,Ff as s,GI as c,Mf as l,Nf as u,Of as d,Pf as f,Sf as p,T as m,Tf as h,eL as g,jf as _,kf as v,wf as y,xf as b}from"./dist-CKeB-cox.js";import{At as x,Dt as S,Ot as C,gt as w,jt as T,kt as E}from"./index-Bjld8kqu.js";var D=t(e(),1);function O(e){return e===`user`?h():e===`all`?y():i({group:e.group})}function k(e){return e===`common`?p():e===`owner`?b():i({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=g(m.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=g(m.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,A.jsxs)(S,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":f(),children:(0,A.jsx)(T,{placeholder:f()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(E,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:l()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:o()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:v()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gm as r,Hm as i,Jm as a,Km as o,Um as s,Wm as c,qm as l}from"./dist-CKeB-cox.js";import{r as u}from"./dist-_mTpkDcR.js";import{t as d}from"./x-DJVrcLrv.js";import{t as f}from"./button-9CDM33ms.js";import{At as p,Dt as m,Ot as h,_t as g,jt as _,kt as v,ln as y}from"./index-Bjld8kqu.js";import{r as b}from"./TimeRangePicker-Cc-m21ii.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),l(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(m,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:r()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(m,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(v,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(g,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(y,{}),i()]})]}):null]})}export{D as t};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$i as i,$l as a,$u as o,Bi as s,GI as c,Gl as l,Hi as u,Hl as d,Jl as f,Kl as p,Qi as m,Ql as h,Ri as g,T as _,Ui as v,Ul as y,Vi as b,Vl as x,Wi as S,Wl as C,Xl as w,Yl as T,ZI as E,Zi as D,Zl as O,Zu as k,_a as A,aa as j,au as ee,ca as M,cu as N,da as P,du as F,eL as I,ea as L,eu as te,fa as R,fu as z,ga as B,gu as ne,ha as V,hu as re,ia as H,iu as U,la as ie,lu as ae,ma as oe,mu as se,na as ce,nu as le,oa as ue,ou as de,pa as fe,pu as pe,qI as W,ql as me,ra as he,ru as ge,sa as _e,su as ve,ta as ye,tu as be,ua as xe,uk as Se,uu as Ce,zi as we}from"./dist-CKeB-cox.js";import{t as G}from"./button-9CDM33ms.js";import{$ as Te,At as Ee,Ct as De,Dt as Oe,Lt as ke,Ot as K,St as Ae,V as je,at as Me,bt as Ne,et as Pe,gt as Fe,it as Ie,jt as Le,kt as Re,nt as ze,ot as Be,qt as q,rn as J,rt as Ve,tt as He,vt as Ue,yt as We}from"./index-Bjld8kqu.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-zajsEi96.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(e,t){let n=new Map;for(let t of e.split(`
2
- `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=I(_.me.getMe,{host:ke}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=I(_.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=I(_.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=I(_.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,Y.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,Y.useState)(null);(0,Y.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=E(_.agentFiles.listAgentFiles),[m,h]=(0,Y.useState)({status:`idle`}),g=f?.instanceName??null,v=f?.agentId??null,y=I(_.compat.forInstance,n&&g!==null?{instanceName:g}:`skip`),b=n&&g!==null?je(y,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,S=(0,Y.useCallback)(async()=>{if(!(g===null||v===null)){h({status:`loading`});try{h({status:`done`,files:(await p({instanceName:g,agentId:v})).files})}catch{h({status:`error`})}}},[p,g,v]);(0,Y.useEffect)(()=>{x===!1&&S()},[S,x]);let[C,w]=(0,Y.useState)(null),T=I(_.agentFileCuration.listCurations,t&&g!==null&&v!==null?{instanceName:g,agentId:v}:`skip`),D=I(_.agentFileCuration.curationSettings,t&&g!==null?{instanceName:g}:`skip`),O=E(_.agentFileCuration.requestCuration),[A,j]=(0,Y.useState)(null),[M,P]=(0,Y.useState)(null),{toast:L}=q(),te=(0,Y.useMemo)(()=>{let e=new Map;for(let t of T??[])e.has(t.name)||e.set(t.name,t);return e},[T]),B=(0,Y.useCallback)(async e=>{if(!(g===null||v===null)){j(e);try{let t=await O({instanceName:g,agentId:v,name:e,trigger:`manual`});t.ok?L({title:oe(),variant:`success`}):L({title:fe({reason:t.reason??`unknown`}),variant:`error`})}catch{L({title:R(),variant:`error`})}finally{j(null)}}},[O,g,v,L]),V=W(),H=(0,Y.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Oe,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":re(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(K,{children:(r??[]).map(e=>(0,Q.jsx)(Re,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(Oe,{value:u??``,onValueChange:e=>d(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":se(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(K,{children:l.map(e=>(0,Q.jsx)(Re,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()})]}),f===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(b.gatewayVersion,b.provider)]}):m.status===`loading`||m.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):m.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[F(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:k()})]}):m.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:m.files.map(e=>{let n=Ye(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Fe,{variant:`outline`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ae({size:Z(e.size,V)})}),(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:N({pct:H.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":ve()}):(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:()=>w(e),children:t?ee():U()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:D?.budgetChars??null,enabled:D?.enabled??!1,curation:te.get(e.name)??null,inFlight:A===e.name,onCurate:()=>void B(e.name),onReview:e=>P(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:de({used:Z(Ze(m.files),V),total:Z(Je,V),pct:H.format(Xe(Ze(m.files)))})})]}),C&&f?(0,Q.jsx)(rt,{instanceName:f.instanceName,agentId:f.agentId,name:C.name,isAdmin:t,onClose:()=>w(null),onSaved:()=>void S()}):null,M?(0,Q.jsx)(it,{curationId:M,onClose:()=>P(null),onApplied:()=>{P(null),S()}}):null]})}function nt({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:B()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Fe,{variant:`outline`,className:`oc-afiles__curate-status`,children:V()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:A()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:s}){let u=E(_.agentFiles.getAgentFile),m=E(_.agentFiles.setAgentFile),g=q(),[v,b]=(0,Y.useState)(null),[S,D]=(0,Y.useState)(!1),[A,j]=(0,Y.useState)(``),[ee,M]=(0,Y.useState)(!1),[N,P]=(0,Y.useState)(!1),[F,I]=(0,Y.useState)(!1),[L,R]=(0,Y.useState)(!1),z=(0,Y.useCallback)(async r=>{D(!1);try{let i=await u({instanceName:e,agentId:t,name:n});b({content:i.content,updatedAtMs:i.updatedAtMs}),r||j(i.content),I(!1)}catch{D(!0)}},[u,e,t,n]);(0,Y.useEffect)(()=>{z(!1)},[z]);async function B(){if(v!==null){P(!0),R(!1);try{await m({instanceName:e,agentId:t,name:n,content:A,baseUpdatedAtMs:v.updatedAtMs??void 0}),g.success(O({name:n})),s(),await z(!1)}catch(e){et(e)?I(!0):R(!0)}finally{P(!1)}}}let ne=v!==null&&A!==v.content,V=(0,Y.useMemo)(()=>v===null?null:$e(v.content,A),[v,A]),re=A.length>X,H=W(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H),[H]);return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(We,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(De,{children:ge({name:n})}),(0,Q.jsxs)(Ne,{children:[le({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,be()]})]})]}),S?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[T(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void z(!1),children:k()})]}):v===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:A,readOnly:!r,spellCheck:!1,onChange:e=>j(e.target.value),"aria-label":ge({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:te()}),F?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void z(!0),children:me()})]}):null,L?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:w()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${re?` is-over`:``}`,children:a({count:U.format(A.length),max:U.format(X)})}),r?(0,Q.jsx)(G,{size:`sm`,disabled:!ne||N||F,onClick:()=>M(!0),children:N?o():h()}):null]})]}),(0,Q.jsx)(Te,{open:ee,onOpenChange:M,children:(0,Q.jsxs)(ze,{children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Be,{children:p({name:n})}),(0,Q.jsx)(Ve,{children:l({agent:t})})]}),V?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:C({added:V.added,removed:V.removed})}),V.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:y()}),V.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,V.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:d()}),V.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(He,{children:Se()}),(0,Q.jsx)(Pe,{onClick:()=>void B(),children:x()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let a=I(_.agentFileCuration.getProposal,{curationId:e}),l=E(_.agentFileCuration.approveCuration),d=r(_.agentFileCuration.rejectCuration),{toast:f}=q(),[p,h]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(``),T=W(),O=(0,Y.useMemo)(()=>a?$e(a.beforeContent,a.proposedContent):null,[a]);async function k(){h(`approve`);try{let t=await l({curationId:e});t.ok?(f({title:P(),variant:`success`}),n()):f({title:t.reason===`conflict`?ie():M({reason:t.reason??`unknown`}),variant:`error`})}catch{f({title:R(),variant:`error`})}finally{h(null)}}async function A(n){h(`reject`);try{let r=C.trim();(await d({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?f({title:n?we():xe(),variant:`success`}):f({title:j(),variant:`error`}),t()}catch{f({title:R(),variant:`error`})}finally{h(null)}}return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(We,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(De,{children:a?_e({name:a.name}):c()}),(0,Q.jsx)(Ne,{children:ue()})]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):a===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[H({before:Z(a.beforeSize,T),after:Z(a.proposedSize,T)}),a.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,he()]}):null]}),O?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:ce({added:O.added,removed:O.removed})}):null,a.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:g({feedback:a.feedback})}):null,O&&O.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:D()}),(0,Q.jsx)(`ul`,{children:O.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:m()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ye()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:a.proposedContent})]})]})]}),y?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:S()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:v(),value:C,onChange:e=>w(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`ghost`,onClick:()=>x(!1),disabled:p!==null,children:u()}),(0,Q.jsx)(G,{variant:`outline`,onClick:()=>void A(!1),disabled:p!==null,children:p===`reject`?o():b()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void A(!0),disabled:p!==null,children:p===`reject`?o():s()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`outline`,onClick:()=>x(!0),disabled:p!==null||a==null,children:L()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void k(),disabled:p!==null||a==null,children:p===`approve`?o():i()})]})]})})}export{tt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$b as i,Ax as ee,Cx as a,Dx as te,Ex as ne,Fx as re,Ix as ie,Jb as o,Lx as s,Mx as c,Nx as l,Ox as ae,Px as oe,Qb as u,Rx as d,Sx as se,T as f,Tx as ce,Xb as p,Yb as m,Zb as h,_x as le,ax as ue,bx as de,cx as g,dx as fe,eL as _,ex as v,fx as y,gx as b,hx as pe,ix as me,jx as he,kx as ge,lx as _e,mx as x,nx as ve,ox as S,px as C,qb as w,rx as T,sx as E,tx as D,ux as O,vx as k,wx as A,xx as j,yx as M,zx as N}from"./dist-CKeB-cox.js";import{At as P,Ct as F,Dt as I,Fn as ye,Lt as be,Ot as L,Pn as R,St as z,Z as xe,ct as B,gt as V,i as Se,jt as H,kt as U,o as Ce,qt as we,vt as W,yt as G}from"./index-Bjld8kqu.js";import{n as Te}from"./TimeRangePicker-Cc-m21ii.js";import{t as Ee}from"./FilterBar-D1X-NYiQ.js";import{t as De}from"./DataTableShell-C8TvrDnS.js";import{t as K}from"./dispatchErrorInfo-BwVeZJIC.js";var q=t(e(),1),J=n(),Y=`__all__`,Oe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function ke(e){return e===`open`?N():e===`acknowledged`?d():s()}var Ae=[`info`,`warn`,`critical`],je=[`detector`,`agent`,`user`],Me={kind:`relative`,from:`now-30d`,to:`now`},Ne=200,X=`all`;function Z(){let e=ye({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,i=e.status===X?Y:e.status,o=e.severity??Y,s=e.kind??Y,[u,d]=(0,q.useState)(Y),p=Se(e.from,e.to),{from:m,to:h}=Te(p),v=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),w=e=>void t({search:t=>({...t,status:e===Y?X:e})}),N=e=>void t({search:t=>({...t,severity:e===Y?void 0:e})}),F=e=>void t({search:t=>({...t,kind:e===Y?void 0:e})}),z=e=>void t({search:t=>({...t,...Ce(e)})}),W=xe(),G=we(),K=r(f.anomalies.resolveAnomaly),Z=(_(f.me.getMe,{host:be})?.permissions??[]).includes(`admin.manage`),Q=_(f.anomalies.listAnomalies,{limit:Ne,filter:{q:n||void 0,from:m,to:h,anomalyStatus:i===Y?void 0:i,severity:o===Y?void 0:o,source:u===Y?void 0:u,kind:s===Y?void 0:s}}),$=(0,q.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),ze=n!==``||i!==`open`||o!==Y||u!==Y||s!==Y||p.kind!==`relative`||p.from!==Me.from;function Be(){d(Y),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await W({title:ie(),description:(0,J.jsxs)(J.Fragment,{children:[re(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,oe(),` `,(0,J.jsx)(`strong`,{children:l()}),`.`,` `,c()]}),confirmLabel:he()}))try{await K({anomalyId:e._id,status:`resolved`}),G.success(ee(),e.kind)}catch(e){G.error(ge(),e)}}async function He(e){try{await K({anomalyId:e._id,status:`acknowledged`}),G.success(ae(),e.kind)}catch(e){G.error(te(),e)}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,J.jsx)(`strong`,{children:ce()}),` `,A(),` `,(0,J.jsx)(`strong`,{children:a()}),` `,se(),` `,(0,J.jsx)(`strong`,{children:j()}),` `,de(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:M()})]}),(0,J.jsxs)(Ee,{q:n,onQChange:v,searchPlaceholder:k(),timeRange:p,onTimeRangeChange:z,onReset:Be,canReset:ze,children:[(0,J.jsxs)(I,{value:i,onValueChange:w,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:le()}),Oe.map(e=>(0,J.jsx)(U,{value:e.value,children:ke(e.value)},e.value))]})]}),(0,J.jsxs)(I,{value:o,onValueChange:N,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{placeholder:b()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:pe()}),Ae.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:u,onValueChange:d,children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:x()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:C()}),je.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(I,{value:s,onValueChange:F,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{placeholder:y()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(U,{value:Y,children:fe()}),$.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]})]}),(0,J.jsx)(De,{title:O(),rows:Q,emptyHint:i===`open`?_e():g(),rowActions:e=>Z&&e.status===`open`?[{label:E(),onSelect:()=>void Ve(e)},{label:S(),onSelect:()=>void He(e)}]:[],columns:[{header:ue(),cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:B(e.at)}),sort:e=>e.at},{header:y(),cell:e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:b(),cell:e=>(0,J.jsx)(Ie,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:me(),cell:e=>(0,J.jsx)(Le,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:x(),cell:e=>(0,J.jsx)(V,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:T(),cell:e=>(0,J.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,J.jsx)(Fe,{row:e})]}),sort:e=>e.message},{header:ve(),cell:e=>(0,J.jsx)(Pe,{row:e}),sort:e=>e.evidence??null},{header:D(),cell:e=>e.correlationId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Q(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(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 Pe({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=$(e);return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,v()]}):null]})}let n=Q(e);if(!n.dominantCode)return(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=K(n.dominantCode),i=n.sampleCorrelationId;return(0,J.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,J.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,J.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,J.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,v()]}):null]})}function Fe({row:e}){let[t,n]=(0,q.useState)(!1),r=_(f.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[i(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,J.jsx)(W,{open:t,onOpenChange:n,children:(0,J.jsxs)(G,{className:`oc-anomaly__attachments-dialog`,children:[(0,J.jsx)(z,{children:(0,J.jsx)(F,{children:u()})}),r===void 0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:h()}):r.length===0?(0,J.jsx)(`p`,{className:`oc-traces__muted`,children:p()}):(0,J.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,J.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,J.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,J.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ie({severity:e}){return(0,J.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Le({status:e}){return e===`open`?(0,J.jsx)(V,{variant:`destructive`,children:m()}):e===`acknowledged`?(0,J.jsx)(V,{variant:`secondary`,children:o()}):(0,J.jsx)(V,{variant:`outline`,children:w()})}function Re(e){return e.length>8?e.slice(0,8):e}export{Z as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AS as r,BS as i,Br as a,FS as o,Fr as s,HS as c,IS as l,Ir as u,LS as d,Lr as f,MS as p,NS as m,PS as h,RS as g,Rr as _,T as v,US as y,VS as b,WS as x,eL as S,jS as C,zS as w,zr as T}from"./dist-CKeB-cox.js";import{At as E,Dt as D,Fn as O,Ot as k,Pn as A,a as j,ct as M,i as N,jt as P,kt as F,n as I,o as L,s as R}from"./index-Bjld8kqu.js";import{n as ee}from"./TimeRangePicker-Cc-m21ii.js";import{t as z}from"./FilterBar-D1X-NYiQ.js";import{t as B}from"./AdvancedFilter-Bt1eVvHP.js";import{t as V}from"./DataTableShell-C8TvrDnS.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:T()},{value:`targetLabel`,label:_()},{value:`impersonated`,label:f()},{value:`resource`,label:u()},{value:`resourceId`,label:s()}];function q(){let e=O({from:`/settings/audit`}),t=A({from:`/settings/audit`}),n=e.q??``,a=e.action??G,s=e.impersonated??G,u=e.resource??G,f=N(e.from,e.to),_=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:I}=ee(f),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:j(e)}),replace:!0}),$=S(v.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:a===G?void 0:a,resource:u===G?void 0:u,impersonated:s===G?void 0:s===`yes`,advanced:_.length>0?_: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!==``||a!==G||s!==G||u!==G||_.length>0||f.kind!==`relative`||f.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:[x(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:y()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:c(),timeRange:f,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(D,{value:a,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:b()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(F,{value:G,children:i()}),te.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}),(0,U.jsxs)(D,{value:s,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(F,{value:G,children:w()}),(0,U.jsx)(F,{value:`yes`,children:g()}),(0,U.jsx)(F,{value:`no`,children:d()})]})]}),(0,U.jsxs)(D,{value:u,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:l()})}),(0,U.jsxs)(k,{children:[(0,U.jsx)(F,{value:G,children:o()}),ne.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:_,onChange:Q}),(0,U.jsx)(V,{title:h(),rows:$,emptyHint:m(),columns:[{header:p(),cell:e=>M(e.at),sort:e=>e.at},{header:b(),cell:e=>e.action,sort:e=>e.action},{header:C(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:l(),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{$I as r,$_ as i,A_ as a,Al as o,B_ as s,Bv as c,C_ as l,Cl as u,D as d,D_ as f,Dl as p,E_ as m,El as h,F_ as g,Fv as ee,G_ as _,Gv as te,H_ as v,Hv as ne,I_ as y,J_ as b,Jv as x,K_ as re,L_ as ie,M_ as ae,N_ as oe,O_ as se,Ol as ce,P_ as le,Pv as ue,Q_ as de,R_ as fe,Rv as pe,S_ as me,Sl as he,T as S,T_ as ge,Tl as C,U_ as _e,Uv as ve,V_ as ye,Vv as be,W_ as xe,Wv as Se,X_ as Ce,Y_ as we,ZI as Te,Z_ as Ee,__ as De,ar as Oe,av as ke,b_ as Ae,bl as je,cv as Me,dv as Ne,eL as w,ev as Pe,fv as Fe,g_ as Ie,h_ as T,ir as Le,iv as Re,j_ as ze,k_ as E,kl as Be,lv as Ve,ml as He,nv as Ue,or as We,ov as Ge,q_ as Ke,qv as qe,rr as Je,rv as Ye,sr as Xe,sv as Ze,tv as Qe,ur as $e,uv as et,v_ as tt,vl as nt,w_ as rt,wl as it,x_ as at,xl as ot,y_ as st,yl as ct,z_ as lt,zv as ut}from"./dist-CKeB-cox.js";import{r as D}from"./dist-_mTpkDcR.js";import{t as dt}from"./chevron-up-Zim_BdlH.js";import{t as ft}from"./chevrons-up-down-Dynznz1g.js";import{i as pt,n as O,o as mt,r as ht,s as gt}from"./FieldLabel-DSkWwP2e.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-XFZCx7lK.js";import{t as xt}from"./button-9CDM33ms.js";import{An as St,At as k,Ct,Dt as A,Et as wt,Fn as Tt,I as Et,Lt as Dt,Ot as j,P as Ot,Pn as M,St as kt,Tt as At,_t as N,bn as jt,bt as Mt,ct as P,gt as F,jn as I,jt as L,kt as R,lt as z,on as Nt,qt as Pt,rn as B,vt as Ft,wt as It,yt as Lt}from"./index-Bjld8kqu.js";import{r as Rt}from"./locales-CPjguROj.js";import{a as zt,i as V,n as Bt,o as H,r as U,t as Vt}from"./table-QZEG8lub.js";import{t as Ht}from"./FilterBar-D1X-NYiQ.js";import{a as Ut,n as Wt,o as Gt,r as Kt,s as qt,t as Jt}from"./compatView-zajsEi96.js";import{t as W}from"./dispatchErrorInfo-BwVeZJIC.js";var Yt=d(`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`}]]),Xt=d(`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 Zt(e){return e.filter(e=>e.state===`error`)}function Qt(e){return e.reachable&&Zt(e.targets).length===0}function $t(e){return Qt(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function en(e){return e.state===`error`&&e.lastErrorCode!==null}function tn(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function nn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function rn(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 nn(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__`,an={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function on(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function sn(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 cn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function ln(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 Gt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function un(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=cn(t.key,e),a=cn(t.key,r);return i&&a?0:i?1:a?-1:n*ln(t.key,e,r)})}function dn(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 fn(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 pn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Gt(e,t)??X(e,t))}var Z=n();function mn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(an),[i,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),c=(0,G.useMemo)(()=>dn(s),[s]),u=(0,G.useMemo)(()=>fn(s),[s]),d=(0,G.useMemo)(()=>pn(s),[s]),p=(0,G.useMemo)(()=>un(sn(s,n),i),[s,n,i]);function h(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:oe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Ht,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:a(),onReset:()=>r(an),canReset:on(n),children:[(0,Z.jsxs)(A,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(L,{placeholder:se()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(R,{value:J,children:E()}),c.map(e=>(0,Z.jsx)(R,{value:e,children:gn(e)},e))]})]}),(0,Z.jsxs)(A,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(L,{placeholder:f()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(R,{value:J,children:E()}),u.map(e=>(0,Z.jsx)(R,{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)(k,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(L,{placeholder:m()})}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(R,{value:J,children:E()}),d.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))]})]})]}),p.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Z.jsxs)(Vt,{className:`oc-conn__table`,children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:rt(),sortKey:`target`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:l(),sortKey:`state`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:me(),sortKey:`instance`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:at(),sortKey:`host`,sort:i,onSort:h}),(0,Z.jsx)(Q,{label:Ae(),sortKey:`version`,sort:i,onSort:h}),(0,Z.jsx)(V,{children:st()}),(0,Z.jsx)(Q,{label:tt(),sortKey:`lastOk`,sort:i,onSort:h})]})}),(0,Z.jsx)(Bt,{children:p.map(e=>(0,Z.jsx)(hn,{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)(V,{"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)(dt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function hn({r:e}){let t=en(e)?W(e.lastErrorCode):null,n=tn(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(_n,{state:e.state})}),(0,Z.jsx)(U,{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)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{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)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:ae({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:z(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{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?` · ${z(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ze({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${z(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function gn(e){return e===`connected`?De():e===`error`?Ie():T()}function _n({state:e}){return e===`connected`?(0,Z.jsx)(F,{variant:`secondary`,children:De()}):e===`error`?(0,Z.jsx)(F,{variant:`destructive`,children:Ie()}):(0,Z.jsx)(F,{variant:`outline`,children:T()})}function vn(){return w(S.bridgeHealth.getBridgeHealth,{})}function yn(){let e=vn(),t=w(S.compat.getBridgeCompat,{}),n=w(S.me.getMe,{host:Dt})?.role===`admin`,r=w(S.admin.listInstances,n?{}:`skip`),i=w(S.agents.usageForInstances,n?{}:`skip`),a=M(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=rn(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Tt({from:`/settings/bridge`}),l=M({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Wt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(bn,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:de()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Ee()}),(0,Z.jsxs)(Vt,{children:[(0,Z.jsx)(zt,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:Xe()}),(0,Z.jsx)(V,{children:We()}),(0,Z.jsx)(V,{children:Oe()}),(0,Z.jsx)(V,{children:Le()}),(0,Z.jsx)(V,{children:Je()})]})}),(0,Z.jsx)(Bt,{children:i.flatMap(e=>{let t=Et(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(F,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(bt,{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)(yt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Nt,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(vt,{value:e.key,children:(0,Z.jsx)(xn,{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:He()}):null]})}function bn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Ut(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:ce(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,p({build:t.buildVersion??`?`})]}):null,` · `,h(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:_e()});let o=Zt(e.targets),c=!e.reachable,l=$t(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=P(e.checkedAt),m=e.startedAt==null?null:P(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(St,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(Xt,{size:22}):(0,Z.jsx)(B,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?v():l===`gateways_unreachable`?fe({count:u.length}):c?ye():s({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(Yt,{size:12,"aria-hidden":!0}),` `,lt({time:f})]}),m?(0,Z.jsx)(`span`,{children:y({time:m})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:ie({names:u.join(`, `)})}):null,c?(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:g()})]})}function xn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:s}){let c=r?qt(r,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(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)(Nt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),p?(0,Z.jsx)(F,{variant:p===`beyond`?`destructive`:`secondary`,children:Kt(p)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:o()}),(0,Z.jsx)(Cn,{providerName:q(e),support:c,compatStatus:i,compatReachable:a,manifest:r,instanceRows:u}),s?(0,Z.jsx)(Sn,{protocol:s}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),le({count:t.length})]}),m?(0,Z.jsx)(mn,{connections:t,displayByInstance:l}):null]})}function Sn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ce(),i.length>0?(0,Z.jsx)(F,{variant:`destructive`,children:b({count:i.length})}):(0,Z.jsx)(F,{variant:`secondary`,children:we()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ke({version:e.vendoredVersion}),r?` · `+re({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(D,{size:13,"aria-hidden":!0}):(0,Z.jsx)(I,{size:13,"aria-hidden":!0}),_({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function Cn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:$e({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:he({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:C()}),e?(0,Z.jsx)(En,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):(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:Ut(e.version)}),(0,Z.jsx)(F,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Kt(e.state)})]},e.instanceName))})]})}function wn({instance:e,onClose:t}){return(0,Z.jsx)(Ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ct,{children:x({instance:e.displayName??e.name})}),(0,Z.jsx)(Mt,{children:qe()})]}),(0,Z.jsx)(Tn,{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)(St,{"aria-hidden":!0}):(0,Z.jsx)(B,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Ue():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Qe()]}):null}function Tn({instance:e,onClose:t}){let n=r(S.admin.upsertInstanceConfig),a=Te(S.bridge.validateMediaPaths),o=Pt(),s=Rt(e.config?.contentLocale,void 0),[l,u]=(0,G.useState)(()=>pt(e.config??{},s)),[d,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=l.inboundMediaMode===`shared-fs`,v=l.mediaMode===`shared-fs`,y=_||v;async function b(){m(!0),g(null);try{g(await a({instanceName:e.name,inboundMediaMode:l.inboundMediaMode,mediaMode:l.mediaMode}))}catch(e){o.error(Ge(),e)}finally{m(!1)}}async function x(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(l,r,s)}),t()}catch(e){o.error(c(),e)}finally{f(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:te(),help:ut()}),(0,Z.jsxs)(A,{value:l.mediaMode,onValueChange:e=>u({...l,mediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(L,{})}),(0,Z.jsx)(j,{children:gt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Se(),help:pe()}),(0,Z.jsxs)(A,{value:l.inboundMediaMode,onValueChange:e=>u({...l,inboundMediaMode:e}),children:[(0,Z.jsx)(k,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(L,{})}),(0,Z.jsx)(j,{children:mt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:ve(),help:ee()}),(0,Z.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:l.mediaMaxMb,onChange:e=>u({...l,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:Fe(),help:Ne()}),(0,Z.jsx)(N,{className:`w-full`,spellCheck:!1,value:l.inboundAgentMount,onChange:e=>u({...l,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(O,{label:et(),help:Ve()}),(0,Z.jsx)(N,{className:`w-full`,spellCheck:!1,value:l.outboundAgentMount,onChange:e=>u({...l,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Ot,{checked:l.rehydration,onCheckedChange:e=>u({...l,rehydration:e===!0})}),(0,Z.jsx)(O,{label:ne(),help:ue()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),i({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Re(),result:h.inbound}),(0,Z.jsx)($,{label:Ye(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),Pe()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void b(),disabled:p,children:[p?(0,Z.jsx)(jt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?Ze():Me()]}),(0,Z.jsx)(xt,{size:`sm`,onClick:()=>void x(),disabled:d,children:be()})]})]})})}function En({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(It,{children:[(0,Z.jsx)(wt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?ot():je({count:e.length}),(0,Z.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(At,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ct()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(F,{variant:`secondary`,children:e},e))})]})]})}export{yn as BridgeTab,wn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$u as i,Fl as a,GI as o,Il as s,Ku as c,Kv as l,Ll as u,Ml as d,Nl as f,Pl as p,Rl as m,T as h,ZI as g,Zu as _,ao as v,co as y,do as b,eL as x,hu as S,io as C,jl as w,lo as T,lr as E,no as D,oo as O,qu as k,ro as A,so as j,uo as M,zl as N}from"./dist-CKeB-cox.js";import{t as P}from"./button-9CDM33ms.js";import{At as F,Dt as I,M as L,N as R,Ot as z,P as B,V,_t as H,jt as U,kt as W,rn as G}from"./index-Bjld8kqu.js";import{i as K}from"./compatView-zajsEi96.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=r(h.admin.upsertInstanceConfig),n=x(h.agents.listAgentsForInstance,{instanceName:e.name}),a=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[o,s]=(0,q.useState)(a),[c,l]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(a),l(`idle`)},[e._id,a]);let u=`__none__`,p=o!==a;async function m(){l(`saving`);try{let n={...e.config??{}};o===``||o===u?delete n.converterAgentId:n.converterAgentId=o,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}let g=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(I,{value:o===``?u:o,onValueChange:e=>s(e===u?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":y(),children:(0,X.jsx)(U,{placeholder:O()})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(W,{value:u,children:O()}),g.map(e=>(0,X.jsx)(W,{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`?i():f()})]}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null]})}function Q({instance:e}){let t=r(h.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,a=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[o,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(a===null?``:String(a)),[u,p]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(a===null?``:String(a)),p(`idle`)},[e._id,n,a]);let m=c.trim(),g=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,_=!o||g===null||Number.isInteger(g)&&g>=4e3&&g<=6e4,y=o!==n||(g??null)!==a;async function b(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=o,!o||g===null||Number.isNaN(g)?delete n.curationBudgetChars:n.curationBudgetChars=g,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`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)(B,{checked:o,onCheckedChange:e=>s(e===!0),"aria-label":T()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(H,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!_,"aria-label":v(),disabled:!o}),(0,X.jsx)(P,{size:`sm`,disabled:!y||!_||u===`saving`,onClick:()=>void b(),children:u===`saving`?i():f()})]}),_?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]})}function $({instance:e}){let t=r(h.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[a,o]=(0,q.useState)(n===null?``:String(n)),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=a.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function g(){c(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,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:b()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(H,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:a,onChange:e=>o(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||s===`saving`,onClick:()=>void g(),children:s===`saving`?i():f()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:w()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:M()})]})}function ee(){let e=g(h.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=x(h.admin.listInstances,{}),[i,d]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!i||!r.some(e=>e.name===i))&&d(r[0].name)},[r,i]);let f=(r?.length??0)>1,v=r!==void 0&&r.length===0,y=x(h.compat.forInstance,i?{instanceName:i}:`skip`),b=i?V(y,`configDefaults`):`loading`,C=b===`loading`?null:b.blocked,w=(0,q.useMemo)(()=>f&&i?{instanceName:i}:{},[f,i]),T=(0,q.useRef)(0),D=(0,q.useCallback)(async()=>{let t=++T.current;n({status:`loading`});try{let r=Y(await e(w));if(T.current!==t)return;n({status:`done`,current:r})}catch{if(T.current!==t)return;n({status:`error`})}},[e,w]);(0,q.useEffect)(()=>{C===!1&&(f&&!i||D())},[D,C,f,i]);let O=t.status===`done`?t.current:null,A=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:k()},{id:`standard`,label:c()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:N()}),f&&i?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,X.jsxs)(I,{value:i,onValueChange:e=>d(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":S(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(z,{children:(r??[]).map(e=>(0,X.jsx)(W,{value:e.name,children:e.name},e.name))})]})]}):null,v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:l()}):b===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):b.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(G,{size:14,"aria-hidden":!0}),` `,K(b.gatewayVersion,b.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[p(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:_()})]}):(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,{options:A,value:O?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()}),(0,X.jsx)(L,{options:j,value:O===null||O.fastModeDefault===null?null:O.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:a()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:E()})]}),(()=>{let e=r?.find(e=>e.name===(i??r[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{am as r,em as i,im as a,nm as o,om as s,rm as c,tm as l}from"./dist-CKeB-cox.js";import{r as u}from"./dist-_mTpkDcR.js";import{t as d}from"./chevron-up-Zim_BdlH.js";import{t as f}from"./chevrons-up-down-Dynznz1g.js";import{t as p}from"./button-9CDM33ms.js";import{En as m,P as h,dt as g,ft as _,ht as v,in as y,ln as b,mt as x,ut as S}from"./index-Bjld8kqu.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-QZEG8lub.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=s(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(y,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(h,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(h,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(S,{children:[(0,M.jsx)(v,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(m,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(x,{}):null,(0,M.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$T as i,AT as a,BT as o,CT as s,Ca as c,DT as l,ET as u,FT as d,GT as f,HT as p,IT as m,JT as ee,KT as te,LT as ne,MT as h,NT as g,OT as _,PT as v,QT as y,RT as re,ST as b,T as x,TT as S,UT as ie,VT as C,WT as w,XT as T,YT as E,ZT as D,_T as O,aE as k,bT as A,cE as j,cT as M,dT as N,eE as P,eL as F,fT as I,gT as L,hT as R,iE as z,jT as B,kT as V,lE as H,lT as U,mT as W,nE as G,oE as K,pT as ae,qT as q,rE as J,sE as oe,tE as se,uE as ce,uT as le,vT as ue,wT as de,xT as fe,xa as pe,yT as me,zT as he}from"./dist-CKeB-cox.js";import{t as ge}from"./button-9CDM33ms.js";import{Z as _e,ct as Y}from"./index-Bjld8kqu.js";import{t as ve}from"./DataTableShell-C8TvrDnS.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>ce(),incorrect:()=>H(),incoherence:()=>j(),formatting:()=>oe(),latency:()=>K(),api_error:()=>k(),other:()=>z()},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:G()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:se()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:J()})}function be({data:e,reference:t,closeReason:n}){let a=e.snapshot,s=r(x.feedback.respondToFeedback),[l,u]=(0,X.useState)(e.thread),[h,g]=(0,X.useState)(``),[b,S]=(0,X.useState)(!1);async function O(){let t=h.trim();if(!(!t||b)){S(!0);try{await s({feedbackId:e._id,text:t}),u(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),g(``)}finally{S(!1)}}}let k=[];try{k=a.contextJson?JSON.parse(a.contextJson):[]}catch{k=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:a.displayedMatchesStored,sourceWasOpen:a.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,a.messageRole,a.isRegeneration?` · ${P()}`:``,a.openclawModel?` · ${a.openclawModel}`:``,a.openclawRuntime?` (${a.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:_(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(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:W()}),(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:y()}),l.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:l.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`?D():e.authorRole===`agent`?e.authorLabel??c():T()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:E()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:ee(),value:h,maxLength:2e3,rows:3,onChange:e=>g(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 O(),disabled:!h.trim()||b,children:b?q():te()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.messageText||w()})]}),a.clientInfo?.sourceWasOpen&&a.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.displayedText||w()})]}):null,a.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:a.promptText})]}):null,k.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C({count:a.contextCount??k.length,truncated:a.contextTruncated?o():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:k.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,a.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:he()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[a.outboxText??``,a.outboxStatus?`\n[status: ${a.outboxStatus}]`:``]})]}):null,a.clientInfo?.extensionsDetected&&a.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:a.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:ne()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[a.clientInfo?.language,a.clientInfo?.timezone,a.clientInfo?.theme?m({theme:a.clientInfo.theme}):null,a.runId?`run ${a.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,a.clientInfo?.plugins&&a.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[d(),` `,a.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,v()]})]}):null,a.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:a.clientInfo.userAgent}):null]})]})]})}function xe(){let e=F(x.feedback.listForAdmin,{}),t=r(x.feedback.readSnapshot),n=r(x.feedback.deleteFeedback),i=_e(),[o,c]=(0,X.useState)(null),[d,f]=(0,X.useState)({});async function p(e){if(o===e._id){c(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}c(e._id)}async function m(e){await i({title:le(),description:U(),confirmLabel:M(),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:[g(),` `,(0,Z.jsx)(`strong`,{children:h()}),` `,B()]}),(0,Z.jsx)(ve,{title:a(),rows:e,emptyHint:V(),isExpanded:e=>o===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,Z.jsx)(be,{data:d[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:l(),cell:e=>Y(e.at),sort:e=>e.at},{header:u(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:S(),cell:e=>e.messageRole===`user`?de():s(),sort:e=>e.messageRole},{header:b(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${fe({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:A(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:me(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ue(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:O()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:L()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:R()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?ae():I(),onSelect:()=>void p(e)},{label:N(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$I as ee,BF as i,Da as a,Ea as te,FF as ne,GF as re,GI as ie,HF as ae,IF as oe,JF as o,KF as s,LF as c,MF as l,NF as u,PF as d,QF as f,RF as p,T as m,UF as se,VF as ce,WF as le,XF as h,YF as g,ZF as _,aI as ue,cI as v,dI as de,eI as y,eL as fe,fI as pe,iI as me,jF as he,lI as b,nI as ge,oI as _e,qF as ve,qI as x,rI as S,sI as C,tI as w,uI as T,uk as E,zF as D}from"./dist-CKeB-cox.js";import{t as O}from"./button-9CDM33ms.js";import{$ as k,At as A,Dn as j,Dt as M,En as N,Ot as P,P as F,at as ye,cn as be,dt as xe,et as Se,ft as I,gt as L,ht as Ce,in as we,it as Te,jt as R,kt as z,nt as Ee,ot as De,qt as Oe,rt as ke,tt as Ae,ut as je}from"./index-Bjld8kqu.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-QZEG8lub.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return w();case`audio`:return y();case`video`:return r();case`pdf`:return f();case`document`:return _();case`archive`:return h();default:return g()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[f,h]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[y,w]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ee(m.files.softDelete),Y=Oe();function Ie(){t(G),r(G),h(G),_(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(p())}catch(e){Y.error(c(),e)}}let X=fe(m.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:f===G?void 0:f,category:g===G?void 0:g,includeAutoGenerated:y||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(x(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:ie()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||f!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(M,{value:e,onValueChange:t,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":de(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:T()}),(0,W.jsx)(z,{value:`inbound`,children:b()}),(0,W.jsx)(z,{value:`outbound`,children:v()})]})]}),(0,W.jsxs)(M,{value:n,onValueChange:r,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":C(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:_e()}),Q.chats.map(e=>(0,W.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(M,{value:f,onValueChange:h,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":ue(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:me()}),Q.instances.map(e=>(0,W.jsx)(z,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(M,{value:g,onValueChange:_,children:[(0,W.jsx)(A,{size:`sm`,"aria-label":S(),children:(0,W.jsx)(R,{})}),(0,W.jsxs)(P,{children:[(0,W.jsx)(z,{value:G,children:ge()}),Q.categories.map(e=>(0,W.jsx)(z,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(F,{checked:y,onCheckedChange:e=>w(e===!0),"aria-label":a()}),(0,W.jsx)(`span`,{children:a()})]}),$?(0,W.jsxs)(O,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(be,{size:14,"aria-hidden":!0}),ce()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?l():u()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:o()}),(0,W.jsx)(B,{children:ve()}),(0,W.jsx)(B,{children:s()}),(0,W.jsx)(B,{children:re()}),(0,W.jsx)(B,{children:le()}),(0,W.jsx)(B,{className:`text-right`,children:se()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(L,{variant:`outline`,style:{marginLeft:6},children:te()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(L,{variant:`secondary`,children:e.direction===`inbound`?b():v()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(je,{children:[(0,W.jsx)(Ce,{asChild:!0,children:(0,W.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":i(),children:(0,W.jsx)(N,{size:16})})}),(0,W.jsxs)(xe,{align:`end`,children:[e.url?(0,W.jsx)(I,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(j,{size:14}),ae()]})}):(0,W.jsxs)(I,{disabled:!0,children:[(0,W.jsx)(j,{size:14}),d()]}),(0,W.jsxs)(I,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(we,{size:14}),D()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:he({cap:Be})}):null]}),(0,W.jsx)(k,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ee,{children:[(0,W.jsxs)(ye,{children:[(0,W.jsx)(De,{children:oe()}),(0,W.jsx)(ke,{children:ne()})]}),(0,W.jsxs)(Te,{children:[(0,W.jsx)(Ae,{children:E()}),(0,W.jsx)(Se,{onClick:()=>void Le(),children:D()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cm as r,sm as i}from"./dist-CKeB-cox.js";import{t as a}from"./button-9CDM33ms.js";import{_t as o,cn as s,sn as c}from"./index-Bjld8kqu.js";import{t as l}from"./TimeRangePicker-Cc-m21ii.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(s,{}),i()]})]})}export{p as t};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$d as i,Ad as a,Bd as o,Cd as s,D as c,Dd as l,Ed as u,Fd as d,Gd as f,Hd as p,Id as m,Jd as h,Kd as g,Ld as _,Md as v,Nd as y,Od as b,Pd as x,Qd as S,Rd as C,Sd as w,T,Td as E,Ud as ee,Vd as D,Wd as te,Xd as ne,Yd as re,Zd as ie,_d as ae,_f as O,af as k,bd as oe,bf as A,cf as j,dd as M,df as se,eL as N,ef as P,fd as ce,ff as F,gd as le,gf as ue,hd as I,hf as L,if as de,jd as R,kd as fe,lf as pe,md as me,mf as he,nf as ge,of as _e,pd as ve,pf as ye,qd as be,rf as xe,sf as Se,tf as Ce,uf as we,vd as Te,vf as Ee,wd as De,xd as Oe,yd as ke,yf as Ae,zd as je}from"./dist-CKeB-cox.js";import{t as Me}from"./x-DJVrcLrv.js";import{i as z,n as B,r as Ne,t as Pe}from"./tabs-XFZCx7lK.js";import{t as V}from"./button-9CDM33ms.js";import{At as Fe,Ct as Ie,Dt as Le,Lt as Re,Mn as ze,Ot as Be,P as H,St as Ve,Z as He,_ as Ue,_t as U,an as W,bt as We,gt as G,jn as Ge,jt as Ke,kt as qe,on as K,qt as q,vt as Je,yt as Ye}from"./index-Bjld8kqu.js";import{t as Xe}from"./FilterBar-D1X-NYiQ.js";import{t as Ze}from"./DataTableShell-C8TvrDnS.js";import{t as J}from"./DetailChips-KZ6IBAE_.js";var Qe=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=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(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 et(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 tt(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 nt(e){switch(e){case`admin`:return D();case`user`:return o();case`pending`:return je();default:return e}}function rt(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 it(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 Q=n(),$={name:``,description:``};function at(){let e=N(T.groups.listGroups,{}),t=N(T.me.getMe,{host:Re})?.role===`admin`,n=r(T.groups.createGroup),a=r(T.groups.updateGroup),o=r(T.groups.deleteGroup),s=He(),c=q(),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)($),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(``),y=(0,Z.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($),u(!0)}function x(e){f(e),m({name:e.name,description:e.description??``}),u(!0)}async function S(){try{d?await a({groupId:d._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m($),f(null),u(!1)}catch(e){c.error(me(),e)}}async function C(e){if(await s({title:Ce({name:e.name}),description:P(),confirmWord:e.name,confirmLabel:i(),cancelLabel:Se(),destructive:!0}))try{await o({groupId:e._id})}catch(e){c.error(ve(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,Q.jsx)(Xe,{q:_,onQChange:v,onReset:()=>v(``),canReset:_!==``,searchPlaceholder:F()}),(0,Q.jsx)(Ze,{title:A(),rows:y,addLabel:Ee(),onAdd:t?b:void 0,emptyHint:O(),columns:[{header:ue(),cell:e=>e.name,sort:e=>e.name},{header:L(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(X,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Y,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:he(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ye(),cell:e=>(0,Q.jsx)(J,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:se(),onSelect:()=>g({groupId:e._id,name:e.name})},...t?[{label:we(),onSelect:()=>x(e)},{label:pe(),variant:`destructive`,onSelect:()=>void C(e)}]:[]]}),(0,Q.jsx)(Ue,{open:l,onOpenChange:u,title:d?k():_e(),description:de(),canSubmit:!!p.name.trim(),onSubmit:S,submitLabel:j(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:xe()}),(0,Q.jsx)(U,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ge()}),(0,Q.jsx)(U,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:h?.groupId??null,groupName:h?.name??``,open:h!==null,onOpenChange:e=>{e||g(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(ze,{size:14,"aria-hidden":!0}),te()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":p({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ee(),(0,Q.jsx)(Ge,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=N(T.groups.getGroup,n&&e?{groupId:e}:`skip`),o=N(T.groups.listAssignableInstances,n?{}:`skip`),s=N(T.groups.listAssignableUsers,n?{}:`skip`),c=r(T.groups.addMember),u=r(T.groups.removeMember),d=r(T.groups.bulkSetMembers),p=r(T.groups.setGroupManager),_=q(),[v,b]=(0,Z.useState)(``),[w,E]=(0,Z.useState)(``),[ee,D]=(0,Z.useState)(`members`),[te,O]=(0,Z.useState)(1),[k,oe]=(0,Z.useState)(new Set),A=(0,Z.useRef)(null),j=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),M=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),se=a?.viewerIsAdmin===!0,P=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{b(``),E(``),D(`members`),O(1),A.current=null},[n,e]),(0,Z.useEffect)(()=>{O(1)},[v]),(0,Z.useEffect)(()=>{n&&a&&e&&A.current!==e&&(A.current=e,oe(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let F=(0,Z.useMemo)(()=>s?$e(s,v,k):[],[s,v,k]);async function ue(t,n){if(e)try{n?await u({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){_.error(ce(),e)}}async function I(t,n){if(e)try{await p({groupId:e,userId:t,manager:!n})}catch(e){_.error(le(),e)}}let L=rt(F,e=>j.has(e.userId)),de=F.filter(e=>j.has(e.userId)).length,R=it(F,te,ot);async function fe(){if(!e||F.length===0)return;let t=F.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:L!==`all`})}catch(e){_.error(ce(),e)}}return(0,Q.jsx)(Je,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ye,{className:`oc-access`,children:[(0,Q.jsxs)(Ve,{children:[(0,Q.jsx)(Ie,{children:S({name:t})}),(0,Q.jsx)(We,{children:ie()})]}),(0,Q.jsxs)(Pe,{value:ee,onValueChange:D,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Ne,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(X,{size:13,"aria-hidden":!0}),ne(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,Q.jsxs)(z,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),h(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:P.size}):null]}),(0,Q.jsxs)(z,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),l(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(B,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:x()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:v,onChange:e=>b(e.target.value),placeholder:re(),className:`oc-access__search`}),F.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):(0,Q.jsxs)(Q.Fragment,{children:[F.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(H,{checked:L===`all`?!0:L===`some`?`indeterminate`:!1,onCheckedChange:()=>void fe(),"aria-label":f()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:f()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[de,` / `,F.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=j.has(e.userId),n=tt(e),r=M.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(H,{checked:t,onCheckedChange:()=>void ue(e.userId,t),"aria-label":C({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&se?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?ae():Te(),title:r?ae():Te(),onClick:()=>void I(e.userId,r),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":ke(),title:ke(),children:(0,Q.jsx)(Y,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:O})]})]})}),(0,Q.jsx)(B,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{value:w,onChange:e=>E(e.target.value),placeholder:be(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:P,query:w},`${e}-${t._id}`))})]})}),(0,Q.jsx)(B,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:o}){let s=N(T.groups.listAssignableAgents,{instanceName:t}),c=r(T.groups.assignAgentToGroup),l=r(T.groups.removeAgentFromGroup),u=r(T.groups.bulkSetGroupAgents),p=q(),[m,h]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{h(1)},[o]),!e)return null;let g=et(s?.agents??[],o),y=s?.discovery&&!s.discovery.lastPollOk;if(o.trim()&&g.length===0)return null;let x=g.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),S=rt(x,e=>i.has(`${t}/${e.agentId}`)),C=it(g,m,ot);async function w(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await c({groupId:e,instanceName:t,agentId:n})}catch(e){p.error(M(),e)}}async function E(){if(x.length===0)return;let n=x.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:S!==`all`})}catch(e){p.error(M(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),y?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:a()}):null]}),s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:d()}):g.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:y?R():v()}):(0,Q.jsxs)(Q.Fragment,{children:[x.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(H,{checked:S===`all`?!0:S===`some`?`indeterminate`:!1,onCheckedChange:()=>void E(),"aria-label":f()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:f()})]}):null,C.pageItems.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(H,{checked:r,disabled:(a||o)&&!r,onCheckedChange:()=>void w(e.agentId,r),"aria-label":_({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":b(),title:b(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:fe()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:C.page,pageCount:C.pageCount,onPage:h})]})]})}function ut({groupId:e}){let t=N(T.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=r(T.charts.assignChartToGroup),i=r(T.charts.removeChartFromGroup),a=r(T.charts.setGroupDefaultChart),o=r(T.charts.addChartToGroupPool),c=r(T.charts.removeChartFromGroupPool),l=q();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()});let{pool:d,addable:f,canManagePool:p}=t;if(d.length===0&&!p)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:u()});async function h(t,r){try{r?await i({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}async function g(t){try{await a({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}async function _(t){try{await o({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}async function v(t){try{await c({groupId:e,chartKey:t})}catch(e){l.error(I(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:d.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(H,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":w({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Oe(),title:Oe(),children:(0,Q.jsx)(W,{size:14,fill:`currentColor`})}):(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:oe()}):null,p?(0,Q.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":s({name:e.name}),title:s({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(Me,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),p?f.length>0?(0,Q.jsxs)(Le,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Fe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ke,{placeholder:De()})}),(0,Q.jsx)(Be,{children:f.map(e=>(0,Q.jsx)(qe,{value:e.chartKey,children:e.name},e.chartKey))})]}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:E()}):null:null]})}export{at as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$I as i,$S as a,AC as o,Aw as s,BC as c,CC as l,Cw as u,DC as d,Do as f,Dw as p,EC as m,Eo as h,Ew as g,FC as _,GC as v,GS as y,HC as b,IC as x,Iv as ee,JC as S,JS as C,KC as te,KS as w,LC as T,Lv as E,MC as ne,Mw as re,NC as ie,Nw as ae,OC as oe,Oo as se,Ow as ce,PC as le,Pw as ue,QC as de,QS as fe,RC as pe,SC as me,Sw as he,T as D,TC as ge,Tw as _e,UC as ve,VC as ye,WC as be,XC as xe,XS as Se,YC as Ce,YS as we,ZC as Te,ZI as O,ZS as Ee,_C as De,_w as Oe,aC as ke,aw as Ae,bC as k,bw as A,cC as je,cw as Me,dC as Ne,dw as Pe,eC as Fe,eL as j,ew as Ie,fC as Le,fr as Re,fw as ze,gC as Be,gw as Ve,hC as M,hw as He,iC as Ue,iw as We,jC as Ge,jw as Ke,kC as qe,ko as Je,kw as Ye,lC as Xe,lw as Ze,mr as Qe,mw as $e,nA as N,nC as et,nw as tt,oC as nt,ow as rt,pC as it,pr as at,pw as ot,qC as st,qS as ct,rA as P,rC as lt,rw as ut,sC as dt,sw as ft,tC as pt,tw as mt,uC as ht,uw as gt,vC as F,vw as _t,wC as vt,ww as yt,xC as bt,xw as xt,yC as St,yw as Ct,zC as wt}from"./dist-CKeB-cox.js";import{a as Tt,c as Et}from"./FieldLabel-DSkWwP2e.js";import{t as I}from"./button-9CDM33ms.js";import{At as L,Ct as R,Dt as z,Et as Dt,Ot as B,P as V,St as H,Tt as Ot,Z as kt,_ as At,_t as U,bt as W,gt as G,jt as K,kt as q,qt as J,vt as jt,wt as Mt,yt as Nt}from"./index-Bjld8kqu.js";import{t as Pt}from"./DataTableShell-C8TvrDnS.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-BvWUat6m.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function Vt(){let e=j(D.admin.listInstances,{}),t=j(D.agents.listAllInstanceAgents,{}),n=i(D.admin.upsertInstance),r=i(D.admin.deleteInstance),a=J(),[o,c]=(0,Y.useState)(!1),[l,d]=(0,Y.useState)(Q),[f,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(null),[b,x]=(0,Y.useState)(null);async function S(){try{await n({instanceId:b??void 0,name:l.name,gatewayUrl:l.gatewayUrl,bridgeUrl:l.bridgeUrl||void 0,displayName:l.displayName||void 0,kind:l.kind,transport:l.kind===`hermes`?l.transport:void 0,gatewayVersion:l.gatewayVersion||void 0,gatewayHttpUrl:l.gatewayHttpUrl||void 0,streamTransport:l.streamTransport}),d(Q),x(null),c(!1)}catch(e){a.error(re(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ke(),(0,Z.jsx)(`strong`,{children:s()}),Ye()]}),(0,Z.jsx)(Pt,{title:ce(),rows:e,addLabel:p(),onAdd:()=>{x(null),d(Q),c(!0)},emptyHint:g(),columns:[{header:_e(),cell:e=>e.name,sort:e=>e.name},{header:yt(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:u(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:he(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ue(),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)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?w():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:_t(),onSelect:()=>{x(e._id),d(Bt(e)),c(!0)}},{label:ae(),onSelect:()=>m(e.name)},{label:ut(),onSelect:()=>y(e)},{label:xt(),onSelect:()=>_(e)},{label:A(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:A(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(At,{open:o,onOpenChange:c,title:b?Oe():Ct(),description:He(),canSubmit:!!(l.name&&l.gatewayUrl),onSubmit:S,submitLabel:$e(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ot(),children:[(0,Z.jsx)(U,{value:l.name,disabled:b!==null,onChange:e=>d({...l,name:e.target.value})}),b?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ve()}):null]}),(0,Z.jsx)($,{label:ze(),children:(0,Z.jsxs)(z,{value:l.kind,onValueChange:e=>d({...l,kind:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),l.kind===`hermes`?(0,Z.jsx)($,{label:Qe(),children:(0,Z.jsxs)(z,{value:l.transport,onValueChange:e=>d({...l,transport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(q,{value:`ws`,children:at()}),(0,Z.jsx)(q,{value:`rest`,children:Re()})]})]})}):null,(0,Z.jsx)($,{label:Pe(),children:(0,Z.jsx)(U,{value:l.gatewayUrl,onChange:e=>d({...l,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:gt(),children:(0,Z.jsx)(U,{value:l.bridgeUrl,placeholder:Ze(),onChange:e=>d({...l,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Me(),children:(0,Z.jsx)(U,{value:l.displayName,onChange:e=>d({...l,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:E(),children:[(0,Z.jsxs)(z,{value:l.streamTransport,onValueChange:e=>d({...l,streamTransport:e}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(B,{children:Et.map(e=>(0,Z.jsx)(q,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ee()})]}),(0,Z.jsx)($,{label:ft(),children:(0,Z.jsx)(U,{value:l.gatewayVersion,placeholder:rt(),onChange:e=>d({...l,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ae(),children:(0,Z.jsx)(U,{value:l.gatewayHttpUrl,placeholder:We(),onChange:e=>d({...l,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>_(null)},h._id):null,v?(0,Z.jsx)(Ht,{instance:v,onClose:()=>y(null)},v._id):null]})}function Ht({instance:e,onClose:t}){let n=j(D.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(R,{children:tt({instance:e.displayName??e.name})}),(0,Z.jsx)(W,{children:mt()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=O(D.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(_());break;case`no_agents`:n.success(ie());break;case`no_bridge_url`:n.error(ne());break;case`deploy_misconfigured`:n.error(Ge());break;case`unauthorized`:n.error(qe());break;case`not_served`:n.error(oe());break;default:n.error(o());break}}catch(e){n.error(le(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?x():T()})})]})}function Wt({instance:e}){let t=j(D.bridgeAuth.listBridgeAuthStatus,{}),n=O(D.bridgeAuth.mintBridgeSecret),r=i(D.bridgeAuth.revokeBridgeSecret),a=J(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),h=p!==void 0;async function g(){if(!o){s(!0);try{u((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){a.error(k(),e)}finally{s(!1)}}}async function _(){if(!o){s(!0);try{await r({instanceId:e._id}),u(null),a.success(bt())}catch(e){a.error(k(),e)}finally{s(!1)}}}async function v(){if(c)try{await navigator.clipboard.writeText(c),f(!0)}catch{}}return(0,Z.jsxs)($,{label:m(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:h?`outline`:`secondary`,children:h?`${Te()} · ${p.prefix}…${p.lastFour}`:xe()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void g(),disabled:o,children:h?l():vt()}),h?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:o,children:me()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:St()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:d?P():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),f(!1)},children:F()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let a=O(D.instanceSecrets.setInstanceSecret),o=i(D.instanceSecrets.clearInstanceSecret),s=O(D.deviceIdentity.generateDeviceIdentity),l=J(),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),y=n!==null,x=t===`deviceIdentity`,ee=t===`token`?Ie():t===`deviceIdentity`?r():de();async function C(){if(!(!u.trim()||f)){p(!0);try{await a({instanceId:e,field:t,plaintext:u}),d(``),h(null),_(!1),l.success(v())}catch(e){l.error(be(),e)}finally{p(!1)}}}async function w(){if(!f){p(!0);try{await o({instanceId:e,field:t}),h(null),_(!1),l.success(ve())}catch(e){l.error(be(),e)}finally{p(!1)}}}async function T(){if(!f){p(!0);try{h(await s({instanceId:e})),_(!1),l.success(c())}catch(e){l.error(pe(),e)}finally{p(!1)}}}let E=m?`openclaw devices approve ${m.id}`:``;async function ne(){if(E)try{await navigator.clipboard.writeText(E),_(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[x?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:y?`outline`:`secondary`,children:y?Te():xe()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:u,placeholder:y?S():Ce(),onChange:e=>d(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(I,{size:`sm`,onClick:()=>void C(),disabled:f||u.trim().length===0,children:st()}),x?(0,Z.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:f,children:b()}):null,y?(0,Z.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void w(),disabled:f,children:te()}):null]})]}),m?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:c()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:wt()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:g?P():N()})]}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{h(null),_(!1)},children:F()})]}):null]})}var Kt={conversational:dt,documentary:ke,summarizer:Je,curator:f},qt={conversational:nt,documentary:Ue,summarizer:se,curator:h},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Ne()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Mt,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ht()})}),(0,Z.jsxs)(Ot,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Xe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:je()}),(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)(V,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=j(D.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),o=i(D.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),s=i(D.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=i(D.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=i(D.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(D.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(D.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),u=i(D.agents.removeInstanceAgent),d=kt(),f=J();async function p(t,n){if(e)try{await o({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(M(),e)}}async function m(t){if(e)try{await s({instanceName:e,agentId:t})}catch(e){f.error(M(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){f.error(M(),e)}}async function g(t,n){if(e&&await d({title:pt({name:n}),description:Fe(),confirmLabel:a(),destructive:!0}))try{await u({instanceName:e,agentId:t}),f.success(fe())}catch(e){f.error(M(),e)}}return(0,Z.jsx)(jt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(Nt,{className:`oc-access`,children:[(0,Z.jsxs)(H,{children:[(0,Z.jsx)(R,{children:De({name:e??``})}),(0,Z.jsx)(W,{children:Be()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Ee()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Se():r.discovery.lastPollOk?we():C({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ct()}):(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)(V,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void p(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)(G,{variant:`outline`,className:`oc-access__gone`,children:y()}),(0,Z.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:et()})]}):i?(0,Z.jsx)(G,{variant:`default`,children:w()}):(0,Z.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:lt()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await l({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(M(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:it(),"aria-label":Le(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,CE as i,Gs as a,Hs as o,Js as s,Ks as c,SE as l,T as u,TE as d,Us as f,Ws as p,Xs as m,Ys as h,ZI as g,_E as _,bE as v,eL as y,fE as b,gE as x,hE as S,mE as C,pE as w,qs as T,vE as E,wE as D,xE as O,yE as k}from"./dist-CKeB-cox.js";import{t as A}from"./button-9CDM33ms.js";import{P as j,_t as M,gt as N}from"./index-Bjld8kqu.js";var P=t(e(),1),F=n();function I(){let e=y(u.integrations.status.status,{}),t=r(u.admin.setIntegrationConfig),[n,a]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&a(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:d()});let o=n,c=(e,t,n)=>a({...o,[e]:{...o[e],[t]:n}}),f=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[D(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,l()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:v()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:E(),children:[(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(M,{value:o.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>c(`langfuse`,`host`,e.target.value),onBlur:()=>f(`langfuse`,{host:o.langfuse.host??``})})}),(0,F.jsx)(z,{label:b(),checked:o.langfuse.enabled??!0,onChange:e=>{c(`langfuse`,`enabled`,e),f(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:v()}):(0,F.jsx)(N,{variant:`outline`,children:k()}),note:_(),children:[(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(M,{value:o.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>c(`opik`,`baseUrl`,e.target.value),onBlur:()=>f(`opik`,{baseUrl:o.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(M,{value:o.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||w(),onChange:e=>c(`opik`,`workspace`,e.target.value),onBlur:()=>f(`opik`,{workspace:o.opik.workspace??``})})}),(0,F.jsx)(z,{label:b(),checked:o.opik.enabled??!0,onChange:e=>{c(`opik`,`enabled`,e),f(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:O()}):(0,F.jsx)(N,{variant:`outline`,children:v()}):(0,F.jsx)(N,{variant:`outline`,children:m()}),note:h(),children:[(0,F.jsx)(R,{label:s(),children:(0,F.jsx)(M,{value:o.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>c(`otlp`,`endpoint`,e.target.value),onBlur:()=>f(`otlp`,{endpoint:o.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:b(),checked:o.otlp.enabled??!0,onChange:e=>{c(`otlp`,`enabled`,e),f(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(j,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=g(u.integrations.otlpSecret.setOtlpHeaders),n=r(u.integrations.otlpSecret.clearOtlpHeaders),[i,s]=(0,P.useState)(``),[l,d]=(0,P.useState)(null),[m,h]=(0,P.useState)(!1),_=async()=>{h(!0),d(null);try{await t({headersJson:i}),s(``)}catch(e){d(e instanceof Error?e.message:String(e))}finally{h(!1)}};return(0,F.jsxs)(R,{label:T(),children:[(0,F.jsx)(M,{value:i,placeholder:e?c():a(),onChange:e=>s(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:m||i.trim().length===0,onClick:()=>void _(),children:p()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:m,onClick:()=>void n({}),children:f()}):null]}),l?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:l}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:o()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Gg as i,Hg as a,Jg as o,Kg as s,ND as c,QE as l,Qg as u,T as d,Ug as f,Wg as p,Xg as m,Yg as h,ZE as g,Zg as ee,aD as _,cD as v,eL as y,e_ as b,oD as x,qg as S,sD as C,t_ as w}from"./dist-CKeB-cox.js";import{Fn as T,Lt as E,Pn as D,i as te,o as ne,r as re}from"./index-Bjld8kqu.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-cbtxUmVi.js";import{n as N,t as P}from"./TimeRangePicker-Cc-m21ii.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=y(d.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=y(d.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,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:c()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:v()}),(0,I.jsx)(j,{children:x()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,I.jsx)(B,{series:n})})]})]})}function B({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,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[g(),` p50 `,R(s.cP50),` `,C()]}),(0,I.jsxs)(`span`,{children:[l(),` p50 `,R(s.aP50),` `,C()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":v(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:w(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:b(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:r(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:u(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:ee(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:m(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=T({from:`/settings/kpi`}),t=D({from:`/settings/kpi`}),n=te(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:i,to:a}=N(n),{rowLimit:c,buckets:l}=K(i,a),u=y(d.kpi.listKpis,{limit:c,filter:{from:i,to:a}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:o()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:i({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:p()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:f({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.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,o=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":a({max:Q(r),unit:n}),children:e.map((e,a)=>{let s=r>0?e.value/r*(Z-1):0,c=a*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:o,height:s,children:(0,I.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{q as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$j as i,AI as a,Aj as o,BI as s,Bj as c,CI as l,Cj as u,DI as d,Dj as f,E as p,EI as ee,Ej as m,Et as h,FI as g,Fj as _,GI as te,Gj as ne,Hj as re,II as ie,Ij as ae,Jj as oe,Kj as se,LI as ce,Lj as le,MI as ue,Mj as de,Mt as fe,NI as pe,Nj as me,OI as he,Oj as v,PI as y,Pj as b,Qj as x,Rj as S,SI as C,Sj as w,T,TI as E,Tj as D,Uj as O,Vj as k,Wj as A,Xj as j,Yj as M,Zj as N,_I as P,_j as F,_t as I,bI as L,bj as R,dt as ge,eL as z,eM as _e,ft as ve,gI as ye,gj as be,gt as xe,hI as Se,hj as Ce,ht as we,jI as Te,jj as Ee,jt as De,kI as Oe,kj as ke,mI as Ae,mt as je,mw as Me,pt as Ne,qj as Pe,vI as Fe,vj as Ie,vt as Le,wI as Re,wj as B,xI as ze,xj as Be,yI as Ve,yj as He,zj as Ue}from"./dist-CKeB-cox.js";import{t as V}from"./button-9CDM33ms.js";import{At as We,Dt as Ge,Ft as Ke,It as qe,Lt as H,Ot as Je,P as U,Pt as Ye,_t as W,gt as G,jt as Xe,kt as K,q as Ze,qt as Qe,t as $e}from"./index-Bjld8kqu.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-bRTawtDX.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:p(`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:p(`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:()=>_e()},{id:`composer`,label:()=>i()},{id:`sidebar`,label:()=>x()},{id:`notifications`,label:()=>_()},{id:`other`,label:()=>N()}],X={showSource:{category:`messages`,label:()=>j(),help:()=>M()},showReport:{category:`messages`,label:()=>oe(),help:()=>Pe()},copyAssistant:{category:`messages`,label:()=>se()},copyUser:{category:`messages`,label:()=>ne()},showDelete:{category:`messages`,label:()=>A()},showTools:{category:`messages`,label:()=>O(),help:()=>re()},voiceInput:{category:`composer`,label:()=>k(),help:()=>c()},showUsage:{category:`composer`,label:()=>Ue(),help:()=>S()},autoReadAloud:{category:`composer`,label:()=>fe(),help:()=>De()},showChatAge:{category:`sidebar`,label:()=>le(),help:()=>ae()},notifSound:{category:`notifications`,label:()=>b(),help:()=>me()},notifSystem:{category:`notifications`,label:()=>de(),help:()=>Ee()},replySound:{category:`notifications`,label:()=>o(),help:()=>ke()}};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:()=>He()};function ut({prefKey:e,ui:t}){let n=r(T.admin.setUiPrefDefault),i=r(T.admin.setFeatureEnabled),a=ct(e),o=a?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:u()}),(0,J.jsxs)(Ge,{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)(Xe,{})}),(0,J.jsxs)(Je,{children:[(0,J.jsx)(K,{value:`on`,children:F()}),(0,J.jsx)(K,{value:`off`,children:be()}),(0,J.jsx)(K,{value:`inherit`,children:Ce()})]})]}),a?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(U,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":w()}),w()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function dt({current:e,enabled:t}){let n=r(T.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=Ke(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:[Le(),e?(0,J.jsx)(G,{variant:`secondary`,children:qe(e,Ye())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?we():i?xe():I()})]}),(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:ge()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?ve():e?Ne():je()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=z(T.me.getMe,{host:H}),o=a?.ui,s=$(a?.role)&&n,c=r(T.me.setUiPref).withOptimisticUpdate(Ze),l=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(U,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":B()}),B()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:Be()}),(0,J.jsx)(`p`,{children:R()}),(0,J.jsx)(`p`,{children:Ie()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:v(),"aria-label":v(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:f()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.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=o.locked[e],a=o.effective[e],l=o.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)(G,{variant:`outline`,children:m()}):l?(0,J.jsx)(G,{variant:`secondary`,children:h()}):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 c({key:e,value:null}),children:D()}):null,(0,J.jsx)(nt,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:te()})}var pt={sm:()=>E(),md:()=>Re(),lg:()=>l(),xl:()=>C(),"2xl":()=>ze(),"3xl":()=>L()};function mt(){let e=z(T.me.getMe,{host:H}),t=r(T.me.setLocale),n=r(T.me.setTimezone),i=r(T.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(T.me.getMe,{host:H});n&&e.setQuery(T.me.getMe,{host:H},{...n,fontScale:t,resolvedFontScale:t??`md`})}),o=r(T.me.setMyName),c=Qe(),l=e?.locale??`default`,u=e?.name??``,[f,p]=(0,q.useState)(null),m=f??u,h=m.trim()!==u.trim();async function _(){try{await o({name:m}),p(null),c.success(pe())}catch(e){c.error(ue(),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:ce()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:m,maxLength:120,placeholder:g(),onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),_())}}),(0,J.jsx)(V,{size:`sm`,disabled:!h,onClick:()=>void _(),children:Me()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(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:Te()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:l==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:s()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(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:P()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(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:he()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(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 i({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(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:Se()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(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{$I as r,Bh as i,Cg as a,Ch as o,Cm as s,D as c,Dh as l,Eh as u,GI as d,Gh as f,Hh as p,Ih as m,Jh as ee,Kh as te,Lh as h,Mh as g,Nh as ne,Ph as _,Qh as v,Rh as y,Sh as b,T as x,Tg as re,Th as S,Uh as ie,Vh as ae,Wh as C,Xh as oe,Yh as se,Zh as w,_h as T,bh as ce,cg as le,eL as E,eg as ue,fg as D,gg as de,hg as fe,hh as O,ig as k,jh as pe,lg as me,ng as he,og as A,qh as ge,rg as j,sg as _e,tg as ve,ug as ye,vg as M,vh as be,wg as xe,xh as N,yg as P,yh as Se,zh as Ce}from"./dist-CKeB-cox.js";import{r as we}from"./dist-_mTpkDcR.js";import{t as Te}from"./list-AW1nQPBF.js";import{t as F}from"./button-9CDM33ms.js";import{A as Ee,C as De,Cn as Oe,D as I,E as ke,En as Ae,F as je,Fn as Me,In as Ne,O as L,Pn as R,Q as Pe,Rt as Fe,S as Ie,Sn as Le,T as Re,Z as ze,_ as Be,_n as Ve,_t as He,b as z,d as Ue,dn as We,dt as Ge,f as Ke,fn as B,ft as V,g as H,h as U,hn as W,ht as qe,in as Je,j as G,jn as Ye,k as Xe,m as Ze,mt as Qe,p as $e,pn as et,pt as tt,qt as nt,ut as rt,v as K,vn as it,w as at,wn as q,x as J,y as ot,zt as st}from"./index-Bjld8kqu.js";var ct=c(`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`}]]),lt=c(`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`}]]),ut=c(`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`}]]),dt=c(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function Z({className:e}){return(0,X.jsx)(qe,{asChild:!0,children:(0,X.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":o(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(Ae,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:i,className:o,onOpen:s}){let c=r(x.projects.renameProject),l=r(x.projects.setProjectColor),d=r(x.projects.moveProject),f=r(x.projects.deleteProject),p=r(x.projects.createProject),m=ze(),ee=Pe(),[te,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(t),[v,y]=(0,Y.useState)(!1),[ie,ae]=(0,Y.useState)(!1),C=E(x.projects.projectTreeCount,ie?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(rt,{onOpenChange:e=>e&&ae(!0),children:[(0,X.jsx)(Z,{className:o}),(0,X.jsxs)(Ge,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(V,{onSelect:()=>s(),children:[(0,X.jsx)(q,{}),` `,A()]}),(0,X.jsxs)(V,{onSelect:()=>{_(t),h(!0)},children:[(0,X.jsx)(et,{}),` `,b()]}),(0,X.jsxs)(V,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await ee({title:w(),label:re(),placeholder:xe(),confirmLabel:a()});t&&await p({name:t,parentId:e})})},children:[(0,X.jsx)(Oe,{}),` `,w()]}),(0,X.jsxs)(V,{onSelect:()=>y(!0),children:[(0,X.jsx)(lt,{}),` `,ne()]}),(0,X.jsx)(tt,{children:Se()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":be(),children:`✕`}),Ze.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void l({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(Qe,{}),(0,X.jsxs)(V,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=C?.folders??0,r=C?.chats??0;await m({title:me({name:t}),description:n>0?_e({folders:n,chats:r}):r>0?le({count:r}):u(),confirmWord:S(),confirmLabel:ye(),destructive:!0})&&await f({projectId:e})})},children:[(0,X.jsx)(Je,{}),` `,S()]})]})]}),(0,X.jsx)(Be,{open:te,onOpenChange:h,title:fe(),canSubmit:g.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:g.trim()}),h(!1)},submitLabel:b(),children:(0,X.jsx)(He,{value:g,onChange:e=>_(e.target.value),autoFocus:!0})}),v?(0,X.jsx)($e,{open:v,onOpenChange:y,title:pe(),movingFolderId:e,currentId:i,onPick:t=>void d({projectId:e,parentId:t})}):null]})}function $({chat:e,currentFolderId:t,className:n}){let i=r(x.chats.pinChat),a=r(x.chats.deleteChat),o=r(x.chats.renameChat),s=r(x.chats.setChatSidebar),c=r(x.chats.moveChatToProject),l=ze(),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(e.title??``),[ee,te]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(rt,{children:[(0,X.jsx)(Z,{className:n}),(0,X.jsxs)(Ge,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(V,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,X.jsx)(et,{}),` `,b()]}),(0,X.jsxs)(V,{onSelect:()=>void i({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(We,{}):(0,X.jsx)(B,{}),e.pinned?N():ce()]}),(0,X.jsxs)(V,{onSelect:()=>te(!0),children:[(0,X.jsx)(lt,{}),` `,_()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(V,{onSelect:()=>void s({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(W,{}):(0,X.jsx)(dt,{}),e.inSidebar?j():k()]}),(0,X.jsx)(Qe,{}),(0,X.jsxs)(V,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:T(),description:u(),confirmLabel:S(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,X.jsx)(Je,{}),` `,S()]})]})]}),(0,X.jsx)(Be,{open:d,onOpenChange:f,title:O(),canSubmit:p.trim().length>0,onSubmit:async()=>{await o({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:b(),children:(0,X.jsx)(He,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),ee?(0,X.jsx)($e,{open:ee,onOpenChange:te,title:g(),currentId:t,onPick:t=>void c({chatId:e._id,projectId:t})}):null]})}function ft(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function pt(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 mt(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 ht=`oc.projpage.view`;function gt(){let e=localStorage.getItem(ht);return e===`cards`||e===`list`?e:`columns`}var _t=e=>`into:${e}`,vt=e=>`col:${e??`null`}`,yt=e=>`crumb:${e}`;function bt(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 xt(){let{projectId:e}=Ne({from:`/project/$projectId`}),t=R(),n=E(x.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:d()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:Ce()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:y()}),(0,X.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:h()})]}):(0,X.jsx)(St,{page:n})})}function St({page:e}){let t=R(),n=ze(),o=Pe(),c=nt(),d=r(x.projects.renameProject),f=r(x.projects.setProjectColor),h=r(x.projects.deleteProject),g=r(x.projects.createProject),_=r(x.projects.moveProject),y=r(x.chats.moveChatToProject),C=r(x.chats.reorderChat),oe=r(x.projects.reorderProject),se=E(x.projects.projectTreeCount,{projectId:e.project._id}),[T,ce]=(0,Y.useState)(gt),D=e=>{localStorage.setItem(ht,e),ce(e)},O=E(x.projects.folderColumns,T===`columns`?{projectId:e.project._id}:`skip`),k=E(x.projects.projectTreeList,T===`list`?{projectId:e.project._id}:`skip`),{c:A}=Me({from:`/project/$projectId`}),j=E(x.projects.listProjects,{}),M=E(x.chatReads.myBusyChats,{}),N=(0,Y.useMemo)(()=>new Set(M??[]),[M]),Ce=E(x.chatReads.myChatReads,{}),we=(0,Y.useMemo)(()=>mt(e.chats,Ce??[]),[e.chats,Ce]),{startNewChat:Ne,picker:L}=Ue(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,We]=(0,Y.useState)(``),[Ke,B]=(0,Y.useState)(!1),[U,W]=(0,Y.useState)(e.project.name),[G,Ye]=(0,Y.useState)(!1),[q,dt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>dt(z.trim()),180);return()=>clearTimeout(e)},[z]);let Z=E(x.search.searchConversations,q.length>=2?{query:q,projectId:e.project._id}:`skip`),Q=Ee(Xe(at,{activationConstraint:{distance:4}}),Xe(Re,{activationConstraint:{delay:250,tolerance:8}})),$=(0,Y.useRef)(!1),_t=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[vt,yt]=(0,Y.useState)(null),xt=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||P()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(j??[]).find(t=>t._id===e)?.name??``}}return null},St=e=>yt(xt(String(e.active.id))),Tt=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=I(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=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:ke(n(t?`folder:`:`chat:`))},[]),Dt=t=>{if(T===`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(T===`list`){let e=k?.chats.find(e=>e._id===t);return e?{list:k.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},kt=t=>{if(T===`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(T===`list`){let e=k?.folders.find(e=>e._id===t);if(!e||!k)return null;let n=e.parentId??k.rootId;return{list:st(k.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},At=async e=>{yt(null),_t();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=bt(r);if(e!==void 0){if(a)await y({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Fe(j??[],t,e)){c.error(v());return}await _({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=Dt(t);if(!n)return;n.list.some(t=>t._id===e)||await y({chatId:e,projectId:n.folderId});let a=pt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await C({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=kt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Fe(j??[],e,n.parentId)){c.error(v());return}await _({projectId:e,parentId:n.parentId})}let a=pt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await oe({projectId:e,...a});return}}catch{c.error(v())}},[,Mt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Mt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Nt=Date.now(),Pt=H(e.project),Ft=ft(e.chats,z),It=e.breadcrumb.slice(0,-1),Lt=e=>()=>{$.current||e()};return(0,X.jsxs)(Ie,{sensors:Q,collisionDetection:Tt,onDragStart:St,onDragEnd:At,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Pt},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":m(),children:[It.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(Ct,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Lt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":he(),children:[(0,X.jsx)(F,{variant:T===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":he(),title:he(),"aria-pressed":T===`cards`,onClick:()=>D(`cards`),children:(0,X.jsx)(ut,{})}),(0,X.jsx)(F,{variant:T===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ve(),title:ve(),"aria-pressed":T===`columns`,onClick:()=>D(`columns`),children:(0,X.jsx)(ct,{})}),(0,X.jsx)(F,{variant:T===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ue(),title:ue(),"aria-pressed":T===`list`,onClick:()=>D(`list`),children:(0,X.jsx)(Te,{})})]}),(0,X.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void Ne({projectId:e.project._id}),children:[(0,X.jsx)(it,{}),te()]}),(0,X.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:w(),label:re(),placeholder:xe(),confirmLabel:a()});t&&await g({name:t,parentId:e.project._id})},children:[(0,X.jsx)(Oe,{}),w()]}),(0,X.jsxs)(rt,{children:[(0,X.jsx)(qe,{asChild:!0,children:(0,X.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":de(),children:(0,X.jsx)(Ae,{})})}),(0,X.jsxs)(Ge,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(V,{onSelect:()=>{W(e.project.name),B(!0)},children:[(0,X.jsx)(et,{}),` `,b()]}),(0,X.jsxs)(V,{onSelect:()=>Ye(!0),children:[(0,X.jsx)(lt,{}),` `,ne()]}),(0,X.jsx)(tt,{children:Se()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e.project._id,color:null}),"aria-label":be(),children:`✕`}),Ze.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void f({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(Qe,{}),(0,X.jsxs)(V,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=se?.folders??0,a=se?.chats??0;await n({title:me({name:e.project.name}),description:i>0?_e({folders:i,chats:a}):a>0?le({count:a}):u(),confirmWord:S(),confirmLabel:ye(),destructive:!0})&&(await h({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(Je,{}),` `,S()]})]})]})]})]}),T===`columns`?(0,X.jsx)(jt,{data:O,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:A??null}):T===`list`?(0,X.jsx)(Ot,{data:k,busyIds:N,suppressClick:$,locateChatId:A??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ee()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:ot,children:e.children.map(t=>(0,X.jsx)(wt,{child:t,parentId:e.project._id,now:Nt,suppressClick:$},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ge()}),e.chats.length>0?(0,X.jsx)(He,{value:z,onChange:e=>We(e.target.value),placeholder:ie(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?ae():i()}):Ft.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:p({term:z.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(K,{items:Ft.map(e=>`chat:${e._id}`),strategy:J,children:Ft.map(t=>(0,X.jsx)(Et,{chat:t,currentFolderId:e.project._id,now:Nt,busy:N.has(t._id),unread:we.has(t._id),locate:t._id===A,suppressClick:$},t._id))})})]}),q.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:l()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:p({term:q})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&q&&je(e.messageId,q),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(Ve,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||s()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(Be,{open:Ke,onOpenChange:B,title:fe(),canSubmit:U.trim().length>0,onSubmit:async()=>{await d({projectId:e.project._id,name:U.trim()}),B(!1)},submitLabel:b(),children:(0,X.jsx)(He,{value:U,onChange:e=>W(e.target.value),autoFocus:!0})}),G?(0,X.jsx)($e,{open:G,onOpenChange:Ye,title:pe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void _({projectId:e.project._id,parentId:t})}):null,L]}),(0,X.jsx)(De,{children:vt?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[vt.kind===`folder`?(0,X.jsx)(Le,{size:13,"aria-hidden":!0}):(0,X.jsx)(Ve,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:vt.label})]}):null})]})}function Ct({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:yt(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function wt({child:e,parentId:t,now:n,suppressClick:r}){let i=R(),a=z({id:`folder:${e._id}`}),o=L({id:_t(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":H(e),transform:G.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(Le,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.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,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?f({count:e.folderCount})+` · `:``,C({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:Ke(e.lastActivityAt,n)})]})}function Tt({chat:e}){let t=r(x.chats.setChatSidebar),n=e.inSidebar?j():k();return(0,X.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,X.jsx)(W,{}):(0,X.jsx)(dt,{})})}function Et({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=R(),c=U(e.color),l=z({id:`chat:${e._id}`}),u=Dt(a);return(0,X.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:G.Transform.toString(l.transform),transition:l.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||P()}),e.pinned?(0,X.jsx)(B,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:Ke(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,title:M(),"aria-label":M()}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:D(),"aria-label":D()}):null]}),(0,X.jsx)(Tt,{chat:e}),(0,X.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Dt(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ot({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:d()});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=st(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:J,children:u.map(e=>(0,X.jsx)(At,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:J,children:d.map(t=>(0,X.jsx)(kt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&st(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:ae()}):c(null,0)})}function kt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=R(),c=z({id:`folder:${e._id}`}),l=L({id:_t(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":H(e),transform:G.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?oe():se(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(Ye,{size:13}):(0,X.jsx)(we,{size:13})}),(0,X.jsx)(Le,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.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 At({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=R(),o=z({id:`chat:${e._id}`}),s=Dt(r),c=U(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:G.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||P()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)($,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Tt,{chat:e})]})}function jt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:d()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(Mt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function Mt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:a,locateChatId:o}){let s=R(),c=L({id:vt(e.folderId)});return(0,X.jsxs)(`div`,{ref:c.setNodeRef,className:`oc-projpage__col`+(c.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:J,children:e.folders.map(t=>(0,X.jsx)(Nt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:a,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:J,children:e.chats.map(t=>(0,X.jsx)(Pt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===o,suppressClick:a,onOpen:()=>void s({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:i()}):null]})}function Nt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:_t(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":H(e),transform:G.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(Le,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Pt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=z({id:`chat:${e._id}`}),s=Dt(r),c=U(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:G.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||P()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)($,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(Tt,{chat:e})]})}export{xt 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,Ao as i,Av as a,Bv as o,Cv as s,Dv as c,Ev as l,Gi as u,Ji as d,Ki as f,Mo as p,Mv as m,No as h,Nv as g,Ov as _,Po as ee,Sv as te,T as v,Tv as y,Vv as b,Xi as x,Yi as S,_r as C,_v as w,bv as T,eL as E,gr as D,gv as ne,hr as re,hv as ie,jo as O,jv as k,kv as A,mv as j,qi as M,vv as N,wv as P,xv as F,yv as I}from"./dist-CKeB-cox.js";import{d as L,f as R,i as z,l as B,n as V,r as H,t as U,u as ae}from"./FieldLabel-DSkWwP2e.js";import{t as W}from"./button-9CDM33ms.js";import{At as G,Dt as K,Lt as q,Ot as J,P as oe,jt as Y,kt as X,qt as se}from"./index-Bjld8kqu.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:_,help:c},documentary_fetch:{label:l,help:y},inbound_files:{label:P,help:s},history_summary:{label:ee,help:h},file_curation:{label:x,help:S}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:ne,references:ie,files:j,previous_summary:p,new_messages:O,max_chars:i,file_name:d,budget_chars:M,feedback:f,content:u};function pe(){let e=E(v.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:F()})});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)(V,{label:g(),help:m()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:te()}),(0,$.jsxs)(K,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(J,{children:e.map(e=>(0,$.jsx)(X,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=r(v.admin.upsertInstanceConfig),n=se(),i=E(v.me.getMe,{host:q}),a=e.config??{},s=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[c,l]=(0,Q.useState)(()=>z(a,s));(0,Q.useEffect)(()=>{l(z(a,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:H(c,a,s)})}catch(e){n.error(o(),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(o(),e)}}let g=e.config?.contentLocale??`default`,_=ce[Z(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:C()}),(0,$.jsxs)(K,{value:g,onValueChange:e=>void h(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(J,{children:[(0,$.jsx)(X,{value:`default`,children:re({locale:_})}),le().map(e=>(0,$.jsx)(X,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]}),ae.map(e=>(0,$.jsx)(he,{injKey:e,def:B[e],i18n:ue[e],row:f[e]??{enabled:!0,template:B[e].defaultTemplate[s]},contentLocale:s,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void m(),disabled:u,children:b()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:o}){let[s,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,de[e]??`{${e}}`])),f=L(e,r,i),p=f?R(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)(oe,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(V,{label:n.label(),help:n.help()})]}):(0,$.jsx)(V,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:a()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({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:A()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(U,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?I():T()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[i]}),children:k()})]})]}),s&&(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:N()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,Bx as i,CS as a,DS as o,ES as s,Gx as c,Hx as l,Jx as u,Kx as d,OS as f,SS as p,T as m,TS as h,Ux as g,Vx as ee,Wx as _,_S as v,aS as y,bS as b,ba as x,cS as te,dS as ne,eL as re,eS as ie,fS as ae,gS as S,hS as C,iS as w,kS as T,lS as E,mS as D,nS as O,oS as k,pS as A,qx as j,rS as M,sS as N,tS as P,uS as F,vS as I,wS as L,xS as R,yS as z}from"./dist-CKeB-cox.js";import{t as B}from"./button-9CDM33ms.js";import{P as V,Z as H,_ as U,_t as W,gt as G,qt as K,yn as q}from"./index-Bjld8kqu.js";import{t as J}from"./roleDescriptions-BIxax60M.js";var Y=t(e(),1),X=n(),Z=[{group:()=>T(),keys:[{key:`traces.read`,label:()=>L()},{key:`traces.read.content`,label:()=>a(),phi:!0},{key:`traces.write`,label:()=>p()}]},{group:()=>f(),keys:[{key:`kpi.read`,label:()=>L()},{key:`kpi.write`,label:()=>p()}]},{group:()=>o(),keys:[{key:`openclaw.query`,label:()=>R()},{key:`anomalies.read`,label:()=>b()},{key:`anomalies.report`,label:()=>z()}]},{group:()=>s(),keys:[{key:`chats.read`,label:()=>L()},{key:`selfheal`,label:()=>v()},{key:`feedback.respond`,label:()=>x()}]},{group:()=>h(),keys:[{key:`admin.manage`,label:()=>I()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=re(m.apiKeys.listRoles,{}),t=r(m.apiKeys.createRole),n=r(m.apiKeys.ensureRolesSeeded),a=r(m.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(m.apiKeys.listRoles,{});r&&e.setQuery(m.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=H(),s=K(),[f,p]=(0,Y.useState)(!1),[h,v]=(0,Y.useState)($),[b,x]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(C(),e)})},[n,s]);let T=e??[];async function I(e,t){if(Q(e.permissions))return;if(e.builtin){await o({title:D({name:e.name}),description:A(),confirmLabel:ae()});return}if(b.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];x(t=>new Set(t).add(e._id));try{await a({roleId:e._id,permissions:n})}catch(e){s.error(ne(),e)}finally{x(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function L(){try{await t({key:h.key,name:h.name,description:h.description||void 0,permissions:[]}),v($),p(!1)}catch(e){s.error(F(),e)}}let R=e===void 0,z=!R&&T.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,te(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,N()]}),(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:k()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{v($),p(!0)},children:y()})})]}),R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:O()}),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?S({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:T.map(e=>{let t=Q(e.permissions),n=b.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,P()]}):(0,X.jsx)(G,{variant:`secondary`,children:ie()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?u():n?j():r,onCheckedChange:()=>void I(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(U,{open:f,onOpenChange:p,title:d(),description:c(),canSubmit:!!(h.key&&h.name),onSubmit:L,submitLabel:_(),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:g()}),(0,X.jsx)(W,{value:h.key,placeholder:l(),onChange:e=>v({...h,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ee()}),(0,X.jsx)(W,{value:h.name,onChange:e=>v({...h,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,X.jsx)(W,{value:h.description,onChange:e=>v({...h,description:e.target.value})})]})]})})]})}export{se as RolesTab};