@lacneu/atrium 0.19.0 → 0.19.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.
Files changed (49) hide show
  1. package/dist/assets/{AccessTab-SACgMGAi.js → AccessTab-IcphauIj.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-D7QXVQ5_.js → AdvancedFilter-DJjN0ZKH.js} +1 -1
  3. package/dist/assets/{AgentFilesTab-DcWaUTsA.js → AgentFilesTab-BI5XcES3.js} +1 -1
  4. package/dist/assets/{AnomaliesTab-B856xOQY.js → AnomaliesTab-Q2U1eiwk.js} +1 -1
  5. package/dist/assets/{AuditTab-B0xwh9EC.js → AuditTab-CoWGV21G.js} +1 -1
  6. package/dist/assets/{BridgeTab-KP5PlAMx.js → BridgeTab-B5Mc-mW3.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-1p-luBRT.js → ChatDefaultsTab-Dk0xhrjV.js} +1 -1
  8. package/dist/assets/{DataTableShell-C1ZKbpq3.js → DataTableShell-CyKGlXVg.js} +1 -1
  9. package/dist/assets/{DetailChips-Dg4YEpwe.js → DetailChips-Ct8LcwC-.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-Bg62mK4W.js → FeedbacksTab-DBmQnYcU.js} +1 -1
  11. package/dist/assets/{FieldLabel-X2EAqICh.js → FieldLabel-CgUTCK6q.js} +1 -1
  12. package/dist/assets/{FilesTab-BiW2j80D.js → FilesTab-Cce1_C32.js} +1 -1
  13. package/dist/assets/{FilterBar-CSA8xMkl.js → FilterBar-Dc-vzhP8.js} +1 -1
  14. package/dist/assets/{GroupsTab-CevcyqNU.js → GroupsTab-BZKmekSM.js} +1 -1
  15. package/dist/assets/{InstancesTab-CK-3Nvfy.js → InstancesTab-BhMe2xiQ.js} +1 -1
  16. package/dist/assets/{IntegrationsTab-Cf2NA4f0.js → IntegrationsTab-BMkQEaMo.js} +1 -1
  17. package/dist/assets/{KpiTab-BHkpsXb_.js → KpiTab-nVTkmGQL.js} +1 -1
  18. package/dist/assets/{PreferencesTab-DBxEQcoG.js → PreferencesTab-D3bpsq0u.js} +1 -1
  19. package/dist/assets/{PromptInjectionsTab-ILsAUU_D.js → PromptInjectionsTab-Di6T_ef2.js} +1 -1
  20. package/dist/assets/{RolesTab-cg8r2k6J.js → RolesTab-B9-Z0CrC.js} +1 -1
  21. package/dist/assets/{ServiceAccountsTab-DV9xE6V0.js → ServiceAccountsTab-B1jaHHEp.js} +1 -1
  22. package/dist/assets/{SubAgentReportsTab-Cre8FArV.js → SubAgentReportsTab-BuVbJkcE.js} +1 -1
  23. package/dist/assets/{ThemeShowroom-DxfyV3nj.js → ThemeShowroom-DvjqYChJ.js} +1 -1
  24. package/dist/assets/{TimeRangePicker-CY6cFX3v.js → TimeRangePicker-BAldDUhc.js} +1 -1
  25. package/dist/assets/{TracesTab-C5hnZP3-.js → TracesTab-tLa9PtsX.js} +1 -1
  26. package/dist/assets/{UsersTab-DDINHhFG.js → UsersTab-BtWlWFwx.js} +1 -1
  27. package/dist/assets/{button-DXGXeanX.js → button-C3LWIgGJ.js} +1 -1
  28. package/dist/assets/{card-B60DsQBe.js → card-DXTJ7L6C.js} +1 -1
  29. package/dist/assets/chevrons-up-down-B6ce3M7f.js +1 -0
  30. package/dist/assets/{compatView-BKe3swOt.js → compatView-MdW0ASNn.js} +1 -1
  31. package/dist/assets/{dispatchErrorInfo-DekuLV6o.js → dispatchErrorInfo-COvKpdTE.js} +1 -1
  32. package/dist/assets/{dist-By-c_NRB.js → dist-B8y7NGFk.js} +1 -1
  33. package/dist/assets/dist-BPcfIXgJ.js +44 -0
  34. package/dist/assets/{dist-CWfWFr7t.js → dist-BtzdT2wL.js} +1 -1
  35. package/dist/assets/{dist-AH7-HhdT.js → dist-D9C9G3zQ.js} +1 -1
  36. package/dist/assets/{highlighted-body-OFNGDK62-CVA3g0hA.js → highlighted-body-OFNGDK62-BrgfLBa3.js} +1 -1
  37. package/dist/assets/{index-CKlFEsq3.js → index-B--TQi5b.js} +6 -6
  38. package/dist/assets/mermaid-GHXKKRXX-DIkajMJk.js +1 -0
  39. package/dist/assets/roleDescriptions-DmHFjDvY.js +1 -0
  40. package/dist/assets/{table-AFxsandT.js → table-CjpKnop2.js} +1 -1
  41. package/dist/assets/{tabs-9X-5Pgx3.js → tabs-C1F_imzX.js} +1 -1
  42. package/dist/assets/x-BY_tjn83.js +1 -0
  43. package/dist/index.html +7 -7
  44. package/package.json +1 -1
  45. package/dist/assets/chevrons-up-down-CeISPPN2.js +0 -1
  46. package/dist/assets/dist-BzNYkP4V.js +0 -44
  47. package/dist/assets/mermaid-GHXKKRXX-BKbfiXDa.js +0 -1
  48. package/dist/assets/roleDescriptions-BN-dndvd.js +0 -1
  49. package/dist/assets/x-DQ_CLIEK.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CD as r,Cl as i,Hy as a,Ny as o,Py as s,Sl as c,Uy as l,Vy as u,Wy as d,_l as f,bl as p,dl as m,fl as h,gD as g,gl as _,hb as v,hl as y,ml as b,pl as x,vl as S,wl as C,xl as w,yl as ee}from"./dist-BzNYkP4V.js";import{Mt as te,a as ne,jt as re,n as T,ot as E,r as D}from"./index-CKlFEsq3.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-B60DsQBe.js";import{n as N,t as P}from"./TimeRangePicker-CY6cFX3v.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=r(g.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=r(g.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:v()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:d()}),(0,I.jsx)(j,{children:a()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),u=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:[o(),` p50 `,R(u.cP50),` `,l()]}),(0,I.jsxs)(`span`,{children:[s(),` p50 `,R(u.aP50),` `,l()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":d(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:i(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:w(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:p(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:ee(),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=te({from:`/settings/kpi`}),t=re({from:`/settings/kpi`}),n=D(e.from,e.to,T,`now`),i=e=>void t({search:t=>({...t,...ne(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=K(a,o),l=r(g.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){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>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),d=(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:f()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}):(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.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:u.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:b({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:x()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h({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":m({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
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CD as r,Cl as i,Hy as a,Ny as o,Py as s,Sl as c,Uy as l,Vy as u,Wy as d,_l as f,bl as p,dl as m,fl as h,gD as g,gl as _,hb as v,hl as y,ml as b,pl as x,vl as S,wl as C,xl as w,yl as ee}from"./dist-BPcfIXgJ.js";import{Mt as te,a as ne,jt as re,n as T,ot as E,r as D}from"./index-B--TQi5b.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-DXTJ7L6C.js";import{n as N,t as P}from"./TimeRangePicker-BAldDUhc.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=r(g.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=r(g.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:v()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:d()}),(0,I.jsx)(j,{children:a()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):(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,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),u=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:[o(),` p50 `,R(u.cP50),` `,l()]}),(0,I.jsxs)(`span`,{children:[s(),` p50 `,R(u.aP50),` `,l()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":d(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:i(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:c(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:w(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:p(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:ee(),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=te({from:`/settings/kpi`}),t=re({from:`/settings/kpi`}),n=D(e.from,e.to,T,`now`),i=e=>void t({search:t=>({...t,...ne(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=K(a,o),l=r(g.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){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>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),d=(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:f()})]}),(0,I.jsx)(J,{value:n,onChange:i})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}):(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.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:u.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:b({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:x()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h({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":m({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{$C as r,AE as i,BC as a,CD as o,CE as s,DE as c,EE as l,FE as ee,GC as u,HC as d,IC as f,JC as p,KC as m,LC as h,ME as te,NE as ne,OE as g,PE as re,QC as ie,RC as ae,RE as oe,SD as _,TE as se,UC as v,UE as ce,VC as le,WC as ue,XC as y,YC as de,ZC as fe,aw as b,cw as x,dw as S,ew as C,fw as w,gD as T,hw as E,iw as D,jE as O,kE as k,lw as A,mw as j,nw as M,ow as N,pw as P,qC as F,rw as I,sw as L,tw as R,uw as z,wE as B,xg as V,zC as pe}from"./dist-BzNYkP4V.js";import{t as H}from"./button-DXGXeanX.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-CKlFEsq3.js";var q=t(e(),1),J=[{id:`messages`,label:()=>E()},{id:`composer`,label:()=>j()},{id:`sidebar`,label:()=>P()},{id:`other`,label:()=>w()}],Y={showSource:{category:`messages`,label:()=>S(),help:()=>z()},showReport:{category:`messages`,label:()=>A(),help:()=>x()},copyAssistant:{category:`messages`,label:()=>L()},copyUser:{category:`messages`,label:()=>N()},showDelete:{category:`messages`,label:()=>b()},showTools:{category:`messages`,label:()=>D(),help:()=>I()},voiceInput:{category:`composer`,label:()=>M(),help:()=>R()},showChatAge:{category:`sidebar`,label:()=>C(),help:()=>r()},showChatProvider:{category:`sidebar`,label:()=>ie(),help:()=>fe()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.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`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>a()};function De({prefKey:e,ui:t}){let n=_(T.admin.setUiPrefDefault),r=_(T.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ue()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:ae()}),(0,$.jsx)(K,{value:`off`,children:h()}),(0,$.jsx)(K,{value:`inherit`,children:f()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":v()}),v()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=o(T.me.getMe,{host:G}),a=i?.ui,s=Z(i?.role)&&n,c=_(T.me.setUiPref).withOptimisticUpdate(ge),l=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":u()}),u()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:d()}),(0,$.jsx)(`p`,{children:le()}),(0,$.jsx)(`p`,{children:pe()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:y(),"aria-label":y(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:de()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:p()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:F()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:m()}):null,(0,$.jsx)(W,{checked:o,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ce()})}function ke(){let e=o(T.me.getMe,{host:G}),t=_(T.me.setLocale),n=_(T.me.setMyName),r=me(),a=e?.locale??`default`,u=e?.name??``,[d,f]=(0,q.useState)(null),p=d??u,m=p.trim()!==u.trim();async function h(){try{await n({name:p}),f(null),r.success(O())}catch(e){r.error(i(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{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,$.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void h(),children:V()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:k()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?B():e===`en`?s():oe()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AE as i,BC as a,CD as o,CE as s,DE as c,EE as l,FE as ee,GC as u,HC as d,IC as f,JC as p,KC as m,LC as h,ME as te,NE as ne,OE as g,PE as re,QC as ie,RC as ae,RE as oe,SD as _,TE as se,UC as v,UE as ce,VC as le,WC as ue,XC as y,YC as de,ZC as fe,aw as b,cw as x,dw as S,ew as C,fw as w,gD as T,hw as E,iw as D,jE as O,kE as k,lw as A,mw as j,nw as M,ow as N,pw as P,qC as F,rw as I,sw as L,tw as R,uw as z,wE as B,xg as V,zC as pe}from"./dist-BPcfIXgJ.js";import{t as H}from"./button-C3LWIgGJ.js";import{A as me,C as he,O as ge,S as _e,Z as U,_ as W,b as ve,ot as G,x as K,y as ye}from"./index-B--TQi5b.js";var q=t(e(),1),J=[{id:`messages`,label:()=>E()},{id:`composer`,label:()=>j()},{id:`sidebar`,label:()=>P()},{id:`other`,label:()=>w()}],Y={showSource:{category:`messages`,label:()=>S(),help:()=>z()},showReport:{category:`messages`,label:()=>A(),help:()=>x()},copyAssistant:{category:`messages`,label:()=>L()},copyUser:{category:`messages`,label:()=>N()},showDelete:{category:`messages`,label:()=>b()},showTools:{category:`messages`,label:()=>D(),help:()=>I()},voiceInput:{category:`composer`,label:()=>M(),help:()=>R()},showChatAge:{category:`sidebar`,label:()=>C(),help:()=>r()},showChatProvider:{category:`sidebar`,label:()=>ie(),help:()=>fe()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function be(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.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`,`showChatProvider`],Se={voiceInput:`voiceInput`};function Ce(e){return xe.includes(e)}function Z(e){return e===`admin`}function we(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Q(e){return e===`on`?!0:e===`off`?!1:null}function Te(e){return Ce(e)?Se[e]:void 0}var $=n(),Ee={voiceInput:()=>a()};function De({prefKey:e,ui:t}){let n=_(T.admin.setUiPrefDefault),r=_(T.admin.setFeatureEnabled),i=Te(e),a=i?Ee[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ue()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(_e,{size:`sm`,className:`w-36`,children:(0,$.jsx)(he,{})}),(0,$.jsxs)(ve,{children:[(0,$.jsx)(K,{value:`on`,children:ae()}),(0,$.jsx)(K,{value:`off`,children:h()}),(0,$.jsx)(K,{value:`inherit`,children:f()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":v()}),v()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=o(T.me.getMe,{host:G}),a=i?.ui,s=Z(i?.role)&&n,c=_(T.me.setUiPref).withOptimisticUpdate(ge),l=(0,q.useMemo)(()=>a?be(Object.keys(a.effective),e):[],[a,e]);return a?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":u()}),u()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:d()}),(0,$.jsx)(`p`,{children:le()}),(0,$.jsx)(`p`,{children:pe()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:y(),"aria-label":y(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:de()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-prefs__group`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],o=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${l&&!i?` is-overridden`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(`span`,{className:`oc-prefs__lock`,children:p()}):l?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:F()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:m()}):null,(0,$.jsx)(W,{checked:o,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:a}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ce()})}function ke(){let e=o(T.me.getMe,{host:G}),t=_(T.me.setLocale),n=_(T.me.setMyName),r=me(),a=e?.locale??`default`,u=e?.name??``,[d,f]=(0,q.useState)(null),p=d??u,m=p.trim()!==u.trim();async function h(){try{await n({name:p}),f(null),r.success(O())}catch(e){r.error(i(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{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,$.jsx)(H,{size:`sm`,disabled:!m,onClick:()=>void h(),children:V()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:k()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:a===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?B():e===`en`?s():oe()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -1,2 +1,2 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Bu as i,CD as a,Fu as o,Gu as s,Hu as c,Iu as l,Ku as u,Lu as d,Mu as f,Nu as p,Ou as m,Pu as h,Ru as g,SD as _,Uu as v,Vu as y,Wu as b,ed as x,gD as S,ju as C,ku as w,qu as T,td as E,zu as D}from"./dist-BzNYkP4V.js";import{d as O,f as k,i as A,l as j,n as M,r as N,t as P,u as F}from"./FieldLabel-X2EAqICh.js";import{t as I}from"./button-DXGXeanX.js";import{A as L,C as R,S as z,_ as B,b as V,x as H,y as U}from"./index-CKlFEsq3.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:c,help:y},documentary_fetch:{label:i,help:D},inbound_files:{label:g,help:d}},q={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Bu as i,CD as a,Fu as o,Gu as s,Hu as c,Iu as l,Ku as u,Lu as d,Mu as f,Nu as p,Ou as m,Pu as h,Ru as g,SD as _,Uu as v,Vu as y,Wu as b,ed as x,gD as S,ju as C,ku as w,qu as T,td as E,zu as D}from"./dist-BPcfIXgJ.js";import{d as O,f as k,i as A,l as j,n as M,r as N,t as P,u as F}from"./FieldLabel-CgUTCK6q.js";import{t as I}from"./button-C3LWIgGJ.js";import{A as L,C as R,S as z,_ as B,b as V,x as H,y as U}from"./index-B--TQi5b.js";/* empty css */var W=t(e(),1),G=n(),K={media_delivery:{label:c,help:y},documentary_fetch:{label:i,help:D},inbound_files:{label:g,help:d}},q={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)`},J={outboundDir:r,references:w,files:m};function Y(){let e=a(S.admin.listInstances,{}),[t,n]=(0,W.useState)(null);if(e===void 0)return(0,G.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,G.jsx)(`div`,{className:`oc-injtab`,children:(0,G.jsx)(`p`,{className:`oc-admin__hint`,children:o()})});let r=e.find(e=>e._id===t)??e[0];return(0,G.jsxs)(`div`,{className:`oc-injtab`,children:[(0,G.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,G.jsx)(M,{label:T(),help:u()}),(0,G.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,G.jsx)(`span`,{children:l()}),(0,G.jsxs)(U,{value:r._id,onValueChange:e=>n(e),children:[(0,G.jsx)(z,{size:`sm`,className:`min-w-44`,children:(0,G.jsx)(R,{})}),(0,G.jsx)(V,{children:e.map(e=>(0,G.jsx)(H,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,G.jsx)(X,{instance:r},r._id)]})}function X({instance:e}){let t=_(S.admin.upsertInstanceConfig),n=L(),r=e.config??{},[i,a]=(0,W.useState)(()=>A(r)),[o,s]=(0,W.useState)(!1),c=i.promptInjections,l=(e,t)=>a({...i,promptInjections:{...c,[e]:{...c[e],...t}}});async function u(){s(!0);try{await t({instanceId:e._id,config:N(i,r)})}catch(e){n.error(x(),e)}finally{s(!1)}}return(0,G.jsxs)(`div`,{className:`oc-injtab__body`,children:[F.map(e=>(0,G.jsx)(Z,{injKey:e,def:j[e],i18n:K[e],row:c[e]??{enabled:!0,template:j[e].defaultTemplate},onChange:t=>l(e,t)},e)),(0,G.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,G.jsx)(I,{size:`sm`,onClick:()=>void u(),disabled:o,children:E()})})]})}function Z({injKey:e,def:t,i18n:n,row:r,onChange:i}){let[a,o]=(0,W.useState)(!1),c=r.template.trim()!==t.defaultTemplate,l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,q[e]??`{${e}}`])),d=O(e,r),m=d?k(d,u):``;return(0,G.jsxs)(`section`,{className:`oc-injcard`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,G.jsxs)(`label`,{className:`oc-field--row`,children:[(0,G.jsx)(B,{checked:r.enabled,onCheckedChange:e=>i({enabled:e===!0})}),(0,G.jsx)(M,{label:n.label(),help:n.help()})]}):(0,G.jsx)(M,{label:n.label(),help:n.help()}),c&&(0,G.jsx)(`span`,{className:`oc-injection__badge`,children:b()})]}),(0,G.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>i({template:e.target.value})}),(0,G.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,G.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:v()}),t.placeholders.map(e=>(0,G.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,G.jsx)(`code`,{children:`{${e}}`}),(0,G.jsx)(P,{text:(J[e]??(()=>e))()})]},e))]}),(0,G.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>o(e=>!e),children:a?p():h()}),c&&(0,G.jsx)(I,{variant:`ghost`,size:`sm`,onClick:()=>i({template:t.defaultTemplate}),children:s()})]})]}),a&&(0,G.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:f()})]}):(0,G.jsx)(`span`,{className:`oc-injection__ph`,children:C()})})]})}export{Y as PromptInjectionsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,CD as ee,Cm as te,Dm as a,Em as o,Fm as s,Im as c,Lm as l,Mm as u,Nm as d,Om as f,Pm as p,Qp as m,Rm as h,SD as g,Sm as _,Tm as v,Xp as y,Zp as b,_m as x,bm as S,dm as ne,em as re,fm as ie,gD as C,gm as ae,hm as w,im as T,jm as E,km as D,mm as O,nm as k,pm as A,rm as j,tm as M,um as N,vm as P,wm as F,xm as I,ym as L,zm as R}from"./dist-BzNYkP4V.js";import{t as z}from"./button-DXGXeanX.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-CKlFEsq3.js";import{t as q}from"./roleDescriptions-BN-dndvd.js";var J=t(e(),1),Y=n(),X=[{group:()=>R(),keys:[{key:`traces.read`,label:()=>p()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>u()}]},{group:()=>h(),keys:[{key:`kpi.read`,label:()=>p()},{key:`kpi.write`,label:()=>u()}]},{group:()=>l(),keys:[{key:`openclaw.query`,label:()=>E()},{key:`anomalies.read`,label:()=>i()},{key:`anomalies.report`,label:()=>D()}]},{group:()=>c(),keys:[{key:`chats.read`,label:()=>p()},{key:`selfheal`,label:()=>a()}]},{group:()=>s(),keys:[{key:`admin.manage`,label:()=>f()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ee(C.apiKeys.listRoles,{}),t=g(C.apiKeys.createRole),n=g(C.apiKeys.ensureRolesSeeded),i=g(C.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(C.apiKeys.listRoles,{});r&&e.setQuery(C.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),s=B(),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Q),[f,p]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{s.error(v(),e)})},[n,s]);let h=e??[];async function E(e,t){if(Z(e.permissions)||f.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:F({name:e.name}),description:te(),confirmLabel:_()}))){p(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(I(),e)}finally{p(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function D(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),d(Q),l(!1)}catch(e){s.error(S(),e)}}let R=e===void 0,$=!R&&h.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[L(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,P(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,x()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:ae()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{d(Q),l(!0)},children:w()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ie()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?o({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:h.map(e=>{let t=Z(e.permissions),n=f.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,ne()]}):(0,Y.jsx)(V,{variant:`secondary`,children:N()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?T():n?j():r,onCheckedChange:()=>void E(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:c,onOpenChange:l,title:k(),description:M(),canSubmit:!!(u.key&&u.name),onSubmit:D,submitLabel:re(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,Y.jsx)(H,{value:u.key,placeholder:m(),onChange:e=>d({...u,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,Y.jsx)(H,{value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,Y.jsx)(H,{value:u.description,onChange:e=>d({...u,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,Am as i,CD as ee,Cm as te,Dm as a,Em as o,Fm as s,Im as c,Lm as l,Mm as u,Nm as d,Om as f,Pm as p,Qp as m,Rm as h,SD as g,Sm as _,Tm as v,Xp as y,Zp as b,_m as x,bm as S,dm as ne,em as re,fm as ie,gD as C,gm as ae,hm as w,im as T,jm as E,km as D,mm as O,nm as k,pm as A,rm as j,tm as M,um as N,vm as P,wm as F,xm as I,ym as L,zm as R}from"./dist-BPcfIXgJ.js";import{t as z}from"./button-C3LWIgGJ.js";import{A as B,X as V,Z as H,_ as U,j as W,m as G,xt as K}from"./index-B--TQi5b.js";import{t as q}from"./roleDescriptions-DmHFjDvY.js";var J=t(e(),1),Y=n(),X=[{group:()=>R(),keys:[{key:`traces.read`,label:()=>p()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>u()}]},{group:()=>h(),keys:[{key:`kpi.read`,label:()=>p()},{key:`kpi.write`,label:()=>u()}]},{group:()=>l(),keys:[{key:`openclaw.query`,label:()=>E()},{key:`anomalies.read`,label:()=>i()},{key:`anomalies.report`,label:()=>D()}]},{group:()=>c(),keys:[{key:`chats.read`,label:()=>p()},{key:`selfheal`,label:()=>a()}]},{group:()=>s(),keys:[{key:`admin.manage`,label:()=>f()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=ee(C.apiKeys.listRoles,{}),t=g(C.apiKeys.createRole),n=g(C.apiKeys.ensureRolesSeeded),i=g(C.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(C.apiKeys.listRoles,{});r&&e.setQuery(C.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),s=B(),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Q),[f,p]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{s.error(v(),e)})},[n,s]);let h=e??[];async function E(e,t){if(Z(e.permissions)||f.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:F({name:e.name}),description:te(),confirmLabel:_()}))){p(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(I(),e)}finally{p(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function D(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),d(Q),l(!1)}catch(e){s.error(S(),e)}}let R=e===void 0,$=!R&&h.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[L(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,P(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,x()]}),(0,Y.jsxs)(`div`,{className:`oc-dt`,children:[(0,Y.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,Y.jsx)(`h2`,{className:`oc-dt__title`,children:ae()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{d(Q),l(!0)},children:w()})})]}),R?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(0,Y.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,Y.jsxs)(`table`,{className:`oc-matrix`,children:[(0,Y.jsxs)(`thead`,{children:[(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ie()}),X.map(e=>(0,Y.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,Y.jsx)(`tr`,{children:X.flatMap(e=>e.keys.map(e=>(0,Y.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?o({key:e.key}):e.key,children:[e.label(),e.phi?(0,Y.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,Y.jsx)(`tbody`,{children:h.map(e=>{let t=Z(e.permissions),n=f.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,ne()]}):(0,Y.jsx)(V,{variant:`secondary`,children:N()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(r=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(U,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?T():n?j():r,onCheckedChange:()=>void E(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(G,{open:c,onOpenChange:l,title:k(),description:M(),canSubmit:!!(u.key&&u.name),onSubmit:D,submitLabel:re(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,Y.jsx)(H,{value:u.key,placeholder:m(),onChange:e=>d({...u,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,Y.jsx)(H,{value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,Y.jsx)(H,{value:u.description,onChange:e=>d({...u,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AC as i,AS as a,BS as ee,CC as te,CD as o,CS as s,DC as ne,DS as c,EC as re,ES as l,FC as ie,FS as u,GS as ae,HS as oe,IS as d,JS as se,KS as ce,LS as f,MC as le,MS as p,NC as ue,NS as de,OC as fe,OS as pe,PC as me,PS as he,QS as ge,RS as m,SC as _e,SD as h,SS as g,TC as ve,TS as _,US as ye,VS as be,WS as xe,XS as Se,YS as Ce,ZS as we,_C as Te,_S as v,aC as Ee,bC as De,bD as Oe,bS as y,cC as ke,dC as Ae,eC as je,fC as Me,gC as Ne,gD as b,gS as x,hC as Pe,hS as S,iC as Fe,jC as Ie,jS as C,kC as w,kS as T,lC as Le,mC as Re,nC as ze,oC as Be,pC as Ve,qS as He,rC as Ue,sC as We,tC as Ge,uC as Ke,vC as qe,vS as E,wC as Je,wS as D,xC as Ye,xS as O,yC as Xe,yS as k,zS as Ze}from"./dist-BzNYkP4V.js";import{n as A}from"./dist-CWfWFr7t.js";import{i as Qe}from"./dist-AH7-HhdT.js";import{t as j}from"./button-DXGXeanX.js";import{$ as M,A as $e,At as et,C as N,Dt as P,Mt as tt,Q as F,S as I,X as L,Z as R,b as z,et as B,j as nt,jt as rt,m as it,nt as V,rt as H,tt as at,x as U,y as W}from"./index-CKlFEsq3.js";import{t as ot}from"./FilterBar-CSA8xMkl.js";import{t as st}from"./DataTableShell-C1ZKbpq3.js";import{t as ct}from"./roleDescriptions-BN-dndvd.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>O(),days:null},{value:`30`,label:()=>y(),days:30},{value:`90`,label:()=>k(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=tt({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??J,[s,c]=(0,G.useState)(J),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),d=o(b.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:s===J?void 0:s,disabled:a===J?void 0:a===`disabled`}}),f=o(b.apiKeys.listKeys,{}),p=o(b.apiKeys.listRoles,{}),de=h(b.apiKeys.createServiceAccount),pe=h(b.apiKeys.updateServiceAccount),he=h(b.apiKeys.deleteServiceAccount),m=Oe(b.apiKeys.mintApiKey),g=h(b.apiKeys.revokeApiKey),_=nt(),v=$e(),y=n!==``||s!==J||a!==J;function x(){c(J),t({search:{},replace:!0})}let[S,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,A]=(0,G.useState)(new Set),[M,P]=(0,G.useState)(null),F=(0,G.useRef)(!1),[B,V]=(0,G.useState)(new Set),[H,at]=(0,G.useState)({}),[lt,X]=(0,G.useState)(null),Z=(0,G.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){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await pe({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(r())):await de({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),O(null),C(!1)}catch(e){v.error(D?je():Ge(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function $(e){if(F.current)return;F.current=!0;let t=H[e._id]??`never`,n=q.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;P(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(ge(),e)}finally{F.current=!1,P(null)}}async function mt(e){if(await _({title:we(),description:(0,K.jsxs)(K.Fragment,{children:[Se(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ce(),` `,(0,K.jsx)(`strong`,{children:se()}),` `,He()]}),confirmWord:e.name,confirmLabel:ce(),destructive:!0}))try{await he({serviceAccountId:e._id}),v.success(ae(),e.name)}catch(e){v.error(xe(),e)}}async function ht(e){if(await _({title:ye(),description:(0,K.jsxs)(K.Fragment,{children:[oe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,be()]}),confirmLabel:ee(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(Ze(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,K.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:me(),onReset:x,canReset:y,children:[(0,K.jsxs)(W,{value:s,onValueChange:c,children:[(0,K.jsx)(I,{size:`sm`,className:`w-40`,children:(0,K.jsx)(N,{placeholder:ue()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(U,{value:J,children:le()}),(p??[]).map(e=>(0,K.jsx)(U,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(W,{value:a,onValueChange:u,children:[(0,K.jsx)(I,{size:`sm`,className:`w-36`,children:(0,K.jsx)(N,{})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(U,{value:J,children:Ie()}),(0,K.jsx)(U,{value:`active`,children:i()}),(0,K.jsx)(U,{value:`disabled`,children:w()})]})]})]}),(0,K.jsx)(st,{title:fe(),rows:d,addLabel:ne(),onAdd:()=>{E(Y),O(null),C(!0)},emptyHint:re(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:_e(),onSelect:()=>pt(e)},{label:ve(),onSelect:()=>void $(e)},{label:k.has(e._id)?Je():te(),onSelect:()=>Q(e._id)},{label:Ye(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?De():Xe(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)(Qe,{}):(0,K.jsx)(et,{})})},{header:qe(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Te(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:Ne(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(L,{variant:`destructive`,children:w()}):(0,K.jsx)(L,{variant:`outline`,children:i()})},{header:Pe(),cell:e=>(0,K.jsxs)(W,{value:H[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(I,{size:`sm`,className:`w-32`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(z,{children:q.map(e=>(0,K.jsx)(U,{value:e.value,children:e.label()},e.value))})]})},{header:Re(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Ve():Me({count:t})})}}]}),(0,K.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?Ae():ke(),description:D?Ke():We(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Le():Be(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,K.jsx)(R,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Fe()}),(0,K.jsxs)(W,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,K.jsx)(I,{className:`w-full`,children:(0,K.jsx)(N,{placeholder:Ue()})}),(0,K.jsx)(z,{children:(p??[]).map(e=>(0,K.jsxs)(U,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:ze()}),(0,K.jsx)(R,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[m(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:d()}),(0,K.jsx)(`th`,{children:u()}),(0,K.jsx)(`th`,{children:he()}),(0,K.jsx)(`th`,{children:de()}),(0,K.jsx)(`th`,{children:p()}),(0,K.jsx)(`th`,{children:C()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?a():T()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(F,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)(M,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(V,{children:[(0,K.jsx)(H,{children:pe()}),(0,K.jsx)(B,{children:c({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:l()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,K.jsx)(A,{}):(0,K.jsx)(P,{}),n?D():s()]})]}),(0,K.jsx)(at,{children:(0,K.jsx)(j,{onClick:()=>{r(!1),t()},children:g()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?E():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(L,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(L,{variant:`outline`,children:x()}):(0,K.jsx)(L,{variant:`outline`,children:S()})}export{X as ServiceAccountsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AC as i,AS as a,BS as ee,CC as te,CD as o,CS as s,DC as ne,DS as c,EC as re,ES as l,FC as ie,FS as u,GS as ae,HS as oe,IS as d,JS as se,KS as ce,LS as f,MC as le,MS as p,NC as ue,NS as de,OC as fe,OS as pe,PC as me,PS as he,QS as ge,RS as m,SC as _e,SD as h,SS as g,TC as ve,TS as _,US as ye,VS as be,WS as xe,XS as Se,YS as Ce,ZS as we,_C as Te,_S as v,aC as Ee,bC as De,bD as Oe,bS as y,cC as ke,dC as Ae,eC as je,fC as Me,gC as Ne,gD as b,gS as x,hC as Pe,hS as S,iC as Fe,jC as Ie,jS as C,kC as w,kS as T,lC as Le,mC as Re,nC as ze,oC as Be,pC as Ve,qS as He,rC as Ue,sC as We,tC as Ge,uC as Ke,vC as qe,vS as E,wC as Je,wS as D,xC as Ye,xS as O,yC as Xe,yS as k,zS as Ze}from"./dist-BPcfIXgJ.js";import{n as A}from"./dist-BtzdT2wL.js";import{i as Qe}from"./dist-D9C9G3zQ.js";import{t as j}from"./button-C3LWIgGJ.js";import{$ as M,A as $e,At as et,C as N,Dt as P,Mt as tt,Q as F,S as I,X as L,Z as R,b as z,et as B,j as nt,jt as rt,m as it,nt as V,rt as H,tt as at,x as U,y as W}from"./index-B--TQi5b.js";import{t as ot}from"./FilterBar-Dc-vzhP8.js";import{t as st}from"./DataTableShell-CyKGlXVg.js";import{t as ct}from"./roleDescriptions-DmHFjDvY.js";var G=t(e(),1),K=n(),q=[{value:`never`,label:()=>O(),days:null},{value:`30`,label:()=>y(),days:30},{value:`90`,label:()=>k(),days:90}],lt=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=tt({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??J,[s,c]=(0,G.useState)(J),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),d=o(b.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:s===J?void 0:s,disabled:a===J?void 0:a===`disabled`}}),f=o(b.apiKeys.listKeys,{}),p=o(b.apiKeys.listRoles,{}),de=h(b.apiKeys.createServiceAccount),pe=h(b.apiKeys.updateServiceAccount),he=h(b.apiKeys.deleteServiceAccount),m=Oe(b.apiKeys.mintApiKey),g=h(b.apiKeys.revokeApiKey),_=nt(),v=$e(),y=n!==``||s!==J||a!==J;function x(){c(J),t({search:{},replace:!0})}let[S,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,A]=(0,G.useState)(new Set),[M,P]=(0,G.useState)(null),F=(0,G.useRef)(!1),[B,V]=(0,G.useState)(new Set),[H,at]=(0,G.useState)({}),[lt,X]=(0,G.useState)(null),Z=(0,G.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){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await pe({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(r())):await de({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),O(null),C(!1)}catch(e){v.error(D?je():Ge(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function $(e){if(F.current)return;F.current=!0;let t=H[e._id]??`never`,n=q.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;P(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(ge(),e)}finally{F.current=!1,P(null)}}async function mt(e){if(await _({title:we(),description:(0,K.jsxs)(K.Fragment,{children:[Se(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ce(),` `,(0,K.jsx)(`strong`,{children:se()}),` `,He()]}),confirmWord:e.name,confirmLabel:ce(),destructive:!0}))try{await he({serviceAccountId:e._id}),v.success(ae(),e.name)}catch(e){v.error(xe(),e)}}async function ht(e){if(await _({title:ye(),description:(0,K.jsxs)(K.Fragment,{children:[oe(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,be()]}),confirmLabel:ee(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(Ze(),e)}finally{V(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,K.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:me(),onReset:x,canReset:y,children:[(0,K.jsxs)(W,{value:s,onValueChange:c,children:[(0,K.jsx)(I,{size:`sm`,className:`w-40`,children:(0,K.jsx)(N,{placeholder:ue()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(U,{value:J,children:le()}),(p??[]).map(e=>(0,K.jsx)(U,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(W,{value:a,onValueChange:u,children:[(0,K.jsx)(I,{size:`sm`,className:`w-36`,children:(0,K.jsx)(N,{})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(U,{value:J,children:Ie()}),(0,K.jsx)(U,{value:`active`,children:i()}),(0,K.jsx)(U,{value:`disabled`,children:w()})]})]})]}),(0,K.jsx)(st,{title:fe(),rows:d,addLabel:ne(),onAdd:()=>{E(Y),O(null),C(!0)},emptyHint:re(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:_e(),onSelect:()=>pt(e)},{label:ve(),onSelect:()=>void $(e)},{label:k.has(e._id)?Je():te(),onSelect:()=>Q(e._id)},{label:Ye(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?De():Xe(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)(Qe,{}):(0,K.jsx)(et,{})})},{header:qe(),sort:e=>e.name,cell:e=>(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsx)(`span`,{children:e.name}),e.description?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Te(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:Ne(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(L,{variant:`destructive`,children:w()}):(0,K.jsx)(L,{variant:`outline`,children:i()})},{header:Pe(),cell:e=>(0,K.jsxs)(W,{value:H[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(I,{size:`sm`,className:`w-32`,children:(0,K.jsx)(N,{})}),(0,K.jsx)(z,{children:q.map(e=>(0,K.jsx)(U,{value:e.value,children:e.label()},e.value))})]})},{header:Re(),sort:e=>(Z.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Z.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,K.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Ve():Me({count:t})})}}]}),(0,K.jsx)(it,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:D?Ae():ke(),description:D?Ke():We(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Le():Be(),children:(0,K.jsxs)(`div`,{className:`oc-form`,children:[(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Ee()}),(0,K.jsx)(R,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:Fe()}),(0,K.jsxs)(W,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,K.jsx)(I,{className:`w-full`,children:(0,K.jsx)(N,{placeholder:Ue()})}),(0,K.jsx)(z,{children:(p??[]).map(e=>(0,K.jsxs)(U,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,K.jsxs)(`label`,{className:`oc-field`,children:[(0,K.jsx)(`span`,{className:`oc-field__label`,children:ze()}),(0,K.jsx)(R,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:lt,onClose:()=>X(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,K.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,K.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[m(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:d()}),(0,K.jsx)(`th`,{children:u()}),(0,K.jsx)(`th`,{children:he()}),(0,K.jsx)(`th`,{children:de()}),(0,K.jsx)(`th`,{children:p()}),(0,K.jsx)(`th`,{children:C()}),(0,K.jsx)(`th`,{})]})}),(0,K.jsx)(`tbody`,{children:t.map(t=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{children:(0,K.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,K.jsx)(`td`,{children:(0,K.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,K.jsx)(`td`,{children:Z(t.createdAt)}),(0,K.jsx)(`td`,{className:Q(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,K.jsx)(`td`,{children:pt(t.expiresAt)}),(0,K.jsx)(`td`,{children:$(t)}),(0,K.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,K.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?a():T()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,G.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,K.jsx)(F,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,K.jsxs)(M,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,K.jsxs)(V,{children:[(0,K.jsx)(H,{children:pe()}),(0,K.jsx)(B,{children:c({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:l()}),(0,K.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,K.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,K.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":_(),children:[n?(0,K.jsx)(A,{}):(0,K.jsx)(P,{}),n?D():s()]})]}),(0,K.jsx)(at,{children:(0,K.jsx)(j,{onClick:()=>{r(!1),t()},children:g()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>lt}function ft(e){return e===null?E():new Date(e).toLocaleString(`fr-FR`)}function pt(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function $(e){return e.disabled?(0,K.jsx)(L,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(L,{variant:`outline`,children:x()}):(0,K.jsx)(L,{variant:`outline`,children:S()})}export{X as ServiceAccountsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,B as i,C as a,CD as o,D as s,E as c,F as l,G as u,H as d,I as f,L as p,M as m,N as h,O as g,P as _,R as v,S as y,SD as b,T as x,U as S,V as C,W as w,_ as T,b as E,c as D,d as O,f as k,g as A,gD as j,h as M,j as N,k as P,l as F,m as I,p as ee,s as L,u as R,v as z,w as B,x as V,y as H,z as U}from"./dist-BzNYkP4V.js";import{t as W}from"./button-DXGXeanX.js";import{j as G}from"./index-CKlFEsq3.js";import{t as K}from"./DataTableShell-C1ZKbpq3.js";var q=t(e(),1),J=n(),Y={hung:()=>g(),wrong_result:()=>s(),error:()=>c(),other:()=>x()},X=e=>(e&&Y[e]?.())??e??`—`;function Z(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function Q({data:e}){let t=e.snapshot,n=b(j.subAgentReports.respondToReport),[r,i]=(0,q.useState)(e.thread),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,J.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,J.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[X(e.category),` · `,B({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,J.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),r.length>0?(0,J.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?V():E()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:z(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?A():T()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[M({count:t.children.length}),t.childrenTruncated?` ${I()}`:``,t.textTruncated?` ${ee()}`:``]}),(0,J.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,J.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,J.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Z(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${k()}`:``]}),e.errorMessage?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:O()}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,J.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 $(){let e=o(j.subAgentReports.listForAdmin,{}),t=b(j.subAgentReports.readReport),n=b(j.subAgentReports.deleteReport),a=G(),[s,c]=(0,q.useState)(null),[g,y]=(0,q.useState)({});async function x(e){if(s===e._id){c(null);return}if(!g[e._id]){let n=await t({reportId:e._id});y(t=>({...t,[e._id]:n}))}c(e._id)}async function T(e){await a({title:F(),description:D(),confirmLabel:L(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,J.jsx)(`strong`,{children:d()}),` `,C()]}),(0,J.jsx)(K,{title:u(),rows:e,emptyHint:w(),isExpanded:e=>s===e._id&&!!g[e._id],renderExpanded:e=>g[e._id]?(0,J.jsx)(Q,{data:g[e._id]}):null,columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:U(),cell:e=>X(e.category),sort:e=>X(e.category)},{header:v(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${_({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:f(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:l(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?r():N(),onSelect:()=>void x(e)},{label:P(),onSelect:()=>void T(e),variant:`destructive`}]})]})}export{$ as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,B as i,C as a,CD as o,D as s,E as c,F as l,G as u,H as d,I as f,L as p,M as m,N as h,O as g,P as _,R as v,S as y,SD as b,T as x,U as S,V as C,W as w,_ as T,b as E,c as D,d as O,f as k,g as A,gD as j,h as M,j as N,k as P,l as F,m as I,p as ee,s as L,u as R,v as z,w as B,x as V,y as H,z as U}from"./dist-BPcfIXgJ.js";import{t as W}from"./button-C3LWIgGJ.js";import{j as G}from"./index-B--TQi5b.js";import{t as K}from"./DataTableShell-CyKGlXVg.js";var q=t(e(),1),J=n(),Y={hung:()=>g(),wrong_result:()=>s(),error:()=>c(),other:()=>x()},X=e=>(e&&Y[e]?.())??e??`—`;function Z(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function Q({data:e}){let t=e.snapshot,n=b(j.subAgentReports.respondToReport),[r,i]=(0,q.useState)(e.thread),[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,J.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,J.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[X(e.category),` · `,B({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,J.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),r.length>0?(0,J.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,J.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,J.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?V():E()}),(0,J.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,J.jsx)(`p`,{className:`oc-fbadmin__meta`,children:H()}),(0,J.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:z(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,J.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,J.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?A():T()})})]}),(0,J.jsxs)(`section`,{children:[(0,J.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[M({count:t.children.length}),t.childrenTruncated?` ${I()}`:``,t.textTruncated?` ${ee()}`:``]}),(0,J.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,J.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,J.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Z(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${k()}`:``]}),e.errorMessage?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:O()}),(0,J.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,J.jsxs)(`section`,{children:[(0,J.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,J.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 $(){let e=o(j.subAgentReports.listForAdmin,{}),t=b(j.subAgentReports.readReport),n=b(j.subAgentReports.deleteReport),a=G(),[s,c]=(0,q.useState)(null),[g,y]=(0,q.useState)({});async function x(e){if(s===e._id){c(null);return}if(!g[e._id]){let n=await t({reportId:e._id});y(t=>({...t,[e._id]:n}))}c(e._id)}async function T(e){await a({title:F(),description:D(),confirmLabel:L(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&c(null))}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,J.jsx)(`strong`,{children:d()}),` `,C()]}),(0,J.jsx)(K,{title:u(),rows:e,emptyHint:w(),isExpanded:e=>s===e._id&&!!g[e._id],renderExpanded:e=>g[e._id]?(0,J.jsx)(Q,{data:g[e._id]}):null,columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:U(),cell:e=>X(e.category),sort:e=>X(e.category)},{header:v(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:p(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${_({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:f(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:l(),cell:e=>e.answered?(0,J.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:h()}):(0,J.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?r():N(),onSelect:()=>void x(e)},{label:P(),onSelect:()=>void T(e),variant:`destructive`}]})]})}export{$ as SubAgentReportsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,AT as i,Aw as a,BE as o,Bw as s,CD as c,CE as l,CT as u,Cw as d,DT as f,Dw as p,ET as m,Ew as h,FT as g,Fw as _,Gw as ee,Hw as v,IT as te,Iw as y,Jw as ne,Kw as re,LT as ie,Lw as ae,MT as oe,Mw as se,NT as ce,Nw as le,OT as b,Ow as ue,PT as de,Pw as fe,Qw as pe,RT as me,Rw as he,SD as x,ST as ge,Sw as _e,TT as ve,Tw as ye,Uw as be,VE as xe,Vw as Se,Ww as Ce,Xw as we,Yw as Te,Zw as Ee,_D as De,_T as Oe,_w as ke,a as S,aT as Ae,bD as je,bT as Me,bw as C,cT as Ne,dT as Pe,eT as Fe,fT as Ie,gD as w,gT as Le,gw as Re,hT as ze,i as Be,iT as Ve,jT as He,jw as Ue,kT as We,kw as Ge,lT as Ke,mT as qe,n as Je,nT as Ye,o as Xe,oT as Ze,pT as Qe,qw as $e,r as et,rT as tt,sT as nt,tT as T,uT as rt,vT as it,vw as at,wE as ot,wT as st,ww as E,xT as ct,xw as lt,yT as ut,yw as dt,zE as ft,zw as pt}from"./dist-BzNYkP4V.js";import{n as D}from"./dist-CWfWFr7t.js";import{t as O}from"./x-DQ_CLIEK.js";import{t as k}from"./button-DXGXeanX.js";import{C as A,Et as mt,G as ht,J as j,K as M,S as N,Tt as P,W as gt,X as F,Y as _t,Z as I,_ as L,at as vt,b as R,it as yt,ot as z,q as bt,x as B,y as V}from"./index-CKlFEsq3.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-B60DsQBe.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-AFxsandT.js";import{t as At}from"./TimeRangePicker-CY6cFX3v.js";import{t as jt}from"./FilterBar-CSA8xMkl.js";import{t as Mt}from"./AdvancedFilter-D7QXVQ5_.js";var G=De(`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),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(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 Lt(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 Lt(e,t,n)>=Nt}function Rt(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 zt(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 Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(pt());if(e.size>Bt)throw Error(he());let{source:n,width:r,height:i,cleanup:a}=await Gt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Vt/r,Ht/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(y());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=It(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(y());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)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(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`,Ut)??await Y(f,`image/png`);if(!h)throw Error(_());return{blob:h,hasAlpha:m}}finally{a()}}async function Gt(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(ae())),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 Kt(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`},qt=[{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 Jt(e){return e===`light`?xe():e===`dark`?o():ft()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({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:Je(`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)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":Xe(),title:Xe(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=c(w.charts.listMyCharts),r=x(w.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:i()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:b(),subtitle:f(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?m():n.via===`owner`?ve():st({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()}):null]})}function $t(){let e=x(w.charts.importChart),[t,n]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(T())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(r());return}let o;try{o=JSON.parse(i)}catch{s(T());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(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:nt()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:Ze(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:Ve(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),tt(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void p(),children:Ye()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Fe()}):null]})]})}function en({chart:e}){let t=je(w.charts.setChartLogo),n=x(w.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Wt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?re():ee()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?be():Ce(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Se()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:v()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:$e()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:s()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=c(w.me.getMe,{host:z}),n=x(w.charts.addChartDomain),r=x(w.charts.removeChartDomain),[i,o]=(0,K.useState)(``),[s,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=i.trim();if(t!==``){l(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function m(t){l(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:fe()}),(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:a()}):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":Ge({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>o(e.target.value),placeholder:se(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void p(),children:Ue()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=x(w.charts.updateChart),n=x(w.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>nn(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[d,f]=(0,K.useState)(null),[m,g]=(0,K.useState)(!1);function _(){o(e.name),c(nn(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function ee(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(T());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:_,children:Te()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:ne()})]})})]}),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:h()}),(0,X.jsx)(I,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:S()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Be():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ye()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void ee(),children:ue()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:p()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=c(w.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:pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=x(w.charts.addChartToGroupPool),r=x(w.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ze():e.kind===`custom`&&e.scope===`personal`?C():Le()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:qe()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ie()}),(a??[]).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":rt({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(A,{placeholder:Pe()})}),(0,X.jsx)(R,{children:s.map(e=>(0,X.jsx)(B,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Qe()}):null]})]})}function sn({chart:e}){let t=x(w.charts.promoteChartToCommon),n=x(w.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(E()))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`?dt():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:lt({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:at()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ke()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(w.admin.setDefaultThemeMode),i=x(w.admin.setDefaultLocale),a=x(w.charts.setDefaultChart),o=c(w.charts.listChartsAdmin),s=c(w.groups.listGroups,{}),u=e??`system`,f=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:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(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:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ct()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:b()}),vt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:it()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{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:d()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{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:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(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:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?ot():l()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()})]})]})}function ln(){let e=c(w.me.getMe,{host:z}),t=yt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ce()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(k,{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)(N,{className:`w-56`,children:(0,X.jsx)(A,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(B,{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)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes directions`}),(0,X.jsx)(B,{value:`inbound`,children:`inbound`}),(0,X.jsx)(B,{value:`outbound`,children:`outbound`}),(0,X.jsx)(B,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(B,{value:`info`,children:`info`}),(0,X.jsx)(B,{value:`warn`,children:`warn`}),(0,X.jsx)(B,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Mt,{fields:qt,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)(At,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(bt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{children:`Edit`}),(0,X.jsx)(M,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Et,{className:`w-80`,children:[(0,X.jsxs)(xt,{children:[(0,X.jsx)(wt,{children:`Instance`}),(0,X.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(St,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(kt,{children:[(0,X.jsx)(Dt,{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)(Ot,{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)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{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{un as ThemeShowroom};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,AT as i,Aw as a,BE as o,Bw as s,CD as c,CE as l,CT as u,Cw as d,DT as f,Dw as p,ET as m,Ew as h,FT as g,Fw as _,Gw as ee,Hw as v,IT as te,Iw as y,Jw as ne,Kw as re,LT as ie,Lw as ae,MT as oe,Mw as se,NT as ce,Nw as le,OT as b,Ow as ue,PT as de,Pw as fe,Qw as pe,RT as me,Rw as he,SD as x,ST as ge,Sw as _e,TT as ve,Tw as ye,Uw as be,VE as xe,Vw as Se,Ww as Ce,Xw as we,Yw as Te,Zw as Ee,_D as De,_T as Oe,_w as ke,a as S,aT as Ae,bD as je,bT as Me,bw as C,cT as Ne,dT as Pe,eT as Fe,fT as Ie,gD as w,gT as Le,gw as Re,hT as ze,i as Be,iT as Ve,jT as He,jw as Ue,kT as We,kw as Ge,lT as Ke,mT as qe,n as Je,nT as Ye,o as Xe,oT as Ze,pT as Qe,qw as $e,r as et,rT as tt,sT as nt,tT as T,uT as rt,vT as it,vw as at,wE as ot,wT as st,ww as E,xT as ct,xw as lt,yT as ut,yw as dt,zE as ft,zw as pt}from"./dist-BPcfIXgJ.js";import{n as D}from"./dist-BtzdT2wL.js";import{t as O}from"./x-BY_tjn83.js";import{t as k}from"./button-C3LWIgGJ.js";import{C as A,Et as mt,G as ht,J as j,K as M,S as N,Tt as P,W as gt,X as F,Y as _t,Z as I,_ as L,at as vt,b as R,it as yt,ot as z,q as bt,x as B,y as V}from"./index-B--TQi5b.js";import{a as xt,i as St,n as Ct,o as wt,r as Tt,t as Et}from"./card-DXTJ7L6C.js";import{a as Dt,i as H,n as Ot,o as U,r as W,t as kt}from"./table-CjpKnop2.js";import{t as At}from"./TimeRangePicker-BAldDUhc.js";import{t as jt}from"./FilterBar-Dc-vzhP8.js";import{t as Mt}from"./AdvancedFilter-DJjN0ZKH.js";var G=De(`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),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(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 Lt(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 Lt(e,t,n)>=Nt}function Rt(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 zt(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 Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(pt());if(e.size>Bt)throw Error(he());let{source:n,width:r,height:i,cleanup:a}=await Gt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Vt/r,Ht/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(y());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=It(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(y());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)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(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`,Ut)??await Y(f,`image/png`);if(!h)throw Error(_());return{blob:h,hasAlpha:m}}finally{a()}}async function Gt(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(ae())),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 Kt(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`},qt=[{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 Jt(e){return e===`light`?xe():e===`dark`?o():ft()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({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:Je(`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)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":Xe(),title:Xe(),children:(0,X.jsx)(mt,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=c(w.charts.listMyCharts),r=x(w.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:i()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:We()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:b(),subtitle:f(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?m():n.via===`owner`?ve():st({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:u()}):null]})}function $t(){let e=x(w.charts.importChart),[t,n]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(T())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(r());return}let o;try{o=JSON.parse(i)}catch{s(T());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(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:nt()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:Ze(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:Ve(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),tt(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void p(),children:Ye()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Fe()}):null]})]})}function en({chart:e}){let t=je(w.charts.setChartLogo),n=x(w.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Wt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?re():ee()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?be():Ce(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Se()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:v()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:$e()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:s()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=c(w.me.getMe,{host:z}),n=x(w.charts.addChartDomain),r=x(w.charts.removeChartDomain),[i,o]=(0,K.useState)(``),[s,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=i.trim();if(t!==``){l(null),d(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){l(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function m(t){l(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:fe()}),(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:a()}):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":Ge({domain:e}),onClick:()=>void m(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>o(e.target.value),placeholder:se(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void p(),children:Ue()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=x(w.charts.updateChart),n=x(w.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>nn(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[d,f]=(0,K.useState)(null),[m,g]=(0,K.useState)(!1);function _(){o(e.name),c(nn(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function ee(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(T());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:_,children:Te()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:ne()})]})})]}),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:h()}),(0,X.jsx)(I,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:S()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Be():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ye()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void ee(),children:ue()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:p()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=c(w.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:pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=x(w.charts.addChartToGroupPool),r=x(w.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ze():e.kind===`custom`&&e.scope===`personal`?C():Le()}),e.isGlobalDefault?(0,X.jsx)(F,{variant:`default`,children:qe()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ie()}),(a??[]).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":rt({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(V,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(N,{size:`sm`,className:`w-56`,children:(0,X.jsx)(A,{placeholder:Pe()})}),(0,X.jsx)(R,{children:s.map(e=>(0,X.jsx)(B,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Qe()}):null]})]})}function sn({chart:e}){let t=x(w.charts.promoteChartToCommon),n=x(w.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(E()))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`?dt():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:lt({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:at()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ke()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(w.admin.setDefaultThemeMode),i=x(w.admin.setDefaultLocale),a=x(w.charts.setDefaultChart),o=c(w.charts.listChartsAdmin),s=c(w.groups.listGroups,{}),u=e??`system`,f=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:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(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:ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ct()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:b()}),vt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ut()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:it()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{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:d()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{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:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(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:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(k,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?ot():l()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()})]})]})}function ln(){let e=c(w.me.getMe,{host:z}),t=yt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ce()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(k,{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)(N,{className:`w-56`,children:(0,X.jsx)(A,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(B,{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)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(V,{value:o,onValueChange:s,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes directions`}),(0,X.jsx)(B,{value:`inbound`,children:`inbound`}),(0,X.jsx)(B,{value:`outbound`,children:`outbound`}),(0,X.jsx)(B,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(V,{value:c,onValueChange:l,children:[(0,X.jsx)(N,{size:`sm`,children:(0,X.jsx)(A,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(B,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(B,{value:`info`,children:`info`}),(0,X.jsx)(B,{value:`warn`,children:`warn`}),(0,X.jsx)(B,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Mt,{fields:qt,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)(At,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(bt,{children:`Actions`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{children:`Edit`}),(0,X.jsx)(M,{children:`Duplicate`}),(0,X.jsx)(j,{}),(0,X.jsx)(M,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Et,{className:`w-80`,children:[(0,X.jsxs)(xt,{children:[(0,X.jsx)(wt,{children:`Instance`}),(0,X.jsx)(Tt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(Ct,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(St,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(kt,{children:[(0,X.jsx)(Dt,{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)(Ot,{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)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{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{un as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Dl as i,El as a,Fl as o,Il as s,Ll as c,Ml as l,Nl as u,Ol as d,Pl as f,Tl as p,jl as m,kl as h}from"./dist-BzNYkP4V.js";import{t as g}from"./button-DXGXeanX.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-CKlFEsq3.js";var w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(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=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:c(),from:`now-5m`},{label:s(),from:`now-15m`},{label:o(),from:`now-30m`},{label:f(),from:`now-1h`},{label:u(),from:`now-3h`},{label:l(),from:`now-6h`},{label:m(),from:`now-12h`},{label:r(),from:`now-24h`},{label:h(),from:`now-2d`},{label:d(),from:`now-7d`},{label:i(),from:`now-30d`},{label:a(),from:`now-90d`},{label:p(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(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 M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.jsx)(x,{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,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Dl as i,El as a,Fl as o,Il as s,Ll as c,Ml as l,Nl as u,Ol as d,Pl as f,Tl as p,jl as m,kl as h}from"./dist-BPcfIXgJ.js";import{t as g}from"./button-C3LWIgGJ.js";import{Ot as _,Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-B--TQi5b.js";var w=t(e(),1),T={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function E(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=T[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function D(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:E(e.from,t)??t-T.h,to:E(e.to,t)??t}}var O=[{label:c(),from:`now-5m`},{label:s(),from:`now-15m`},{label:o(),from:`now-30m`},{label:f(),from:`now-1h`},{label:u(),from:`now-3h`},{label:l(),from:`now-6h`},{label:m(),from:`now-12h`},{label:r(),from:`now-24h`},{label:h(),from:`now-2d`},{label:d(),from:`now-7d`},{label:i(),from:`now-30d`},{label:a(),from:`now-90d`},{label:p(),from:`now-520w`}];function k(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function A(e){if(e.kind===`relative`){let t=O.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${k(e.from)} → ${k(e.to)}`}function j(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 M(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function N(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var P=n();function F(e){let[t,n]=(0,w.useState)(0);return(0,w.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,w.useMemo)(()=>{let{from:t,to:n}=D(e);return e.kind===`absolute`?{from:t,to:n}:{from:I(t),to:I(n)}},[e,t])}function I(e){return Math.floor(e/6e4)*6e4}function L({value:e,onChange:t}){let[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(``),o=D(e),[s,c]=(0,w.useState)(()=>j(o.from)),[l,u]=(0,w.useState)(()=>j(o.to));function d(t){if(t){let t=D(e);c(j(t.from)),u(j(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=M(s),n=M(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,w.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?O:O.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=M(s)!==null&&M(l)!==null;return(0,P.jsxs)(b,{open:n,onOpenChange:d,children:[(0,P.jsx)(S,{asChild:!0,children:(0,P.jsxs)(g,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,P.jsx)(_,{}),A(e)]})}),(0,P.jsx)(y,{children:(0,P.jsx)(x,{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,P.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,P.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,P.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`oc-field`,children:[(0,P.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,P.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,P.jsx)(g,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,P.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,P.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,P.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,P.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,P.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,P.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{F as n,N as r,L as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$y as i,Af as a,Ay as o,By as s,CD as c,Cf as l,Df as u,Dy as d,Ef as f,Ey as p,Fy as m,Gy as h,Iy as g,Jy as _,Ky as v,Ly as y,Mf as ee,My as b,Nf as x,Ny as S,Of as te,Oy as C,Py as w,Qd as ne,Qy as re,Ry as T,SD as E,Sf as ie,Tf as ae,Xd as D,Xy as O,Yd as k,Yy as A,Zd as oe,Zy as se,_D as j,_f as ce,ab as le,af as ue,bf as de,cb as fe,cf as pe,db as me,df as he,eb as ge,ef as _e,fb as ve,ff as ye,gD as M,gf as be,hb as N,hf as xe,ib as P,if as Se,jf as Ce,jy as F,kf as we,ky as Te,lb as Ee,lf as De,mb as Oe,mf as ke,nb as I,nf as Ae,ob as je,of as Me,pb as Ne,pf as Pe,qy as Fe,rb as L,rf as Ie,sb as Le,sf as Re,tb as ze,tf as Be,ub as Ve,uf as He,vf as Ue,wf as We,xf as Ge,yf as Ke,zy as qe}from"./dist-BzNYkP4V.js";import{n as Je}from"./dist-CWfWFr7t.js";import{t as Ye}from"./x-DQ_CLIEK.js";import{i as R,n as z,r as Xe,t as Ze}from"./tabs-9X-5Pgx3.js";import{t as B}from"./button-DXGXeanX.js";import{$ as Qe,C as V,Ct as $e,Dt as et,Mt as tt,Q as nt,S as H,X as U,a as rt,b as W,et as it,i as at,jt as ot,k as st,nt as ct,o as lt,ot as ut,r as dt,rt as ft,wt as pt,x as G,y as K}from"./index-CKlFEsq3.js";import{n as mt}from"./TimeRangePicker-CY6cFX3v.js";import{t as ht}from"./FilterBar-CSA8xMkl.js";import{t as gt}from"./AdvancedFilter-D7QXVQ5_.js";import{t as _t}from"./DataTableShell-C1ZKbpq3.js";var vt=j(`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`}]]),yt=j(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function bt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?O():n===`agent`?`${A()} - ${r}`:e}function xt(){let e=c(M.me.getMe,{host:ut})?.role===`admin`,t=c(M.deliveryTiming.getDeliveryStatus,{}),n=E(M.deliveryTiming.startDeliveryRecord),r=E(M.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{s(!0);try{l?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:N()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}),e?(0,J.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void u(),children:l?ve():Ne()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(U,{variant:`secondary`,children:me()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Ve({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Le():fe()})}),i?(0,J.jsx)(St,{isAdmin:e}):null]})}function St({isAdmin:e}){let t=c(M.deliveryTiming.listDeliverySessions,{}),n=E(M.deliveryTiming.deleteDeliverySessions),[r,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[l,u]=(0,q.useState)(Y),[f,p]=(0,q.useState)(null),{from:m,to:h}=mt(l),g=l.to===`now`?1/0:h,y=r.trim()!==``||o!==`all`||l!==Y,ee=()=>{a(``),s(`all`),u(Y)},b=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=m&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,m,g]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),f!==null&&r.includes(f)&&p(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(ht,{q:r,onQChange:a,searchPlaceholder:le(),timeRange:l,onTimeRangeChange:u,onReset:ee,canReset:y,children:(0,J.jsxs)(K,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(H,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:`all`,children:P()}),(0,J.jsx)(G,{value:`active`,children:L()}),(0,J.jsx)(G,{value:`stopped`,children:I()})]})]})}),(0,J.jsx)(_t,{title:je(),rows:b,emptyHint:d(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":f===e.sessionId?Fe():_(),onClick:()=>p(t=>t===e.sessionId?null:e.sessionId),children:f===e.sessionId?(0,J.jsx)(vt,{size:15,"aria-hidden":!0}):(0,J.jsx)(pt,{size:15,"aria-hidden":!0})})},{header:ze(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:ge(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:i(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:re(),sort:e=>e.startedBy,cell:e=>bt(e.startedBy)},{header:se(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(U,{variant:`secondary`,children:L()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:I()})}],rowActions:e?e=>[{label:v(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:v(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===f,renderExpanded:e=>(0,J.jsx)(Ct,{sessionId:e.sessionId})})]})}function Ct({sessionId:e}){let t=c(M.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(wt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(st(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function wt({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:h()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,p()]}),(0,J.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Je,{size:13,"aria-hidden":!0}):(0,J.jsx)(et,{size:13,"aria-hidden":!0}),t?C():Te()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:T()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:y()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:g()})]})}),(0,J.jsxs)(`tbody`,{children:[i(m(),r.bridge),i(w(),r.A),i(S(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:F()})]})}var Tt=[50,100,200,500],Z=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function jt(){let e=tt({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,i=e.kind,o=e.statusClass??Q,d=e.principalType??Q,p=e.direction??Q,m=e.roleKey??Q,h=e.q??``,g=dt(e.from,e.to),_=(0,q.useMemo)(()=>lt(e.adv),[e.adv]),{from:v,to:y}=mt(g),[b,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),re=e=>void t({search:t=>({...t,limit:e})}),T=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),oe=e=>void t({search:t=>({...t,...rt(e)})}),se=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),j=c(M.observability.listEvents,{limit:n}),le=c(M.observability.listEvents,{limit:n,kind:i===Z?void 0:i,filter:{q:h||void 0,from:v,to:y,statusClass:o===Q?void 0:o,principalType:d===Q?void 0:d,direction:p===Q?void 0:p,roleKey:m===Q?void 0:m,advanced:_.length>0?_:void 0}}),fe=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),me=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),ge=h!==``||o!==Q||d!==Q||p!==Q||m!==Q||_.length>0||g.kind!==`relative`||g.from!==kt.from;function ve(){t({search:{limit:100,kind:`all`},replace:!0})}let N=b?j?.filter(e=>e.correlationId===b):le,[P,F]=(0,q.useState)(`events`);return(0,J.jsxs)(Ze,{value:P,onValueChange:e=>F(e),children:[(0,J.jsxs)(Xe,{className:`w-full`,children:[(0,J.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)($e,{size:13,"aria-hidden":!0}),s()]}),(0,J.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(yt,{size:13,"aria-hidden":!0}),qe()]})]}),(0,J.jsx)(z,{value:`latency`,children:(0,J.jsx)(xt,{})}),(0,J.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),(0,J.jsx)(`strong`,{children:ee()}),Ce(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,J.jsxs)(ht,{q:h,onQChange:E,searchPlaceholder:we(),timeRange:g,onTimeRangeChange:oe,onReset:ve,canReset:ge,children:[(0,J.jsxs)(K,{value:o,onValueChange:D,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:te()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:u()}),Et.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:d,onValueChange:O,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:f()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:ae()}),Dt.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:p,onValueChange:k,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:We()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:l()}),Ot.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:m,onValueChange:A,children:[(0,J.jsx)(H,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{placeholder:ie()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:Ge()}),me.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:i,onValueChange:T,children:[(0,J.jsx)(H,{size:`sm`,className:`w-44`,children:(0,J.jsx)(V,{placeholder:de()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Z,children:Ke()}),fe.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:String(n),onValueChange:e=>re(Number(e)),children:[(0,J.jsx)(H,{size:`sm`,className:`w-28`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(W,{children:Tt.map(e=>(0,J.jsx)(G,{value:String(e),children:Ue({count:e})},e))})]})]}),(0,J.jsx)(gt,{fields:At,seed:_,onChange:se}),b?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:ce(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[be(),(0,J.jsx)(`code`,{children:$(b)})]}),(0,J.jsx)(Ye,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:xe()})]})}):null,(0,J.jsx)(_t,{title:ke(),rows:N,emptyHint:b?Pe():ye(),columns:[{header:he(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:He(),sort:e=>e.kind,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.kind})},{header:De(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":pe(),children:`✓`})}},{header:Re(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(U,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Me(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ue(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Se(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Ie(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${Mt(e.status)}`,children:e.status})},{header:Ae(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Be(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:_e(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:r(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:ne()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Pt,{row:C,onClose:()=>w(null)})]})]})}function Mt(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 Nt(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 Pt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(nt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(Qe,{className:`max-w-lg`,children:[(0,J.jsxs)(ct,{children:[(0,J.jsxs)(ft,{className:`oc-traces__meta-title`,children:[oe(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(U,{variant:`outline`,children:D()})]}),(0,J.jsx)(it,{children:k()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,$y as i,Af as a,Ay as o,By as s,CD as c,Cf as l,Df as u,Dy as d,Ef as f,Ey as p,Fy as m,Gy as h,Iy as g,Jy as _,Ky as v,Ly as y,Mf as ee,My as b,Nf as x,Ny as S,Of as te,Oy as C,Py as w,Qd as ne,Qy as re,Ry as T,SD as E,Sf as ie,Tf as ae,Xd as D,Xy as O,Yd as k,Yy as A,Zd as oe,Zy as se,_D as j,_f as ce,ab as le,af as ue,bf as de,cb as fe,cf as pe,db as me,df as he,eb as ge,ef as _e,fb as ve,ff as ye,gD as M,gf as be,hb as N,hf as xe,ib as P,if as Se,jf as Ce,jy as F,kf as we,ky as Te,lb as Ee,lf as De,mb as Oe,mf as ke,nb as I,nf as Ae,ob as je,of as Me,pb as Ne,pf as Pe,qy as Fe,rb as L,rf as Ie,sb as Le,sf as Re,tb as ze,tf as Be,ub as Ve,uf as He,vf as Ue,wf as We,xf as Ge,yf as Ke,zy as qe}from"./dist-BPcfIXgJ.js";import{n as Je}from"./dist-BtzdT2wL.js";import{t as Ye}from"./x-BY_tjn83.js";import{i as R,n as z,r as Xe,t as Ze}from"./tabs-C1F_imzX.js";import{t as B}from"./button-C3LWIgGJ.js";import{$ as Qe,C as V,Ct as $e,Dt as et,Mt as tt,Q as nt,S as H,X as U,a as rt,b as W,et as it,i as at,jt as ot,k as st,nt as ct,o as lt,ot as ut,r as dt,rt as ft,wt as pt,x as G,y as K}from"./index-B--TQi5b.js";import{n as mt}from"./TimeRangePicker-BAldDUhc.js";import{t as ht}from"./FilterBar-Dc-vzhP8.js";import{t as gt}from"./AdvancedFilter-DJjN0ZKH.js";import{t as _t}from"./DataTableShell-CyKGlXVg.js";var vt=j(`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`}]]),yt=j(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function bt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?O():n===`agent`?`${A()} - ${r}`:e}function xt(){let e=c(M.me.getMe,{host:ut})?.role===`admin`,t=c(M.deliveryTiming.getDeliveryStatus,{}),n=E(M.deliveryTiming.startDeliveryRecord),r=E(M.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),l=t?.recording??!1,u=async()=>{s(!0);try{l?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:N()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}),e?(0,J.jsx)(B,{variant:l?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void u(),children:l?ve():Ne()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(U,{variant:`secondary`,children:me()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Ve({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Le():fe()})}),i?(0,J.jsx)(St,{isAdmin:e}):null]})}function St({isAdmin:e}){let t=c(M.deliveryTiming.listDeliverySessions,{}),n=E(M.deliveryTiming.deleteDeliverySessions),[r,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[l,u]=(0,q.useState)(Y),[f,p]=(0,q.useState)(null),{from:m,to:h}=mt(l),g=l.to===`now`?1/0:h,y=r.trim()!==``||o!==`all`||l!==Y,ee=()=>{a(``),s(`all`),u(Y)},b=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=m&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,m,g]),x=e=>{let t=new Set((b??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),f!==null&&r.includes(f)&&p(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(ht,{q:r,onQChange:a,searchPlaceholder:le(),timeRange:l,onTimeRangeChange:u,onReset:ee,canReset:y,children:(0,J.jsxs)(K,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(H,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:`all`,children:P()}),(0,J.jsx)(G,{value:`active`,children:L()}),(0,J.jsx)(G,{value:`stopped`,children:I()})]})]})}),(0,J.jsx)(_t,{title:je(),rows:b,emptyHint:d(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(B,{variant:`ghost`,size:`icon`,"aria-label":f===e.sessionId?Fe():_(),onClick:()=>p(t=>t===e.sessionId?null:e.sessionId),children:f===e.sessionId?(0,J.jsx)(vt,{size:15,"aria-hidden":!0}):(0,J.jsx)(pt,{size:15,"aria-hidden":!0})})},{header:ze(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:ge(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:i(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:re(),sort:e=>e.startedBy,cell:e=>bt(e.startedBy)},{header:se(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(U,{variant:`secondary`,children:L()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:I()})}],rowActions:e?e=>[{label:v(),variant:`destructive`,onSelect:()=>x([e.sessionId])}]:void 0,bulkActions:e?[{label:v(),variant:`destructive`,onSelect:e=>x(e)}]:void 0,isExpanded:e=>e.sessionId===f,renderExpanded:e=>(0,J.jsx)(Ct,{sessionId:e.sessionId})})]})}function Ct({sessionId:e}){let t=c(M.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(wt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(st(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function wt({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:h()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,p()]}),(0,J.jsxs)(B,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(Je,{size:13,"aria-hidden":!0}):(0,J.jsx)(et,{size:13,"aria-hidden":!0}),t?C():Te()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:T()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:y()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:g()})]})}),(0,J.jsxs)(`tbody`,{children:[i(m(),r.bridge),i(w(),r.A),i(S(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:F()})]})}var Tt=[50,100,200,500],Z=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function jt(){let e=tt({from:`/settings/traces`}),t=ot({from:`/settings/traces`}),n=e.limit,i=e.kind,o=e.statusClass??Q,d=e.principalType??Q,p=e.direction??Q,m=e.roleKey??Q,h=e.q??``,g=dt(e.from,e.to),_=(0,q.useMemo)(()=>lt(e.adv),[e.adv]),{from:v,to:y}=mt(g),[b,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),re=e=>void t({search:t=>({...t,limit:e})}),T=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),oe=e=>void t({search:t=>({...t,...rt(e)})}),se=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),j=c(M.observability.listEvents,{limit:n}),le=c(M.observability.listEvents,{limit:n,kind:i===Z?void 0:i,filter:{q:h||void 0,from:v,to:y,statusClass:o===Q?void 0:o,principalType:d===Q?void 0:d,direction:p===Q?void 0:p,roleKey:m===Q?void 0:m,advanced:_.length>0?_:void 0}}),fe=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])e.add(t.kind);return[...e].sort()},[j]),me=(0,q.useMemo)(()=>{let e=new Set;for(let t of j??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[j]),ge=h!==``||o!==Q||d!==Q||p!==Q||m!==Q||_.length>0||g.kind!==`relative`||g.from!==kt.from;function ve(){t({search:{limit:100,kind:`all`},replace:!0})}let N=b?j?.filter(e=>e.correlationId===b):le,[P,F]=(0,q.useState)(`events`);return(0,J.jsxs)(Ze,{value:P,onValueChange:e=>F(e),children:[(0,J.jsxs)(Xe,{className:`w-full`,children:[(0,J.jsxs)(R,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)($e,{size:13,"aria-hidden":!0}),s()]}),(0,J.jsxs)(R,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(yt,{size:13,"aria-hidden":!0}),qe()]})]}),(0,J.jsx)(z,{value:`latency`,children:(0,J.jsx)(xt,{})}),(0,J.jsxs)(z,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),(0,J.jsx)(`strong`,{children:ee()}),Ce(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,J.jsxs)(ht,{q:h,onQChange:E,searchPlaceholder:we(),timeRange:g,onTimeRangeChange:oe,onReset:ve,canReset:ge,children:[(0,J.jsxs)(K,{value:o,onValueChange:D,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:te()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:u()}),Et.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:d,onValueChange:O,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:f()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:ae()}),Dt.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:p,onValueChange:k,children:[(0,J.jsx)(H,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{placeholder:We()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:l()}),Ot.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:m,onValueChange:A,children:[(0,J.jsx)(H,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{placeholder:ie()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Q,children:Ge()}),me.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:i,onValueChange:T,children:[(0,J.jsx)(H,{size:`sm`,className:`w-44`,children:(0,J.jsx)(V,{placeholder:de()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(G,{value:Z,children:Ke()}),fe.map(e=>(0,J.jsx)(G,{value:e,children:e},e))]})]}),(0,J.jsxs)(K,{value:String(n),onValueChange:e=>re(Number(e)),children:[(0,J.jsx)(H,{size:`sm`,className:`w-28`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(W,{children:Tt.map(e=>(0,J.jsx)(G,{value:String(e),children:Ue({count:e})},e))})]})]}),(0,J.jsx)(gt,{fields:At,seed:_,onChange:se}),b?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:ce(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[be(),(0,J.jsx)(`code`,{children:$(b)})]}),(0,J.jsx)(Ye,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:xe()})]})}):null,(0,J.jsx)(_t,{title:ke(),rows:N,emptyHint:b?Pe():ye(),columns:[{header:he(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:He(),sort:e=>e.kind,cell:e=>(0,J.jsx)(U,{variant:`secondary`,children:e.kind})},{header:De(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":pe(),children:`✓`})}},{header:Re(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(U,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Me(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(U,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ue(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(U,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Se(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Ie(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${Mt(e.status)}`,children:e.status})},{header:Ae(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Be(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:_e(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:r(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:ne()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Pt,{row:C,onClose:()=>w(null)})]})]})}function Mt(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 Nt(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 Pt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(nt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(Qe,{className:`max-w-lg`,children:[(0,J.jsxs)(ct,{children:[(0,J.jsxs)(ft,{className:`oc-traces__meta-title`,children:[oe(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(U,{variant:`outline`,children:D()})]}),(0,J.jsx)(it,{children:k()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Bg as i,CD as a,Gg as o,Hg as s,Jg as c,Kg as l,Qg as u,SD as d,Ug as f,Vg as ee,Wg as te,Xg as ne,Yg as re,Zg as ie,_d as p,a_ as ae,bd as m,c_ as oe,d_ as se,dd as h,e_ as ce,f_ as g,fd as _,gD as v,gd as y,hd as b,i_ as le,l_ as ue,ld as x,m_ as S,md as C,n_ as de,o_ as fe,p_ as w,pd as T,qg as E,r_ as D,s_ as pe,t_ as me,u_ as he,ud as O,vd as k,xd as A,xg as ge,yd as j}from"./dist-BzNYkP4V.js";import{t as M}from"./button-DXGXeanX.js";import{$ as N,A as P,C as F,G as I,K as L,M as _e,Mt as ve,Q as R,S as z,W as B,X as V,Y as ye,_ as H,_t as U,b as W,d as G,et as be,f as K,gt as q,j as xe,jt as Se,nt as Ce,ot as we,p as J,q as Te,rt as Ee,x as Y,y as X}from"./index-CKlFEsq3.js";import{t as De}from"./FilterBar-CSA8xMkl.js";import{t as Oe}from"./DataTableShell-C1ZKbpq3.js";import{t as ke}from"./DetailChips-Dg4YEpwe.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=a(v.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=a(v.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Q.jsx)(R,{open:n,onOpenChange:r,children:(0,Q.jsxs)(N,{className:`oc-access`,children:[(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(Ee,{children:A({user:t})}),(0,Q.jsx)(be,{children:m()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?j():k()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):[...f.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=d(v.agents.assignAgent),s=d(v.agents.removeAgent),c=d(v.agents.setDefaultAgent),l=P();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(y(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(b(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(H,{checked:r,disabled:s&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":T({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:_()}):null,e.outOfPool?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:h()}):null,r?o?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":O(),title:O(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(M,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":x(),title:x(),onClick:()=>void f(e.agentId),children:(0,Q.jsx)(q,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=G.filter(e=>n.has(J[e])).length;return(0,Q.jsxs)(B,{children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?S():w({count:r})})}),(0,Q.jsxs)(I,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Te,{children:g()}),G.map(e=>{let r=J[e];return(0,Q.jsxs)(L,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(H,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:K[e]??e})]},e)})]})]})}function Ne(){let e=ve({from:`/settings/users`}),t=Se({from:`/settings/users`}),n=e.q??``,p=e.role??$,m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),g=a(v.admin.listUsers,{filter:{q:n||void 0,role:p===$?void 0:p},withAgents:!0}),_=a(v.me.getMe,{host:we}),y=d(v.admin.setRole),b=d(v.admin.setUserPermissions),x=d(v.admin.startImpersonation),S=d(v.admin.deleteUser),C=d(v.admin.setUserName),w=xe(),T=_e(),O=P(),[k,A]=(0,Z.useState)(null),j=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of g??[])e.add(t.role);return[...e]},[g]),M=n!==``||p!==$;function N(){t({search:{},replace:!0})}async function I(e){try{await y(e)}catch(e){O.error(se(),e)}}async function L(e){try{await b(e)}catch(e){O.error(he(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:D(),description:de({user:t}),confirmWord:me(),confirmLabel:ce(),destructive:!0}))try{await S({profileId:e._id}),O.success(u({user:t}))}catch(e){O.error(r(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:ne(),label:re({user:t}),placeholder:c(),defaultValue:e.name??``,confirmLabel:ge()});if(n!==null)try{await C({profileId:e._id,name:n}),O.success(E())}catch(e){O.error(l(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:m,searchPlaceholder:ue(),onReset:N,canReset:M,children:(0,Q.jsxs)(X,{value:p,onValueChange:h,children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{value:$,children:oe()}),j.map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:pe(),rows:g,emptyHint:fe(),rowActions:e=>{let t=[{label:i(),onSelect:()=>A({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ie(),onSelect:()=>void B(e)}];return e.userId!==_?.userId&&t.push({label:ae(),onSelect:()=>void x({profileId:e._id})},{label:le(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:o(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:te(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(X,{value:e.role,onValueChange:t=>void I({profileId:e._id,role:t}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{value:`pending`,children:`pending`}),(0,Q.jsx)(Y,{value:`user`,children:`user`}),(0,Q.jsx)(Y,{value:`admin`,children:`admin`})]})]})},{header:f(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:s()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),L({profileId:e._id,permissions:[...n]})}})},{header:ee(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:k?.profileId??null,userLabel:k?.label??``,open:k!==null,onOpenChange:e=>{e||A(null)}})]})}export{Ne as UsersTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Bg as i,CD as a,Gg as o,Hg as s,Jg as c,Kg as l,Qg as u,SD as d,Ug as f,Vg as ee,Wg as te,Xg as ne,Yg as re,Zg as ie,_d as p,a_ as ae,bd as m,c_ as oe,d_ as se,dd as h,e_ as ce,f_ as g,fd as _,gD as v,gd as y,hd as b,i_ as le,l_ as ue,ld as x,m_ as S,md as C,n_ as de,o_ as fe,p_ as w,pd as T,qg as E,r_ as D,s_ as pe,t_ as me,u_ as he,ud as O,vd as k,xd as A,xg as ge,yd as j}from"./dist-BPcfIXgJ.js";import{t as M}from"./button-C3LWIgGJ.js";import{$ as N,A as P,C as F,G as I,K as L,M as _e,Mt as ve,Q as R,S as z,W as B,X as V,Y as ye,_ as H,_t as U,b as W,d as G,et as be,f as K,gt as q,j as xe,jt as Se,nt as Ce,ot as we,p as J,q as Te,rt as Ee,x as Y,y as X}from"./index-B--TQi5b.js";import{t as De}from"./FilterBar-Dc-vzhP8.js";import{t as Oe}from"./DataTableShell-CyKGlXVg.js";import{t as ke}from"./DetailChips-Ct8LcwC-.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=a(v.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=a(v.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Q.jsx)(R,{open:n,onOpenChange:r,children:(0,Q.jsxs)(N,{className:`oc-access`,children:[(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(Ee,{children:A({user:t})}),(0,Q.jsx)(be,{children:m()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?j():k()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p()}):d.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):[...f.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=d(v.agents.assignAgent),s=d(v.agents.removeAgent),c=d(v.agents.setDefaultAgent),l=P();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(y(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(b(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(H,{checked:r,disabled:s&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":T({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:_()}):null,e.outOfPool?(0,Q.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:h()}):null,r?o?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":O(),title:O(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(M,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":x(),title:x(),onClick:()=>void f(e.agentId),children:(0,Q.jsx)(q,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=G.filter(e=>n.has(J[e])).length;return(0,Q.jsxs)(B,{children:[(0,Q.jsx)(ye,{asChild:!0,children:(0,Q.jsx)(M,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?S():w({count:r})})}),(0,Q.jsxs)(I,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Te,{children:g()}),G.map(e=>{let r=J[e];return(0,Q.jsxs)(L,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(H,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:K[e]??e})]},e)})]})]})}function Ne(){let e=ve({from:`/settings/users`}),t=Se({from:`/settings/users`}),n=e.q??``,p=e.role??$,m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),g=a(v.admin.listUsers,{filter:{q:n||void 0,role:p===$?void 0:p},withAgents:!0}),_=a(v.me.getMe,{host:we}),y=d(v.admin.setRole),b=d(v.admin.setUserPermissions),x=d(v.admin.startImpersonation),S=d(v.admin.deleteUser),C=d(v.admin.setUserName),w=xe(),T=_e(),O=P(),[k,A]=(0,Z.useState)(null),j=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of g??[])e.add(t.role);return[...e]},[g]),M=n!==``||p!==$;function N(){t({search:{},replace:!0})}async function I(e){try{await y(e)}catch(e){O.error(se(),e)}}async function L(e){try{await b(e)}catch(e){O.error(he(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:D(),description:de({user:t}),confirmWord:me(),confirmLabel:ce(),destructive:!0}))try{await S({profileId:e._id}),O.success(u({user:t}))}catch(e){O.error(r(),e)}}async function B(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:ne(),label:re({user:t}),placeholder:c(),defaultValue:e.name??``,confirmLabel:ge()});if(n!==null)try{await C({profileId:e._id,name:n}),O.success(E())}catch(e){O.error(l(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:m,searchPlaceholder:ue(),onReset:N,canReset:M,children:(0,Q.jsxs)(X,{value:p,onValueChange:h,children:[(0,Q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{value:$,children:oe()}),j.map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:pe(),rows:g,emptyHint:fe(),rowActions:e=>{let t=[{label:i(),onSelect:()=>A({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:ie(),onSelect:()=>void B(e)}];return e.userId!==_?.userId&&t.push({label:ae(),onSelect:()=>void x({profileId:e._id})},{label:le(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:o(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:te(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(X,{value:e.role,onValueChange:t=>void I({profileId:e._id,role:t}),children:[(0,Q.jsx)(z,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(F,{})}),(0,Q.jsxs)(W,{children:[(0,Q.jsx)(Y,{value:`pending`,children:`pending`}),(0,Q.jsx)(Y,{value:`user`,children:`user`}),(0,Q.jsx)(Y,{value:`admin`,children:`admin`})]})]})},{header:f(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:s()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),L({profileId:e._id,permissions:[...n]})}})},{header:ee(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:k?.profileId??null,userLabel:k?.label??``,open:k!==null,onOpenChange:e=>{e||A(null)}})]})}export{Ne as UsersTab};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{dD as n,n as r,t as i}from"./dist-BzNYkP4V.js";e();var a=t(),o=i(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function s({className:e,variant:t=`default`,size:i=`default`,asChild:s=!1,...c}){return(0,a.jsx)(s?n:`button`,{"data-slot":`button`,"data-variant":t,"data-size":i,className:r(o({variant:t,size:i,className:e})),...c})}export{o as n,s as t};
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{dD as n,n as r,t as i}from"./dist-BPcfIXgJ.js";e();var a=t(),o=i(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function s({className:e,variant:t=`default`,size:i=`default`,asChild:s=!1,...c}){return(0,a.jsx)(s?n:`button`,{"data-slot":`button`,"data-variant":t,"data-size":i,className:r(o({variant:t,size:i,className:e})),...c})}export{o as n,s as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-BzNYkP4V.js";e();var r=t();function i({className:e,size:t=`default`,...i}){return(0,r.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:n(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...i})}function a({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-header`,className:n(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-title`,className:n(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-description`,className:n(`text-sm text-muted-foreground`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-content`,className:n(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-footer`,className:n(`flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3`,e),...t})}export{a,l as i,c as n,o,s as r,i as t};
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-BPcfIXgJ.js";e();var r=t();function i({className:e,size:t=`default`,...i}){return(0,r.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:n(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...i})}function a({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-header`,className:n(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-title`,className:n(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-description`,className:n(`text-sm text-muted-foreground`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-content`,className:n(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`card-footer`,className:n(`flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3`,e),...t})}export{a,l as i,c as n,o,s as r,i as t};
@@ -0,0 +1 @@
1
+ import{_D as e}from"./dist-BPcfIXgJ.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
@@ -1 +1 @@
1
- import{Fn as e,Jn as t,Ln as n,Pn as r,Rn as i,zn as a}from"./dist-BzNYkP4V.js";var o=e=>typeof e==`string`?e:null;function s(e){return/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(e=>Number.parseInt(e,10)):null}function c(e,t){let n=s(e),r=s(t);if(n===null||r===null)return null;for(let e=0;e<3;e++){let t=n[e]-r[e];if(t!==0)return t}return 0}function l(e,t){if(e===null||t===null)return!1;let n=c(t,e.min);return n!==null&&n>=0}function u(e,t){let n={range:null,validatedVersions:[]};if(typeof e!=`object`||!e)return n;let r=e.providers;if(typeof r!=`object`||!r)return n;let i=r[t];if(typeof i!=`object`||!i)return n;let a=i,s=null;if(typeof a.supportedRange==`object`&&a.supportedRange!==null){let e=a.supportedRange,t=o(e.min),n=o(e.maxValidated);t!==null&&n!==null&&(s={min:t,maxValidated:n})}let c=Array.isArray(a.validatedVersions)?a.validatedVersions.filter(e=>typeof e==`string`):[];return{range:s,validatedVersions:c}}function d(e,t,n){if(e===null)return`unknown`;let{range:r}=u(n,t);return l(r,e)?r!==null&&(c(e,r.maxValidated)??0)>0?`beyond`:`supported`:`unknown`}function f(e){return e===`supported`?a():e===`beyond`?i():n()}function p(e){return e??t()}function m(t){return t===null?r():e({version:t})}function h(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}export{p as a,m as i,h as n,c as o,f as r,u as s,d as t};
1
+ import{Fn as e,Jn as t,Ln as n,Pn as r,Rn as i,zn as a}from"./dist-BPcfIXgJ.js";var o=e=>typeof e==`string`?e:null;function s(e){return/^\d+\.\d+\.\d+$/.test(e)?e.split(`.`).map(e=>Number.parseInt(e,10)):null}function c(e,t){let n=s(e),r=s(t);if(n===null||r===null)return null;for(let e=0;e<3;e++){let t=n[e]-r[e];if(t!==0)return t}return 0}function l(e,t){if(e===null||t===null)return!1;let n=c(t,e.min);return n!==null&&n>=0}function u(e,t){let n={range:null,validatedVersions:[]};if(typeof e!=`object`||!e)return n;let r=e.providers;if(typeof r!=`object`||!r)return n;let i=r[t];if(typeof i!=`object`||!i)return n;let a=i,s=null;if(typeof a.supportedRange==`object`&&a.supportedRange!==null){let e=a.supportedRange,t=o(e.min),n=o(e.maxValidated);t!==null&&n!==null&&(s={min:t,maxValidated:n})}let c=Array.isArray(a.validatedVersions)?a.validatedVersions.filter(e=>typeof e==`string`):[];return{range:s,validatedVersions:c}}function d(e,t,n){if(e===null)return`unknown`;let{range:r}=u(n,t);return l(r,e)?r!==null&&(c(e,r.maxValidated)??0)>0?`beyond`:`supported`:`unknown`}function f(e){return e===`supported`?a():e===`beyond`?i():n()}function p(e){return e??t()}function m(t){return t===null?r():e({version:t})}function h(e,t){if(typeof e!=`object`||!e)return!1;let n=e.providers;return typeof n!=`object`||!n?!1:t in n}export{p as a,m as i,h as n,c as o,f as r,u as s,d as t};
@@ -1 +1 @@
1
- import{$o as e,Jo as t,Qo as n,Ss as r,Xo as i,Yo as a,Zo as o,_s as s,as as c,bs as l,cs as u,ds as d,es as f,fs as p,gs as m,hs as h,is as g,ls as _,ms as v,ns as y,os as b,ps as x,rs as S,ss as C,ts as w,us as T,vs as E,xs as D,ys as O}from"./dist-BzNYkP4V.js";var k={AGENT_NOT_FOUND:()=>({label:r(),hint:D()}),AUTH_TOKEN_MISMATCH:()=>({label:l(),hint:O()}),DEVICE_SIGNING_FAILED:()=>({label:E(),hint:s()}),SESSION_SCOPE_DENIED:()=>({label:m(),hint:h()}),GATEWAY_TIMEOUT:()=>({label:v(),hint:x()}),GATEWAY_DISCONNECTED:()=>({label:p(),hint:d()}),ATTACHMENT_TOO_LARGE:()=>({label:u(),hint:C()}),ATTACHMENT_REJECTED:()=>({label:b(),hint:c()}),BRIDGE_UNREACHABLE:()=>({label:T(),hint:_()}),INVALID_REQUEST:()=>({label:g(),hint:S()}),NOT_CONFIGURED:()=>({label:y(),hint:w()}),UNROUTED:()=>({label:f(),hint:e()}),UPSTREAM_ERROR:()=>({label:n(),hint:o()}),UNKNOWN:()=>({label:i(),hint:a()})};function A(e){return e?k[e]?.()??{label:e,hint:t()}:k.UNKNOWN()}export{A as t};
1
+ import{$o as e,Jo as t,Qo as n,Ss as r,Xo as i,Yo as a,Zo as o,_s as s,as as c,bs as l,cs as u,ds as d,es as f,fs as p,gs as m,hs as h,is as g,ls as _,ms as v,ns as y,os as b,ps as x,rs as S,ss as C,ts as w,us as T,vs as E,xs as D,ys as O}from"./dist-BPcfIXgJ.js";var k={AGENT_NOT_FOUND:()=>({label:r(),hint:D()}),AUTH_TOKEN_MISMATCH:()=>({label:l(),hint:O()}),DEVICE_SIGNING_FAILED:()=>({label:E(),hint:s()}),SESSION_SCOPE_DENIED:()=>({label:m(),hint:h()}),GATEWAY_TIMEOUT:()=>({label:v(),hint:x()}),GATEWAY_DISCONNECTED:()=>({label:p(),hint:d()}),ATTACHMENT_TOO_LARGE:()=>({label:u(),hint:C()}),ATTACHMENT_REJECTED:()=>({label:b(),hint:c()}),BRIDGE_UNREACHABLE:()=>({label:T(),hint:_()}),INVALID_REQUEST:()=>({label:g(),hint:S()}),NOT_CONFIGURED:()=>({label:y(),hint:w()}),UNROUTED:()=>({label:f(),hint:e()}),UPSTREAM_ERROR:()=>({label:n(),hint:o()}),UNKNOWN:()=>({label:i(),hint:a()})};function A(e){return e?k[e]?.()??{label:e,hint:t()}:k.UNKNOWN()}export{A as t};
@@ -1,4 +1,4 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,JE as i,QE as a,XE as o,YE as s,ZE as c,aD as l,cD as u,eD as d,fD as f,hD as p,iD as m,lD as h,nD as g,tD as _}from"./dist-BzNYkP4V.js";var v=t(e(),1),y=n(),b=`Dialog`,[x,S]=l(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=g({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(E,n),a=p(t,i.triggerRef);return(0,y.jsx)(h.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":q(i.open),...r,ref:a,onClick:u(e.onClick,i.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(_,{present:n||a.open,children:(0,y.jsx)(c,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(_,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=f(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(M,n);return(0,y.jsx)(s,{as:P,allowPinchZoom:!0,shards:[i.contentRef],children:(0,y.jsx)(h.div,{"data-state":q(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(_,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(null),a=p(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return i(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:u(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:u(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:u(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:c,...l}=e,u=w(I,n),d=v.useRef(null),f=p(t,d);return o(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:c,children:(0,y.jsx)(r,{role:`dialog`,id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":q(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Z,{titleId:u.titleId}),(0,y.jsx)($,{contentRef:d,descriptionId:u.descriptionId})]})]})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(h.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(h.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(h.button,{type:`button`,...r,ref:t,onClick:u(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}var J=`DialogTitleWarning`,[Y,X]=m(J,{contentName:I,titleName:V,docsSlug:`dialog`}),Z=({titleId:e})=>{let t=X(J),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,JE as i,QE as a,XE as o,YE as s,ZE as c,aD as l,cD as u,eD as d,fD as f,hD as p,iD as m,lD as h,nD as g,tD as _}from"./dist-BPcfIXgJ.js";var v=t(e(),1),y=n(),b=`Dialog`,[x,S]=l(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=g({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(E,n),a=p(t,i.triggerRef);return(0,y.jsx)(h.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":q(i.open),...r,ref:a,onClick:u(e.onClick,i.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(_,{present:n||a.open,children:(0,y.jsx)(c,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(_,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=f(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(M,n);return(0,y.jsx)(s,{as:P,allowPinchZoom:!0,shards:[i.contentRef],children:(0,y.jsx)(h.div,{"data-state":q(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(_,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(null),a=p(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return i(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:u(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:u(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:u(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:c,...l}=e,u=w(I,n),d=v.useRef(null),f=p(t,d);return o(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(a,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:c,children:(0,y.jsx)(r,{role:`dialog`,id:u.contentId,"aria-describedby":u.descriptionId,"aria-labelledby":u.titleId,"data-state":q(u.open),...l,ref:f,onDismiss:()=>u.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Z,{titleId:u.titleId}),(0,y.jsx)($,{contentRef:d,descriptionId:u.descriptionId})]})]})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(h.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(h.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(h.button,{type:`button`,...r,ref:t,onClick:u(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}var J=`DialogTitleWarning`,[Y,X]=m(J,{contentName:I,titleName:V,docsSlug:`dialog`}),Z=({titleId:e})=>{let t=X(J),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2
2
 
3
3
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
4