@lacneu/atrium 0.99.0 → 0.100.1

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 (84) hide show
  1. package/dist/assets/AccessTab-xEptIbOW.js +1 -0
  2. package/dist/assets/{AdvancedFilter-DuAvb6_v.js → AdvancedFilter-bgzdOb0t.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DaQy7pSK.js +3 -0
  4. package/dist/assets/AnomaliesTab-kh1sKpdf.js +1 -0
  5. package/dist/assets/AuditTab-D5e84pvG.js +1 -0
  6. package/dist/assets/BridgeTab-DFyIKDyv.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-boUvWCTK.js +1 -0
  8. package/dist/assets/{DataTableShell-CZIWIEsI.js → DataTableShell-CeVf9eD_.js} +1 -1
  9. package/dist/assets/DeletedChatsTab-CPJHm-dY.js +1 -0
  10. package/dist/assets/{DetailChips-Bv8rGcLM.js → DetailChips-tXOC1zN0.js} +1 -1
  11. package/dist/assets/FeedbacksTab-BmIkSmB4.js +1 -0
  12. package/dist/assets/{FieldLabel-BO1-yXaX.js → FieldLabel-BBpaaMpJ.js} +1 -1
  13. package/dist/assets/FilesTab-D12g4ly7.js +1 -0
  14. package/dist/assets/{FilterBar-D1f8IVOZ.js → FilterBar-CdYSlKIB.js} +1 -1
  15. package/dist/assets/GroupsTab-dKfpCkYX.js +1 -0
  16. package/dist/assets/InstancesTab-Bx1bHqXx.js +1 -0
  17. package/dist/assets/IntegrationsTab-BGtmJfZJ.js +1 -0
  18. package/dist/assets/KpiTab-C6h_0kgd.js +1 -0
  19. package/dist/assets/PreferencesTab-DMX9Hooo.js +1 -0
  20. package/dist/assets/ProjectPage-Q1yeQWDA.js +1 -0
  21. package/dist/assets/PromptInjectionsTab-x69hhi90.js +4 -0
  22. package/dist/assets/RolesTab-B3Znx3m2.js +1 -0
  23. package/dist/assets/ScheduledTab-CdV-14gv.js +1 -0
  24. package/dist/assets/ServiceAccountsTab-DUy0hvoO.js +1 -0
  25. package/dist/assets/SubAgentReportsTab-CEswYxX3.js +1 -0
  26. package/dist/assets/ThemeShowroom-CBhqWNEv.js +1 -0
  27. package/dist/assets/{TimeRangePicker-BMeAmmsC.js → TimeRangePicker-CMNe-waP.js} +1 -1
  28. package/dist/assets/{TimezoneCombobox-JvLcqMC7.js → TimezoneCombobox-BR5ScfJS.js} +1 -1
  29. package/dist/assets/TracesTab-By3aJj5o.js +1 -0
  30. package/dist/assets/{TrashTab-C34S9sxA.js → TrashTab-CUNsA_at.js} +1 -1
  31. package/dist/assets/UsersTab-DqJ1H1in.js +1 -0
  32. package/dist/assets/VoiceTab-Dj72iKiP.js +1 -0
  33. package/dist/assets/{api-BEXV-QDx.js → api-uQUQB4xy.js} +5 -5
  34. package/dist/assets/{button-BI4NYd7l.js → button-Biq40Zpc.js} +1 -1
  35. package/dist/assets/{card-CUy80Snk.js → card-AFUQEzoT.js} +1 -1
  36. package/dist/assets/chevrons-up-down-HreDTesh.js +1 -0
  37. package/dist/assets/{compatView-C6vyLpqy.js → compatView-Di1KVtbg.js} +1 -1
  38. package/dist/assets/dispatchErrorInfo-DaVpBFg-.js +1 -0
  39. package/dist/assets/{dist-ibS6mHJS.js → dist-BV5tiwQ7.js} +1 -1
  40. package/dist/assets/{dist-Yi0k4JhM.js → dist-Bta1CYcq.js} +1 -1
  41. package/dist/assets/{dist-xED7lptS.js → dist-CwmWIp2d.js} +1 -1
  42. package/dist/assets/{dist-BgUgjwlI.js → dist-trlbpTaE.js} +1 -1
  43. package/dist/assets/{highlighted-body-OFNGDK62-DaG1VFZL.js → highlighted-body-OFNGDK62-BA-hTZck.js} +1 -1
  44. package/dist/assets/index-Bw4ypNNp.js +448 -0
  45. package/dist/assets/{list-CMpIlPcq.js → list-C1mXgOwS.js} +1 -1
  46. package/dist/assets/mermaid-GHXKKRXX-D0Y-yjBm.js +1 -0
  47. package/dist/assets/{pdf-D3L6KL-o.js → pdf-Uq7gSb2p.js} +1 -1
  48. package/dist/assets/roleDescriptions-CbaJtUsv.js +1 -0
  49. package/dist/assets/{table-CvUcBPgp.js → table-DH8u2aW2.js} +1 -1
  50. package/dist/assets/{trashPage-B36nmIyS.js → trashPage-BIm71gVQ.js} +1 -1
  51. package/dist/assets/{use_paginated_query-CWrNoLih.js → use_paginated_query-Ce4kc6WY.js} +1 -1
  52. package/dist/assets/x-CfpsHFMp.js +1 -0
  53. package/dist/index.html +8 -8
  54. package/package.json +1 -1
  55. package/dist/assets/AccessTab-Bsu_pBw1.js +0 -1
  56. package/dist/assets/AgentFilesTab-CajvKiFH.js +0 -3
  57. package/dist/assets/AnomaliesTab-DQLh8Yyx.js +0 -1
  58. package/dist/assets/AuditTab-PwLy5ZSV.js +0 -1
  59. package/dist/assets/BridgeTab-60WDe9Oh.js +0 -1
  60. package/dist/assets/ChatDefaultsTab-DhtiaDDk.js +0 -1
  61. package/dist/assets/DeletedChatsTab-bjOae5ku.js +0 -1
  62. package/dist/assets/FeedbacksTab-BqOxEjoz.js +0 -1
  63. package/dist/assets/FilesTab-CTieLSvW.js +0 -1
  64. package/dist/assets/GroupsTab-CJdGd3CX.js +0 -1
  65. package/dist/assets/InstancesTab-DSvIWt7d.js +0 -1
  66. package/dist/assets/IntegrationsTab-DGyO4LdP.js +0 -1
  67. package/dist/assets/KpiTab-DKy1FYxU.js +0 -1
  68. package/dist/assets/PreferencesTab-BtQQuvK8.js +0 -1
  69. package/dist/assets/ProjectPage-V-mFGtPc.js +0 -1
  70. package/dist/assets/PromptInjectionsTab-M0j0v8Zw.js +0 -4
  71. package/dist/assets/RolesTab-BEy1GjmZ.js +0 -1
  72. package/dist/assets/ScheduledTab-nN388CYz.js +0 -1
  73. package/dist/assets/ServiceAccountsTab-C4duhDDt.js +0 -1
  74. package/dist/assets/SubAgentReportsTab-Cq86t53b.js +0 -1
  75. package/dist/assets/ThemeShowroom-BiL-NcBn.js +0 -1
  76. package/dist/assets/TracesTab-DAR8-pmx.js +0 -1
  77. package/dist/assets/UsersTab-Mu9Duc2n.js +0 -1
  78. package/dist/assets/VoiceTab-3yLkRehJ.js +0 -1
  79. package/dist/assets/chevrons-up-down-BBnIDUVh.js +0 -1
  80. package/dist/assets/dispatchErrorInfo-U1f-h1hb.js +0 -1
  81. package/dist/assets/index-DQx8LX7A.js +0 -448
  82. package/dist/assets/mermaid-GHXKKRXX-DWPlOIbJ.js +0 -1
  83. package/dist/assets/roleDescriptions-BUL4ira1.js +0 -1
  84. package/dist/assets/x-ijoBrBAS.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AN as i,BN as a,CN as o,Cf as s,DN as c,EN as l,FN as u,IN as d,LN as f,MN as p,NN as m,ON as h,PN as g,QM as ee,RN as _,SN as te,TN as v,VN as y,ZM as b,_N as x,aN as ne,bN as re,dN as ie,eN as ae,fN as S,gN as C,gX as w,hN as T,hX as E,iN as D,jN as O,kN as k,mN as A,nN as j,pN as M,rN as N,t as P,tN as F,vN as I,wN as L,xN as R,yN as oe,zN as z}from"./api-uQUQB4xy.js";import{t as B}from"./button-Biq40Zpc.js";import{$t as V,Jt as H,Mt as U,Yt as W,b as G,ct as K,qn as q}from"./index-Bw4ypNNp.js";import{t as J}from"./roleDescriptions-CbaJtUsv.js";var Y=t(e(),1),X=n(),Z=[{group:()=>y(),keys:[{key:`traces.read`,label:()=>d()},{key:`traces.read.content`,label:()=>u(),phi:!0},{key:`traces.write`,label:()=>g()}]},{group:()=>a(),keys:[{key:`kpi.read`,label:()=>d()},{key:`kpi.write`,label:()=>g()}]},{group:()=>z(),keys:[{key:`openclaw.query`,label:()=>m()},{key:`anomalies.read`,label:()=>p()},{key:`anomalies.report`,label:()=>O()}]},{group:()=>_(),keys:[{key:`chats.read`,label:()=>d()},{key:`selfheal`,label:()=>k()},{key:`media.repair`,label:()=>h()},{key:`feedback.respond`,label:()=>s()}]},{group:()=>f(),keys:[{key:`admin.manage`,label:()=>i()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=w(P.apiKeys.listRoles,{}),t=E(P.apiKeys.createRole),n=E(P.apiKeys.ensureRolesSeeded),i=E(P.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(P.apiKeys.listRoles,{});r&&e.setQuery(P.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=K(),s=W(),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)($),[m,h]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(l(),e)})},[n,s]);let g=e??[];async function _(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:v({name:e.name}),description:L(),confirmLabel:o()});return}if(m.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];h(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(te(),e)}finally{h(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function y(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),p($),d(!1)}catch(e){s.error(R(),e)}}let O=e===void 0,k=!O&&g.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,oe(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,I()]}),(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:x()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{p($),d(!0)},children:C()})})]}),O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):k?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:M()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?c({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:g.map(e=>{let t=Q(e.permissions),n=m.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,S()]}):(0,X.jsx)(H,{variant:`secondary`,children:ie()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ne():n?D():r,onCheckedChange:()=>void _(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:u,onOpenChange:d,title:N(),description:j(),canSubmit:!!(f.key&&f.name),onSubmit:y,submitLabel:F(),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:ae()}),(0,X.jsx)(V,{value:f.key,placeholder:r(),onChange:e=>p({...f,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)(V,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,X.jsx)(V,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$q as i,AJ as a,Aq as o,BJ as s,Bq as c,Cq as l,Dq as u,E as d,Eq as f,FJ as p,Fq as m,GK as h,HJ as g,HK as _,Hq as ee,IJ as te,IK as ne,Iq as re,JK as ie,KK as ae,Kq as oe,LJ as se,Lq as ce,MJ as le,NJ as ue,Oq as de,PJ as fe,QK as pe,Qq as me,RJ as he,Rq as ge,Sq as _e,Tq as v,UJ as ve,UK as ye,Uq as be,VJ as xe,Vq as Se,WJ as Ce,WK as we,Wq as Te,XK as Ee,Xq as De,YK as Oe,Yq as ke,ZK as Ae,Zq as je,_q as Me,aJ as Ne,aq as Pe,bq as Fe,cJ as Ie,cX as y,eJ as Le,eq as Re,gX as ze,gq as Be,hq as Ve,iq as He,jJ as Ue,kJ as We,kq as Ge,lJ as Ke,nJ as qe,nq as Je,oJ as Ye,oX as Xe,pX as b,qK as Ze,rJ as Qe,rq as $e,sJ as et,t as x,tJ as tt,tq as nt,uJ as rt,vq as it,wq as at,xq as S,yq as ot,zJ as st,zq as ct}from"./api-uQUQB4xy.js";import{t as lt}from"./list-C1mXgOwS.js";import{t as C}from"./button-Biq40Zpc.js";import{$t as ut,An as dt,Bt as ft,Ct as pt,Dt as mt,Et as ht,Gt as gt,Hn as _t,Ht as vt,In as yt,Jn as bt,Jt as w,Kt as xt,Ot as St,Rn as Ct,Rt as wt,St as T,Tt,Ut as Et,Vn as Dt,Vt as Ot,Wt as kt,Yt as At,bt as E,cn as D,cr as O,ft as jt,on as k,qt as Mt,sn as A,sr as j,vt as M,wn as Nt,wt as Pt,xt as N,yt as P,zt as Ft}from"./index-Bw4ypNNp.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-DH8u2aW2.js";import{t as Bt}from"./FilterBar-CdYSlKIB.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as z,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-BR5ScfJS.js";var qt=d(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Jt=d(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),V=t(e(),1),H=n();function U(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Ht(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,V.useState)(!1),l=(0,V.useMemo)(()=>U(y()),[]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{month:`long`,year:`numeric`}),[]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),m=L(i.year,i.month),h=n?.hour??9,g=n?.minute??0,_=(e,n,r,i,a)=>t(B(e,n,r,i,a)),ee=(e,t,n)=>{a({year:e,month:t}),_(e,t,n,h,g)},te=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},ne=n===null?Ge():p.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(k,{modal:!0,open:s,onOpenChange:c,children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":o(),children:[(0,H.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,H.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ne})]})}),(0,H.jsxs)(A,{align:`start`,className:`oc-dtp__pop`,children:[(0,H.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":de(),onClick:()=>te(-1),children:(0,H.jsx)(O,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:d.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":u(),onClick:()=>te(1),children:(0,H.jsx)(j,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),m.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>ee(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(M,{value:String(h),onValueChange:e=>_(i.year,i.month,n?.day??r.getDate(),Number(e),g),children:[(0,H.jsx)(N,{size:`sm`,"aria-label":f(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(P,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(M,{value:String(g),onValueChange:e=>_(i.year,i.month,n?.day??r.getDate(),h,Number(e)),children:[(0,H.jsx)(N,{size:`sm`,"aria-label":v(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(P,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function Qt(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function en(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=y(),c=(0,V.useMemo)(()=>Zt(e),[e]),l=(0,V.useMemo)(()=>$t(s),[s]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),p=new Date,m=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},h=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":it(),onClick:()=>m(-1),children:(0,H.jsx)(O,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":Me(),onClick:()=>m(1),children:(0,H.jsx)(j,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:p.getFullYear(),month:p.getMonth()}),children:ot()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:h}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:S()}),(0,H.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:Fe()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:c,weekdays:l,timeFmt:f,now:p,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:c,monthShortFmt:d,now:p,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:Be({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=L(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*on[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=z(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Gt(e)){case`ok`:return(0,H.jsx)(w,{variant:`secondary`,children:be()});case`error`:return(0,H.jsx)(w,{variant:`destructive`,children:Se()});case`running`:return(0,H.jsx)(w,{variant:`outline`,children:c()});case`other`:return(0,H.jsx)(w,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=b(x.scheduled.listMyCrons),t=b(x.scheduled.getCronDetail),n=b(x.scheduled.listCronRuns),o=b(x.scheduled.updateCron),u=b(x.scheduled.removeCron),d=b(x.scheduled.runCronNow),f=At(),de=ze(x.me.getMe,{host:jt})?.timezone,[v,Me]=(0,V.useState)(null),[Fe,Be]=(0,V.useState)(!1),[Ge,it]=(0,V.useState)(!1),[S,ot]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),[k,A]=(0,V.useState)(null),[j,L]=(0,V.useState)(null),[Ht,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ut),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of v??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[v,B]),on=(0,V.useMemo)(()=>Qt===`year`?tn(G.year):en(G.year,G.month),[Qt,G]),sn=(0,V.useMemo)(()=>un(an,on.startMs,on.endMs),[an,on]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,V.useCallback)(async()=>{Be(!0),it(!1);try{Me(await e({}))}catch{it(!0)}finally{Be(!1)}},[e]);(0,V.useEffect)(()=>{q()},[q]);let cn=(0,V.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,V.useRef)(null);(0,V.useEffect)(()=>{v!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[v]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ot(e);try{await t(),f.success(n),await q()}catch(e){f.toast({variant:`error`,title:Qe({code:dn(e)})})}finally{ot(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;A({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;A({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;A(null),f.toast({variant:`error`,title:Qe({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;L(null),f.toast({variant:`error`,title:Qe({code:dn(e)})})}},mn=async()=>{if(j===null)return;let e={};if(j.nameDirty&&j.name.trim()===``||j.messageDirty&&j.hasMessage&&j.message.trim()===``){f.toast({variant:`error`,title:_()});return}if(j.nameDirty&&j.name.trim()!==``&&(e.name=j.name.trim()),j.scheduleDirty){if(j.scheduleKind===`cron`&&j.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:j.cronExpr.trim(),...j.tz.trim()===``?{}:{tz:j.tz.trim()}};else if(j.scheduleKind===`every`){let t=Number(j.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[j.everyUnit])})}else if(j.scheduleKind===`at`&&j.at!==``){let t=Date.parse(j.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(j.scheduleDirty&&e.schedule===void 0){f.toast({variant:`error`,title:ye()});return}if(j.messageDirty&&j.hasMessage&&j.message.trim()!==``&&(e.message=j.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Gt(!0);try{await o({instanceName:j.instanceName,jobId:j.jobId,patch:e}),f.success(Je()),t===Q.current&&L(null),await q()}catch(e){f.toast({variant:`error`,title:Qe({code:dn(e)})})}finally{Gt(!1)}},hn=v?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Ce()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":at(),children:[(0,H.jsx)(C,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":l(),title:l(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(lt,{})}),(0,H.jsx)(C,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":_e(),title:_e(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Fe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(yt,{size:14,"aria-hidden":!0}),ve()]})]}),v!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:ge(),onReset:()=>U(Ut),canReset:Wt(B),children:[(0,H.jsxs)(M,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(N,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`all`,children:ce()}),(0,H.jsx)(E,{value:`active`,children:a()}),(0,H.jsx)(E,{value:`paused`,children:Ue()}),(0,H.jsx)(E,{value:`auto-disabled`,children:We()})]})]}),(0,H.jsxs)(M,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(N,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`all`,children:re()}),(0,H.jsx)(E,{value:`ok`,children:be()}),(0,H.jsx)(E,{value:`error`,children:Se()}),(0,H.jsx)(E,{value:`running`,children:c()}),(0,H.jsx)(E,{value:`none`,children:ct()})]})]})]}):null,v===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Fe,children:Ge?g():Xe()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[Ge?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):null,v.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:Ve()})]}):(0,H.jsxs)(H.Fragment,{children:[Ge?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):null,v.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):null,v.map(e=>{let t=e.jobs.filter(e=>Vt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[v.length>1||e.error||!e.supported?(0,H.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,H.jsx)(w,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:st({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:he()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:se()}),(0,H.jsx)(F,{children:te()}),(0,H.jsx)(F,{children:p()}),(0,H.jsx)(F,{children:fe()}),(0,H.jsx)(F,{children:ue()}),(0,H.jsx)(F,{children:Te()}),(0,H.jsx)(F,{children:Pe()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=S===r,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,H.jsxs)(Rt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??le()}),(0,H.jsx)(I,{children:(0,H.jsx)(w,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=wt(t.schedule),n=e===null?null:Ft(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(I,{children:z(t)===`auto-disabled`?(0,H.jsx)(w,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:We()}):z(t)===`active`?(0,H.jsx)(w,{variant:`secondary`,children:a()}):z(t)===`paused`?(0,H.jsx)(w,{variant:`outline`,children:Ue()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(I,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(w,{variant:`destructive`,title:t.lastDeliveryError??rt(),children:ee()}):null]}),(0,H.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,H.jsx)(bt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:S!==null,onClick:()=>void X(r,async()=>{let n=await d({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},qe()),children:(0,H.jsx)(Nt,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?et():Ye(),"aria-label":R(t)===`pause`?et():Ye(),disabled:S!==null,onClick:()=>void X(r,()=>o({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?tt():Le()),children:R(t)===`pause`?(0,H.jsx)(_t,{size:14,"aria-hidden":!0}):(0,H.jsx)(Ct,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:He(),"aria-label":He(),disabled:S!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(Dt,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:$e(),"aria-label":$e(),disabled:S!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ne(),"aria-label":Ne(),disabled:S!==null,onClick:()=>O({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(dt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:ne()}):null]}),(0,H.jsx)(ft,{open:D!==null,onOpenChange:e=>{e||O(null)},children:(0,H.jsxs)(Et,{children:[(0,H.jsxs)(xt,{children:[(0,H.jsx)(Mt,{children:me()}),(0,H.jsx)(kt,{children:je({name:D?.name??``})})]}),(0,H.jsxs)(gt,{children:[(0,H.jsx)(vt,{children:De()}),(0,H.jsx)(Ot,{onClick:()=>{let e=D;O(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>u({instanceName:e.instanceName,jobId:e.jobId}),i())},children:ke()})]})]})}),(0,H.jsx)(pt,{open:k!==null,onOpenChange:e=>{e||(Z.current++,A(null))},children:(0,H.jsxs)(Pt,{style:{maxWidth:640},children:[(0,H.jsx)(mt,{children:(0,H.jsx)(St,{children:nt({name:k?.name??``})})}),k?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):k!==null&&k.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):k===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:k.entries.map((e,t)=>(0,H.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,H.jsx)(fn,{status:e.status}),(0,H.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,H.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[oe({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(pt,{open:j!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,H.jsxs)(Pt,{className:`oc-cronedit`,children:[(0,H.jsxs)(mt,{children:[(0,H.jsx)(St,{children:r()}),(0,H.jsx)(Tt,{children:pe()})]}),j===null?null:j.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:se()}),(0,H.jsx)(ut,{value:j.name,maxLength:200,onChange:e=>L({...j,name:e.target.value,nameDirty:!0})})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ae()}),(0,H.jsxs)(M,{value:j.scheduleKind,onValueChange:e=>L({...j,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(N,{children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`cron`,children:Ee()}),(0,H.jsx)(E,{value:`every`,children:Oe()}),(0,H.jsx)(E,{value:`at`,children:ie()})]})]}),j.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(ut,{value:j.cronExpr,onChange:e=>L({...j,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:j.tz,onChange:e=>L({...j,tz:e,scheduleDirty:!0}),fallbackTz:de??void 0})]}):j.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(ut,{type:`number`,min:1,value:j.everyValue,onChange:e=>L({...j,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(M,{value:j.everyUnit,onValueChange:e=>L({...j,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(N,{style:{maxWidth:160},children:(0,H.jsx)(T,{})}),(0,H.jsxs)(P,{children:[(0,H.jsx)(E,{value:`minutes`,children:Ze()}),(0,H.jsx)(E,{value:`hours`,children:ae()}),(0,H.jsx)(E,{value:`days`,children:h()})]})]})]}):(0,H.jsx)(Yt,{value:j.at,onChange:e=>L({...j,at:e,scheduleDirty:!0})})]}),j.hasMessage?(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ke()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:j.message,onChange:e=>L({...j,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(ht,{children:[(0,H.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:De()}),(0,H.jsxs)(C,{onClick:()=>void mn(),disabled:j===null||j.loading||Ht,children:[Ht?(0,H.jsx)(bt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,we()]})]})]})})]})}export{pn as ScheduledTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,AU as i,BU as ee,CU as a,CW as te,DU as ne,EU as o,FU as re,GU as ie,HU as ae,IU as oe,JU as se,KU as ce,LU as le,MU as ue,NU as de,OU as fe,PU as pe,QU as me,RU as he,SU as s,SW as ge,TU as c,UU as _e,VU as ve,WU as ye,XU as be,YU as xe,ZU as Se,_U as Ce,_W as we,aU as Te,aW as Ee,bU as l,bW as De,cU as u,cW as Oe,dU as ke,dW as Ae,eW as je,fU as d,fW as Me,gU as f,gW as Ne,gX as p,hU as m,hW as Pe,hX as h,iU as g,iW as Fe,jU as Ie,kU as Le,lU as _,lW as Re,mU as v,mW as ze,nW as Be,oU as y,oW as Ve,pU as b,pW as He,pX as Ue,qU as We,rU as x,rW as Ge,sU as S,sW as Ke,t as C,tW as qe,uU as w,uW as Je,vU as T,vW as E,wU as D,xU as O,xW as Ye,yU as k,yW as Xe,zU as Ze}from"./api-uQUQB4xy.js";import{r as Qe}from"./dist-BV5tiwQ7.js";import{t as A}from"./button-Biq40Zpc.js";import{$t as j,At as M,Ct as N,Dt as P,Et as F,Jt as I,Ot as L,St as R,Tt as z,Yt as $e,b as et,bt as B,ct as tt,dr as nt,fr as rt,kt as V,lr as H,rr as it,sr as at,vt as U,wt as W,xt as G,yt as K}from"./index-Bw4ypNNp.js";import{t as ot}from"./FilterBar-CdYSlKIB.js";import{t as st}from"./DataTableShell-CeVf9eD_.js";import{t as ct}from"./roleDescriptions-CbaJtUsv.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>_(),days:null},{value:`30`,label:()=>u(),days:30},{value:`90`,label:()=>S(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=rt({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??X,[o,s]=(0,q.useState)(X),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Ce=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),Te=p(C.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===X?void 0:o,disabled:a===X?void 0:a===`disabled`}}),l=p(C.apiKeys.listKeys,{}),u=p(C.apiKeys.listRoles,{}),ke=h(C.apiKeys.createServiceAccount),d=h(C.apiKeys.updateServiceAccount),f=h(C.apiKeys.deleteServiceAccount),m=Ue(C.apiKeys.mintApiKey),g=h(C.apiKeys.revokeApiKey),_=tt(),v=$e(),y=n!==``||o!==X||a!==X;function b(){s(X),t({search:{},replace:!0})}let[x,S]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Z),[D,O]=(0,q.useState)(null),[k,M]=(0,q.useState)(new Set),[N,P]=(0,q.useState)(null),F=(0,q.useRef)(!1),[L,z]=(0,q.useState)(new Set),[V,H]=(0,q.useState)({}),[it,W]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function Q(e){M(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await d({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(ve())):await ke({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Z),O(null),S(!1)}catch(e){v.error(D?ae():_e(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),S(!0)}async function mt(e){if(F.current)return;F.current=!0;let t=V[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;P(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(ee(),e)}finally{F.current=!1,P(null)}}async function $(e){if(await _({title:Ze(),description:(0,J.jsxs)(J.Fragment,{children:[he(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,le(),` `,(0,J.jsx)(`strong`,{children:oe()}),` `,re()]}),confirmWord:e.name,confirmLabel:pe(),destructive:!0}))try{await f({serviceAccountId:e._id}),v.success(de(),e.name)}catch(e){v.error(ue(),e)}}async function ht(e){if(await _({title:Ie(),description:(0,J.jsxs)(J.Fragment,{children:[i(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Le()]}),confirmLabel:fe(),destructive:!0})&&!L.has(e._id)){z(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(ne(),e)}finally{z(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,J.jsxs)(ot,{q:n,onQChange:c,searchPlaceholder:ge(),onReset:b,canReset:y,children:[(0,J.jsxs)(U,{value:o,onValueChange:s,children:[(0,J.jsx)(G,{size:`sm`,className:`w-40`,children:(0,J.jsx)(R,{placeholder:Ye()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(B,{value:X,children:De()}),(u??[]).map(e=>(0,J.jsx)(B,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(U,{value:a,onValueChange:Ce,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(R,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(B,{value:X,children:Xe()}),(0,J.jsx)(B,{value:`active`,children:E()}),(0,J.jsx)(B,{value:`disabled`,children:we()})]})]})]}),(0,J.jsx)(st,{title:Ne(),rows:Te,addLabel:Pe(),onAdd:()=>{T(Z),O(null),S(!0)},emptyHint:ze(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Je(),onSelect:()=>pt(e)},{label:He(),onSelect:()=>void mt(e)}]:[],{label:k.has(e._id)?Me():Ae(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:Re(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Oe():Ke(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(at,{})})},{header:Ve(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:Fe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(I,{variant:`destructive`,children:we()}):(0,J.jsx)(I,{variant:`outline`,children:E()})},{header:Ge(),cell:e=>(0,J.jsxs)(U,{value:V[e._id]??`never`,onValueChange:t=>H(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(R,{})}),(0,J.jsx)(K,{children:lt.map(e=>(0,J.jsx)(B,{value:e.value,children:e.label()},e.value))})]})},{header:Be(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?qe():je({count:t})})}}]}),(0,J.jsx)(et,{open:x,onOpenChange:e=>{S(e),e||O(null)},title:D?r():be(),description:D?me():xe(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?Se():se(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,J.jsx)(j,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,J.jsxs)(U,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(G,{className:`w-full`,children:(0,J.jsx)(R,{placeholder:ie()})}),(0,J.jsx)(K,{children:(u??[]).map(e=>(0,J.jsxs)(B,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===w.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ye()}),(0,J.jsx)(j,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:it,onClose:()=>W(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[o(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:D()}),(0,J.jsx)(`th`,{children:a()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:l()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:M(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?T():Ce()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(N,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(P,{children:[(0,J.jsx)(L,{children:f()}),(0,J.jsx)(z,{children:m({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:v()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":b(),children:[n?(0,J.jsx)(H,{}):(0,J.jsx)(it,{}),n?d():ke()]})]}),(0,J.jsx)(F,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:w()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?y():M(e)}function mt(e){return e===null?`—`:V(e)}function $(e){return e.disabled?(0,J.jsx)(I,{variant:`destructive`,children:Te()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(I,{variant:`outline`,children:g()}):(0,J.jsx)(I,{variant:`outline`,children:x()})}export{Q as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,Cm as a,Dm as o,Em as s,Mm as c,Nm as l,Om as u,Pm as d,Qp as f,Sm as p,Tm as m,Xp as h,Zp as g,_m as _,am as v,bm as y,cm as b,dm as x,em as S,fm as C,gX as w,gm as T,hX as E,hm as D,im as O,jm as k,km as A,lm as j,mm as M,nm as N,om as P,pm as F,rm as I,sm as L,t as R,tm as ee,um as z,vm as B,wm as V,xm as H,ym as U}from"./api-uQUQB4xy.js";import{t as W}from"./button-Biq40Zpc.js";import{At as G,ct as K}from"./index-Bw4ypNNp.js";import{t as q}from"./DataTableShell-CeVf9eD_.js";var J=t(e(),1),Y=n(),X={hung:()=>_(),wrong_result:()=>T(),error:()=>D(),other:()=>M()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=E(R.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,F({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?z():j()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:b()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:L(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?v():P()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[O({count:t.children.length}),t.childrenTruncated?` ${I()}`:``,t.textTruncated?` ${N()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${ee()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=w(R.subAgentReports.listForAdmin,{}),t=E(R.subAgentReports.readReport),n=E(R.subAgentReports.deleteReport),r=K(),[_,v]=(0,J.useState)(null),[b,x]=(0,J.useState)({});async function S(e){if(_===e._id){v(null);return}if(!b[e._id]){let n=await t({reportId:e._id});x(t=>({...t,[e._id]:n}))}v(e._id)}async function C(e){await r({title:f(),description:g(),confirmLabel:h(),destructive:!0})&&(await n({reportId:e._id}),_===e._id&&v(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),` `,(0,Y.jsx)(`strong`,{children:k()}),` `,i()]}),(0,Y.jsx)(q,{title:d(),rows:e,emptyHint:l(),isExpanded:e=>_===e._id&&!!b[e._id],renderExpanded:e=>b[e._id]?(0,Y.jsx)($,{data:b[e._id]}):null,columns:[{header:A(),cell:e=>G(e.at),sort:e=>e.at},{header:u(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:o(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:s(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${a({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:m(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:V(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:p()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:H()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:_===e._id?U():y(),onSelect:()=>void S(e)},{label:B(),onSelect:()=>void C(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,AG as i,AK as a,BG as o,CG as s,CK as c,DG as l,DK as u,EG as d,EK as f,FG as p,GG as m,HG as h,IG as g,JG as ee,Jp as _,KG as v,Kp as te,LG as ne,MG as re,MK as ie,NG as ae,OG as oe,OK as se,PG as ce,QG as le,RG as ue,SG as de,SK as y,TG as fe,TK as pe,UG as me,VG as he,WG as ge,XG as _e,YG as b,Yp as x,ZG as ve,_G as ye,_K as be,aK as xe,bG as Se,bK as Ce,cK as we,dG as Te,dK as Ee,eK as De,fG as Oe,fK as ke,gG as Ae,gK as je,gX as S,hG as Me,hK as Ne,hX as C,iK as Pe,iX as Fe,jG as Ie,jK as Le,kG as Re,kK as ze,lK as Be,mG as w,mK as Ve,nK as He,nX as Ue,oK as We,pG as Ge,pK as Ke,pX as qe,qG as Je,qp as Ye,r as Xe,rK as Ze,rX as Qe,sK as $e,t as T,tK as et,uG as tt,uK as nt,vG as E,vK as rt,wG as it,wK as at,xG as ot,xK as st,yG as ct,yK as lt,zG as ut}from"./api-uQUQB4xy.js";import{t as D}from"./x-CfpsHFMp.js";import{t as O}from"./button-Biq40Zpc.js";import{$t as k,Jt as A,Mt as j,On as M,St as N,an as dt,bt as P,dt as ft,en as pt,ft as F,in as I,lr as L,nn as R,nr as mt,rn as ht,tn as gt,tr as z,ut as _t,vt as B,xt as V,yt as H}from"./index-Bw4ypNNp.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-AFUQEzoT.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-DH8u2aW2.js";import{t as Ot}from"./TimeRangePicker-CMNe-waP.js";import{t as kt}from"./FilterBar-CdYSlKIB.js";import{t as At}from"./AdvancedFilter-bgzdOb0t.js";var K=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ae());if(e.size>Rt)throw Error(re());let{source:n,width:r,height:a,cleanup:o}=await Ut(e);try{let o=e.type===`image/svg+xml`,s=Math.min(zt/r,Bt/a,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(a*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(i());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Pt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(i());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);q(e.data,f.width,f.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),m.putImageData(e,0,0)}let h=q(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await Y(p,`image/webp`,Vt)??await Y(p,`image/png`);if(!g)throw Error(Re());return{blob:g,hasAlpha:h}}finally{o()}}async function Ut(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Ie())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Fe():e===`dark`?Qe():Ue()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Xe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(L,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":x(),title:x(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=S(T.charts.listMyCharts),r=C(T.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:at()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:y(),subtitle:st(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Ce():n.via===`owner`?lt():rt({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()}):null]})}function Qt(){let e=C(T.charts.importChart),[t,n]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(b())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(Je());return}let r;try{r=JSON.parse(i)}catch{s(b());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:et()}),(0,X.jsx)(k,{value:t,onChange:e=>n(e.target.value),placeholder:De(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:le(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),ve(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(O,{size:`sm`,disabled:u,onClick:()=>void p(),children:_e()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ee()}):null]})]})}function $t({chart:e}){let t=qe(T.charts.setChartLogo),n=C(T.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,s]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?o():ut()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),t?ne():ue(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:p()}):null,t?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:g()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:he()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=S(T.me.getMe,{host:F}),n=C(T.charts.addChartDomain),r=C(T.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,c]=(0,K.useState)(null),[u,f]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let p=e.domains??[];async function m(){let t=i.trim();if(t!==``){c(null),f(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{f(!1)}}}async function h(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:oe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:p.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it()}):p.map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":s({domain:e}),onClick:()=>void h(e),children:(0,X.jsx)(D,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{value:i,onChange:e=>a(e.target.value),placeholder:d(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void m(),children:fe()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:l()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=C(T.charts.updateChart),n=C(T.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>$(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[d,f]=(0,K.useState)(null),[p,m]=(0,K.useState)(!1);function g(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function ee(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(b());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}m(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:g,children:me()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:h()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Se()}),(0,X.jsx)(k,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:_()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":_()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Ye():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:te()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ct()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,disabled:p,onClick:()=>void ee(),children:de()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ot()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=S(T.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:v()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ge()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=C(T.charts.addChartToGroupPool),r=C(T.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Be():e.kind===`custom`&&e.scope===`personal`?w():nt()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:we()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:We()}),(a??[]).map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Pe({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(D,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(B,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(V,{size:`sm`,className:`w-56`,children:(0,X.jsx)(N,{placeholder:xe()})}),(0,X.jsx)(H,{children:s.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:$e()}):null]})]})}function an({chart:e}){let t=C(T.charts.promoteChartToCommon),n=C(T.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Ge():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Me({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Oe()}):null,(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Te()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(T.admin.setDefaultThemeMode),i=C(T.admin.setDefaultLocale),o=C(T.charts.setDefaultChart),s=S(T.charts.listChartsAdmin),c=S(T.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:f()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:y()}),ft.map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ke()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:tt()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(O,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,X.jsx)(O,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:se()})]})]})}function sn(){let e=S(T.me.getMe,{host:F}),t=_t(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[d,f]=(0,K.useState)(Gt),p=i!==``||o!==Z||c!==Z;function m(){a(``),s(Z),l(Z),f(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:u()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(O,{variant:`outline`,children:`Outline`}),(0,X.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(O,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,children:`Small`}),(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{size:`lg`,children:`Large`}),(0,X.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(z,{})}),(0,X.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(k,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(B,{value:n,onValueChange:r,children:[(0,X.jsx)(V,{className:`w-56`,children:(0,X.jsx)(N,{placeholder:`Select…`})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(j,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:d,onTimeRangeChange:f,onReset:m,canReset:p,children:[(0,X.jsxs)(B,{value:o,onValueChange:s,children:[(0,X.jsx)(V,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(B,{value:c,onValueChange:l,children:[(0,X.jsx)(V,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Ot,{value:d,onChange:f})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(pt,{children:[(0,X.jsx)(dt,{asChild:!0,children:(0,X.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(z,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(ht,{children:`Actions`}),(0,X.jsx)(I,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(I,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(wt,{className:`w-80`,children:[(0,X.jsxs)(yt,{children:[(0,X.jsx)(St,{children:`Instance`}),(0,X.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(bt,{className:`gap-2`,children:[(0,X.jsx)(O,{size:`sm`,children:`Save`}),(0,X.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Dt,{children:[(0,X.jsx)(Tt,{children:(0,X.jsxs)(W,{children:[(0,X.jsx)(U,{className:`w-8`,children:(0,X.jsx)(j,{"aria-label":`select all`})}),(0,X.jsx)(U,{children:`Name`}),(0,X.jsx)(U,{children:`Mode`}),(0,X.jsx)(U,{className:`text-right`,children:`Status`}),(0,X.jsx)(U,{className:`w-8`})]})}),(0,X.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(W,{children:[(0,X.jsx)(G,{children:(0,X.jsx)(j,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(G,{className:`font-medium`,children:e.n}),(0,X.jsx)(G,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(G,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(L,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(G,{children:(0,X.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(z,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cd as r,Dd as i,Ed as a,Od as o,Sd as s,Td as c,aO as l,cO as u,dO as d,fO as f,iO as p,lO as m,mO as h,nO as g,oO as _,pO as v,rO as y,sO as b,uO as x,wd as S}from"./api-BEXV-QDx.js";import{t as C}from"./button-BI4NYd7l.js";import{$t as w,At as T,Fn as E,dn as D,fn as O,ir as k,ln as A,un as j}from"./index-DQx8LX7A.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:h(),from:`now-5m`},{label:v(),from:`now-15m`},{label:f(),from:`now-30m`},{label:d(),from:`now-1h`},{label:x(),from:`now-3h`},{label:m(),from:`now-6h`},{label:u(),from:`now-12h`},{label:b(),from:`now-24h`},{label:_(),from:`now-2d`},{label:l(),from:`now-7d`},{label:p(),from:`now-30d`},{label:y(),from:`now-90d`},{label:g(),from:`now-520w`}];function L(e){return T(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,l]=(0,M.useState)(!1),[u,d]=(0,M.useState)(``),f=F(e),[p,m]=(0,M.useState)(()=>z(f.from)),[h,g]=(0,M.useState)(()=>z(f.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),d(``)}l(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),l(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),l(!1))}let b=(0,M.useMemo)(()=>{let e=u.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[u]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:_,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(k,{}),R(e)]})}),(0,H.jsx)(j,{children:(0,H.jsx)(A,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:o()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,H.jsx)(w,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(w,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:c()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:u,onChange:e=>d(e.target.value),placeholder:S(),"aria-label":r()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:s()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,Dd as i,Ed as a,Od as o,Td as s,_O as c,aO as l,cO as u,dO as d,fO as f,gO as p,hO as m,jd as h,kd as g,lO as _,mO as v,oO as y,pO as b,sO as x,uO as S}from"./api-uQUQB4xy.js";import{t as C}from"./button-Biq40Zpc.js";import{$t as w,At as T,Fn as E,dn as D,fn as O,ir as k,ln as A,un as j}from"./index-Bw4ypNNp.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:c(),from:`now-5m`},{label:p(),from:`now-15m`},{label:m(),from:`now-30m`},{label:v(),from:`now-1h`},{label:b(),from:`now-3h`},{label:f(),from:`now-6h`},{label:d(),from:`now-12h`},{label:S(),from:`now-24h`},{label:_(),from:`now-2d`},{label:u(),from:`now-7d`},{label:x(),from:`now-30d`},{label:y(),from:`now-90d`},{label:l(),from:`now-520w`}];function L(e){return T(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,c]=(0,M.useState)(!1),[l,u]=(0,M.useState)(``),d=F(e),[f,p]=(0,M.useState)(()=>z(d.from)),[m,_]=(0,M.useState)(()=>z(d.to));function v(t){if(t){let t=F(e);p(z(t.from)),_(z(t.to)),u(``)}c(t)}function y(e){t({kind:`relative`,from:e,to:`now`}),c(!1)}function b(){let e=B(f),n=B(m);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),c(!1))}let x=(0,M.useMemo)(()=>{let e=l.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[l]),S=B(f)!==null&&B(m)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:v,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(k,{}),R(e)]})}),(0,H.jsx)(j,{children:(0,H.jsx)(A,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:h()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,H.jsx)(w,{type:`datetime-local`,value:f,onChange:e=>p(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:g()}),(0,H.jsx)(w,{type:`datetime-local`,value:m,onChange:e=>_(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:b,children:o()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:l,onChange:e=>u(e.target.value),placeholder:i(),"aria-label":a()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:s()}):x.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>y(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aq as r,Oq as i,jq as a,kq as o}from"./api-BEXV-QDx.js";import{t as s}from"./chevrons-up-down-BBnIDUVh.js";import{$t as c,cn as l,lr as u,on as d,sn as f}from"./index-DQx8LX7A.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(c,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||i():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(l,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:r(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:o()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Mq as r,Nq as i,Pq as a,jq as o}from"./api-uQUQB4xy.js";import{t as s}from"./chevrons-up-down-HreDTesh.js";import{$t as c,cn as l,lr as u,on as d,sn as f}from"./index-Bw4ypNNp.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(c,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||o():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(l,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:i(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:r()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$R as i,AR as a,BR as o,Cj as s,Dj as c,Du as l,E as u,Ej as d,Eu as f,FR as p,GA as m,HR as h,IR as g,JA as _,JR as v,KA as y,LR as b,MR as x,NR as S,OR as C,Ou as w,PR as T,QA as ee,QR as te,RR as ne,Sj as re,Tj as ie,VR as ae,WA as oe,XA as se,XR as ce,YA as le,YR as ue,ZA as de,ZR as E,_j as fe,_z as D,aj as pe,az as O,bj as me,cj as he,cz as ge,dj as _e,dz as ve,ej as ye,ez as k,fj as be,fz as A,gX as j,gj as xe,gz as M,hX as N,hj as Se,hz as P,ij as Ce,iz as F,jR as we,kR as Te,lj as Ee,lz as De,mj as Oe,mz as ke,nj as Ae,nz as je,oj as Me,oz as Ne,pj as Pe,pz as Fe,qA as Ie,qR as Le,rj as Re,rz as ze,sj as Be,sz as Ve,t as I,tj as He,tz as Ue,uj as We,uz as Ge,vj as Ke,wj as qe,xj as Je,yj as Ye,zR as Xe}from"./api-uQUQB4xy.js";import{t as Ze}from"./x-CfpsHFMp.js";import{t as L}from"./button-Biq40Zpc.js";import{$n as Qe,At as R,Ct as $e,Dt as et,Jt as z,Ot as tt,St as B,Tt as nt,U as rt,Yn as it,a as at,at as V,bt as H,dr as ot,er as st,fr as ct,ft as lt,i as ut,it as dt,jt as ft,lr as pt,o as mt,ot as ht,rr as gt,s as _t,st as U,vt as W,wt as vt,xt as G,yt as K}from"./index-Bw4ypNNp.js";import{n as yt}from"./TimeRangePicker-CMNe-waP.js";import{t as bt}from"./FilterBar-CdYSlKIB.js";import{t as xt}from"./AdvancedFilter-bgzdOb0t.js";import{t as St}from"./DataTableShell-CeVf9eD_.js";var Ct=u(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?te():n===`agent`?`${E()} - ${r}`:e}function Tt(){let e=j(I.me.getMe,{host:lt})?.role===`admin`,t=j(I.deliveryTiming.getDeliveryStatus,{}),n=N(I.deliveryTiming.startDeliveryRecord),r=N(I.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:D()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:M()})]}),e?(0,J.jsx)(L,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?ke():P()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(z,{variant:`secondary`,children:Fe()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:A({time:ft(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?De():Ge()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=j(I.deliveryTiming.listDeliverySessions,{}),n=N(I.deliveryTiming.deleteDeliverySessions),[r,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=yt(c),m=c.to===`now`?1/0:p,h=r.trim()!==``||o!==`all`||c!==Y,g=()=>{a(``),s(`all`),l(Y)},_=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,o,f,m]),y=e=>{let t=new Set((_??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:a,searchPlaceholder:Ve(),timeRange:c,onTimeRangeChange:l,onReset:g,canReset:h,children:(0,J.jsxs)(W,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:`all`,children:Ne()}),(0,J.jsx)(H,{value:`active`,children:O()}),(0,J.jsx)(H,{value:`stopped`,children:F()})]})]})}),(0,J.jsx)(St,{title:ge(),rows:_,emptyHint:Te(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?ue():ce(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(st,{size:15,"aria-hidden":!0}):(0,J.jsx)(Qe,{size:15,"aria-hidden":!0})})},{header:ze(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:R(e.startedAt)})},{header:je(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:R(e.stoppedAt)})},{header:Ue(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:k(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:i(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(z,{variant:`secondary`,children:O()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:F()})}],rowActions:e?e=>[{label:v(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:v(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=j(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Le()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ve()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,C()]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(pt,{size:13,"aria-hidden":!0}):(0,J.jsx)(gt,{size:13,"aria-hidden":!0}),t?a():we()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:o()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Xe()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ne()})]})}),(0,J.jsxs)(`tbody`,{children:[i(b(),r.bridge),i(g(),r.A),i(p(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:w()},{value:`principalType`,label:l()},{value:`direction`,label:`direction`},{value:`roleKey`,label:f()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=ct({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,o=e.principalType??Q,l=e.direction??Q,u=e.roleKey??Q,f=e.q??``,p=e.correlationId,m=ut(e.from,e.to),g=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:v,to:y}=yt(m),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),w=e=>void t({search:t=>({...t,limit:e})}),T=e=>void t({search:t=>({...t,kind:e})}),te=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ne=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),oe=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,...mt(e)})}),D=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),O=j(I.observability.listEvents,{limit:n}),ge=j(I.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...p?{correlationId:p}:{},filter:{q:f||void 0,from:v,to:y,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:l===Q?void 0:l,roleKey:u===Q?void 0:u,advanced:g.length>0?g:void 0}}),ve=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),k=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),A=f!==``||a!==Q||o!==Q||l!==Q||u!==Q||g.length>0||m.kind!==`relative`||m.from!==Nt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let N=b?O?.filter(e=>e.correlationId===b):ge,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(dt,{value:P,onValueChange:e=>F(e),children:[(0,J.jsxs)(ht,{className:`w-full`,children:[(0,J.jsxs)(U,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(it,{size:13,"aria-hidden":!0}),h()]}),(0,J.jsxs)(U,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),ae()]})]}),(0,J.jsx)(V,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(V,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[c(),(0,J.jsx)(`strong`,{children:d()}),ie(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:qe()})]}),(0,J.jsxs)(bt,{q:f,onQChange:te,searchPlaceholder:s(),timeRange:m,onTimeRangeChange:E,onReset:M,canReset:A,children:[(0,J.jsxs)(W,{value:a,onValueChange:ne,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:re()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:Je()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:o,onValueChange:oe,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:me()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:Ye()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:l,onValueChange:ce,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{placeholder:Ke()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:fe()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:u,onValueChange:ue,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{placeholder:xe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(H,{value:Q,children:Se()}),k.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===Z?``:i,placeholder:Oe(),"aria-label":Oe(),onChange:e=>{let t=e.target.value.trim();T(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:ve.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(W,{value:String(n),onValueChange:e=>w(Number(e)),children:[(0,J.jsx)(G,{size:`sm`,className:`w-28`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(K,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:Pe({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:g,onChange:D}),b?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>x(null),title:be(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[_e(),(0,J.jsx)(`code`,{children:$(b)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:We()})]})}):null,(0,J.jsx)(St,{title:Ee(),rows:N,emptyHint:b?he():Be(),columns:[{header:Me(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)})},{header:pe(),sort:e=>e.kind,cell:e=>(0,J.jsx)(z,{variant:`secondary`,children:e.kind})},{header:Ce(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":Re(),children:`✓`})}},{header:Ae(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(z,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:He(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(z,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ye(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(z,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:r(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:de(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:se(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:le(),onClick:()=>x(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:_(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:Ie()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:S,onClose:()=>C(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)($e,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(vt,{className:`max-w-lg`,children:[(0,J.jsxs)(et,{children:[(0,J.jsxs)(tt,{className:`oc-traces__meta-title`,children:[y(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(z,{variant:`outline`,children:m()})]}),(0,J.jsx)(nt,{children:oe()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BA as r,BT as i,E as a,GT as o,HT as s,IT as c,JT as l,KT as u,LT as d,QT as f,RT as p,UT as m,VT as h,WT as g,XT as _,YT as v,ZT as y,aX as b,fX as x,nE as S,pX as C,qT as w,t as T,tE as E,zT as D}from"./api-BEXV-QDx.js";import{t as O}from"./use_paginated_query-CWrNoLih.js";import{t as k}from"./button-BI4NYd7l.js";import{An as A,At as j,F as M,Yt as N,ct as P,h as F}from"./index-DQx8LX7A.js";import{n as I,t as L}from"./trashPage-B36nmIyS.js";var R=a(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=C(T.blobSweep.listBlobSweeps,{}),t=C(T.blobQuarantine.quarantineSettings,{}),n=x(T.blobSweep.startBlobSweep),a=P(),{toast:S}=N(),[E,O]=(0,z.useState)(!1),F=b(),I=e=>M(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){S({title:c(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await a({title:i({count:H.orphans.count}),description:D({size:I(H.orphans.bytes)}),confirmLabel:h(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:f()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:E||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,_()]}),(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:E||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(A,{}),` `,h()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:y({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:r()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:v({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:l()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:w({date:j(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:u({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:o({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:g({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:m({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:s()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?d({date:j(L.lastApply.finishedAt??L.lastApply.startedAt)}):p({date:j(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(T.trash.adminListTrash,{},{initialNumItems:50}),i=F(),a=x(T.trash.adminRestoreChat),o=x(T.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:S({days:i})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:r()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:E()}):(0,V.jsx)(L,{items:e,onRestore:e=>a({chatId:e}),onPurge:e=>o({chatId:e})}),(0,V.jsx)(I,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,BT as i,E as a,GT as o,HT as s,JT as c,KT as l,QT as u,UA as d,UT as f,VT as p,WT as m,XT as h,YT as g,ZT as _,aE as v,cX as y,eE as b,gX as x,hX as S,iE as C,qT as w,t as T,tE as E,zT as D}from"./api-uQUQB4xy.js";import{t as O}from"./use_paginated_query-Ce4kc6WY.js";import{t as k}from"./button-Biq40Zpc.js";import{An as A,At as j,F as M,Yt as N,ct as P,h as F}from"./index-Bw4ypNNp.js";import{n as I,t as L}from"./trashPage-BIm71gVQ.js";var R=a(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=x(T.blobSweep.listBlobSweeps,{}),t=x(T.blobQuarantine.quarantineSettings,{}),n=S(T.blobSweep.startBlobSweep),a=P(),{toast:v}=N(),[C,O]=(0,z.useState)(!1),F=y(),I=e=>M(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){v({title:D(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await a({title:f({count:H.orphans.count}),description:s({size:I(H.orphans.bytes)}),confirmLabel:m(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:E()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:C||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,r()]}),(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:C||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(A,{}),` `,m()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:b({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:d()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:u({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:_()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:h({date:j(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:g({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:c({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:w({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:l({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:o()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?i({date:j(L.lastApply.finishedAt??L.lastApply.startedAt)}):p({date:j(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(T.trash.adminListTrash,{},{initialNumItems:50}),r=F(),i=S(T.trash.adminRestoreChat),a=S(T.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:v({days:r})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:d()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:C()}):(0,V.jsx)(L,{items:e,onRestore:e=>i({chatId:e}),onPurge:e=>a({chatId:e})}),(0,V.jsx)(I,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$k as i,CI as a,MF as o,QF as s,SI as c,TI as l,ZF as u,_I as d,aA as f,aI as p,bI as ee,bb as m,cA as h,cI as te,dA as g,dI as ne,eA as _,eI as re,fI as ie,gI as ae,gX as v,hI as oe,hX as y,iA as b,iI as se,lA as x,lI as ce,mI as le,nA as S,nI as ue,oA as C,oI as de,pI as fe,rA as w,rI as pe,sA as T,sI as E,t as D,tA as O,tI as me,uA as k,uI as he,vI as ge,vb as A,wI as j,xI as _e,yI as ve,yb as M}from"./api-uQUQB4xy.js";import{t as N}from"./button-Biq40Zpc.js";import{Ct as P,Dt as F,J as I,Jt as L,Mt as R,Ot as ye,Pn as z,St as B,Tt as be,Yt as V,an as xe,bt as H,c as U,ct as Se,dr as Ce,en as we,fr as Te,ft as Ee,jn as W,l as De,lt as Oe,nn as ke,rn as Ae,tn as je,u as G,vt as K,wt as Me,xt as q,yt as J}from"./index-Bw4ypNNp.js";import{t as Ne}from"./FilterBar-CdYSlKIB.js";import{t as Pe}from"./DataTableShell-CeVf9eD_.js";import{t as Fe}from"./DetailChips-tXOC1zN0.js";var Y=t(e(),1),X=n();function Z({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=v(D.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=v(D.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,X.jsx)(P,{open:n,onOpenChange:r,children:(0,X.jsxs)(Me,{className:`oc-access`,children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(ye,{children:g({user:t})}),(0,X.jsx)(be,{children:k()})]}),i?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?x():h()}):null,(0,X.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:T()}):u.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:b()}):[...d.entries()].map(([t,n])=>(0,X.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:r,assigned:a,defaultKey:o}){let s=y(D.agents.assignAgent),c=y(D.agents.removeAgent),l=y(D.agents.setDefaultAgent),u=V();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(C(),I(e))}}async function p(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(f(),I(e))}}return(0,X.jsxs)(`div`,{className:`oc-access__group`,children:[(0,X.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,X.jsx)(z,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(L,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),s=o===n,c=e.state===`deleted`,l=!e.enabled;return(0,X.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,X.jsx)(R,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":w({name:e.displayName??e.agentId})}),(0,X.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,X.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:S()}):null,e.outOfPool?(0,X.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:O()}):null,r?s?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":_(),title:_(),children:(0,X.jsx)(W,{size:14,fill:`currentColor`})}):(0,X.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":i(),title:i(),disabled:l,onClick:()=>void p(e.agentId),children:(0,X.jsx)(W,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return A();case`user`:return M();case`admin`:return m();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(G[e])).length;return(0,X.jsxs)(we,{children:[(0,X.jsx)(xe,{asChild:!0,children:(0,X.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?l():j({count:r})})}),(0,X.jsxs)(je,{align:`start`,className:`w-52`,children:[(0,X.jsx)(Ae,{children:a()}),U.map(e=>{let r=G[e];return(0,X.jsxs)(ke,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,X.jsx)(R,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,X.jsx)(`span`,{children:De[e]()})]},e)})]})]})}function Re(){let e=Te({from:`/settings/users`}),t=Ce({from:`/settings/users`}),n=e.q??``,i=e.role??Q,a=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),f=v(D.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),m=v(D.me.getMe,{host:Ee}),h=y(D.admin.setRole),g=y(D.admin.setUserPermissions),_=y(D.admin.startImpersonation),b=y(D.admin.deleteUser),x=y(D.admin.setUserName),S=Se(),C=Oe(),w=V(),[T,O]=(0,Y.useState)(null),k=(0,Y.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of f??[])e.add(t.role);return[...e]},[f]),A=n!==``||i!==Q;function j(){t({search:{},replace:!0})}async function M(e){try{await h(e)}catch(e){w.error(c(),e)}}async function N(e){try{await g(e)}catch(e){w.error(_e(),e)}}async function P(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:le(),description:fe({user:t}),confirmWord:ie(),confirmLabel:ne(),destructive:!0}))try{await b({profileId:e._id}),w.success(ce({user:t}))}catch(e){w.error(he(),e)}}async function F(e){let t=e.email||e.name||e.userId.slice(0,8),n=await C({title:E(),label:de({user:t}),placeholder:p(),defaultValue:e.name??``,confirmLabel:o()});if(n!==null)try{await x({profileId:e._id,name:n}),w.success(se())}catch(e){w.error(pe(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ne,{q:n,onQChange:a,searchPlaceholder:ee(),onReset:j,canReset:A,children:(0,X.jsxs)(K,{value:i,onValueChange:l,children:[(0,X.jsx)(q,{size:`sm`,className:`w-36`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(J,{children:[(0,X.jsx)(H,{value:Q,children:ve()}),k.map(e=>(0,X.jsx)(H,{value:e,children:$(e)},e))]})]})}),(0,X.jsx)(Pe,{title:ge(),rows:f,emptyHint:d(),rowActions:e=>{let t=[{label:u(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:te(),onSelect:()=>void F(e)}];return e.userId!==m?.userId&&t.push({label:ae(),onSelect:()=>void _({profileId:e._id})},{label:oe(),variant:`destructive`,onSelect:()=>void P(e)}),t},columns:[{header:ue(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:t}),n?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:me(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,X.jsxs)(K,{value:e.role,onValueChange:t=>void M({profileId:e._id,role:t}),children:[(0,X.jsx)(q,{size:`sm`,className:`w-28`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(J,{children:[(0,X.jsx)(H,{value:`pending`,children:$(`pending`)}),(0,X.jsx)(H,{value:`user`,children:$(`user`)}),(0,X.jsx)(H,{value:`admin`,children:$(`admin`)})]})]})},{header:re(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:r()}):(0,X.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:s(),cell:e=>(0,X.jsx)(Fe,{icon:(0,X.jsx)(z,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,X.jsx)(Z,{profileId:T?.profileId??null,userLabel:T?.label??``,open:T!==null,onOpenChange:e=>{e||O(null)}})]})}export{Re as UsersTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Al as i,Bl as a,Cc as o,Cl as s,Dl as c,Ec as l,El as u,Fl as d,Gl as f,Hl as p,Il as m,Kl as h,Ll as g,Ml as _,Nc as v,Nl as y,Ol as b,Pl as x,Rl as S,Sc as C,Sl as ee,Tc as te,Tl as w,Tv as T,Ul as ne,Vl as E,Wl as re,_c as ie,cX as ae,dc as oe,e_ as se,fc as ce,gX as D,gc as le,hX as O,jl as ue,kL as k,kl as A,mc as j,n_ as de,oX as M,pX as fe,pc as pe,t as N,vc as me,wc as P,wl as F,yc as I,zl as L}from"./api-uQUQB4xy.js";import{t as R}from"./button-Biq40Zpc.js";import{Cn as z,Jt as B,Mt as V,Sn as H,St as U,Tn as he,Wn as ge,_n as _e,at as W,bn as ve,bt as G,dr as ye,fr as be,ft as xe,it as Se,ot as Ce,st as K,ur as we,vn as Te,vt as q,xn as J,xt as Y,yn as Ee,yt as X}from"./index-Bw4ypNNp.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>L()],[`fr-FR`,()=>l()],[`en-US`,()=>te()],[`en-GB`,()=>P()],[`de-DE`,()=>o()],[`es-ES`,()=>C()]],Oe=[[`0.75`,()=>g()],[`1`,()=>m()],[`1.25`,()=>d()],[`1.5`,()=>x()]],$=0;function ke({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=e.config??{},o={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(`idle`),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),h=fe(N.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{c({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),u(`idle`)},[e._id]);let g=s.enabled!==o.enabled||s.engine!==o.engine||s.lang!==o.lang||s.rate!==o.rate||s.autoRead!==o.autoRead;async function v(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=s.enabled,s.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,s.lang===`auto`?delete n.voiceLang:n.voiceLang=s.lang;let r=Number.parseFloat(s.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,s.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(B,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:s.enabled,onCheckedChange:e=>c({...s,enabled:e===!0}),"aria-label":E()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,Q.jsxs)(q,{value:s.engine,onValueChange:e=>c({...s,engine:e}),disabled:!s.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":j(),children:(0,Q.jsx)(U,{})}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(G,{value:`browser`,children:pe()}),e.kind===`hermes`?null:(0,Q.jsx)(G,{value:`gateway`,children:ce()})]})]})]}),s.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:oe()}):null,s.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,Q.jsxs)(q,{value:s.lang,onValueChange:e=>c({...s,lang:e}),disabled:!s.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(X,{children:De.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,Q.jsxs)(q,{value:s.rate,onValueChange:e=>c({...s,rate:e}),disabled:!s.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(X,{children:Oe.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),s.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:s.autoRead,onCheckedChange:e=>c({...s,autoRead:e===!0}),disabled:!s.enabled,"aria-label":y()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(R,{size:`sm`,disabled:!g||l===`saving`,onClick:()=>void v(),children:l===`saving`?T():de()}),(0,Q.jsx)(R,{variant:`outline`,size:`sm`,disabled:!s.enabled||d,onClick:()=>{let t=Number.parseFloat(s.rate)||1,n=++$;if(m(!1),H(),J(),s.engine!==`gateway`){ve(A(),{lang:Ee(s.lang,ae()),rate:t});return}f(!0),h({instanceName:e.name,text:A()}).then(({mime:e,audioBase64:r})=>{n===$&&Te(r,e,{rate:t})}).catch(()=>{n===$&&m(!0)}).finally(()=>f(!1))},children:d?T():ue()}),(0,Q.jsx)(R,{variant:`ghost`,size:`sm`,onClick:()=>{$++,f(!1),H(),J()},children:i()})]}),l===`error`||p?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p?r():se()}):null]})}function Ae({stt:e}){let t=D(N.me.getMe,{host:xe}),n=O(N.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:c()}),(0,Q.jsx)(B,{variant:e?`secondary`:`outline`,children:e?s():ee()}),(0,Q.jsx)(B,{variant:r?`secondary`:`destructive`,children:r?me():ie()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:I()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]})}function je(){let e=D(N.admin.listInstances,{}),t=(0,Z.useMemo)(()=>z(),[]),n=(0,Z.useMemo)(()=>_e(),[]),{section:r}=be({from:`/settings/voice`}),i=ye({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(B,{variant:t?`secondary`:`destructive`,children:t?f():re()}),(0,Q.jsx)(B,{variant:n?`secondary`:`destructive`,children:n?ne():p()})]}),(0,Q.jsxs)(Se,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(Ce,{className:`w-full`,children:[(0,Q.jsxs)(K,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(he,{size:13,"aria-hidden":!0}),le()]}),(0,Q.jsxs)(K,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ge,{size:13,"aria-hidden":!0}),c()]}),(0,Q.jsxs)(K,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(we,{size:13,"aria-hidden":!0}),w()]})]}),(0,Q.jsx)(W,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(W,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(W,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:w()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:F()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=O(N.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(B,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(V,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()})]})]})}export{je as VoiceTab};