@lacneu/atrium 0.75.1 → 0.75.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/assets/{AccessTab-D4QP4p9J.js → AccessTab-CDE1CUNG.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-Cj03B7Mb.js → AdvancedFilter-Cp_QQRkp.js} +1 -1
  3. package/dist/assets/{AgentFilesTab-Bnn47As9.js → AgentFilesTab-84NHw12x.js} +1 -1
  4. package/dist/assets/{AnomaliesTab-BCw0xO9Y.js → AnomaliesTab-CbiQBLaf.js} +1 -1
  5. package/dist/assets/{AuditTab-gHQ_wQmh.js → AuditTab-CLKyRqiM.js} +1 -1
  6. package/dist/assets/{BridgeTab-DwjWGxdx.js → BridgeTab-DrSqWmlb.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-eUFvsrmp.js → ChatDefaultsTab-aJk775U1.js} +1 -1
  8. package/dist/assets/{DataTableShell-hu5AF3BF.js → DataTableShell-mx-pazY0.js} +1 -1
  9. package/dist/assets/{DetailChips-CPHHClkW.js → DetailChips-CueZT7sb.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-Cl4rHkqk.js → FeedbacksTab-Dj1AU6BI.js} +1 -1
  11. package/dist/assets/{FieldLabel-orXtJQ8U.js → FieldLabel-ClaiY1oM.js} +1 -1
  12. package/dist/assets/{FilesTab-BgNepwhZ.js → FilesTab-DNkmnOMq.js} +1 -1
  13. package/dist/assets/{FilterBar-B3g5mQkA.js → FilterBar-DdAB946f.js} +1 -1
  14. package/dist/assets/{GroupsTab-iNciegdR.js → GroupsTab-BfNPrple.js} +1 -1
  15. package/dist/assets/{InstancesTab-D6lM2BsV.js → InstancesTab-B1q-VPzM.js} +1 -1
  16. package/dist/assets/{IntegrationsTab--a2Y9KS4.js → IntegrationsTab-CIQHHrtM.js} +1 -1
  17. package/dist/assets/{KpiTab-Fl5Bk8Gj.js → KpiTab-D7I4BLy0.js} +1 -1
  18. package/dist/assets/{PreferencesTab-axQ_DQ-W.js → PreferencesTab-D9568hwy.js} +1 -1
  19. package/dist/assets/{ProjectPage-Bd7DK5RJ.js → ProjectPage-B_FMZbLH.js} +1 -1
  20. package/dist/assets/{PromptInjectionsTab-OiV13dvS.js → PromptInjectionsTab-D9-b5ifr.js} +1 -1
  21. package/dist/assets/{RolesTab-CeTKQHRD.js → RolesTab-BkbtDwIw.js} +1 -1
  22. package/dist/assets/{ScheduledTab-B0jErNoz.js → ScheduledTab-D3etFLpV.js} +1 -1
  23. package/dist/assets/{ServiceAccountsTab-BHe_p9wb.js → ServiceAccountsTab-BD4IKtYE.js} +1 -1
  24. package/dist/assets/{SubAgentReportsTab-BUXZQIyv.js → SubAgentReportsTab-XllkVE3H.js} +1 -1
  25. package/dist/assets/{ThemeShowroom-Bz6AuYIe.js → ThemeShowroom-Ba6uUvIV.js} +1 -1
  26. package/dist/assets/{TimeRangePicker-CS4l2E_Y.js → TimeRangePicker-DwIZMTeU.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-C6dFG3Xz.js → TimezoneCombobox-Hbv2mUXV.js} +1 -1
  28. package/dist/assets/{TracesTab-C66qWc1i.js → TracesTab-BftRoL7z.js} +1 -1
  29. package/dist/assets/{UsersTab-Bclv37Pv.js → UsersTab-CThOoRhK.js} +1 -1
  30. package/dist/assets/{VoiceTab-DjZp4YXH.js → VoiceTab-BcPu4cdA.js} +1 -1
  31. package/dist/assets/{highlighted-body-OFNGDK62-CEI-JPe4.js → highlighted-body-OFNGDK62-DhlWlGbp.js} +1 -1
  32. package/dist/assets/{index-BfYewJnn.css → index-Cb1uiZUw.css} +1 -1
  33. package/dist/assets/{index-CFqHR0gi.js → index-MXp7-qZv.js} +6 -6
  34. package/dist/assets/mermaid-GHXKKRXX-CvN6rE1W.js +1 -0
  35. package/dist/assets/{pdf-Bymhe00c.js → pdf-D1NPUlhY.js} +1 -1
  36. package/dist/assets/{tabs-BQOp_WCt.js → tabs-C9_bsrsA.js} +1 -1
  37. package/dist/index.html +2 -2
  38. package/package.json +1 -1
  39. package/dist/assets/mermaid-GHXKKRXX-BKAkYTvj.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Bs as i,Cc as a,Gs as o,Hs as s,Js as c,Ks as l,Qs as u,Sc as d,Tz as f,Us as p,Vs as m,Ws as h,Xs as g,Ys as _,Zs as v,_c as y,ac as b,bc as x,cc as S,dc as C,ec as w,fc as T,gc as E,hc as D,ic as O,lc as k,mc as A,nc as j,oc as M,pc as N,qs as P,rc as F,sc as I,t as L,tc as R,uc as ee,vc as z,wc as B,wz as V,xc as H,yc as U}from"./api-CMppRsht.js";import{t as W}from"./button-IhgT55aN.js";import{U as G,ct as K}from"./index-CFqHR0gi.js";import{t as q}from"./DataTableShell-hu5AF3BF.js";var J=t(e(),1),Y=n(),X={hung:()=>I(),wrong_result:()=>M(),error:()=>b(),other:()=>O()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=V(L.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[s,d]=(0,J.useState)(``),[f,m]=(0,J.useState)(!1);async function y(){let t=s.trim();if(!(!t||f)){m(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{m(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,F({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(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:R()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?w():r()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:u()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:s,maxLength:2e3,rows:3,onChange:e=>d(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 y(),disabled:!s.trim()||f,children:f?_():g()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[c({count:t.children.length}),t.childrenTruncated?` ${P()}`:``,t.textTruncated?` ${l()}`:``]}),(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?` · ${o()}`:``]}),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:p()}),(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=f(L.subAgentReports.listForAdmin,{}),t=V(L.subAgentReports.readReport),n=V(L.subAgentReports.deleteReport),r=G(),[o,c]=(0,J.useState)(null),[l,u]=(0,J.useState)({});async function p(e){if(o===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function h(e){await r({title:s(),description:m(),confirmLabel:i(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,Y.jsx)(`strong`,{children:H()}),` `,x()]}),(0,Y.jsx)(q,{title:B(),rows:e,emptyHint:a(),isExpanded:e=>o===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Y.jsx)($,{data:l[e._id]}):null,columns:[{header:U(),cell:e=>K(e.at),sort:e=>e.at},{header:z(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:y(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:E(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${N({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:D(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),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:C()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?k():ee(),onSelect:()=>void p(e)},{label:S(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$s as r,Bs as i,Cc as a,Gs as o,Hs as s,Js as c,Ks as l,Qs as u,Sc as d,Tz as f,Us as p,Vs as m,Ws as h,Xs as g,Ys as _,Zs as v,_c as y,ac as b,bc as x,cc as S,dc as C,ec as w,fc as T,gc as E,hc as D,ic as O,lc as k,mc as A,nc as j,oc as M,pc as N,qs as P,rc as F,sc as I,t as L,tc as R,uc as ee,vc as z,wc as B,wz as V,xc as H,yc as U}from"./api-CMppRsht.js";import{t as W}from"./button-IhgT55aN.js";import{U as G,ct as K}from"./index-MXp7-qZv.js";import{t as q}from"./DataTableShell-mx-pazY0.js";var J=t(e(),1),Y=n(),X={hung:()=>I(),wrong_result:()=>M(),error:()=>b(),other:()=>O()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=V(L.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[s,d]=(0,J.useState)(``),[f,m]=(0,J.useState)(!1);async function y(){let t=s.trim();if(!(!t||f)){m(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{m(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,F({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(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:R()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?w():r()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:u()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:v(),value:s,maxLength:2e3,rows:3,onChange:e=>d(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 y(),disabled:!s.trim()||f,children:f?_():g()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[c({count:t.children.length}),t.childrenTruncated?` ${P()}`:``,t.textTruncated?` ${l()}`:``]}),(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?` · ${o()}`:``]}),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:p()}),(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=f(L.subAgentReports.listForAdmin,{}),t=V(L.subAgentReports.readReport),n=V(L.subAgentReports.deleteReport),r=G(),[o,c]=(0,J.useState)(null),[l,u]=(0,J.useState)({});async function p(e){if(o===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function h(e){await r({title:s(),description:m(),confirmLabel:i(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,Y.jsx)(`strong`,{children:H()}),` `,x()]}),(0,Y.jsx)(q,{title:B(),rows:e,emptyHint:a(),isExpanded:e=>o===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Y.jsx)($,{data:l[e._id]}):null,columns:[{header:U(),cell:e=>K(e.at),sort:e=>e.at},{header:z(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:y(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:E(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${N({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:D(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),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:C()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?k():ee(),onSelect:()=>void p(e)},{label:S(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AF as i,AP as a,BF as o,BP as s,CF as c,CP as l,DF as u,DP as d,EF as f,EP as p,FF as m,FP as h,GP as g,HF as _,HP as v,IF as ee,IP as te,Is as ne,JP as re,KP as ie,LF as ae,LP as oe,Ls as se,MF as ce,MP as le,NF as ue,NP as de,OF as fe,OP as pe,PF as y,PP as me,QP as he,RF as ge,RP as _e,Rs as b,SF as ve,SP as ye,Sz as be,TF as xe,TP as Se,Tz as x,UF as Ce,UP as we,VF as Te,VP as Ee,WF as De,WP as Oe,XP as ke,YP as Ae,ZP as je,_F as Me,aF as Ne,bF as Pe,cF as Fe,dF as Ie,eF as Le,fF as Re,fz as ze,gF as Be,hF as Ve,iF as He,jF as Ue,jP as We,kF as Ge,kP as Ke,lF as qe,mF as Je,mz as Ye,nF as Xe,oF as Ze,pF as Qe,pz as $e,qP as et,r as tt,rF as nt,sF as S,t as C,tF as rt,uF as it,vF as at,wF as ot,wP as st,wz as w,xF as ct,yF as lt,zF as ut,zP as dt,zs as T}from"./api-CMppRsht.js";import{t as E}from"./check-7d2-JR5i.js";import{t as D}from"./x-CdHbCgxq.js";import{t as O}from"./button-IhgT55aN.js";import{$ as k,Dn as A,Et as j,Ft as ft,G as pt,It as M,K as mt,Lt as ht,Mt as gt,Nt as _t,On as vt,Pt as N,Q as P,X as F,Z as I,et as L,jt as R,q as z,rn as B,ut as V}from"./index-CFqHR0gi.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-ClDtGwk1.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-E4WVxNnB.js";import{t as kt}from"./TimeRangePicker-CS4l2E_Y.js";import{t as At}from"./FilterBar-B3g5mQkA.js";import{t as jt}from"./AdvancedFilter-Cj03B7Mb.js";var G=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(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 It(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 K(e,t,n){return It(e,t,n)>=Mt}function Lt(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 Rt(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 zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(g());if(e.size>zt)throw Error(Oe());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/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(v());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(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(v());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);K(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=K(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await J(f,`image/webp`,Ht)??await J(f,`image/png`);if(!h)throw Error(Ee());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return q(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 q(e)}async function q(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(we())),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 J(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Y=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var X=`__all__`,Z={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,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Y.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Ye():e===`dark`?$e():ze()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Y.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Y.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,Y.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:tt(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Y.jsx)(E,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Y.jsx)(Yt,{tokens:r,mode:i}):(0,Y.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Y.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Y.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Y.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,Y.jsx)(vt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(C.charts.listMyCharts),r=w(C.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Y.jsx)(Xt,{selected:e===null,title:y(),subtitle:ue(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?ce():n.via===`owner`?Ue():i({group:n.via.group});return(0,Y.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ge()}):null]})}function Qt(){let e=w(C.charts.importChart),[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(S())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Ne());return}let a;try{a=JSON.parse(r)}catch{o(S());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:Ve()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Qe()}),(0,Y.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:Re(),maxLength:60})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:it(),rows:8,spellCheck:!1})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(B,{className:`size-4`}),qe(),(0,Y.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,Y.jsx)(O,{size:`sm`,disabled:l,onClick:()=>void f(),children:Fe()})]}),a?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Y.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ze()}):null]})]})}function $t({chart:e}){let t=be(C.charts.setChartLogo),n=w(C.charts.removeChartLogo),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Ut(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?he():je()}),(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Y.jsx)(`img`,{src:t,alt:``}):null}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(B,{className:`size-4`}),t?Ae():ke(),(0,Y.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(e),children:et()}):null,t?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void d(e),children:re()}):null]})}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:r()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Y.jsx)(p,{mode:`light`}),(0,Y.jsx)(p,{mode:`dark`})]}),i?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ie()}):null,o?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=x(C.me.getMe,{host:z}),n=w(C.charts.addChartDomain),r=w(C.charts.removeChartDomain),[i,a]=(0,G.useState)(``),[o,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:s()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:te()}):d.map(e=>(0,Y.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":h({domain:e}),onClick:()=>void p(e),children:(0,Y.jsx)(D,{className:`size-3`})})]},e))}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:_e(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:oe()})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:dt()}),o?(0,Y.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=w(C.charts.updateChart),n=w(C.charts.deleteChart),[r,i]=(0,G.useState)(!1),[o,s]=(0,G.useState)(e.name),[c,l]=(0,G.useState)(()=>$(e.tokens)),[u,d]=(0,G.useState)(e.tokens.bpm??0),[f,p]=(0,G.useState)(null),[m,h]=(0,G.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(S());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(a()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:g,children:rt()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:Le()})]})})]}),r?(0,Y.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:le()}),(0,Y.jsx)(R,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:b()}),(0,Y.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Y.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":b()}),(0,Y.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?se():`${u} BPM`})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ne()})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:We()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,disabled:m,onClick:()=>void _(),children:me()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:de()})]})]}):null,(0,Y.jsx)($t,{chart:e}),(0,Y.jsx)(en,{chart:e})]})}function nn(){let e=x(C.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:He()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),e!==void 0&&t.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Xe()}):(0,Y.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Y.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=w(C.charts.addChartToGroupPool),r=w(C.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(j,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ct():e.kind===`custom`&&e.scope===`personal`?p():ve()}),e.isGlobalDefault?(0,Y.jsx)(j,{variant:`default`,children:Pe()}):null]}),(0,Y.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:at()}),(a??[]).map(e=>(0,Y.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Be({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Y.jsx)(D,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Y.jsxs)(F,{value:``,onValueChange:e=>void c(e),children:[(0,Y.jsx)(k,{size:`sm`,className:`w-56`,children:(0,Y.jsx)(L,{placeholder:Me()})}),(0,Y.jsx)(I,{children:s.map(e=>(0,Y.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:lt()}):null]})]})}function an({chart:e}){let t=w(C.charts.promoteChartToCommon),n=w(C.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(a()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Se():p()}),e.ownerLabel?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:d({owner:e.ownerLabel})}):null]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:st()}):null,(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:l()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=w(C.admin.setDefaultThemeMode),i=w(C.admin.setDefaultLocale),a=w(C.charts.setDefaultChart),s=x(C.charts.listChartsAdmin),l=x(C.groups.listGroups,{}),d=e??`system`,p=t??`fr`;return(0,Y.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ge()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:fe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:y()}),mt.map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:f()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Y.jsx)(rn,{chart:e,groups:l??[]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:ot()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Y.jsx)(en,{chart:e})]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:Ke()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ye()}):(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Y.jsx)(an,{chart:e},e.key))})})()]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:De()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Y.jsx)(O,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:_()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,Y.jsx)(O,{variant:p===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:o()})]})]})}function sn(){let e=x(C.me.getMe,{host:z}),t=pt(e?.resolvedThemeMode);return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Y.jsx)(Qt,{}),(0,Y.jsx)(nn,{}),e?.role===`admin`?(0,Y.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,G.useState)(!0),[n,r]=(0,G.useState)(`per-user`),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(X),[c,l]=(0,G.useState)(X),[u,d]=(0,G.useState)(Z),f=i!==``||o!==X||c!==X;function p(){a(``),s(X),l(X),d(Z)}return(0,Y.jsxs)(`div`,{className:`oc-show`,children:[(0,Y.jsx)(sn,{}),(0,Y.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Y.jsx)(`summary`,{className:`oc-show__title`,children:ut()}),(0,Y.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(O,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,Y.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,Y.jsx)(O,{variant:`link`,children:`Link`})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Small`}),(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{size:`lg`,children:`Large`}),(0,Y.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,Y.jsx)(A,{})}),(0,Y.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,Y.jsx)(Q,{title:`Badges`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(j,{children:`Default`}),(0,Y.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,Y.jsx)(Q,{title:`Inputs & selection`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(R,{placeholder:`Text input…`}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsxs)(F,{value:n,onValueChange:r,children:[(0,Y.jsx)(k,{className:`w-56`,children:(0,Y.jsx)(L,{placeholder:`Select…`})}),(0,Y.jsxs)(I,{children:[(0,Y.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Y.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Y.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Y.jsx)(V,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Y.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,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Y.jsxs)(F,{value:o,onValueChange:s,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(L,{})}),(0,Y.jsxs)(I,{children:[(0,Y.jsx)(P,{value:X,children:`Toutes directions`}),(0,Y.jsx)(P,{value:`inbound`,children:`inbound`}),(0,Y.jsx)(P,{value:`outbound`,children:`outbound`}),(0,Y.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,Y.jsxs)(F,{value:c,onValueChange:l,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(L,{})}),(0,Y.jsxs)(I,{children:[(0,Y.jsx)(P,{value:X,children:`Toutes sévérités`}),(0,Y.jsx)(P,{value:`info`,children:`info`}),(0,Y.jsx)(P,{value:`warn`,children:`warn`}),(0,Y.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,Y.jsx)(jt,{fields:Kt,onChange:()=>{}}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Y.jsx)(kt,{value:u,onChange:d})]})]})}),(0,Y.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Y.jsxs)(gt,{children:[(0,Y.jsx)(ht,{asChild:!0,children:(0,Y.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Y.jsx)(A,{})})}),(0,Y.jsxs)(_t,{align:`start`,children:[(0,Y.jsx)(ft,{children:`Actions`}),(0,Y.jsx)(M,{}),(0,Y.jsx)(N,{children:`Edit`}),(0,Y.jsx)(N,{children:`Duplicate`}),(0,Y.jsx)(M,{}),(0,Y.jsx)(N,{variant:`destructive`,children:`Delete`})]})]})}),(0,Y.jsx)(Q,{title:`Card`,children:(0,Y.jsxs)(Tt,{className:`w-80`,children:[(0,Y.jsxs)(bt,{children:[(0,Y.jsx)(Ct,{children:`Instance`}),(0,Y.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,Y.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Y.jsxs)(xt,{className:`gap-2`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Save`}),(0,Y.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Y.jsx)(Q,{title:`Table`,children:(0,Y.jsxs)(Ot,{children:[(0,Y.jsx)(Et,{children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(H,{className:`w-8`,children:(0,Y.jsx)(V,{"aria-label":`select all`})}),(0,Y.jsx)(H,{children:`Name`}),(0,Y.jsx)(H,{children:`Mode`}),(0,Y.jsx)(H,{className:`text-right`,children:`Status`}),(0,Y.jsx)(H,{className:`w-8`})]})}),(0,Y.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{children:(0,Y.jsx)(V,{"aria-label":`select ${e.n}`})}),(0,Y.jsx)(W,{className:`font-medium`,children:e.n}),(0,Y.jsx)(W,{children:(0,Y.jsx)(j,{variant:`secondary`,children:e.m})}),(0,Y.jsx)(W,{className:`text-right`,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Y.jsx)(E,{className:`size-3.5`}),` `,e.s]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Y.jsx)(A,{})})})]},e.n))})]})}),(0,Y.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Y.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Y.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Y.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Y.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Y.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Y.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Y.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Y.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Y.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AF as i,AP as a,BF as o,BP as s,CF as c,CP as l,DF as u,DP as d,EF as f,EP as p,FF as m,FP as h,GP as g,HF as _,HP as v,IF as ee,IP as te,Is as ne,JP as re,KP as ie,LF as ae,LP as oe,Ls as se,MF as ce,MP as le,NF as ue,NP as de,OF as fe,OP as pe,PF as y,PP as me,QP as he,RF as ge,RP as _e,Rs as b,SF as ve,SP as ye,Sz as be,TF as xe,TP as Se,Tz as x,UF as Ce,UP as we,VF as Te,VP as Ee,WF as De,WP as Oe,XP as ke,YP as Ae,ZP as je,_F as Me,aF as Ne,bF as Pe,cF as Fe,dF as Ie,eF as Le,fF as Re,fz as ze,gF as Be,hF as Ve,iF as He,jF as Ue,jP as We,kF as Ge,kP as Ke,lF as qe,mF as Je,mz as Ye,nF as Xe,oF as Ze,pF as Qe,pz as $e,qP as et,r as tt,rF as nt,sF as S,t as C,tF as rt,uF as it,vF as at,wF as ot,wP as st,wz as w,xF as ct,yF as lt,zF as ut,zP as dt,zs as T}from"./api-CMppRsht.js";import{t as E}from"./check-7d2-JR5i.js";import{t as D}from"./x-CdHbCgxq.js";import{t as O}from"./button-IhgT55aN.js";import{$ as k,Dn as A,Et as j,Ft as ft,G as pt,It as M,K as mt,Lt as ht,Mt as gt,Nt as _t,On as vt,Pt as N,Q as P,X as F,Z as I,et as L,jt as R,q as z,rn as B,ut as V}from"./index-MXp7-qZv.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-ClDtGwk1.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-E4WVxNnB.js";import{t as kt}from"./TimeRangePicker-DwIZMTeU.js";import{t as At}from"./FilterBar-DdAB946f.js";import{t as jt}from"./AdvancedFilter-Cp_QQRkp.js";var G=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(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 It(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 K(e,t,n){return It(e,t,n)>=Mt}function Lt(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 Rt(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 zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(g());if(e.size>zt)throw Error(Oe());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/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(v());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(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(v());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);K(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=K(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await J(f,`image/webp`,Ht)??await J(f,`image/png`);if(!h)throw Error(Ee());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return q(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 q(e)}async function q(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(we())),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 J(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Y=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var X=`__all__`,Z={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,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Y.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Ye():e===`dark`?$e():ze()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Y.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Y.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,Y.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Y.jsxs)(`button`,{type:`button`,className:tt(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Y.jsx)(E,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Y.jsx)(Yt,{tokens:r,mode:i}):(0,Y.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Y.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Y.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Y.jsx)(O,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,Y.jsx)(vt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(C.charts.listMyCharts),r=w(C.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Y.jsx)(Xt,{selected:e===null,title:y(),subtitle:ue(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?ce():n.via===`owner`?Ue():i({group:n.via.group});return(0,Y.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ge()}):null]})}function Qt(){let e=w(C.charts.importChart),[t,n]=(0,G.useState)(``),[r,i]=(0,G.useState)(``),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[l,u]=(0,G.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(S())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Ne());return}let a;try{a=JSON.parse(r)}catch{o(S());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:Ve()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Je()})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Qe()}),(0,Y.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:Re(),maxLength:60})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:it(),rows:8,spellCheck:!1})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(B,{className:`size-4`}),qe(),(0,Y.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,Y.jsx)(O,{size:`sm`,disabled:l,onClick:()=>void f(),children:Fe()})]}),a?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Y.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ze()}):null]})]})}function $t({chart:e}){let t=be(C.charts.setChartLogo),n=w(C.charts.removeChartLogo),[i,a]=(0,G.useState)(!1),[o,s]=(0,G.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Ut(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?he():je()}),(0,Y.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Y.jsx)(`img`,{src:t,alt:``}):null}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Y.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Y.jsx)(B,{className:`size-4`}),t?Ae():ke(),(0,Y.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(e),children:et()}):null,t?(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void d(e),children:re()}):null]})}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:r()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Y.jsx)(p,{mode:`light`}),(0,Y.jsx)(p,{mode:`dark`})]}),i?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ie()}):null,o?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=x(C.me.getMe,{host:z}),n=w(C.charts.addChartDomain),r=w(C.charts.removeChartDomain),[i,a]=(0,G.useState)(``),[o,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:s()}),(0,Y.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:te()}):d.map(e=>(0,Y.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":h({domain:e}),onClick:()=>void p(e),children:(0,Y.jsx)(D,{className:`size-3`})})]},e))}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:_e(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,Y.jsx)(O,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:oe()})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:dt()}),o?(0,Y.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=w(C.charts.updateChart),n=w(C.charts.deleteChart),[r,i]=(0,G.useState)(!1),[o,s]=(0,G.useState)(e.name),[c,l]=(0,G.useState)(()=>$(e.tokens)),[u,d]=(0,G.useState)(e.tokens.bpm??0),[f,p]=(0,G.useState)(null),[m,h]=(0,G.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(S());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(a()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:g,children:rt()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:Le()})]})})]}),r?(0,Y.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:le()}),(0,Y.jsx)(R,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,Y.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:b()}),(0,Y.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Y.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":b()}),(0,Y.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?se():`${u} BPM`})]}),(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:ne()})]}),(0,Y.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-import__label`,children:We()}),(0,Y.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,Y.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,disabled:m,onClick:()=>void _(),children:me()}),(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:de()})]})]}):null,(0,Y.jsx)($t,{chart:e}),(0,Y.jsx)(en,{chart:e})]})}function nn(){let e=x(C.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:He()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),e!==void 0&&t.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Xe()}):(0,Y.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Y.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=w(C.charts.addChartToGroupPool),r=w(C.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(j,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ct():e.kind===`custom`&&e.scope===`personal`?p():ve()}),e.isGlobalDefault?(0,Y.jsx)(j,{variant:`default`,children:Pe()}):null]}),(0,Y.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:at()}),(a??[]).map(e=>(0,Y.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Y.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Be({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Y.jsx)(D,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Y.jsxs)(F,{value:``,onValueChange:e=>void c(e),children:[(0,Y.jsx)(k,{size:`sm`,className:`w-56`,children:(0,Y.jsx)(L,{placeholder:Me()})}),(0,Y.jsx)(I,{children:s.map(e=>(0,Y.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:lt()}):null]})]})}function an({chart:e}){let t=w(C.charts.promoteChartToCommon),n=w(C.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(a()))try{await n({chartId:e.chartId})}catch{}}return(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Y.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Se():p()}),e.ownerLabel?(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:d({owner:e.ownerLabel})}):null]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Y.jsx)(O,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:st()}):null,(0,Y.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:l()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=w(C.admin.setDefaultThemeMode),i=w(C.admin.setDefaultLocale),a=w(C.charts.setDefaultChart),s=x(C.charts.listChartsAdmin),l=x(C.groups.listGroups,{}),d=e??`system`,p=t??`fr`;return(0,Y.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:ge()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:fe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:y()}),mt.map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Y.jsx)(O,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:f()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Y.jsx)(rn,{chart:e,groups:l??[]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:ot()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Y.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Y.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Y.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Y.jsx)(en,{chart:e})]},e.key))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:Ke()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ye()}):(0,Y.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Y.jsx)(an,{chart:e},e.key))})})()]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:De()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Y.jsx)(O,{variant:d===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h3`,{className:`oc-show__title`,children:_()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,Y.jsx)(O,{variant:p===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:o()})]})]})}function sn(){let e=x(C.me.getMe,{host:z}),t=pt(e?.resolvedThemeMode);return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Y.jsx)(Qt,{}),(0,Y.jsx)(nn,{}),e?.role===`admin`?(0,Y.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,G.useState)(!0),[n,r]=(0,G.useState)(`per-user`),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(X),[c,l]=(0,G.useState)(X),[u,d]=(0,G.useState)(Z),f=i!==``||o!==X||c!==X;function p(){a(``),s(X),l(X),d(Z)}return(0,Y.jsxs)(`div`,{className:`oc-show`,children:[(0,Y.jsx)(sn,{}),(0,Y.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Y.jsx)(`summary`,{className:`oc-show__title`,children:ut()}),(0,Y.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(O,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(O,{variant:`ghost`,children:`Ghost`}),(0,Y.jsx)(O,{variant:`destructive`,children:`Destructive`}),(0,Y.jsx)(O,{variant:`link`,children:`Link`})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Small`}),(0,Y.jsx)(O,{children:`Default`}),(0,Y.jsx)(O,{size:`lg`,children:`Large`}),(0,Y.jsx)(O,{size:`icon`,"aria-label":`more`,children:(0,Y.jsx)(A,{})}),(0,Y.jsx)(O,{disabled:!0,children:`Disabled`})]})]}),(0,Y.jsx)(Q,{title:`Badges`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(j,{children:`Default`}),(0,Y.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Y.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Y.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,Y.jsx)(Q,{title:`Inputs & selection`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(R,{placeholder:`Text input…`}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsxs)(F,{value:n,onValueChange:r,children:[(0,Y.jsx)(k,{className:`w-56`,children:(0,Y.jsx)(L,{placeholder:`Select…`})}),(0,Y.jsxs)(I,{children:[(0,Y.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Y.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Y.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Y.jsx)(V,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Y.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,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Y.jsxs)(F,{value:o,onValueChange:s,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(L,{})}),(0,Y.jsxs)(I,{children:[(0,Y.jsx)(P,{value:X,children:`Toutes directions`}),(0,Y.jsx)(P,{value:`inbound`,children:`inbound`}),(0,Y.jsx)(P,{value:`outbound`,children:`outbound`}),(0,Y.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,Y.jsxs)(F,{value:c,onValueChange:l,children:[(0,Y.jsx)(k,{size:`sm`,children:(0,Y.jsx)(L,{})}),(0,Y.jsxs)(I,{children:[(0,Y.jsx)(P,{value:X,children:`Toutes sévérités`}),(0,Y.jsx)(P,{value:`info`,children:`info`}),(0,Y.jsx)(P,{value:`warn`,children:`warn`}),(0,Y.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,Y.jsx)(jt,{fields:Kt,onChange:()=>{}}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Y.jsx)(kt,{value:u,onChange:d})]})]})}),(0,Y.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Y.jsxs)(gt,{children:[(0,Y.jsx)(ht,{asChild:!0,children:(0,Y.jsx)(O,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Y.jsx)(A,{})})}),(0,Y.jsxs)(_t,{align:`start`,children:[(0,Y.jsx)(ft,{children:`Actions`}),(0,Y.jsx)(M,{}),(0,Y.jsx)(N,{children:`Edit`}),(0,Y.jsx)(N,{children:`Duplicate`}),(0,Y.jsx)(M,{}),(0,Y.jsx)(N,{variant:`destructive`,children:`Delete`})]})]})}),(0,Y.jsx)(Q,{title:`Card`,children:(0,Y.jsxs)(Tt,{className:`w-80`,children:[(0,Y.jsxs)(bt,{children:[(0,Y.jsx)(Ct,{children:`Instance`}),(0,Y.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,Y.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Y.jsxs)(xt,{className:`gap-2`,children:[(0,Y.jsx)(O,{size:`sm`,children:`Save`}),(0,Y.jsx)(O,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Y.jsx)(Q,{title:`Table`,children:(0,Y.jsxs)(Ot,{children:[(0,Y.jsx)(Et,{children:(0,Y.jsxs)(U,{children:[(0,Y.jsx)(H,{className:`w-8`,children:(0,Y.jsx)(V,{"aria-label":`select all`})}),(0,Y.jsx)(H,{children:`Name`}),(0,Y.jsx)(H,{children:`Mode`}),(0,Y.jsx)(H,{className:`text-right`,children:`Status`}),(0,Y.jsx)(H,{className:`w-8`})]})}),(0,Y.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Y.jsxs)(U,{children:[(0,Y.jsx)(W,{children:(0,Y.jsx)(V,{"aria-label":`select ${e.n}`})}),(0,Y.jsx)(W,{className:`font-medium`,children:e.n}),(0,Y.jsx)(W,{children:(0,Y.jsx)(j,{variant:`secondary`,children:e.m})}),(0,Y.jsx)(W,{className:`text-right`,children:(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Y.jsx)(E,{className:`size-3.5`}),` `,e.s]})}),(0,Y.jsx)(W,{children:(0,Y.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Y.jsx)(A,{})})})]},e.n))})]})}),(0,Y.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,Y.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Y.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Y.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Y.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Y.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Y.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Y.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Y.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Y.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Y.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Y.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ca as r,Sa as i,_a as a,_y as o,ay as s,ba as c,cy as l,dy as u,fy as d,gy as f,hy as p,ly as m,my as h,oy as g,py as _,sy as v,uy as y,va as b,xa as x,ya as S}from"./api-CMppRsht.js";import{t as C}from"./button-IhgT55aN.js";import{An as w,Ht as T,Ut as E,Vt as D,Wt as O,cn as k,ct as A,jt as j}from"./index-CFqHR0gi.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:o(),from:`now-5m`},{label:f(),from:`now-15m`},{label:p(),from:`now-30m`},{label:h(),from:`now-1h`},{label:_(),from:`now-3h`},{label:d(),from:`now-6h`},{label:u(),from:`now-12h`},{label:y(),from:`now-24h`},{label:m(),from:`now-2d`},{label:l(),from:`now-7d`},{label:v(),from:`now-30d`},{label:g(),from:`now-90d`},{label:s(),from:`now-520w`}];function L(e){return A(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,o]=(0,M.useState)(!1),[s,l]=(0,M.useState)(``),u=F(e),[d,f]=(0,M.useState)(()=>z(u.from)),[p,m]=(0,M.useState)(()=>z(u.to));function h(t){if(t){let t=F(e);f(z(t.from)),m(z(t.to)),l(``)}o(t)}function g(e){t({kind:`relative`,from:e,to:`now`}),o(!1)}function _(){let e=B(d),n=B(p);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),o(!1))}let v=(0,M.useMemo)(()=>{let e=s.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[s]),y=B(d)!==null&&B(p)!==null;return(0,H.jsxs)(E,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(w,{}),R(e)]})}),(0,H.jsx)(T,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:r()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,H.jsx)(j,{type:`datetime-local`,value:d,onChange:e=>f(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(j,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!y,onClick:_,children:c()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(k,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(j,{value:s,onChange:e=>l(e.target.value),placeholder:S(),"aria-label":b()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:v.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:a()}):v.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>g(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ca as r,Sa as i,_a as a,_y as o,ay as s,ba as c,cy as l,dy as u,fy as d,gy as f,hy as p,ly as m,my as h,oy as g,py as _,sy as v,uy as y,va as b,xa as x,ya as S}from"./api-CMppRsht.js";import{t as C}from"./button-IhgT55aN.js";import{An as w,Ht as T,Ut as E,Vt as D,Wt as O,cn as k,ct as A,jt as j}from"./index-MXp7-qZv.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:o(),from:`now-5m`},{label:f(),from:`now-15m`},{label:p(),from:`now-30m`},{label:h(),from:`now-1h`},{label:_(),from:`now-3h`},{label:d(),from:`now-6h`},{label:u(),from:`now-12h`},{label:y(),from:`now-24h`},{label:m(),from:`now-2d`},{label:l(),from:`now-7d`},{label:v(),from:`now-30d`},{label:g(),from:`now-90d`},{label:s(),from:`now-520w`}];function L(e){return A(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,o]=(0,M.useState)(!1),[s,l]=(0,M.useState)(``),u=F(e),[d,f]=(0,M.useState)(()=>z(u.from)),[p,m]=(0,M.useState)(()=>z(u.to));function h(t){if(t){let t=F(e);f(z(t.from)),m(z(t.to)),l(``)}o(t)}function g(e){t({kind:`relative`,from:e,to:`now`}),o(!1)}function _(){let e=B(d),n=B(p);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),o(!1))}let v=(0,M.useMemo)(()=>{let e=s.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[s]),y=B(d)!==null&&B(p)!==null;return(0,H.jsxs)(E,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(w,{}),R(e)]})}),(0,H.jsx)(T,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:r()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,H.jsx)(j,{type:`datetime-local`,value:d,onChange:e=>f(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(j,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!y,onClick:_,children:c()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(k,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(j,{value:s,onChange:e=>l(e.target.value),placeholder:S(),"aria-label":b()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:v.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:a()}):v.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>g(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GI as r,KI as i,UI as a,WI as o}from"./api-CMppRsht.js";import{t as s}from"./check-7d2-JR5i.js";import{t as c}from"./chevrons-up-down-DJIIcTyy.js";import{Bt as l,Rt as u,jt as d,zt as f}from"./index-CFqHR0gi.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}var g={q:``,state:`all`,result:`all`};function _(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function v(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&h(e.enabled)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function y(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function x(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function S(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function C(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function w(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var T=n();function E({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>y(),[]),[g,_]=(0,p.useState)(!1),[v,S]=(0,p.useState)(``);if(h.length===0)return(0,T.jsx)(d,{value:e,onChange:e=>t(e.target.value),placeholder:m||b()||`America/Toronto`,className:n});let C=x(h,v,h.length,e||void 0),w=e===``?m||b()||a():e;return(0,T.jsxs)(u,{modal:!0,open:g,onOpenChange:e=>{_(e),e||S(``)},children:[(0,T.jsx)(l,{asChild:!0,children:(0,T.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":i(),children:[(0,T.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,T.jsx)(c,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,T.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,T.jsx)(d,{autoFocus:!0,value:v,onChange:e=>S(e.target.value),placeholder:r(),className:`oc-tzcombo__search`}),(0,T.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:C.length===0?(0,T.jsx)(`p`,{className:`oc-tzcombo__empty`,children:o()}):C.map(n=>(0,T.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),S(``)},children:[(0,T.jsx)(s,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,T.jsx)(`span`,{children:n})]},n))})]})]})}export{m as a,w as c,v as i,C as l,g as n,h as o,_ as r,S as s,E as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{GI as r,KI as i,UI as a,WI as o}from"./api-CMppRsht.js";import{t as s}from"./check-7d2-JR5i.js";import{t as c}from"./chevrons-up-down-DJIIcTyy.js";import{Bt as l,Rt as u,jt as d,zt as f}from"./index-MXp7-qZv.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}var g={q:``,state:`all`,result:`all`};function _(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function v(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&h(e.enabled)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function y(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function x(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function S(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function C(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function w(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var T=n();function E({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>y(),[]),[g,_]=(0,p.useState)(!1),[v,S]=(0,p.useState)(``);if(h.length===0)return(0,T.jsx)(d,{value:e,onChange:e=>t(e.target.value),placeholder:m||b()||`America/Toronto`,className:n});let C=x(h,v,h.length,e||void 0),w=e===``?m||b()||a():e;return(0,T.jsxs)(u,{modal:!0,open:g,onOpenChange:e=>{_(e),e||S(``)},children:[(0,T.jsx)(l,{asChild:!0,children:(0,T.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":i(),children:[(0,T.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,T.jsx)(c,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,T.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,T.jsx)(d,{autoFocus:!0,value:v,onChange:e=>S(e.target.value),placeholder:r(),className:`oc-tzcombo__search`}),(0,T.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:C.length===0?(0,T.jsx)(`p`,{className:`oc-tzcombo__empty`,children:o()}):C.map(n=>(0,T.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),S(``)},children:[(0,T.jsx)(s,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,T.jsx)(`span`,{children:n})]},n))})]})]})}export{m as a,w as c,v as i,C as l,g as n,h as o,_ as r,S as s,E as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$x as i,Ak as a,Bx as o,Ck as s,D as c,Dk as l,Ek as u,Fk as d,Gx as f,Hx as p,Ik as m,Jx as h,Kx as ee,Lk as g,Mk as _,Nk as v,Ok as y,Pk as b,QO as x,Qx as te,Rk as S,SS as ne,Sk as C,Tk as re,Tz as w,Ux as ie,Vx as ae,Wx as oe,XO as se,Xx as ce,Yx as le,ZO as ue,Zx as de,_S as fe,_k as T,aS as pe,ak as E,bS as me,bi as D,bk as O,cS as he,ck as ge,dS as _e,eS as ve,ek as k,fS as ye,gS as be,gk as A,hS as xe,hk as j,iS as Se,ik as M,jk as N,kk as P,lS as Ce,lk as we,mS as Te,nS as Ee,nk as De,oS as Oe,ok as ke,pS as Ae,qx as je,rS as Me,rk as Ne,sS as Pe,sk as Fe,t as F,tS as Ie,tk as Le,uS as Re,uk as ze,vS as Be,vi as Ve,vk as He,wk as Ue,wz as I,xS as We,xk as Ge,yS as Ke,yi as qe,yk as Je,zk as Ye,zx as Xe}from"./api-CMppRsht.js";import{t as Ze}from"./check-7d2-JR5i.js";import{t as Qe}from"./x-CdHbCgxq.js";import{i as L,n as R,r as $e,t as et}from"./tabs-BQOp_WCt.js";import{t as z}from"./button-IhgT55aN.js";import{$ as B,En as tt,Et as V,Fn as nt,H as rt,In as it,Q as H,Sn as at,X as U,Z as W,a as ot,at as st,ct as G,et as K,i as ct,kn as lt,lt as ut,nt as dt,o as ft,ot as pt,q as mt,rt as ht,s as gt,tt as _t}from"./index-CFqHR0gi.js";import{n as vt}from"./TimeRangePicker-CS4l2E_Y.js";import{t as yt}from"./FilterBar-B3g5mQkA.js";import{t as bt}from"./AdvancedFilter-Cj03B7Mb.js";import{t as xt}from"./DataTableShell-hu5AF3BF.js";var St=c(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ct=c(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?O():n===`agent`?`${Je()} - ${r}`:e}function Tt(){let e=w(F.me.getMe,{host:mt})?.role===`admin`,t=w(F.deliveryTiming.getDeliveryStatus,{}),n=I(F.deliveryTiming.startDeliveryRecord),r=I(F.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:Ye()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}),e?(0,J.jsx)(z,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?m():g()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:d()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:b({time:ut(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?N():_()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=w(F.deliveryTiming.listDeliverySessions,{}),n=I(F.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[o,c]=(0,q.useState)(`all`),[d,f]=(0,q.useState)(Y),[p,m]=(0,q.useState)(null),{from:h,to:ee}=vt(d),g=d.to===`now`?1/0:ee,_=r.trim()!==``||o!==`all`||d!==Y,v=()=>{i(``),c(`all`),f(Y)},b=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=h&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,h,g]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),p!==null&&r.includes(p)&&m(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(yt,{q:r,onQChange:i,searchPlaceholder:P(),timeRange:d,onTimeRangeChange:f,onReset:v,canReset:_,children:(0,J.jsxs)(U,{value:o,onValueChange:e=>c(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:y()}),(0,J.jsx)(H,{value:`active`,children:l()}),(0,J.jsx)(H,{value:`stopped`,children:u()})]})]})}),(0,J.jsx)(xt,{title:a(),rows:b,emptyHint:ue(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":p===e.sessionId?T():He(),onClick:()=>m(t=>t===e.sessionId?null:e.sessionId),children:p===e.sessionId?(0,J.jsx)(St,{size:15,"aria-hidden":!0}):(0,J.jsx)(tt,{size:15,"aria-hidden":!0})})},{header:re(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:Ue(),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:s(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:C(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Ge(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:l()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:u()})}],rowActions:e?e=>[{label:A(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:A(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===p,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=w(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:j()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:v()});let i=e.segments,a=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,se()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,J.jsx)(lt,{size:13,"aria-hidden":!0}),t?x():r()]})]}),(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:ge()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Fe()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ke()})]})}),(0,J.jsxs)(`tbody`,{children:[a(E(),i.bridge),a(M(),i.A),a(Ne(),i.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Le()})]})}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:D()},{value:`principalType`,label:qe()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ve()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=it({from:`/settings/traces`}),t=nt({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,o=e.principalType??Q,s=e.direction??Q,c=e.roleKey??Q,l=e.q??``,u=e.correlationId,d=ct(e.from,e.to),m=(0,q.useMemo)(()=>gt(e.adv),[e.adv]),{from:g,to:_}=vt(d),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=e=>void t({search:t=>({...t,limit:e})}),C=e=>void t({search:t=>({...t,kind:e})}),re=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ae=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),se=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,...ft(e)})}),D=e=>void t({search:t=>({...t,adv:ot(e)}),replace:!0}),O=w(F.observability.listEvents,{limit:n}),ge=w(F.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...u?{correlationId:u}:{},filter:{q:l||void 0,from:g,to:_,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:s===Q?void 0:s,roleKey:c===Q?void 0:c,advanced:m.length>0?m:void 0}}),k=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),j=l!==``||a!==Q||o!==Q||s!==Q||c!==Q||m.length>0||d.kind!==`relative`||d.from!==Nt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let N=v?O?.filter(e=>e.correlationId===v):ge,P=e.section,De=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(et,{value:P,onValueChange:e=>De(e),children:[(0,J.jsxs)($e,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(at,{size:13,"aria-hidden":!0}),ze()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),we()]})]}),(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:[ne(),(0,J.jsx)(`strong`,{children:We()}),me(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ke()})]}),(0,J.jsxs)(yt,{q:l,onQChange:re,searchPlaceholder:Be(),timeRange:d,onTimeRangeChange:E,onReset:M,canReset:j,children:[(0,J.jsxs)(U,{value:a,onValueChange:ae,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:fe()})}),(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:o,onValueChange:se,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:xe()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Te()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:s,onValueChange:ue,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:Ae()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:ye()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:T,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:_e()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Re()}),A.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:r===Z?``:r,placeholder:Ce(),"aria-label":Ce(),onChange:e=>{let t=e.target.value.trim();C(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:k.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>S(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:he({count:e})},e))})]})]}),(0,J.jsx)(bt,{fields:Pt,seed:m,onChange:D}),v?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>y(null),title:Pe(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Oe(),(0,J.jsx)(`code`,{children:$(v)})]}),(0,J.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:pe()})]})}):null,(0,J.jsx)(xt,{title:Se(),rows:N,emptyHint:v?Me():Ee(),columns:[{header:Ie(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ve(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:i(),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":te(),children:`✓`})}},{header:de(),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:ce(),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:h(),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:je(),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:ee(),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:f(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:oe(),onClick:()=>y(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ie(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>x(e),children:p()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:b,onClose:()=>x(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)(_t,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(dt,{className:`max-w-lg`,children:[(0,J.jsxs)(st,{children:[(0,J.jsxs)(pt,{className:`oc-traces__meta-title`,children:[ae(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:o()})]}),(0,J.jsx)(ht,{children:Xe()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$x as i,Ak as a,Bx as o,Ck as s,D as c,Dk as l,Ek as u,Fk as d,Gx as f,Hx as p,Ik as m,Jx as h,Kx as ee,Lk as g,Mk as _,Nk as v,Ok as y,Pk as b,QO as x,Qx as te,Rk as S,SS as ne,Sk as C,Tk as re,Tz as w,Ux as ie,Vx as ae,Wx as oe,XO as se,Xx as ce,Yx as le,ZO as ue,Zx as de,_S as fe,_k as T,aS as pe,ak as E,bS as me,bi as D,bk as O,cS as he,ck as ge,dS as _e,eS as ve,ek as k,fS as ye,gS as be,gk as A,hS as xe,hk as j,iS as Se,ik as M,jk as N,kk as P,lS as Ce,lk as we,mS as Te,nS as Ee,nk as De,oS as Oe,ok as ke,pS as Ae,qx as je,rS as Me,rk as Ne,sS as Pe,sk as Fe,t as F,tS as Ie,tk as Le,uS as Re,uk as ze,vS as Be,vi as Ve,vk as He,wk as Ue,wz as I,xS as We,xk as Ge,yS as Ke,yi as qe,yk as Je,zk as Ye,zx as Xe}from"./api-CMppRsht.js";import{t as Ze}from"./check-7d2-JR5i.js";import{t as Qe}from"./x-CdHbCgxq.js";import{i as L,n as R,r as $e,t as et}from"./tabs-C9_bsrsA.js";import{t as z}from"./button-IhgT55aN.js";import{$ as B,En as tt,Et as V,Fn as nt,H as rt,In as it,Q as H,Sn as at,X as U,Z as W,a as ot,at as st,ct as G,et as K,i as ct,kn as lt,lt as ut,nt as dt,o as ft,ot as pt,q as mt,rt as ht,s as gt,tt as _t}from"./index-MXp7-qZv.js";import{n as vt}from"./TimeRangePicker-DwIZMTeU.js";import{t as yt}from"./FilterBar-DdAB946f.js";import{t as bt}from"./AdvancedFilter-Cp_QQRkp.js";import{t as xt}from"./DataTableShell-mx-pazY0.js";var St=c(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Ct=c(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?O():n===`agent`?`${Je()} - ${r}`:e}function Tt(){let e=w(F.me.getMe,{host:mt})?.role===`admin`,t=w(F.deliveryTiming.getDeliveryStatus,{}),n=I(F.deliveryTiming.startDeliveryRecord),r=I(F.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:Ye()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:S()})]}),e?(0,J.jsx)(z,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?m():g()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:d()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:b({time:ut(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?N():_()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=w(F.deliveryTiming.listDeliverySessions,{}),n=I(F.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[o,c]=(0,q.useState)(`all`),[d,f]=(0,q.useState)(Y),[p,m]=(0,q.useState)(null),{from:h,to:ee}=vt(d),g=d.to===`now`?1/0:ee,_=r.trim()!==``||o!==`all`||d!==Y,v=()=>{i(``),c(`all`),f(Y)},b=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=h&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,h,g]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),p!==null&&r.includes(p)&&m(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(yt,{q:r,onQChange:i,searchPlaceholder:P(),timeRange:d,onTimeRangeChange:f,onReset:v,canReset:_,children:(0,J.jsxs)(U,{value:o,onValueChange:e=>c(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:y()}),(0,J.jsx)(H,{value:`active`,children:l()}),(0,J.jsx)(H,{value:`stopped`,children:u()})]})]})}),(0,J.jsx)(xt,{title:a(),rows:b,emptyHint:ue(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":p===e.sessionId?T():He(),onClick:()=>m(t=>t===e.sessionId?null:e.sessionId),children:p===e.sessionId?(0,J.jsx)(St,{size:15,"aria-hidden":!0}):(0,J.jsx)(tt,{size:15,"aria-hidden":!0})})},{header:re(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:Ue(),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:s(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:C(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:Ge(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:l()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:u()})}],rowActions:e?e=>[{label:A(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:A(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===p,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=w(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(rt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:j()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:v()});let i=e.segments,a=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,se()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,J.jsx)(lt,{size:13,"aria-hidden":!0}),t?x():r()]})]}),(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:ge()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Fe()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ke()})]})}),(0,J.jsxs)(`tbody`,{children:[a(E(),i.bridge),a(M(),i.A),a(Ne(),i.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Le()})]})}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:D()},{value:`principalType`,label:qe()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ve()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=it({from:`/settings/traces`}),t=nt({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,o=e.principalType??Q,s=e.direction??Q,c=e.roleKey??Q,l=e.q??``,u=e.correlationId,d=ct(e.from,e.to),m=(0,q.useMemo)(()=>gt(e.adv),[e.adv]),{from:g,to:_}=vt(d),[v,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),S=e=>void t({search:t=>({...t,limit:e})}),C=e=>void t({search:t=>({...t,kind:e})}),re=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ae=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),se=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),ue=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),E=e=>void t({search:t=>({...t,...ft(e)})}),D=e=>void t({search:t=>({...t,adv:ot(e)}),replace:!0}),O=w(F.observability.listEvents,{limit:n}),ge=w(F.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...u?{correlationId:u}:{},filter:{q:l||void 0,from:g,to:_,statusClass:a===Q?void 0:a,principalType:o===Q?void 0:o,direction:s===Q?void 0:s,roleKey:c===Q?void 0:c,advanced:m.length>0?m:void 0}}),k=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),j=l!==``||a!==Q||o!==Q||s!==Q||c!==Q||m.length>0||d.kind!==`relative`||d.from!==Nt.from;function M(){t({search:{limit:100,kind:`all`},replace:!0})}let N=v?O?.filter(e=>e.correlationId===v):ge,P=e.section,De=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(et,{value:P,onValueChange:e=>De(e),children:[(0,J.jsxs)($e,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(at,{size:13,"aria-hidden":!0}),ze()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),we()]})]}),(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:[ne(),(0,J.jsx)(`strong`,{children:We()}),me(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Ke()})]}),(0,J.jsxs)(yt,{q:l,onQChange:re,searchPlaceholder:Be(),timeRange:d,onTimeRangeChange:E,onReset:M,canReset:j,children:[(0,J.jsxs)(U,{value:a,onValueChange:ae,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:fe()})}),(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:o,onValueChange:se,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:xe()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Te()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:s,onValueChange:ue,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:Ae()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:ye()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:T,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:_e()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Re()}),A.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:r===Z?``:r,placeholder:Ce(),"aria-label":Ce(),onChange:e=>{let t=e.target.value.trim();C(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:k.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>S(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:he({count:e})},e))})]})]}),(0,J.jsx)(bt,{fields:Pt,seed:m,onChange:D}),v?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>y(null),title:Pe(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Oe(),(0,J.jsx)(`code`,{children:$(v)})]}),(0,J.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:pe()})]})}):null,(0,J.jsx)(xt,{title:Se(),rows:N,emptyHint:v?Me():Ee(),columns:[{header:Ie(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ve(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:i(),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":te(),children:`✓`})}},{header:de(),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:ce(),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:h(),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:je(),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:ee(),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:f(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:oe(),onClick:()=>y(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ie(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>x(e),children:p()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:b,onClose:()=>x(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)(_t,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(dt,{className:`max-w-lg`,children:[(0,J.jsxs)(st,{children:[(0,J.jsxs)(pt,{className:`oc-traces__meta-title`,children:[ae(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:o()})]}),(0,J.jsx)(ht,{children:Xe()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$b as i,BE as a,GE as o,Gf as s,HE as c,JE as l,KE as u,Kf as d,QE as f,Tz as p,UE as ee,VE as m,WE as h,XE as te,YE as ne,ZE as re,aD as g,ax as _,bE as v,cD as ie,cx as y,dD as b,dx as x,eD as ae,ex as S,fD as C,iD as oe,ix as w,lD as se,lx as T,nD as ce,nx as E,oD as le,ox as D,pD as O,qE as ue,qf as k,rD as de,rx as A,sD as fe,sx as j,t as M,tD as pe,tx as N,uD as me,ux as P,wz as F,zE as he}from"./api-CMppRsht.js";import{t as I}from"./button-IhgT55aN.js";import{$ as L,Dt as R,Et as z,Fn as ge,Ft as B,In as _e,Lt as ve,Mt as ye,Nt as be,Pt as xe,Q as V,U as Se,W as Ce,X as H,Z as U,at as we,c as W,et as G,l as Te,nt as Ee,on as K,ot as De,q as Oe,rt as ke,sn as q,tt as Ae,u as J,ut as Y}from"./index-CFqHR0gi.js";import{t as je}from"./FilterBar-B3g5mQkA.js";import{t as Me}from"./DataTableShell-hu5AF3BF.js";import{t as Ne}from"./DetailChips-CPHHClkW.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=p(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=p(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Z.jsx)(Ae,{open:n,onOpenChange:r,children:(0,Z.jsxs)(Ee,{className:`oc-access`,children:[(0,Z.jsxs)(we,{children:[(0,Z.jsx)(De,{children:x({user:t})}),(0,Z.jsx)(ke,{children:P()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?T():y()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:j()}):u.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:w()}):[...d.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:a,defaultKey:o}){let s=F(M.agents.assignAgent),c=F(M.agents.removeAgent),l=F(M.agents.setDefaultAgent),u=R();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(D(),e)}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(_(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(q,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),s=o===n,c=e.state===`deleted`,l=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,Z.jsx)(Y,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":A({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:E()}):null,e.outOfPool?(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:N()}):null,r?s?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S(),title:S(),children:(0,Z.jsx)(K,{size:14,fill:`currentColor`})}):(0,Z.jsx)(I,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":i(),title:i(),disabled:l,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(K,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return s();case`user`:return d();case`admin`:return k();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=W.filter(e=>n.has(J[e])).length;return(0,Z.jsxs)(ye,{children:[(0,Z.jsx)(ve,{asChild:!0,children:(0,Z.jsx)(I,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?O():C({count:r})})}),(0,Z.jsxs)(be,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(B,{children:b()}),W.map(e=>{let r=J[e];return(0,Z.jsxs)(xe,{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:Te[e]()})]},e)})]})]})}function Le(){let e=_e({from:`/settings/users`}),t=ge({from:`/settings/users`}),n=e.q??``,i=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),_=p(M.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),y=p(M.me.getMe,{host:Oe}),b=F(M.admin.setRole),x=F(M.admin.setUserPermissions),S=F(M.admin.startImpersonation),C=F(M.admin.deleteUser),w=F(M.admin.setUserName),T=Se(),E=Ce(),D=R(),[O,k]=(0,X.useState)(null),A=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of _??[])e.add(t.role);return[...e]},[_]),j=n!==``||i!==Q;function N(){t({search:{},replace:!0})}async function P(e){try{await b(e)}catch(e){D.error(me(),e)}}async function I(e){try{await x(e)}catch(e){D.error(se(),e)}}async function z(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await T({title:ce(),description:pe({user:t}),confirmWord:ae(),confirmLabel:r(),destructive:!0}))try{await C({profileId:e._id}),D.success(re({user:t}))}catch(e){D.error(f(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await E({title:ne(),label:l({user:t}),placeholder:ue(),defaultValue:e.name??``,confirmLabel:v()});if(n!==null)try{await w({profileId:e._id,name:n}),D.success(u())}catch(e){D.error(o(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:s,searchPlaceholder:ie(),onReset:N,canReset:j,children:(0,Z.jsxs)(H,{value:i,onValueChange:d,children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(G,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{value:Q,children:fe()}),A.map(e=>(0,Z.jsx)(V,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:le(),rows:_,emptyHint:g(),rowActions:e=>{let t=[{label:he(),onSelect:()=>k({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:te(),onSelect:()=>void B(e)}];return e.userId!==y?.userId&&t.push({label:oe(),onSelect:()=>void S({profileId:e._id})},{label:de(),variant:`destructive`,onSelect:()=>void z(e)}),t},columns:[{header:h(),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:ee(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(H,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(G,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(V,{value:`user`,children:$(`user`)}),(0,Z.jsx)(V,{value:`admin`,children:$(`admin`)})]})]})},{header:c(),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:m()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),I({profileId:e._id,permissions:[...n]})}})},{header:a(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||k(null)}})]})}export{Le as UsersTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$b as i,BE as a,GE as o,Gf as s,HE as c,JE as l,KE as u,Kf as d,QE as f,Tz as p,UE as ee,VE as m,WE as h,XE as te,YE as ne,ZE as re,aD as g,ax as _,bE as v,cD as ie,cx as y,dD as b,dx as x,eD as ae,ex as S,fD as C,iD as oe,ix as w,lD as se,lx as T,nD as ce,nx as E,oD as le,ox as D,pD as O,qE as ue,qf as k,rD as de,rx as A,sD as fe,sx as j,t as M,tD as pe,tx as N,uD as me,ux as P,wz as F,zE as he}from"./api-CMppRsht.js";import{t as I}from"./button-IhgT55aN.js";import{$ as L,Dt as R,Et as z,Fn as ge,Ft as B,In as _e,Lt as ve,Mt as ye,Nt as be,Pt as xe,Q as V,U as Se,W as Ce,X as H,Z as U,at as we,c as W,et as G,l as Te,nt as Ee,on as K,ot as De,q as Oe,rt as ke,sn as q,tt as Ae,u as J,ut as Y}from"./index-MXp7-qZv.js";import{t as je}from"./FilterBar-DdAB946f.js";import{t as Me}from"./DataTableShell-mx-pazY0.js";import{t as Ne}from"./DetailChips-CueZT7sb.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=p(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=p(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Z.jsx)(Ae,{open:n,onOpenChange:r,children:(0,Z.jsxs)(Ee,{className:`oc-access`,children:[(0,Z.jsxs)(we,{children:[(0,Z.jsx)(De,{children:x({user:t})}),(0,Z.jsx)(ke,{children:P()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?T():y()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:j()}):u.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:w()}):[...d.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:a,defaultKey:o}){let s=F(M.agents.assignAgent),c=F(M.agents.removeAgent),l=F(M.agents.setDefaultAgent),u=R();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(D(),e)}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(_(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(q,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),s=o===n,c=e.state===`deleted`,l=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${l?` is-disabled`:``}`,children:[(0,Z.jsx)(Y,{checked:r,disabled:(c||l)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":A({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,c?(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:E()}):null,e.outOfPool?(0,Z.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:N()}):null,r?s?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":S(),title:S(),children:(0,Z.jsx)(K,{size:14,fill:`currentColor`})}):(0,Z.jsx)(I,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":i(),title:i(),disabled:l,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(K,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return s();case`user`:return d();case`admin`:return k();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=W.filter(e=>n.has(J[e])).length;return(0,Z.jsxs)(ye,{children:[(0,Z.jsx)(ve,{asChild:!0,children:(0,Z.jsx)(I,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?O():C({count:r})})}),(0,Z.jsxs)(be,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(B,{children:b()}),W.map(e=>{let r=J[e];return(0,Z.jsxs)(xe,{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:Te[e]()})]},e)})]})]})}function Le(){let e=_e({from:`/settings/users`}),t=ge({from:`/settings/users`}),n=e.q??``,i=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),d=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),_=p(M.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),y=p(M.me.getMe,{host:Oe}),b=F(M.admin.setRole),x=F(M.admin.setUserPermissions),S=F(M.admin.startImpersonation),C=F(M.admin.deleteUser),w=F(M.admin.setUserName),T=Se(),E=Ce(),D=R(),[O,k]=(0,X.useState)(null),A=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of _??[])e.add(t.role);return[...e]},[_]),j=n!==``||i!==Q;function N(){t({search:{},replace:!0})}async function P(e){try{await b(e)}catch(e){D.error(me(),e)}}async function I(e){try{await x(e)}catch(e){D.error(se(),e)}}async function z(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await T({title:ce(),description:pe({user:t}),confirmWord:ae(),confirmLabel:r(),destructive:!0}))try{await C({profileId:e._id}),D.success(re({user:t}))}catch(e){D.error(f(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await E({title:ne(),label:l({user:t}),placeholder:ue(),defaultValue:e.name??``,confirmLabel:v()});if(n!==null)try{await w({profileId:e._id,name:n}),D.success(u())}catch(e){D.error(o(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(je,{q:n,onQChange:s,searchPlaceholder:ie(),onReset:N,canReset:j,children:(0,Z.jsxs)(H,{value:i,onValueChange:d,children:[(0,Z.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(G,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{value:Q,children:fe()}),A.map(e=>(0,Z.jsx)(V,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:le(),rows:_,emptyHint:g(),rowActions:e=>{let t=[{label:he(),onSelect:()=>k({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:te(),onSelect:()=>void B(e)}];return e.userId!==y?.userId&&t.push({label:oe(),onSelect:()=>void S({profileId:e._id})},{label:de(),variant:`destructive`,onSelect:()=>void z(e)}),t},columns:[{header:h(),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:ee(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(H,{value:e.role,onValueChange:t=>void P({profileId:e._id,role:t}),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(G,{})}),(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(V,{value:`user`,children:$(`user`)}),(0,Z.jsx)(V,{value:`admin`,children:$(`admin`)})]})]})},{header:c(),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:m()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),I({profileId:e._id,permissions:[...n]})}})},{header:a(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(q,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:O?.profileId??null,userLabel:O?.label??``,open:O!==null,onOpenChange:e=>{e||k(null)}})]})}export{Le as UsersTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{An as r,Ar as i,Cn as a,Cr as ee,Dr as o,Er as s,Fr as c,Ir as l,Iu as te,Lr as u,Mr as d,Nr as f,Or as p,Pr as m,Pu as ne,Rr as h,Sn as g,Sr as _,Sz as re,Tr as v,Tz as y,Xt as ie,_O as b,_r as x,af as S,bn as ae,br as C,cn as w,dn as T,gn as E,gr as D,gz as O,hn as oe,hr as se,jr as k,kr as ce,ln as le,mn as ue,pn as de,t as A,un as fe,vr as j,vz as pe,wr as me,wz as M,xn as N,xr as P,yn as F,yr as I,zr as L}from"./api-CMppRsht.js";import{i as R,n as z,r as he,t as ge}from"./tabs-BQOp_WCt.js";import{t as B}from"./button-IhgT55aN.js";import{$ as V,$t as H,Et as U,Fn as _e,In as ve,Jt as ye,Pn as be,Q as W,Qt as G,X as K,Xt as xe,Yt as Se,Z as q,Zt as Ce,_n as we,en as Te,et as J,nn as Ee,q as De,ut as Y}from"./index-CFqHR0gi.js";/* empty css */var X=t(e(),1),Z=n(),Q=[[`auto`,()=>d()],[`fr-FR`,()=>a()],[`en-US`,()=>g()],[`en-GB`,()=>N()],[`de-DE`,()=>ae()],[`es-ES`,()=>F()]],Oe=[[`0.75`,()=>i()],[`1`,()=>ce()],[`1.25`,()=>p()],[`1.5`,()=>o()]],$=0;function ke({instance:e}){let t=M(A.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,a]=(0,X.useState)(r),[o,c]=(0,X.useState)(`idle`),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(!1),h=re(A.voice.gatewayTtsPreview);(0,X.useEffect)(()=>{a({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),c(`idle`)},[e._id]);let g=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function y(){c(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),c(`idle`)}catch{c(`error`)}}return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:i.enabled,onCheckedChange:e=>a({...i,enabled:e===!0}),"aria-label":m()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,Z.jsxs)(K,{value:i.engine,onValueChange:e=>a({...i,engine:e}),disabled:!i.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":T(),children:(0,Z.jsx)(J,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(W,{value:`browser`,children:fe()}),e.kind===`hermes`?null:(0,Z.jsx)(W,{value:`gateway`,children:le()})]})]})]}),i.engine===`gateway`?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()}):null,i.engine===`gateway`?null:(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,Z.jsxs)(K,{value:i.lang,onValueChange:e=>a({...i,lang:e}),disabled:!i.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":f(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(q,{children:Q.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,Z.jsxs)(K,{value:i.rate,onValueChange:e=>a({...i,rate:e}),disabled:!i.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":k(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(q,{children:Oe.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:i.autoRead,onCheckedChange:e=>a({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":s()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()})]}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]}),(0,Z.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Z.jsx)(B,{size:`sm`,disabled:!g||o===`saving`,onClick:()=>void y(),children:o===`saving`?S():te()}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,disabled:!i.enabled||l,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(p(!1),H(),G(),i.engine!==`gateway`){Ce(_(),{lang:xe(i.lang,pe()),rate:t});return}u(!0),h({instanceName:e.name,text:_()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&p(!0)}).finally(()=>u(!1))},children:l?S():me()}),(0,Z.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{$++,u(!1),H(),G()},children:ee()})]}),o===`error`||d?(0,Z.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d?ie():ne()}):null]})}function Ae({stt:e}){let t=y(A.me.getMe,{host:De}),n=M(A.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:C()}),(0,Z.jsx)(U,{variant:e?`secondary`:`outline`,children:e?D():se()}),(0,Z.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?oe():ue()})]}),i?(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":E()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()})]}):null,(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]})}function je(){let e=y(A.admin.listInstances,{}),t=(0,X.useMemo)(()=>Te(),[]),n=(0,X.useMemo)(()=>ye(),[]),{section:r}=ve({from:`/settings/voice`}),i=_e({from:`/settings/voice`});return(0,Z.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:L()}),(0,Z.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Z.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?h():u()}),(0,Z.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?l():c()})]}),(0,Z.jsxs)(ge,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Z.jsxs)(he,{className:`w-full`,children:[(0,Z.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Ee,{size:13,"aria-hidden":!0}),de()]}),(0,Z.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(we,{size:13,"aria-hidden":!0}),C()]}),(0,Z.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(be,{size:13,"aria-hidden":!0}),j()]})]}),(0,Z.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):e.map(e=>(0,Z.jsx)(ke,{instance:e},e._id))}),(0,Z.jsx)(z,{value:`dictation`,children:(0,Z.jsx)(Ae,{stt:n})}),(0,Z.jsxs)(z,{value:`talk`,children:[(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:j()})}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]}),e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):e.map(e=>(0,Z.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=M(A.admin.upsertInstanceConfig),n=e.config??{},i=n.talkEnabled===!0,a=e.kind===`hermes`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(U,{variant:`secondary`,children:a?`Hermes`:`OpenClaw`})]}),a?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}):(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:i,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":b()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]})]})}export{je as VoiceTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{An as r,Ar as i,Cn as a,Cr as ee,Dr as o,Er as s,Fr as c,Ir as l,Iu as te,Lr as u,Mr as d,Nr as f,Or as p,Pr as m,Pu as ne,Rr as h,Sn as g,Sr as _,Sz as re,Tr as v,Tz as y,Xt as ie,_O as b,_r as x,af as S,bn as ae,br as C,cn as w,dn as T,gn as E,gr as D,gz as O,hn as oe,hr as se,jr as k,kr as ce,ln as le,mn as ue,pn as de,t as A,un as fe,vr as j,vz as pe,wr as me,wz as M,xn as N,xr as P,yn as F,yr as I,zr as L}from"./api-CMppRsht.js";import{i as R,n as z,r as he,t as ge}from"./tabs-C9_bsrsA.js";import{t as B}from"./button-IhgT55aN.js";import{$ as V,$t as H,Et as U,Fn as _e,In as ve,Jt as ye,Pn as be,Q as W,Qt as G,X as K,Xt as xe,Yt as Se,Z as q,Zt as Ce,_n as we,en as Te,et as J,nn as Ee,q as De,ut as Y}from"./index-MXp7-qZv.js";/* empty css */var X=t(e(),1),Z=n(),Q=[[`auto`,()=>d()],[`fr-FR`,()=>a()],[`en-US`,()=>g()],[`en-GB`,()=>N()],[`de-DE`,()=>ae()],[`es-ES`,()=>F()]],Oe=[[`0.75`,()=>i()],[`1`,()=>ce()],[`1.25`,()=>p()],[`1.5`,()=>o()]],$=0;function ke({instance:e}){let t=M(A.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,a]=(0,X.useState)(r),[o,c]=(0,X.useState)(`idle`),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(!1),h=re(A.voice.gatewayTtsPreview);(0,X.useEffect)(()=>{a({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),c(`idle`)},[e._id]);let g=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function y(){c(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),c(`idle`)}catch{c(`error`)}}return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:i.enabled,onCheckedChange:e=>a({...i,enabled:e===!0}),"aria-label":m()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:T()}),(0,Z.jsxs)(K,{value:i.engine,onValueChange:e=>a({...i,engine:e}),disabled:!i.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":T(),children:(0,Z.jsx)(J,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(W,{value:`browser`,children:fe()}),e.kind===`hermes`?null:(0,Z.jsx)(W,{value:`gateway`,children:le()})]})]})]}),i.engine===`gateway`?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()}):null,i.engine===`gateway`?null:(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()}),(0,Z.jsxs)(K,{value:i.lang,onValueChange:e=>a({...i,lang:e}),disabled:!i.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":f(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(q,{children:Q.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Z.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,Z.jsxs)(K,{value:i.rate,onValueChange:e=>a({...i,rate:e}),disabled:!i.enabled,children:[(0,Z.jsx)(V,{size:`sm`,"aria-label":k(),children:(0,Z.jsx)(J,{})}),(0,Z.jsx)(q,{children:Oe.map(([e,t])=>(0,Z.jsx)(W,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:i.autoRead,onCheckedChange:e=>a({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":s()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:s()})]}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:v()})]}),(0,Z.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Z.jsx)(B,{size:`sm`,disabled:!g||o===`saving`,onClick:()=>void y(),children:o===`saving`?S():te()}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,disabled:!i.enabled||l,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(p(!1),H(),G(),i.engine!==`gateway`){Ce(_(),{lang:xe(i.lang,pe()),rate:t});return}u(!0),h({instanceName:e.name,text:_()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&p(!0)}).finally(()=>u(!1))},children:l?S():me()}),(0,Z.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>{$++,u(!1),H(),G()},children:ee()})]}),o===`error`||d?(0,Z.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d?ie():ne()}):null]})}function Ae({stt:e}){let t=y(A.me.getMe,{host:De}),n=M(A.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:C()}),(0,Z.jsx)(U,{variant:e?`secondary`:`outline`,children:e?D():se()}),(0,Z.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?oe():ue()})]}),i?(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":E()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()})]}):null,(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]})}function je(){let e=y(A.admin.listInstances,{}),t=(0,X.useMemo)(()=>Te(),[]),n=(0,X.useMemo)(()=>ye(),[]),{section:r}=ve({from:`/settings/voice`}),i=_e({from:`/settings/voice`});return(0,Z.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:L()}),(0,Z.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Z.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?h():u()}),(0,Z.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?l():c()})]}),(0,Z.jsxs)(ge,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Z.jsxs)(he,{className:`w-full`,children:[(0,Z.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(Ee,{size:13,"aria-hidden":!0}),de()]}),(0,Z.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(we,{size:13,"aria-hidden":!0}),C()]}),(0,Z.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(be,{size:13,"aria-hidden":!0}),j()]})]}),(0,Z.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):e.map(e=>(0,Z.jsx)(ke,{instance:e},e._id))}),(0,Z.jsx)(z,{value:`dictation`,children:(0,Z.jsx)(Ae,{stt:n})}),(0,Z.jsxs)(z,{value:`talk`,children:[(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:j()})}),(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]}),e===void 0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):e.map(e=>(0,Z.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=M(A.admin.upsertInstanceConfig),n=e.config??{},i=n.talkEnabled===!0,a=e.kind===`hermes`;return(0,Z.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Z.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Z.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Z.jsx)(U,{variant:`secondary`,children:a?`Hermes`:`OpenClaw`})]}),a?(0,Z.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}):(0,Z.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Z.jsx)(Y,{checked:i,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":b()}),(0,Z.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]})]})}export{je as VoiceTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dt as r,ft as i,pt as a}from"./index-CFqHR0gi.js";var o=t(e(),1),s=n(),c=({code:e,language:t,raw:n,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(a),p=i(),[m,h]=(0,o.useState)(n);return(0,o.useEffect)(()=>{if(!p){h(n);return}let r=p.highlight({code:e,language:t,themes:f},e=>{h(e)});r&&h(r)},[e,t,f,p,n]),(0,s.jsx)(r,{className:c,language:t,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{dt as r,ft as i,pt as a}from"./index-MXp7-qZv.js";var o=t(e(),1),s=n(),c=({code:e,language:t,raw:n,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(a),p=i(),[m,h]=(0,o.useState)(n);return(0,o.useEffect)(()=>{if(!p){h(n);return}let r=p.highlight({code:e,language:t,themes:f},e=>{h(e)});r&&h(r)},[e,t,f,p,n]),(0,s.jsx)(r,{className:c,language:t,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};