@lacneu/atrium 0.60.0 → 0.60.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccessTab-BBYqbyQz.js → AccessTab-BlTwl2Uk.js} +1 -1
- package/dist/assets/{AdvancedFilter-BTcB0NuZ.js → AdvancedFilter-C5pnO4fi.js} +1 -1
- package/dist/assets/{AgentFilesTab-BjPywJ7Q.js → AgentFilesTab-tYeG81Bo.js} +1 -1
- package/dist/assets/{AnomaliesTab-CYpcTOYy.js → AnomaliesTab-C94n-0pQ.js} +1 -1
- package/dist/assets/{AuditTab-NnWwJHq_.js → AuditTab-D_mhJO5w.js} +1 -1
- package/dist/assets/{BridgeTab-C_I81PZ8.js → BridgeTab-s6Ggg8Zu.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-STVjXTAX.js → ChatDefaultsTab-DYVQXktp.js} +1 -1
- package/dist/assets/{DataTableShell-DAEVsm3y.js → DataTableShell-COEwE2Hv.js} +1 -1
- package/dist/assets/{DetailChips-DerZpgh4.js → DetailChips-8ZpH5ZXE.js} +1 -1
- package/dist/assets/{FeedbacksTab-BdYRB-_C.js → FeedbacksTab-CqJ8NDLb.js} +1 -1
- package/dist/assets/{FieldLabel-BJRoUSf1.js → FieldLabel-hLNtge_D.js} +1 -1
- package/dist/assets/{FilesTab-h10yjTHp.js → FilesTab-lytzpFwp.js} +1 -1
- package/dist/assets/{FilterBar-Byr6OGo7.js → FilterBar-CY1WfFDB.js} +1 -1
- package/dist/assets/{GroupsTab-BJWQQexi.js → GroupsTab-BjjiPSDY.js} +1 -1
- package/dist/assets/{InstancesTab-ZJeQ4rRg.js → InstancesTab-bbthnf8h.js} +1 -1
- package/dist/assets/{IntegrationsTab-CSOlJvFa.js → IntegrationsTab-DQt4Kllc.js} +1 -1
- package/dist/assets/{KpiTab-Dz5IcL9k.js → KpiTab-qUWozfhc.js} +1 -1
- package/dist/assets/{PreferencesTab-Bd-GUi0T.js → PreferencesTab-B1JSLFVE.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-H8zrJADs.js → PromptInjectionsTab-Df6PKtxv.js} +1 -1
- package/dist/assets/{RolesTab-rgpFvkKx.js → RolesTab-DbSxOWRh.js} +1 -1
- package/dist/assets/{ScheduledTab-DbMIc4wG.js → ScheduledTab-km3Zx4dq.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-BeEdMciQ.js → ServiceAccountsTab-Bcd88LfG.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-BgM9O4QZ.js → SubAgentReportsTab-xgRtphLV.js} +1 -1
- package/dist/assets/{ThemeShowroom-BjDGGE3i.js → ThemeShowroom-DxcANzhZ.js} +1 -1
- package/dist/assets/{TimeRangePicker-RVc6k7g6.js → TimeRangePicker-BYCcnF0a.js} +1 -1
- package/dist/assets/{TracesTab-Cb65hpku.js → TracesTab-ColoY1Nx.js} +1 -1
- package/dist/assets/{UsersTab-BPRPmEOS.js → UsersTab-B0IdN_hl.js} +1 -1
- package/dist/assets/{VoiceTab-tgovFfm-.js → VoiceTab-qZ5tMxmC.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-Dj4OC_Nj.js → highlighted-body-OFNGDK62-xjw7PDBM.js} +1 -1
- package/dist/assets/{index-CW5WE31O.js → index-CNwjY680.js} +6 -6
- package/dist/assets/mermaid-GHXKKRXX-DxPFrHWq.js +1 -0
- package/dist/assets/{pdf-Bx7jp7ID.js → pdf-CLjbM27Z.js} +1 -1
- package/dist/assets/{tabs-Kb2_G-yp.js → tabs-fDXC7itk.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/mermaid-GHXKKRXX-DURCfVhS.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$w as i,E as a,Jw as o,Qw as s,Xw as c,Yw as l,ZP as u,Zw as d,aT as f,as as p,cs as m,ds as h,eF as g,eT as _,fs as v,iT as y,ls as b,nT as x,oT as S,os as C,ps as w,qw as T,rT as E,ss as D,tT as O,us as k}from"./dist-De2K23IB.js";import{t as A}from"./button-Bd43O_sm.js";import{dt as j,ft as M,m as N}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$w as i,E as a,Jw as o,Qw as s,Xw as c,Yw as l,ZP as u,Zw as d,aT as f,as as p,cs as m,ds as h,eF as g,eT as _,fs as v,iT as y,ls as b,nT as x,oT as S,os as C,ps as w,qw as T,rT as E,ss as D,tT as O,us as k}from"./dist-De2K23IB.js";import{t as A}from"./button-Bd43O_sm.js";import{dt as j,ft as M,m as N}from"./index-CNwjY680.js";var P=t(e(),1),F=n();function I(){let e=g(a.integrations.status.status,{}),t=r(a.admin.setIntegrationConfig),[n,u]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&u(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let p=n,m=(e,t,n)=>u({...p,[e]:{...p[e],[t]:n}}),b=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[f(),` `,(0,F.jsx)(`strong`,{children:y()}),` `,E()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:x()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:_()}),note:i(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(M,{value:p.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>b(`langfuse`,{host:p.langfuse.host??``})})}),(0,F.jsx)(z,{label:T(),checked:p.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),b(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:x()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:_()}),note:s(),children:[(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:p.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>b(`opik`,{baseUrl:p.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:l(),children:(0,F.jsx)(M,{value:p.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||o(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>b(`opik`,{workspace:p.opik.workspace??``})})}),(0,F.jsx)(z,{label:T(),checked:p.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),b(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:x()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:w()}),note:v(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:p.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>b(`otlp`,{endpoint:p.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:T(),checked:p.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),b(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=u(a.integrations.otlpSecret.setOtlpHeaders),n=r(a.integrations.otlpSecret.clearOtlpHeaders),[i,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(null),[l,d]=(0,P.useState)(!1),f=async()=>{d(!0),c(null);try{await t({headersJson:i}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{d(!1)}};return(0,F.jsxs)(R,{label:k(),children:[(0,F.jsx)(M,{value:i,placeholder:e?b():m(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||i.trim().length===0,onClick:()=>void f(),children:D()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:C()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:p()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,BT as i,Dh as a,E as o,Eh as s,Fh as c,HT as l,Ih as u,Lh as d,MT as f,Mh as p,NT as m,Nh as h,Oh as g,Ph as _,Th as v,UT as y,VT as b,eF as x,jh as S,kh as C,mE as w,wh as T}from"./dist-De2K23IB.js";import{i as E,nn as ee,o as te,r as ne,rn as re,wt as D}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,BT as i,Dh as a,E as o,Eh as s,Fh as c,HT as l,Ih as u,Lh as d,MT as f,Mh as p,NT as m,Nh as h,Oh as g,Ph as _,Th as v,UT as y,VT as b,eF as x,jh as S,kh as C,mE as w,wh as T}from"./dist-De2K23IB.js";import{i as E,nn as ee,o as te,r as ne,rn as re,wt as D}from"./index-CNwjY680.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-Bkvykfxh.js";import{n as N,t as P}from"./TimeRangePicker-BYCcnF0a.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=x(o.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=x(o.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:w()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:y()}),(0,I.jsx)(j,{children:b()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[f(),` p50 `,R(s.cP50),` `,l()]}),(0,I.jsxs)(`span`,{children:[m(),` p50 `,R(s.aP50),` `,l()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":y(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:d(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:u(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:_(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:h(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:p(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=re({from:`/settings/kpi`}),t=ee({from:`/settings/kpi`}),n=E(e.from,e.to,ne,`now`),i=e=>void t({search:t=>({...t,...te(e)})}),{from:a,to:s}=N(n),{rowLimit:c,buckets:l}=K(a,s),u=x(o.kpi.listKpis,{limit:c,filter:{from:a,to:s}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):(0,I.jsxs)(I.Fragment,{children:[f,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:a({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:s()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:v({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":T({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$k as i,AA as a,AP as o,BP as s,CA as c,CP as l,DA as u,DP as ee,E as d,EA as f,EP as te,Et as p,FA as m,FP as ne,GP as h,IP as re,LP as ie,MA as ae,MP as oe,Mt as se,NA as ce,NP as le,OA as g,OP as _,PA as ue,PP as de,Qk as fe,SA as pe,SP as me,TA as he,TP as ge,XS as v,Xk as y,Zk as b,_A as x,_t as S,aA as C,bA as w,bP as T,cA as E,dA as D,dt as O,eA as k,eF as A,fA as j,ft as M,gA as N,gt as P,hA as F,ht as I,iA as L,jA as _e,jP as ve,jt as ye,kA as be,kP as xe,lA as R,mA as Se,mt as Ce,n as z,nA as we,oA as Te,pA as Ee,pt as De,rA as B,sA as Oe,tA as ke,uA as Ae,vA as je,vt as Me,wA as Ne,wP as V,xA as Pe,xP as Fe,yA as Ie}from"./dist-De2K23IB.js";import{t as H}from"./button-Bd43O_sm.js";import{C as U,Ct as Le,H as Re,S as ze,St as Be,T as Ve,dt as W,ft as G,j as He,m as K,t as Ue,w as We,wt as q,x as Ge,xt as Ke}from"./index-CW5WE31O.js";import{t as qe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Je({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>m()},{id:`composer`,label:()=>ue()},{id:`sidebar`,label:()=>ce()},{id:`notifications`,label:()=>N()},{id:`other`,label:()=>ae()}],Z={showSource:{category:`messages`,label:()=>_e(),help:()=>a()},showReport:{category:`messages`,label:()=>be(),help:()=>g()},copyAssistant:{category:`messages`,label:()=>u()},copyUser:{category:`messages`,label:()=>f()},showDelete:{category:`messages`,label:()=>he()},showTools:{category:`messages`,label:()=>Ne(),help:()=>c()},voiceInput:{category:`composer`,label:()=>pe(),help:()=>Pe()},showUsage:{category:`composer`,label:()=>w(),help:()=>Ie()},autoReadAloud:{category:`composer`,label:()=>se(),help:()=>ye()},showChatAge:{category:`sidebar`,label:()=>je(),help:()=>x()},notifSound:{category:`notifications`,label:()=>F(),help:()=>Se()},notifSystem:{category:`notifications`,label:()=>Ee(),help:()=>j()},replySound:{category:`notifications`,label:()=>D(),help:()=>Ae()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ye(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>k()};function rt({prefKey:e,ui:t}){let n=r(d.admin.setUiPrefDefault),i=r(d.admin.setFeatureEnabled),a=tt(e),o=a?nt[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:L()}),(0,Y.jsxs)(Ge,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,Y.jsx)(We,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Ve,{})}),(0,Y.jsxs)(ze,{children:[(0,Y.jsx)(U,{value:`on`,children:fe()}),(0,Y.jsx)(U,{value:`off`,children:b()}),(0,Y.jsx)(U,{value:`inherit`,children:y()})]})]}),a?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":B()}),B()]}):null]}),o?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function it({current:e,enabled:t}){let n=r(d.me.setDictationShortcut),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!i)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Be(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[Me(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Le(e,Ke())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?I():i?P():S()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:O()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?M():e?De():Ce()})]})]})}function at(){let[e,t]=(0,J.useState)(``),[n,a]=(0,J.useState)(!1),o=A(d.me.getMe,{host:q}),s=o?.ui,c=$(o?.role)&&n,l=r(d.me.setUiPref).withOptimisticUpdate(He),u=(0,J.useMemo)(()=>s?Ye(Object.keys(s.effective),e):[],[s,e]);return s?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(o?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>a(e===!0),"aria-label":C()}),C()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:we()}),(0,Y.jsx)(`p`,{children:ke()}),(0,Y.jsx)(`p`,{children:i()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:R(),"aria-label":R(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:E()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:Oe()}):o?(0,Y.jsx)(W,{variant:`secondary`,children:p()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:Te()}):null,(0,Y.jsx)(Je,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),c?(0,Y.jsx)(rt,{prefKey:e,ui:s}):null]},e)})]},e.id))}),(0,Y.jsx)(it,{current:o?.dictationShortcut??null,enabled:s.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:h()})}var ot={sm:()=>ge(),md:()=>V(),lg:()=>l(),xl:()=>me()};function st(){let e=A(d.me.getMe,{host:q}),t=r(d.me.setLocale),n=r(d.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(d.me.getMe,{host:q});n&&e.setQuery(d.me.getMe,{host:q},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=r(d.me.setMyName),a=Re(),c=e?.locale??`default`,l=e?.name??``,[u,f]=(0,J.useState)(null),p=u??l,m=p.trim()!==l.trim();async function h(){try{await i({name:p}),f(null),a.success(le())}catch(e){a.error(oe(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(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:ie()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:p,maxLength:120,placeholder:ne(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void h(),children:v()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(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:o()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[qe().map(e=>(0,Y.jsx)(H,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:s()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(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:_()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:Ue.map(t=>(0,Y.jsx)(H,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(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:Fe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:T()})]}),(0,Y.jsx)(at,{})]})]})}export{st as PreferencesTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$k as i,AA as a,AP as o,BP as s,CA as c,CP as l,DA as u,DP as ee,E as d,EA as f,EP as te,Et as p,FA as m,FP as ne,GP as h,IP as re,LP as ie,MA as ae,MP as oe,Mt as se,NA as ce,NP as le,OA as g,OP as _,PA as ue,PP as de,Qk as fe,SA as pe,SP as me,TA as he,TP as ge,XS as v,Xk as y,Zk as b,_A as x,_t as S,aA as C,bA as w,bP as T,cA as E,dA as D,dt as O,eA as k,eF as A,fA as j,ft as M,gA as N,gt as P,hA as F,ht as I,iA as L,jA as _e,jP as ve,jt as ye,kA as be,kP as xe,lA as R,mA as Se,mt as Ce,n as z,nA as we,oA as Te,pA as Ee,pt as De,rA as B,sA as Oe,tA as ke,uA as Ae,vA as je,vt as Me,wA as Ne,wP as V,xA as Pe,xP as Fe,yA as Ie}from"./dist-De2K23IB.js";import{t as H}from"./button-Bd43O_sm.js";import{C as U,Ct as Le,H as Re,S as ze,St as Be,T as Ve,dt as W,ft as G,j as He,m as K,t as Ue,w as We,wt as q,x as Ge,xt as Ke}from"./index-CNwjY680.js";import{t as qe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Je({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>m()},{id:`composer`,label:()=>ue()},{id:`sidebar`,label:()=>ce()},{id:`notifications`,label:()=>N()},{id:`other`,label:()=>ae()}],Z={showSource:{category:`messages`,label:()=>_e(),help:()=>a()},showReport:{category:`messages`,label:()=>be(),help:()=>g()},copyAssistant:{category:`messages`,label:()=>u()},copyUser:{category:`messages`,label:()=>f()},showDelete:{category:`messages`,label:()=>he()},showTools:{category:`messages`,label:()=>Ne(),help:()=>c()},voiceInput:{category:`composer`,label:()=>pe(),help:()=>Pe()},showUsage:{category:`composer`,label:()=>w(),help:()=>Ie()},autoReadAloud:{category:`composer`,label:()=>se(),help:()=>ye()},showChatAge:{category:`sidebar`,label:()=>je(),help:()=>x()},notifSound:{category:`notifications`,label:()=>F(),help:()=>Se()},notifSystem:{category:`notifications`,label:()=>Ee(),help:()=>j()},replySound:{category:`notifications`,label:()=>D(),help:()=>Ae()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ye(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Xe=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ze={voiceInput:`voiceInput`};function Qe(e){return Xe.includes(e)}function $(e){return e===`admin`}function $e(e){return e===!0?`on`:e===!1?`off`:`inherit`}function et(e){return e===`on`?!0:e===`off`?!1:null}function tt(e){return Qe(e)?Ze[e]:void 0}var nt={voiceInput:()=>k()};function rt({prefKey:e,ui:t}){let n=r(d.admin.setUiPrefDefault),i=r(d.admin.setFeatureEnabled),a=tt(e),o=a?nt[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:L()}),(0,Y.jsxs)(Ge,{value:$e(t.defaults[e]),onValueChange:t=>void n({key:e,value:et(t)}),children:[(0,Y.jsx)(We,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Ve,{})}),(0,Y.jsxs)(ze,{children:[(0,Y.jsx)(U,{value:`on`,children:fe()}),(0,Y.jsx)(U,{value:`off`,children:b()}),(0,Y.jsx)(U,{value:`inherit`,children:y()})]})]}),a?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void i({key:a,enabled:e===!0}),"aria-label":B()}),B()]}):null]}),o?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function it({current:e,enabled:t}){let n=r(d.me.setDictationShortcut),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!i)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Be(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[i,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[Me(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Le(e,Ke())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?I():i?P():S()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!i?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:O()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":i,onClick:()=>a(e=>!e),children:i?M():e?De():Ce()})]})]})}function at(){let[e,t]=(0,J.useState)(``),[n,a]=(0,J.useState)(!1),o=A(d.me.getMe,{host:q}),s=o?.ui,c=$(o?.role)&&n,l=r(d.me.setUiPref).withOptimisticUpdate(He),u=(0,J.useMemo)(()=>s?Ye(Object.keys(s.effective),e):[],[s,e]);return s?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(o?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>a(e===!0),"aria-label":C()}),C()]}):null,c?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:we()}),(0,Y.jsx)(`p`,{children:ke()}),(0,Y.jsx)(`p`,{children:i()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:R(),"aria-label":R(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:E()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:Oe()}):o?(0,Y.jsx)(W,{variant:`secondary`,children:p()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:Te()}):null,(0,Y.jsx)(Je,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),c?(0,Y.jsx)(rt,{prefKey:e,ui:s}):null]},e)})]},e.id))}),(0,Y.jsx)(it,{current:o?.dictationShortcut??null,enabled:s.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:h()})}var ot={sm:()=>ge(),md:()=>V(),lg:()=>l(),xl:()=>me()};function st(){let e=A(d.me.getMe,{host:q}),t=r(d.me.setLocale),n=r(d.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(d.me.getMe,{host:q});n&&e.setQuery(d.me.getMe,{host:q},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=r(d.me.setMyName),a=Re(),c=e?.locale??`default`,l=e?.name??``,[u,f]=(0,J.useState)(null),p=u??l,m=p.trim()!==l.trim();async function h(){try{await i({name:p}),f(null),a.success(le())}catch(e){a.error(oe(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(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:ie()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:p,maxLength:120,placeholder:ne(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&m&&(e.preventDefault(),h())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void h(),children:v()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(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:o()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[qe().map(e=>(0,Y.jsx)(H,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:s()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(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:_()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,Y.jsx)(`div`,{className:`oc-show__row`,children:Ue.map(t=>(0,Y.jsx)(H,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void n({scale:t}),children:ot[t]()},t))}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(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:Fe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:T()})]}),(0,Y.jsx)(at,{})]})]})}export{st as PreferencesTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$g as i,C_ as a,E as o,Ja as s,Mn as c,Nn as l,Pn as u,Qg as d,S_ as f,Xa as p,Xg as m,Ya as h,Za as g,Zg as _,a_ as v,c_ as y,ci as b,d_ as x,di as S,eF as C,e_ as w,f_ as T,fi as E,h_ as D,i_ as O,l_ as ee,li as k,m_ as te,n_ as ne,o_ as re,p_ as ie,pi as ae,qa as A,r_ as j,s_ as M,t_ as N,u_ as P,ui as F}from"./dist-De2K23IB.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$g as i,C_ as a,E as o,Ja as s,Mn as c,Nn as l,Pn as u,Qg as d,S_ as f,Xa as p,Xg as m,Ya as h,Za as g,Zg as _,a_ as v,c_ as y,ci as b,d_ as x,di as S,eF as C,e_ as w,f_ as T,fi as E,h_ as D,i_ as O,l_ as ee,li as k,m_ as te,n_ as ne,o_ as re,p_ as ie,pi as ae,qa as A,r_ as j,s_ as M,t_ as N,u_ as P,ui as F}from"./dist-De2K23IB.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-hLNtge_D.js";import{t as W}from"./button-Bd43O_sm.js";import{C as G,H as K,S as q,T as J,m as oe,w as Y,wt as se,x as X}from"./index-CNwjY680.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:P,help:ee},documentary_fetch:{label:y,help:M},inbound_files:{label:re,help:v},history_summary:{label:g,help:p},file_curation:{label:ae,help:E}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
2
|
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
3
|
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
4
|
- [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:d,references:_,files:m,previous_summary:h,new_messages:s,max_chars:A,file_name:S,budget_chars:F,feedback:k,content:b};function pe(){let e=C(o.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:j()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:D(),help:te()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:O()}),(0,$.jsxs)(X,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=r(o.admin.upsertInstanceConfig),n=K(),i=C(o.me.getMe,{host:se}),s=e.config??{},d=Z(e.config?.contentLocale,i?.defaultLocale??void 0),[p,m]=(0,Q.useState)(()=>R(s,d));(0,Q.useEffect)(()=>{m(R(s,d))},[d,e._id]);let[h,g]=(0,Q.useState)(!1),_=p.promptInjections,v=(e,t)=>m({...p,promptInjections:{..._,[e]:{..._[e],...t}}});async function y(){g(!0);try{await t({instanceId:e._id,config:V(p,s,d)})}catch(e){n.error(f(),e)}finally{g(!1)}}async function b(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(f(),e)}}let x=e.config?.contentLocale??`default`,S=ce[Z(void 0,i?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:u()}),(0,$.jsxs)(X,{value:x,onValueChange:e=>void b(e),children:[(0,$.jsx)(Y,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(G,{value:`default`,children:c({locale:S})}),le().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:_[e]??{enabled:!0,template:z[e].defaultTemplate[d]},contentLocale:d,onChange:t=>v(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void y(),disabled:h,children:a()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),f=I(e,r,a),p=f?L(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(oe,{checked:r.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:T()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:x()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?N():ne()}),l&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:ie()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:w()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:i()})})]})}export{pe as PromptInjectionsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$b as i,Ab as a,Bb as o,Cb as s,Db as c,E as l,Eb as u,Gb as d,Hb as f,Ib as p,Jb as m,Kb as h,Lb as g,Li as _,Ob as v,Qb as y,Rb as b,Sb as x,Tb as S,Ub as ee,Vb as te,Wb as ne,Xb as re,Yb as ie,Zb as C,ax as w,cx as T,dx as E,eF as D,ex as O,ix as k,kb as A,lx as j,nx as M,ox as N,qb as P,rx as F,sx as I,tx as L,ux as R,wb as ae,zb as z}from"./dist-De2K23IB.js";import{t as B}from"./button-Bd43O_sm.js";import{Gt as V,H,U,d as W,dt as G,ft as K,m as q}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$b as i,Ab as a,Bb as o,Cb as s,Db as c,E as l,Eb as u,Gb as d,Hb as f,Ib as p,Jb as m,Kb as h,Lb as g,Li as _,Ob as v,Qb as y,Rb as b,Sb as x,Tb as S,Ub as ee,Vb as te,Wb as ne,Xb as re,Yb as ie,Zb as C,ax as w,cx as T,dx as E,eF as D,ex as O,ix as k,kb as A,lx as j,nx as M,ox as N,qb as P,rx as F,sx as I,tx as L,ux as R,wb as ae,zb as z}from"./dist-De2K23IB.js";import{t as B}from"./button-Bd43O_sm.js";import{Gt as V,H,U,d as W,dt as G,ft as K,m as q}from"./index-CNwjY680.js";import{t as J}from"./roleDescriptions-zLFA4zEm.js";var Y=t(e(),1),X=n(),Z=[{group:()=>E(),keys:[{key:`traces.read`,label:()=>N()},{key:`traces.read.content`,label:()=>w(),phi:!0},{key:`traces.write`,label:()=>k()}]},{group:()=>R(),keys:[{key:`kpi.read`,label:()=>N()},{key:`kpi.write`,label:()=>k()}]},{group:()=>j(),keys:[{key:`openclaw.query`,label:()=>F()},{key:`anomalies.read`,label:()=>M()},{key:`anomalies.report`,label:()=>L()}]},{group:()=>T(),keys:[{key:`chats.read`,label:()=>N()},{key:`selfheal`,label:()=>i()},{key:`feedback.respond`,label:()=>_()}]},{group:()=>I(),keys:[{key:`admin.manage`,label:()=>O()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=D(l.apiKeys.listRoles,{}),t=r(l.apiKeys.createRole),n=r(l.apiKeys.ensureRolesSeeded),i=r(l.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(l.apiKeys.listRoles,{});r&&e.setQuery(l.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),_=U(),w=H(),[T,E]=(0,Y.useState)(!1),[O,k]=(0,Y.useState)($),[j,M]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{w.error(C(),e)})},[n,w]);let N=e??[];async function F(e,t){if(Q(e.permissions))return;if(e.builtin){await _({title:re({name:e.name}),description:ie(),confirmLabel:m()});return}if(j.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];M(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){w.error(P(),e)}finally{M(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function I(){try{await t({key:O.key,name:O.name,description:O.description||void 0,permissions:[]}),k($),E(!1)}catch(e){w.error(h(),e)}}let L=e===void 0,R=!L&&N.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,ee()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:f()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{k($),E(!0)},children:te()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:z()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:b()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?y({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:N.map(e=>{let t=Q(e.permissions),n=j.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(V,{}),` `,g()]}):(0,X.jsx)(G,{variant:`secondary`,children:p()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?a():n?A():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:T,onOpenChange:E,title:v(),description:c(),canSubmit:!!(O.key&&O.name),onSubmit:I,submitLabel:u(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,X.jsx)(K,{value:O.key,placeholder:ae(),onChange:e=>k({...O,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,X.jsx)(K,{value:O.name,onChange:e=>k({...O,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,X.jsx)(K,{value:O.description,onChange:e=>k({...O,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AM as r,AN as i,CM as a,CN as o,D as s,DM as c,DN as l,E as u,EM as ee,EN as te,FN as ne,GM as d,GP as f,HM as re,JM as ie,KM as ae,MN as oe,NN as p,OM as se,ON as ce,PN as le,QM as m,SM as ue,SN as de,TM as fe,TN as pe,VM as me,WM as he,XM as ge,YM as _e,ZM as ve,ZP as h,_M as ye,bM as be,cM as xe,eN as Se,gM as Ce,hM as we,iN as Te,jM as Ee,jN as De,kM as g,kN as Oe,mM as ke,nN as _,qM as Ae,qP as je,rN as v,tN as y,vM as Me,wM as Ne,wN as Pe,xM as Fe,xN as Ie,yM as Le}from"./dist-De2K23IB.js";import{t as b}from"./button-Bd43O_sm.js";import{B as Re,C as x,Ft as ze,G as Be,H as Ve,Ht as He,J as Ue,K as We,Kt as Ge,Mt as Ke,Q as qe,S as Je,T as Ye,Ut as Xe,V as Ze,Vt as Qe,X as $e,Y as et,Z as tt,_t as nt,dt as S,ft as C,gt as rt,ht as it,mt as at,pt as w,q as ot,vt as T,w as E,x as D,zt as st}from"./index-CW5WE31O.js";import{a as ct,i as O,n as lt,o as k,r as A,t as ut}from"./table-BRilRxUj.js";var dt=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),j=t(e(),1),M=n(),N={minutes:6e4,hours:36e5,days:864e5};function P(e){return e?.data?.code??`unknown`}function F(){let e=h(u.scheduled.listMyCrons),t=h(u.scheduled.getCronDetail),n=h(u.scheduled.listCronRuns),s=h(u.scheduled.updateCron),F=h(u.scheduled.removeCron),ft=h(u.scheduled.runCronNow),I=Ve(),[L,pt]=(0,j.useState)(null),[R,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),[H,mt]=(0,j.useState)(null),[U,W]=(0,j.useState)(null),[G,K]=(0,j.useState)(null),[q,J]=(0,j.useState)(null),[ht,gt]=(0,j.useState)(!1),Y=(0,j.useCallback)(async()=>{z(!0),V(!1);try{pt(await e({}))}catch{V(!0)}finally{z(!1)}},[e]);(0,j.useEffect)(()=>{Y()},[Y]);let _t=(0,j.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),X=(0,j.useRef)(null);(0,j.useEffect)(()=>{L!==null&&X.current!==null&&X.current.scrollIntoView({block:`center`})},[L]);let vt=(0,j.useMemo)(()=>new Intl.DateTimeFormat(je(),{dateStyle:`medium`,timeStyle:`short`}),[]),Z=async(e,t,n)=>{mt(e);try{await t(),I.success(n),await Y()}catch(e){I.toast({variant:`error`,title:m({code:P(e)})})}finally{mt(null)}},Q=(0,j.useRef)(0),$=(0,j.useRef)(0),yt=async(e,t)=>{if(t.id===null)return;let r=++Q.current;K({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Q.current)return;K({name:t.name??t.id,entries:i})}catch(e){if(r!==Q.current)return;K(null),I.toast({variant:`error`,title:m({code:P(e)})})}},bt=async(e,n)=>{if(n.id===null)return;let r=++$.current;J({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%N.days===0?(s=String(e/N.days),c=`days`):e%N.hours===0?(s=String(e/N.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/N.minutes))),c=`minutes`))}if(r!==$.current)return;J(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==$.current)return;J(null),I.toast({variant:`error`,title:m({code:P(e)})})}},xt=async()=>{if(q===null)return;let e={};if(q.nameDirty&&q.name.trim()===``||q.messageDirty&&q.hasMessage&&q.message.trim()===``){I.toast({variant:`error`,title:ke()});return}if(q.nameDirty&&q.name.trim()!==``&&(e.name=q.name.trim()),q.scheduleDirty){if(q.scheduleKind===`cron`&&q.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:q.cronExpr.trim(),...q.tz.trim()===``?{}:{tz:q.tz.trim()}};else if(q.scheduleKind===`every`){let t=Number(q.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*N[q.everyUnit])})}else if(q.scheduleKind===`at`&&q.at!==``){let t=Date.parse(q.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(q.scheduleDirty&&e.schedule===void 0){I.toast({variant:`error`,title:we()});return}if(q.messageDirty&&q.hasMessage&&q.message.trim()!==``&&(e.message=q.message.trim()),Object.keys(e).length===0){J(null);return}let t=$.current;gt(!0);try{await s({instanceName:q.instanceName,jobId:q.jobId,patch:e}),I.success(se()),t===$.current&&J(null),await Y()}catch(e){I.toast({variant:`error`,title:m({code:P(e)})})}finally{gt(!1)}},St=L?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,M.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:ne()}),(0,M.jsxs)(b,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:R,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,M.jsx)(st,{size:14,"aria-hidden":!0}),le()]})]}),L===null?(0,M.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":R,children:B?p():f()}):(0,M.jsxs)(M.Fragment,{children:[B?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,L.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):null,L.map(e=>(0,M.jsxs)(`section`,{style:{marginBottom:20},children:[L.length>1||e.error||!e.supported?(0,M.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,M.jsx)(S,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i({code:e.error})}):e.jobs.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):(0,M.jsxs)(ut,{children:[(0,M.jsx)(ct,{children:(0,M.jsxs)(k,{children:[(0,M.jsx)(O,{children:ce()}),(0,M.jsx)(O,{children:l()}),(0,M.jsx)(O,{children:te()}),(0,M.jsx)(O,{children:pe()}),(0,M.jsx)(O,{children:Pe()}),(0,M.jsx)(O,{children:Ee()})]})}),(0,M.jsx)(lt,{children:e.jobs.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=H===i,c=e.manageSupported,l=e.kind===`openclaw`&&c;return(0,M.jsxs)(k,{ref:t.id!==null&&t.id===_t?X:void 0,"data-state":t.id!==null&&t.id===_t?`selected`:void 0,children:[(0,M.jsx)(A,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??o()}),(0,M.jsx)(A,{children:(0,M.jsx)(S,{variant:`secondary`,children:t.agentId})}),(0,M.jsxs)(A,{className:`whitespace-nowrap`,children:[(0,M.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Re(t.schedule),n=e===null?null:Ze(e);return n===null?null:(0,M.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,M.jsx)(A,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:vt.format(t.nextRunAtMs)}),(0,M.jsxs)(A,{children:[t.enabled===!0?(0,M.jsx)(S,{variant:`secondary`,children:Ie()}):t.enabled===!1?(0,M.jsx)(S,{variant:`outline`,children:de()}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,M.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]}),(0,M.jsx)(A,{className:`whitespace-nowrap`,children:t.id===null?(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,M.jsx)(Ge,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,M.jsxs)(`span`,{style:{display:`inline-flex`,gap:2},children:[l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:v(),"aria-label":v(),disabled:H!==null,onClick:()=>void Z(i,async()=>{let n=await ft({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ve()),children:(0,M.jsx)(Ke,{size:14,"aria-hidden":!0})}):null,l&&t.enabled!==null?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:t.enabled?_():y(),"aria-label":t.enabled?_():y(),disabled:H!==null,onClick:()=>void Z(i,()=>s({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?ge():_e()),children:t.enabled?(0,M.jsx)(Xe,{size:14,"aria-hidden":!0}):(0,M.jsx)(Qe,{size:14,"aria-hidden":!0})}):null,l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:r(),"aria-label":r(),disabled:H!==null,onClick:()=>void bt(e.instanceName,t),children:(0,M.jsx)(He,{size:14,"aria-hidden":!0})}):null,l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:g(),"aria-label":g(),disabled:H!==null,onClick:()=>void yt(e.instanceName,t),children:(0,M.jsx)(dt,{size:14,"aria-hidden":!0})}):null,c?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:Se(),"aria-label":Se(),disabled:H!==null,onClick:()=>W({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,M.jsx)(ze,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:De()})]},e.instanceName)),St>0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:xe()}):null]}),(0,M.jsx)(Be,{open:U!==null,onOpenChange:e=>{e||W(null)},children:(0,M.jsxs)(Ue,{children:[(0,M.jsxs)(tt,{children:[(0,M.jsx)(qe,{children:Ae()}),(0,M.jsx)(et,{children:ae({name:U?.name??``})})]}),(0,M.jsxs)($e,{children:[(0,M.jsx)(ot,{children:d()}),(0,M.jsx)(We,{onClick:()=>{let e=U;W(null),e!==null&&Z(`${e.instanceName}:${e.jobId}`,()=>F({instanceName:e.instanceName,jobId:e.jobId}),ie())},children:he()})]})]})}),(0,M.jsx)(w,{open:G!==null,onOpenChange:e=>{e||(Q.current++,K(null))},children:(0,M.jsxs)(at,{style:{maxWidth:640},children:[(0,M.jsx)(nt,{children:(0,M.jsx)(T,{children:c({name:G?.name??``})})}),G?.entries===null?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):G!==null&&G.entries.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):G===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:G.entries.map((e,t)=>(0,M.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,M.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[e.status===`ok`?(0,M.jsx)(S,{variant:`secondary`,children:re()}):e.status===`error`?(0,M.jsx)(S,{variant:`destructive`,children:me()}):(0,M.jsx)(S,{variant:`outline`,children:e.status??`—`}),(0,M.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?vt.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,M.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,M.jsx)(w,{open:q!==null,onOpenChange:e=>{e||($.current++,J(null))},children:(0,M.jsxs)(at,{children:[(0,M.jsxs)(nt,{children:[(0,M.jsx)(T,{children:fe()}),(0,M.jsx)(it,{children:Ne()})]}),q===null?null:q.loading?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,M.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,M.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ce()}),(0,M.jsx)(C,{value:q.name,maxLength:200,onChange:e=>J({...q,name:e.target.value,nameDirty:!0})})]}),(0,M.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:a()}),(0,M.jsxs)(D,{value:q.scheduleKind,onValueChange:e=>J({...q,scheduleKind:e,scheduleDirty:!0}),children:[(0,M.jsx)(E,{children:(0,M.jsx)(Ye,{})}),(0,M.jsxs)(Je,{children:[(0,M.jsx)(x,{value:`cron`,children:ue()}),(0,M.jsx)(x,{value:`every`,children:Fe()}),(0,M.jsx)(x,{value:`at`,children:be()})]})]}),q.scheduleKind===`cron`?(0,M.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,M.jsx)(C,{value:q.cronExpr,onChange:e=>J({...q,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,M.jsx)(C,{value:q.tz,onChange:e=>J({...q,tz:e.target.value,scheduleDirty:!0}),placeholder:`America/Toronto`,style:{maxWidth:180}})]}):q.scheduleKind===`every`?(0,M.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,M.jsx)(C,{type:`number`,min:1,value:q.everyValue,onChange:e=>J({...q,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,M.jsxs)(D,{value:q.everyUnit,onValueChange:e=>J({...q,everyUnit:e,scheduleDirty:!0}),children:[(0,M.jsx)(E,{style:{maxWidth:160},children:(0,M.jsx)(Ye,{})}),(0,M.jsxs)(Je,{children:[(0,M.jsx)(x,{value:`minutes`,children:Le()}),(0,M.jsx)(x,{value:`hours`,children:Me()}),(0,M.jsx)(x,{value:`days`,children:ye()})]})]})]}):(0,M.jsx)(C,{type:`datetime-local`,value:q.at,onChange:e=>J({...q,at:e.target.value,scheduleDirty:!0})})]}),q.hasMessage?(0,M.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Te()}),(0,M.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:q.message,onChange:e=>J({...q,message:e.target.value,messageDirty:!0})})]}):null]}),(0,M.jsxs)(rt,{children:[(0,M.jsx)(b,{variant:`ghost`,onClick:()=>J(null),children:d()}),(0,M.jsxs)(b,{onClick:()=>void xt(),disabled:q===null||q.loading||ht,children:[ht?(0,M.jsx)(Ge,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Ce()]})]})]})})]})}export{F as ScheduledTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AM as r,AN as i,CM as a,CN as o,D as s,DM as c,DN as l,E as u,EM as ee,EN as te,FN as ne,GM as d,GP as f,HM as re,JM as ie,KM as ae,MN as oe,NN as p,OM as se,ON as ce,PN as le,QM as m,SM as ue,SN as de,TM as fe,TN as pe,VM as me,WM as he,XM as ge,YM as _e,ZM as ve,ZP as h,_M as ye,bM as be,cM as xe,eN as Se,gM as Ce,hM as we,iN as Te,jM as Ee,jN as De,kM as g,kN as Oe,mM as ke,nN as _,qM as Ae,qP as je,rN as v,tN as y,vM as Me,wM as Ne,wN as Pe,xM as Fe,xN as Ie,yM as Le}from"./dist-De2K23IB.js";import{t as b}from"./button-Bd43O_sm.js";import{B as Re,C as x,Ft as ze,G as Be,H as Ve,Ht as He,J as Ue,K as We,Kt as Ge,Mt as Ke,Q as qe,S as Je,T as Ye,Ut as Xe,V as Ze,Vt as Qe,X as $e,Y as et,Z as tt,_t as nt,dt as S,ft as C,gt as rt,ht as it,mt as at,pt as w,q as ot,vt as T,w as E,x as D,zt as st}from"./index-CNwjY680.js";import{a as ct,i as O,n as lt,o as k,r as A,t as ut}from"./table-BRilRxUj.js";var dt=s(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),j=t(e(),1),M=n(),N={minutes:6e4,hours:36e5,days:864e5};function P(e){return e?.data?.code??`unknown`}function F(){let e=h(u.scheduled.listMyCrons),t=h(u.scheduled.getCronDetail),n=h(u.scheduled.listCronRuns),s=h(u.scheduled.updateCron),F=h(u.scheduled.removeCron),ft=h(u.scheduled.runCronNow),I=Ve(),[L,pt]=(0,j.useState)(null),[R,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),[H,mt]=(0,j.useState)(null),[U,W]=(0,j.useState)(null),[G,K]=(0,j.useState)(null),[q,J]=(0,j.useState)(null),[ht,gt]=(0,j.useState)(!1),Y=(0,j.useCallback)(async()=>{z(!0),V(!1);try{pt(await e({}))}catch{V(!0)}finally{z(!1)}},[e]);(0,j.useEffect)(()=>{Y()},[Y]);let _t=(0,j.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),X=(0,j.useRef)(null);(0,j.useEffect)(()=>{L!==null&&X.current!==null&&X.current.scrollIntoView({block:`center`})},[L]);let vt=(0,j.useMemo)(()=>new Intl.DateTimeFormat(je(),{dateStyle:`medium`,timeStyle:`short`}),[]),Z=async(e,t,n)=>{mt(e);try{await t(),I.success(n),await Y()}catch(e){I.toast({variant:`error`,title:m({code:P(e)})})}finally{mt(null)}},Q=(0,j.useRef)(0),$=(0,j.useRef)(0),yt=async(e,t)=>{if(t.id===null)return;let r=++Q.current;K({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Q.current)return;K({name:t.name??t.id,entries:i})}catch(e){if(r!==Q.current)return;K(null),I.toast({variant:`error`,title:m({code:P(e)})})}},bt=async(e,n)=>{if(n.id===null)return;let r=++$.current;J({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%N.days===0?(s=String(e/N.days),c=`days`):e%N.hours===0?(s=String(e/N.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/N.minutes))),c=`minutes`))}if(r!==$.current)return;J(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==$.current)return;J(null),I.toast({variant:`error`,title:m({code:P(e)})})}},xt=async()=>{if(q===null)return;let e={};if(q.nameDirty&&q.name.trim()===``||q.messageDirty&&q.hasMessage&&q.message.trim()===``){I.toast({variant:`error`,title:ke()});return}if(q.nameDirty&&q.name.trim()!==``&&(e.name=q.name.trim()),q.scheduleDirty){if(q.scheduleKind===`cron`&&q.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:q.cronExpr.trim(),...q.tz.trim()===``?{}:{tz:q.tz.trim()}};else if(q.scheduleKind===`every`){let t=Number(q.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*N[q.everyUnit])})}else if(q.scheduleKind===`at`&&q.at!==``){let t=Date.parse(q.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(q.scheduleDirty&&e.schedule===void 0){I.toast({variant:`error`,title:we()});return}if(q.messageDirty&&q.hasMessage&&q.message.trim()!==``&&(e.message=q.message.trim()),Object.keys(e).length===0){J(null);return}let t=$.current;gt(!0);try{await s({instanceName:q.instanceName,jobId:q.jobId,patch:e}),I.success(se()),t===$.current&&J(null),await Y()}catch(e){I.toast({variant:`error`,title:m({code:P(e)})})}finally{gt(!1)}},St=L?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,M.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:ne()}),(0,M.jsxs)(b,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:R,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,M.jsx)(st,{size:14,"aria-hidden":!0}),le()]})]}),L===null?(0,M.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":R,children:B?p():f()}):(0,M.jsxs)(M.Fragment,{children:[B?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,L.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):null,L.map(e=>(0,M.jsxs)(`section`,{style:{marginBottom:20},children:[L.length>1||e.error||!e.supported?(0,M.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,M.jsx)(S,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i({code:e.error})}):e.jobs.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()}):(0,M.jsxs)(ut,{children:[(0,M.jsx)(ct,{children:(0,M.jsxs)(k,{children:[(0,M.jsx)(O,{children:ce()}),(0,M.jsx)(O,{children:l()}),(0,M.jsx)(O,{children:te()}),(0,M.jsx)(O,{children:pe()}),(0,M.jsx)(O,{children:Pe()}),(0,M.jsx)(O,{children:Ee()})]})}),(0,M.jsx)(lt,{children:e.jobs.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=H===i,c=e.manageSupported,l=e.kind===`openclaw`&&c;return(0,M.jsxs)(k,{ref:t.id!==null&&t.id===_t?X:void 0,"data-state":t.id!==null&&t.id===_t?`selected`:void 0,children:[(0,M.jsx)(A,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??o()}),(0,M.jsx)(A,{children:(0,M.jsx)(S,{variant:`secondary`,children:t.agentId})}),(0,M.jsxs)(A,{className:`whitespace-nowrap`,children:[(0,M.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Re(t.schedule),n=e===null?null:Ze(e);return n===null?null:(0,M.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,M.jsx)(A,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:vt.format(t.nextRunAtMs)}),(0,M.jsxs)(A,{children:[t.enabled===!0?(0,M.jsx)(S,{variant:`secondary`,children:Ie()}):t.enabled===!1?(0,M.jsx)(S,{variant:`outline`,children:de()}):(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}),t.lastRunStatus?(0,M.jsx)(`span`,{className:`text-muted-foreground`,style:{marginLeft:8,fontSize:`0.8rem`},children:t.lastRunStatus}):null]}),(0,M.jsx)(A,{className:`whitespace-nowrap`,children:t.id===null?(0,M.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,M.jsx)(Ge,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,M.jsxs)(`span`,{style:{display:`inline-flex`,gap:2},children:[l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:v(),"aria-label":v(),disabled:H!==null,onClick:()=>void Z(i,async()=>{let n=await ft({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ve()),children:(0,M.jsx)(Ke,{size:14,"aria-hidden":!0})}):null,l&&t.enabled!==null?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:t.enabled?_():y(),"aria-label":t.enabled?_():y(),disabled:H!==null,onClick:()=>void Z(i,()=>s({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?ge():_e()),children:t.enabled?(0,M.jsx)(Xe,{size:14,"aria-hidden":!0}):(0,M.jsx)(Qe,{size:14,"aria-hidden":!0})}):null,l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:r(),"aria-label":r(),disabled:H!==null,onClick:()=>void bt(e.instanceName,t),children:(0,M.jsx)(He,{size:14,"aria-hidden":!0})}):null,l?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:g(),"aria-label":g(),disabled:H!==null,onClick:()=>void yt(e.instanceName,t),children:(0,M.jsx)(dt,{size:14,"aria-hidden":!0})}):null,c?(0,M.jsx)(b,{variant:`ghost`,size:`icon-sm`,title:Se(),"aria-label":Se(),disabled:H!==null,onClick:()=>W({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,M.jsx)(ze,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:De()})]},e.instanceName)),St>0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:xe()}):null]}),(0,M.jsx)(Be,{open:U!==null,onOpenChange:e=>{e||W(null)},children:(0,M.jsxs)(Ue,{children:[(0,M.jsxs)(tt,{children:[(0,M.jsx)(qe,{children:Ae()}),(0,M.jsx)(et,{children:ae({name:U?.name??``})})]}),(0,M.jsxs)($e,{children:[(0,M.jsx)(ot,{children:d()}),(0,M.jsx)(We,{onClick:()=>{let e=U;W(null),e!==null&&Z(`${e.instanceName}:${e.jobId}`,()=>F({instanceName:e.instanceName,jobId:e.jobId}),ie())},children:he()})]})]})}),(0,M.jsx)(w,{open:G!==null,onOpenChange:e=>{e||(Q.current++,K(null))},children:(0,M.jsxs)(at,{style:{maxWidth:640},children:[(0,M.jsx)(nt,{children:(0,M.jsx)(T,{children:c({name:G?.name??``})})}),G?.entries===null?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):G!==null&&G.entries.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):G===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:G.entries.map((e,t)=>(0,M.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,M.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[e.status===`ok`?(0,M.jsx)(S,{variant:`secondary`,children:re()}):e.status===`error`?(0,M.jsx)(S,{variant:`destructive`,children:me()}):(0,M.jsx)(S,{variant:`outline`,children:e.status??`—`}),(0,M.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?vt.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,M.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,M.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error})]},t))})]})}),(0,M.jsx)(w,{open:q!==null,onOpenChange:e=>{e||($.current++,J(null))},children:(0,M.jsxs)(at,{children:[(0,M.jsxs)(nt,{children:[(0,M.jsx)(T,{children:fe()}),(0,M.jsx)(it,{children:Ne()})]}),q===null?null:q.loading?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,M.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,M.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ce()}),(0,M.jsx)(C,{value:q.name,maxLength:200,onChange:e=>J({...q,name:e.target.value,nameDirty:!0})})]}),(0,M.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:a()}),(0,M.jsxs)(D,{value:q.scheduleKind,onValueChange:e=>J({...q,scheduleKind:e,scheduleDirty:!0}),children:[(0,M.jsx)(E,{children:(0,M.jsx)(Ye,{})}),(0,M.jsxs)(Je,{children:[(0,M.jsx)(x,{value:`cron`,children:ue()}),(0,M.jsx)(x,{value:`every`,children:Fe()}),(0,M.jsx)(x,{value:`at`,children:be()})]})]}),q.scheduleKind===`cron`?(0,M.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,M.jsx)(C,{value:q.cronExpr,onChange:e=>J({...q,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,M.jsx)(C,{value:q.tz,onChange:e=>J({...q,tz:e.target.value,scheduleDirty:!0}),placeholder:`America/Toronto`,style:{maxWidth:180}})]}):q.scheduleKind===`every`?(0,M.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,M.jsx)(C,{type:`number`,min:1,value:q.everyValue,onChange:e=>J({...q,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,M.jsxs)(D,{value:q.everyUnit,onValueChange:e=>J({...q,everyUnit:e,scheduleDirty:!0}),children:[(0,M.jsx)(E,{style:{maxWidth:160},children:(0,M.jsx)(Ye,{})}),(0,M.jsxs)(Je,{children:[(0,M.jsx)(x,{value:`minutes`,children:Le()}),(0,M.jsx)(x,{value:`hours`,children:Me()}),(0,M.jsx)(x,{value:`days`,children:ye()})]})]})]}):(0,M.jsx)(C,{type:`datetime-local`,value:q.at,onChange:e=>J({...q,at:e.target.value,scheduleDirty:!0})})]}),q.hasMessage?(0,M.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,M.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Te()}),(0,M.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:q.message,onChange:e=>J({...q,message:e.target.value,messageDirty:!0})})]}):null]}),(0,M.jsxs)(rt,{children:[(0,M.jsx)(b,{variant:`ghost`,onClick:()=>J(null),children:d()}),(0,M.jsxs)(b,{onClick:()=>void xt(),disabled:q===null||q.loading||ht,children:[ht?(0,M.jsx)(Ge,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Ce()]})]})]})})]})}export{F as ScheduledTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$P as i,AO as a,Ak as ee,BO as o,Bk as te,Ck as ne,Dk as re,E as s,Ek as ie,FO as c,Fk as ae,GO as l,Gk as oe,HO as u,Hk as se,IO as d,Ik as ce,JO as f,Jk as le,KO as p,Kk as ue,LO as m,Lk as de,MO as h,Mk as fe,NO as g,Nk as pe,Ok as me,PO as he,Pk as ge,QO as _e,RO as _,Rk as ve,Sk as ye,Tk as be,UO as v,Uk as xe,VO as Se,Vk as Ce,WO as y,Wk as b,XO as x,YO as S,Yk as we,ZO as C,ZP as Te,_k as Ee,ak as De,bk as Oe,ck as ke,dk as Ae,eF as w,ek as je,fk as Me,gk as Ne,hk as Pe,ik as Fe,jO as T,jk as Ie,kO as E,kk as Le,lk as Re,mk as ze,nk as Be,ok as Ve,pk as He,qO as D,qk as Ue,rk as We,sk as Ge,tk as Ke,uk as qe,vk as Je,wk as Ye,xk as Xe,yk as Ze,zO as O,zk as Qe}from"./dist-De2K23IB.js";import{n as k}from"./dist-Du1hJWyV.js";import{i as $e}from"./dist-CXJY_tYD.js";import{t as A}from"./button-Bd43O_sm.js";import{C as j,H as et,S as M,T as N,U as tt,Zt as P,_t as F,d as nt,dt as I,en as rt,ft as L,gt as R,ht as z,mt as B,nn as it,nt as V,pt as at,rn as ot,rt as H,vt as U,w as W,x as G}from"./index-CW5WE31O.js";import{t as st}from"./FilterBar-Byr6OGo7.js";import{t as ct}from"./DataTableShell-DAEVsm3y.js";import{t as lt}from"./roleDescriptions-zLFA4zEm.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>he(),days:30},{value:`90`,label:()=>g(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=ot({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??X,[o,c]=(0,K.useState)(X),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),d=w(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===X?void 0:o,disabled:a===X?void 0:a===`disabled`}}),f=w(s.apiKeys.listKeys,{}),p=w(s.apiKeys.listRoles,{}),m=i(s.apiKeys.createServiceAccount),h=i(s.apiKeys.updateServiceAccount),g=i(s.apiKeys.deleteServiceAccount),he=Te(s.apiKeys.mintApiKey),_e=i(s.apiKeys.revokeApiKey),_=tt(),v=et(),Se=n!==``||o!==X||a!==X;function y(){c(X),t({search:{},replace:!0})}let[x,S]=(0,K.useState)(!1),[C,T]=(0,K.useState)(Z),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(new Set),[P,F]=(0,K.useState)(null),R=(0,K.useRef)(!1),[z,B]=(0,K.useState)(new Set),[V,at]=(0,K.useState)({}),[H,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function Q(e){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await h({serviceAccountId:E,name:C.name,roleKey:C.roleKey,description:C.description}),v.success(He())):await m({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Z),D(null),S(!1)}catch(e){v.error(E?ze():Pe(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),S(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await he({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Me(),e)}finally{R.current=!1,F(null)}}async function $(e){if(await _({title:Ae(),description:(0,q.jsxs)(q.Fragment,{children:[qe(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Re(),` `,(0,q.jsx)(`strong`,{children:ke()}),` `,Ge()]}),confirmWord:e.name,confirmLabel:Ve(),destructive:!0}))try{await g({serviceAccountId:e._id}),v.success(De(),e.name)}catch(e){v.error(Fe(),e)}}async function ht(e){if(await _({title:We(),description:(0,q.jsxs)(q.Fragment,{children:[Be(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ke()]}),confirmLabel:je(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _e({keyId:e._id})}catch(e){v.error(r(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,q.jsxs)(st,{q:n,onQChange:l,searchPlaceholder:le(),onReset:y,canReset:Se,children:[(0,q.jsxs)(G,{value:o,onValueChange:c,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(N,{placeholder:Ue()})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(j,{value:X,children:ue()}),(p??[]).map(e=>(0,q.jsx)(j,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:a,onValueChange:u,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(N,{})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(j,{value:X,children:oe()}),(0,q.jsx)(j,{value:`active`,children:b()}),(0,q.jsx)(j,{value:`disabled`,children:xe()})]})]})]}),(0,q.jsx)(ct,{title:se(),rows:d,addLabel:Ce(),onAdd:()=>{T(Z),D(null),S(!0)},emptyHint:te(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ce(),onSelect:()=>pt(e)},{label:Qe(),onSelect:()=>void mt(e)},{label:O.has(e._id)?ve():de(),onSelect:()=>Q(e._id)},{label:ae(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ge():pe(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,q.jsx)($e,{}):(0,q.jsx)(rt,{})})},{header:fe(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ie(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:xe()}):(0,q.jsx)(I,{variant:`outline`,children:b()})},{header:Le(),cell:e=>(0,q.jsxs)(G,{value:V[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(M,{children:J.map(e=>(0,q.jsx)(j,{value:e.value,children:e.label()},e.value))})]})},{header:me(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?re():ie({count:t})})}}]}),(0,q.jsx)(nt,{open:x,onOpenChange:e=>{S(e),e||D(null)},title:E?be():ye(),description:E?Ye():Xe(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:E?ne():Oe(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ze()}),(0,q.jsx)(L,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Je()}),(0,q.jsxs)(G,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(N,{placeholder:Ee()})}),(0,q.jsx)(M,{children:(p??[]).map(e=>(0,q.jsxs)(j,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===C.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ne()}),(0,q.jsx)(L,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:H,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[_e(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:x()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:f()}),(0,q.jsx)(`th`,{children:D()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{children:l()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:H(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?y():v()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(at,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(B,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(F,{children:[(0,q.jsx)(U,{children:u()}),(0,q.jsx)(z,{children:Se({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:o()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":O(),children:[n?(0,q.jsx)(k,{}):(0,q.jsx)(P,{}),n?_():m()]})]}),(0,q.jsx)(R,{children:(0,q.jsx)(A,{onClick:()=>{r(!1),t()},children:d()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?h():H(e)}function mt(e){return e===null?`—`:V(e)}function $(e){return e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:T()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(I,{variant:`outline`,children:a()}):(0,q.jsx)(I,{variant:`outline`,children:E()})}export{Q as ServiceAccountsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$P as i,AO as a,Ak as ee,BO as o,Bk as te,Ck as ne,Dk as re,E as s,Ek as ie,FO as c,Fk as ae,GO as l,Gk as oe,HO as u,Hk as se,IO as d,Ik as ce,JO as f,Jk as le,KO as p,Kk as ue,LO as m,Lk as de,MO as h,Mk as fe,NO as g,Nk as pe,Ok as me,PO as he,Pk as ge,QO as _e,RO as _,Rk as ve,Sk as ye,Tk as be,UO as v,Uk as xe,VO as Se,Vk as Ce,WO as y,Wk as b,XO as x,YO as S,Yk as we,ZO as C,ZP as Te,_k as Ee,ak as De,bk as Oe,ck as ke,dk as Ae,eF as w,ek as je,fk as Me,gk as Ne,hk as Pe,ik as Fe,jO as T,jk as Ie,kO as E,kk as Le,lk as Re,mk as ze,nk as Be,ok as Ve,pk as He,qO as D,qk as Ue,rk as We,sk as Ge,tk as Ke,uk as qe,vk as Je,wk as Ye,xk as Xe,yk as Ze,zO as O,zk as Qe}from"./dist-De2K23IB.js";import{n as k}from"./dist-Du1hJWyV.js";import{i as $e}from"./dist-CXJY_tYD.js";import{t as A}from"./button-Bd43O_sm.js";import{C as j,H as et,S as M,T as N,U as tt,Zt as P,_t as F,d as nt,dt as I,en as rt,ft as L,gt as R,ht as z,mt as B,nn as it,nt as V,pt as at,rn as ot,rt as H,vt as U,w as W,x as G}from"./index-CNwjY680.js";import{t as st}from"./FilterBar-CY1WfFDB.js";import{t as ct}from"./DataTableShell-COEwE2Hv.js";import{t as lt}from"./roleDescriptions-zLFA4zEm.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>he(),days:30},{value:`90`,label:()=>g(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=ot({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??X,[o,c]=(0,K.useState)(X),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),d=w(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===X?void 0:o,disabled:a===X?void 0:a===`disabled`}}),f=w(s.apiKeys.listKeys,{}),p=w(s.apiKeys.listRoles,{}),m=i(s.apiKeys.createServiceAccount),h=i(s.apiKeys.updateServiceAccount),g=i(s.apiKeys.deleteServiceAccount),he=Te(s.apiKeys.mintApiKey),_e=i(s.apiKeys.revokeApiKey),_=tt(),v=et(),Se=n!==``||o!==X||a!==X;function y(){c(X),t({search:{},replace:!0})}let[x,S]=(0,K.useState)(!1),[C,T]=(0,K.useState)(Z),[E,D]=(0,K.useState)(null),[O,k]=(0,K.useState)(new Set),[P,F]=(0,K.useState)(null),R=(0,K.useRef)(!1),[z,B]=(0,K.useState)(new Set),[V,at]=(0,K.useState)({}),[H,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function Q(e){k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await h({serviceAccountId:E,name:C.name,roleKey:C.roleKey,description:C.description}),v.success(He())):await m({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Z),D(null),S(!1)}catch(e){v.error(E?ze():Pe(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),S(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await he({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Me(),e)}finally{R.current=!1,F(null)}}async function $(e){if(await _({title:Ae(),description:(0,q.jsxs)(q.Fragment,{children:[qe(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Re(),` `,(0,q.jsx)(`strong`,{children:ke()}),` `,Ge()]}),confirmWord:e.name,confirmLabel:Ve(),destructive:!0}))try{await g({serviceAccountId:e._id}),v.success(De(),e.name)}catch(e){v.error(Fe(),e)}}async function ht(e){if(await _({title:We(),description:(0,q.jsxs)(q.Fragment,{children:[Be(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ke()]}),confirmLabel:je(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _e({keyId:e._id})}catch(e){v.error(r(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,q.jsxs)(st,{q:n,onQChange:l,searchPlaceholder:le(),onReset:y,canReset:Se,children:[(0,q.jsxs)(G,{value:o,onValueChange:c,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(N,{placeholder:Ue()})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(j,{value:X,children:ue()}),(p??[]).map(e=>(0,q.jsx)(j,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(G,{value:a,onValueChange:u,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(N,{})}),(0,q.jsxs)(M,{children:[(0,q.jsx)(j,{value:X,children:oe()}),(0,q.jsx)(j,{value:`active`,children:b()}),(0,q.jsx)(j,{value:`disabled`,children:xe()})]})]})]}),(0,q.jsx)(ct,{title:se(),rows:d,addLabel:Ce(),onAdd:()=>{T(Z),D(null),S(!0)},emptyHint:te(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:ce(),onSelect:()=>pt(e)},{label:Qe(),onSelect:()=>void mt(e)},{label:O.has(e._id)?ve():de(),onSelect:()=>Q(e._id)},{label:ae(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ge():pe(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,q.jsx)($e,{}):(0,q.jsx)(rt,{})})},{header:fe(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ie(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})},{header:ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:xe()}):(0,q.jsx)(I,{variant:`outline`,children:b()})},{header:Le(),cell:e=>(0,q.jsxs)(G,{value:V[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(N,{})}),(0,q.jsx)(M,{children:J.map(e=>(0,q.jsx)(j,{value:e.value,children:e.label()},e.value))})]})},{header:me(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?re():ie({count:t})})}}]}),(0,q.jsx)(nt,{open:x,onOpenChange:e=>{S(e),e||D(null)},title:E?be():ye(),description:E?Ye():Xe(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:E?ne():Oe(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ze()}),(0,q.jsx)(L,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Je()}),(0,q.jsxs)(G,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(N,{placeholder:Ee()})}),(0,q.jsx)(M,{children:(p??[]).map(e=>(0,q.jsxs)(j,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===C.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ne()}),(0,q.jsx)(L,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:H,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[_e(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:x()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:f()}),(0,q.jsx)(`th`,{children:D()}),(0,q.jsx)(`th`,{children:p()}),(0,q.jsx)(`th`,{children:l()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(I,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:H(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?y():v()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(at,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(B,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(F,{children:[(0,q.jsx)(U,{children:u()}),(0,q.jsx)(z,{children:Se({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:o()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":O(),children:[n?(0,q.jsx)(k,{}):(0,q.jsx)(P,{}),n?_():m()]})]}),(0,q.jsx)(R,{children:(0,q.jsx)(A,{onClick:()=>{r(!1),t()},children:d()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?h():H(e)}function mt(e){return e===null?`—`:V(e)}function $(e){return e.disabled?(0,q.jsx)(I,{variant:`destructive`,children:T()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(I,{variant:`outline`,children:a()}):(0,q.jsx)(I,{variant:`outline`,children:E()})}export{Q as ServiceAccountsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,Ao as i,Bo as a,Co as o,Do as s,E as c,Eo as l,Fo as u,Io as d,Lo as f,Mo as p,No as m,Oo as h,Po as g,Ro as _,So as v,To as y,_o as b,ao as x,bo as S,co as C,do as w,eF as T,fo as E,go as D,ho as O,io as k,jo as A,ko as j,lo as M,mo as N,no as P,oo as F,po as I,ro as L,so as ee,uo as R,vo as z,wo as B,xo as V,yo as H,zo as U}from"./dist-De2K23IB.js";import{t as W}from"./button-Bd43O_sm.js";import{U as G,rt as K}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,Ao as i,Bo as a,Co as o,Do as s,E as c,Eo as l,Fo as u,Io as d,Lo as f,Mo as p,No as m,Oo as h,Po as g,Ro as _,So as v,To as y,_o as b,ao as x,bo as S,co as C,do as w,eF as T,fo as E,go as D,ho as O,io as k,jo as A,ko as j,lo as M,mo as N,no as P,oo as F,po as I,ro as L,so as ee,uo as R,vo as z,wo as B,xo as V,yo as H,zo as U}from"./dist-De2K23IB.js";import{t as W}from"./button-Bd43O_sm.js";import{U as G,rt as K}from"./index-CNwjY680.js";import{t as q}from"./DataTableShell-COEwE2Hv.js";var J=t(e(),1),Y=n(),X={hung:()=>o(),wrong_result:()=>v(),error:()=>V(),other:()=>S()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=r(c.subAgentReports.respondToReport),[i,a]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1);async function d(){let t=o.trim();if(!(!t||l)){u(!0);try{await n({reportId:e._id,text:t}),a(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{u(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,H({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),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`?D():O()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:I(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void d(),disabled:!o.trim()||l,children:l?w():E()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[R({count:t.children.length}),t.childrenTruncated?` ${M()}`:``,t.textTruncated?` ${C()}`:``]}),(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?` · ${ee()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=T(c.subAgentReports.listForAdmin,{}),t=r(c.subAgentReports.readReport),n=r(c.subAgentReports.deleteReport),o=G(),[v,b]=(0,J.useState)(null),[x,S]=(0,J.useState)({});async function C(e){if(v===e._id){b(null);return}if(!x[e._id]){let n=await t({reportId:e._id});S(t=>({...t,[e._id]:n}))}b(e._id)}async function w(e){await o({title:k(),description:L(),confirmLabel:P(),destructive:!0})&&(await n({reportId:e._id}),v===e._id&&b(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,Y.jsx)(`strong`,{children:f()}),` `,d()]}),(0,Y.jsx)(q,{title:a(),rows:e,emptyHint:U(),isExpanded:e=>v===e._id&&!!x[e._id],renderExpanded:e=>x[e._id]?(0,Y.jsx)($,{data:x[e._id]}):null,columns:[{header:u(),cell:e=>K(e.at),sort:e=>e.at},{header:g(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:m(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${j({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:A(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:i(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:s()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:v===e._id?y():l(),onSelect:()=>void C(e)},{label:B(),onSelect:()=>void w(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{$A as r,$P as i,$a as a,$j as o,Aj as s,BA as c,Bj as l,Cj as u,D as d,Dj as f,E as p,Ej as m,Fj as h,GA as g,Gj as _,HA as v,HP as y,Hj as b,IA as x,Ij as ee,JA as te,Jj as S,KA as ne,Kj as re,LA as ie,Lj as ae,Mj as oe,Nj as se,Oj as ce,Pj as le,QA as ue,Qa as de,Qj as fe,RA as pe,Rj as me,Sj as he,Tj as ge,UA as _e,UP as ve,Uj as ye,VA as be,VP as xe,Vj as Se,WA as C,Wj as Ce,XA as we,Xj as Te,YA as Ee,Yj as De,ZA as Oe,ZP as ke,Zj as Ae,_j as je,aj as Me,bj as Ne,cj as Pe,dj as Fe,eF as w,eM as Ie,ej as Le,eo as T,fj as Re,gj as ze,hj as Be,iM as Ve,ij as He,jj as Ue,kj as We,lj as Ge,mj as Ke,n as qe,nM as Je,nj as Ye,oj as Xe,pj as Ze,qA as Qe,qj as $e,rM as et,rj as tt,sj as nt,tM as rt,tj as it,to as E,uj as at,vj as ot,wj as st,xj as D,yj as ct,zA as lt,zj as ut}from"./dist-De2K23IB.js";import{n as O}from"./dist-Du1hJWyV.js";import{t as k}from"./x-DXaZHGzl.js";import{t as A}from"./button-Bd43O_sm.js";import{C as j,S as M,T as N,Xt as dt,Yt as P,at as ft,bt as pt,ct as mt,dt as F,ft as I,lt as ht,m as L,ot as gt,st as R,ut as _t,w as z,wt as B,x as V,yt as vt}from"./index-CW5WE31O.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-Bkvykfxh.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-BRilRxUj.js";import{t as kt}from"./TimeRangePicker-RVc6k7g6.js";import{t as At}from"./FilterBar-Byr6OGo7.js";import{t as jt}from"./AdvancedFilter-BTcB0NuZ.js";var G=d(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=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 q(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(Me());if(e.size>zt)throw Error(He());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(Ye());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(Ye());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error(it());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(tt())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={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 $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?ve():e===`dark`?y():xe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":E(),title:E(),children:(0,X.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=w(p.charts.listMyCharts),r=i(p.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:S(),subtitle:$e(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?re():n.via===`owner`?_():Ce({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()}):null]})}function Qt(){let e=i(p.charts.importChart),[t,n]=(0,K.useState)(``),[r,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[d,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(D())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(ct());return}let i;try{i=JSON.parse(r)}catch{s(D());return}h(!0);try{await e({name:t.trim(),tokens:i}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{h(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:We()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:m(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ge()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>a(e.target.value),placeholder:st(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),u(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:d,onClick:()=>void _(),children:he()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ne()}):null]})]})}function $t({chart:e}){let t=ke(p.charts.setChartLogo),n=i(p.charts.removeChartLogo),[r,a]=(0,K.useState)(!1),[o,s]=(0,K.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 m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Re():Fe()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?Ge():at(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:nt()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Pe()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ze()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Xe()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=w(p.me.getMe,{host:B}),n=i(p.charts.addChartDomain),a=i(p.charts.removeChartDomain),[o,s]=(0,K.useState)(``),[c,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function m(){let t=o.trim();if(t!==``){l(null),d(!0);try{await n({chartKey:e.key,domain:t}),s(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function h(t){l(null);try{await a({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Le()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:we()}):f.map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ee({domain:e}),onClick:()=>void h(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:o,onChange:e=>s(e.target.value),placeholder:ue(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void m(),children:Oe()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:r()}),c?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:c}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=i(p.charts.updateChart),n=i(p.charts.deleteChart),[r,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(e.name),[l,u]=(0,K.useState)(()=>tn(e.tokens)),[d,f]=(0,K.useState)(e.tokens.bpm??0),[m,h]=(0,K.useState)(null),[_,v]=(0,K.useState)(!1);function y(){c(e.name),u(tn(e.tokens)),f(e.tokens.bpm??0),h(null),o(!0)}async function b(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(l)}catch{h(D());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}v(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),o(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function x(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:y,children:Be()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void x(),children:Ke()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ne()}),(0,X.jsx)(I,{value:s,onChange:e=>c(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>f(Number(e.target.value)),"aria-label":T()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?a():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:de()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:g()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:_,onClick:()=>void b(),children:te()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:Qe()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=w(p.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ot()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=i(p.charts.addChartToGroupPool),r=i(p.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,l=new Set((o??[]).map(e=>e.groupId)),u=t.filter(e=>!l.has(e._id));async function d(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function f(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?h():e.kind===`custom`&&e.scope===`personal`?c():ee()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:le()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:oe()}),(o??[]).map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":s({group:e.name}),onClick:()=>void f(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),u.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void d(e),children:[(0,X.jsx)(z,{size:`sm`,className:`w-56`,children:(0,X.jsx)(N,{placeholder:Ue()})}),(0,X.jsx)(M,{children:u.map(e=>(0,X.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:se()}):null]})]})}function on({chart:e}){let t=i(p.charts.promoteChartToCommon),n=i(p.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function a(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?lt():c()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:be({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:pe()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:ie()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=i(p.admin.setDefaultThemeMode),a=i(p.admin.setDefaultLocale),o=i(p.charts.setDefaultChart),s=w(p.charts.listChartsAdmin),c=w(p.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:b()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:S()}),pt.map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:l()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:x()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(A,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]})]})}function cn(){let e=w(p.me.getMe,{host:B}),t=vt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[s,c]=(0,K.useState)(Z),[l,u]=(0,K.useState)(Z),[d,f]=(0,K.useState)(Q),p=i!==``||s!==Z||l!==Z;function m(){a(``),c(Z),u(Z),f(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:o()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(F,{children:`Default`}),(0,X.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(F,{variant:`outline`,children:`Outline`}),(0,X.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(z,{className:`w-56`,children:(0,X.jsx)(N,{placeholder:`Select…`})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:d,onTimeRangeChange:f,onReset:m,canReset:p,children:[(0,X.jsxs)(V,{value:s,onValueChange:c,children:[(0,X.jsx)(z,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes directions`}),(0,X.jsx)(j,{value:`inbound`,children:`inbound`}),(0,X.jsx)(j,{value:`outbound`,children:`outbound`}),(0,X.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:l,onValueChange:u,children:[(0,X.jsx)(z,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(j,{value:`info`,children:`info`}),(0,X.jsx)(j,{value:`warn`,children:`warn`}),(0,X.jsx)(j,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(kt,{value:d,onChange:f})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ft,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(mt,{children:`Actions`}),(0,X.jsx)(ht,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(ht,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(F,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$P as i,$a as a,$j as o,Aj as s,BA as c,Bj as l,Cj as u,D as d,Dj as f,E as p,Ej as m,Fj as h,GA as g,Gj as _,HA as v,HP as y,Hj as b,IA as x,Ij as ee,JA as te,Jj as S,KA as ne,Kj as re,LA as ie,Lj as ae,Mj as oe,Nj as se,Oj as ce,Pj as le,QA as ue,Qa as de,Qj as fe,RA as pe,Rj as me,Sj as he,Tj as ge,UA as _e,UP as ve,Uj as ye,VA as be,VP as xe,Vj as Se,WA as C,Wj as Ce,XA as we,Xj as Te,YA as Ee,Yj as De,ZA as Oe,ZP as ke,Zj as Ae,_j as je,aj as Me,bj as Ne,cj as Pe,dj as Fe,eF as w,eM as Ie,ej as Le,eo as T,fj as Re,gj as ze,hj as Be,iM as Ve,ij as He,jj as Ue,kj as We,lj as Ge,mj as Ke,n as qe,nM as Je,nj as Ye,oj as Xe,pj as Ze,qA as Qe,qj as $e,rM as et,rj as tt,sj as nt,tM as rt,tj as it,to as E,uj as at,vj as ot,wj as st,xj as D,yj as ct,zA as lt,zj as ut}from"./dist-De2K23IB.js";import{n as O}from"./dist-Du1hJWyV.js";import{t as k}from"./x-DXaZHGzl.js";import{t as A}from"./button-Bd43O_sm.js";import{C as j,S as M,T as N,Xt as dt,Yt as P,at as ft,bt as pt,ct as mt,dt as F,ft as I,lt as ht,m as L,ot as gt,st as R,ut as _t,w as z,wt as B,x as V,yt as vt}from"./index-CNwjY680.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-Bkvykfxh.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-BRilRxUj.js";import{t as kt}from"./TimeRangePicker-BYCcnF0a.js";import{t as At}from"./FilterBar-CY1WfFDB.js";import{t as jt}from"./AdvancedFilter-C5pnO4fi.js";var G=d(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=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 q(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(Me());if(e.size>zt)throw Error(He());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(Ye());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(Ye());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error(it());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(tt())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={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 $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?ve():e===`dark`?y():xe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":E(),title:E(),children:(0,X.jsx)(dt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=w(p.charts.listMyCharts),r=i(p.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:S(),subtitle:$e(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?re():n.via===`owner`?_():Ce({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()}):null]})}function Qt(){let e=i(p.charts.importChart),[t,n]=(0,K.useState)(``),[r,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[d,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(D())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(ct());return}let i;try{i=JSON.parse(r)}catch{s(D());return}h(!0);try{await e({name:t.trim(),tokens:i}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{h(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:We()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:m(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ge()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>a(e.target.value),placeholder:st(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),u(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:d,onClick:()=>void _(),children:he()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ne()}):null]})]})}function $t({chart:e}){let t=ke(p.charts.setChartLogo),n=i(p.charts.removeChartLogo),[r,a]=(0,K.useState)(!1),[o,s]=(0,K.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 m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Re():Fe()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?Ge():at(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:nt()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:Pe()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ze()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Xe()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=w(p.me.getMe,{host:B}),n=i(p.charts.addChartDomain),a=i(p.charts.removeChartDomain),[o,s]=(0,K.useState)(``),[c,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function m(){let t=o.trim();if(t!==``){l(null),d(!0);try{await n({chartKey:e.key,domain:t}),s(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function h(t){l(null);try{await a({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Le()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:we()}):f.map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ee({domain:e}),onClick:()=>void h(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:o,onChange:e=>s(e.target.value),placeholder:ue(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void m(),children:Oe()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:r()}),c?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:c}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=i(p.charts.updateChart),n=i(p.charts.deleteChart),[r,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(e.name),[l,u]=(0,K.useState)(()=>tn(e.tokens)),[d,f]=(0,K.useState)(e.tokens.bpm??0),[m,h]=(0,K.useState)(null),[_,v]=(0,K.useState)(!1);function y(){c(e.name),u(tn(e.tokens)),f(e.tokens.bpm??0),h(null),o(!0)}async function b(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(l)}catch{h(D());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}v(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),o(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function x(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:y,children:Be()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void x(),children:Ke()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ne()}),(0,X.jsx)(I,{value:s,onChange:e=>c(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>f(Number(e.target.value)),"aria-label":T()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?a():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:de()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:g()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>u(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:_,onClick:()=>void b(),children:te()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>o(!1),children:Qe()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=w(p.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ot()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ze()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=i(p.charts.addChartToGroupPool),r=i(p.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,l=new Set((o??[]).map(e=>e.groupId)),u=t.filter(e=>!l.has(e._id));async function d(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function f(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?h():e.kind===`custom`&&e.scope===`personal`?c():ee()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:le()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:oe()}),(o??[]).map(e=>(0,X.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":s({group:e.name}),onClick:()=>void f(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),u.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void d(e),children:[(0,X.jsx)(z,{size:`sm`,className:`w-56`,children:(0,X.jsx)(N,{placeholder:Ue()})}),(0,X.jsx)(M,{children:u.map(e=>(0,X.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:se()}):null]})]})}function on({chart:e}){let t=i(p.charts.promoteChartToCommon),n=i(p.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function a(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?lt():c()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:be({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:pe()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:ie()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=i(p.admin.setDefaultThemeMode),a=i(p.admin.setDefaultLocale),o=i(p.charts.setDefaultChart),s=w(p.charts.listChartsAdmin),c=w(p.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:b()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:S()}),pt.map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:l()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:x()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(A,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]})]})}function cn(){let e=w(p.me.getMe,{host:B}),t=vt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[s,c]=(0,K.useState)(Z),[l,u]=(0,K.useState)(Z),[d,f]=(0,K.useState)(Q),p=i!==``||s!==Z||l!==Z;function m(){a(``),c(Z),u(Z),f(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:o()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(F,{children:`Default`}),(0,X.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(F,{variant:`outline`,children:`Outline`}),(0,X.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(V,{value:n,onValueChange:r,children:[(0,X.jsx)(z,{className:`w-56`,children:(0,X.jsx)(N,{placeholder:`Select…`})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:d,onTimeRangeChange:f,onReset:m,canReset:p,children:[(0,X.jsxs)(V,{value:s,onValueChange:c,children:[(0,X.jsx)(z,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes directions`}),(0,X.jsx)(j,{value:`inbound`,children:`inbound`}),(0,X.jsx)(j,{value:`outbound`,children:`outbound`}),(0,X.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:l,onValueChange:u,children:[(0,X.jsx)(z,{size:`sm`,children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(j,{value:`info`,children:`info`}),(0,X.jsx)(j,{value:`warn`,children:`warn`}),(0,X.jsx)(j,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(kt,{value:d,onChange:f})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ft,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(mt,{children:`Actions`}),(0,X.jsx)(ht,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(ht,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(F,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,Bh as i,Gh as a,Hh as o,Jh as s,Jr as c,Kh as l,Qr as u,Rh as d,Uh as f,Vh as p,Wh as m,Xh as h,Xr as g,Yh as _,Yr as v,Zr as y,ei as b,qh as x,zh as S}from"./dist-De2K23IB.js";import{t as C}from"./button-Bd43O_sm.js";import{Dt as w,Et as T,Ot as E,Qt as D,Rt as O,Tt as k,ft as A,rt as j}from"./index-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$r as r,Bh as i,Gh as a,Hh as o,Jh as s,Jr as c,Kh as l,Qr as u,Rh as d,Uh as f,Vh as p,Wh as m,Xh as h,Xr as g,Yh as _,Yr as v,Zr as y,ei as b,qh as x,zh as S}from"./dist-De2K23IB.js";import{t as C}from"./button-Bd43O_sm.js";import{Dt as w,Et as T,Ot as E,Qt as D,Rt as O,Tt as k,ft as A,rt as j}from"./index-CNwjY680.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:h(),from:`now-5m`},{label:_(),from:`now-15m`},{label:s(),from:`now-30m`},{label:x(),from:`now-1h`},{label:l(),from:`now-3h`},{label:a(),from:`now-6h`},{label:m(),from:`now-12h`},{label:f(),from:`now-24h`},{label:o(),from:`now-2d`},{label:p(),from:`now-7d`},{label:i(),from:`now-30d`},{label:S(),from:`now-90d`},{label:d(),from:`now-520w`}];function L(e){return j(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,i]=(0,M.useState)(!1),[a,o]=(0,M.useState)(``),s=F(e),[l,d]=(0,M.useState)(()=>z(s.from)),[f,p]=(0,M.useState)(()=>z(s.to));function m(t){if(t){let t=F(e);d(z(t.from)),p(z(t.to)),o(``)}i(t)}function h(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function _(){let e=B(l),n=B(f);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),i(!1))}let x=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),S=B(l)!==null&&B(f)!==null;return(0,H.jsxs)(w,{open:n,onOpenChange:m,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(D,{}),R(e)]})}),(0,H.jsx)(T,{children:(0,H.jsx)(k,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:b()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,H.jsx)(A,{type:`datetime-local`,value:l,onChange:e=>d(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:u()}),(0,H.jsx)(A,{type:`datetime-local`,value:f,onChange:e=>p(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:_,children:y()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(O,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:a,onChange:e=>o(e.target.value),placeholder:g(),"aria-label":v()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:c()}):x.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>h(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{$P as r,$T as i,$v as a,AT as o,Av as s,Bv as c,Cv as l,D as u,DT as d,Dv as f,E as p,ET as m,Ev as h,FT as g,Fv as _,GT as v,Gv as y,Hv as b,IT as x,Iv as S,JT as C,Jv as ee,KT as w,Kv as te,LT as T,Lv as ne,MT as re,Mv as ie,NT as E,Nv as ae,OT as oe,Ov as se,PT as ce,Pv as le,QT as ue,Qv as de,RT as fe,Rv as pe,Sv as me,TT as he,Tv as ge,Uv as _e,Vv as ve,WT as ye,Wv as be,XT as D,Xn as O,Xv as xe,YT as k,Yn as A,Yv as Se,ZT as j,Zn as Ce,Zv as we,_v as Te,aE as Ee,bv as De,cE as Oe,dE as ke,eE as M,eF as N,ey as Ae,fE as P,iE as F,jT as je,jv as Me,kT as Ne,kv as Pe,lE as Fe,mE as Ie,nE as I,oE as Le,pE as Re,qT as ze,qv as Be,rE as Ve,sE as He,tE as L,ty as Ue,uE as We,vv as Ge,wv as Ke,xv as qe,yv as Je,zT as Ye,zv as Xe}from"./dist-De2K23IB.js";import{n as Ze}from"./dist-Du1hJWyV.js";import{t as Qe}from"./x-DXaZHGzl.js";import{i as R,n as z,r as $e,t as et}from"./tabs-Kb2_G-yp.js";import{t as B}from"./button-Bd43O_sm.js";import{C as V,Jt as tt,M as nt,S as H,T as U,Zt as rt,_t as it,a as at,dt as W,ht as ot,i as st,it as ct,mt as lt,nn as ut,o as dt,pt as ft,qt as pt,rn as mt,rt as G,s as ht,vt as gt,w as K,wt as _t,x as q}from"./index-CW5WE31O.js";import{n as vt}from"./TimeRangePicker-RVc6k7g6.js";import{t as yt}from"./FilterBar-Byr6OGo7.js";import{t as bt}from"./AdvancedFilter-BTcB0NuZ.js";import{t as xt}from"./DataTableShell-DAEVsm3y.js";var St=u(`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=u(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=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`?k():n===`agent`?`${C()} - ${r}`:e}function Tt(){let e=N(p.me.getMe,{host:_t})?.role===`admin`,t=N(p.deliveryTiming.getDeliveryStatus,{}),n=r(p.deliveryTiming.startDeliveryRecord),i=r(p.deliveryTiming.stopDeliveryRecord),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:Ie()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Re()})]}),e?(0,Y.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?ke():P()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:We()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:Fe({time:ct(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?Le():He()})}),a?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=N(p.deliveryTiming.listDeliverySessions,{}),n=r(p.deliveryTiming.deleteDeliverySessions),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[d,f]=(0,J.useState)(null),{from:h,to:g}=vt(l),_=l.to===`now`?1/0:g,y=a.trim()!==``||s!==`all`||l!==X,b=()=>{o(``),c(`all`),u(X)},x=(0,J.useMemo)(()=>{if(t===void 0)return;let e=a.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(s===`all`||(s===`active`?t.active:!t.active))&&t.startedAt>=h&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,a,s,h,_]),S=e=>{let t=new Set((x??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:a,onQChange:o,searchPlaceholder:F(),timeRange:l,onTimeRangeChange:u,onReset:b,canReset:y,children:(0,Y.jsxs)(q,{value:s,onValueChange:e=>c(e),children:[(0,Y.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:`all`,children:Ve()}),(0,Y.jsx)(V,{value:`active`,children:I()}),(0,Y.jsx)(V,{value:`stopped`,children:L()})]})]})}),(0,Y.jsx)(xt,{title:Ee(),rows:x,emptyHint:m(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?w():ze(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(tt,{size:15,"aria-hidden":!0})})},{header:M(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:i(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:ue(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:j(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:D(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:I()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:L()})}],rowActions:e?e=>[{label:v(),variant:`destructive`,onSelect:()=>S([e.sessionId])}]:void 0,bulkActions:e?[{label:v(),variant:`destructive`,onSelect:e=>S(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=N(p.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(nt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ye()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,he()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Y.jsx)(rt,{size:13,"aria-hidden":!0}),t?d():oe()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:T()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:x()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:g()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(ce(),r.bridge),i(E(),r.A),i(re(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Ce()},{value:`principalType`,label:O()},{value:`direction`,label:`direction`},{value:`roleKey`,label:A()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=mt({from:`/settings/traces`}),t=ut({from:`/settings/traces`}),n=e.limit,r=e.kind,i=e.statusClass??Q,o=e.principalType??Q,u=e.direction??Q,d=e.roleKey??Q,m=e.q??``,g=st(e.from,e.to),v=(0,J.useMemo)(()=>ht(e.adv),[e.adv]),{from:x,to:C}=vt(g),[w,T]=(0,J.useState)(null),[re,E]=(0,J.useState)(null),oe=e=>void t({search:t=>({...t,limit:e})}),ce=e=>void t({search:t=>({...t,kind:e})}),ue=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),he=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ye=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...dt(e)})}),A=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),j=N(p.observability.listEvents,{limit:n}),Ce=N(p.observability.listEvents,{limit:n,kind:r===At?void 0:r,filter:{q:m||void 0,from:x,to:C,statusClass:i===Q?void 0:i,principalType:o===Q?void 0:o,direction:u===Q?void 0:u,roleKey:d===Q?void 0:d,advanced:v.length>0?v:void 0}}),Te=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),Ee=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),Oe=m!==``||i!==Q||o!==Q||u!==Q||d!==Q||v.length>0||g.kind!==`relative`||g.from!==Pt.from;function ke(){t({search:{limit:100,kind:`all`},replace:!0})}let M=w?j?.filter(e=>e.correlationId===w):Ce,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(et,{value:P,onValueChange:e=>F(e),children:[(0,Y.jsxs)($e,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(pt,{size:13,"aria-hidden":!0}),Ye()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),fe()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue(),(0,Y.jsx)(`strong`,{children:Ae()}),a(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:de()})]}),(0,Y.jsxs)(yt,{q:m,onQChange:ue,searchPlaceholder:we(),timeRange:g,onTimeRangeChange:k,onReset:ke,canReset:Oe,children:[(0,Y.jsxs)(q,{value:i,onValueChange:he,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:xe()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:Se()}),jt.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:o,onValueChange:ye,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:ee()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:Be()}),Mt.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:u,onValueChange:D,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:te()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:y()}),Nt.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:d,onValueChange:O,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{placeholder:be()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:_e()}),Ee.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:r,onValueChange:ce,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(U,{placeholder:b()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:At,children:ve()}),Te.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:String(n),onValueChange:e=>oe(Number(e)),children:[(0,Y.jsx)(K,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(U,{})}),(0,Y.jsx)(H,{children:kt.map(e=>(0,Y.jsx)(V,{value:String(e),children:c({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:v,onChange:A}),w?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>T(null),title:Xe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[pe(),(0,Y.jsx)(`code`,{children:$(w)})]}),(0,Y.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ne()})]})}):null,(0,Y.jsx)(xt,{title:S(),rows:M,emptyHint:w?_():le(),columns:[{header:ae(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ie(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Me(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":s(),children:`✓`})}},{header:Pe(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:se(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:f(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:h(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ge(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:Ke(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:l(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:me(),onClick:()=>T(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:qe(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:De()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:re,onClose:()=>E(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Rt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function zt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(ft,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(lt,{className:`max-w-lg`,children:[(0,Y.jsxs)(it,{children:[(0,Y.jsxs)(gt,{className:`oc-traces__meta-title`,children:[Je(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:Ge()})]}),(0,Y.jsx)(ot,{children:Te()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$T as i,$v as a,AT as o,Av as s,Bv as c,Cv as l,D as u,DT as d,Dv as f,E as p,ET as m,Ev as h,FT as g,Fv as _,GT as v,Gv as y,Hv as b,IT as x,Iv as S,JT as C,Jv as ee,KT as w,Kv as te,LT as T,Lv as ne,MT as re,Mv as ie,NT as E,Nv as ae,OT as oe,Ov as se,PT as ce,Pv as le,QT as ue,Qv as de,RT as fe,Rv as pe,Sv as me,TT as he,Tv as ge,Uv as _e,Vv as ve,WT as ye,Wv as be,XT as D,Xn as O,Xv as xe,YT as k,Yn as A,Yv as Se,ZT as j,Zn as Ce,Zv as we,_v as Te,aE as Ee,bv as De,cE as Oe,dE as ke,eE as M,eF as N,ey as Ae,fE as P,iE as F,jT as je,jv as Me,kT as Ne,kv as Pe,lE as Fe,mE as Ie,nE as I,oE as Le,pE as Re,qT as ze,qv as Be,rE as Ve,sE as He,tE as L,ty as Ue,uE as We,vv as Ge,wv as Ke,xv as qe,yv as Je,zT as Ye,zv as Xe}from"./dist-De2K23IB.js";import{n as Ze}from"./dist-Du1hJWyV.js";import{t as Qe}from"./x-DXaZHGzl.js";import{i as R,n as z,r as $e,t as et}from"./tabs-fDXC7itk.js";import{t as B}from"./button-Bd43O_sm.js";import{C as V,Jt as tt,M as nt,S as H,T as U,Zt as rt,_t as it,a as at,dt as W,ht as ot,i as st,it as ct,mt as lt,nn as ut,o as dt,pt as ft,qt as pt,rn as mt,rt as G,s as ht,vt as gt,w as K,wt as _t,x as q}from"./index-CNwjY680.js";import{n as vt}from"./TimeRangePicker-BYCcnF0a.js";import{t as yt}from"./FilterBar-CY1WfFDB.js";import{t as bt}from"./AdvancedFilter-C5pnO4fi.js";import{t as xt}from"./DataTableShell-COEwE2Hv.js";var St=u(`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=u(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=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`?k():n===`agent`?`${C()} - ${r}`:e}function Tt(){let e=N(p.me.getMe,{host:_t})?.role===`admin`,t=N(p.deliveryTiming.getDeliveryStatus,{}),n=r(p.deliveryTiming.startDeliveryRecord),i=r(p.deliveryTiming.stopDeliveryRecord),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=t?.recording??!1,u=async()=>{c(!0);try{l?await i({}):await n({})}finally{c(!1)}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:Ie()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Re()})]}),e?(0,Y.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void u(),children:l?ke():P()}):null]}),l?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(W,{variant:`secondary`,children:We()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:Fe({time:ct(t.startedAt)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?Le():He()})}),a?(0,Y.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=N(p.deliveryTiming.listDeliverySessions,{}),n=r(p.deliveryTiming.deleteDeliverySessions),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[d,f]=(0,J.useState)(null),{from:h,to:g}=vt(l),_=l.to===`now`?1/0:g,y=a.trim()!==``||s!==`all`||l!==X,b=()=>{o(``),c(`all`),u(X)},x=(0,J.useMemo)(()=>{if(t===void 0)return;let e=a.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(s===`all`||(s===`active`?t.active:!t.active))&&t.startedAt>=h&&t.startedAt<=_).map(e=>({...e,_id:e.sessionId}))},[t,a,s,h,_]),S=e=>{let t=new Set((x??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(yt,{q:a,onQChange:o,searchPlaceholder:F(),timeRange:l,onTimeRangeChange:u,onReset:b,canReset:y,children:(0,Y.jsxs)(q,{value:s,onValueChange:e=>c(e),children:[(0,Y.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:`all`,children:Ve()}),(0,Y.jsx)(V,{value:`active`,children:I()}),(0,Y.jsx)(V,{value:`stopped`,children:L()})]})]})}),(0,Y.jsx)(xt,{title:Ee(),rows:x,emptyHint:m(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?w():ze(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,Y.jsx)(St,{size:15,"aria-hidden":!0}):(0,Y.jsx)(tt,{size:15,"aria-hidden":!0})})},{header:M(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:i(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:ue(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:j(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:D(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(W,{variant:`secondary`,children:I()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:L()})}],rowActions:e?e=>[{label:v(),variant:`destructive`,onSelect:()=>S([e.sessionId])}]:void 0,bulkActions:e?[{label:v(),variant:`destructive`,onSelect:e=>S(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,Y.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=N(p.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(nt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ye()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,he()]}),(0,Y.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Ze,{size:13,"aria-hidden":!0}):(0,Y.jsx)(rt,{size:13,"aria-hidden":!0}),t?d():oe()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:T()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:x()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:g()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(ce(),r.bridge),i(E(),r.A),i(re(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:je()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]})}var kt=[50,100,200,500],At=`all`,Q=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Ce()},{value:`principalType`,label:O()},{value:`direction`,label:`direction`},{value:`roleKey`,label:A()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=mt({from:`/settings/traces`}),t=ut({from:`/settings/traces`}),n=e.limit,r=e.kind,i=e.statusClass??Q,o=e.principalType??Q,u=e.direction??Q,d=e.roleKey??Q,m=e.q??``,g=st(e.from,e.to),v=(0,J.useMemo)(()=>ht(e.adv),[e.adv]),{from:x,to:C}=vt(g),[w,T]=(0,J.useState)(null),[re,E]=(0,J.useState)(null),oe=e=>void t({search:t=>({...t,limit:e})}),ce=e=>void t({search:t=>({...t,kind:e})}),ue=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),he=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ye=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),D=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,...dt(e)})}),A=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),j=N(p.observability.listEvents,{limit:n}),Ce=N(p.observability.listEvents,{limit:n,kind:r===At?void 0:r,filter:{q:m||void 0,from:x,to:C,statusClass:i===Q?void 0:i,principalType:o===Q?void 0:o,direction:u===Q?void 0:u,roleKey:d===Q?void 0:d,advanced:v.length>0?v:void 0}}),Te=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),Ee=(0,J.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),Oe=m!==``||i!==Q||o!==Q||u!==Q||d!==Q||v.length>0||g.kind!==`relative`||g.from!==Pt.from;function ke(){t({search:{limit:100,kind:`all`},replace:!0})}let M=w?j?.filter(e=>e.correlationId===w):Ce,P=e.section,F=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,Y.jsxs)(et,{value:P,onValueChange:e=>F(e),children:[(0,Y.jsxs)($e,{className:`w-full`,children:[(0,Y.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(pt,{size:13,"aria-hidden":!0}),Ye()]}),(0,Y.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(Ct,{size:13,"aria-hidden":!0}),fe()]})]}),(0,Y.jsx)(z,{value:`latency`,children:(0,Y.jsx)(Tt,{})}),(0,Y.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue(),(0,Y.jsx)(`strong`,{children:Ae()}),a(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:de()})]}),(0,Y.jsxs)(yt,{q:m,onQChange:ue,searchPlaceholder:we(),timeRange:g,onTimeRangeChange:k,onReset:ke,canReset:Oe,children:[(0,Y.jsxs)(q,{value:i,onValueChange:he,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:xe()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:Se()}),jt.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:o,onValueChange:ye,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:ee()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:Be()}),Mt.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:u,onValueChange:D,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:te()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:y()}),Nt.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:d,onValueChange:O,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{placeholder:be()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:Q,children:_e()}),Ee.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:r,onValueChange:ce,children:[(0,Y.jsx)(K,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(U,{placeholder:b()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(V,{value:At,children:ve()}),Te.map(e=>(0,Y.jsx)(V,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:String(n),onValueChange:e=>oe(Number(e)),children:[(0,Y.jsx)(K,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(U,{})}),(0,Y.jsx)(H,{children:kt.map(e=>(0,Y.jsx)(V,{value:String(e),children:c({count:e})},e))})]})]}),(0,Y.jsx)(bt,{fields:Ft,seed:v,onChange:A}),w?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>T(null),title:Xe(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[pe(),(0,Y.jsx)(`code`,{children:$(w)})]}),(0,Y.jsx)(Qe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ne()})]})}):null,(0,Y.jsx)(xt,{title:S(),rows:M,emptyHint:w?_():le(),columns:[{header:ae(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:ie(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Me(),sort:e=>Rt(e)??null,cell:e=>{let t=Rt(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":s(),children:`✓`})}},{header:Pe(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(W,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:se(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:f(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:h(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ge(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:Ke(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:l(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:me(),onClick:()=>T(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:qe(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>E(e),children:De()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(zt,{row:re,onClose:()=>E(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Rt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function zt({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(ft,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(lt,{className:`max-w-lg`,children:[(0,Y.jsxs)(it,{children:[(0,Y.jsxs)(gt,{className:`oc-traces__meta-title`,children:[Je(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(W,{variant:`outline`,children:Ge()})]}),(0,Y.jsx)(ot,{children:Te()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|