@lacneu/atrium 0.68.1 → 0.68.3

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 (82) hide show
  1. package/dist/assets/AccessTab-CUqDXS9n.js +1 -0
  2. package/dist/assets/{AdvancedFilter-D3IHsSgI.js → AdvancedFilter-JyDhEm6J.js} +1 -1
  3. package/dist/assets/AgentFilesTab-CbJLk2rX.js +3 -0
  4. package/dist/assets/AnomaliesTab-D2xKiknD.js +1 -0
  5. package/dist/assets/AuditTab-DJXy03rI.js +1 -0
  6. package/dist/assets/BridgeTab-D6d3TIUS.js +1 -0
  7. package/dist/assets/{ChatDefaultsTab-B49bnKco.js → ChatDefaultsTab-DdmzwEcZ.js} +1 -1
  8. package/dist/assets/{DataTableShell-BYhMdaSl.js → DataTableShell-CZDcCKKK.js} +1 -1
  9. package/dist/assets/{DetailChips-BT8QU7Op.js → DetailChips-B8kGG5hF.js} +1 -1
  10. package/dist/assets/FeedbacksTab-BmcyryH6.js +1 -0
  11. package/dist/assets/{FieldLabel-2xG6-0gZ.js → FieldLabel-DE4FyAs1.js} +1 -1
  12. package/dist/assets/FilesTab-CDumq8Pb.js +1 -0
  13. package/dist/assets/{FilterBar-Bxpfu6Cp.js → FilterBar-D_9qHvFj.js} +1 -1
  14. package/dist/assets/GroupsTab-CKY58Zog.js +1 -0
  15. package/dist/assets/InstancesTab-DZ2JbufE.js +1 -0
  16. package/dist/assets/IntegrationsTab-B-riJ-pv.js +1 -0
  17. package/dist/assets/KpiTab-BdJGpYI1.js +1 -0
  18. package/dist/assets/PreferencesTab-B2P31o_Q.js +1 -0
  19. package/dist/assets/ProjectPage-C6MfkiS7.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-i74_ZmS4.js +4 -0
  21. package/dist/assets/RolesTab-CDV5aagt.js +1 -0
  22. package/dist/assets/ScheduledTab-CyNGhT_9.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-D0yNODzY.js +1 -0
  24. package/dist/assets/SubAgentReportsTab-DvQ_FYGT.js +1 -0
  25. package/dist/assets/ThemeShowroom-DuOJtPAn.js +1 -0
  26. package/dist/assets/{TimeRangePicker-DBPA3ISK.js → TimeRangePicker-B3zo0XgE.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-Cf0dO1lp.js → TimezoneCombobox-STliPks8.js} +1 -1
  28. package/dist/assets/TracesTab-C37HTOlN.js +1 -0
  29. package/dist/assets/UsersTab-DBqLDc8u.js +1 -0
  30. package/dist/assets/VoiceTab-DzR7fkF6.js +1 -0
  31. package/dist/assets/{api-EsnGI4EC.js → api-BGVfFctT.js} +5 -5
  32. package/dist/assets/{button-CZ9WPf0m.js → button-BfYgdYX0.js} +1 -1
  33. package/dist/assets/{card-CZABX7Qs.js → card-CwHlnnr8.js} +1 -1
  34. package/dist/assets/check-DG9jPa8f.js +1 -0
  35. package/dist/assets/chevron-up-B5kfyHME.js +1 -0
  36. package/dist/assets/chevrons-up-down-BhiEa2LE.js +1 -0
  37. package/dist/assets/{compatView-BNLmViDl.js → compatView-ClCkygm7.js} +1 -1
  38. package/dist/assets/{dispatchErrorInfo-GCb0ITYo.js → dispatchErrorInfo-BKjFe-Vw.js} +1 -1
  39. package/dist/assets/{dist-C7_P8Qst.js → dist-Byg7ezJ2.js} +1 -1
  40. package/dist/assets/{dist-CM-sT-ds.js → dist-CLAHvz0q.js} +1 -1
  41. package/dist/assets/{dist-BM94bqpE.js → dist-DhfIUl6t.js} +1 -1
  42. package/dist/assets/{highlighted-body-OFNGDK62-D8RSF8so.js → highlighted-body-OFNGDK62-DN2ud2_r.js} +1 -1
  43. package/dist/assets/{index-OKqVOmIC.css → index-CX1S7Sqd.css} +1 -1
  44. package/dist/assets/index-DvMLMrhJ.js +238 -0
  45. package/dist/assets/{list-DaUUbsAN.js → list-Bm7rk_iV.js} +1 -1
  46. package/dist/assets/mermaid-GHXKKRXX-Cx_V1Ao9.js +1 -0
  47. package/dist/assets/{pdf-D65rOI23.js → pdf-kH4oRUoH.js} +1 -1
  48. package/dist/assets/roleDescriptions-C1SAAg_v.js +1 -0
  49. package/dist/assets/{table-B--HXOj1.js → table-DIB4BxfQ.js} +1 -1
  50. package/dist/assets/{tabs-lFf0wQh0.js → tabs-BuvmZxjl.js} +1 -1
  51. package/dist/assets/x-MNkljOMn.js +1 -0
  52. package/dist/index.html +10 -10
  53. package/package.json +1 -1
  54. package/dist/assets/AccessTab-BFZrGfSt.js +0 -1
  55. package/dist/assets/AgentFilesTab-CHMpYoZN.js +0 -3
  56. package/dist/assets/AnomaliesTab-Bna7O7DK.js +0 -1
  57. package/dist/assets/AuditTab-BQO2KxIW.js +0 -1
  58. package/dist/assets/BridgeTab-DCHBE54n.js +0 -1
  59. package/dist/assets/FeedbacksTab-B3aYpOIP.js +0 -1
  60. package/dist/assets/FilesTab-_09UVEP4.js +0 -1
  61. package/dist/assets/GroupsTab-lX4rp_r8.js +0 -1
  62. package/dist/assets/InstancesTab-Bg4DV0Mg.js +0 -1
  63. package/dist/assets/IntegrationsTab-eVcH8e5g.js +0 -1
  64. package/dist/assets/KpiTab-BxeRQXix.js +0 -1
  65. package/dist/assets/PreferencesTab-DZSU4xP1.js +0 -1
  66. package/dist/assets/ProjectPage-vg8X5OT3.js +0 -1
  67. package/dist/assets/PromptInjectionsTab-88NlW26U.js +0 -4
  68. package/dist/assets/RolesTab-BZFTJhyf.js +0 -1
  69. package/dist/assets/ScheduledTab-DGRbUQ47.js +0 -1
  70. package/dist/assets/ServiceAccountsTab-pE8F7p-2.js +0 -1
  71. package/dist/assets/SubAgentReportsTab-BTQehyRQ.js +0 -1
  72. package/dist/assets/ThemeShowroom-HrqPxKuI.js +0 -1
  73. package/dist/assets/TracesTab-DpeDrf2G.js +0 -1
  74. package/dist/assets/UsersTab-txTMEiI9.js +0 -1
  75. package/dist/assets/VoiceTab-CnjBb1Ea.js +0 -1
  76. package/dist/assets/check-LaI7fqW2.js +0 -1
  77. package/dist/assets/chevron-up-DZeG4Ghe.js +0 -1
  78. package/dist/assets/chevrons-up-down-BQ8-VyUH.js +0 -1
  79. package/dist/assets/index-CsdodIca.js +0 -238
  80. package/dist/assets/mermaid-GHXKKRXX-CHdRR4I9.js +0 -1
  81. package/dist/assets/roleDescriptions-DEIReM8x.js +0 -1
  82. package/dist/assets/x-DOcdk27K.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AF as i,AP as a,BF as o,CP as s,D as c,DF as l,DP as u,EF as ee,EP as d,FL as f,FP as p,HL as m,IF as h,IP as g,JP as te,LF as ne,LP as re,MF as ie,MP as ae,NF as oe,NL as se,NP as ce,OF as le,OP as ue,PF as de,PP as fe,QP as pe,RF as me,RP as he,SF as ge,SP as _e,TP as ve,XP as _,YP as ye,ZP as v,_F as be,_I as xe,aF as Se,aI as Ce,bF as we,cF as Te,cI as Ee,dI as De,eF as Oe,fI as ke,gF as Ae,gI as je,hF as Me,hI as Ne,hP as Pe,iF as y,iI as Fe,jF as Ie,jP as Le,kF as Re,kP as ze,lF as Be,lI as Ve,mF as He,mI as Ue,nF as We,oF as b,oI as Ge,pI as Ke,rF as qe,rI as Je,sF as Ye,sI as Xe,t as x,tF as Ze,uI as Qe,vF as $e,wP as et,xF as tt,xP as nt,yF as rt,zF as it,zL as S}from"./api-BGVfFctT.js";import{t as at}from"./list-Bm7rk_iV.js";import{t as C}from"./button-BfYgdYX0.js";import{$ as ot,Bt as w,Dt as st,Mn as T,Rt as E,X as ct,Y as lt,_t as D,at as ut,bn as dt,bt as O,cn as ft,dt as pt,et as mt,ft as ht,gt,ht as _t,in as vt,it as yt,jn as k,jt as bt,mn as xt,mt as St,nt as Ct,ot as wt,pn as Tt,pt as Et,rt as Dt,tn as Ot,tt as kt,un as At,ut as A,vt as j,wt as jt,xt as M,yt as N,zt as P}from"./index-DvMLMrhJ.js";import{a as Mt,i as F,n as Nt,o as Pt,r as I,t as Ft}from"./table-DIB4BxfQ.js";import{t as It}from"./FilterBar-D_9qHvFj.js";/* empty css */import{a as L,c as Lt,i as Rt,l as zt,n as Bt,o as Vt,r as Ht,s as R,t as Ut}from"./TimezoneCombobox-STliPks8.js";var Wt=c(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Gt=c(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),z=t(e(),1),B=n();function V(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Kt({value:e,onChange:t}){let n=Lt(e),r=(0,z.useMemo)(()=>new Date,[]),[i,a]=(0,z.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,z.useState)(!1),c=(0,z.useMemo)(()=>V(f()),[]),l=(0,z.useMemo)(()=>new Intl.DateTimeFormat(f(),{month:`long`,year:`numeric`}),[]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(f(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=R(i.year,i.month),d=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(zt(e,n,r,i,a)),h=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,d,p)},g=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},te=n===null?Te():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,B.jsxs)(E,{modal:!0,open:o,onOpenChange:s,children:[(0,B.jsx)(w,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":Be(),children:[(0,B.jsx)(Wt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,B.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:te})]})}),(0,B.jsxs)(P,{align:`start`,className:`oc-dtp__pop`,children:[(0,B.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":Ye(),onClick:()=>g(-1),children:(0,B.jsx)(T,{size:15,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":b(),onClick:()=>g(1),children:(0,B.jsx)(k,{size:15,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.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:()=>h(e.year,e.month,e.day),children:e.day},t)})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,B.jsxs)(D,{value:String(d),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,B.jsx)(O,{size:`sm`,"aria-label":Se(),children:(0,B.jsx)(M,{})}),(0,B.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,B.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,B.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,B.jsxs)(D,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,B.jsx)(O,{size:`sm`,"aria-label":y(),children:(0,B.jsx)(M,{})}),(0,B.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,B.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function H(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function qt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Jt(e){let t=new Map;for(let n of e){let e=H(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function U(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(qt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function Yt(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt(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 Zt(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function Qt({events:e,mode:t,cursor:n,onModeChange:i,onCursorChange:a,onEventClick:o,footnote:s}){let c=f(),l=(0,z.useMemo)(()=>Jt(e),[e]),u=(0,z.useMemo)(()=>Yt(c),[c]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),p=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),m=new Date,h=e=>{if(t===`year`){a({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);a({year:r.getFullYear(),month:r.getMonth()})},g=t===`year`?String(n.year):ee.format(new Date(n.year,n.month,1));return(0,B.jsxs)(`div`,{className:`oc-cal`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":v(),onClick:()=>h(-1),children:(0,B.jsx)(T,{})}),(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":_(),onClick:()=>h(1),children:(0,B.jsx)(k,{})}),(0,B.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>a({year:m.getFullYear(),month:m.getMonth()}),children:pe()})]}),(0,B.jsx)(`span`,{className:`oc-cal__title`,children:g}),(0,B.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,B.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>i(`month`),children:Oe()}),(0,B.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>i(`year`),children:r()})]})]}),t===`month`?(0,B.jsx)($t,{cursor:n,byDay:l,weekdays:u,timeFmt:p,now:m,onEventClick:o}):(0,B.jsx)(en,{year:n.year,byDay:l,monthShortFmt:d,now:m,onOpenMonth:e=>{a({year:n.year,month:e}),i(`month`)}}),s?(0,B.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function $t({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=R(e.year,e.month);return(0,B.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(qt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,B.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,B.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,B.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,B.jsx)(`span`,{className:`oc-cal__more`,children:ye({count:o.length-W})}):null]},n)})]})}function en({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,B.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=U(t,e,o),c=R(e,o);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,B.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,B.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var G={h:36e5,min:6e4,s:1e3,ms:1};function tn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*G[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var J=new Map;function Y(e){let t=J.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 J.set(e,n),n}function nn(e,t){if(t!==null){let n=Y(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||Y(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=nn(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=nn(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 rn(e,t){return`${e}${t}`}function an(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=rn(a.instanceName,e.id);i.set(o,a);let s=Z(e.enabled===!1?null:tn(e.schedule),e.nextRunAtMs,t,n);for(let t of s)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:e.enabled===!1,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function on(e){return e?.data?.code??`unknown`}function sn({status:e}){switch(L(e)){case`ok`:return(0,B.jsx)(A,{variant:`secondary`,children:tt()});case`error`:return(0,B.jsx)(A,{variant:`destructive`,children:we()});case`running`:return(0,B.jsx)(A,{variant:`outline`,children:rt()});case`other`:return(0,B.jsx)(A,{variant:`outline`,children:e});case`none`:return(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function cn(){let e=S(x.scheduled.listMyCrons),t=S(x.scheduled.getCronDetail),n=S(x.scheduled.listCronRuns),r=S(x.scheduled.updateCron),c=S(x.scheduled.removeCron),pe=S(x.scheduled.runCronNow),_=st(),ye=m(x.me.getMe,{host:jt})?.timezone,[v,Se]=(0,z.useState)(null),[Te,Oe]=(0,z.useState)(!1),[y,Be]=(0,z.useState)(!1),[b,Ye]=(0,z.useState)(null),[w,T]=(0,z.useState)(null),[E,k]=(0,z.useState)(null),[P,L]=(0,z.useState)(null),[Lt,zt]=(0,z.useState)(!1),[R,V]=(0,z.useState)(Bt),[H,qt]=(0,z.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Jt=e=>{localStorage.setItem(`oc.sched.view`,e),qt(e)},[U,Yt]=(0,z.useState)(`month`),[W,$t]=(0,z.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),en=(0,z.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)Rt(r,R)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[v,R]),G=(0,z.useMemo)(()=>U===`year`?Zt(W.year):Xt(W.year,W.month),[U,W]),tn=(0,z.useMemo)(()=>an(en,G.startMs,G.endMs),[en,G]),K=e=>{let t=tn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||cn(t.instanceName,t.job)},q=(0,z.useCallback)(async()=>{Oe(!0),Be(!1);try{Se(await e({}))}catch{Be(!0)}finally{Oe(!1)}},[e]);(0,z.useEffect)(()=>{q()},[q]);let J=(0,z.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),Y=(0,z.useRef)(null);(0,z.useEffect)(()=>{v!==null&&Y.current!==null&&Y.current.scrollIntoView({block:`center`})},[v]);let nn=(0,z.useMemo)(()=>new Intl.DateTimeFormat(f(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{Ye(e);try{await t(),_.success(n),await q()}catch(e){_.toast({variant:`error`,title:de({code:on(e)})})}finally{Ye(null)}},Z=(0,z.useRef)(0),Q=(0,z.useRef)(0),rn=async(e,t)=>{if(t.id===null)return;let r=++Z.current;k({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;k({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;k(null),_.toast({variant:`error`,title:de({code:on(e)})})}},cn=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),_.toast({variant:`error`,title:de({code:on(e)})})}},ln=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){_.toast({variant:`error`,title:nt()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){_.toast({variant:`error`,title:_e()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;zt(!0);try{await r({instanceName:P.instanceName,jobId:P.jobId,patch:e}),_.success(p()),t===Q.current&&L(null),await q()}catch(e){_.toast({variant:`error`,title:de({code:on(e)})})}finally{zt(!1)}},un=v?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:xe()}),(0,B.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":qe(),children:[(0,B.jsx)(C,{variant:H===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":We(),title:We(),"aria-pressed":H===`list`,onClick:()=>Jt(`list`),children:(0,B.jsx)(at,{})}),(0,B.jsx)(C,{variant:H===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ze(),title:Ze(),"aria-pressed":H===`calendar`,onClick:()=>Jt(`calendar`),children:(0,B.jsx)(Wt,{})})]}),(0,B.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Te,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(ft,{size:14,"aria-hidden":!0}),je()]})]}),v!==null&&un>0?(0,B.jsxs)(It,{q:R.q,onQChange:e=>V(t=>({...t,q:e})),searchPlaceholder:be(),onReset:()=>V(Bt),canReset:Ht(R),children:[(0,B.jsxs)(D,{value:R.state,onValueChange:e=>V(t=>({...t,state:e})),children:[(0,B.jsx)(O,{size:`sm`,className:`w-40`,children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(N,{value:`all`,children:Ae()}),(0,B.jsx)(N,{value:`active`,children:Je()}),(0,B.jsx)(N,{value:`paused`,children:Fe()})]})]}),(0,B.jsxs)(D,{value:R.result,onValueChange:e=>V(t=>({...t,result:e})),children:[(0,B.jsx)(O,{size:`sm`,className:`w-40`,children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(N,{value:`all`,children:Me()}),(0,B.jsx)(N,{value:`ok`,children:tt()}),(0,B.jsx)(N,{value:`error`,children:we()}),(0,B.jsx)(N,{value:`running`,children:rt()}),(0,B.jsx)(N,{value:`none`,children:$e()})]})]})]}):null,v===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Te,children:y?Ne():se()}):H===`calendar`?(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):null,v.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):(0,B.jsx)(Qt,{events:tn.events,mode:U,cursor:W,onModeChange:Yt,onCursorChange:$t,onEventClick:K,footnote:te()})]}):(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):null,v.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):null,v.map(e=>{let t=e.jobs.filter(e=>Rt(e,R)),n=Ht(R)&&e.jobs.length>0&&t.length===0;return(0,B.jsxs)(`section`,{style:{marginBottom:20},children:[v.length>1||e.error||!e.supported?(0,B.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,B.jsx)(A,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ke({code:e.error})}):e.jobs.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):n?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(0,B.jsxs)(Ft,{children:[(0,B.jsx)(Mt,{children:(0,B.jsxs)(Pt,{children:[(0,B.jsx)(F,{children:Qe()}),(0,B.jsx)(F,{children:Ve()}),(0,B.jsx)(F,{children:Ee()}),(0,B.jsx)(F,{children:Xe()}),(0,B.jsx)(F,{children:Ge()}),(0,B.jsx)(F,{children:ge()}),(0,B.jsx)(F,{children:he()})]})}),(0,B.jsx)(Nt,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=b===i,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,B.jsxs)(Pt,{ref:t.id!==null&&t.id===J?Y:void 0,"data-state":t.id!==null&&t.id===J?`selected`:void 0,children:[(0,B.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Ce()}),(0,B.jsx)(I,{children:(0,B.jsx)(A,{variant:`secondary`,children:t.agentId})}),(0,B.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=lt(t.schedule),n=e===null?null:ct(e);return n===null?null:(0,B.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,B.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:nn.format(t.nextRunAtMs)}),(0,B.jsx)(I,{children:Vt(t.enabled)===`active`?(0,B.jsx)(A,{variant:`secondary`,children:Je()}):Vt(t.enabled)===`paused`?(0,B.jsx)(A,{variant:`outline`,children:Fe()}):(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,B.jsx)(I,{children:(0,B.jsx)(sn,{status:t.lastRunStatus})}),(0,B.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,B.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:it(),"aria-label":it(),disabled:b!==null,onClick:()=>void X(i,async()=>{let n=await pe({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},oe()),children:(0,B.jsx)(Ot,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:t.enabled?me():ne(),"aria-label":t.enabled?me():ne(),disabled:b!==null,onClick:()=>void X(i,()=>r({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?ie():Ie()),children:t.enabled?(0,B.jsx)(xt,{size:14,"aria-hidden":!0}):(0,B.jsx)(At,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:re(),"aria-label":re(),disabled:b!==null,onClick:()=>void cn(e.instanceName,t),children:(0,B.jsx)(Tt,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:g(),"aria-label":g(),disabled:b!==null,onClick:()=>void rn(e.instanceName,t),children:(0,B.jsx)(Gt,{size:14,"aria-hidden":!0})}):null,o?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:h(),"aria-label":h(),disabled:b!==null,onClick:()=>T({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,B.jsx)(vt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()})]},e.instanceName)}),un>0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Pe()}):null]}),(0,B.jsx)(ot,{open:w!==null,onOpenChange:e=>{e||T(null)},children:(0,B.jsxs)(Ct,{children:[(0,B.jsxs)(ut,{children:[(0,B.jsx)(wt,{children:Re()}),(0,B.jsx)(Dt,{children:le({name:w?.name??``})})]}),(0,B.jsxs)(yt,{children:[(0,B.jsx)(kt,{children:l()}),(0,B.jsx)(mt,{onClick:()=>{let e=w;T(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),i())},children:ee()})]})]})}),(0,B.jsx)(pt,{open:E!==null,onOpenChange:e=>{e||(Z.current++,k(null))},children:(0,B.jsxs)(ht,{style:{maxWidth:640},children:[(0,B.jsx)(_t,{children:(0,B.jsx)(gt,{children:fe({name:E?.name??``})})}),E?.entries===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):E!==null&&E.entries.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):E===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:E.entries.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,B.jsx)(sn,{status:e.status}),(0,B.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?nn.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,B.jsx)(pt,{open:P!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,B.jsxs)(ht,{className:`oc-cronedit`,children:[(0,B.jsxs)(_t,{children:[(0,B.jsx)(gt,{children:ae()}),(0,B.jsx)(Et,{children:Le()})]}),P===null?null:P.loading?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Qe()}),(0,B.jsx)(bt,{value:P.name,maxLength:200,onChange:e=>L({...P,name:e.target.value,nameDirty:!0})})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:a()}),(0,B.jsxs)(D,{value:P.scheduleKind,onValueChange:e=>L({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,B.jsx)(O,{children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(N,{value:`cron`,children:ze()}),(0,B.jsx)(N,{value:`every`,children:ue()}),(0,B.jsx)(N,{value:`at`,children:u()})]})]}),P.scheduleKind===`cron`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(bt,{value:P.cronExpr,onChange:e=>L({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,B.jsx)(Ut,{value:P.tz,onChange:e=>L({...P,tz:e,scheduleDirty:!0}),fallbackTz:ye??void 0})]}):P.scheduleKind===`every`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(bt,{type:`number`,min:1,value:P.everyValue,onChange:e=>L({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,B.jsxs)(D,{value:P.everyUnit,onValueChange:e=>L({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,B.jsx)(O,{style:{maxWidth:160},children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(N,{value:`minutes`,children:d()}),(0,B.jsx)(N,{value:`hours`,children:ve()}),(0,B.jsx)(N,{value:`days`,children:et()})]})]})]}):(0,B.jsx)(Kt,{value:P.at,onChange:e=>L({...P,at:e,scheduleDirty:!0})})]}),P.hasMessage?(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:o()}),(0,B.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>L({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,B.jsxs)(St,{children:[(0,B.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:l()}),(0,B.jsxs)(C,{onClick:()=>void ln(),disabled:P===null||P.loading||Lt,children:[Lt?(0,B.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,s()]})]})]})})]})}export{cn as ScheduledTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$j as i,Aj as ee,BA as a,Bj as te,Cj as ne,Dj as re,Ej as ie,Fj as ae,GA as o,Gj as oe,HA as s,HL as c,Hj as se,IA as l,Ij as ce,JA as le,Jj as ue,KA as u,Kj as de,LA as d,Lj as fe,Mj as pe,Nj as me,Oj as he,Pj as ge,QA as _e,Qj as ve,RA as f,Rj as ye,Sj as be,Tj as xe,UA as p,Uj as Se,VA as m,VL as h,Vj as Ce,WA as we,Wj as Te,XA as g,Xj as _,YA as v,Yj as Ee,ZA as y,Zj as b,_j as De,aj as x,bj as Oe,cj as ke,dj as Ae,eM as je,ej as S,fj as Me,gj as Ne,hj as Pe,ij as C,jj as Fe,kj as Ie,lj as Le,mj as Re,nM as ze,nj as w,oj as Be,pj as Ve,qA as T,qj as He,rj as E,sj as Ue,t as D,tM as We,tj as O,uj as Ge,vj as Ke,wj as qe,xj as Je,yj as Ye,zA as k,zL as Xe,zj as Ze}from"./api-BGVfFctT.js";import{t as A}from"./check-DG9jPa8f.js";import{r as Qe}from"./dist-DhfIUl6t.js";import{t as j}from"./button-BfYgdYX0.js";import{Dt as $e,Fn as et,On as tt,Pn as nt,Z as rt,_ as it,_t as M,bt as N,ct as P,dt as F,ft as I,gt as L,ht as R,jn as at,jt as z,mt as B,pt as V,st as H,ut as U,vt as W,xt as G,yt as K}from"./index-DvMLMrhJ.js";import{t as ot}from"./FilterBar-D_9qHvFj.js";import{t as st}from"./DataTableShell-CZDcCKKK.js";import{t as ct}from"./roleDescriptions-C1SAAg_v.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>s(),days:null},{value:`30`,label:()=>m(),days:30},{value:`90`,label:()=>a(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??Z,[a,o]=(0,q.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),le=c(D.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:r===Z?void 0:r===`disabled`}}),u=c(D.apiKeys.listKeys,{}),d=c(D.apiKeys.listRoles,{}),_e=h(D.apiKeys.createServiceAccount),f=h(D.apiKeys.updateServiceAccount),p=h(D.apiKeys.deleteServiceAccount),m=Xe(D.apiKeys.mintApiKey),we=h(D.apiKeys.revokeApiKey),g=rt(),v=$e(),y=n!==``||a!==Z||r!==Z;function x(){o(Z),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Q),[E,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[tt,P]=(0,q.useState)(null),F=(0,q.useRef)(!1),[I,L]=(0,q.useState)(new Set),[R,B]=(0,q.useState)({}),[V,H]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await f({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(Oe())):await _e({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),O(null),C(!1)}catch(e){v.error(E?Je():be(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function pt(e){if(F.current)return;F.current=!0;let t=R[e._id]??`never`,n=Y.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});H({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Ye(),e)}finally{F.current=!1,P(null)}}async function mt(e){if(await g({title:Ke(),description:(0,J.jsxs)(J.Fragment,{children:[De(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ne(),` `,(0,J.jsx)(`strong`,{children:Pe()}),` `,Re()]}),confirmWord:e.name,confirmLabel:Ve(),destructive:!0}))try{await p({serviceAccountId:e._id}),v.success(Me(),e.name)}catch(e){v.error(Ae(),e)}}async function ht(e){if(await g({title:Ge(),description:(0,J.jsxs)(J.Fragment,{children:[Le(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:Ue(),destructive:!0})&&!I.has(e._id)){L(t=>new Set(t).add(e._id));try{await we({keyId:e._id})}catch(e){v.error(Be(),e)}finally{L(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:ze()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:We(),onReset:x,canReset:y,children:[(0,J.jsxs)(M,{value:a,onValueChange:o,children:[(0,J.jsx)(N,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:je()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:Z,children:i()}),(d??[]).map(e=>(0,J.jsx)(K,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(M,{value:r,onValueChange:l,children:[(0,J.jsx)(N,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:Z,children:ve()}),(0,J.jsx)(K,{value:`active`,children:b()}),(0,J.jsx)(K,{value:`disabled`,children:_()})]})]})]}),(0,J.jsx)(st,{title:Ee(),rows:le,addLabel:ue(),onAdd:()=>{T(Q),O(null),C(!0)},emptyHint:He(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:I}),rowActions:e=>[{label:Se(),onSelect:()=>ft(e)},{label:de(),onSelect:()=>void pt(e)},{label:k.has(e._id)?oe():Te(),onSelect:()=>$(e._id)},{label:se(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Ce():te(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(at,{})})},{header:Ze(),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:ye(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey})},{header:fe(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:_()}):(0,J.jsx)(U,{variant:`outline`,children:b()})},{header:ce(),cell:e=>(0,J.jsxs)(M,{value:R[e._id]??`never`,onValueChange:t=>B(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(N,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(W,{children:Y.map(e=>(0,J.jsx)(K,{value:e.value,children:e.label()},e.value))})]})},{header:ae(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:tt===e._id?ge():me({count:t})})}}]}),(0,J.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:E?pe():Ie(),description:E?Fe():he(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?ee():re(),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:ie()}),(0,J.jsx)(z,{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:xe()}),(0,J.jsxs)(M,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(N,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:qe()})}),(0,J.jsx)(W,{children:(d??[]).map(e=>(0,J.jsxs)(K,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).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:ne()}),(0,J.jsx)(z,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:V,onClose:()=>H(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:i}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[x(),` `,(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:E()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:r()}),(0,J.jsx)(`th`,{children:_e()}),(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)(U,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:P(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:i.has(t._id),onClick:()=>n(t),children:i.has(t._id)?y():g()})})]},t._id))})]})]})}function ut({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)(F,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(I,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(R,{children:[(0,J.jsx)(L,{children:v()}),(0,J.jsx)(V,{children:le({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:T()}),(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)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":u(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(tt,{}),n?o():we()]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:p()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?k():P(e)}function pt(e){return e===null?`—`:H(e)}function mt(e){return e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:f()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(U,{variant:`outline`,children:d()}):(0,J.jsx)(U,{variant:`outline`,children:l()})}export{$ as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$o as r,As as i,Cs as a,Ds as o,Es as s,HL as c,Jo as l,Ms as u,Os as d,Qo as f,Ss as p,Ts as m,VL as h,Xo as g,Yo as _,Zo as v,_s as y,as as b,bs as x,cs as S,ds as C,es as w,fs as T,gs as E,hs as D,is as O,js as k,ks as A,ls as j,ms as M,ns as N,os as P,ps as F,rs as I,ss as L,t as R,ts as ee,us as z,vs as B,ws as V,xs as H,ys as U}from"./api-BGVfFctT.js";import{t as W}from"./button-BfYgdYX0.js";import{Z as G,ct as K}from"./index-DvMLMrhJ.js";import{t as q}from"./DataTableShell-CZDcCKKK.js";var J=t(e(),1),Y=n(),X={hung:()=>D(),wrong_result:()=>M(),error:()=>F(),other:()=>T()},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=h(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),` · `,C({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:z()}),(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:j()}),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`?S():L()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:P()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:b(),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?I():O()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[N({count:t.children.length}),t.childrenTruncated?` ${ee()}`:``,t.textTruncated?` ${w()}`:``]}),(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?` · ${r()}`:``]}),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:f()}),(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:v()}),(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=c(R.subAgentReports.listForAdmin,{}),t=h(R.subAgentReports.readReport),n=h(R.subAgentReports.deleteReport),r=G(),[f,v]=(0,J.useState)(null),[b,S]=(0,J.useState)({});async function C(e){if(f===e._id){v(null);return}if(!b[e._id]){let n=await t({reportId:e._id});S(t=>({...t,[e._id]:n}))}v(e._id)}async function w(e){await r({title:g(),description:_(),confirmLabel:l(),destructive:!0})&&(await n({reportId:e._id}),f===e._id&&v(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:A()}),` `,d()]}),(0,Y.jsx)(q,{title:u(),rows:e,emptyHint:k(),isExpanded:e=>f===e._id&&!!b[e._id],renderExpanded:e=>b[e._id]?(0,Y.jsx)($,{data:b[e._id]}):null,columns:[{header:o(),cell:e=>K(e.at),sort:e=>e.at},{header:s(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:m(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:V(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${H({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:a(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:p(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:x()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:U()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:f===e._id?y():B(),onSelect:()=>void C(e)},{label:E(),onSelect:()=>void w(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{$M as r,$N as i,AL as a,AN as o,BN as s,CN as c,D as l,DN as u,EN as d,FN as f,GM as p,GN as m,Go as h,HL as g,HN as _,IN as ee,JM as v,JN as te,KM as ne,KN as re,Ko as y,LN as ie,MN as ae,NN as oe,ON as b,PN as se,QM as ce,QN as le,RN as ue,SN as de,TN as fe,UM as pe,UN as me,VL as x,VN as he,WM as ge,WN as _e,Wo as ve,XM as ye,XN as be,YM as xe,YN as Se,ZM as S,ZN as Ce,_N as we,aN as Te,aP as Ee,bN as De,cN as Oe,cP as ke,dN as Ae,dP as je,eN as Me,eP as Ne,fN as Pe,gN as Fe,hN as Ie,iN as Le,iP as Re,jL as ze,jN as Be,kL as Ve,kN as He,lN as C,lP as Ue,mN as We,nN as Ge,nP as Ke,oN as qe,oP as Je,pN as Ye,qM as w,qN as Xe,qo as T,r as Ze,rN as Qe,rP as $e,sN as et,sP as tt,t as E,tN as nt,tP as D,uN as rt,uP as it,vN as at,wN as ot,xN as st,yN as ct,zL as lt,zN as ut}from"./api-BGVfFctT.js";import{t as O}from"./check-DG9jPa8f.js";import{t as k}from"./x-MNkljOMn.js";import{t as A}from"./button-BfYgdYX0.js";import{Ct as dt,Dn as ft,En as j,Ft as pt,It as M,Lt as mt,Mt as ht,Nt as gt,P as N,Pt as P,St as _t,_t as F,bt as I,jt as L,ut as R,vt as z,wt as B,xt as V,yt as H}from"./index-DvMLMrhJ.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-CwHlnnr8.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-DIB4BxfQ.js";import{t as Ot}from"./TimeRangePicker-B3zo0XgE.js";import{t as kt}from"./FilterBar-D_9qHvFj.js";import{t as At}from"./AdvancedFilter-JyDhEm6J.js";var K=l(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),q=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 J(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(Pe());if(e.size>Rt)throw Error(Ae());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(C());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(C());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Wt(f,`image/webp`,Vt)??await Wt(f,`image/png`);if(!h)throw Error(Oe());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return Y(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 Y(e)}async function Y(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(rt())),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 Wt(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Kt={kind:`relative`,from:`now-24h`,to:`now`},qt=[{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 Jt(e){return e===`light`?ze():e===`dark`?a():Ve()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ze(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{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)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=g(E.charts.listMyCharts),r=x(E.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ke()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:D(),subtitle:Ne(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?i():n.via===`owner`?le():Ce({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()}):null]})}function $t(){let e=x(E.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[p,m]=(0,q.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(b())}}}async function g(){if(s(null),l(!1),t.trim()===``){s(d());return}let a;try{a=JSON.parse(r)}catch{s(b());return}m(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(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:se()}),(0,X.jsx)(L,{value:t,onChange:e=>n(e.target.value),placeholder:oe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ae()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Be(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(K,{className:`size-4`}),o(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:p,onClick:()=>void g(),children:He()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:u()}):null]})]})}function en({chart:e}){let t=lt(E.charts.setChartLogo),n=x(E.charts.removeChartLogo),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ht(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ct():at()}),(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)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(K,{className:`size-4`}),t?Fe():we(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:We()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ie()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:De()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ye()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=g(E.me.getMe,{host:B}),n=x(E.charts.addChartDomain),r=x(E.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:et()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Qe()}):u.map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ge({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(L,{value:i,onChange:e=>a(e.target.value),placeholder:Te(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:Le()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:qe()}),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 nn({chart:e}){let t=x(E.charts.updateChart),n=x(E.charts.deleteChart),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(e.name),[c,l]=(0,q.useState)(()=>$(e.tokens)),[u,d]=(0,q.useState)(e.tokens.bpm??0),[f,p]=(0,q.useState)(null),[m,g]=(0,q.useState)(!1);function _(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),a(!0)}async function ee(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(b());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:_,children:de()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:st()})]})})]}),i?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,X.jsx)(L,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:y()}),(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:u,onChange:e=>d(Number(e.target.value)),"aria-label":y()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?h():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ve()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ce()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:m,onClick:()=>void ee(),children:nt()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:Me()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function rn(){let e=g(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=x(E.charts.addChartToGroupPool),r=x(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!o.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(R,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?_():e.kind===`custom`&&e.scope===`personal`?w():me()}),e.isGlobalDefault?(0,X.jsx)(R,{variant:`default`,children:he()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ut()}),(a??[]).map(e=>(0,X.jsxs)(R,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ie({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(F,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(I,{size:`sm`,className:`w-56`,children:(0,X.jsx)(V,{placeholder:ue()})}),(0,X.jsx)(z,{children:c.map(e=>(0,X.jsx)(H,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:s()}):null]})]})}function on({chart:e}){let t=x(E.charts.promoteChartToCommon),n=x(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(R,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ne():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:v({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:p()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ge()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(E.admin.setDefaultThemeMode),i=x(E.admin.setDefaultLocale),a=x(E.charts.setDefaultChart),o=g(E.charts.listChartsAdmin),s=g(E.groups.listGroups,{}),c=e??`system`,l=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(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:Se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:D()}),dt.map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:m()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{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:xe()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:it()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(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:Ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,X.jsx)(A,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:tt()})]})]})}function cn(){let e=g(E.me.getMe,{host:B}),t=_t(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Z),[c,l]=(0,q.useState)(Z),[u,d]=(0,q.useState)(Kt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Kt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:Je()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,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:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(j,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{children:`Default`}),(0,X.jsx)(R,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(R,{variant:`outline`,children:`Outline`}),(0,X.jsx)(R,{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)(L,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(F,{value:n,onValueChange:r,children:[(0,X.jsx)(I,{className:`w-56`,children:(0,X.jsx)(V,{placeholder:`Select…`})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(H,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(H,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(N,{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:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(F,{value:o,onValueChange:s,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(H,{value:Z,children:`Toutes directions`}),(0,X.jsx)(H,{value:`inbound`,children:`inbound`}),(0,X.jsx)(H,{value:`outbound`,children:`outbound`}),(0,X.jsx)(H,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(F,{value:c,onValueChange:l,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(V,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(H,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(H,{value:`info`,children:`info`}),(0,X.jsx)(H,{value:`warn`,children:`warn`}),(0,X.jsx)(H,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{fields:qt,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:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(j,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(pt,{children:`Actions`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{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)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{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)(N,{"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)(N,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(G,{className:`font-medium`,children:e.n}),(0,X.jsx)(G,{children:(0,X.jsx)(R,{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)(O,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(G,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(j,{})})})]},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{ln as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Fi as i,G_ as a,H_ as o,Ii as s,J_ as c,K_ as l,Li as u,Mi as d,Ni as f,Pi as p,Q_ as m,U_ as h,V_ as g,W_ as _,X_ as v,Y_ as y,Z_ as b,ji as x,q_ as S}from"./api-EsnGI4EC.js";import{t as C}from"./button-CZ9WPf0m.js";import{Ht as w,Ut as T,Vt as E,Wt as D,ct as O,jt as k,kn as A,sn as j}from"./index-CsdodIca.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:r(),from:`now-5m`},{label:m(),from:`now-15m`},{label:b(),from:`now-30m`},{label:v(),from:`now-1h`},{label:y(),from:`now-3h`},{label:c(),from:`now-6h`},{label:S(),from:`now-12h`},{label:l(),from:`now-24h`},{label:a(),from:`now-2d`},{label:_(),from:`now-7d`},{label:h(),from:`now-30d`},{label:o(),from:`now-90d`},{label:g(),from:`now-520w`}];function L(e){return O(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,r]=(0,M.useState)(!1),[a,o]=(0,M.useState)(``),c=F(e),[l,m]=(0,M.useState)(()=>z(c.from)),[h,g]=(0,M.useState)(()=>z(c.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),o(``)}r(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(l),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),S=B(l)!==null&&B(h)!==null;return(0,H.jsxs)(T,{open:n,onOpenChange:_,children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(A,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(E,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 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:u()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,H.jsx)(k,{type:`datetime-local`,value:l,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:y,children:p()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(j,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(k,{value:a,onChange:e=>o(e.target.value),placeholder:f(),"aria-label":d()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:x()}):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{$_ as r,Fi as i,G_ as a,Ii as o,J_ as s,K_ as c,Li as l,Mi as u,Ni as d,Pi as f,Q_ as p,W_ as m,X_ as h,Y_ as g,Z_ as _,ev as v,ji as y,nv as b,q_ as x,tv as S}from"./api-BGVfFctT.js";import{t as C}from"./button-BfYgdYX0.js";import{Ht as w,Ut as T,Vt as E,Wt as D,ct as O,jt as k,kn as A,sn as j}from"./index-DvMLMrhJ.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:b(),from:`now-5m`},{label:S(),from:`now-15m`},{label:v(),from:`now-30m`},{label:r(),from:`now-1h`},{label:p(),from:`now-3h`},{label:_(),from:`now-6h`},{label:h(),from:`now-12h`},{label:g(),from:`now-24h`},{label:s(),from:`now-2d`},{label:x(),from:`now-7d`},{label:c(),from:`now-30d`},{label:a(),from:`now-90d`},{label:m(),from:`now-520w`}];function L(e){return O(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,r]=(0,M.useState)(!1),[a,s]=(0,M.useState)(``),c=F(e),[p,m]=(0,M.useState)(()=>z(c.from)),[h,g]=(0,M.useState)(()=>z(c.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),s(``)}r(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function b(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let x=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),S=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(T,{open:n,onOpenChange:_,children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(A,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(E,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 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:l()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,H.jsx)(k,{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:i()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:b,children:f()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(j,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(k,{value:a,onChange:e=>s(e.target.value),placeholder:d(),"aria-label":u()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:y()}):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:()=>v(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{cF as r,lF as i,sF as a,uF as o}from"./api-EsnGI4EC.js";import{t as s}from"./check-LaI7fqW2.js";import{t as c}from"./chevrons-up-down-BQ8-VyUH.js";import{Bt as l,Rt as u,jt as d,zt as f}from"./index-CsdodIca.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`}var g={q:``,state:`all`,result:`all`};function _(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function v(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&h(e.enabled)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function y(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function x(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 S(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 C(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 w(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 T=n();function E({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>y(),[]),[g,_]=(0,p.useState)(!1),[v,S]=(0,p.useState)(``);if(h.length===0)return(0,T.jsx)(d,{value:e,onChange:e=>t(e.target.value),placeholder:m||b()||`America/Toronto`,className:n});let C=x(h,v,h.length,e||void 0),w=e===``?m||b()||a():e;return(0,T.jsxs)(u,{modal:!0,open:g,onOpenChange:e=>{_(e),e||S(``)},children:[(0,T.jsx)(l,{asChild:!0,children:(0,T.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":o(),children:[(0,T.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,T.jsx)(c,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,T.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,T.jsx)(d,{autoFocus:!0,value:v,onChange:e=>S(e.target.value),placeholder:i(),className:`oc-tzcombo__search`}),(0,T.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:C.length===0?(0,T.jsx)(`p`,{className:`oc-tzcombo__empty`,children:r()}):C.map(n=>(0,T.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),S(``)},children:[(0,T.jsx)(s,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,T.jsx)(`span`,{children:n})]},n))})]})]})}export{m as a,w as c,v as i,C as l,g as n,h as o,_ as r,S as s,E as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dF as r,fF as i,pF as a,uF as o}from"./api-BGVfFctT.js";import{t as s}from"./check-DG9jPa8f.js";import{t as c}from"./chevrons-up-down-BhiEa2LE.js";import{Bt as l,Rt as u,jt as d,zt as f}from"./index-DvMLMrhJ.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`}var g={q:``,state:`all`,result:`all`};function _(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function v(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&h(e.enabled)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function y(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function x(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 S(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 C(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 w(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 T=n();function E({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>y(),[]),[g,_]=(0,p.useState)(!1),[v,S]=(0,p.useState)(``);if(h.length===0)return(0,T.jsx)(d,{value:e,onChange:e=>t(e.target.value),placeholder:m||b()||`America/Toronto`,className:n});let C=x(h,v,h.length,e||void 0),w=e===``?m||b()||o():e;return(0,T.jsxs)(u,{modal:!0,open:g,onOpenChange:e=>{_(e),e||S(``)},children:[(0,T.jsx)(l,{asChild:!0,children:(0,T.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,T.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,T.jsx)(c,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,T.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,T.jsx)(d,{autoFocus:!0,value:v,onChange:e=>S(e.target.value),placeholder:i(),className:`oc-tzcombo__search`}),(0,T.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:C.length===0?(0,T.jsx)(`p`,{className:`oc-tzcombo__empty`,children:r()}):C.map(n=>(0,T.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),S(``)},children:[(0,T.jsx)(s,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,T.jsx)(`span`,{children:n})]},n))})]})]})}export{m as a,w as c,v as i,C as l,g as n,h as o,_ as r,S as s,E as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$b as i,Ab as a,BD as o,Bb as s,Cb as c,D as l,Db as u,Eb as d,FD as f,Fb as ee,GD as p,Gb as m,HD as h,HL as g,Hb as _,ID as v,Ib as te,Jb as ne,KD as re,Kb as ie,LD as y,Lb as ae,MD as b,Mb as oe,Mr as x,ND as S,Nb as se,Nr as C,Ob as ce,PD as le,Pb as ue,Pr as w,QD as T,Qb as de,RD as E,Rb as fe,Tb as D,UD as O,Ub as pe,VD as k,VL as A,Vb as me,WD as he,Wb as ge,Xb as _e,Yb as ve,ZD as ye,Zb as be,_O as xe,aO as j,ax as Se,bO as Ce,cO as M,dO as we,eO as Te,ex as Ee,fO as De,gO as Oe,hO as N,iO as P,ix as ke,jb as Ae,kb as je,lO as F,mO as Me,nO as Ne,nx as Pe,oO as Fe,ox as Ie,pO as Le,qb as Re,rO as ze,rx as Be,sO as Ve,sx as He,t as I,tO as Ue,tx as We,uO as Ge,vO as Ke,wb as qe,xO as Je,yO as Ye,zD as Xe,zb as Ze}from"./api-BGVfFctT.js";import{t as Qe}from"./check-DG9jPa8f.js";import{t as $e}from"./x-MNkljOMn.js";import{i as L,n as R,r as et,t as tt}from"./tabs-BuvmZxjl.js";import{t as z}from"./button-BfYgdYX0.js";import{Fn as nt,J as rt,On as it,Pn as at,Tn as ot,_t as B,a as st,bt as V,ct as H,dt as ct,ft as lt,gt as ut,ht as dt,i as ft,lt as pt,o as mt,pt as ht,s as gt,ut as U,vt as W,wt as _t,xn as vt,xt as G,yt as K}from"./index-DvMLMrhJ.js";import{n as yt}from"./TimeRangePicker-B3zo0XgE.js";import{t as bt}from"./FilterBar-D_9qHvFj.js";import{t as xt}from"./AdvancedFilter-JyDhEm6J.js";import{t as St}from"./DataTableShell-CZDcCKKK.js";var Ct=l(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),wt=l(`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 Tt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Ne():n===`agent`?`${Ue()} - ${r}`:e}function Et(){let e=g(I.me.getMe,{host:_t})?.role===`admin`,t=g(I.deliveryTiming.getDeliveryStatus,{}),n=A(I.deliveryTiming.startDeliveryRecord),r=A(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:Je()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()})]}),e?(0,J.jsx)(z,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?Ke():Ye()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(U,{variant:`secondary`,children:xe()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Oe({time:pt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Le():Me()})}),i?(0,J.jsx)(Dt,{isAdmin:e}):null]})}function Dt({isAdmin:e}){let t=g(I.deliveryTiming.listDeliverySessions,{}),n=A(I.deliveryTiming.deleteDeliverySessions),[i,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:ee}=yt(c),p=c.to===`now`?1/0:ee,m=i.trim()!==``||o!==`all`||c!==Y,h=()=>{a(``),s(`all`),l(Y)},_=(0,q.useMemo)(()=>{if(t===void 0)return;let e=i.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<=p).map(e=>({...e,_id:e.sessionId}))},[t,i,o,f,p]),v=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:i,onQChange:a,searchPlaceholder:we(),timeRange:c,onTimeRangeChange:l,onReset:h,canReset:m,children:(0,J.jsxs)(B,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:`all`,children:Ge()}),(0,J.jsx)(K,{value:`active`,children:F()}),(0,J.jsx)(K,{value:`stopped`,children:M()})]})]})}),(0,J.jsx)(St,{title:De(),rows:_,emptyHint:S(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?r():Te(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(Ct,{size:15,"aria-hidden":!0}):(0,J.jsx)(ot,{size:15,"aria-hidden":!0})})},{header:Ve(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:H(e.startedAt)})},{header:Fe(),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:H(e.stoppedAt)})},{header:j(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:P(),sort:e=>e.startedBy,cell:e=>Tt(e.startedBy)},{header:ze(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(U,{variant:`secondary`,children:F()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:M()})}],rowActions:e?e=>[{label:T(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:T(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Ot,{sessionId:e.sessionId})})]})}function Ot({sessionId:e}){let t=g(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(kt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function kt({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ye()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()});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,` `,b()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Qe,{size:13,"aria-hidden":!0}):(0,J.jsx)(it,{size:13,"aria-hidden":!0}),t?le():f()]})]}),(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:he()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:O()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:h()})]})}),(0,J.jsxs)(`tbody`,{children:[i(k(),r.bridge),i(o(),r.A),i(Xe(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:E()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]})}var At=[50,100,200,500],Z=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:w()},{value:`principalType`,label:C()},{value:`direction`,label:`direction`},{value:`roleKey`,label:x()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=nt({from:`/settings/traces`}),t=at({from:`/settings/traces`}),n=e.limit,r=e.kind,o=e.statusClass??Q,c=e.principalType??Q,l=e.direction??Q,f=e.roleKey??Q,h=e.q??``,v=ft(e.from,e.to),y=(0,q.useMemo)(()=>gt(e.adv),[e.adv]),{from:b,to:x}=yt(v),[S,C]=(0,q.useState)(null),[le,w]=(0,q.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),E=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),he=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),ye=e=>void t({search:t=>({...t,...mt(e)})}),xe=e=>void t({search:t=>({...t,adv:st(e)}),replace:!0}),j=g(I.observability.listEvents,{limit:n}),Ce=g(I.observability.listEvents,{limit:n,kind:r===Z?void 0:r,filter:{q:h||void 0,from:b,to:x,statusClass:o===Q?void 0:o,principalType:c===Q?void 0:c,direction:l===Q?void 0:l,roleKey:f===Q?void 0:f,advanced:y.length>0?y:void 0}}),M=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),we=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),Te=h!==``||o!==Q||c!==Q||l!==Q||f!==Q||y.length>0||v.kind!==`relative`||v.from!==Pt.from;function De(){t({search:{limit:100,kind:`all`},replace:!0})}let Oe=S?j?.filter(e=>e.correlationId===S):Ce,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(tt,{value:N,onValueChange:e=>P(e),children:[(0,J.jsxs)(et,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(vt,{size:13,"aria-hidden":!0}),re()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(wt,{size:13,"aria-hidden":!0}),p()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Et,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[He(),(0,J.jsx)(`strong`,{children:Ie()}),Se(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:ke()})]}),(0,J.jsxs)(bt,{q:h,onQChange:D,searchPlaceholder:Be(),timeRange:v,onTimeRangeChange:ye,onReset:De,canReset:Te,children:[(0,J.jsxs)(B,{value:o,onValueChange:O,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:Pe()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:Q,children:We()}),jt.map(e=>(0,J.jsx)(K,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:c,onValueChange:k,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:Ee()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:Q,children:i()}),Mt.map(e=>(0,J.jsx)(K,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:l,onValueChange:A,children:[(0,J.jsx)(V,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{placeholder:de()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:Q,children:be()}),Nt.map(e=>(0,J.jsx)(K,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:f,onValueChange:he,children:[(0,J.jsx)(V,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{placeholder:_e()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:Q,children:ve()}),we.map(e=>(0,J.jsx)(K,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:r,onValueChange:E,children:[(0,J.jsx)(V,{size:`sm`,className:`w-44`,children:(0,J.jsx)(G,{placeholder:ne()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(K,{value:Z,children:Re()}),M.map(e=>(0,J.jsx)(K,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,J.jsx)(V,{size:`sm`,className:`w-28`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(W,{children:At.map(e=>(0,J.jsx)(K,{value:String(e),children:ie({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Ft,seed:y,onChange:xe}),S?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:m(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ge(),(0,J.jsx)(`code`,{children:$(S)})]}),(0,J.jsx)($e,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:pe()})]})}):null,(0,J.jsx)(St,{title:_(),rows:Oe,emptyHint:S?me():s(),columns:[{header:Ze(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:H(e.at)})},{header:fe(),sort:e=>e.kind,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.kind})},{header:ae(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(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":te(),children:`✓`})}},{header:ee(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(U,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ue(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:se(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:oe(),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:Ae(),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 ${Lt(e.status)}`,children:e.status})},{header:a(),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:je(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ce(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:u(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:d()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(zt,{row:le,onClose:()=>w(null)})]})]})}function Lt(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 Rt(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 zt({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)(ct,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(lt,{className:`max-w-lg`,children:[(0,J.jsxs)(dt,{children:[(0,J.jsxs)(ut,{className:`oc-traces__meta-title`,children:[D(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(U,{variant:`outline`,children:qe()})]}),(0,J.jsx)(ht,{children:c()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BT as i,By as a,CT as o,DT as s,ET as c,FT as l,GT as u,Gy as d,HL as f,HT as p,Hy as m,IT as ee,JT as h,Jy as g,KT as te,Ky as _,LT as ne,Ly as v,MT as re,NT as ie,OT as ae,PT as oe,Qd as y,RT as se,Ry as b,ST as ce,TT as le,UT as ue,Uy as x,VL as S,VT as de,Vy as C,WT as fe,Wy as w,Xd as T,YT as E,Yy as D,Zd as O,jT as pe,kT as me,nT as he,qT as k,qy as A,t as j,wT as ge,xT as _e,zT as ve,zy as M}from"./api-BGVfFctT.js";import{t as N}from"./button-BfYgdYX0.js";import{Dt as P,Fn as F,Ft as I,Lt as L,Mt as R,Nt as ye,P as z,Pn as be,Pt as xe,Q as Se,Z as Ce,_t as B,an as V,bt as H,c as U,dt as we,ft as Te,gt as Ee,ht as De,l as Oe,on as W,pt as ke,u as G,ut as K,vt as q,wt as Ae,xt as J,yt as Y}from"./index-DvMLMrhJ.js";import{t as je}from"./FilterBar-D_9qHvFj.js";import{t as Me}from"./DataTableShell-CZDcCKKK.js";import{t as Ne}from"./DetailChips-B8kGG5hF.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=f(j.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=f(j.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}))],p=new Map;for(let e of u){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,Z.jsx)(we,{open:n,onOpenChange:r,children:(0,Z.jsxs)(Te,{className:`oc-access`,children:[(0,Z.jsxs)(De,{children:[(0,Z.jsx)(Ee,{children:D({user:t})}),(0,Z.jsx)(ke,{children:g()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?A():_()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:d()}):u.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):[...p.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:o}){let s=S(j.agents.assignAgent),c=S(j.agents.removeAgent),l=S(j.agents.setDefaultAgent),u=P();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(w(),e)}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(x(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(W,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),s=o===n,c=e.state===`deleted`,l=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,Z.jsx)(z,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":C({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:a()}):null,e.outOfPool?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:M()}):null,r?s?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":b(),title:b(),children:(0,Z.jsx)(V,{size:14,fill:`currentColor`})}):(0,Z.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":v(),title:v(),disabled:l,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(V,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return T();case`user`:return O();case`admin`:return y();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(G[e])).length;return(0,Z.jsxs)(R,{children:[(0,Z.jsx)(L,{asChild:!0,children:(0,Z.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?E():h({count:r})})}),(0,Z.jsxs)(ye,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(I,{children:k()}),U.map(e=>{let r=G[e];return(0,Z.jsxs)(xe,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(z,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Oe[e]()})]},e)})]})]})}function Le(){let e=F({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,a=e.role??Q,d=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),m=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),h=f(j.admin.listUsers,{filter:{q:n||void 0,role:a===Q?void 0:a},withAgents:!0}),g=f(j.me.getMe,{host:Ae}),_=S(j.admin.setRole),v=S(j.admin.setUserPermissions),y=S(j.admin.startImpersonation),b=S(j.admin.deleteUser),x=S(j.admin.setUserName),C=Ce(),w=Se(),T=P(),[E,D]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of h??[])e.add(t.role);return[...e]},[h]),k=n!==``||a!==Q;function A(){t({search:{},replace:!0})}async function M(e){try{await _(e)}catch(e){T.error(te(),e)}}async function N(e){try{await v(e)}catch(e){T.error(u(),e)}}async function I(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:se(),description:ne({user:t}),confirmWord:ee(),confirmLabel:l(),destructive:!0}))try{await b({profileId:e._id}),T.success(ie({user:t}))}catch(e){T.error(oe(),e)}}async function L(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:pe(),label:r({user:t}),placeholder:me(),defaultValue:e.name??``,confirmLabel:he()});if(n!==null)try{await x({profileId:e._id,name:n}),T.success(ae())}catch(e){T.error(s(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:d,searchPlaceholder:fe(),onReset:A,canReset:k,children:(0,Z.jsxs)(B,{value:a,onValueChange:m,children:[(0,Z.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(J,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(Y,{value:Q,children:ue()}),O.map(e=>(0,Z.jsx)(Y,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:p(),rows:h,emptyHint:de(),rowActions:e=>{let t=[{label:_e(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:re(),onSelect:()=>void L(e)}];return e.userId!==g?.userId&&t.push({label:i(),onSelect:()=>void y({profileId:e._id})},{label:ve(),variant:`destructive`,onSelect:()=>void I(e)}),t},columns:[{header:c(),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,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:le(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(B,{value:e.role,onValueChange:t=>void M({profileId:e._id,role:t}),children:[(0,Z.jsx)(H,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(J,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(Y,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(Y,{value:`user`,children:$(`user`)}),(0,Z.jsx)(Y,{value:`admin`,children:$(`admin`)})]})]})},{header:ge(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:o()}):(0,Z.jsx)(Ie,{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:ce(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(W,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||D(null)}})]})}export{Le as UsersTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$n as i,An as a,At as o,Bn as s,Ct as c,Dt as l,FL as ee,Fn as u,Ft as d,Gn as f,HL as p,Hl as m,Hn as h,In as g,It as _,Jn as v,Kn as y,Ln as te,Lt as b,Mn as x,NL as S,Nn as ne,Nt as re,Ot as ie,Pn as C,Pt as ae,Qn as w,Rn as T,St as E,Tt as D,Un as O,VL as k,Vn as oe,Wl as se,Wn as ce,Wt as le,Xn as ue,Yn as de,Zn as fe,jn as pe,kn as A,kt as j,qn as M,t as N,ud as P,ut as F,wt as I,zL as L,zn as R}from"./api-BGVfFctT.js";import{i as z,n as B,r as me,t as he}from"./tabs-BuvmZxjl.js";import{t as V}from"./button-BfYgdYX0.js";import{$t as H,Fn as ge,Jt as _e,Nn as ve,P as U,Pn as ye,Qt as W,Xt as be,Yt as xe,Zt as Se,_t as G,bt as K,en as Ce,gn as we,nn as Te,ut as q,vt as J,wt as Ee,xt as Y,yt as X}from"./index-DvMLMrhJ.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>y()],[`fr-FR`,()=>b()],[`en-US`,()=>_()],[`en-GB`,()=>d()],[`de-DE`,()=>ae()],[`es-ES`,()=>re()]],Oe=[[`0.75`,()=>ce()],[`1`,()=>O()],[`1.25`,()=>h()],[`1.5`,()=>oe()]],$=0;function ke({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=e.config??{},r={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},[i,a]=(0,Z.useState)(r),[o,l]=(0,Z.useState)(`idle`),[u,d]=(0,Z.useState)(!1),[p,h]=(0,Z.useState)(!1),_=L(N.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{a({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),l(`idle`)},[e._id]);let y=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function b(){l(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),l(`idle`)}catch{l(`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)(q,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(U,{checked:i.enabled,onCheckedChange:e=>a({...i,enabled:e===!0}),"aria-label":v()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:v()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,Q.jsxs)(G,{value:i.engine,onValueChange:e=>a({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(K,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(X,{value:`browser`,children:I()}),e.kind===`hermes`?null:(0,Q.jsx)(X,{value:`gateway`,children:c()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()}):null,i.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,Q.jsxs)(G,{value:i.lang,onValueChange:e=>a({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(K,{size:`sm`,"aria-label":M(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(J,{children:De.map(([e,t])=>(0,Q.jsx)(X,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,Q.jsxs)(G,{value:i.rate,onValueChange:e=>a({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(K,{size:`sm`,"aria-label":f(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(J,{children:Oe.map(([e,t])=>(0,Q.jsx)(X,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(U,{checked:i.autoRead,onCheckedChange:e=>a({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":s()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:R()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!y||o===`saving`,onClick:()=>void b(),children:o===`saving`?P():se()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!i.enabled||u,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(h(!1),H(),W(),i.engine!==`gateway`){Se(g(),{lang:be(i.lang,ee()),rate:t});return}d(!0),_({instanceName:e.name,text:g()}).then(({mime:e,audioBase64:r})=>{n===$&&xe(r,e,{rate:t})}).catch(()=>{n===$&&h(!0)}).finally(()=>d(!1))},children:u?P():T()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,d(!1),H(),W()},children:te()})]}),o===`error`||p?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p?F():m()}):null]})}function Ae({stt:e}){let t=p(N.me.getMe,{host:Ee}),n=k(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)(q,{variant:e?`secondary`:`outline`,children:e?a():A()}),(0,Q.jsx)(q,{variant:r?`secondary`:`destructive`,children:r?j():ie()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(U,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":o()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()})]})}function je(){let e=p(N.admin.listInstances,{}),t=(0,Z.useMemo)(()=>Ce(),[]),n=(0,Z.useMemo)(()=>_e(),[]),{section:r}=ge({from:`/settings/voice`}),a=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:i()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(q,{variant:t?`secondary`:`destructive`,children:t?w():fe()}),(0,Q.jsx)(q,{variant:n?`secondary`:`destructive`,children:n?ue():de()})]}),(0,Q.jsxs)(he,{value:r,onValueChange:e=>void a({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(me,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),l()]}),(0,Q.jsxs)(z,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(we,{size:13,"aria-hidden":!0}),C()]}),(0,Q.jsxs)(z,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ve,{size:13,"aria-hidden":!0}),x()]})]}),(0,Q.jsx)(B,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(B,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(B,{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:x()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:pe()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=k(N.admin.upsertInstanceConfig),n=e.config??{},i=n.talkEnabled===!0,a=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)(q,{variant:`secondary`,children:a?`Hermes`:`OpenClaw`})]}),a?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:le()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(U,{checked:i,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":r()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()})]})]})}export{je as VoiceTab};