@lacneu/atrium 0.80.0 → 0.81.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-BgWLWjSu.js +1 -0
- package/dist/assets/{AdvancedFilter-Ddd7TM1I.js → AdvancedFilter-CDngwUem.js} +1 -1
- package/dist/assets/AgentFilesTab-CL0cJrKE.js +3 -0
- package/dist/assets/AnomaliesTab-CKSRbds6.js +1 -0
- package/dist/assets/AuditTab-BnDFtbaS.js +1 -0
- package/dist/assets/BridgeTab-QW9px1z5.js +1 -0
- package/dist/assets/ChatDefaultsTab-XNB8jInh.js +1 -0
- package/dist/assets/{DataTableShell-D2srrwu0.js → DataTableShell-BWoSBli_.js} +1 -1
- package/dist/assets/{DetailChips-WUMzjman.js → DetailChips-CUfCyLvN.js} +1 -1
- package/dist/assets/FeedbacksTab-Ba-zMA-p.js +1 -0
- package/dist/assets/{FieldLabel-BNwSIo5u.js → FieldLabel-8vj4ipPC.js} +1 -1
- package/dist/assets/FilesTab-Dht0_RDj.js +1 -0
- package/dist/assets/{FilterBar-BS4HsrlJ.js → FilterBar-BJ1mhU3e.js} +1 -1
- package/dist/assets/GroupsTab-Bz7Mvvwj.js +1 -0
- package/dist/assets/InstancesTab-BTESpzxw.js +1 -0
- package/dist/assets/IntegrationsTab-D3y4_fhI.js +1 -0
- package/dist/assets/KpiTab-D9ujtelb.js +1 -0
- package/dist/assets/PreferencesTab-CHqxxQ3R.js +1 -0
- package/dist/assets/ProjectPage-Dom5dB_v.js +1 -0
- package/dist/assets/PromptInjectionsTab-D-7L-yZy.js +4 -0
- package/dist/assets/RolesTab-2nGoIoBg.js +1 -0
- package/dist/assets/ScheduledTab-_v_HWkIY.js +1 -0
- package/dist/assets/ServiceAccountsTab-foQObSmk.js +1 -0
- package/dist/assets/SubAgentReportsTab-DIzBgBj5.js +1 -0
- package/dist/assets/ThemeShowroom-Gqbq2MWW.js +1 -0
- package/dist/assets/{TimeRangePicker-Dx50b9Tc.js → TimeRangePicker-qNMV_Gj-.js} +1 -1
- package/dist/assets/{TimezoneCombobox-DH_5qFyU.js → TimezoneCombobox-D2e6UjGY.js} +1 -1
- package/dist/assets/TracesTab-D_Z__oYy.js +1 -0
- package/dist/assets/UsersTab-1HZ5mAYl.js +1 -0
- package/dist/assets/VoiceTab-DGQk5yGt.js +1 -0
- package/dist/assets/{api-CyG2Kb2E.js → api-CCk5U5gB.js} +5 -5
- package/dist/assets/{button-SxU4iS5M.js → button-CbUSFbZL.js} +1 -1
- package/dist/assets/{card-vJtS-_yl.js → card-PW6qFB8Z.js} +1 -1
- package/dist/assets/chevrons-up-down-DAdQ-ohu.js +1 -0
- package/dist/assets/{compatView-JE5RFigb.js → compatView-DgV9jG5C.js} +1 -1
- package/dist/assets/dispatchErrorInfo-CW9VFOfh.js +1 -0
- package/dist/assets/{dist-bgyYeQqP.js → dist-BF1pXGOi.js} +1 -1
- package/dist/assets/{dist-CPSxRyhy.js → dist-CeBeEhXM.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-BakvA9z8.js → highlighted-body-OFNGDK62-B0i3QCx_.js} +1 -1
- package/dist/assets/index-DY7zoioz.js +324 -0
- package/dist/assets/index-vuXE_6pY.css +1 -0
- package/dist/assets/{list-JGKvhNdi.js → list-wMpxVo2w.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-CWDFvVZH.js +1 -0
- package/dist/assets/{pdf-BkJsigVn.js → pdf-BFBPmq_U.js} +1 -1
- package/dist/assets/roleDescriptions-Du6v2lbA.js +1 -0
- package/dist/assets/{table-jvClq47d.js → table-BhYNJKZu.js} +1 -1
- package/dist/assets/{tabs-D_DuLEpU.js → tabs-BwhZusQZ.js} +1 -1
- package/dist/assets/x-BvfQ_1AZ.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AccessTab-Bg7AJltl.js +0 -1
- package/dist/assets/AgentFilesTab-BRmbz8_w.js +0 -3
- package/dist/assets/AnomaliesTab-m5WLIYl2.js +0 -1
- package/dist/assets/AuditTab-1gyBuFew.js +0 -1
- package/dist/assets/BridgeTab-DlU50D2z.js +0 -1
- package/dist/assets/ChatDefaultsTab-CN8cDKMU.js +0 -1
- package/dist/assets/FeedbacksTab-CcE_6zZR.js +0 -1
- package/dist/assets/FilesTab-CfDSdvOR.js +0 -1
- package/dist/assets/GroupsTab-BN8czt3O.js +0 -1
- package/dist/assets/InstancesTab-Mw3vQGZr.js +0 -1
- package/dist/assets/IntegrationsTab-HnFrohTq.js +0 -1
- package/dist/assets/KpiTab-Bt81LKar.js +0 -1
- package/dist/assets/PreferencesTab-DNxJMl_1.js +0 -1
- package/dist/assets/ProjectPage-BNEr-qVc.js +0 -1
- package/dist/assets/PromptInjectionsTab-DaLlUnez.js +0 -4
- package/dist/assets/RolesTab-DjKUmoAu.js +0 -1
- package/dist/assets/ScheduledTab-BTuR5Igi.js +0 -1
- package/dist/assets/ServiceAccountsTab-3PR98Iqq.js +0 -1
- package/dist/assets/SubAgentReportsTab-kiNltjSe.js +0 -1
- package/dist/assets/ThemeShowroom-DGuXtdJT.js +0 -1
- package/dist/assets/TracesTab-zOMYT0Ye.js +0 -1
- package/dist/assets/UsersTab-DVhM7px6.js +0 -1
- package/dist/assets/VoiceTab-l-Tr6bly.js +0 -1
- package/dist/assets/chevrons-up-down-ChvoKzuN.js +0 -1
- package/dist/assets/dispatchErrorInfo-BKhXLGGN.js +0 -1
- package/dist/assets/index-Cv1UBVbk.css +0 -1
- package/dist/assets/index-DWkl2h55.js +0 -324
- package/dist/assets/mermaid-GHXKKRXX-CgrVl_4r.js +0 -1
- package/dist/assets/roleDescriptions-B9SjwOYY.js +0 -1
- package/dist/assets/x-CHe0mcCM.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,AL as i,AR as a,BI as o,BL as s,CR as c,D as l,DI as u,DL as ee,DR as d,EL as f,ER as p,FI as te,FL as ne,GI as re,GL as ie,HI as ae,HL as oe,II as se,JI as ce,JL as m,KI as le,KL as ue,LI as de,LL as fe,ML as pe,MR as me,NI as he,NL as ge,NR as _e,OL as ve,OR as ye,PI as be,PL as xe,PR as Se,QL as Ce,Qz as h,RI as we,SR as Te,TR as Ee,UI as De,UL as Oe,VI as ke,VL as Ae,WI as je,WL as Me,XI as Ne,XL as Pe,Xz as Fe,YI as Ie,ZL as Le,_L as Re,aB as ze,bL as Be,bR as Ve,cL as g,dL as He,eR as Ue,fL as _,gL as We,hL as Ge,jL as Ke,jR as qe,kL as Je,kR as Ye,lL as Xe,mL as Ze,nB as v,oL as Qe,pL as $e,qI as et,qL as tt,sL as nt,t as y,tR as rt,uL as it,vL as at,wR as ot,xL as b,xR as st,yL as ct,yR as lt,zI as ut}from"./api-CyG2Kb2E.js";import{t as dt}from"./list-JGKvhNdi.js";import{t as x}from"./button-SxU4iS5M.js";import{$ as S,Bn as C,Bt as ft,Ct as pt,Dn as mt,Dt as ht,Et as w,Q as T,Rt as E,St as gt,Tt as _t,Vn as D,X as O,Z as k,_n as vt,_t as yt,at as bt,bn as xt,bt as St,dn as Ct,et as A,gt as wt,hn as Tt,it as Et,jt as Dt,nt as Ot,on as kt,ot as At,q as jt,rt as Mt,tt as Nt,vt as Pt,wt as Ft,xn as It,xt as Lt,yt as Rt,zt as j}from"./index-DWkl2h55.js";import{a as zt,i as M,n as Bt,o as Vt,r as N,t as Ht}from"./table-jvClq47d.js";import{t as Ut}from"./FilterBar-BS4HsrlJ.js";/* empty css */import{a as Wt,c as P,i as F,l as Gt,n as Kt,o as I,r as qt,s as Jt,t as Yt,u as L}from"./TimezoneCombobox-DH_5qFyU.js";var Xt=l(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Zt=l(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),R=t(e(),1),z=n();function B(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Qt({value:e,onChange:t}){let n=Gt(e),r=(0,R.useMemo)(()=>new Date,[]),[i,a]=(0,R.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,R.useState)(!1),c=(0,R.useMemo)(()=>B(h()),[]),l=(0,R.useMemo)(()=>new Intl.DateTimeFormat(h(),{month:`long`,year:`numeric`}),[]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=P(i.year,i.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(L(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),p(e,t,n,d,f)},ne=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},re=n===null?Be():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,z.jsxs)(E,{modal:!0,open:o,onOpenChange:s,children:[(0,z.jsx)(ft,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":b(),children:[(0,z.jsx)(Xt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,z.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,z.jsxs)(j,{align:`start`,className:`oc-dtp__pop`,children:[(0,z.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ct(),onClick:()=>ne(-1),children:(0,z.jsx)(D,{size:15,"aria-hidden":!0})}),(0,z.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":at(),onClick:()=>ne(1),children:(0,z.jsx)(C,{size:15,"aria-hidden":!0})})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,z.jsxs)(O,{value:String(d),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),Number(e),f),children:[(0,z.jsx)(S,{size:`sm`,"aria-label":Re(),children:(0,z.jsx)(A,{})}),(0,z.jsx)(k,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,z.jsx)(T,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,z.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,z.jsxs)(O,{value:String(f),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,z.jsx)(S,{size:`sm`,"aria-label":We(),children:(0,z.jsx)(A,{})}),(0,z.jsx)(k,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,z.jsx)(T,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function V(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=V(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function H(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function tn(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function nn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function rn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var U=3;function an({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=h(),c=(0,R.useMemo)(()=>en(e),[e]),l=(0,R.useMemo)(()=>tn(s),[s]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),d=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=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):u.format(new Date(n.year,n.month,1));return(0,z.jsxs)(`div`,{className:`oc-cal`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":Xe(),onClick:()=>p(-1),children:(0,z.jsx)(D,{})}),(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":g(),onClick:()=>p(1),children:(0,z.jsx)(C,{})}),(0,z.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:it()})]}),(0,z.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,z.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,z.jsx)(x,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:_()}),(0,z.jsx)(x,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:He()})]})]}),t===`month`?(0,z.jsx)(on,{cursor:n,byDay:c,weekdays:l,timeFmt:d,now:f,onEventClick:a}):(0,z.jsx)(sn,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,z.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function on({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=P(e.year,e.month);return(0,z.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,z.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,z.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,U).map(e=>(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,z.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,z.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>U?(0,z.jsx)(`span`,{className:`oc-cal__more`,children:nt({count:o.length-U})}):null]},n)})]})}function sn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,z.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=H(t,e,o),c=P(e,o);return(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,z.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,z.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,z.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var W={h:36e5,min:6e4,s:1e3,ms:1};function cn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*W[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var q=new Map;function J(e){let t=q.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return q.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=I(e)!==`active`,c=Z(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Jt(e)){case`ok`:return(0,z.jsx)(w,{variant:`secondary`,children:xe()});case`error`:return(0,z.jsx)(w,{variant:`destructive`,children:pe()});case`running`:return(0,z.jsx)(w,{variant:`outline`,children:Ke()});case`other`:return(0,z.jsx)(w,{variant:`outline`,children:e});case`none`:return(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=v(y.scheduled.listMyCrons),t=v(y.scheduled.getCronDetail),n=v(y.scheduled.listCronRuns),l=v(y.scheduled.updateCron),Re=v(y.scheduled.removeCron),Be=v(y.scheduled.runCronNow),g=ht(),He=ze(y.me.getMe,{host:jt})?.timezone,[_,We]=(0,R.useState)(null),[Xe,nt]=(0,R.useState)(!1),[it,at]=(0,R.useState)(!1),[b,ct]=(0,R.useState)(null),[C,ft]=(0,R.useState)(null),[E,D]=(0,R.useState)(null),[j,P]=(0,R.useState)(null),[Gt,Jt]=(0,R.useState)(!1),[L,B]=(0,R.useState)(Kt),[V,$t]=(0,R.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),en=e=>{localStorage.setItem(`oc.sched.view`,e),$t(e)},[H,tn]=(0,R.useState)(`month`),[U,on]=(0,R.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),sn=(0,R.useMemo)(()=>{let e=[];for(let t of _??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Wt(r,L)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[_,L]),W=(0,R.useMemo)(()=>H===`year`?rn(U.year):nn(U.year,U.month),[H,U]),cn=(0,R.useMemo)(()=>un(sn,W.startMs,W.endMs),[sn,W]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,R.useCallback)(async()=>{nt(!0),at(!1);try{We(await e({}))}catch{at(!0)}finally{nt(!1)}},[e]);(0,R.useEffect)(()=>{K()},[K]);let q=(0,R.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,R.useRef)(null);(0,R.useEffect)(()=>{_!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[_]);let Y=(0,R.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ct(e);try{await t(),g.success(n),await K()}catch(e){g.toast({variant:`error`,title:m({code:dn(e)})})}finally{ct(null)}},Z=(0,R.useRef)(0),Q=(0,R.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;D({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;D({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;D(null),g.toast({variant:`error`,title:m({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;P({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;P(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;P(null),g.toast({variant:`error`,title:m({code:dn(e)})})}},mn=async()=>{if(j===null)return;let e={};if(j.nameDirty&&j.name.trim()===``||j.messageDirty&&j.hasMessage&&j.message.trim()===``){g.toast({variant:`error`,title:he()});return}if(j.nameDirty&&j.name.trim()!==``&&(e.name=j.name.trim()),j.scheduleDirty){if(j.scheduleKind===`cron`&&j.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:j.cronExpr.trim(),...j.tz.trim()===``?{}:{tz:j.tz.trim()}};else if(j.scheduleKind===`every`){let t=Number(j.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[j.everyUnit])})}else if(j.scheduleKind===`at`&&j.at!==``){let t=Date.parse(j.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(j.scheduleDirty&&e.schedule===void 0){g.toast({variant:`error`,title:be()});return}if(j.messageDirty&&j.hasMessage&&j.message.trim()!==``&&(e.message=j.message.trim()),Object.keys(e).length===0){P(null);return}let t=Q.current;Jt(!0);try{await l({instanceName:j.instanceName,jobId:j.jobId,patch:e}),g.success(et()),t===Q.current&&P(null),await K()}catch(e){g.toast({variant:`error`,title:m({code:dn(e)})})}finally{Jt(!1)}},hn=_?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Se()}),(0,z.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":Ge(),children:[(0,z.jsx)(x,{variant:V===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ze(),title:Ze(),"aria-pressed":V===`list`,onClick:()=>en(`list`),children:(0,z.jsx)(dt,{})}),(0,z.jsx)(x,{variant:V===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":$e(),title:$e(),"aria-pressed":V===`calendar`,onClick:()=>en(`calendar`),children:(0,z.jsx)(Xt,{})})]}),(0,z.jsxs)(x,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:Xe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,z.jsx)(Tt,{size:14,"aria-hidden":!0}),_e()]})]}),_!==null&&hn>0?(0,z.jsxs)(Ut,{q:L.q,onQChange:e=>B(t=>({...t,q:e})),searchPlaceholder:Je(),onReset:()=>B(Kt),canReset:qt(L),children:[(0,z.jsxs)(O,{value:L.state,onValueChange:e=>B(t=>({...t,state:e})),children:[(0,z.jsx)(S,{size:`sm`,className:`w-40`,children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`all`,children:ve()}),(0,z.jsx)(T,{value:`active`,children:Ve()}),(0,z.jsx)(T,{value:`paused`,children:st()}),(0,z.jsx)(T,{value:`auto-disabled`,children:lt()})]})]}),(0,z.jsxs)(O,{value:L.result,onValueChange:e=>B(t=>({...t,result:e})),children:[(0,z.jsx)(S,{size:`sm`,className:`w-40`,children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`all`,children:ee()}),(0,z.jsx)(T,{value:`ok`,children:xe()}),(0,z.jsx)(T,{value:`error`,children:pe()}),(0,z.jsx)(T,{value:`running`,children:Ke()}),(0,z.jsx)(T,{value:`none`,children:i()})]})]})]}):null,_===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Xe,children:it?me():Fe()}):V===`calendar`?(0,z.jsxs)(z.Fragment,{children:[it?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null,_.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,z.jsx)(an,{events:cn.events,mode:H,cursor:U,onModeChange:tn,onCursorChange:on,onEventClick:G,footnote:Qe()})]}):(0,z.jsxs)(z.Fragment,{children:[it?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null,_.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):null,_.map(e=>{let t=e.jobs.filter(e=>Wt(e,L)),n=qt(L)&&e.jobs.length>0&&t.length===0;return(0,z.jsxs)(`section`,{style:{marginBottom:20},children:[_.length>1||e.error||!e.supported?(0,z.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,z.jsx)(w,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye({code:e.error})}):e.jobs.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):n?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,z.jsxs)(Ht,{children:[(0,z.jsx)(zt,{children:(0,z.jsxs)(Vt,{children:[(0,z.jsx)(M,{children:d()}),(0,z.jsx)(M,{children:p()}),(0,z.jsx)(M,{children:Ee()}),(0,z.jsx)(M,{children:ot()}),(0,z.jsx)(M,{children:c()}),(0,z.jsx)(M,{children:ne()}),(0,z.jsx)(M,{children:Ne()})]})}),(0,z.jsx)(Bt,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=b===i,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,z.jsxs)(Vt,{ref:t.id!==null&&t.id===q?J:void 0,"data-state":t.id!==null&&t.id===q?`selected`:void 0,children:[(0,z.jsx)(N,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Te()}),(0,z.jsx)(N,{children:(0,z.jsx)(w,{variant:`secondary`,children:t.agentId})}),(0,z.jsxs)(N,{className:`whitespace-nowrap`,children:[(0,z.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=wt(t.schedule),n=e===null?null:yt(e);return n===null?null:(0,z.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,z.jsx)(N,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,z.jsx)(N,{children:I(t)===`auto-disabled`?(0,z.jsx)(w,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:lt()}):I(t)===`active`?(0,z.jsx)(w,{variant:`secondary`,children:Ve()}):I(t)===`paused`?(0,z.jsx)(w,{variant:`outline`,children:st()}):(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,z.jsxs)(N,{children:[(0,z.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,z.jsx)(w,{variant:`destructive`,title:t.lastDeliveryError??rt(),children:ge()}):null]}),(0,z.jsx)(N,{className:`whitespace-nowrap`,children:t.id===null?(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,z.jsx)(mt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,z.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:r(),"aria-label":r(),disabled:b!==null,onClick:()=>void X(i,async()=>{let n=await Be({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},tt()),children:(0,z.jsx)(kt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:F(t)===`pause`?Ce():Le(),"aria-label":F(t)===`pause`?Ce():Le(),disabled:b!==null,onClick:()=>void X(i,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:F(t)===`resume`}}),F(t)===`pause`?ue():ie()),children:F(t)===`pause`?(0,z.jsx)(It,{size:14,"aria-hidden":!0}):(0,z.jsx)(vt,{size:14,"aria-hidden":!0})}):null,s?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:b!==null,onClick:()=>void pn(e.instanceName,t),children:(0,z.jsx)(xt,{size:14,"aria-hidden":!0})}):null,s?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:ce(),"aria-label":ce(),disabled:b!==null,onClick:()=>void ln(e.instanceName,t),children:(0,z.jsx)(Zt,{size:14,"aria-hidden":!0})}):null,o?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Pe(),"aria-label":Pe(),disabled:b!==null,onClick:()=>ft({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,z.jsx)(Ct,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]},e.instanceName)}),hn>0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:u()}):null]}),(0,z.jsx)(Pt,{open:C!==null,onOpenChange:e=>{e||ft(null)},children:(0,z.jsxs)(Lt,{children:[(0,z.jsxs)(Ft,{children:[(0,z.jsx)(_t,{children:Oe()}),(0,z.jsx)(gt,{children:oe({name:C?.name??``})})]}),(0,z.jsxs)(pt,{children:[(0,z.jsx)(St,{children:Ae()}),(0,z.jsx)(Rt,{onClick:()=>{let e=C;ft(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>Re({instanceName:e.instanceName,jobId:e.jobId}),Me())},children:s()})]})]})}),(0,z.jsx)(Nt,{open:E!==null,onOpenChange:e=>{e||(Z.current++,D(null))},children:(0,z.jsxs)(Ot,{style:{maxWidth:640},children:[(0,z.jsx)(bt,{children:(0,z.jsx)(At,{children:le({name:E?.name??``})})}),E?.entries===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):E!==null&&E.entries.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):E===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:E.entries.map((e,t)=>(0,z.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,z.jsx)(fn,{status:e.status}),(0,z.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,z.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[fe({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,z.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,z.jsx)(Nt,{open:j!==null,onOpenChange:e=>{e||(Q.current++,P(null))},children:(0,z.jsxs)(Ot,{className:`oc-cronedit`,children:[(0,z.jsxs)(bt,{children:[(0,z.jsx)(At,{children:je()}),(0,z.jsx)(Mt,{children:De()})]}),j===null?null:j.loading?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:d()}),(0,z.jsx)(Dt,{value:j.name,maxLength:200,onChange:e=>P({...j,name:e.target.value,nameDirty:!0})})]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ae()}),(0,z.jsxs)(O,{value:j.scheduleKind,onValueChange:e=>P({...j,scheduleKind:e,scheduleDirty:!0}),children:[(0,z.jsx)(S,{children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`cron`,children:ke()}),(0,z.jsx)(T,{value:`every`,children:o()}),(0,z.jsx)(T,{value:`at`,children:ut()})]})]}),j.scheduleKind===`cron`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(Dt,{value:j.cronExpr,onChange:e=>P({...j,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,z.jsx)(Yt,{value:j.tz,onChange:e=>P({...j,tz:e,scheduleDirty:!0}),fallbackTz:He??void 0})]}):j.scheduleKind===`every`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(Dt,{type:`number`,min:1,value:j.everyValue,onChange:e=>P({...j,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,z.jsxs)(O,{value:j.everyUnit,onValueChange:e=>P({...j,everyUnit:e,scheduleDirty:!0}),children:[(0,z.jsx)(S,{style:{maxWidth:160},children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`minutes`,children:we()}),(0,z.jsx)(T,{value:`hours`,children:de()}),(0,z.jsx)(T,{value:`days`,children:se()})]})]})]}):(0,z.jsx)(Qt,{value:j.at,onChange:e=>P({...j,at:e,scheduleDirty:!0})})]}),j.hasMessage?(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ue()}),(0,z.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:j.message,onChange:e=>P({...j,message:e.target.value,messageDirty:!0})})]}):null]}),(0,z.jsxs)(Et,{children:[(0,z.jsx)(x,{variant:`ghost`,onClick:()=>P(null),children:Ae()}),(0,z.jsxs)(x,{onClick:()=>void mn(),disabled:j===null||j.loading||Gt,children:[Gt?(0,z.jsx)(mt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,te()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,$N as i,AN as ee,BN as te,CN as ne,DN as re,EN as ie,FN as ae,GN as oe,HN as se,IN as ce,JM as a,JN as le,KN as ue,LN as de,MN as fe,NN as pe,ON as me,PN as he,QM as o,QN as ge,RN as _e,SN as ve,TN as ye,UN as be,VN as xe,WN as Se,XM as s,XN as Ce,YM as we,YN as Te,ZM as Ee,ZN as De,_N as c,aB as l,aN as u,aP as Oe,bN as ke,cN as d,cP as f,dN as p,dP as Ae,eN as m,eP as je,fN as h,fP as Me,gN as g,hN as _,iB as v,iN as y,iP as Ne,jN as Pe,kN as Fe,lN as b,lP as x,mN as S,mP as Ie,nB as Le,nN as C,nP as Re,oN as w,oP as ze,pN as T,pP as Be,qN as Ve,rN as E,rP as He,sN as D,sP as Ue,t as O,tN as k,tP as We,uN as A,uP as Ge,vN as Ke,wN as qe,xN as Je,yN as Ye,zN as Xe}from"./api-CyG2Kb2E.js";import{t as j}from"./button-SxU4iS5M.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as at,tt as K}from"./index-DWkl2h55.js";import{t as ot}from"./FilterBar-BS4HsrlJ.js";import{t as st}from"./DataTableShell-D2srrwu0.js";import{t as ct}from"./roleDescriptions-B9SjwOYY.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>m(),days:null},{value:`30`,label:()=>r(),days:30},{value:`90`,label:()=>o(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[a,o]=(0,q.useState)(X),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),we=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),Ee=l(O.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:r===X?void 0:r===`disabled`}}),c=l(O.apiKeys.listKeys,{}),u=l(O.apiKeys.listRoles,{}),d=v(O.apiKeys.createServiceAccount),p=v(O.apiKeys.updateServiceAccount),m=v(O.apiKeys.deleteServiceAccount),h=Le(O.apiKeys.mintApiKey),g=v(O.apiKeys.revokeApiKey),_=nt(),y=Qe(),b=n!==``||a!==X||r!==X;function S(){o(X),t({search:{},replace:!0})}let[C,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(Z),[D,k]=(0,q.useState)(null),[A,P]=(0,q.useState)(new Set),[I,z]=(0,q.useState)(null),B=(0,q.useRef)(!1),[H,W]=(0,q.useState)(new Set),[G,it]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function Q(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await p({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(fe())):await d({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Z),k(null),w(!1)}catch(e){y.error(D?pe():he(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),w(!0)}async function mt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(Pe(),e)}finally{B.current=!1,z(null)}}async function $(e){if(await _({title:ee(),description:(0,J.jsxs)(J.Fragment,{children:[Fe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,me(),` `,(0,J.jsx)(`strong`,{children:re()}),` `,ie()]}),confirmWord:e.name,confirmLabel:ye(),destructive:!0}))try{await m({serviceAccountId:e._id}),y.success(qe(),e.name)}catch(e){y.error(ne(),e)}}async function ht(e){if(await _({title:ve(),description:(0,J.jsxs)(J.Fragment,{children:[Je(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:Ye(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){y.error(Ke(),e)}finally{W(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:Ie()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:Be(),onReset:S,canReset:b,children:[(0,J.jsxs)(L,{value:a,onValueChange:o,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(V,{placeholder:Me()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ae()}),(u??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:r,onValueChange:we,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ge()}),(0,J.jsx)(F,{value:`active`,children:x()}),(0,J.jsx)(F,{value:`disabled`,children:f()})]})]})]}),(0,J.jsx)(st,{title:Ue(),rows:Ee,addLabel:ze(),onAdd:()=>{E(Z),k(null),w(!0)},emptyHint:Oe(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:We(),onSelect:()=>pt(e)},{label:Ne(),onSelect:()=>void mt(e)}]:[],{label:A.has(e._id)?He():Re(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:je(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?i():ge(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,J.jsx)(et,{}):(0,J.jsx)(Ze,{})})},{header:De(),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:Ce(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:Te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:f()}):(0,J.jsx)(N,{variant:`outline`,children:x()})},{header:le(),cell:e=>(0,J.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(R,{children:lt.map(e=>(0,J.jsx)(F,{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:I===e._id?ue():oe({count:t})})}}]}),(0,J.jsx)(rt,{open:C,onOpenChange:e=>{w(e),e||k(null)},title:D?Se():xe(),description:D?be():te(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?se():Xe(),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:_e()}),(0,J.jsx)(U,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,J.jsxs)(L,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(V,{placeholder:ce()})}),(0,J.jsx)(R,{children:(u??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===T.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:ae()}),(0,J.jsx)(U,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,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:[c(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:T()}),(0,J.jsx)(`th`,{children:h()}),(0,J.jsx)(`th`,{children:p()}),(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)(N,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:B(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)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?b():d()}):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)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(G,{children:D()}),(0,J.jsx)(it,{children:w({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:u()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":y(),children:[n?(0,J.jsx)(I,{}):(0,J.jsx)(P,{}),n?E():C()]})]}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:k()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?Ee():B(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:s()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(N,{variant:`outline`,children:we()}):(0,J.jsx)(N,{variant:`outline`,children:a()})}export{Q as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Ac as i,Bc as a,Cc as o,Dc as s,Ec as c,Fc as l,Gc as u,Hc as d,Ic as f,Jc as p,Kc as m,Lc as h,Mc as g,Nc as _,Oc as v,Pc as y,Qc as b,Rc as x,Sc as S,Tc as C,Uc as w,Vc as T,Wc as E,Xc as D,Yc as O,Zc as k,_c as A,aB as j,bc as M,gc as N,hc as P,iB as F,jc as I,kc as ee,qc as L,t as R,vc as z,wc as B,xc as V,yc as H,zc as U}from"./api-CyG2Kb2E.js";import{t as W}from"./button-SxU4iS5M.js";import{U as G,ct as K}from"./index-DWkl2h55.js";import{t as q}from"./DataTableShell-D2srrwu0.js";var J=t(e(),1),Y=n(),X={hung:()=>f(),wrong_result:()=>l(),error:()=>y(),other:()=>_()},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=F(R.subAgentReports.respondToReport),[r,a]=(0,J.useState)(e.thread),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1);async function p(){let t=l.trim();if(!(!t||d)){f(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!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),` · `,g({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:I()}),(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:i()}),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`?ee():v()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:s()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:c(),value:l,maxLength:2e3,rows:3,onChange:e=>u(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 p(),disabled:!l.trim()||d,children:d?B():C()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[o({count:t.children.length}),t.childrenTruncated?` ${S()}`:``,t.textTruncated?` ${V()}`:``]}),(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?` · ${M()}`:``]}),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:H()}),(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:z()}),(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=j(R.subAgentReports.listForAdmin,{}),t=F(R.subAgentReports.readReport),n=F(R.subAgentReports.deleteReport),i=G(),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function f(e){if(o===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function g(e){await i({title:A(),description:N(),confirmLabel:P(),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:[k(),` `,(0,Y.jsx)(`strong`,{children:D()}),` `,O()]}),(0,Y.jsx)(q,{title:r(),rows:e,emptyHint:b(),isExpanded:e=>o===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:p(),cell:e=>K(e.at),sort:e=>e.at},{header:L(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:m(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:u(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${d({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:E(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:w(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:T()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:a()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?x():U(),onSelect:()=>void f(e)},{label:h(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,AF as i,BF as a,CF as o,CI as s,DF as c,EF as l,FF as u,GF as d,HF as f,IF as p,JF as m,Jz as h,KF as g,Kz as _,LF as v,MF as ee,NF as te,OF as ne,PF as re,QF as ie,RF as ae,SF as oe,SI as se,TF as ce,UF as le,VF as ue,WF as de,XF as fe,YF as pe,ZF as me,_F as he,_I as ge,aB as y,aF as _e,aI as ve,bF as ye,bI as be,cF as xe,cI as Se,dF as Ce,dI as we,dc as Te,eI as Ee,fF as De,fI as Oe,fc as ke,gF as Ae,gI as je,hF as Me,hI as Ne,iB as b,iF as Pe,iI as Fe,jF as Ie,kF as Le,lF as x,lI as Re,mF as ze,mI as Be,mc as S,nB as Ve,nF as He,nI as Ue,oF as We,oI as Ge,pF as Ke,pI as C,pc as w,qF as qe,qz as Je,r as Ye,rF as Xe,rI as Ze,sF as Qe,sI as $e,t as T,tF as et,tI as tt,uF as nt,uI as rt,vF as it,vI as at,wF as ot,xF as E,xI as st,yF as ct,yI as lt,zF as ut}from"./api-CyG2Kb2E.js";import{t as D}from"./x-CHe0mcCM.js";import{t as O}from"./button-SxU4iS5M.js";import{$ as k,Et as A,Fn as dt,Ft as ft,G as pt,It as j,K as mt,Lt as ht,Mt as gt,Nt as _t,Pn as M,Pt as N,Q as P,Un as F,X as I,Z as L,et as R,jt as z,ln as B,q as V,ut as H}from"./index-DWkl2h55.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-vJtS-_yl.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-jvClq47d.js";import{t as Ot}from"./TimeRangePicker-Dx50b9Tc.js";import{t as kt}from"./FilterBar-BS4HsrlJ.js";import{t as At}from"./AdvancedFilter-Ddd7TM1I.js";var K=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Ft(e,t,n)>=jt}function It(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Lt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ot());if(e.size>Rt)throw Error(o());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(E());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(E());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);q(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Vt)??await Y(f,`image/png`);if(!h)throw Error(ye());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(oe())),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`?h():e===`dark`?Je():_()}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)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":S(),title:S(),children:(0,X.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=y(T.charts.listMyCharts),r=b(T.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ne()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:C(),subtitle:Oe(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?we():n.via===`owner`?rt():Re({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:Se()}):null]})}function Qt(){let e=b(T.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,p]=(0,K.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(a())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(ae());return}let o;try{o=JSON.parse(r)}catch{s(a());return}p(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{p(!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:m()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(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:g()}),(0,X.jsx)(z,{value:t,onChange:e=>n(e.target.value),placeholder:d(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:de()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:le(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(B,{className:`size-4`}),f(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,X.jsx)(O,{size:`sm`,disabled:u,onClick:()=>void _(),children:ue()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:ut()}):null]})]})}function $t({chart:e}){let t=Ve(T.charts.setChartLogo),n=b(T.charts.removeChartLogo),[r,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(null),u=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function d(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Ht(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await d(e,n)}async function p(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function m(e){let t=u(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await d(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function h({mode:e}){let t=u(e),n=u(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`?Ie():i()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(B,{className:`size-4`}),t?ne():Le(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:l()}):null,t?(0,X.jsx)(O,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:c()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ee()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(h,{mode:`light`}),(0,X.jsx)(h,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=y(T.me.getMe,{host:V}),n=b(T.charts.addChartDomain),r=b(T.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ct()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Me()}):u.map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ze({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(D,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{value:i,onChange:e=>a(e.target.value),placeholder:he(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(O,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:Ae()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=b(T.charts.updateChart),n=b(T.charts.deleteChart),[r,i]=(0,K.useState)(!1),[o,s]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>$(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1);function g(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(a());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:g,children:re()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:te()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ce()}),(0,X.jsx)(z,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children: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:u,onChange:e=>d(Number(e.target.value)),"aria-label":w()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?ke():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:nt()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,disabled:m,onClick:()=>void _(),children:Ke()}),(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:De()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=y(T.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:v()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:p()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()}):(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=b(T.charts.addChartToGroupPool),i=b(T.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await i({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?Ee():e.kind===`custom`&&e.scope===`personal`?_e():tt()}),e.isGlobalDefault?(0,X.jsx)(A,{variant:`default`,children:r()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:me()}),(o??[]).map(e=>(0,X.jsxs)(A,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":pe({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(D,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(I,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(k,{size:`sm`,className:`w-56`,children:(0,X.jsx)(R,{placeholder:fe()})}),(0,X.jsx)(L,{children:c.map(e=>(0,X.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ie()}):null]})]})}function an({chart:e}){let t=b(T.charts.promoteChartToCommon),n=b(T.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(x()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(A,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Pe():_e()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:We({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Xe()}):null,(0,X.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:He()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=b(T.admin.setDefaultThemeMode),i=b(T.admin.setDefaultLocale),a=b(T.charts.setDefaultChart),o=y(T.charts.listChartsAdmin),c=y(T.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(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:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:C()}),mt.map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).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:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(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:xe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()}):(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:s()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(O,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:st()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,X.jsx)(O,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:lt()})]})]})}function sn(){let e=y(T.me.getMe,{host:V}),t=pt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.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:at()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(O,{variant:`outline`,children:`Outline`}),(0,X.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(O,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(O,{size:`sm`,children:`Small`}),(0,X.jsx)(O,{children:`Default`}),(0,X.jsx)(O,{size:`lg`,children:`Large`}),(0,X.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(z,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(I,{value:n,onValueChange:r,children:[(0,X.jsx)(k,{className:`w-56`,children:(0,X.jsx)(R,{placeholder:`Select…`})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(H,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(kt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(I,{value:o,onValueChange:s,children:[(0,X.jsx)(k,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes directions`}),(0,X.jsx)(P,{value:`inbound`,children:`inbound`}),(0,X.jsx)(P,{value:`outbound`,children:`outbound`}),(0,X.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(I,{value:c,onValueChange:l,children:[(0,X.jsx)(k,{size:`sm`,children:(0,X.jsx)(R,{})}),(0,X.jsxs)(L,{children:[(0,X.jsx)(P,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(P,{value:`info`,children:`info`}),(0,X.jsx)(P,{value:`warn`,children:`warn`}),(0,X.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Ot,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(ht,{asChild:!0,children:(0,X.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(_t,{align:`start`,children:[(0,X.jsx)(ft,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(N,{children:`Edit`}),(0,X.jsx)(N,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(N,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(wt,{className:`w-80`,children:[(0,X.jsxs)(yt,{children:[(0,X.jsx)(St,{children:`Instance`}),(0,X.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(bt,{className:`gap-2`,children:[(0,X.jsx)(O,{size:`sm`,children:`Save`}),(0,X.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Dt,{children:[(0,X.jsx)(Tt,{children:(0,X.jsxs)(W,{children:[(0,X.jsx)(U,{className:`w-8`,children:(0,X.jsx)(H,{"aria-label":`select all`})}),(0,X.jsx)(U,{children:`Name`}),(0,X.jsx)(U,{children:`Mode`}),(0,X.jsx)(U,{className:`text-right`,children:`Status`}),(0,X.jsx)(U,{className:`w-8`})]})}),(0,X.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(W,{children:[(0,X.jsx)(G,{children:(0,X.jsx)(H,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(G,{className:`font-medium`,children:e.n}),(0,X.jsx)(G,{children:(0,X.jsx)(A,{variant:`secondary`,children:e.m})}),(0,X.jsx)(G,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(F,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(G,{children:(0,X.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(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 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$k as i,AS as a,Ak as o,BS as s,Bk as c,CS as l,D as u,DS as d,ES as f,FS as ee,Fk as p,GS as te,HS as m,Hk as h,IS as g,Ik as _,JS as ne,Ji as v,Jk as y,KS as re,LS as ie,Lk as b,MS as ae,Mk as oe,NS as se,Nk as ce,OS as le,PS as ue,Pk as x,QS as de,Qk as S,RS as fe,Rk as C,SS as pe,TS as me,US as he,Uk as ge,VS as _e,Vk as w,WS as ve,XS as ye,Xk as T,YS as be,Yi as xe,Yk as E,ZS as Se,Zk as Ce,_A as we,aA as D,aB as O,bS as k,cA as A,dA as Te,eA as j,eC as Ee,fA as De,gA as Oe,hA as ke,iA as Ae,iB as M,jS as je,jk as Me,kS as Ne,kk as N,lA as P,mA as Pe,nA as Fe,oA as F,pA as Ie,qS as Le,qi as Re,rA as ze,sA as Be,t as I,tA as Ve,tC as He,uA as Ue,vA as We,vS as Ge,wS as Ke,xS as qe,yS as Je,zS as Ye,zk as Xe}from"./api-CyG2Kb2E.js";import{t as Ze}from"./x-CHe0mcCM.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-D_DuLEpU.js";import{t as z}from"./button-SxU4iS5M.js";import{$ as B,Et as V,Gn as et,H as tt,In as nt,Kn as rt,Mn as it,Nn as at,On as ot,Q as H,Un as st,X as U,Z as W,a as ct,at as lt,ct as G,et as K,i as ut,lt as dt,nt as ft,o as pt,ot as mt,q as ht,rt as gt,s as _t,tt as vt}from"./index-DWkl2h55.js";import{n as yt}from"./TimeRangePicker-Dx50b9Tc.js";import{t as bt}from"./FilterBar-BS4HsrlJ.js";import{t as xt}from"./AdvancedFilter-Ddd7TM1I.js";import{t as St}from"./DataTableShell-D2srrwu0.js";var Ct=u(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?i():n===`agent`?`${S()} - ${r}`:e}function Tt(){let e=O(I.me.getMe,{host:ht})?.role===`admin`,t=O(I.deliveryTiming.getDeliveryStatus,{}),n=M(I.deliveryTiming.startDeliveryRecord),r=M(I.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:We()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:we()})]}),e?(0,J.jsx)(z,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?ke():Oe()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:Pe()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Ie({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Ue():Te()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=O(I.deliveryTiming.listDeliverySessions,{}),n=M(I.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:ee}=yt(c),p=c.to===`now`?1/0:ee,te=r.trim()!==``||a!==`all`||c!==Y,m=()=>{i(``),s(`all`),l(Y)},h=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=p).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,p]),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:r,onQChange:i,searchPlaceholder:A(),timeRange:c,onTimeRangeChange:l,onReset:m,canReset:te,children:(0,J.jsxs)(U,{value:a,onValueChange:e=>s(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:`all`,children:Be()}),(0,J.jsx)(H,{value:`active`,children:F()}),(0,J.jsx)(H,{value:`stopped`,children:D()})]})]})}),(0,J.jsx)(St,{title:P(),rows:h,emptyHint:o(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?T():Ce(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:Ae(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:ze(),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:G(e.stoppedAt)})},{header:Fe(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:Ve(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:j(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:F()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:D()})}],rowActions:e?e=>[{label:E(),variant:`destructive`,onSelect:()=>g([e.sessionId])}]:void 0,bulkActions:e?[{label:E(),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=O(I.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(tt(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:y()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()});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,` `,N()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(st,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?Me():oe()]})]}),(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:w()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:c()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Xe()})]})}),(0,J.jsxs)(`tbody`,{children:[i(C(),r.bridge),i(b(),r.A),i(_(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]})}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:xe()},{value:`principalType`,label:v()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Re()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=rt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,i=e.kind,o=e.statusClass??Q,c=e.principalType??Q,u=e.direction??Q,p=e.roleKey??Q,_=e.q??``,v=e.correlationId,y=ut(e.from,e.to),b=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:oe,to:ce}=yt(y),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),xe=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Ce=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),we=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,...pt(e)})}),Te=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),j=O(I.observability.listEvents,{limit:n}),De=O(I.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...v?{correlationId:v}:{},filter:{q:_||void 0,from:oe,to:ce,statusClass:o===Q?void 0:o,principalType:c===Q?void 0:c,direction:u===Q?void 0:u,roleKey:p===Q?void 0:p,advanced:b.length>0?b:void 0}}),Oe=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),ke=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),Ae=_!==``||o!==Q||c!==Q||u!==Q||p!==Q||b.length>0||y.kind!==`relative`||y.from!==Nt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let Me=x?j?.filter(e=>e.correlationId===x):De,N=e.section,P=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:N,onValueChange:e=>P(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ot,{size:13,"aria-hidden":!0}),ge()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),h()]})]}),(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:[He(),(0,J.jsx)(`strong`,{children:Ee()}),r(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:de()})]}),(0,J.jsxs)(bt,{q:_,onQChange:E,searchPlaceholder:Se(),timeRange:y,onTimeRangeChange:A,onReset:M,canReset:Ae,children:[(0,J.jsxs)(U,{value:o,onValueChange:Ce,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ye()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:be()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:we,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ne()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Le()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:u,onValueChange:D,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:re()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:te()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:p,onValueChange:k,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:ve()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:he()}),ke.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===Z?``:i,placeholder:m(),"aria-label":m(),onChange:e=>{let t=e.target.value.trim();xe(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)(U,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(K,{})}),(0,J.jsx)(W,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:_e({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:b,onChange:Te}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:s(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Ye(),(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:fe()})]})}):null,(0,J.jsx)(St,{title:ie(),rows:Me,emptyHint:x?g():ee(),columns:[{header:ue(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:se(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:ae(),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":je(),children:`✓`})}},{header:a(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(V,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Ne(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:le(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:d(),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:f(),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:me(),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:Ke(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:l(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:pe(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:qe()}):(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)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ft,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(mt,{className:`oc-traces__meta-title`,children:[k(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:Je()})]}),(0,J.jsx)(gt,{children:Ge()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AD as i,BD as a,Bx as o,CD as s,Cp as c,DD as l,ED as u,FD as d,Fx as f,GD as p,HD as ee,Hx as m,ID as h,Ix as g,KD as _,LD as te,Lx as v,MD as ne,Mx as y,ND as b,Nx as x,OD as re,PD as ie,Px as S,RD as ae,Rx as C,SD as oe,Sp as w,TD as se,UD as T,Ux as E,VD as ce,Vx as D,WD as O,Wx as k,aB as A,bD as le,iB as j,jD as ue,kD as de,t as M,vD as fe,wD as pe,xD as me,xp as N,yD as he,zD as ge,zx as P}from"./api-CyG2Kb2E.js";import{t as F}from"./button-SxU4iS5M.js";import{$ as I,Dt as L,Et as R,Ft as z,Gn as _e,Kn as ve,Lt as ye,Mt as be,Nt as xe,Pt as Se,Q as B,U as Ce,W as we,X as V,Z as H,at as Te,c as U,et as W,fn as G,l as Ee,nt as De,ot as Oe,pn as K,q as ke,rt as Ae,tt as q,u as J,ut as Y}from"./index-DWkl2h55.js";import{t as je}from"./FilterBar-BS4HsrlJ.js";import{t as Me}from"./DataTableShell-D2srrwu0.js";import{t as Ne}from"./DetailChips-WUMzjman.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=A(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=A(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(a??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).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}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Z.jsx)(q,{open:n,onOpenChange:r,children:(0,Z.jsxs)(De,{className:`oc-access`,children:[(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(Oe,{children:k({user:t})}),(0,Z.jsx)(Ae,{children:E()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?m():D()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:o()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:v()}):[...f.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=j(M.agents.assignAgent),s=j(M.agents.removeAgent),c=j(M.agents.setDefaultAgent),l=L();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(P(),e)}}async function d(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(C(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(K,{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)(Y,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":g({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:f()}):null,e.outOfPool?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:S()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":x(),title:x(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":y(),title:y(),disabled:c,onClick:()=>void d(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return N();case`user`:return w();case`admin`:return c();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(J[e])).length;return(0,Z.jsxs)(be,{children:[(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?_():p({count:r})})}),(0,Z.jsxs)(xe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(z,{children:O()}),U.map(e=>{let r=J[e];return(0,Z.jsxs)(Se,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(Y,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Le(){let e=ve({from:`/settings/users`}),t=_e({from:`/settings/users`}),n=e.q??``,o=e.role??Q,c=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})}),p=A(M.admin.listUsers,{filter:{q:n||void 0,role:o===Q?void 0:o},withAgents:!0}),m=A(M.me.getMe,{host:ke}),g=j(M.admin.setRole),_=j(M.admin.setUserPermissions),v=j(M.admin.startImpersonation),y=j(M.admin.deleteUser),x=j(M.admin.setUserName),S=Ce(),C=we(),w=L(),[E,D]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of p??[])e.add(t.role);return[...e]},[p]),k=n!==``||o!==Q;function N(){t({search:{},replace:!0})}async function P(e){try{await g(e)}catch(e){w.error(T(),e)}}async function F(e){try{await _(e)}catch(e){w.error(ee(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:d(),description:ie({user:t}),confirmWord:b(),confirmLabel:ne(),destructive:!0}))try{await y({profileId:e._id}),w.success(i({user:t}))}catch(e){w.error(ue(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await C({title:re(),label:l({user:t}),placeholder:u(),defaultValue:e.name??``,confirmLabel:r()});if(n!==null)try{await x({profileId:e._id,name:n}),w.success(se())}catch(e){w.error(pe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:c,searchPlaceholder:ce(),onReset:N,canReset:k,children:(0,Z.jsxs)(V,{value:o,onValueChange:f,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:Q,children:a()}),O.map(e=>(0,Z.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:ge(),rows:p,emptyHint:ae(),rowActions:e=>{let t=[{label:fe(),onSelect:()=>D({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:de(),onSelect:()=>void z(e)}];return e.userId!==m?.userId&&t.push({label:te(),onSelect:()=>void v({profileId:e._id})},{label:h(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:s(),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:oe(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(B,{value:`user`,children:$(`user`)}),(0,Z.jsx)(B,{value:`admin`,children:$(`admin`)})]})]})},{header:me(),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:le()}):(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)(K,{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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,Bn as i,Ff as a,Gn as o,Gr as s,Hn as c,Jn as l,Jr as u,Kr as d,Ln as ee,Qn as f,Qr as te,Qz as ne,Rn as re,Tn as p,Un as m,Wn as h,Wr as g,XO as _,Xn as v,Xr as y,Xz as b,Yn as ie,Yr as x,Zn as ae,Zr as S,aB as C,ai as oe,ar as se,ci as w,di as T,ei as E,fd as D,fi as O,iB as k,ii as ce,li as A,mi as le,nB as ue,ni as de,oi as j,pi as fe,qr as M,ri as pe,si as N,t as P,ti as F,ud as I,ui as L,zn as R}from"./api-CyG2Kb2E.js";import{i as z,n as B,r as me,t as he}from"./tabs-D_DuLEpU.js";import{t as V}from"./button-SxU4iS5M.js";import{$ as H,$t as ge,Cn as _e,Et as U,Gn as ve,Kn as ye,Q as W,Wn as be,X as G,Z as K,an as xe,en as Se,et as q,in as J,nn as Ce,q as we,rn as Y,sn as Te,tn as Ee,ut as X}from"./index-DWkl2h55.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>N()],[`fr-FR`,()=>f()],[`en-US`,()=>ae()],[`en-GB`,()=>v()],[`de-DE`,()=>ie()],[`es-ES`,()=>l()]],Oe=[[`0.75`,()=>oe()],[`1`,()=>ce()],[`1.25`,()=>pe()],[`1.5`,()=>de()]],$=0;function ke({instance:e}){let t=k(P.admin.upsertInstanceConfig),n=e.config??{},o={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(`idle`),[d,f]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),g=ue(P.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{c({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),u(`idle`)},[e._id]);let _=s.enabled!==o.enabled||s.engine!==o.engine||s.lang!==o.lang||s.rate!==o.rate||s.autoRead!==o.autoRead;async function v(){u(`saving`);try{let n={...e.config??{}};n.voiceEnabled=s.enabled,s.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,s.lang===`auto`?delete n.voiceLang:n.voiceLang=s.lang;let r=Number.parseFloat(s.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,s.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),u(`idle`)}catch{u(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{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:s.enabled,onCheckedChange:e=>c({...s,enabled:e===!0}),"aria-label":A()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,Q.jsxs)(G,{value:s.engine,onValueChange:e=>c({...s,engine:e}),disabled:!s.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(W,{value:`browser`,children:R()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:re()})]})]})]}),s.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()}):null,s.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,Q.jsxs)(G,{value:s.lang,onValueChange:e=>c({...s,lang:e}),disabled:!s.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":w(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,Q.jsxs)(G,{value:s.rate,onValueChange:e=>c({...s,rate:e}),disabled:!s.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":j(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),s.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:s.autoRead,onCheckedChange:e=>c({...s,autoRead:e===!0}),disabled:!s.enabled,"aria-label":F()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:F()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:E()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!_||l===`saving`,onClick:()=>void v(),children:l===`saving`?a():D()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!s.enabled||d,onClick:()=>{let t=Number.parseFloat(s.rate)||1,n=++$;if(h(!1),J(),Y(),s.engine!==`gateway`){Ce(S(),{lang:Ee(s.lang,ne()),rate:t});return}f(!0),g({instanceName:e.name,text:S()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&h(!0)}).finally(()=>f(!1))},children:d?a():r()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,f(!1),J(),Y()},children:te()})]}),l===`error`||m?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m?p():I()}):null]})}function Ae({stt:e}){let t=C(P.me.getMe,{host:we}),n=k(P.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:x()}),(0,Q.jsx)(U,{variant:e?`secondary`:`outline`,children:e?s():g()}),(0,Q.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?h():m()})]}),i?(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":o()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]})}function je(){let e=C(P.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ge(),[]),{section:r}=ye({from:`/settings/voice`}),i=ve({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?fe():O()}),(0,Q.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?T():L()})]}),(0,Q.jsxs)(he,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(me,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),c()]}),(0,Q.jsxs)(z,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),x()]}),(0,Q.jsxs)(z,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),M()]})]}),(0,Q.jsx)(B,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(B,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(B,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:M()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=k(P.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)(U,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:se()}):(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":_()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]})]})}export{je as VoiceTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e}from"./api-CyG2Kb2E.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ah as e,Bh as t,Bt as n,Ch as r,Dh as i,Eh as a,Fh as o,Ih as s,Lh as c,Mh as l,Nh as u,Oh as d,Ph as f,Rh as p,Sh as m,Th as h,Vh as g,_h as _,bh as v,ch as y,dh as b,fh as x,gh as S,hh as C,jh as w,kh as T,lh as E,mh as D,ph as O,sh as k,uh as A,vh as j,wh as M,xh as N,yh as P,zh as F,zt as I}from"./api-CyG2Kb2E.js";var L={AGENT_NOT_FOUND:()=>({label:g(),hint:t()}),AUTH_TOKEN_MISMATCH:()=>({label:F(),hint:p()}),DEVICE_SIGNING_FAILED:()=>({label:c(),hint:s()}),SESSION_SCOPE_DENIED:()=>({label:o(),hint:f()}),GATEWAY_TIMEOUT:()=>({label:u(),hint:l()}),GATEWAY_DISCONNECTED:()=>({label:w(),hint:e()}),GATEWAY_RESTARTING:()=>({label:T(),hint:d()}),CONNECTION_SATURATED:()=>({label:i(),hint:a()}),DISPATCH_STALLED:()=>({label:n(),hint:I()}),ATTACHMENT_TOO_LARGE:()=>({label:r(),hint:m()}),ATTACHMENT_REJECTED:()=>({label:N(),hint:v()}),BRIDGE_UNREACHABLE:()=>({label:h(),hint:M()}),INVALID_REQUEST:()=>({label:P(),hint:j()}),chat_request_conflict:()=>({label:_(),hint:S()}),NOT_CONFIGURED:()=>({label:C(),hint:D()}),UNROUTED:()=>({label:O(),hint:x()}),UPSTREAM_ERROR:()=>({label:b(),hint:A()}),UNKNOWN:()=>({label:E(),hint:y()})};function R(e){return e?L[e]?.()??{label:e,hint:k()}:L.UNKNOWN()}export{R as t};
|