@lacneu/atrium 0.88.1 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-D82x_380.js +1 -0
- package/dist/assets/{AdvancedFilter-D_IAxoTH.js → AdvancedFilter-DEwJUkfT.js} +1 -1
- package/dist/assets/AgentFilesTab-CEqQ02fZ.js +3 -0
- package/dist/assets/AnomaliesTab-Cl2630PU.js +1 -0
- package/dist/assets/AuditTab-DYryQjmJ.js +1 -0
- package/dist/assets/BridgeTab-rI4MFNcQ.js +1 -0
- package/dist/assets/ChatDefaultsTab-CgTm4WMx.js +1 -0
- package/dist/assets/{DataTableShell-CgfEZzcq.js → DataTableShell-REGK6Dqj.js} +1 -1
- package/dist/assets/{DetailChips-BWOhDvfm.js → DetailChips-Dhiulk-F.js} +1 -1
- package/dist/assets/FeedbacksTab-DpWIlp9R.js +1 -0
- package/dist/assets/{FieldLabel-ObN4xPwN.js → FieldLabel-CFBfL_GK.js} +1 -1
- package/dist/assets/FilesTab-VZuW17oP.js +1 -0
- package/dist/assets/{FilterBar-YVVbd65x.js → FilterBar-CJwP10CI.js} +1 -1
- package/dist/assets/GroupsTab-BjJmfc7f.js +1 -0
- package/dist/assets/InstancesTab-Ofqk-EZR.js +1 -0
- package/dist/assets/IntegrationsTab-Cey3WV3E.js +1 -0
- package/dist/assets/KpiTab-DIRKI4qa.js +1 -0
- package/dist/assets/PreferencesTab-BfHNBONO.js +1 -0
- package/dist/assets/ProjectPage-BsJB0GCv.js +1 -0
- package/dist/assets/PromptInjectionsTab-KdBPVl-W.js +4 -0
- package/dist/assets/RolesTab-DdooYgwg.js +1 -0
- package/dist/assets/ScheduledTab-AArpRKQU.js +1 -0
- package/dist/assets/ServiceAccountsTab-ByKfn9jX.js +1 -0
- package/dist/assets/SubAgentReportsTab-BMxqMtk1.js +1 -0
- package/dist/assets/ThemeShowroom-Ctv3Ktd3.js +1 -0
- package/dist/assets/{TimeRangePicker-Bo3B16zc.js → TimeRangePicker-es8qiYT0.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DvhM5ae3.js → TimezoneCombobox-DSIM9YOb.js} +1 -1
- package/dist/assets/TracesTab-CXdVaFxl.js +1 -0
- package/dist/assets/TrashPage-DBE3OVMc.css +1 -0
- package/dist/assets/TrashPage-DwgS7gln.js +1 -0
- package/dist/assets/TrashTab-CAfRYG_t.js +1 -0
- package/dist/assets/UsersTab-B29t4KCa.js +1 -0
- package/dist/assets/VoiceTab-BaN-J1s2.js +1 -0
- package/dist/assets/api-DfVtzU1G.js +44 -0
- package/dist/assets/button-BWdRKrS3.js +1 -0
- package/dist/assets/{card-MbRTJSAv.js → card-CdvSrnID.js} +1 -1
- package/dist/assets/chevrons-up-down-RHDK4dlM.js +1 -0
- package/dist/assets/{compatView-Bc7ErYFT.js → compatView-ChkOVx0F.js} +1 -1
- package/dist/assets/dispatchErrorInfo-CpWqaJBx.js +1 -0
- package/dist/assets/dist-CGHNQwsf.js +1 -0
- package/dist/assets/dist-CdViHsIv.js +1 -0
- package/dist/assets/{dist-QaMCaCpK.js → dist-D8270q9m.js} +1 -1
- package/dist/assets/{dist-CgIoeCFu.js → dist-cnxPdTGN.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BHc3abNI.js → highlighted-body-OFNGDK62-CrlMHfOs.js} +1 -1
- package/dist/assets/index-B0MXmi3m.js +327 -0
- package/dist/assets/index-Dwpglqo3.css +1 -0
- package/dist/assets/{list-CTSN7gc5.js → list-CR2YIdia.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-n8ziFmjV.js +1 -0
- package/dist/assets/{pdf-CMtKos9j.js → pdf-D1bMzEYl.js} +1 -1
- package/dist/assets/roleDescriptions-DBqNfMhe.js +1 -0
- package/dist/assets/{table-VhRaEfeZ.js → table-CVSQWo7b.js} +1 -1
- package/dist/assets/use_paginated_query-DSw-EOJL.js +1 -0
- package/dist/assets/x-CrZwGtLz.js +1 -0
- package/dist/index.html +9 -8
- package/package.json +3 -2
- package/dist/assets/AccessTab-ltWQiPGn.js +0 -1
- package/dist/assets/AgentFilesTab-DKg-5AOZ.js +0 -3
- package/dist/assets/AnomaliesTab-Dshz0Xdo.js +0 -1
- package/dist/assets/AuditTab-DZViPs0S.js +0 -1
- package/dist/assets/BridgeTab-CULepdP_.js +0 -1
- package/dist/assets/ChatDefaultsTab-BW8xCDPC.js +0 -1
- package/dist/assets/FeedbacksTab-CtKRbyAA.js +0 -1
- package/dist/assets/FilesTab-CmzQqlbZ.js +0 -1
- package/dist/assets/GroupsTab-C4hW_HZp.js +0 -1
- package/dist/assets/InstancesTab-BScBfWJZ.js +0 -1
- package/dist/assets/IntegrationsTab-BoN5nv7u.js +0 -1
- package/dist/assets/KpiTab-CZk6V7_p.js +0 -1
- package/dist/assets/PreferencesTab-C6_BZOL8.js +0 -1
- package/dist/assets/ProjectPage-D0_yFA88.js +0 -1
- package/dist/assets/PromptInjectionsTab-BToYYWRN.js +0 -4
- package/dist/assets/RolesTab-Dqf82Nw4.js +0 -1
- package/dist/assets/ScheduledTab-DgYEuqzx.js +0 -1
- package/dist/assets/ServiceAccountsTab-BuxSQV5z.js +0 -1
- package/dist/assets/SubAgentReportsTab-CbhBlx3_.js +0 -1
- package/dist/assets/ThemeShowroom-Bq3JZseY.js +0 -1
- package/dist/assets/TracesTab-BYz48MmX.js +0 -1
- package/dist/assets/UsersTab-CRl1CgUo.js +0 -1
- package/dist/assets/VoiceTab-D9o7TRAg.js +0 -1
- package/dist/assets/api-CKGeK7QS.js +0 -44
- package/dist/assets/button-HWWS6bgL.js +0 -1
- package/dist/assets/chevrons-up-down-AQ82L9UQ.js +0 -1
- package/dist/assets/dispatchErrorInfo-cGLdZODI.js +0 -1
- package/dist/assets/dist-BVlixrts.js +0 -1
- package/dist/assets/index-0DcZwf39.css +0 -1
- package/dist/assets/index-BZLPehFE.js +0 -327
- package/dist/assets/mermaid-GHXKKRXX-vvzO9QCP.js +0 -1
- package/dist/assets/roleDescriptions-B2IUxsB1.js +0 -1
- package/dist/assets/x-CZJSCjdP.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,$W as i,AW as a,BG as o,BU as s,BW as c,CW as l,DW as u,E as d,EW as ee,FG as f,GG as p,GW as m,HG as te,HW as ne,IG as re,JG as ie,JU as ae,JW as oe,KG as se,KU as ce,KW as le,LG as ue,MW as h,NG as de,NW as fe,OW as pe,PG as me,PW as g,QU as he,RG as ge,SW as _e,TW as ve,UG as ye,UW as be,VG as xe,VW as Se,WG as Ce,WW as we,XU as Te,XW as Ee,YU as De,ZU as Oe,_q as _,aG as ke,aW as Ae,bW as je,bq as Me,cW as Ne,dG as Pe,eG as Fe,eW as Ie,fG as Le,fq as v,iG as Re,iW as ze,jW as y,kW as Be,lG as Ve,lW as He,mG as Ue,nG as We,nW as Ge,oG as Ke,oW as qe,pG as Je,qG as Ye,qU as Xe,qW as Ze,rG as Qe,rW as $e,sG as b,sW as et,t as x,tG as tt,tW as nt,uG as rt,uq as it,wW as S,xW as at,yW as ot,zG as st,zW as ct}from"./api-DfVtzU1G.js";import{t as lt}from"./list-CR2YIdia.js";import{t as C}from"./button-BWdRKrS3.js";import{At as ut,Cn as dt,Dt as ft,Fn as pt,Ft as mt,Ht as ht,It as gt,Jn as w,Lt as T,Mt as _t,Nt as vt,On as yt,Ot as bt,Pt as xt,Rt as St,Tn as Ct,Xt as E,Yn as D,Yt as O,Zt as k,_t as wt,ct as A,dt as j,ft as Tt,gt as Et,ht as Dt,jt as Ot,kn as kt,kt as At,lt as M,mt as jt,pn as Mt,pt as Nt,st as N,tt as Pt,ut as P,vn as Ft}from"./index-B0MXmi3m.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-CVSQWo7b.js";import{t as Bt}from"./FilterBar-CJwP10CI.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt,u as z}from"./TimezoneCombobox-DSIM9YOb.js";var Jt=d(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Yt=d(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),B=t(e(),1),V=n();function H(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt({value:e,onChange:t}){let n=Ht(e),r=(0,B.useMemo)(()=>new Date,[]),[i,o]=(0,B.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,B.useState)(!1),l=(0,B.useMemo)(()=>H(v()),[]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{month:`long`,year:`numeric`}),[]),d=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=L(i.year,i.month),f=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(z(e,n,r,i,a)),te=(e,t,n)=>{o({year:e,month:t}),m(e,t,n,f,p)},ne=e=>{let t=new Date(i.year,i.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},re=n===null?fe():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,V.jsxs)(O,{modal:!0,open:s,onOpenChange:c,children:[(0,V.jsx)(k,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":g(),children:[(0,V.jsx)(Jt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,V.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,V.jsxs)(E,{align:`start`,className:`oc-dtp__pop`,children:[(0,V.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":h(),onClick:()=>ne(-1),children:(0,V.jsx)(D,{size:15,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":y(),onClick:()=>ne(1),children:(0,V.jsx)(w,{size:15,"aria-hidden":!0})})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,V.jsxs)(N,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,V.jsx)(P,{size:`sm`,"aria-label":a(),children:(0,V.jsx)(j,{})}),(0,V.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,V.jsx)(M,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,V.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,V.jsxs)(N,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,V.jsx)(P,{size:`sm`,"aria-label":Be(),children:(0,V.jsx)(j,{})}),(0,V.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,V.jsx)(M,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function U(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Zt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Qt(e){let t=new Map;for(let n of e){let e=U(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function $t(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Zt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function tn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=v(),c=(0,B.useMemo)(()=>Qt(e),[e]),u=(0,B.useMemo)(()=>en(s),[s]),d=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),f=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),p=new Date,m=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},te=t===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,V.jsxs)(`div`,{className:`oc-cal`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":_e(),onClick:()=>m(-1),children:(0,V.jsx)(D,{})}),(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":at(),onClick:()=>m(1),children:(0,V.jsx)(w,{})}),(0,V.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:p.getFullYear(),month:p.getMonth()}),children:l()})]}),(0,V.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,V.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,V.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:ve()}),(0,V.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:S()})]})]}),t===`month`?(0,V.jsx)(an,{cursor:n,byDay:c,weekdays:u,timeFmt:f,now:p,onEventClick:a}):(0,V.jsx)(on,{year:n.year,byDay:c,monthShortFmt:ee,now:p,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,V.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,V.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Zt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,V.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,V.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,V.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,V.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,V.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,V.jsx)(`span`,{className:`oc-cal__more`,children:je({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,V.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=$t(t,e,o),c=L(e,o);return(0,V.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,V.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,V.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,V.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var sn={h:36e5,min:6e4,s:1e3,ms:1};function cn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*sn[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var ln=new Map;function q(e){let t=ln.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return ln.set(e,n),n}function J(e,t){if(t!==null){let n=q(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function Y(e,t,n,r,i,a){if(a===null||q(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=J(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function X(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=J(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=Y(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=Y(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Z=`crons`;function un(e,t){return`${e}\u0000${t}`}function dn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=un(a.instanceName,e.id);i.set(o,a);let s=Wt(e)!==`active`,c=X(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Z,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var Q={minutes:6e4,hours:36e5,days:864e5};function $(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Kt(e)){case`ok`:return(0,V.jsx)(T,{variant:`secondary`,children:Ze()});case`error`:return(0,V.jsx)(T,{variant:`destructive`,children:m()});case`running`:return(0,V.jsx)(T,{variant:`outline`,children:we()});case`other`:return(0,V.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=_(x.scheduled.listMyCrons),t=_(x.scheduled.getCronDetail),n=_(x.scheduled.listCronRuns),a=_(x.scheduled.updateCron),l=_(x.scheduled.removeCron),d=_(x.scheduled.runCronNow),h=St(),fe=Me(x.me.getMe,{host:Pt})?.timezone,[g,_e]=(0,B.useState)(null),[ve,je]=(0,B.useState)(!1),[y,Be]=(0,B.useState)(!1),[S,at]=(0,B.useState)(null),[w,E]=(0,B.useState)(null),[D,O]=(0,B.useState)(null),[k,L]=(0,B.useState)(null),[Ht,Kt]=(0,B.useState)(!1),[z,H]=(0,B.useState)(Ut),[U,Zt]=(0,B.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Qt=e=>{localStorage.setItem(`oc.sched.view`,e),Zt(e)},[$t,en]=(0,B.useState)(`month`),[W,an]=(0,B.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,B.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,z)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,z]),sn=(0,B.useMemo)(()=>$t===`year`?nn(W.year):tn(W.year,W.month),[$t,W]),cn=(0,B.useMemo)(()=>dn(on,sn.startMs,sn.endMs),[on,sn]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,B.useCallback)(async()=>{je(!0),Be(!1);try{_e(await e({}))}catch{Be(!0)}finally{je(!1)}},[e]);(0,B.useEffect)(()=>{K()},[K]);let ln=(0,B.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),q=(0,B.useRef)(null);(0,B.useEffect)(()=>{g!==null&&q.current!==null&&q.current.scrollIntoView({block:`center`})},[g]);let J=(0,B.useMemo)(()=>new Intl.DateTimeFormat(v(),{dateStyle:`medium`,timeStyle:`short`}),[]),Y=async(e,t,n)=>{at(e);try{await t(),h.success(n),await K()}catch(e){h.toast({variant:`error`,title:b({code:$(e)})})}finally{at(null)}},X=(0,B.useRef)(0),Z=(0,B.useRef)(0),un=async(e,t)=>{if(t.id===null)return;let r=++X.current;O({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==X.current)return;O({name:t.name??t.id,entries:i})}catch(e){if(r!==X.current)return;O(null),h.toast({variant:`error`,title:b({code:$(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Z.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%Q.days===0?(s=String(e/Q.days),c=`days`):e%Q.hours===0?(s=String(e/Q.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/Q.minutes))),c=`minutes`))}if(r!==Z.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Z.current)return;L(null),h.toast({variant:`error`,title:b({code:$(e)})})}},mn=async()=>{if(k===null)return;let e={};if(k.nameDirty&&k.name.trim()===``||k.messageDirty&&k.hasMessage&&k.message.trim()===``){h.toast({variant:`error`,title:ce()});return}if(k.nameDirty&&k.name.trim()!==``&&(e.name=k.name.trim()),k.scheduleDirty){if(k.scheduleKind===`cron`&&k.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:k.cronExpr.trim(),...k.tz.trim()===``?{}:{tz:k.tz.trim()}};else if(k.scheduleKind===`every`){let t=Number(k.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*Q[k.everyUnit])})}else if(k.scheduleKind===`at`&&k.at!==``){let t=Date.parse(k.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(k.scheduleDirty&&e.schedule===void 0){h.toast({variant:`error`,title:Xe()});return}if(k.messageDirty&&k.hasMessage&&k.message.trim()!==``&&(e.message=k.message.trim()),Object.keys(e).length===0){L(null);return}let t=Z.current;Kt(!0);try{await a({instanceName:k.instanceName,jobId:k.jobId,patch:e}),h.success(qe()),t===Z.current&&L(null),await K()}catch(e){h.toast({variant:`error`,title:b({code:$(e)})})}finally{Kt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:ie()}),(0,V.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":pe(),children:[(0,V.jsx)(C,{variant:U===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":u(),title:u(),"aria-pressed":U===`list`,onClick:()=>Qt(`list`),children:(0,V.jsx)(lt,{})}),(0,V.jsx)(C,{variant:U===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ee(),title:ee(),"aria-pressed":U===`calendar`,onClick:()=>Qt(`calendar`),children:(0,V.jsx)(Jt,{})})]}),(0,V.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:ve,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,V.jsx)(dt,{size:14,"aria-hidden":!0}),Ye()]})]}),g!==null&&hn>0?(0,V.jsxs)(Bt,{q:z.q,onQChange:e=>H(t=>({...t,q:e})),searchPlaceholder:ne(),onReset:()=>H(Ut),canReset:Gt(z),children:[(0,V.jsxs)(N,{value:z.state,onValueChange:e=>H(t=>({...t,state:e})),children:[(0,V.jsx)(P,{size:`sm`,className:`w-40`,children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`all`,children:Se()}),(0,V.jsx)(M,{value:`active`,children:me()}),(0,V.jsx)(M,{value:`paused`,children:f()}),(0,V.jsx)(M,{value:`auto-disabled`,children:de()})]})]}),(0,V.jsxs)(N,{value:z.result,onValueChange:e=>H(t=>({...t,result:e})),children:[(0,V.jsx)(P,{size:`sm`,className:`w-40`,children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`all`,children:c()}),(0,V.jsx)(M,{value:`ok`,children:Ze()}),(0,V.jsx)(M,{value:`error`,children:m()}),(0,V.jsx)(M,{value:`running`,children:we()}),(0,V.jsx)(M,{value:`none`,children:be()})]})]})]}):null,g===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ve,children:y?se():it()}):U===`calendar`?(0,V.jsxs)(V.Fragment,{children:[y?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,V.jsx)(rn,{events:cn.events,mode:$t,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:G,footnote:ot()})]}):(0,V.jsxs)(V.Fragment,{children:[y?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,g.map(e=>{let t=e.jobs.filter(e=>Vt(e,z)),n=Gt(z)&&e.jobs.length>0&&t.length===0;return(0,V.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,V.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,V.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ye({code:e.error})}):e.jobs.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):n?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}):(0,V.jsxs)(zt,{children:[(0,V.jsx)(It,{children:(0,V.jsxs)(Rt,{children:[(0,V.jsx)(F,{children:xe()}),(0,V.jsx)(F,{children:o()}),(0,V.jsx)(F,{children:st()}),(0,V.jsx)(F,{children:ge()}),(0,V.jsx)(F,{children:ue()}),(0,V.jsx)(F,{children:oe()}),(0,V.jsx)(F,{children:He()})]})}),(0,V.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=S===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,V.jsxs)(Rt,{ref:t.id!==null&&t.id===ln?q:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,V.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??re()}),(0,V.jsx)(I,{children:(0,V.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,V.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,V.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ft(t.schedule),n=e===null?null:bt(e);return n===null?null:(0,V.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,V.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:J.format(t.nextRunAtMs)}),(0,V.jsx)(I,{children:Wt(t)===`auto-disabled`?(0,V.jsx)(T,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${J.format(t.autoDisabledAtMs)}`}`,children:de()}):Wt(t)===`active`?(0,V.jsx)(T,{variant:`secondary`,children:me()}):Wt(t)===`paused`?(0,V.jsx)(T,{variant:`outline`,children:f()}):(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,V.jsxs)(I,{children:[(0,V.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,V.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??Ue(),children:le()}):null]}),(0,V.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,V.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:S!==null,onClick:()=>void Y(r,async()=>{let n=await d({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Ke()),children:(0,V.jsx)(Mt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?Pe():rt(),"aria-label":R(t)===`pause`?Pe():rt(),disabled:S!==null,onClick:()=>void Y(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?ke():Re()),children:R(t)===`pause`?(0,V.jsx)(kt,{size:14,"aria-hidden":!0}):(0,V.jsx)(Ct,{size:14,"aria-hidden":!0})}):null,s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ne(),"aria-label":Ne(),disabled:S!==null,onClick:()=>void pn(e.instanceName,t),children:(0,V.jsx)(yt,{size:14,"aria-hidden":!0})}):null,s?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:et(),"aria-label":et(),disabled:S!==null,onClick:()=>void un(e.instanceName,t),children:(0,V.jsx)(Yt,{size:14,"aria-hidden":!0})}):null,o?(0,V.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ve(),"aria-label":Ve(),disabled:S!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,V.jsx)(Ft,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()})]},e.instanceName)}),hn>0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:s()}):null]}),(0,V.jsx)(At,{open:w!==null,onOpenChange:e=>{e||E(null)},children:(0,V.jsxs)(_t,{children:[(0,V.jsxs)(mt,{children:[(0,V.jsx)(gt,{children:We()}),(0,V.jsx)(vt,{children:tt({name:w?.name??``})})]}),(0,V.jsxs)(xt,{children:[(0,V.jsx)(Ot,{children:Fe()}),(0,V.jsx)(ut,{onClick:()=>{let e=w;E(null),e!==null&&Y(`${e.instanceName}:${e.jobId}`,()=>l({instanceName:e.instanceName,jobId:e.jobId}),Qe())},children:i()})]})]})}),(0,V.jsx)(Tt,{open:D!==null,onOpenChange:e=>{e||(X.current++,O(null))},children:(0,V.jsxs)(Nt,{style:{maxWidth:640},children:[(0,V.jsx)(Et,{children:(0,V.jsx)(wt,{children:Ae({name:D?.name??``})})}),D?.entries===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):D!==null&&D.entries.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}):D===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:D.entries.map((e,t)=>(0,V.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,V.jsx)(fn,{status:e.status}),(0,V.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?J.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,V.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Ee({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,V.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,V.jsx)(Tt,{open:k!==null,onOpenChange:e=>{e||(Z.current++,L(null))},children:(0,V.jsxs)(Nt,{className:`oc-cronedit`,children:[(0,V.jsxs)(Et,{children:[(0,V.jsx)(wt,{children:$e()}),(0,V.jsx)(jt,{children:Ge()})]}),k===null?null:k.loading?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:it()}):(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:xe()}),(0,V.jsx)(ht,{value:k.name,maxLength:200,onChange:e=>L({...k,name:e.target.value,nameDirty:!0})})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:nt()}),(0,V.jsxs)(N,{value:k.scheduleKind,onValueChange:e=>L({...k,scheduleKind:e,scheduleDirty:!0}),children:[(0,V.jsx)(P,{children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`cron`,children:Ie()}),(0,V.jsx)(M,{value:`every`,children:r()}),(0,V.jsx)(M,{value:`at`,children:he()})]})]}),k.scheduleKind===`cron`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(ht,{value:k.cronExpr,onChange:e=>L({...k,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,V.jsx)(qt,{value:k.tz,onChange:e=>L({...k,tz:e,scheduleDirty:!0}),fallbackTz:fe??void 0})]}):k.scheduleKind===`every`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(ht,{type:`number`,min:1,value:k.everyValue,onChange:e=>L({...k,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,V.jsxs)(N,{value:k.everyUnit,onValueChange:e=>L({...k,everyUnit:e,scheduleDirty:!0}),children:[(0,V.jsx)(P,{style:{maxWidth:160},children:(0,V.jsx)(j,{})}),(0,V.jsxs)(A,{children:[(0,V.jsx)(M,{value:`minutes`,children:Oe()}),(0,V.jsx)(M,{value:`hours`,children:Te()}),(0,V.jsx)(M,{value:`days`,children:De()})]})]})]}):(0,V.jsx)(Xt,{value:k.at,onChange:e=>L({...k,at:e,scheduleDirty:!0})})]}),k.hasMessage?(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Je()}),(0,V.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:k.message,onChange:e=>L({...k,message:e.target.value,messageDirty:!0})})]}):null]}),(0,V.jsxs)(Dt,{children:[(0,V.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:Fe()}),(0,V.jsxs)(C,{onClick:()=>void mn(),disabled:k===null||k.loading||Ht,children:[Ht?(0,V.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ae()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -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,BB as ee,CB as a,CV as te,DB as o,DV as ne,EB as s,EV as re,FB as ie,GB as ae,HB as oe,IB as se,JB as ce,KB as le,LB as ue,MB as de,NB as fe,OB as c,PB as pe,QB as me,RB as he,SB as ge,SV as _e,TB as l,TV as ve,UB as ye,VB as be,WB as xe,XB as Se,YB as Ce,ZB as we,_B as u,_V as Te,_q as Ee,aV as De,bB as Oe,bV as ke,bq as d,cB as f,cV as Ae,dB as p,dV as je,eV as Me,fB as m,fV as Ne,gB as h,gV as Pe,hB as g,hV as Fe,iV as Ie,jB as Le,kB as _,lB as v,lV as Re,mB as y,mV as ze,nV as Be,oV as Ve,pB as b,pV as He,qB as Ue,rV as We,sB as x,sV as Ge,t as S,tV as Ke,uB as C,uV as qe,vB as w,vV as Je,wB as T,wV as Ye,xB as E,xV as D,yB as O,yV as Xe,yq as k,zB as Ze}from"./api-DfVtzU1G.js";import{r as Qe}from"./dist-D8270q9m.js";import{t as A}from"./button-BWdRKrS3.js";import{$n as $e,Ht as j,Jn as et,Lt as M,Qn as tt,Rt as nt,Wn as N,Xn as P,Z as rt,_t as F,b as it,ct as I,dt as L,ft as R,gt as z,ht as B,lt as V,mt as H,pt as at,st as U,ut as W,vt as G,yt as K}from"./index-B0MXmi3m.js";import{t as ot}from"./FilterBar-CJwP10CI.js";import{t as st}from"./DataTableShell-REGK6Dqj.js";import{t as ct}from"./roleDescriptions-DBqNfMhe.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>b(),days:null},{value:`30`,label:()=>m(),days:30},{value:`90`,label:()=>p(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=$e({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[a,o]=(0,q.useState)(X),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),ge=d(S.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:i===X?void 0:i===`disabled`}}),l=d(S.apiKeys.listKeys,{}),u=d(S.apiKeys.listRoles,{}),Oe=k(S.apiKeys.createServiceAccount),f=k(S.apiKeys.updateServiceAccount),p=k(S.apiKeys.deleteServiceAccount),m=Ee(S.apiKeys.mintApiKey),h=k(S.apiKeys.revokeApiKey),g=rt(),_=nt(),v=n!==``||a!==X||i!==X;function y(){o(X),t({search:{},replace:!0})}let[b,x]=(0,q.useState)(!1),[C,w]=(0,q.useState)(Z),[T,E]=(0,q.useState)(null),[O,N]=(0,q.useState)(new Set),[P,F]=(0,q.useState)(null),R=(0,q.useRef)(!1),[z,B]=(0,q.useState)(new Set),[H,at]=(0,q.useState)({}),[G,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function Q(e){N(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{T?(await f({serviceAccountId:T,name:C.name,roleKey:C.roleKey,description:C.description}),_.success(ae())):await Oe({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),w(Z),E(null),x(!1)}catch(e){_.error(T?le():Ue(),e)}}function pt(e){w({name:e.name,roleKey:e.roleKey,description:e.description??``}),E(e._id),x(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=H[e._id]??`never`,n=lt.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 m({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(xe(),e)}finally{R.current=!1,F(null)}}async function $(e){if(await g({title:ye(),description:(0,J.jsxs)(J.Fragment,{children:[oe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,be(),` `,(0,J.jsx)(`strong`,{children:ee()}),` `,Ze()]}),confirmWord:e.name,confirmLabel:he(),destructive:!0}))try{await p({serviceAccountId:e._id}),_.success(ue(),e.name)}catch(e){_.error(se(),e)}}async function ht(e){if(await g({title:ie(),description:(0,J.jsxs)(J.Fragment,{children:[pe(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,fe()]}),confirmLabel:de(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(Le(),e)}finally{B(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:ne()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:re(),onReset:y,canReset:v,children:[(0,J.jsxs)(U,{value:a,onValueChange:o,children:[(0,J.jsx)(W,{size:`sm`,className:`w-40`,children:(0,J.jsx)(L,{placeholder:ve()})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(V,{value:X,children:Ye()}),(u??[]).map(e=>(0,J.jsx)(V,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(U,{value:i,onValueChange:c,children:[(0,J.jsx)(W,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{})}),(0,J.jsxs)(I,{children:[(0,J.jsx)(V,{value:X,children:te()}),(0,J.jsx)(V,{value:`active`,children:_e()}),(0,J.jsx)(V,{value:`disabled`,children:D()})]})]})]}),(0,J.jsx)(st,{title:ke(),rows:ge,addLabel:Xe(),onAdd:()=>{w(Z),E(null),x(!0)},emptyHint:Je(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[...(e.managedBy??null)===null?[{label:ze(),onSelect:()=>pt(e)},{label:Te(),onSelect:()=>void mt(e)}]:[],{label:O.has(e._id)?Pe():Fe(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:He(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?Ne():je(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(et,{})})},{header:qe(),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:Re(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(M,{variant:`secondary`,children:e.roleKey})},{header:Ae(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:D()}):(0,J.jsx)(M,{variant:`outline`,children:_e()})},{header:Ge(),cell:e=>(0,J.jsxs)(U,{value:H[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(W,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{})}),(0,J.jsx)(I,{children:lt.map(e=>(0,J.jsx)(V,{value:e.value,children:e.label()},e.value))})]})},{header:Ve(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?De():Ie({count:t})})}}]}),(0,J.jsx)(it,{open:b,onOpenChange:e=>{x(e),e||E(null)},title:T?We():Me(),description:T?Be():r(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:T?Ke():me(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:we()}),(0,J.jsx)(j,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Se()}),(0,J.jsxs)(U,{value:C.roleKey||void 0,onValueChange:e=>w({...C,roleKey:e}),children:[(0,J.jsx)(W,{className:`w-full`,children:(0,J.jsx)(L,{placeholder:Ce()})}),(0,J.jsx)(I,{children:(u??[]).map(e=>(0,J.jsxs)(V,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===C.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:ce()}),(0,J.jsx)(j,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:G,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[i(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:c()}),(0,J.jsx)(`th`,{children:o()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:l()}),(0,J.jsx)(`th`,{children:T()}),(0,J.jsx)(`th`,{children:a()}),(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)(M,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:K(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?ge():E()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(R,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(at,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(F,{children:Oe()}),(0,J.jsx)(H,{children:O({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 i(),"aria-label":u(),children:[n?(0,J.jsx)(P,{}):(0,J.jsx)(N,{}),n?h():g()]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(A,{onClick:()=>{r(!1),t()},children:y()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?C():K(e)}function mt(e){return e===null?`—`:G(e)}function $(e){return e.disabled?(0,J.jsx)(M,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(M,{variant:`outline`,children:f()}):(0,J.jsx)(M,{variant:`outline`,children:x()})}export{Q as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ap as r,Bp as i,Cp as a,Dp as o,Ep as s,Fp as c,Gp as l,Hp as u,Ip as d,Kp as f,Lp as p,Mp as m,Np as ee,Op as h,Pp as g,Rp as _,Sp as v,Tp as y,Up as b,Vp as x,Wp as S,_p as C,bp as w,bq as T,cp as E,dp as D,fp as O,gp as k,hp as A,jp as j,kp as M,lp as N,mp as P,pp as F,t as I,up as L,vp as R,wp as z,xp as B,yp as V,yq as H,zp as U}from"./api-DfVtzU1G.js";import{t as W}from"./button-BWdRKrS3.js";import{Z as G,yt as K}from"./index-B0MXmi3m.js";import{t as q}from"./DataTableShell-REGK6Dqj.js";var J=t(e(),1),Y=n(),X={hung:()=>M(),wrong_result:()=>h(),error:()=>o(),other:()=>s()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=H(I.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,y({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),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`?v():B()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:w()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:V(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?C():R()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[k({count:t.children.length}),t.childrenTruncated?` ${A()}`:``,t.textTruncated?` ${P()}`:``]}),(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:O()}),(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:D()}),(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=T(I.subAgentReports.listForAdmin,{}),t=H(I.subAgentReports.readReport),n=H(I.subAgentReports.deleteReport),a=G(),[o,s]=(0,J.useState)(null),[h,v]=(0,J.useState)({});async function y(e){if(o===e._id){s(null);return}if(!h[e._id]){let n=await t({reportId:e._id});v(t=>({...t,[e._id]:n}))}s(e._id)}async function C(e){await a({title:L(),description:N(),confirmLabel:E(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,Y.jsx)(`strong`,{children:b()}),` `,u()]}),(0,Y.jsx)(q,{title:f(),rows:e,emptyHint:l(),isExpanded:e=>o===e._id&&!!h[e._id],renderExpanded:e=>h[e._id]?(0,Y.jsx)($,{data:h[e._id]}):null,columns:[{header:x(),cell:e=>K(e.at),sort:e=>e.at},{header:i(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:U(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:_(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${c({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:p(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:g()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ee()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?j():m(),onSelect:()=>void y(e)},{label:r(),onSelect:()=>void C(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$H as r,AH as i,AU as a,BH as o,CH as s,CU as c,DH as l,DU as u,EH as d,EU as f,FH as p,FU as m,GH as h,HH as g,IH as _,IU as v,JH as y,KH as ee,LH as b,MH as te,MU as ne,NH as re,NU as ie,OH as ae,OU as oe,PH as x,PU as se,QH as ce,RH as le,SH as S,SU as ue,TH as de,TU as fe,UH as pe,VH as me,WH as he,XH as ge,YH as _e,ZH as ve,_H as ye,_U as be,_q as xe,aU as Se,ap as Ce,bH as we,bU as Te,bq as C,cU as Ee,cq as De,dU as Oe,eU as ke,fU as Ae,gH as je,gU as Me,hH as Ne,hU as Pe,iU as Fe,ip as Ie,jH as Le,jU as Re,kH as ze,kU as Be,lU as Ve,mH as He,mU as Ue,nU as We,oU as Ge,op as w,oq as Ke,pU as qe,qH as Je,r as Ye,rU as Xe,sU as Ze,sp as T,sq as Qe,t as E,tU as $e,uU as et,vH as D,vU as tt,wH as nt,wU as rt,xH as it,xU as at,yH as ot,yU as st,yq as O,zH as ct}from"./api-DfVtzU1G.js";import{t as k}from"./x-CrZwGtLz.js";import{t as A}from"./button-BWdRKrS3.js";import{$ as lt,Gt as j,Hn as M,Ht as N,Jt as ut,Kt as dt,Lt as P,Un as ft,Ut as pt,Wt as mt,Xn as F,ct as I,dt as L,et as ht,gn as R,lt as z,qt as B,st as V,tt as H,ut as U,xt as W}from"./index-B0MXmi3m.js";import{t as gt}from"./localePickerView-C2RmOS86.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,t as St}from"./card-CdvSrnID.js";import{a as Ct,i as G,n as wt,o as K,r as q,t as Tt}from"./table-CVSQWo7b.js";import{t as Et}from"./TimeRangePicker-es8qiYT0.js";import{t as Dt}from"./FilterBar-CJwP10CI.js";import{t as Ot}from"./AdvancedFilter-DEwJUkfT.js";var J=t(e(),1),kt=.1,At=[248,248,248],jt=[24,24,24];function Mt(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 Nt(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 Pt(e,t,n){return Nt(e,t,n)>=kt}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(b());if(e.size>Lt)throw Error(_());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(x());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Mt(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(x());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);Pt(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?At:jt):It(e.data),p.putImageData(e,0,0)}let m=Pt(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(p())),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`?De():e===`dark`?Qe():Ke()}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:Ye(`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)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=C(E.charts.listMyCharts),r=O(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:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:f(),subtitle:fe(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?rt():n.via===`owner`?c():ue({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:at()}):null]})}function Qt(){let e=O(E.charts.importChart),[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(r())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(ve());return}let o;try{o=JSON.parse(i)}catch{s(r());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Se()}),(0,X.jsx)(N,{value:t,onChange:e=>n(e.target.value),placeholder:Fe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:We(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(R,{className:`size-4`}),$e(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:u,onClick:()=>void p(),children:ke()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ce()}):null]})]})}function $t({chart:e}){let t=xe(E.charts.setChartLogo),n=O(E.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function 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`?he():pe()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(R,{className:`size-4`}),t?me():g(),(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)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:ct()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:o()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:h()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=C(E.me.getMe,{host:H}),n=O(E.charts.addChartDomain),r=O(E.charts.removeChartDomain),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=a.trim();if(t!==``){c(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function m(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:te()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ae()}):f.map(e=>(0,X.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":l({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(N,{value:a,onChange:e=>o(e.target.value),placeholder:i(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void p(),children:ze()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Le()}),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=O(E.charts.updateChart),n=O(E.charts.deleteChart),[i,a]=(0,J.useState)(!1),[o,c]=(0,J.useState)(e.name),[l,u]=(0,J.useState)(()=>$(e.tokens)),[f,p]=(0,J.useState)(e.tokens.bpm??0),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(!1);function v(){c(e.name),u($(e.tokens)),p(e.tokens.bpm??0),h(null),a(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(l)}catch{h(r());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;f>0?e.bpm=f:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:v,children:Je()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:ee()})]})})]}),i?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:nt()}),(0,X.jsx)(N,{value:o,onChange:e=>c(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:w()}),(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:f,onChange:e=>p(Number(e.target.value)),"aria-label":w()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:f===0?Ce():`${f} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ie()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:s()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:g,onClick:()=>void y(),children:d()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:de()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=C(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:_e()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()}):(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=O(E.charts.addChartToGroupPool),r=O(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 c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?qe():e.kind===`custom`&&e.scope===`personal`?D():Ue()}),e.isGlobalDefault?(0,X.jsx)(P,{variant:`default`,children:Ae()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:et()}),(a??[]).map(e=>(0,X.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ee({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(U,{size:`sm`,className:`w-56`,children:(0,X.jsx)(L,{placeholder:Ve()})}),(0,X.jsx)(I,{children:s.map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Oe()}):null]})]})}function an({chart:e}){let t=O(E.charts.promoteChartToCommon),n=O(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ye():D()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ot({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:je()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ne()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=O(E.admin.setDefaultThemeMode),i=O(E.admin.setDefaultLocale),o=O(E.charts.setDefaultChart),s=C(E.charts.listChartsAdmin),c=C(E.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(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:Te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:f()}),ht.map(e=>(0,X.jsx)(A,{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)(A,{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:tt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(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:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(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:it()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()}):(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:v()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:gt().map(e=>(0,X.jsx)(A,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]})]})}function sn(){let e=C(E.me.getMe,{host:H}),t=lt(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,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.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:Re()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(P,{children:`Default`}),(0,X.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(P,{variant:`outline`,children:`Outline`}),(0,X.jsx)(P,{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)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(U,{className:`w-56`,children:(0,X.jsx)(L,{placeholder:`Select…`})}),(0,X.jsxs)(I,{children:[(0,X.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(W,{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)(Dt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(U,{size:`sm`,children:(0,X.jsx)(L,{})}),(0,X.jsxs)(I,{children:[(0,X.jsx)(z,{value:Z,children:`Toutes directions`}),(0,X.jsx)(z,{value:`inbound`,children:`inbound`}),(0,X.jsx)(z,{value:`outbound`,children:`outbound`}),(0,X.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(U,{size:`sm`,children:(0,X.jsx)(L,{})}),(0,X.jsxs)(I,{children:[(0,X.jsx)(z,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(z,{value:`info`,children:`info`}),(0,X.jsx)(z,{value:`warn`,children:`warn`}),(0,X.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Ot,{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)(Et,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(pt,{children:[(0,X.jsx)(ut,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(mt,{align:`start`,children:[(0,X.jsx)(dt,{children:`Actions`}),(0,X.jsx)(B,{}),(0,X.jsx)(j,{children:`Edit`}),(0,X.jsx)(j,{children:`Duplicate`}),(0,X.jsx)(B,{}),(0,X.jsx)(j,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(St,{className:`w-80`,children:[(0,X.jsxs)(_t,{children:[(0,X.jsx)(bt,{children:`Instance`}),(0,X.jsx)(xt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(yt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(vt,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Tt,{children:[(0,X.jsx)(Ct,{children:(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{className:`w-8`,children:(0,X.jsx)(W,{"aria-label":`select all`})}),(0,X.jsx)(G,{children:`Name`}),(0,X.jsx)(G,{children:`Mode`}),(0,X.jsx)(G,{className:`text-right`,children:`Status`}),(0,X.jsx)(G,{className:`w-8`})]})}),(0,X.jsx)(wt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(K,{children:[(0,X.jsx)(q,{children:(0,X.jsx)(W,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(q,{className:`font-medium`,children:e.n}),(0,X.jsx)(q,{children:(0,X.jsx)(P,{variant:`secondary`,children:e.m})}),(0,X.jsx)(q,{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)(q,{children:(0,X.jsx)(A,{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{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BT as r,Bu as i,GT as a,HT as o,Hu as s,JT as c,KT as l,LT as u,Lu as d,RT as f,Ru as p,UT as m,Uu as h,VT as g,Vu as _,WT as v,YT as y,qT as b,zT as x,zu as S}from"./api-DfVtzU1G.js";import{t as C}from"./button-BWdRKrS3.js";import{$t as w,Gn as T,Ht as E,Qt as D,Sn as O,en as k,tn as A,yt as j}from"./index-B0MXmi3m.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:c(),from:`now-15m`},{label:b(),from:`now-30m`},{label:l(),from:`now-1h`},{label:a(),from:`now-3h`},{label:v(),from:`now-6h`},{label:m(),from:`now-12h`},{label:o(),from:`now-24h`},{label:g(),from:`now-2d`},{label:r(),from:`now-7d`},{label:x(),from:`now-30d`},{label:f(),from:`now-90d`},{label:u(),from:`now-520w`}];function L(e){return j(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[a,o]=(0,M.useState)(``),c=F(e),[l,u]=(0,M.useState)(()=>z(c.from)),[f,m]=(0,M.useState)(()=>z(c.to));function g(t){if(t){let t=F(e);u(z(t.from)),m(z(t.to)),o(``)}r(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(l),n=B(f);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),x=B(l)!==null&&B(f)!==null;return(0,H.jsxs)(k,{open:n,onOpenChange:g,children:[(0,H.jsx)(A,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:h()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,H.jsx)(E,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:_()}),(0,H.jsx)(E,{type:`datetime-local`,value:f,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:i()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(O,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(E,{value:a,onChange:e=>o(e.target.value),placeholder:S(),"aria-label":p()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:d()}):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 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FW as r,IW as i,LW as a,RW as o}from"./api-DfVtzU1G.js";import{t as s}from"./chevrons-up-down-RHDK4dlM.js";import{Ht as c,Xn as l,Xt as u,Yt as d,Zt as f}from"./index-B0MXmi3m.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)(d,{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)(u,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(c,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:a(),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)(l,{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{$F as r,$O as i,AO as a,BF as o,BO as s,Bl as c,CO as l,DO as u,E as d,EO as f,FF as p,FO as m,GF as ee,GO as te,HF as h,HO as g,IF as _,IO as ne,JO as re,KF as ie,KO as ae,LF as v,LO as oe,MF as y,MO as se,NF as ce,NO as le,OO as ue,PF as b,PO as de,QF as x,QO as fe,RF as S,RO as pe,Rl as C,SO as me,TO as he,UF as w,UO as ge,VF as _e,VO as ve,WF as ye,WO as be,XO as xe,YO as Se,ZF as Ce,ZO as we,_I as Te,aI as Ee,bI as T,bO as E,bq as D,cI as O,dI as k,eI as A,ek as De,fI as j,gI as Oe,hI as ke,iI as Ae,jO as je,kO as Me,lI as M,mI as Ne,nI as N,nk as Pe,oI as P,pI as Fe,qO as Ie,rI as Le,sI as Re,t as F,tI as ze,tk as Be,uI as Ve,vI as He,wO as Ue,xI as We,xO as Ge,yI as Ke,yO as qe,yq as I,zF as Je,zO as Ye,zl as Xe}from"./api-DfVtzU1G.js";import{t as Ze}from"./x-CrZwGtLz.js";import{t as L}from"./button-BWdRKrS3.js";import{$n as Qe,Bn as $e,In as et,J as R,Lt as z,Qn as tt,U as nt,Vn as rt,Wn as it,X as B,Xn as at,Y as ot,_t as st,a as ct,bt as lt,ct as V,dt as H,ft as ut,gt as dt,i as ft,lt as U,mt as pt,o as mt,pt as ht,q as gt,s as _t,st as W,tt as vt,ut as G,yt as K}from"./index-B0MXmi3m.js";import{n as yt}from"./TimeRangePicker-es8qiYT0.js";import{t as bt}from"./FilterBar-CJwP10CI.js";import{t as xt}from"./AdvancedFilter-DEwJUkfT.js";import{t as St}from"./DataTableShell-REGK6Dqj.js";var Ct=d(`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`?N():n===`agent`?`${ze()} - ${r}`:e}function Tt(){let e=D(F.me.getMe,{host:vt})?.role===`admin`,t=D(F.deliveryTiming.getDeliveryStatus,{}),n=I(F.deliveryTiming.startDeliveryRecord),r=I(F.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:We()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:T()})]}),e?(0,J.jsx)(L,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?He():Ke()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(z,{variant:`secondary`,children:Te()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Oe({time:lt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Fe():Ne()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=D(F.deliveryTiming.listDeliverySessions,{}),n=I(F.deliveryTiming.deleteDeliverySessions),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=yt(c),m=c.to===`now`?1/0:p,ee=i.trim()!==``||o!==`all`||c!==Y,te=()=>{a(``),s(`all`),l(Y)},h=(0,q.useMemo)(()=>{if(t===void 0)return;let e=i.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,i,o,f,m]),g=e=>{let t=new Set((h??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:i,onQChange:a,searchPlaceholder:k(),timeRange:c,onTimeRangeChange:l,onReset:te,canReset:ee,children:(0,J.jsxs)(W,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(U,{value:`all`,children:Ve()}),(0,J.jsx)(U,{value:`active`,children:M()}),(0,J.jsx)(U,{value:`stopped`,children:O()})]})]})}),(0,J.jsx)(St,{title:j(),rows:h,emptyHint:ce(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?r():A(),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)($e,{size:15,"aria-hidden":!0})})},{header:Re(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:K(e.startedAt)})},{header:P(),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:K(e.stoppedAt)})},{header:Ee(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:Ae(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Le(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(z,{variant:`secondary`,children:M()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:O()})}],rowActions:e?e=>[{label:x(),variant:`destructive`,onSelect:()=>g([e.sessionId])}]:void 0,bulkActions:e?[{label:x(),variant:`destructive`,onSelect:e=>g(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=D(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(nt(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:Ce()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ke()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,y()]}),(0,J.jsxs)(L,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(at,{size:13,"aria-hidden":!0}):(0,J.jsx)(it,{size:13,"aria-hidden":!0}),t?b():p()]})]}),(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:ye()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:w()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:h()})]})}),(0,J.jsxs)(`tbody`,{children:[i(_e(),r.bridge),i(o(),r.A),i(Je(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]})}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:c()},{value:`principalType`,label:Xe()},{value:`direction`,label:`direction`},{value:`roleKey`,label:C()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=Qe({from:`/settings/traces`}),t=tt({from:`/settings/traces`}),n=e.limit,r=e.kind,o=e.statusClass??Q,c=e.principalType??Q,d=e.direction??Q,p=e.roleKey??Q,h=e.q??``,_=e.correlationId,v=ft(e.from,e.to),y=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:ce,to:b}=yt(v),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),_e=e=>void t({search:t=>({...t,limit:e})}),ye=e=>void t({search:t=>({...t,kind:e})}),Ce=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Te=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),Ee=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})}),O=e=>void t({search:t=>({...t,...mt(e)})}),k=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),A=D(F.observability.listEvents,{limit:n}),j=D(F.observability.listEvents,{limit:n,kind:r===Z?void 0:r,..._?{correlationId:_}:{},filter:{q:h||void 0,from:ce,to:b,statusClass:o===Q?void 0:o,principalType:c===Q?void 0:c,direction:d===Q?void 0:d,roleKey:p===Q?void 0:p,advanced:y.length>0?y:void 0}}),Oe=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])e.add(t.kind);return[...e].sort()},[A]),ke=(0,q.useMemo)(()=>{let e=new Set;for(let t of A??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[A]),Ae=h!==``||o!==Q||c!==Q||d!==Q||p!==Q||y.length>0||v.kind!==`relative`||v.from!==Nt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let Ne=x?A?.filter(e=>e.correlationId===x):j,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(gt,{value:N,onValueChange:e=>P(e),children:[(0,J.jsxs)(ot,{className:`w-full`,children:[(0,J.jsxs)(B,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(et,{size:13,"aria-hidden":!0}),ie()]}),(0,J.jsxs)(B,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),ee()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[Pe(),(0,J.jsx)(`strong`,{children:Be()}),De(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:i()})]}),(0,J.jsxs)(bt,{q:h,onQChange:Ce,searchPlaceholder:fe(),timeRange:v,onTimeRangeChange:O,onReset:M,canReset:Ae,children:[(0,J.jsxs)(W,{value:o,onValueChange:Te,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:we()})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(U,{value:Q,children:xe()}),At.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:c,onValueChange:Ee,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:Se()})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(U,{value:Q,children:re()}),jt.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:d,onValueChange:T,children:[(0,J.jsx)(G,{size:`sm`,className:`w-32`,children:(0,J.jsx)(H,{placeholder:Ie()})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(U,{value:Q,children:ae()}),Mt.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsxs)(W,{value:p,onValueChange:E,children:[(0,J.jsx)(G,{size:`sm`,className:`w-36`,children:(0,J.jsx)(H,{placeholder:te()})}),(0,J.jsxs)(V,{children:[(0,J.jsx)(U,{value:Q,children:be()}),ke.map(e=>(0,J.jsx)(U,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:r===Z?``:r,placeholder:ge(),"aria-label":ge(),onChange:e=>{let t=e.target.value.trim();ye(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:Oe.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(W,{value:String(n),onValueChange:e=>_e(Number(e)),children:[(0,J.jsx)(G,{size:`sm`,className:`w-28`,children:(0,J.jsx)(H,{})}),(0,J.jsx)(V,{children:kt.map(e=>(0,J.jsx)(U,{value:String(e),children:g({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:y,onChange:k}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:ve(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[s(),(0,J.jsx)(`code`,{children:$(x)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:Ye()})]})}):null,(0,J.jsx)(St,{title:pe(),rows:Ne,emptyHint:x?oe():ne(),columns:[{header:m(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:K(e.at)})},{header:de(),sort:e=>e.kind,cell:e=>(0,J.jsx)(z,{variant:`secondary`,children:e.kind})},{header:le(),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":se(),children:`✓`})}},{header:je(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(z,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:a(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(z,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:Me(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(z,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ue(),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:u(),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:f(),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:he(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:Ue(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:l(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:me()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:C,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)(ut,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ht,{className:`max-w-lg`,children:[(0,J.jsxs)(dt,{children:[(0,J.jsxs)(st,{className:`oc-traces__meta-title`,children:[Ge(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(z,{variant:`outline`,children:E()})]}),(0,J.jsx)(pt,{children:qe()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.oc-trash{height:100%;padding:24px clamp(16px,5vw,48px);overflow-y:auto}.oc-trash__body{flex-direction:column;gap:16px;max-width:860px;margin:0 auto;display:flex}.oc-trash__head{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;display:flex}.oc-trash__heading{align-items:center;gap:8px;margin:0;font-size:1.25rem;font-weight:600;display:flex}.oc-trash__hint,.oc-trash__empty{color:var(--muted-foreground);margin:0;font-size:.85rem}.oc-trash__list{border:1px solid var(--border);border-radius:var(--radius-lg,.75rem);flex-direction:column;margin:0;padding:0;list-style:none;display:flex;overflow:hidden}.oc-trash__item{border-bottom:1px solid var(--border);flex-wrap:wrap;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;display:flex}.oc-trash__item:last-child{border-bottom:0}.oc-trash__meta{flex-direction:column;flex:240px;gap:2px;min-width:0;display:flex}.oc-trash__title{text-overflow:ellipsis;white-space:nowrap;font-weight:500;overflow:hidden}.oc-trash__dates{color:var(--muted-foreground);font-size:.8rem}.oc-trash__owner{color:var(--foreground)}.oc-trash__actions{flex-shrink:0;gap:6px;display:flex}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{$w as t,BC as n,GC as r,HC as i,JC as a,KC as o,LC as s,RC as c,UC as l,VC as u,WC as d,YC as f,qC as p,t as m,vO as h,yq as g,zC as _}from"./api-DfVtzU1G.js";import{t as v}from"./use_paginated_query-DSw-EOJL.js";import{t as y}from"./button-BWdRKrS3.js";import{Cn as b,Z as x,h as S,m as C,vn as w,vt as T}from"./index-B0MXmi3m.js";var E=e(),D=50;function O({status:e,loadMore:t}){return e!==`CanLoadMore`&&e!==`LoadingMore`?null:(0,E.jsx)(y,{variant:`outline`,size:`sm`,className:`self-start`,disabled:e===`LoadingMore`,onClick:()=>t(50),children:s()})}function k({items:e,onRestore:n,onPurge:a}){let s=x();return(0,E.jsx)(`ul`,{className:`oc-trash__list`,children:e.map(e=>(0,E.jsxs)(`li`,{className:`oc-trash__item`,children:[(0,E.jsxs)(`div`,{className:`oc-trash__meta`,children:[(0,E.jsx)(`span`,{className:`oc-trash__title`,children:e.title||t()}),(0,E.jsxs)(`span`,{className:`oc-trash__dates`,children:[e.owner===void 0?null:(0,E.jsxs)(`span`,{className:`oc-trash__owner`,children:[e.owner,` · `]}),o({date:T(e.trashedAt)}),e.purgeAfter===null?null:` · ${r({date:C(e.purgeAfter)})}`]})]}),(0,E.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,E.jsxs)(y,{variant:`outline`,size:`sm`,onClick:()=>void n(e._id),children:[(0,E.jsx)(b,{}),` `,d()]}),(0,E.jsxs)(y,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:async()=>{await s({title:i(),description:u(),confirmLabel:l(),destructive:!0})&&await a(e._id)},children:[(0,E.jsx)(w,{}),` `,l()]})]})]},e._id))})}function A(){let{results:e,status:t,loadMore:r}=v(m.trash.listMyTrash,{},{initialNumItems:50}),i=S(),o=g(m.trash.restoreChat),s=g(m.trash.purgeChat),l=g(m.trash.emptyTrash),u=x();return(0,E.jsx)(`div`,{className:`oc-trash`,children:(0,E.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,E.jsxs)(`header`,{className:`oc-trash__head`,children:[(0,E.jsxs)(`h1`,{className:`oc-trash__heading`,children:[(0,E.jsx)(w,{className:`size-5`,"aria-hidden":!0}),` `,f()]}),e.length>0?(0,E.jsx)(y,{variant:`destructive`,size:`sm`,onClick:async()=>{await u({title:_(),description:c(),confirmLabel:n(),destructive:!0})&&await l({})},children:n()}):null]}),(0,E.jsx)(`p`,{className:`oc-trash__hint`,children:a({days:i})}),t===`LoadingFirstPage`?(0,E.jsx)(`p`,{className:`oc-trash__hint`,children:h()}):e.length===0?(0,E.jsx)(`p`,{className:`oc-trash__empty`,children:p()}):(0,E.jsx)(k,{items:e,onRestore:e=>o({chatId:e}),onPurge:e=>s({chatId:e})}),(0,E.jsx)(O,{status:t,loadMore:r})]})})}export{D as TRASH_PAGE,k as TrashList,O as TrashLoadMore,A as TrashPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AC as r,CC as i,DC as a,E as o,EC as s,FC as c,IC as l,MC as u,NC as d,OC as f,SC as p,TC as m,_C as h,bC as g,bq as _,fq as v,jC as y,kC as b,t as x,vC as S,vO as C,wC as w,xC as T,yC as E,yq as D}from"./api-DfVtzU1G.js";import{t as O}from"./use_paginated_query-DSw-EOJL.js";import{t as k}from"./button-BWdRKrS3.js";import{F as A,Rt as j,Z as M,h as N,vn as P,yt as F}from"./index-B0MXmi3m.js";import{TrashList as I,TrashLoadMore as L}from"./TrashPage-DwgS7gln.js";var R=o(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=_(x.blobSweep.listBlobSweeps,{}),t=_(x.blobQuarantine.quarantineSettings,{}),n=D(x.blobSweep.startBlobSweep),o=M(),{toast:c}=j(),[l,O]=(0,z.useState)(!1),N=v(),I=e=>A(e,N),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){c({title:h(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await o({title:T({count:H.orphans.count}),description:g({size:I(H.orphans.bytes)}),confirmLabel:p(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:d()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(k,{variant:`outline`,size:`sm`,disabled:l||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,y()]}),(0,V.jsxs)(k,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:l||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(P,{}),` `,p()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:u({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:C()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:r({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:b()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:f({date:F(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:a({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:s({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:m({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:w({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:i()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?S({date:F(L.lastApply.finishedAt??L.lastApply.startedAt)}):E({date:F(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(x.trash.adminListTrash,{},{initialNumItems:50}),r=N(),i=D(x.trash.adminRestoreChat),a=D(x.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:l({days:r})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:C()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:c()}):(0,V.jsx)(I,{items:e,onRestore:e=>i({chatId:e}),onPurge:e=>a({chatId:e})}),(0,V.jsx)(L,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AN as r,BD as i,BN as a,CN as o,DN as s,EN as c,FD as l,FN as u,GN as d,HD as f,HN as p,ID as m,IN as ee,JN as h,KN as g,LD as _,LN as te,MD as v,MN as ne,ND as y,NN as b,ON as re,PD as x,PN as ie,RD as S,RN as ae,SN as oe,TN as se,UD as C,UN as ce,VD as w,VN as le,WN as ue,bN as de,bq as T,bv as E,jD as D,jN as O,kN as fe,qN as k,t as A,tN as pe,wN as me,xN as he,xv as j,yq as M,yv as N,zD as P,zN as ge}from"./api-DfVtzU1G.js";import{t as F}from"./button-BWdRKrS3.js";import{$n as _e,Gt as I,Jt as L,Kt as ve,Lt as R,Q as ye,Qn as be,Rt as z,Ut as xe,Wt as Se,Z as Ce,_t as we,c as B,ct as V,dt as H,ft as Te,gt as Ee,l as De,lt as U,mt as Oe,pt as ke,st as W,tt as Ae,u as G,ut as K,xn as q,xt as J,yn as Y}from"./index-B0MXmi3m.js";import{t as je}from"./FilterBar-CJwP10CI.js";import{t as Me}from"./DataTableShell-REGK6Dqj.js";import{t as Ne}from"./DetailChips-Dhiulk-F.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let a=T(A.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=T(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}`)),d=[...(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 d){let t=p.get(e.instanceName)??[];t.push(e),p.set(e.instanceName,t)}return(0,Z.jsx)(Te,{open:n,onOpenChange:r,children:(0,Z.jsxs)(ke,{className:`oc-access`,children:[(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(we,{children:C({user:t})}),(0,Z.jsx)(Oe,{children:f()})]}),a?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?w():i()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:P()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:m()}):[...p.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=M(A.agents.assignAgent),s=M(A.agents.removeAgent),c=M(A.agents.setDefaultAgent),u=z();if(!e)return null;async function d(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(S(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(_(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(q,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(J,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":l({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,s?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:x()}):null,e.outOfPool?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:y()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":v(),title:v(),children:(0,Z.jsx)(Y,{size:14,fill:`currentColor`})}):(0,Z.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":D(),title:D(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(Y,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return N();case`user`:return E();case`admin`:return j();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=B.filter(e=>n.has(G[e])).length;return(0,Z.jsxs)(xe,{children:[(0,Z.jsx)(L,{asChild:!0,children:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?h():k({count:r})})}),(0,Z.jsxs)(Se,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(ve,{children:g()}),B.map(e=>{let r=G[e];return(0,Z.jsxs)(I,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(J,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:De[e]()})]},e)})]})]})}function Le(){let e=_e({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,i=e.role??Q,l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),f=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),m=T(A.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),h=T(A.me.getMe,{host:Ae}),g=M(A.admin.setRole),_=M(A.admin.setUserPermissions),v=M(A.admin.startImpersonation),y=M(A.admin.deleteUser),x=M(A.admin.setUserName),S=Ce(),C=ye(),w=z(),[E,D]=(0,X.useState)(null),k=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of m??[])e.add(t.role);return[...e]},[m]),j=n!==``||i!==Q;function N(){t({search:{},replace:!0})}async function P(e){try{await g(e)}catch(e){w.error(d(),e)}}async function F(e){try{await _(e)}catch(e){w.error(ue(),e)}}async function I(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:te(),description:ee({user:t}),confirmWord:u(),confirmLabel:ie(),destructive:!0}))try{await y({profileId:e._id}),w.success(ne({user:t}))}catch(e){w.error(b(),e)}}async function L(e){let t=e.email||e.name||e.userId.slice(0,8),n=await C({title:r(),label:fe({user:t}),placeholder:re(),defaultValue:e.name??``,confirmLabel:pe()});if(n!==null)try{await x({profileId:e._id,name:n}),w.success(s())}catch(e){w.error(c(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:l,searchPlaceholder:ce(),onReset:N,canReset:j,children:(0,Z.jsxs)(W,{value:i,onValueChange:f,children:[(0,Z.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(U,{value:Q,children:p()}),k.map(e=>(0,Z.jsx)(U,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:le(),rows:m,emptyHint:a(),rowActions:e=>{let t=[{label:de(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:O(),onSelect:()=>void L(e)}];return e.userId!==h?.userId&&t.push({label:ge(),onSelect:()=>void v({profileId:e._id})},{label:ae(),variant:`destructive`,onSelect:()=>void I(e)}),t},columns:[{header:se(),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:me(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(W,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,Z.jsx)(K,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(U,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(U,{value:`user`,children:$(`user`)}),(0,Z.jsx)(U,{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:oe()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),F({profileId:e._id,permissions:[...n]})}})},{header:he(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:E?.profileId??null,userLabel:E?.label??``,open:E!==null,onOpenChange:e=>{e||D(null)}})]})}export{Le as UsersTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,As as i,Bc as a,Cs as ee,Es as o,Fc as s,Fs as c,Gc as l,Gs as u,Hc as te,Ic as d,Is as f,Jc as p,Kc as m,Lc as h,Ls as g,N_ as _,Os as v,Pc as y,Ps as ne,QP as b,Qc as x,Rc as S,Rs as C,Ts as w,Uc as T,Vc as E,Wc as re,Xc as D,Yc as ie,Zc as ae,_q as oe,bq as O,cg as se,ds as ce,el as le,fq as ue,il as de,js as k,ks as fe,nl as pe,qc as me,rl as he,t as A,tl as j,ug as M,uq as N,ws as P,yq as F,zc as I}from"./api-DfVtzU1G.js";import{t as L}from"./button-BWdRKrS3.js";import{$n as R,J as z,Lt as B,Qn as ge,X as V,Y as _e,Zn as ve,cn as ye,ct as H,dn as U,dt as W,fn as be,jn as xe,ln as Se,lt as G,mn as Ce,on as we,q as Te,sn as Ee,st as K,tt as q,un as J,ut as Y,xt as X}from"./index-B0MXmi3m.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>ae()],[`fr-FR`,()=>C()],[`en-US`,()=>g()],[`en-GB`,()=>f()],[`de-DE`,()=>c()],[`es-ES`,()=>ne()]],Oe=[[`0.75`,()=>ie()],[`1`,()=>p()],[`1.25`,()=>me()],[`1.5`,()=>m()]],$=0;function ke({instance:e}){let t=F(A.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,s]=(0,Z.useState)(i),[c,u]=(0,Z.useState)(`idle`),[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(!1),h=oe(A.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{s({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),u(`idle`)},[e._id]);let g=a.enabled!==i.enabled||a.engine!==i.engine||a.lang!==i.lang||a.rate!==i.rate||a.autoRead!==i.autoRead;async function v(){u(`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}),u(`idle`)}catch{u(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(B,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:a.enabled,onCheckedChange:e=>s({...a,enabled:e===!0}),"aria-label":r()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()}),(0,Q.jsxs)(K,{value:a.engine,onValueChange:e=>s({...a,engine:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":o(),children:(0,Q.jsx)(W,{})}),(0,Q.jsxs)(H,{children:[(0,Q.jsx)(G,{value:`browser`,children:w()}),e.kind===`hermes`?null:(0,Q.jsx)(G,{value:`gateway`,children:P()})]})]})]}),a.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()}):null,a.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,Q.jsxs)(K,{value:a.lang,onValueChange:e=>s({...a,lang:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":x(),children:(0,Q.jsx)(W,{})}),(0,Q.jsx)(H,{children:De.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,Q.jsxs)(K,{value:a.rate,onValueChange:e=>s({...a,rate:e}),disabled:!a.enabled,children:[(0,Q.jsx)(Y,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(W,{})}),(0,Q.jsx)(H,{children:Oe.map(([e,t])=>(0,Q.jsx)(G,{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)(X,{checked:a.autoRead,onCheckedChange:e=>s({...a,autoRead:e===!0}),disabled:!a.enabled,"aria-label":l()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(L,{size:`sm`,disabled:!g||c===`saving`,onClick:()=>void v(),children:c===`saving`?_():M()}),(0,Q.jsx)(L,{variant:`outline`,size:`sm`,disabled:!a.enabled||d,onClick:()=>{let t=Number.parseFloat(a.rate)||1,n=++$;if(m(!1),U(),J(),a.engine!==`gateway`){Se(E(),{lang:ye(a.lang,ue()),rate:t});return}f(!0),h({instanceName:e.name,text:E()}).then(({mime:e,audioBase64:r})=>{n===$&&Ee(r,e,{rate:t})}).catch(()=>{n===$&&m(!0)}).finally(()=>f(!1))},children:d?_():T()}),(0,Q.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>{$++,f(!1),U(),J()},children:te()})]}),c===`error`||p?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p?ce():se()}):null]})}function Ae({stt:e}){let t=O(A.me.getMe,{host:q}),n=F(A.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,a=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:I()}),(0,Q.jsx)(B,{variant:e?`secondary`:`outline`,children:e?s():y()}),(0,Q.jsx)(B,{variant:r?`secondary`:`destructive`,children:r?i():fe()})]}),a?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()})]})}function je(){let e=O(A.admin.listInstances,{}),t=(0,Z.useMemo)(()=>be(),[]),n=(0,Z.useMemo)(()=>we(),[]),{section:r}=R({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:de()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(B,{variant:t?`secondary`:`destructive`,children:t?he():pe()}),(0,Q.jsx)(B,{variant:n?`secondary`:`destructive`,children:n?j():le()})]}),(0,Q.jsxs)(Te,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(_e,{className:`w-full`,children:[(0,Q.jsxs)(V,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ce,{size:13,"aria-hidden":!0}),v()]}),(0,Q.jsxs)(V,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(xe,{size:13,"aria-hidden":!0}),I()]}),(0,Q.jsxs)(V,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ve,{size:13,"aria-hidden":!0}),h()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(z,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(z,{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:h()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=F(A.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:u()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":b()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]})]})}export{je as VoiceTab};
|