@lacneu/atrium 0.86.0 → 0.87.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/assets/{AccessTab-CNyZuN98.js → AccessTab-BjWb2utN.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-Jws5hGtR.js → AdvancedFilter-ksMf6bcD.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DAHA88Tu.js +3 -0
  4. package/dist/assets/AnomaliesTab-CVua97lJ.js +1 -0
  5. package/dist/assets/AuditTab-hTs6iFsI.js +1 -0
  6. package/dist/assets/BridgeTab-DPbj0zcY.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-CdYRaOgV.js +1 -0
  8. package/dist/assets/{DataTableShell-BJyQ95_m.js → DataTableShell-K5cImuMP.js} +1 -1
  9. package/dist/assets/{DetailChips-DMQm7BNy.js → DetailChips-Xge7xE-L.js} +1 -1
  10. package/dist/assets/FeedbacksTab-CvTz752R.js +1 -0
  11. package/dist/assets/{FieldLabel-CwkWnu-s.js → FieldLabel-DVWzsIR3.js} +1 -1
  12. package/dist/assets/FilesTab-BOw97zky.js +1 -0
  13. package/dist/assets/{FilterBar-Htv-6aQ4.js → FilterBar-DLMcpn_E.js} +1 -1
  14. package/dist/assets/GroupsTab-D5ycprxr.js +1 -0
  15. package/dist/assets/InstancesTab-TaKSA8bY.js +1 -0
  16. package/dist/assets/IntegrationsTab-D59mPoaZ.js +1 -0
  17. package/dist/assets/{KpiTab-BwiWke7W.js → KpiTab-1Hx_0Uao.js} +1 -1
  18. package/dist/assets/PreferencesTab-3cXC4S1l.js +1 -0
  19. package/dist/assets/ProjectPage-nBPDSUUX.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-BHhqTYDk.js +4 -0
  21. package/dist/assets/RolesTab-DWR9sNW0.js +1 -0
  22. package/dist/assets/ScheduledTab-R_UJhAFC.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-CJoq437S.js +1 -0
  24. package/dist/assets/SubAgentReportsTab-DCrEW3GB.js +1 -0
  25. package/dist/assets/ThemeShowroom-BePky4K4.js +1 -0
  26. package/dist/assets/{TimeRangePicker-CuQoUHQ2.js → TimeRangePicker-BIobKXvm.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-H0UOn98o.js → TimezoneCombobox-C_pawxor.js} +1 -1
  28. package/dist/assets/TracesTab-l-lueZac.js +1 -0
  29. package/dist/assets/UsersTab-CNvCzpBh.js +1 -0
  30. package/dist/assets/VoiceTab-LihfD0So.js +1 -0
  31. package/dist/assets/api-CnXjOprV.js +44 -0
  32. package/dist/assets/{button-B2QgVBao.js → button-C7mIcWuE.js} +1 -1
  33. package/dist/assets/{card-3tpBLt6P.js → card-D96d_4Et.js} +1 -1
  34. package/dist/assets/chevrons-up-down-CPB13Hhb.js +1 -0
  35. package/dist/assets/{compatView-BsnzFNWK.js → compatView-D2UZENK3.js} +1 -1
  36. package/dist/assets/dispatchErrorInfo-Ct8igIIE.js +1 -0
  37. package/dist/assets/{dist-P3oxB2_Y.js → dist-CLt4MJ3r.js} +1 -1
  38. package/dist/assets/{dist-_bqAwzsc.js → dist-CNXx0sNo.js} +1 -1
  39. package/dist/assets/{dist-DHSnEr51.js → dist-CU23SxxP.js} +1 -1
  40. package/dist/assets/{highlighted-body-OFNGDK62-Cwf9Gjsn.js → highlighted-body-OFNGDK62-CO9Mn_bf.js} +1 -1
  41. package/dist/assets/index-0t8eOneo.js +327 -0
  42. package/dist/assets/index-CURSwr6F.css +1 -0
  43. package/dist/assets/{list-W5dEXtWX.js → list-PsjK33SL.js} +1 -1
  44. package/dist/assets/mermaid-GHXKKRXX-BxbNoi0T.js +1 -0
  45. package/dist/assets/{pdf-BsxzGiTI.js → pdf-jxqL4Jk_.js} +1 -1
  46. package/dist/assets/roleDescriptions-Bm8ptI3N.js +1 -0
  47. package/dist/assets/{table-B4WDub2k.js → table-CXJLU3m_.js} +1 -1
  48. package/dist/assets/x-Cd7Svlfj.js +1 -0
  49. package/dist/index.html +8 -8
  50. package/package.json +1 -1
  51. package/dist/assets/AgentFilesTab-D4TVniuJ.js +0 -3
  52. package/dist/assets/AnomaliesTab-DkyyACiP.js +0 -1
  53. package/dist/assets/AuditTab-1qImoMkJ.js +0 -1
  54. package/dist/assets/BridgeTab-DasmAm9q.js +0 -1
  55. package/dist/assets/ChatDefaultsTab-BsULxYYG.js +0 -1
  56. package/dist/assets/FeedbacksTab-C6lrOAkH.js +0 -1
  57. package/dist/assets/FilesTab-DWvcXJdn.js +0 -1
  58. package/dist/assets/GroupsTab-BBra-JjX.js +0 -1
  59. package/dist/assets/InstancesTab-CH_3qOZQ.js +0 -1
  60. package/dist/assets/IntegrationsTab-DqJ8p5ld.js +0 -1
  61. package/dist/assets/PreferencesTab-C1ltGMAW.js +0 -1
  62. package/dist/assets/ProjectPage-CfvLMLWB.js +0 -1
  63. package/dist/assets/PromptInjectionsTab-DzQ3o2Pc.js +0 -4
  64. package/dist/assets/RolesTab-BKOp-LTM.js +0 -1
  65. package/dist/assets/ScheduledTab-DlvtcBMr.js +0 -1
  66. package/dist/assets/ServiceAccountsTab-CadpDOvS.js +0 -1
  67. package/dist/assets/SubAgentReportsTab-CzpvE4x8.js +0 -1
  68. package/dist/assets/ThemeShowroom-u9zJkOwJ.js +0 -1
  69. package/dist/assets/TracesTab-ld67XHEY.js +0 -1
  70. package/dist/assets/UsersTab-CW9qWzpa.js +0 -1
  71. package/dist/assets/VoiceTab-FR188fYF.js +0 -1
  72. package/dist/assets/api-DMU7ZOYa.js +0 -44
  73. package/dist/assets/chevrons-up-down-CuhmzRKZ.js +0 -1
  74. package/dist/assets/dispatchErrorInfo-CIIXwmrf.js +0 -1
  75. package/dist/assets/index-BQY_zyzx.js +0 -327
  76. package/dist/assets/index-DqyJgH3B.css +0 -1
  77. package/dist/assets/mermaid-GHXKKRXX-Bd_jVWAu.js +0 -1
  78. package/dist/assets/roleDescriptions-BS-RKIZx.js +0 -1
  79. package/dist/assets/x-BXAOE-6-.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$H as r,$U as i,$V as a,BH as o,CG as s,CU as c,D as l,DU as u,EU as ee,FH as d,GH as te,HH as f,IH as p,JU as m,KH as h,KU as ne,LH as re,MG as ie,MH as ae,NH as oe,PH as se,QH as ce,QU as le,RH as g,SH as ue,SU as de,TG as _,TU as fe,UH as pe,VH as me,WH as v,XU as he,YU as ge,ZU as _e,_H as ve,_U as ye,aH as be,aU as xe,aW as Se,bH as Ce,bU as y,cH as we,dH as Te,eU as Ee,eW as De,fH as Oe,fU as ke,gH as Ae,gU as je,hH as Me,hU as Ne,iU as Pe,iW as Fe,kG as b,lH as Ie,lU as Le,mH as Re,mU as ze,nU as Be,nW as Ve,oH as He,oU as Ue,oW as We,pH as Ge,pU as Ke,qH as qe,qU as Je,rU as Ye,rW as Xe,sH as Ze,sU as Qe,sW as $e,t as x,tU as et,tW as tt,uH as nt,vH as rt,vU as it,wU as at,xH as ot,yH as st,yU as ct,zH as lt}from"./api-CnXjOprV.js";import{t as ut}from"./list-PsjK33SL.js";import{t as S}from"./button-C7mIcWuE.js";import{At as C,Ct as dt,Dt as ft,Et as pt,Ft as mt,Hn as w,Ht as ht,On as gt,Ot as _t,Sn as vt,St as yt,Tt as bt,Ut as T,Vn as E,Wt as D,Z as xt,at as St,bt as Ct,ct as wt,dn as Tt,et as O,gn as Et,it as k,jt as Dt,kt as Ot,lt as kt,nt as A,on as At,ot as jt,rt as j,st as Mt,tt as M,ut as Nt,vn as Pt,wt as Ft,xn as It,xt as Lt}from"./index-0t8eOneo.js";import{a as Rt,i as N,n as zt,o as Bt,r as P,t as Vt}from"./table-CXJLU3m_.js";import{t as Ht}from"./FilterBar-DLMcpn_E.js";/* empty css */import{a as Ut,c as F,i as I,l as Wt,n as Gt,o as Kt,r as qt,s as Jt,t as Yt,u as L}from"./TimezoneCombobox-C_pawxor.js";var Xt=l(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Zt=l(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),R=t(e(),1),z=n();function B(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 Qt({value:e,onChange:t}){let n=Wt(e),r=(0,R.useMemo)(()=>new Date,[]),[i,a]=(0,R.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,R.useState)(!1),c=(0,R.useMemo)(()=>B(_()),[]),l=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{month:`long`,year:`numeric`}),[]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=F(i.year,i.month),d=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(L(e,n,r,i,a)),ne=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,d,p)},re=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},ie=n===null?h():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,z.jsxs)(ht,{modal:!0,open:o,onOpenChange:s,children:[(0,z.jsx)(D,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":qe(),children:[(0,z.jsx)(Xt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,z.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ie})]})}),(0,z.jsxs)(T,{align:`start`,className:`oc-dtp__pop`,children:[(0,z.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":te(),onClick:()=>re(-1),children:(0,z.jsx)(w,{size:15,"aria-hidden":!0})}),(0,z.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":v(),onClick:()=>re(1),children:(0,z.jsx)(E,{size:15,"aria-hidden":!0})})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,z.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,z.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:()=>ne(e.year,e.month,e.day),children:e.day},t)})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,z.jsxs)(O,{value:String(d),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,z.jsx)(j,{size:`sm`,"aria-label":pe(),children:(0,z.jsx)(k,{})}),(0,z.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,z.jsx)(A,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,z.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,z.jsxs)(O,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,z.jsx)(j,{size:`sm`,"aria-label":f(),children:(0,z.jsx)(k,{})}),(0,z.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,z.jsx)(A,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function V(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=V(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 H(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($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function tn(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 nn(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 rn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var U=3;function an({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=_(),c=(0,R.useMemo)(()=>en(e),[e]),l=(0,R.useMemo)(()=>tn(s),[s]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),te=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,m=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},h=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,z.jsxs)(`div`,{className:`oc-cal`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":d(),onClick:()=>m(-1),children:(0,z.jsx)(w,{})}),(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":se(),onClick:()=>m(1),children:(0,z.jsx)(E,{})}),(0,z.jsx)(S,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:p()})]}),(0,z.jsx)(`span`,{className:`oc-cal__title`,children:h}),(0,z.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,z.jsx)(S,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:g()}),(0,z.jsx)(S,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:re()})]})]}),t===`month`?(0,z.jsx)(on,{cursor:n,byDay:c,weekdays:l,timeFmt:te,now:f,onEventClick:a}):(0,z.jsx)(sn,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,z.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function on({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=F(e.year,e.month);return(0,z.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,z.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,z.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,U).map(e=>(0,z.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,z.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,z.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>U?(0,z.jsx)(`span`,{className:`oc-cal__more`,children:oe({count:o.length-U})}):null]},n)})]})}function sn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,z.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=H(t,e,o),c=F(e,o);return(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,z.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,z.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,z.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var W={h:36e5,min:6e4,s:1e3,ms:1};function cn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*W[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var q=new Map;function J(e){let t=q.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 q.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=Kt(e)!==`active`,c=Z(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Jt(e)){case`ok`:return(0,z.jsx)(C,{variant:`secondary`,children:Ue()});case`error`:return(0,z.jsx)(C,{variant:`destructive`,children:Pe()});case`running`:return(0,z.jsx)(C,{variant:`outline`,children:Ye()});case`other`:return(0,z.jsx)(C,{variant:`outline`,children:e});case`none`:return(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=b(x.scheduled.listMyCrons),t=b(x.scheduled.getCronDetail),n=b(x.scheduled.listCronRuns),l=b(x.scheduled.updateCron),d=b(x.scheduled.removeCron),te=b(x.scheduled.runCronNow),f=Dt(),p=ie(x.me.getMe,{host:xt})?.timezone,[h,re]=(0,R.useState)(null),[oe,se]=(0,R.useState)(!1),[g,pe]=(0,R.useState)(!1),[v,qe]=(0,R.useState)(null),[w,ht]=(0,R.useState)(null),[T,E]=(0,R.useState)(null),[D,F]=(0,R.useState)(null),[Wt,Jt]=(0,R.useState)(!1),[L,B]=(0,R.useState)(Gt),[V,$t]=(0,R.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),en=e=>{localStorage.setItem(`oc.sched.view`,e),$t(e)},[H,tn]=(0,R.useState)(`month`),[U,on]=(0,R.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),sn=(0,R.useMemo)(()=>{let e=[];for(let t of h??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ut(r,L)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[h,L]),W=(0,R.useMemo)(()=>H===`year`?rn(U.year):nn(U.year,U.month),[H,U]),cn=(0,R.useMemo)(()=>un(sn,W.startMs,W.endMs),[sn,W]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,R.useCallback)(async()=>{se(!0),pe(!1);try{re(await e({}))}catch{pe(!0)}finally{se(!1)}},[e]);(0,R.useEffect)(()=>{K()},[K]);let q=(0,R.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,R.useRef)(null);(0,R.useEffect)(()=>{h!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[h]);let Y=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{qe(e);try{await t(),f.success(n),await K()}catch(e){f.toast({variant:`error`,title:y({code:dn(e)})})}finally{qe(null)}},Z=(0,R.useRef)(0),Q=(0,R.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;E({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;E({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;E(null),f.toast({variant:`error`,title:y({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;F({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;F(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;F(null),f.toast({variant:`error`,title:y({code:dn(e)})})}},mn=async()=>{if(D===null)return;let e={};if(D.nameDirty&&D.name.trim()===``||D.messageDirty&&D.hasMessage&&D.message.trim()===``){f.toast({variant:`error`,title:be()});return}if(D.nameDirty&&D.name.trim()!==``&&(e.name=D.name.trim()),D.scheduleDirty){if(D.scheduleKind===`cron`&&D.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:D.cronExpr.trim(),...D.tz.trim()===``?{}:{tz:D.tz.trim()}};else if(D.scheduleKind===`every`){let t=Number(D.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[D.everyUnit])})}else if(D.scheduleKind===`at`&&D.at!==``){let t=Date.parse(D.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(D.scheduleDirty&&e.schedule===void 0){f.toast({variant:`error`,title:He()});return}if(D.messageDirty&&D.hasMessage&&D.message.trim()!==``&&(e.message=D.message.trim()),Object.keys(e).length===0){F(null);return}let t=Q.current;Jt(!0);try{await l({instanceName:D.instanceName,jobId:D.jobId,patch:e}),f.success(st()),t===Q.current&&F(null),await K()}catch(e){f.toast({variant:`error`,title:y({code:dn(e)})})}finally{Jt(!1)}},hn=h?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:$e()}),(0,z.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":me(),children:[(0,z.jsx)(S,{variant:V===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":o(),title:o(),"aria-pressed":V===`list`,onClick:()=>en(`list`),children:(0,z.jsx)(ut,{})}),(0,z.jsx)(S,{variant:V===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":lt(),title:lt(),"aria-pressed":V===`calendar`,onClick:()=>en(`calendar`),children:(0,z.jsx)(Xt,{})})]}),(0,z.jsxs)(S,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:oe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,z.jsx)(Et,{size:14,"aria-hidden":!0}),We()]})]}),h!==null&&hn>0?(0,z.jsxs)(Ht,{q:L.q,onQChange:e=>B(t=>({...t,q:e})),searchPlaceholder:et(),onReset:()=>B(Gt),canReset:qt(L),children:[(0,z.jsxs)(O,{value:L.state,onValueChange:e=>B(t=>({...t,state:e})),children:[(0,z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`all`,children:Ee()}),(0,z.jsx)(A,{value:`active`,children:Je()}),(0,z.jsx)(A,{value:`paused`,children:m()}),(0,z.jsx)(A,{value:`auto-disabled`,children:ne()})]})]}),(0,z.jsxs)(O,{value:L.result,onValueChange:e=>B(t=>({...t,result:e})),children:[(0,z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`all`,children:r()}),(0,z.jsx)(A,{value:`ok`,children:Ue()}),(0,z.jsx)(A,{value:`error`,children:Pe()}),(0,z.jsx)(A,{value:`running`,children:Ye()}),(0,z.jsx)(A,{value:`none`,children:Be()})]})]})]}):null,h===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":oe,children:g?Se():s()}):V===`calendar`?(0,z.jsxs)(z.Fragment,{children:[g?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,h.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,z.jsx)(an,{events:cn.events,mode:H,cursor:U,onModeChange:tn,onCursorChange:on,onEventClick:G,footnote:ae()})]}):(0,z.jsxs)(z.Fragment,{children:[g?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,h.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):null,h.map(e=>{let t=e.jobs.filter(e=>Ut(e,L)),n=qt(L)&&e.jobs.length>0&&t.length===0;return(0,z.jsxs)(`section`,{style:{marginBottom:20},children:[h.length>1||e.error||!e.supported?(0,z.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,z.jsx)(C,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve({code:e.error})}):e.jobs.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):n?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,z.jsxs)(Vt,{children:[(0,z.jsx)(Rt,{children:(0,z.jsxs)(Bt,{children:[(0,z.jsx)(N,{children:De()}),(0,z.jsx)(N,{children:i()}),(0,z.jsx)(N,{children:le()}),(0,z.jsx)(N,{children:_e()}),(0,z.jsx)(N,{children:he()}),(0,z.jsx)(N,{children:Qe()}),(0,z.jsx)(N,{children:ue()})]})}),(0,z.jsx)(zt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=v===r,a=e.manageSupported,o=e.kind===`openclaw`&&a;return(0,z.jsxs)(Bt,{ref:t.id!==null&&t.id===q?J:void 0,"data-state":t.id!==null&&t.id===q?`selected`:void 0,children:[(0,z.jsx)(P,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??ge()}),(0,z.jsx)(P,{children:(0,z.jsx)(C,{variant:`secondary`,children:t.agentId})}),(0,z.jsxs)(P,{className:`whitespace-nowrap`,children:[(0,z.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Ct(t.schedule),n=e===null?null:Lt(e);return n===null?null:(0,z.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,z.jsx)(P,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,z.jsx)(P,{children:Kt(t)===`auto-disabled`?(0,z.jsx)(C,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:ne()}):Kt(t)===`active`?(0,z.jsx)(C,{variant:`secondary`,children:Je()}):Kt(t)===`paused`?(0,z.jsx)(C,{variant:`outline`,children:m()}):(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,z.jsxs)(P,{children:[(0,z.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,z.jsx)(C,{variant:`destructive`,title:t.lastDeliveryError??u(),children:xe()}):null]}),(0,z.jsx)(P,{className:`whitespace-nowrap`,children:t.id===null?(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,z.jsx)(gt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,z.jsxs)(`span`,{className:`oc-cronactions`,children:[o?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:fe(),"aria-label":fe(),disabled:v!==null,onClick:()=>void X(r,async()=>{let n=await te({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ct()),children:(0,z.jsx)(At,{size:14,"aria-hidden":!0})}):null,o&&t.enabled!==null?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:I(t)===`pause`?at():c(),"aria-label":I(t)===`pause`?at():c(),disabled:v!==null,onClick:()=>void X(r,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:I(t)===`resume`}}),I(t)===`pause`?it():ye()),children:I(t)===`pause`?(0,z.jsx)(vt,{size:14,"aria-hidden":!0}):(0,z.jsx)(Pt,{size:14,"aria-hidden":!0})}):null,o?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:ot(),"aria-label":ot(),disabled:v!==null,onClick:()=>void pn(e.instanceName,t),children:(0,z.jsx)(It,{size:14,"aria-hidden":!0})}):null,o?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:Ce(),"aria-label":Ce(),disabled:v!==null,onClick:()=>void ln(e.instanceName,t),children:(0,z.jsx)(Zt,{size:14,"aria-hidden":!0})}):null,a?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:de(),"aria-label":de(),disabled:v!==null,onClick:()=>ht({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,z.jsx)(Tt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()})]},e.instanceName)}),hn>0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:a()}):null]}),(0,z.jsx)(yt,{open:w!==null,onOpenChange:e=>{e||ht(null)},children:(0,z.jsxs)(bt,{children:[(0,z.jsxs)(_t,{children:[(0,z.jsx)(Ot,{children:Ne()}),(0,z.jsx)(pt,{children:ze({name:w?.name??``})})]}),(0,z.jsxs)(ft,{children:[(0,z.jsx)(Ft,{children:Ke()}),(0,z.jsx)(dt,{onClick:()=>{let e=w;ht(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>d({instanceName:e.instanceName,jobId:e.jobId}),je())},children:ke()})]})]})}),(0,z.jsx)(St,{open:T!==null,onOpenChange:e=>{e||(Z.current++,E(null))},children:(0,z.jsxs)(jt,{style:{maxWidth:640},children:[(0,z.jsx)(kt,{children:(0,z.jsx)(Nt,{children:rt({name:T?.name??``})})}),T?.entries===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):T!==null&&T.entries.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):T===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:T.entries.map((e,t)=>(0,z.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,z.jsx)(fn,{status:e.status}),(0,z.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,z.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Le({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,z.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,z.jsx)(St,{open:D!==null,onOpenChange:e=>{e||(Q.current++,F(null))},children:(0,z.jsxs)(jt,{className:`oc-cronedit`,children:[(0,z.jsxs)(kt,{children:[(0,z.jsx)(Nt,{children:Ae()}),(0,z.jsx)(Mt,{children:Me()})]}),D===null?null:D.loading?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:De()}),(0,z.jsx)(mt,{value:D.name,maxLength:200,onChange:e=>F({...D,name:e.target.value,nameDirty:!0})})]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Re()}),(0,z.jsxs)(O,{value:D.scheduleKind,onValueChange:e=>F({...D,scheduleKind:e,scheduleDirty:!0}),children:[(0,z.jsx)(j,{children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`cron`,children:Ge()}),(0,z.jsx)(A,{value:`every`,children:Oe()}),(0,z.jsx)(A,{value:`at`,children:Te()})]})]}),D.scheduleKind===`cron`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(mt,{value:D.cronExpr,onChange:e=>F({...D,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,z.jsx)(Yt,{value:D.tz,onChange:e=>F({...D,tz:e,scheduleDirty:!0}),fallbackTz:p??void 0})]}):D.scheduleKind===`every`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(mt,{type:`number`,min:1,value:D.everyValue,onChange:e=>F({...D,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,z.jsxs)(O,{value:D.everyUnit,onValueChange:e=>F({...D,everyUnit:e,scheduleDirty:!0}),children:[(0,z.jsx)(j,{style:{maxWidth:160},children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`minutes`,children:nt()}),(0,z.jsx)(A,{value:`hours`,children:Ie()}),(0,z.jsx)(A,{value:`days`,children:we()})]})]})]}):(0,z.jsx)(Qt,{value:D.at,onChange:e=>F({...D,at:e,scheduleDirty:!0})})]}),D.hasMessage?(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ee()}),(0,z.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:D.message,onChange:e=>F({...D,message:e.target.value,messageDirty:!0})})]}):null]}),(0,z.jsxs)(wt,{children:[(0,z.jsx)(S,{variant:`ghost`,onClick:()=>F(null),children:Ke()}),(0,z.jsxs)(S,{onClick:()=>void mn(),disabled:D===null||D.loading||Wt,children:[Wt?(0,z.jsx)(gt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Ze()]})]})]})})]})}export{pn as ScheduledTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,AR as i,Az as a,BR as o,Bz as ee,CR as s,Cz as te,DR as ne,Dz as re,ER as c,Ez as ie,FR as l,Fz as u,GR as ae,HR as d,IR as f,Iz as oe,JR as se,KR as ce,LR as p,Lz as le,MG as m,MR as h,Mz as ue,NR as g,Nz as de,OR as _,Oz as fe,PR as pe,Pz as me,QR as he,RR as v,Rz as ge,SR as y,Sz as _e,TR as ve,Tz as ye,UR as b,VR as x,WR as be,XR as xe,YR as Se,ZR as Ce,_z as we,az as Te,bR as S,bz as Ee,cz as De,dz as Oe,ez as ke,fz as Ae,gz as je,hz as Me,iz as Ne,jG as C,jR as w,jz as Pe,kG as Fe,kR as T,kz as Ie,lz as Le,mz as Re,nz as ze,oz as Be,pz as Ve,qR as He,rz as Ue,sz as We,t as E,tz as Ge,uz as Ke,vz as qe,wR as D,wz as Je,xR as O,xz as Ye,yz as Xe,zR as k,zz as Ze}from"./api-CnXjOprV.js";import{r as Qe}from"./dist-CU23SxxP.js";import{t as A}from"./button-C7mIcWuE.js";import{At as j,Ft as M,Gn as $e,Kn as et,Ln as N,Un as P,Vn as tt,_ as nt,at as F,ct as I,dt as L,et as R,ft as z,it as B,jt as rt,lt as V,nt as H,ot as U,q as it,rt as W,st as at,tt as G,ut as K}from"./index-0t8eOneo.js";import{t as ot}from"./FilterBar-DLMcpn_E.js";import{t as st}from"./DataTableShell-K5cImuMP.js";import{t as ct}from"./roleDescriptions-Bm8ptI3N.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>ve(),days:30},{value:`90`,label:()=>D(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[o,s]=(0,q.useState)(Z),ne=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),l=m(E.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:i===Z?void 0:i===`disabled`}}),d=m(E.apiKeys.listKeys,{}),f=m(E.apiKeys.listRoles,{}),p=C(E.apiKeys.createServiceAccount),h=C(E.apiKeys.updateServiceAccount),g=C(E.apiKeys.deleteServiceAccount),_=Fe(E.apiKeys.mintApiKey),pe=C(E.apiKeys.revokeApiKey),v=it(),y=rt(),ve=n!==``||o!==Z||i!==Z;function b(){s(Z),t({search:{},replace:!0})}let[x,S]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Q),[D,O]=(0,q.useState)(null),[k,N]=(0,q.useState)(new Set),[P,F]=(0,q.useState)(null),I=(0,q.useRef)(!1),[L,z]=(0,q.useState)(new Set),[V,U]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await h({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),y.success(Ne())):await p({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),O(null),S(!1)}catch(e){y.error(D?Te():Be(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),S(!0)}async function pt(e){if(I.current)return;I.current=!0;let t=V[e._id]??`never`,n=Y.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await _({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(Ue(),e)}finally{I.current=!1,F(null)}}async function mt(e){if(await v({title:ze(),description:(0,J.jsxs)(J.Fragment,{children:[Ge(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ke(),` `,(0,J.jsx)(`strong`,{children:r()}),` `,he()]}),confirmWord:e.name,confirmLabel:Ce(),destructive:!0}))try{await g({serviceAccountId:e._id}),y.success(xe(),e.name)}catch(e){y.error(Se(),e)}}async function ht(e){if(await v({title:se(),description:(0,J.jsxs)(J.Fragment,{children:[He(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ce()]}),confirmLabel:ae(),destructive:!0})&&!L.has(e._id)){z(t=>new Set(t).add(e._id));try{await pe({keyId:e._id})}catch(e){y.error(be(),e)}finally{z(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),(0,J.jsxs)(ot,{q:n,onQChange:ne,searchPlaceholder:Ze(),onReset:b,canReset:ve,children:[(0,J.jsxs)(R,{value:o,onValueChange:s,children:[(0,J.jsx)(W,{size:`sm`,className:`w-40`,children:(0,J.jsx)(B,{placeholder:ge()})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(H,{value:Z,children:le()}),(f??[]).map(e=>(0,J.jsx)(H,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(R,{value:i,onValueChange:c,children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(G,{children:[(0,J.jsx)(H,{value:Z,children:oe()}),(0,J.jsx)(H,{value:`active`,children:u()}),(0,J.jsx)(H,{value:`disabled`,children:me()})]})]})]}),(0,J.jsx)(st,{title:de(),rows:l,addLabel:ue(),onAdd:()=>{T(Q),O(null),S(!0)},emptyHint:Pe(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:L}),rowActions:e=>[...(e.managedBy??null)===null?[{label:re(),onSelect:()=>ft(e)},{label:a(),onSelect:()=>void pt(e)}]:[],{label:k.has(e._id)?Ie():fe(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:ie(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ye():Je(),onClick:()=>$(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(tt,{})})},{header:te(),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:_e(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(j,{variant:`secondary`,children:e.roleKey})},{header:Ye(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(j,{variant:`destructive`,children:me()}):(0,J.jsx)(j,{variant:`outline`,children:u()})},{header:Ee(),cell:e=>(0,J.jsxs)(R,{value:V[e._id]??`never`,onValueChange:t=>U(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(W,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(G,{children:Y.map(e=>(0,J.jsx)(H,{value:e.value,children:e.label()},e.value))})]})},{header:Xe(),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:P===e._id?qe():we({count:t})})}}]}),(0,J.jsx)(nt,{open:x,onOpenChange:e=>{S(e),e||O(null)},title:D?je():Ve(),description:D?Me():Ae(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:D?Re():Oe(),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:Ke()}),(0,J.jsx)(M,{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:Le()}),(0,J.jsxs)(R,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(W,{className:`w-full`,children:(0,J.jsx)(B,{placeholder:De()})}),(0,J.jsx)(G,{children:(f??[]).map(e=>(0,J.jsxs)(H,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).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:We()}),(0,J.jsx)(M,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:at,onClose:()=>K(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[b(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:x()}),(0,J.jsx)(`th`,{children:o()}),(0,J.jsx)(`th`,{children:k()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:f()}),(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)(j,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(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&&(e.managedBy??null)===null?(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?l():pe()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function a(){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)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(V,{children:[(0,J.jsx)(K,{children:g()}),(0,J.jsx)(at,{children:h({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:w()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void a(),"aria-label":i(),children:[n?(0,J.jsx)(P,{}):(0,J.jsx)(N,{}),n?T():_()]})]}),(0,J.jsx)(I,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:ne()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?s():z(e)}function pt(e){return e===null?`—`:L(e)}function mt(e){return e.disabled?(0,J.jsx)(j,{variant:`destructive`,children:y()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(j,{variant:`outline`,children:O()}):(0,J.jsx)(j,{variant:`outline`,children:S()})}export{$ as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Af as r,Bf as i,Cf as a,Df as o,Ef as s,Ff as c,Gf as l,Hf as u,If as d,Kf as f,Lf as p,MG as m,Mf as h,Nf as g,Of as _,Pf as v,Rf as y,Sf as b,Tf as x,Uf as S,Vf as C,Wf as w,_f as T,bf as E,df as D,ff as O,gf as k,hf as A,jG as j,jf as M,kf as N,lf as P,mf as F,pf as I,qf as ee,t as L,uf as R,vf as z,wf as B,xf as V,yf as H,zf as U}from"./api-CnXjOprV.js";import{t as W}from"./button-C7mIcWuE.js";import{ft as G,q as K}from"./index-0t8eOneo.js";import{t as q}from"./DataTableShell-K5cImuMP.js";var J=t(e(),1),Y=n(),X={hung:()=>r(),wrong_result:()=>N(),error:()=>_(),other:()=>o()},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=j(L.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[o,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);async function d(){let t=o.trim();if(!(!t||l)){u(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{u(!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),` · `,s({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:x()}),(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:B()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.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`?a():b()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:V()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:E(),value:o,maxLength:2e3,rows:3,onChange:e=>c(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 d(),disabled:!o.trim()||l,children:l?z():H()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[T({count:t.children.length}),t.childrenTruncated?` ${k()}`:``,t.textTruncated?` ${A()}`:``]}),(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?` · ${F()}`:``]}),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:I()}),(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:O()}),(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=m(L.subAgentReports.listForAdmin,{}),t=j(L.subAgentReports.readReport),n=j(L.subAgentReports.deleteReport),r=K(),[a,o]=(0,J.useState)(null),[s,_]=(0,J.useState)({});async function b(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({reportId:e._id});_(t=>({...t,[e._id]:n}))}o(e._id)}async function x(e){await r({title:D(),description:R(),confirmLabel:P(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&o(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,Y.jsx)(`strong`,{children:w()}),` `,S()]}),(0,Y.jsx)(q,{title:ee(),rows:e,emptyHint:f(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Y.jsx)($,{data:s[e._id]}):null,columns:[{header:u(),cell:e=>G(e.at),sort:e=>e.at},{header:C(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:i(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:U(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${d({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:y(),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:c()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:v()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?h():g(),onSelect:()=>void b(e)},{label:M(),onSelect:()=>void x(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{$B as r,AB as i,AV as a,BB as o,BV as s,CV as c,DB as l,DV as u,EV as d,FB as f,FV as p,GB as m,GV as h,HB as g,HV as _,IB as ee,IV as v,JB as te,JV as ne,KB as re,KV as ie,LB as ae,LV as oe,MB as se,MG as y,MV as ce,NB as le,NV as ue,OB as de,OV as fe,PB as pe,PV as me,QB as he,RB as ge,RV as _e,SV as ve,TV as ye,UB as be,UV as xe,VB as Se,VV as Ce,WB as we,WV as Te,XB as Ee,YB as De,YV as Oe,ZB as ke,_V as Ae,aV as je,af as Me,bG as Ne,bV as Pe,cV as Fe,cf as b,dV as Ie,eV as Le,fV as x,gV as Re,hV as ze,iV as Be,jB as S,jG as C,jV as Ve,kB as He,kG as Ue,kV as We,lV as Ge,mV as Ke,nV as qe,oV as Je,of as Ye,pV as Xe,qB as w,qV as Ze,r as Qe,rV as $e,sV as et,sf as T,t as E,tV as tt,uV as nt,vV as rt,wV as it,xG as at,xV as ot,yG as st,yV as ct,zB as lt,zV as D}from"./api-CnXjOprV.js";import{t as O}from"./x-Cd7Svlfj.js";import{t as k}from"./button-C7mIcWuE.js";import{At as A,Bt as j,Fn as M,Ft as N,In as ut,It as dt,Lt as ft,Rt as P,Un as F,Vt as pt,X as mt,Y as ht,Z as I,et as L,it as R,ln as z,mt as B,nt as V,rt as H,tt as U,zt as gt}from"./index-0t8eOneo.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-D96d_4Et.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-CXJLU3m_.js";import{t as Dt}from"./TimeRangePicker-BIobKXvm.js";import{t as Ot}from"./FilterBar-DLMcpn_E.js";import{t as kt}from"./AdvancedFilter-ksMf6bcD.js";var q=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(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 Pt(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 Pt(e,t,n)>=At}function Ft(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 It(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 Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Ee());if(e.size>Lt)throw Error(De());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/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(w());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(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(w());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)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(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 Y(f,`image/webp`,Bt)??await Y(f,`image/png`);if(!h)throw Error(re());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(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 Ut(e)}async function Ut(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(te())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?at():e===`dark`?Ne():st()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Qe(`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)(F,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":b(),title:b(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=y(E.charts.listMyCharts),r=C(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:D(),subtitle:_e(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?oe():n.via===`owner`?v():p({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()}):null]})}function Qt(){let e=C(E.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(x())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(nt());return}let a;try{a=JSON.parse(r)}catch{o(x());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!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:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ct()})]}),(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:rt()}),(0,X.jsx)(N,{value:t,onChange:e=>n(e.target.value),placeholder:Ae(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Re()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:ze(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(z,{className:`size-4`}),Ke(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:l,onClick:()=>void f(),children:Xe()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ie()}):null]})]})}function $t({chart:e}){let t=Ue(E.charts.setChartLogo),n=C(E.charts.removeChartLogo),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Vt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?$e():qe()}),(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)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(z,{className:`size-4`}),t?Le():tt(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(e),children:he()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void d(e),children:r()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Be()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),i?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ke()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=y(E.me.getMe,{host:I}),n=C(E.charts.addChartDomain),r=C(E.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:m()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Se()}):d.map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":o({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(N,{value:i,onChange:e=>a(e.target.value),placeholder:be(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:g()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:we()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=C(E.charts.updateChart),n=C(E.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>$(e.tokens)),[l,u]=(0,q.useState)(e.tokens.bpm??0),[d,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(!1);function g(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(s)}catch{p(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(f()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:g,children:Je()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:je()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ae()}),(0,X.jsx)(N,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":T()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Ye():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Me()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ee()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:lt()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ge()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=y(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:Ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=C(E.charts.addChartToGroupPool),r=C(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function f(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?d():e.kind===`custom`&&e.scope===`personal`?S():u()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:ye()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:c()}),(a??[]).map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ot({group:e.name}),onClick:()=>void f(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(L,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(H,{size:`sm`,className:`w-56`,children:(0,X.jsx)(R,{placeholder:ve()})}),(0,X.jsx)(U,{children:s.map(e=>(0,X.jsx)(V,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it()}):null]})]})}function an({chart:e}){let t=C(E.charts.promoteChartToCommon),n=C(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function a(){if(e.chartId!==void 0&&window.confirm(f()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?i():S()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:se({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:He()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:de()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(E.admin.setDefaultThemeMode),i=C(E.admin.setDefaultLocale),o=C(E.charts.setDefaultChart),s=y(E.charts.listChartsAdmin),c=y(E.groups.listGroups,{}),u=e??`system`,d=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:xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_()})]}),(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:ce()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:D()}),mt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:We()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:l()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(k,{variant:d===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:h()})]})]})}function sn(){let e=y(E.me.getMe,{host:I}),t=ht(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,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)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:Te()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(N,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(L,{value:n,onValueChange:r,children:[(0,X.jsx)(H,{className:`w-56`,children:(0,X.jsx)(R,{placeholder:`Select…`})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(V,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(B,{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)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(L,{value:o,onValueChange:s,children:[(0,X.jsx)(H,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:Z,children:`Toutes directions`}),(0,X.jsx)(V,{value:`inbound`,children:`inbound`}),(0,X.jsx)(V,{value:`outbound`,children:`outbound`}),(0,X.jsx)(V,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(L,{value:c,onValueChange:l,children:[(0,X.jsx)(H,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(V,{value:`info`,children:`info`}),(0,X.jsx)(V,{value:`warn`,children:`warn`}),(0,X.jsx)(V,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(dt,{children:[(0,X.jsx)(pt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(ft,{align:`start`,children:[(0,X.jsx)(gt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(B,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(B,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(F,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(M,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BC as r,Bl as i,Fl as a,GC as o,HC as s,Il as c,JC as l,KC as u,Ll as d,Pl as f,Rl as p,UC as m,VC as h,WC as g,XC as _,YC as v,ZC as y,qC as b,zC as x,zl as S}from"./api-DMU7ZOYa.js";import{t as C}from"./button-B2QgVBao.js";import{Ft as w,Gt as T,Jt as E,Kt as D,Rn as O,ft as k,hn as A,qt as j}from"./index-BQY_zyzx.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:y(),from:`now-5m`},{label:_(),from:`now-15m`},{label:v(),from:`now-30m`},{label:l(),from:`now-1h`},{label:b(),from:`now-3h`},{label:u(),from:`now-6h`},{label:o(),from:`now-12h`},{label:g(),from:`now-24h`},{label:m(),from:`now-2d`},{label:s(),from:`now-7d`},{label:h(),from:`now-30d`},{label:r(),from:`now-90d`},{label:x(),from:`now-520w`}];function L(e){return k(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),[o,s]=(0,M.useState)(``),l=F(e),[u,m]=(0,M.useState)(()=>z(l.from)),[h,g]=(0,M.useState)(()=>z(l.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 y(){let e=B(u),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=o.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[o]),x=B(u)!==null&&B(h)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:_,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(T,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:i()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,H.jsx)(w,{type:`datetime-local`,value:u,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,H.jsx)(w,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:d()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(A,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:o,onChange:e=>s(e.target.value),placeholder:c(),"aria-label":a()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:f()}):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{$C as r,Bl as i,Gl as a,Hl as o,Kl as s,QC as c,Ul as l,Vl as u,Wl as d,XC as f,YC as p,ZC as m,aw as h,ew as g,iw as _,nw as v,ow as y,rw as b,sw as x,tw as S}from"./api-CnXjOprV.js";import{t as C}from"./button-C7mIcWuE.js";import{Ft as w,Gt as T,Jt as E,Kt as D,Rn as O,ft as k,hn as A,qt as j}from"./index-0t8eOneo.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:x(),from:`now-5m`},{label:y(),from:`now-15m`},{label:h(),from:`now-30m`},{label:_(),from:`now-1h`},{label:b(),from:`now-3h`},{label:v(),from:`now-6h`},{label:S(),from:`now-12h`},{label:g(),from:`now-24h`},{label:r(),from:`now-2d`},{label:c(),from:`now-7d`},{label:m(),from:`now-30d`},{label:f(),from:`now-90d`},{label:p(),from:`now-520w`}];function L(e){return k(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),[c,f]=(0,M.useState)(``),p=F(e),[m,h]=(0,M.useState)(()=>z(p.from)),[g,_]=(0,M.useState)(()=>z(p.to));function v(t){if(t){let t=F(e);h(z(t.from)),_(z(t.to)),f(``)}r(t)}function y(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function b(){let e=B(m),n=B(g);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let x=(0,M.useMemo)(()=>{let e=c.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[c]),S=B(m)!==null&&B(g)!==null;return(0,H.jsxs)(j,{open:n,onOpenChange:v,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(T,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:s()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,H.jsx)(w,{type:`datetime-local`,value:m,onChange:e=>h(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:d()}),(0,H.jsx)(w,{type:`datetime-local`,value:g,onChange:e=>_(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:b,children:l()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(A,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(w,{value:c,onChange:e=>f(e.target.value),placeholder:o(),"aria-label":u()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:i()}):x.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>y(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dH as r,fH as i,mH as a,pH as o}from"./api-DMU7ZOYa.js";import{t as s}from"./chevrons-up-down-CuhmzRKZ.js";import{Ft as c,Ht as l,Un as u,Ut as d,Wt as f}from"./index-BQY_zyzx.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(c,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||r():e;return(0,D.jsxs)(l,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(f,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(d,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:o(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:i()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{JH as r,XH as i,YH as a,ZH as o}from"./api-CnXjOprV.js";import{t as s}from"./chevrons-up-down-CPB13Hhb.js";import{Ft as c,Ht as l,Un as u,Ut as d,Wt as f}from"./index-0t8eOneo.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(c,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||r():e;return(0,D.jsxs)(l,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(f,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":o(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(d,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:i(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:a()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$N as i,AP as a,BE as o,CP as s,D as c,DP as l,EP as u,FE as d,GE as f,GN as p,HE as ee,Hc as m,IE as h,JE as g,JN as _,KE as v,KN as y,LE as te,ME as b,MG as x,MP as S,NE as C,NP as ne,OP as w,PE as re,QE as ie,QN as ae,RE as oe,SP as se,TP as ce,UE as le,Uc as ue,VE as de,Vc as fe,WE as pe,WN as T,XE as me,XN as E,YE as he,YN as D,ZE as ge,ZN as O,_P as k,aD as _e,bP as A,cD as ve,dD as ye,dP as be,eD as xe,eP as Se,fD as Ce,fP as we,gP as Te,hP as Ee,iD as De,iP as Oe,jE as j,jG as M,jP as ke,kP as Ae,lD as je,lP as Me,mD as Ne,mP as Pe,nD as Fe,nP as Ie,oD as Le,pD as Re,pP as ze,qE as Be,qN as Ve,rD as He,rP as Ue,sD as We,t as N,tD as P,tP as Ge,uD as Ke,uP as F,vP as qe,wP as Je,xP as I,yP as Ye,zE as Xe}from"./api-CnXjOprV.js";import{t as Ze}from"./x-Cd7Svlfj.js";import{t as L}from"./button-C7mIcWuE.js";import{At as R,G as Qe,Gn as $e,K as z,Kn as et,Ln as tt,Nn as nt,Pn as rt,U as it,Un as at,W as B,Z as ot,a as st,at as ct,et as V,ft as H,i as lt,it as U,kn as ut,lt as dt,nt as W,o as ft,ot as pt,pt as mt,rt as G,s as ht,st as gt,tt as K,ut as _t,z as vt}from"./index-0t8eOneo.js";import{n as yt}from"./TimeRangePicker-BIobKXvm.js";import{t as bt}from"./FilterBar-DLMcpn_E.js";import{t as xt}from"./AdvancedFilter-ksMf6bcD.js";import{t as St}from"./DataTableShell-K5cImuMP.js";var Ct=c(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Pe():n===`agent`?`${ze()} - ${r}`:e}function Tt(){let e=x(N.me.getMe,{host:ot})?.role===`admin`,t=x(N.deliveryTiming.getDeliveryStatus,{}),n=M(N.deliveryTiming.startDeliveryRecord),r=M(N.deliveryTiming.stopDeliveryRecord),[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=t?.recording??!1,d=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:ne()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}),e?(0,J.jsx)(L,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void d(),children:l?a():ke()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(R,{variant:`secondary`,children:Ae()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:w({time:mt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:i?ce():u()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=x(N.deliveryTiming.listDeliverySessions,{}),n=M(N.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:ee}=yt(c),m=c.to===`now`?1/0:ee,h=r.trim()!==``||a!==`all`||c!==Y,g=()=>{i(``),o(`all`),l(Y)},_=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,m]),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:r,onQChange:i,searchPlaceholder:s(),timeRange:c,onTimeRangeChange:l,onReset:g,canReset:h,children:(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(U,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(W,{value:`all`,children:se()}),(0,J.jsx)(W,{value:`active`,children:I()}),(0,J.jsx)(W,{value:`stopped`,children:A()})]})]})}),(0,J.jsx)(St,{title:Je(),rows:_,emptyHint:p(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?be():we(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(rt,{size:15,"aria-hidden":!0}):(0,J.jsx)(nt,{size:15,"aria-hidden":!0})})},{header:Ye(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:H(e.startedAt)})},{header:qe(),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:k(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:Te(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Ee(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(R,{variant:`secondary`,children:I()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:A()})}],rowActions:e?e=>[{label:F(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:F(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=x(N.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(vt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Me()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let r=e.segments,a=(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,` `,T()]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(at,{size:13,"aria-hidden":!0}):(0,J.jsx)(tt,{size:13,"aria-hidden":!0}),t?y():Ve()]})]}),(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:Ie()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Ge()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Se()})]})}),(0,J.jsxs)(`tbody`,{children:[a(i(),r.bridge),a(ae(),r.A),a(O(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:E()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:D()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:ue()},{value:`principalType`,label:m()},{value:`direction`,label:`direction`},{value:`roleKey`,label:fe()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=et({from:`/settings/traces`}),t=$e({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,u=e.q??``,p=e.correlationId,m=lt(e.from,e.to),_=(0,q.useMemo)(()=>ht(e.adv),[e.adv]),{from:y,to:b}=yt(m),[S,C]=(0,q.useState)(null),[ne,w]=(0,q.useState)(null),ae=e=>void t({search:t=>({...t,limit:e})}),se=e=>void t({search:t=>({...t,kind:e})}),ce=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ue=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),fe=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,...ft(e)})}),O=e=>void t({search:t=>({...t,adv:st(e)}),replace:!0}),k=x(N.observability.listEvents,{limit:n}),A=x(N.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...p?{correlationId:p}:{},filter:{q:u||void 0,from:y,to:b,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:_.length>0?_:void 0}}),be=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])e.add(t.kind);return[...e].sort()},[k]),Se=(0,q.useMemo)(()=>{let e=new Set;for(let t of k??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[k]),we=u!==``||a!==Q||s!==Q||c!==Q||l!==Q||_.length>0||m.kind!==`relative`||m.from!==Nt.from;function Te(){t({search:{limit:100,kind:`all`},replace:!0})}let Ee=S?k?.filter(e=>e.correlationId===S):A,j=e.section,M=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(it,{value:j,onValueChange:e=>M(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(z,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ut,{size:13,"aria-hidden":!0}),Oe()]}),(0,J.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),Ue()]})]}),(0,J.jsx)(B,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(B,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ne(),(0,J.jsx)(`strong`,{children:Re()}),Ce(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:ye()})]}),(0,J.jsxs)(bt,{q:u,onQChange:ce,searchPlaceholder:Ke(),timeRange:m,onTimeRangeChange:D,onReset:Te,canReset:we,children:[(0,J.jsxs)(V,{value:a,onValueChange:ue,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(U,{placeholder:je()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(W,{value:Q,children:ve()}),At.map(e=>(0,J.jsx)(W,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:s,onValueChange:fe,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(U,{placeholder:We()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(W,{value:Q,children:Le()}),jt.map(e=>(0,J.jsx)(W,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:c,onValueChange:T,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(U,{placeholder:_e()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(W,{value:Q,children:De()}),Mt.map(e=>(0,J.jsx)(W,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:l,onValueChange:E,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(U,{placeholder:He()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(W,{value:Q,children:Fe()}),Se.map(e=>(0,J.jsx)(W,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===Z?``:i,placeholder:P(),"aria-label":P(),onChange:e=>{let t=e.target.value.trim();se(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:be.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(V,{value:String(n),onValueChange:e=>ae(Number(e)),children:[(0,J.jsx)(G,{size:`sm`,className:`w-28`,children:(0,J.jsx)(U,{})}),(0,J.jsx)(K,{children:kt.map(e=>(0,J.jsx)(W,{value:String(e),children:xe({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:_,onChange:O}),S?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:r(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ie(),(0,J.jsx)(`code`,{children:$(S)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:ge()})]})}):null,(0,J.jsx)(St,{title:me(),rows:Ee,emptyHint:S?he():g(),columns:[{header:Be(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:H(e.at)})},{header:v(),sort:e=>e.kind,cell:e=>(0,J.jsx)(R,{variant:`secondary`,children:e.kind})},{header:f(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":pe(),children:`✓`})}},{header:le(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(R,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(R,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:de(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(R,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:o(),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:Xe(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:oe(),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:te(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:h(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:d(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:re()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:ne,onClose:()=>w(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(ct,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(pt,{className:`max-w-lg`,children:[(0,J.jsxs)(dt,{children:[(0,J.jsxs)(_t,{className:`oc-traces__meta-title`,children:[C(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(R,{variant:`outline`,children:b()})]}),(0,J.jsx)(gt,{children:j()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,$j as i,Bj as a,Fj as o,GT as s,Gj as c,Hj as l,Ij as u,JT as d,Jj as f,KT as p,Kj as ee,Lj as m,MG as h,Mj as te,Nj as ne,Pj as re,QT as g,Qj as ie,Rj as _,UT as v,Uj as ae,Vj as oe,WT as y,Wj as se,XT as b,Xj as ce,YT as x,Yj as le,ZT as S,Zj as ue,aM as C,b_ as w,eE as T,eM as de,iM as E,jG as D,nM as fe,oM as O,pj as pe,qT as k,qj as me,rM as he,t as A,tE as j,tM as ge,x_ as M,y_ as N,zj as _e}from"./api-CnXjOprV.js";import{t as P}from"./button-C7mIcWuE.js";import{At as F,Gn as I,It as L,J as ve,Kn as R,Lt as ye,Rt as be,Vt as xe,Z as Se,at as Ce,c as z,et as B,fn as V,it as H,jt as U,l as we,lt as Te,mn as W,mt as G,nt as K,ot as Ee,q as De,rt as q,st as Oe,tt as J,u as Y,ut as ke,zt as Ae}from"./index-0t8eOneo.js";import{t as je}from"./FilterBar-DLMcpn_E.js";import{t as Me}from"./DataTableShell-K5cImuMP.js";import{t as Ne}from"./DetailChips-Xge7xE-L.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:i}){let a=h(A.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=h(A.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),f=[...(a?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.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 f){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,Z.jsx)(Ce,{open:n,onOpenChange:i,children:(0,Z.jsxs)(Ee,{className:`oc-access`,children:[(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(ke,{children:j({user:t})}),(0,Z.jsx)(Oe,{children:T()})]}),a?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?r():g()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:S()}):f.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:d()}):[...p.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=D(A.agents.assignAgent),c=D(A.agents.removeAgent),l=D(A.agents.setDefaultAgent),u=U();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(b(),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)(F,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,c=e.state===`deleted`,l=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,Z.jsx)(G,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":k({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)(F,{variant:`outline`,className:`oc-access__gone`,children:p()}):null,e.outOfPool?(0,Z.jsx)(F,{variant:`outline`,className:`oc-access__gone`,children:s()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":y(),title:y(),children:(0,Z.jsx)(V,{size:14,fill:`currentColor`})}):(0,Z.jsx)(P,{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 N();case`user`:return w();case`admin`:return M();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=z.filter(e=>n.has(Y[e])).length;return(0,Z.jsxs)(L,{children:[(0,Z.jsx)(xe,{asChild:!0,children:(0,Z.jsx)(P,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?O():C({count:r})})}),(0,Z.jsxs)(ye,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(Ae,{children:E()}),z.map(e=>{let r=Y[e];return(0,Z.jsxs)(be,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(G,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:we[e]()})]},e)})]})]})}function Le(){let e=R({from:`/settings/users`}),t=I({from:`/settings/users`}),n=e.q??``,r=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),p=h(A.admin.listUsers,{filter:{q:n||void 0,role:r===Q?void 0:r},withAgents:!0}),g=h(A.me.getMe,{host:Se}),v=D(A.admin.setRole),y=D(A.admin.setUserPermissions),b=D(A.admin.startImpersonation),x=D(A.admin.deleteUser),S=D(A.admin.setUserName),C=De(),w=ve(),T=U(),[E,O]=(0,X.useState)(null),k=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of p??[])e.add(t.role);return[...e]},[p]),j=n!==``||r!==Q;function M(){t({search:{},replace:!0})}async function N(e){try{await v(e)}catch(e){T.error(he(),e)}}async function P(e){try{await y(e)}catch(e){T.error(fe(),e)}}async function F(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await C({title:le(),description:f({user:t}),confirmWord:me(),confirmLabel:ee(),destructive:!0}))try{await x({profileId:e._id}),T.success(se({user:t}))}catch(e){T.error(c(),e)}}async function L(e){let t=e.email||e.name||e.userId.slice(0,8),n=await w({title:l(),label:oe({user:t}),placeholder:a(),defaultValue:e.name??``,confirmLabel:pe()});if(n!==null)try{await S({profileId:e._id,name:n}),T.success(_e())}catch(e){T.error(_(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:s,searchPlaceholder:ge(),onReset:M,canReset:j,children:(0,Z.jsxs)(B,{value:r,onValueChange:d,children:[(0,Z.jsx)(q,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:Q,children:de()}),k.map(e=>(0,Z.jsx)(K,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:i(),rows:p,emptyHint:ie(),rowActions:e=>{let t=[{label:te(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ae(),onSelect:()=>void L(e)}];return e.userId!==g?.userId&&t.push({label:ue(),onSelect:()=>void b({profileId:e._id})},{label:ce(),variant:`destructive`,onSelect:()=>void F(e)}),t},columns:[{header:m(),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:u(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(B,{value:e.role,onValueChange:t=>void N({profileId:e._id,role:t}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(K,{value:`user`,children:$(`user`)}),(0,Z.jsx)(K,{value:`admin`,children:$(`admin`)})]})]})},{header:o(),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:re()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),P({profileId:e._id,permissions:[...n]})}})},{header:ne(),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||O(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{$s as r,Bo as i,Bs as a,CG as o,Do as ee,Eo as s,Gs as te,Hs as c,Jo as l,Js as u,Ks as ne,Lo as d,Ls as f,MG as p,Mo as m,Ng as h,No as g,Oo as re,Po as _,Qs as v,Ro as ie,Rs as ae,TG as oe,Us as y,Vo as se,Vs as b,Ws as x,Xs as ce,Ys as le,Zs as ue,ac as S,ch as C,ec as w,ic as de,jG as T,jo as fe,kG as pe,ko as E,mo as me,nc as D,oc as O,qs as k,rc as A,sc as j,t as M,tc as N,uN as P,uh as F,zo as I,zs as L}from"./api-CnXjOprV.js";import{t as R}from"./button-C7mIcWuE.js";import{$t as z,At as B,G as he,Gn as ge,K as V,Kn as _e,U as ve,W as H,Wn as ye,Z as be,an as xe,en as Se,et as U,in as W,it as G,mt as K,nn as Ce,nt as q,rn as J,rt as Y,sn as we,tn as Te,tt as X,wn as Ee}from"./index-0t8eOneo.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>w()],[`fr-FR`,()=>se()],[`en-US`,()=>i()],[`en-GB`,()=>I()],[`de-DE`,()=>ie()],[`es-ES`,()=>d()]],Oe=[[`0.75`,()=>v()],[`1`,()=>ue()],[`1.25`,()=>ce()],[`1.5`,()=>le()]],$=0;function ke({instance:e}){let t=T(M.admin.upsertInstanceConfig),n=e.config??{},i={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[a,o]=(0,Z.useState)(i),[c,l]=(0,Z.useState)(`idle`),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),g=pe(M.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{o({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),l(`idle`)},[e._id]);let _=a.enabled!==i.enabled||a.engine!==i.engine||a.lang!==i.lang||a.rate!==i.rate||a.autoRead!==i.autoRead;async function v(){l(`saving`);try{let n={...e.config??{}};n.voiceEnabled=a.enabled,a.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,a.lang===`auto`?delete n.voiceLang:n.voiceLang=a.lang;let r=Number.parseFloat(a.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,a.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),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)(B,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:a.enabled,onCheckedChange:e=>o({...a,enabled:e===!0}),"aria-label":D()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,Q.jsxs)(U,{value:a.engine,onValueChange:e=>o({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":E(),children:(0,Q.jsx)(G,{})}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(q,{value:`browser`,children:re()}),e.kind===`hermes`?null:(0,Q.jsx)(q,{value:`gateway`,children:ee()})]})]})]}),a.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()}):null,a.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:N()}),(0,Q.jsxs)(U,{value:a.lang,onValueChange:e=>o({...a,lang:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":N(),children:(0,Q.jsx)(G,{})}),(0,Q.jsx)(X,{children:De.map(([e,t])=>(0,Q.jsx)(q,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,Q.jsxs)(U,{value:a.rate,onValueChange:e=>o({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":r(),children:(0,Q.jsx)(G,{})}),(0,Q.jsx)(X,{children:Oe.map(([e,t])=>(0,Q.jsx)(q,{value:e,children:t()},e))})]})]}),a.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:a.autoRead,onCheckedChange:e=>o({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":u()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:k()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(R,{size:`sm`,disabled:!_||c===`saving`,onClick:()=>void v(),children:c===`saving`?h():F()}),(0,Q.jsx)(R,{variant:`outline`,size:`sm`,disabled:!a.enabled||d,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(m(!1),W(),J(),a.engine!==`gateway`){Ce(x(),{lang:Te(a.lang,oe()),rate:t});return}f(!0),g({instanceName:e.name,text:x()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&m(!0)}).finally(()=>f(!1))},children:d?h():ne()}),(0,Q.jsx)(R,{variant:`ghost`,size:`sm`,onClick:()=>{$++,f(!1),W(),J()},children:te()})]}),c===`error`||p?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p?me():C()}):null]})}function Ae({stt:e}){let t=p(M.me.getMe,{host:be}),n=T(M.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:c()}),(0,Q.jsx)(B,{variant:e?`secondary`:`outline`,children:e?ae():f()}),(0,Q.jsx)(B,{variant:r?`secondary`:`destructive`,children:r?g():m()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":_()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()})]})}function je(){let e=p(M.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>z(),[]),{section:r}=_e({from:`/settings/voice`}),i=ge({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(B,{variant:t?`secondary`:`destructive`,children:t?O():S()}),(0,Q.jsx)(B,{variant:n?`secondary`:`destructive`,children:n?de():A()})]}),(0,Q.jsxs)(ve,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(he,{className:`w-full`,children:[(0,Q.jsxs)(V,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(we,{size:13,"aria-hidden":!0}),fe()]}),(0,Q.jsxs)(V,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ee,{size:13,"aria-hidden":!0}),c()]}),(0,Q.jsxs)(V,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ye,{size:13,"aria-hidden":!0}),a()]})]}),(0,Q.jsx)(H,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(H,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(H,{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:a()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:L()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=T(M.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(B,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:l()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(K,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":P()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:P()})]})]})}export{je as VoiceTab};