@lacneu/atrium 0.10.15 → 0.10.16

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 (61) hide show
  1. package/dist/assets/{AccessTab-BtJ0YziJ.js → AccessTab-C2TDcMit.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-B7F-AiE3.js → AdvancedFilter-DrUoj1oY.js} +1 -1
  3. package/dist/assets/AgentFilesTab-BrBVC0WC.js +3 -0
  4. package/dist/assets/AnomaliesTab-_Jt6y2Sy.js +1 -0
  5. package/dist/assets/AuditTab-C-6Oxrdo.js +1 -0
  6. package/dist/assets/BridgeTab-BhxIgO6W.js +1 -0
  7. package/dist/assets/{ChatDefaultsTab-Du6UayC8.js → ChatDefaultsTab-C9JLQe-F.js} +1 -1
  8. package/dist/assets/{DataTableShell-lk84lOrM.js → DataTableShell-BY48g0WO.js} +1 -1
  9. package/dist/assets/{DetailChips-BEavm_Ac.js → DetailChips-B_6c_-iY.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-C7XVC3Yw.js → FeedbacksTab-28fA354v.js} +1 -1
  11. package/dist/assets/{FieldLabel-CGyzgDBW.js → FieldLabel-BrnlMFJq.js} +2 -2
  12. package/dist/assets/FilesTab-Bt_1sxvl.js +1 -0
  13. package/dist/assets/{FilterBar-DFcZPoFt.js → FilterBar-Cn4lFaY4.js} +1 -1
  14. package/dist/assets/GroupsTab-DNcRR1QL.js +1 -0
  15. package/dist/assets/InstancesTab-CJtDMRcA.js +1 -0
  16. package/dist/assets/{IntegrationsTab-Cwfkq3we.js → IntegrationsTab-CwPWnqkr.js} +1 -1
  17. package/dist/assets/{KpiTab-xPvR9FM_.js → KpiTab-ChPoG2S2.js} +1 -1
  18. package/dist/assets/PreferencesTab-DD8qntSU.js +1 -0
  19. package/dist/assets/{PromptInjectionsTab-EjIpGvU6.js → PromptInjectionsTab-XzEme_aG.js} +2 -2
  20. package/dist/assets/RolesTab-D1aBj2un.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-D30Lhilu.js +1 -0
  22. package/dist/assets/ThemeShowroom-BrXPZ7CL.js +1 -0
  23. package/dist/assets/{TimeRangePicker-BiwaqlSJ.js → TimeRangePicker-BCumk2bf.js} +1 -1
  24. package/dist/assets/TracesTab-DW9c-271.js +1 -0
  25. package/dist/assets/{UsersTab-BnfJCCZi.js → UsersTab-1qfp9sce.js} +1 -1
  26. package/dist/assets/{button-CjrF4jCF.js → button-ClzO6iiY.js} +1 -1
  27. package/dist/assets/{card-Bv3IToK_.js → card-B4hdn0Qh.js} +1 -1
  28. package/dist/assets/chevrons-up-down-B3gRA_gV.js +1 -0
  29. package/dist/assets/{compatView-BfukCKG8.js → compatView-BLkCb0a4.js} +1 -1
  30. package/dist/assets/{dispatchErrorInfo-B8Zuv2Mz.js → dispatchErrorInfo-eTOwTxQJ.js} +1 -1
  31. package/dist/assets/dist-CEGGJ9VY.js +1 -0
  32. package/dist/assets/{dist-DQy6UNW9.js → dist-CfgJ5RDI.js} +1 -1
  33. package/dist/assets/{dist-Ztske_3A.js → dist-D2UVxg3M.js} +1 -1
  34. package/dist/assets/dist-Ygn7c4YX.js +5 -0
  35. package/dist/assets/{highlighted-body-OFNGDK62-DScb7Jhp.js → highlighted-body-OFNGDK62-CwnBPq8J.js} +1 -1
  36. package/dist/assets/index-BsbX_-dh.js +221 -0
  37. package/dist/assets/mermaid-GHXKKRXX-BtlnP6HU.js +1 -0
  38. package/dist/assets/roleDescriptions-Bjw3U0di.js +1 -0
  39. package/dist/assets/{table-uMxWWF9Z.js → table-BYj7Kdzy.js} +1 -1
  40. package/dist/assets/x-TUhW74Oi.js +1 -0
  41. package/dist/index.html +7 -7
  42. package/package.json +1 -1
  43. package/dist/assets/AgentFilesTab-BDiTdf2o.js +0 -3
  44. package/dist/assets/AnomaliesTab-D9_olGON.js +0 -1
  45. package/dist/assets/AuditTab-DXvZQmFV.js +0 -1
  46. package/dist/assets/BridgeTab-BDuniuOs.js +0 -1
  47. package/dist/assets/FilesTab-oHDctIIE.js +0 -1
  48. package/dist/assets/GroupsTab-Dr-tZ0OB.js +0 -1
  49. package/dist/assets/InstancesTab-nfr3JEEX.js +0 -1
  50. package/dist/assets/PreferencesTab-BfYRXVKJ.js +0 -1
  51. package/dist/assets/RolesTab-ByMxMpI5.js +0 -1
  52. package/dist/assets/ServiceAccountsTab-FKu4_5yB.js +0 -1
  53. package/dist/assets/ThemeShowroom-CaQHQZFb.js +0 -1
  54. package/dist/assets/TracesTab-DxuzyseF.js +0 -1
  55. package/dist/assets/chevrons-up-down-B_Xo1k1h.js +0 -1
  56. package/dist/assets/dist-B7_ufbgZ.js +0 -1
  57. package/dist/assets/dist-KXhBVgxk.js +0 -5
  58. package/dist/assets/index-nY1Cemm1.js +0 -221
  59. package/dist/assets/mermaid-GHXKKRXX-CaUAsyRa.js +0 -1
  60. package/dist/assets/roleDescriptions-EkLHQ7dr.js +0 -1
  61. package/dist/assets/x-12vni2tJ.js +0 -1
@@ -0,0 +1 @@
1
+ import{D as e}from"./index-BsbX_-dh.js";export{e as Mermaid};
@@ -0,0 +1 @@
1
+ import{Cd as e,Ed as t,Sd as n,Td as r,wd as i}from"./dist-CfgJ5RDI.js";var a={pending:t,user:r,admin:i,observer:e,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-DQy6UNW9.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{n}from"./dist-CfgJ5RDI.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -0,0 +1 @@
1
+ import{lw as e}from"./dist-CfgJ5RDI.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
package/dist/index.html CHANGED
@@ -38,14 +38,14 @@
38
38
  document.documentElement.dataset.ambiance = a === "off" ? "off" : "on";
39
39
  })();
40
40
  </script>
41
- <script type="module" crossorigin src="/assets/index-nY1Cemm1.js"></script>
41
+ <script type="module" crossorigin src="/assets/index-BsbX_-dh.js"></script>
42
42
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
43
- <link rel="modulepreload" crossorigin href="/assets/dist-DQy6UNW9.js">
44
- <link rel="modulepreload" crossorigin href="/assets/dist-B7_ufbgZ.js">
45
- <link rel="modulepreload" crossorigin href="/assets/dist-KXhBVgxk.js">
46
- <link rel="modulepreload" crossorigin href="/assets/dist-Ztske_3A.js">
47
- <link rel="modulepreload" crossorigin href="/assets/x-12vni2tJ.js">
48
- <link rel="modulepreload" crossorigin href="/assets/button-CjrF4jCF.js">
43
+ <link rel="modulepreload" crossorigin href="/assets/dist-CfgJ5RDI.js">
44
+ <link rel="modulepreload" crossorigin href="/assets/dist-CEGGJ9VY.js">
45
+ <link rel="modulepreload" crossorigin href="/assets/dist-Ygn7c4YX.js">
46
+ <link rel="modulepreload" crossorigin href="/assets/dist-D2UVxg3M.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/x-TUhW74Oi.js">
48
+ <link rel="modulepreload" crossorigin href="/assets/button-ClzO6iiY.js">
49
49
  <link rel="stylesheet" crossorigin href="/assets/index-BftON7pu.css">
50
50
  </head>
51
51
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.10.15",
3
+ "version": "0.10.16",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,B as i,Dv as a,F as o,G as s,Gt as c,H as l,I as u,IC as d,J as f,K as p,L as m,PC as h,Q as ee,R as g,U as _,Ut as te,V as v,W as y,X as ne,Y as b,Z as x,at as re,ct as S,dw as C,et as ie,it as ae,lt as w,mw as T,nt as oe,ot as E,q as D,rt as O,st as k,sw as A,tt as se,ut as j,z as M}from"./dist-DQy6UNW9.js";import{t as N}from"./button-CjrF4jCF.js";import{B as P,C as F,F as I,G as L,H as ce,I as le,K as ue,P as de,R as fe,S as R,U as pe,V as me,W as he,_ as z,b as B,j as ge,m as _e,mt as V,ot as H,q as ve,x as U,y as W,z as ye}from"./index-nY1Cemm1.js";import{i as G}from"./compatView-BfukCKG8.js";/* empty css */var K=t(e(),1),q=2e4,J=6e4;function Y(e){return typeof e!=`number`||e<=0?0:Math.round(e/q*100)}function X(e){return e<=0?0:Math.round(e/J*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function be(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var xe=3;function Se(e,t){let n=new Map;for(let t of e.split(`
2
- `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<xe&&a.push(e)):t>0&&(i+=t,o.length<xe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function Ce(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function we(){let e=T(A.me.getMe,{host:H}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=T(A.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=T(A.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=T(A.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),l=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[u,f]=(0,K.useState)(null);(0,K.useEffect)(()=>{!l||l.length===0||(!u||!l.some(e=>$(e)===u))&&f($(l[0]))},[l,u]);let p=l?.find(e=>$(e)===u)??null,m=C(A.agentFiles.listAgentFiles),[g,_]=(0,K.useState)({status:`idle`}),v=p?.instanceName??null,y=p?.agentId??null,ne=T(A.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),b=n&&v!==null?z(ne,`agentFiles`):null,x=b===null?!1:b===`loading`?null:b.blocked,D=(0,K.useCallback)(async()=>{if(!(v===null||y===null)){_({status:`loading`});try{_({status:`done`,files:(await m({instanceName:v,agentId:y})).files})}catch{_({status:`error`})}}},[m,v,y]);(0,K.useEffect)(()=>{x===!1&&D()},[D,x]);let[M,P]=(0,K.useState)(null),I=d(),L=(0,K.useMemo)(()=>new Intl.NumberFormat(I,{maximumFractionDigits:0}),[I]);return e===void 0||l===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(W,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":w(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:(i??[]).map(e=>(0,Q.jsx)(U,{value:e.name,children:e.name},e.name))})]}):null,l.length>0?(0,Q.jsxs)(W,{value:u??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(R,{size:`sm`,"aria-label":S(),children:(0,Q.jsx)(F,{})}),(0,Q.jsx)(B,{children:l.map(e=>(0,Q.jsx)(U,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()})]}),p===null?null:b===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):b!==null&&b.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(V,{size:14,"aria-hidden":!0}),` `,G(b.gatewayVersion)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[re(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:te()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Y(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(_e,{variant:`outline`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:O({size:Z(e.size,I)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:oe({pct:L.format(n)})}),i?(0,Q.jsx)(V,{size:14,className:`oc-afiles__warn`,"aria-label":se()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?r():ee()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ie({used:Z(be(g.files),I),total:Z(J,I),pct:L.format(X(be(g.files)))})})]}),M&&p?(0,Q.jsx)(Te,{instanceName:p.instanceName,agentId:p.agentId,name:M.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void D()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:ee,onSaved:re}){let S=C(A.agentFiles.getAgentFile),ie=C(A.agentFiles.setAgentFile),ae=ge(),[w,T]=(0,K.useState)(null),[oe,E]=(0,K.useState)(!1),[O,k]=(0,K.useState)(``),[se,j]=(0,K.useState)(!1),[F,R]=(0,K.useState)(!1),[z,B]=(0,K.useState)(!1),[_e,V]=(0,K.useState)(!1),H=(0,K.useCallback)(async r=>{E(!1);try{let i=await S({instanceName:e,agentId:t,name:n});T({content:i.content,updatedAtMs:i.updatedAtMs}),r||k(i.content),B(!1)}catch{E(!0)}},[S,e,t,n]);(0,K.useEffect)(()=>{H(!1)},[H]);async function U(){if(w!==null){R(!0),V(!1);try{await ie({instanceName:e,agentId:t,name:n,content:O,baseUpdatedAtMs:w.updatedAtMs??void 0}),ae.success(s({name:n})),re(),await H(!1)}catch(e){Ce(e)?B(!0):V(!0)}finally{R(!1)}}}let W=w!==null&&O!==w.content,G=(0,K.useMemo)(()=>w===null?null:Se(w.content,O),[w,O]),J=O.length>q,Y=d(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(de,{open:!0,onOpenChange:e=>!e&&ee(),children:(0,Q.jsxs)(I,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(ye,{children:x({name:n})}),(0,Q.jsxs)(le,{children:[ne({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,b()]})]})]}),oe?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!1),children:te()})]}):w===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:O,readOnly:!r,spellCheck:!1,onChange:e=>k(e.target.value),"aria-label":x({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:f()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[l(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void H(!0),children:v()})]}):null,_e?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:y()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:D({count:X.format(O.length),max:X.format(q)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!W||F||z,onClick:()=>j(!0),children:F?c():p()}):null]})]}),(0,Q.jsx)(P,{open:se,onOpenChange:j,children:(0,Q.jsxs)(pe,{children:[(0,Q.jsxs)(ue,{children:[(0,Q.jsx)(ve,{children:i({name:n})}),(0,Q.jsx)(he,{children:M({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:g({added:G.added,removed:G.removed})}),G.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:m()}),G.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,G.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:u()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(L,{children:[(0,Q.jsx)(ce,{children:a()}),(0,Q.jsx)(me,{onClick:()=>void U(),children:o()})]})]})})]})})}export{we as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Au as i,Bu as ee,Du as a,Eu as o,Fu as te,Gu as ne,Hu as s,Iu as c,Ju as l,Ku as u,Lu as d,Mu as re,Nu as ie,Ou as ae,Pu as oe,Qu as se,Ru as ce,Tu as f,Uu as p,Vu as m,Wu as le,Xu as h,Yu as g,Zu as _,ad as ue,cd as de,dd as v,ed as fe,fd as y,id as pe,ju as me,ku as he,ld as b,mw as x,nd as S,od as C,pw as w,qu as T,rd as E,sd as D,sw as O,td as k,ud as A,wu as j,zu as M}from"./dist-DQy6UNW9.js";import{n as N}from"./TimeRangePicker-BiwaqlSJ.js";import{C as P,M as F,Ot as I,S as L,a as R,b as z,j as ge,kt as _e,m as B,ot as ve,r as ye,x as V,y as H}from"./index-nY1Cemm1.js";import{t as U}from"./FilterBar-DFcZPoFt.js";import{t as be}from"./DataTableShell-lk84lOrM.js";import{t as W}from"./dispatchErrorInfo-B8Zuv2Mz.js";var G=t(e(),1),K=n(),q=`__all__`,xe=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Se(e){return e===`open`?y():e===`acknowledged`?v():A()}var Ce=[`info`,`warn`,`critical`],we=[`detector`,`agent`],Te={kind:`relative`,from:`now-30d`,to:`now`},Ee=200,J=`all`;function Y(){let e=_e({from:`/settings/anomalies`}),t=I({from:`/settings/anomalies`}),n=e.q??``,a=e.status===J?q:e.status,o=e.severity??q,f=e.kind??q,[v,y]=(0,G.useState)(q),A=ye(e.from,e.to),{from:j,to:W}=N(A),Y=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),X=e=>void t({search:t=>({...t,status:e===q?J:e})}),je=e=>void t({search:t=>({...t,severity:e===q?void 0:e})}),Me=e=>void t({search:t=>({...t,kind:e===q?void 0:e})}),Ne=e=>void t({search:t=>({...t,...R(e)})}),Pe=F(),Z=ge(),Q=w(O.anomalies.resolveAnomaly),Fe=(x(O.me.getMe,{host:ve})?.permissions??[]).includes(`admin.manage`),$=x(O.anomalies.listAnomalies,{limit:Ee,filter:{q:n||void 0,from:j,to:W,anomalyStatus:a===q?void 0:a,severity:o===q?void 0:o,source:v===q?void 0:v,kind:f===q?void 0:f}}),Ie=(0,G.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.kind);return[...e].sort()},[$]),Le=n!==``||a!==`open`||o!==q||v!==q||f!==q||A.kind!==`relative`||A.from!==Te.from;function Re(){y(q),t({search:{status:`open`},replace:!0})}async function ze(e){if(await Pe({title:b(),description:(0,K.jsxs)(K.Fragment,{children:[de(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,D(),` `,(0,K.jsx)(`strong`,{children:C()}),`.`,` `,ue()]}),confirmLabel:pe()}))try{await Q({anomalyId:e._id,status:`resolved`}),Z.success(E(),e.kind)}catch(e){Z.error(S(),e)}}async function Be(e){try{await Q({anomalyId:e._id,status:`acknowledged`}),Z.success(k(),e.kind)}catch(e){Z.error(fe(),e)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,K.jsx)(`strong`,{children:se()}),` `,_(),` `,(0,K.jsx)(`strong`,{children:h()}),` `,g(),` `,(0,K.jsx)(`strong`,{children:l()}),` `,T(),` `,(0,K.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,K.jsxs)(U,{q:n,onQChange:Y,searchPlaceholder:ne(),timeRange:A,onTimeRangeChange:Ne,onReset:Re,canReset:Le,children:[(0,K.jsxs)(H,{value:a,onValueChange:X,children:[(0,K.jsx)(L,{size:`sm`,className:`w-36`,children:(0,K.jsx)(P,{})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:le()}),xe.map(e=>(0,K.jsx)(V,{value:e.value,children:Se(e.value)},e.value))]})]}),(0,K.jsxs)(H,{value:o,onValueChange:je,children:[(0,K.jsx)(L,{size:`sm`,className:`w-36`,children:(0,K.jsx)(P,{placeholder:p()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:s()}),Ce.map(e=>(0,K.jsx)(V,{value:e,children:e},e))]})]}),(0,K.jsxs)(H,{value:v,onValueChange:y,children:[(0,K.jsx)(L,{size:`sm`,className:`w-32`,children:(0,K.jsx)(P,{placeholder:m()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:ee()}),we.map(e=>(0,K.jsx)(V,{value:e,children:e},e))]})]}),(0,K.jsxs)(H,{value:f,onValueChange:Me,children:[(0,K.jsx)(L,{size:`sm`,className:`w-36`,children:(0,K.jsx)(P,{placeholder:M()})}),(0,K.jsxs)(z,{children:[(0,K.jsx)(V,{value:q,children:ce()}),Ie.map(e=>(0,K.jsx)(V,{value:e,children:e},e))]})]})]}),(0,K.jsx)(be,{title:d(),rows:$,emptyHint:a===`open`?c():te(),rowActions:e=>Fe&&e.status===`open`?[{label:oe(),onSelect:()=>void ze(e)},{label:ie(),onSelect:()=>void Be(e)}]:[],columns:[{header:re(),cell:e=>(0,K.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)}),sort:e=>e.at},{header:M(),cell:e=>(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:p(),cell:e=>(0,K.jsx)(Oe,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:me(),cell:e=>(0,K.jsx)(ke,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:m(),cell:e=>(0,K.jsx)(B,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:i(),cell:e=>(0,K.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:he(),cell:e=>(0,K.jsx)(De,{row:e}),sort:e=>e.evidence??null},{header:ae(),cell:e=>e.correlationId?(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:Ae(e.correlationId)}):(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function X(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function De({row:e}){let t=I(),n=X(e);if(!n.dominantCode)return(0,K.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=W(n.dominantCode),i=n.sampleCorrelationId;return(0,K.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,K.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,K.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,K.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,K.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,K.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,a()]}):null]})}function Oe({severity:e}){return(0,K.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function ke({status:e}){return e===`open`?(0,K.jsx)(B,{variant:`destructive`,children:o()}):e===`acknowledged`?(0,K.jsx)(B,{variant:`secondary`,children:f()}):(0,K.jsx)(B,{variant:`outline`,children:j()})}function Ae(e){return e.length>8?e.slice(0,8):e}export{Y as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_f as ee,af as r,cf as i,df as a,ff as o,gf as s,hf as c,if as l,lf as u,mf as d,mw as f,of as p,pf as m,rf as h,sf as g,sw as _,uf as v}from"./dist-DQy6UNW9.js";import{n as y}from"./TimeRangePicker-BiwaqlSJ.js";import{C as b,Ot as x,S,a as C,b as w,i as T,kt as E,o as D,r as O,t as k,x as A,y as j}from"./index-nY1Cemm1.js";import{t as M}from"./FilterBar-DFcZPoFt.js";import{t as N}from"./AdvancedFilter-B7F-AiE3.js";import{t as P}from"./DataTableShell-lk84lOrM.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:k,to:`now`},R=`__all__`,z=[{value:`action`,label:`action`},{value:`realLabel`,label:`acteur réel`},{value:`targetLabel`,label:`au nom de`},{value:`impersonated`,label:`usurpation`},{value:`resource`,label:`ressource`},{value:`resourceId`,label:`id ressource`}];function B(){let e=E({from:`/settings/audit`}),t=x({from:`/settings/audit`}),n=e.q??``,k=e.action??R,B=e.impersonated??R,V=e.resource??R,H=O(e.from,e.to),U=(0,F.useMemo)(()=>D(e.adv),[e.adv]),{from:W,to:G}=y(H),K=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),q=e=>void t({search:t=>({...t,action:e===R?void 0:e})}),J=e=>void t({search:t=>({...t,impersonated:e===R?void 0:e})}),Y=e=>void t({search:t=>({...t,resource:e===R?void 0:e})}),X=e=>void t({search:t=>({...t,...C(e)})}),Z=e=>void t({search:t=>({...t,adv:T(e)}),replace:!0}),Q=f(_.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:k===R?void 0:k,resource:V===R?void 0:V,impersonated:B===R?void 0:B===`yes`,advanced:U.length>0?U:void 0}}),$=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.action);return[...e].sort()},[Q]),te=(0,F.useMemo)(()=>{let e=new Set;for(let t of Q??[])t.resource&&e.add(t.resource);return[...e].sort()},[Q]),ne=n!==``||k!==R||B!==R||V!==R||U.length>0||H.kind!==`relative`||H.from!==L.from;function re(){t({search:{},replace:!0})}return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:c(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(j,{value:k,onValueChange:q,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:d()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:m()}),$.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]}),(0,I.jsxs)(j,{value:B,onValueChange:J,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:o()}),(0,I.jsx)(A,{value:`yes`,children:a()}),(0,I.jsx)(A,{value:`no`,children:v()})]})]}),(0,I.jsxs)(j,{value:V,onValueChange:Y,children:[(0,I.jsx)(S,{size:`sm`,className:`w-40`,children:(0,I.jsx)(b,{placeholder:u()})}),(0,I.jsxs)(w,{children:[(0,I.jsx)(A,{value:R,children:i()}),te.map(e=>(0,I.jsx)(A,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:g(),rows:Q,emptyHint:p(),columns:[{header:r(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:d(),cell:e=>e.action,sort:e=>e.action},{header:l(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:h(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:u(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{B as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{As as r,Bs as i,Cs as a,Ds as o,Ec as s,Es as c,Fs as l,Gs as u,Hs as d,Is as f,Ls as p,Ms as m,Ns as h,Os as g,Ps as _,Rs as ee,Sc as te,Ss as v,Tc as y,Ts as b,Us as ne,Vs as re,Ws as ie,_ as x,_c as ae,_s as S,a as C,as as w,b as oe,bc as se,bs as ce,cs as le,cw as T,d as ue,ds as de,dw as fe,f as pe,fs as me,g as he,gc as ge,gs as _e,h as ve,hc as ye,hs as be,is as E,js as xe,ks as Se,l as Ce,ls as we,m as Te,mc as Ee,ms as De,mw as D,os as Oe,p as ke,pc as Ae,ps as je,pw as Me,rs as Ne,ss as Pe,sw as O,u as Fe,us as Ie,v as Le,vc as Re,vs as ze,wc as Be,ws as Ve,xc as He,xs as Ue,y as We,yc as Ge,ys as Ke,zs as qe}from"./dist-DQy6UNW9.js";import{i as k,r as Je}from"./dist-B7_ufbgZ.js";import{t as Ye}from"./chevrons-up-down-B_Xo1k1h.js";import{a as Xe,i as Ze,n as A,o as Qe,r as $e}from"./FieldLabel-CGyzgDBW.js";import{t as j}from"./button-CjrF4jCF.js";import{$ as et,C as M,Ct as tt,Dt as nt,Et as N,F as rt,I as it,J as P,O as at,Ot as ot,P as st,Q as ct,R as lt,S as F,St as ut,X as dt,Y as ft,Z as pt,_t as mt,b as I,et as ht,j as gt,m as L,mt as R,ot as _t,rt as vt,x as z,y as B,z as yt}from"./index-nY1Cemm1.js";import{a as bt,i as V,n as xt,o as H,r as U,t as St}from"./table-uMxWWF9Z.js";import{t as Ct}from"./FilterBar-DFcZPoFt.js";import{a as W,n as wt,o as G,r as Tt,s as Et,t as Dt}from"./compatView-BfukCKG8.js";import{t as K}from"./dispatchErrorInfo-B8Zuv2Mz.js";var Ot=T(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),kt=T(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),q=t(e(),1);function At(e){return e.filter(e=>e.state===`error`)}function jt(e){return e.reachable&&At(e.targets).length===0}function Mt(e){return e.state===`error`&&e.lastErrorCode!==null}function Nt(e){return!!e.lastDownstreamRejectCode}function J(e){return e.kind??`openclaw`}function Pt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function Ft(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,J(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(J(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Pt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>J(e)===r)}))}function It(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,Lt={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function Rt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function zt(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Bt(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function Vt(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return G(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function Ht(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=Bt(t.key,e),a=Bt(t.key,r);return i&&a?0:i?1:a?-1:n*Vt(t.key,e,r)})}function Ut(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function Wt(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function Gt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>G(e,t)??Z(e,t))}var Q=n();function Kt({connections:e,displayByInstance:t}){let[n,r]=(0,q.useState)(Lt),[i,a]=(0,q.useState)(null),o=(0,q.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount,attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,q.useMemo)(()=>Ut(o),[o]),c=(0,q.useMemo)(()=>Wt(o),[o]),l=(0,q.useMemo)(()=>Gt(o),[o]),u=(0,q.useMemo)(()=>Ht(zt(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ct,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:ze(),onReset:()=>r(Lt),canReset:Rt(n),children:[(0,Q.jsxs)(B,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(F,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:_e()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(z,{value:Y,children:S()}),s.map(e=>(0,Q.jsx)(z,{value:e,children:Jt(e)},e))]})]}),(0,Q.jsxs)(B,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(M,{placeholder:be()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(z,{value:Y,children:S()}),c.map(e=>(0,Q.jsx)(z,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(B,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(F,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(M,{placeholder:De()})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(z,{value:Y,children:S()}),l.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:je()}):(0,Q.jsxs)(St,{className:`oc-conn__table`,children:[(0,Q.jsx)(bt,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:me(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:de(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ie(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:we(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:le(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(V,{children:Pe()}),(0,Q.jsx)($,{label:Oe(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(xt,{children:u.map(e=>(0,Q.jsx)(qt,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(Je,{size:13,"aria-hidden":!0}):(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Ye,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function qt({r:e}){let t=Mt(e)?K(e.lastErrorCode):null,n=Nt(e)?K(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(q.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Yt,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:ce({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ke({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Jt(e){return e===`connected`?w():e===`error`?E():Ne()}function Yt({state:e}){return e===`connected`?(0,Q.jsx)(L,{variant:`secondary`,children:w()}):e===`error`?(0,Q.jsx)(L,{variant:`destructive`,children:E()}):(0,Q.jsx)(L,{variant:`outline`,children:Ne()})}function Xt(){return D(O.bridgeHealth.getBridgeHealth,{})}function Zt(){let e=Xt(),t=D(O.compat.getBridgeCompat,{}),n=D(O.me.getMe,{host:_t})?.role===`admin`,r=D(O.admin.listInstances,n?{}:`skip`),i=ot(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=Ft(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&wt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Qt,{health:e,compat:t,onSeeAnomalies:a}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:xe()}),o.map(e=>(0,Q.jsx)($t,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):null]})}function Qt({health:e,compat:t,onSeeAnomalies:n}){let i=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:W(t.bridgeVersion)}),` · `,Le(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Se()});let s=At(e.targets),l=!e.reachable,u=jt(e),d=u?`ok`:`error`,f=new Date(e.checkedAt).toLocaleString(`fr-FR`),p=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Q.jsx)(N,{size:22}):l?(0,Q.jsx)(kt,{size:22}):(0,Q.jsx)(R,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?g():l?o():c({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Ot,{size:12,"aria-hidden":!0}),` `,b({time:f})]}),p?(0,Q.jsx)(`span`,{children:Ve({time:p})}):null,i]}),l?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:K(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:a()})]})}function $t({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?Et(r,e):null,s=new Map;for(let e of n)s.set(e.name,e.displayName??e.name);let c=[],l=new Set;for(let n of t){if(!n.instanceName||l.has(n.instanceName))continue;l.add(n.instanceName);let t=n.gatewayVersion??null;c.push({instanceName:n.instanceName,displayName:s.get(n.instanceName)??n.instanceName,version:t,state:Dt(t,e,r)})}let u=c.map(e=>e.state),d=u.includes(`beyond`)?`beyond`:u.length>0&&u.every(e=>e===`supported`)?`supported`:null,[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(null),g=m===null?null:n.find(e=>e.name===m)??null,_=new Set(n.map(e=>e.name));return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(mt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:It(e)}),d?(0,Q.jsx)(L,{variant:d===`beyond`?`destructive`:`secondary`,children:Tt(d)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:oe()}),(0,Q.jsx)(en,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c,canConfigure:e=>_.has(e),onConfigure:h}),(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(nt,{size:13,"aria-hidden":!0}),v({count:t.length})]}),f?(0,Q.jsx)(Kt,{connections:t,displayByInstance:s}):null,g?(0,Q.jsx)(tn,{instance:g,onClose:()=>h(null)},g._id):null]})}function en({support:e,compatStatus:t,compatReachable:n,manifest:i,instanceRows:a,canConfigure:o,onConfigure:s}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:he()}),i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Te()}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:ke({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:x()}),e?(0,Q.jsx)(an,{versions:e.validatedVersions}):null]}),a.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:W(e.version)}),(0,Q.jsx)(L,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Tt(e.state)}),o(e.instanceName)?(0,Q.jsxs)(ct,{children:[(0,Q.jsx)(vt,{asChild:!0,children:(0,Q.jsx)(j,{variant:`ghost`,size:`icon`,className:`oc-compat__target-menu`,"aria-label":y(),children:(0,Q.jsx)(tt,{size:16,"aria-hidden":!0})})}),(0,Q.jsx)(et,{align:`end`,children:(0,Q.jsx)(ht,{onSelect:()=>s(e.instanceName),children:y()})})]}):null]},e.instanceName))})]})}function tn({instance:e,onClose:t}){return(0,Q.jsx)(st,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(lt,{children:[(0,Q.jsx)(yt,{children:s({instance:e.displayName??e.name})}),(0,Q.jsx)(it,{children:Be()})]}),(0,Q.jsx)(rn,{instance:e,onClose:t})]})})}function nn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(N,{"aria-hidden":!0}):(0,Q.jsx)(R,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?l():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,_()]}):null}function rn({instance:e,onClose:t}){let n=Me(O.admin.upsertInstanceConfig),r=fe(O.bridge.validateMediaPaths),a=gt(),[o,s]=(0,q.useState)(()=>Ze(e.config??{})),[c,l]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(null),b=o.inboundMediaMode===`shared-fs`,x=o.mediaMode===`shared-fs`,S=b||x;async function C(){_(!0),y(null);try{y(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(qe(),e)}finally{_(!1)}}async function w(){l(!0);try{let r=e.config??{};await n({instanceId:e._id,config:$e(o,r)}),t()}catch(e){a.error(ae(),e)}finally{l(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:te(),help:ge()}),(0,Q.jsxs)(B,{value:o.mediaMode,onValueChange:e=>s({...o,mediaMode:e}),children:[(0,Q.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(I,{children:Qe.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:He(),help:ye()}),(0,Q.jsxs)(B,{value:o.inboundMediaMode,onValueChange:e=>s({...o,inboundMediaMode:e}),children:[(0,Q.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(I,{children:Xe.map(e=>(0,Q.jsx)(z,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:se(),help:Ee()}),(0,Q.jsx)(P,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>s({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),S&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:u(),help:ie()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>s({...o,inboundAgentMount:e.target.value})})]}),x&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:ne(),help:d()}),(0,Q.jsx)(P,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>s({...o,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(at,{checked:o.rehydration,onCheckedChange:e=>s({...o,rehydration:e===!0})}),(0,Q.jsx)(A,{label:Ge(),help:Ae()})]}),S&&v!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:v.reachable?!v.inbound&&!v.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(R,{"aria-hidden":!0}),m({reason:v.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(nn,{label:p(),result:v.inbound}),(0,Q.jsx)(nn,{label:f(),result:v.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(R,{"aria-hidden":!0}),h()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[S&&(0,Q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void C(),disabled:g,children:[g?(0,Q.jsx)(ut,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?i():re()]}),(0,Q.jsx)(j,{size:`sm`,onClick:()=>void w(),disabled:c,children:Re()})]})]})})}function an({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(ft,{children:[(0,Q.jsx)(pt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pe():ue({count:e.length}),(0,Q.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(dt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:Fe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(L,{variant:`secondary`,children:e},e))})]})]})}export{Zt as BridgeTab,tn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,BS as ee,Dv as te,FS as ne,GS as re,HS as ie,IC as ae,IS as oe,JS as i,KS as a,LS as o,MS as s,NS as c,PC as l,PS as se,QS as u,RS as ce,US as le,VS as ue,WS as de,XS as d,YS as f,ZS as p,aC as fe,cC as m,dC as pe,eC as h,fC as me,iC as he,jS as ge,lC as g,mw as _e,nC as ve,oC as ye,pw as _,qS as v,rC as y,sC as b,sw as x,tC as S,uC as C,zS as w}from"./dist-DQy6UNW9.js";import{t as T}from"./button-CjrF4jCF.js";import{$ as E,B as D,C as O,Ct as k,G as A,H as j,K as M,Q as N,S as P,U as be,V as xe,W as Se,b as F,et as I,ht as Ce,j as we,m as Te,q as Ee,rt as De,wt as L,x as R,y as z,yt as Oe}from"./index-nY1Cemm1.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-uMxWWF9Z.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return S();case`audio`:return h();case`video`:return r();case`pdf`:return u();case`document`:return p();case`archive`:return d();default:return f()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[u,d]=(0,U.useState)(G),[f,p]=(0,U.useState)(G),[h,S]=(0,U.useState)(null),q=_(x.files.softDelete),J=we();function Me(){t(G),r(G),d(G),p(G)}async function Ne(){let e=h;if(S(null),e)try{await q({fileId:e.id}),J.success(ce())}catch(e){J.error(o(),e)}}let Y=_e(x.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:u===G?void 0:u,category:f===G?void 0:f}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(ae(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||u!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(z,{value:e,onValueChange:t,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":pe(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:C()}),(0,W.jsx)(R,{value:`inbound`,children:g()}),(0,W.jsx)(R,{value:`outbound`,children:m()})]})]}),(0,W.jsxs)(z,{value:n,onValueChange:r,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":b(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:ye()}),Q.chats.map(e=>(0,W.jsx)(R,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(z,{value:u,onValueChange:d,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":fe(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:he()}),Q.instances.map(e=>(0,W.jsx)(R,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(z,{value:f,onValueChange:p,children:[(0,W.jsx)(P,{size:`sm`,"aria-label":y(),children:(0,W.jsx)(O,{})}),(0,W.jsxs)(F,{children:[(0,W.jsx)(R,{value:G,children:ve()}),Q.categories.map(e=>(0,W.jsx)(R,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Oe,{size:14,"aria-hidden":!0}),ue()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?s():c()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(je,{children:[(0,W.jsx)(ke,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:i()}),(0,W.jsx)(B,{children:v()}),(0,W.jsx)(B,{children:a()}),(0,W.jsx)(B,{children:re()}),(0,W.jsx)(B,{children:de()}),(0,W.jsx)(B,{className:`text-right`,children:le()})]})}),(0,W.jsx)(Ae,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsx)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:e.filename}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(Te,{variant:`secondary`,children:e.direction===`inbound`?g():m()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:X.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(N,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":ee(),children:(0,W.jsx)(k,{size:16})})}),(0,W.jsxs)(E,{align:`end`,children:[e.url?(0,W.jsx)(I,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(L,{size:14}),ie()]})}):(0,W.jsxs)(I,{disabled:!0,children:[(0,W.jsx)(L,{size:14}),se()]}),(0,W.jsxs)(I,{variant:`destructive`,onSelect:()=>S({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ce,{size:14}),w()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ge({cap:Fe})}):null]}),(0,W.jsx)(D,{open:h!==null,onOpenChange:e=>!e&&S(null),children:(0,W.jsxs)(be,{children:[(0,W.jsxs)(M,{children:[(0,W.jsx)(Ee,{children:oe()}),(0,W.jsx)(Se,{children:ne()})]}),(0,W.jsxs)(A,{children:[(0,W.jsx)(j,{children:te()}),(0,W.jsx)(xe,{onClick:()=>void Ne(),children:w()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,$n as i,An as a,Bn as o,Cn as s,Dn as c,En as l,Fn as u,GC as d,Gn as f,Hn as p,In as m,Jn as h,KC as g,Kn as _,Ln as v,Mn as y,Nn as b,On as x,Pn as S,Qn as C,Rn as ee,Sn as w,Tn as te,Un as ne,Vn as re,Wn as ie,XC as T,Xn as E,Yn as ae,Zn as D,_n as O,an as oe,ar as se,bn as k,cn as ce,cr as A,cw as j,dn as le,dr as ue,er as M,ew as N,fn as P,fr as de,gn as fe,hn as pe,in as me,ir as he,jn as ge,kn as _e,ln as ve,lr as ye,mn as be,mw as F,n as I,nr as xe,on as Se,or as Ce,pn as we,pw as L,qC as Te,qn as Ee,rn as De,rr as Oe,sn as R,sr as ke,sw as z,t as Ae,tr as je,un as Me,ur as Ne,vn as Pe,wn as Fe,xn as Ie,yn as Le,zn as Re}from"./dist-DQy6UNW9.js";import{t as ze}from"./dist-B7_ufbgZ.js";import{t as Be}from"./x-12vni2tJ.js";import{t as B}from"./button-CjrF4jCF.js";import{C as Ve,Dt as He,F as Ue,I as We,J as V,M as Ge,O as H,P as Ke,R as qe,S as Je,_t as U,b as Ye,dt as Xe,ft as Ze,gt as W,h as Qe,j as G,m as K,ot as $e,pt as et,x as tt,y as nt,z as rt}from"./index-nY1Cemm1.js";import{t as it}from"./FilterBar-DFcZPoFt.js";import{t as at}from"./DataTableShell-lk84lOrM.js";import{t as q}from"./DetailChips-BEavm_Ac.js";var ot=j(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),st=j(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),J=j(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ct=j(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Y=t(e(),1),X=n(),Z=`Tabs`,[lt,ut]=T(Z,[et]),dt=et(),[ft,Q]=lt(Z),pt=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=ze(s),[f,p]=Te({prop:r,onChange:i,defaultProp:a??``,caller:Z});return(0,X.jsx)(ft,{scope:n,baseId:d(),value:f,onValueChange:p,orientation:o,dir:u,activationMode:c,children:(0,X.jsx)(N.div,{dir:u,"data-orientation":o,...l,ref:t})})});pt.displayName=Z;var mt=`TabsList`,ht=Y.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Q(mt,n),o=dt(n);return(0,X.jsx)(Ze,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,X.jsx)(N.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ht.displayName=mt;var gt=`TabsTrigger`,_t=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=Q(gt,n),c=dt(n),l=bt(s.baseId,i),u=xt(s.baseId,i),d=i===s.value;return(0,X.jsx)(Xe,{asChild:!0,...c,focusable:!a,active:d,children:(0,X.jsx)(N.button,{type:`button`,role:`tab`,"aria-selected":d,"aria-controls":u,"data-state":d?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:r(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:r(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:r(e.onFocus,()=>{let e=s.activationMode!==`manual`;!d&&!a&&e&&s.onValueChange(i)})})})});_t.displayName=gt;var vt=`TabsContent`,yt=Y.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Q(vt,n),c=bt(s.baseId,r),l=xt(s.baseId,r),u=r===s.value,d=Y.useRef(u);return Y.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,X.jsx)(g,{present:i||u,children:({present:n})=>(0,X.jsx)(N.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});yt.displayName=vt;function bt(e,t){return`${e}-trigger-${t}`}function xt(e,t){return`${e}-content-${t}`}var St=pt,Ct=ht,wt=_t,Tt=yt;function Et(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function Dt(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function Ot(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function kt(e){switch(e){case`admin`:return b();case`user`:return y();case`pending`:return ge();default:return e}}function At(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function jt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}function Mt({className:e,orientation:t=`horizontal`,...n}){return(0,X.jsx)(St,{"data-slot":`tabs`,"data-orientation":t,className:I(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var Nt=Ae(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function Pt({className:e,variant:t=`default`,...n}){return(0,X.jsx)(Ct,{"data-slot":`tabs-list`,"data-variant":t,className:I(Nt({variant:t}),e),...n})}function $({className:e,...t}){return(0,X.jsx)(wt,{"data-slot":`tabs-trigger`,className:I(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Ft({className:e,...t}){return(0,X.jsx)(Tt,{"data-slot":`tabs-content`,className:I(`flex-1 text-sm outline-none`,e),...t})}var It={name:``,description:``};function Lt(){let e=F(z.groups.listGroups,{}),t=F(z.me.getMe,{host:$e})?.role===`admin`,n=L(z.groups.createGroup),r=L(z.groups.updateGroup),a=L(z.groups.deleteGroup),o=Ge(),s=G(),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(It),[g,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(``),x=(0,Y.useMemo)(()=>{if(!e)return e;let t=y.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,y]);function S(){d(null),m(It),l(!0)}function ee(e){d(e),m({name:e.name,description:e.description??``}),l(!0)}async function w(){try{u?await r({groupId:u._id,name:p.name,description:p.description}):await n({name:p.name,description:p.description||void 0}),m(It),d(null),l(!1)}catch(e){s.error(Se(),e)}}async function te(e){if(await o({title:Ee({name:e.name}),description:_(),confirmWord:e.name,confirmLabel:f(),cancelLabel:i(),destructive:!0}))try{await a({groupId:e._id})}catch(e){s.error(oe(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(0,X.jsx)(it,{q:y,onQChange:b,onReset:()=>b(``),canReset:y!==``,searchPlaceholder:he()}),(0,X.jsx)(at,{title:de(),rows:x,addLabel:Ne(),onAdd:t?S:void 0,emptyHint:ye(),columns:[{header:A(),cell:e=>e.name,sort:e=>e.name},{header:ke(),cell:e=>(0,X.jsx)(q,{icon:(0,X.jsx)(ct,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,X.jsx)(J,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:Ce(),cell:e=>(0,X.jsx)(q,{icon:(0,X.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:se(),cell:e=>(0,X.jsx)(q,{icon:(0,X.jsx)(st,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,X.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:Oe(),onSelect:()=>v({groupId:e._id,name:e.name})},...t?[{label:xe(),onSelect:()=>ee(e)},{label:je(),variant:`destructive`,onSelect:()=>void te(e)}]:[]]}),(0,X.jsx)(Qe,{open:c,onOpenChange:l,title:u?D():C(),description:E(),canSubmit:!!p.name.trim(),onSubmit:w,submitLabel:M(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(V,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,X.jsx)(V,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})}),(0,X.jsx)(Bt,{groupId:g?.groupId??null,groupName:g?.name??``,open:g!==null,onOpenChange:e=>{e||v(null)}})]})}var Rt=8;function zt({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,X.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,X.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,X.jsx)(ot,{size:14,"aria-hidden":!0}),m()]}),(0,X.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":S({page:e,pages:t}),children:[e,` / `,t]}),(0,X.jsxs)(B,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[u(),(0,X.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function Bt({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=F(z.groups.getGroup,n&&e?{groupId:e}:`skip`),s=F(z.groups.listAssignableInstances,n?{}:`skip`),c=F(z.groups.listAssignableUsers,n?{}:`skip`),u=L(z.groups.addMember),d=L(z.groups.removeMember),f=L(z.groups.bulkSetMembers),m=L(z.groups.setGroupManager),h=G(),[g,_]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(``),[S,C]=(0,Y.useState)(`members`),[w,T]=(0,Y.useState)(1),[E,ae]=(0,Y.useState)(new Set),D=(0,Y.useRef)(null),O=(0,Y.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),oe=(0,Y.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),se=i?.viewerIsAdmin===!0,k=(0,Y.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Y.useEffect)(()=>{_(``),b(``),C(`members`),T(1),D.current=null},[n,e]),(0,Y.useEffect)(()=>{T(1)},[g]),(0,Y.useEffect)(()=>{n&&i&&e&&D.current!==e&&(D.current=e,ae(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let A=(0,Y.useMemo)(()=>c?Et(c,g,E):[],[c,g,E]);async function j(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(me(),e)}}async function ue(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(ce(),e)}}let M=At(A,e=>O.has(e.userId)),N=A.filter(e=>O.has(e.userId)).length,P=jt(A,w,Rt);async function de(){if(!e||A.length===0)return;let t=A.map(e=>e.userId);try{await f({groupId:e,userIds:t,member:M!==`all`})}catch(e){h.error(me(),e)}}return(0,X.jsx)(Ke,{open:n,onOpenChange:r,children:(0,X.jsxs)(Ue,{className:`oc-access`,children:[(0,X.jsxs)(qe,{children:[(0,X.jsx)(rt,{children:ie({name:t})}),(0,X.jsx)(We,{children:ne()})]}),(0,X.jsxs)(Mt,{value:S,onValueChange:C,className:`oc-access__tabs`,children:[(0,X.jsxs)(Pt,{className:`w-full`,children:[(0,X.jsxs)($,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,X.jsx)(ct,{size:13,"aria-hidden":!0}),p(),i?(0,X.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:O.size}):null]}),(0,X.jsxs)($,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,X.jsx)(U,{size:13,"aria-hidden":!0}),o(),i?(0,X.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,X.jsxs)($,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,X.jsx)(st,{size:13,"aria-hidden":!0}),Le(),i?(0,X.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,X.jsx)(Ft,{value:`members`,children:c===void 0||i===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:x()}):c.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(V,{value:g,onChange:e=>_(e.target.value),placeholder:re(),className:`oc-access__search`}),A.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:ee()}):(0,X.jsxs)(X.Fragment,{children:[A.length>1?(0,X.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,X.jsx)(H,{checked:M===`all`?!0:M===`some`?`indeterminate`:!1,onCheckedChange:()=>void de(),"aria-label":v()}),(0,X.jsx)(`span`,{className:`oc-access__label`,children:v()}),(0,X.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[N,` / `,A.length]})]}):null,(0,X.jsx)(`div`,{className:`oc-access__list`,children:P.pageItems.map(e=>{let t=O.has(e.userId),n=Ot(e),r=oe.has(e.userId);return(0,X.jsxs)(`div`,{className:`oc-access__row`,children:[(0,X.jsx)(H,{checked:t,onCheckedChange:()=>void j(e.userId,t),"aria-label":a({user:n.primary})}),(0,X.jsxs)(`span`,{className:`oc-access__who`,children:[(0,X.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,X.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,X.jsx)(K,{variant:`outline`,className:`oc-access__role`,children:kt(e.role)}),(0,X.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&se?(0,X.jsx)(B,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?ve():Me(),title:r?ve():Me(),onClick:()=>void ue(e.userId,r),children:(0,X.jsx)(J,{size:15,"aria-hidden":!0})}):t&&r?(0,X.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":le(),title:le(),children:(0,X.jsx)(J,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,X.jsx)(zt,{page:P.page,pageCount:P.pageCount,onPage:T})]})]})}),(0,X.jsx)(Ft,{value:`agents`,children:s===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:x()}):s.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:te()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(V,{value:y,onChange:e=>b(e.target.value),placeholder:Re(),className:`oc-access__search`}),(0,X.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,X.jsx)(Vt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:y},`${e}-${t._id}`))})]})}),(0,X.jsx)(Ft,{value:`charts`,children:(0,X.jsx)(Ht,{groupId:e})})]})]})})}function Vt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=F(z.groups.listAssignableAgents,{instanceName:t}),o=L(z.groups.assignAgentToGroup),l=L(z.groups.removeAgentFromGroup),u=L(z.groups.bulkSetGroupAgents),d=G(),[f,p]=(0,Y.useState)(1);if((0,Y.useEffect)(()=>{p(1)},[i]),!e)return null;let m=Dt(a?.agents??[],i),h=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1),_=At(g,e=>r.has(`${t}/${e.agentId}`)),y=jt(m,f,Rt);async function b(n,r){try{r?await l({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(De(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){d.error(De(),e)}}return(0,X.jsxs)(`div`,{className:`oc-access__group`,children:[(0,X.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,X.jsx)(U,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:t}),(0,X.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,X.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:w()}):null]}),a===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:c()}):m.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:h?s():Fe()}):(0,X.jsxs)(X.Fragment,{children:[g.length>1?(0,X.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,X.jsx)(H,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":v()}),(0,X.jsx)(`span`,{className:`oc-access__label`,children:v()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1;return(0,X.jsxs)(`div`,{className:`oc-access__row`,children:[(0,X.jsx)(H,{checked:i,disabled:a&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":_e({name:e.displayName??e.agentId})}),(0,X.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":k(),title:k(),children:(0,X.jsx)(W,{size:14,fill:`currentColor`})}):null,a?(0,X.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:Ie()}):null]},e.agentId)}),(0,X.jsx)(zt,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function Ht({groupId:e}){let t=F(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=L(z.charts.assignChartToGroup),r=L(z.charts.removeChartFromGroup),i=L(z.charts.setGroupDefaultChart),a=L(z.charts.addChartToGroupPool),o=L(z.charts.removeChartFromGroupPool),s=G();if(!e)return null;if(t===void 0)return(0,X.jsx)(`p`,{className:`oc-access__hint`,children:x()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Pe()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(R(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,X.jsxs)(`div`,{className:`oc-access__row`,children:[(0,X.jsx)(H,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":be({name:e.name})}),(0,X.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,X.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":we(),title:we(),children:(0,X.jsx)(W,{size:14,fill:`currentColor`})}):(0,X.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:P()}):null,u?(0,X.jsx)(B,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":pe({name:e.name}),title:pe({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,X.jsx)(Be,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,X.jsxs)(nt,{value:``,onValueChange:e=>void p(e),children:[(0,X.jsx)(Je,{size:`sm`,className:`oc-access__search`,children:(0,X.jsx)(Ve,{placeholder:fe()})}),(0,X.jsx)(Ye,{children:l.map(e=>(0,X.jsx)(tt,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:O()}):null:null]})}export{Lt as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,Af as a,Ap as o,Bf as s,Bp as c,Cf as l,Cp as u,Df as d,Dp as f,Ef as p,Ep as m,Ff as h,Fp as g,Gf as _,Gp as v,Hf as y,Hp as b,If as x,Ip as S,Jf as C,Jp as w,Kf as T,Kp as ee,Lf as te,Lp as ne,Mf as re,Mp as ie,Nf as ae,Np as oe,Of as se,Op as ce,Pf as le,Pp as ue,Qf as de,Qp as fe,Rf as pe,Rp as me,Sf as he,Sp as ge,Tf as _e,Tp as ve,Uf as ye,Up as be,Vf as xe,Vp as Se,Wf as E,Wp as D,Xf as Ce,Xp as we,Yf as Te,Yp as Ee,Zf as De,Zp as Oe,_p as ke,ap as Ae,bf as je,bp as O,cp as Me,dp as Ne,dw as k,em as Pe,ep as Fe,fp as Ie,gp as Le,hp as Re,hy as A,im as ze,ip as Be,jf as Ve,jp as He,kf as Ue,kp as We,lp as Ge,mp as j,mw as M,my as N,nm as Ke,np as qe,op as Je,pp as Ye,pw as P,qf as Xe,qp as Ze,rm as Qe,rp as $e,sp as et,sw as F,tm as tt,tp as nt,up as rt,vf as it,vp as at,wf as ot,wp as st,xf as ct,xp as lt,yf as I,yp as ut,zf as L,zp as dt}from"./dist-DQy6UNW9.js";import{t as R}from"./button-CjrF4jCF.js";import{C as ft,F as z,I as B,J as V,M as pt,O as H,P as U,R as W,S as mt,X as ht,Y as gt,Z as _t,b as vt,h as yt,j as G,m as K,x as q,y as bt,z as J}from"./index-nY1Cemm1.js";import{t as xt}from"./DataTableShell-lk84lOrM.js";import{InstanceConfigDialog as St}from"./BridgeTab-BDuniuOs.js";var Y=t(e(),1),X=[`conversational`,`documentary`],Ct=new Set(X),wt=`conversational`;function Tt(e){let t=new Set((e??[]).filter(e=>Ct.has(e)));return t.size===0?[wt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,gatewayVersion:``,gatewayHttpUrl:``},Et={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Dt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``}}function Ot(){let e=M(F.admin.listInstances,{}),t=M(F.agents.listAllInstanceAgents,{}),n=P(F.admin.upsertInstance),r=P(F.admin.deleteInstance),a=G(),[s,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[C,T]=(0,Y.useState)(null);async function te(){try{await n({instanceId:C??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0}),d(Q),T(null),l(!1)}catch(e){a.error(Ke(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[tt(),(0,Z.jsx)(`strong`,{children:Pe()}),i()]}),(0,Z.jsx)(xt,{title:fe(),rows:e,addLabel:Oe(),onAdd:()=>{T(null),d(Q),l(!0)},emptyHint:we(),columns:[{header:Ee(),cell:e=>e.name,sort:e=>e.name},{header:w(),cell:e=>(0,Z.jsx)(K,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ze(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ee(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ze(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(K,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?I():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:b(),onSelect:()=>{T(e._id),d(Dt(e)),l(!0)}},{label:Qe(),onSelect:()=>m(e.name)},{label:f(),onSelect:()=>x(e)},{label:v(),onSelect:()=>_(e)},{label:D(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:D(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(yt,{open:s,onOpenChange:l,title:C?Se():be(),description:dt(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:te,submitLabel:me(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsx)(V,{value:u.name,disabled:C!==null,onChange:e=>d({...u,name:e.target.value})}),C?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c()}):null]}),(0,Z.jsx)($,{label:S(),children:(0,Z.jsxs)(bt,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(mt,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(ft,{})}),(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(q,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(q,{value:`hermes`,children:`Hermes`})]})]})}),(0,Z.jsx)($,{label:g(),children:(0,Z.jsx)(V,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ue(),children:(0,Z.jsx)(V,{value:u.bridgeUrl,placeholder:oe(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ie(),children:(0,Z.jsx)(V,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsx)($,{label:He(),children:(0,Z.jsx)(V,{value:u.gatewayVersion,placeholder:o(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsx)(V,{value:u.gatewayHttpUrl,placeholder:ce(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Rt,{instanceName:p,open:p!==null,onOpenChange:e=>{e||m(null)}}),h?(0,Z.jsx)(St,{instance:h,onClose:()=>_(null)},h._id):null,y?(0,Z.jsx)(kt,{instance:y,onClose:()=>x(null)},y._id):null]})}function kt({instance:e,onClose:t}){let n=M(F.instanceSecrets.listInstanceSecretStatus,{}),r=Et[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(U,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(z,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(J,{children:m({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:ve()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Mt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(jt,{instance:e})}),(0,Z.jsx)(At,{instance:e})]})})}function At({instance:e}){let t=k(F.instanceSync.forceInstanceSync),n=G(),[i,a]=(0,Y.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Ae());break;case`no_agents`:n.success($e());break;case`no_bridge_url`:n.error(qe());break;case`deploy_misconfigured`:n.error(nt());break;case`unauthorized`:n.error(r());break;case`not_served`:n.error(de());break;default:n.error(Fe());break}}catch(e){n.error(Be(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?Je():et()})})]})}function jt({instance:e}){let t=M(F.bridgeAuth.listBridgeAuthStatus,{}),n=k(F.bridgeAuth.mintBridgeSecret),r=P(F.bridgeAuth.revokeBridgeSecret),i=G(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(E(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(_())}catch(e){i.error(E(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:Ce(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:f?`outline`:`secondary`,children:f?`${lt()} · ${d.prefix}…${d.lastFour}`:O()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?Xe():C()}),f?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:T()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ye()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?A():N()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:y()})]}):null]})}function Mt({instanceId:e,field:t,updatedAt:n}){let r=k(F.instanceSecrets.setInstanceSecret),i=P(F.instanceSecrets.clearInstanceSecret),a=k(F.deviceIdentity.generateDeviceIdentity),o=G(),[s,c]=(0,Y.useState)(``),[l,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?st():t===`deviceIdentity`?u():ge();async function b(){if(!(!s.trim()||l)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(Re())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function x(){if(!l){d(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Ye())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function S(){if(!l){d(!0);try{p(await a({instanceId:e})),h(!1),o.success(rt())}catch(e){o.error(Me(),e)}finally{d(!1)}}}let C=f?`openclaw devices approve ${f.id}`:``;async function w(){if(C)try{await navigator.clipboard.writeText(C),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(K,{variant:g?`outline`:`secondary`,children:g?lt():O()}),(0,Z.jsx)(V,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?at():ut(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(R,{size:`sm`,onClick:()=>void b(),disabled:l||s.trim().length===0,children:ke()}),_?(0,Z.jsx)(R,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:l,children:Ie()}):null,g?(0,Z.jsx)(R,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:l,children:Le()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:m?A():N()})]}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:y()})]}):null]})}var Nt={conversational:le,documentary:re},Pt={conversational:ae,documentary:Ve},Ft=e=>(Nt[e]??(()=>e))(),It=e=>(Pt[e]??(()=>``))();function Lt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:pe()}),t.map(e=>(0,Z.jsx)(K,{variant:`secondary`,className:`oc-agenttype__chip`,title:It(e),children:Ft(e)},e)),(0,Z.jsxs)(gt,{children:[(0,Z.jsx)(_t,{asChild:!0,children:(0,Z.jsx)(R,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:te()})}),(0,Z.jsxs)(ht,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:x()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:h()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(H,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Ft(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:It(r)})]})]},r)})})]})]})]})}function Rt({instanceName:e,open:t,onOpenChange:n}){let r=M(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=P(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=P(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),c=P(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Tt(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),u=P(F.agents.removeInstanceAgent),f=pt(),m=G();async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(L(),e)}}async function g(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){m.error(L(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await c({instanceName:e,agentId:t,types:i})}catch(e){m.error(L(),e)}}async function v(t,n){if(e&&await f({title:se({name:n}),description:d(),confirmLabel:p(),destructive:!0}))try{await u({instanceName:e,agentId:t}),m.success(_e())}catch(e){m.error(L(),e)}}return(0,Z.jsx)(U,{open:t,onOpenChange:n,children:(0,Z.jsxs)(z,{className:`oc-access`,children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(J,{children:xe({name:e??``})}),(0,Z.jsx)(B,{children:s()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ot()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?l():r.discovery.lastPollOk?he():ct({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:je()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,o=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(H,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void h(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:it()}),(0,Z.jsx)(R,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(e.agentId,i),children:Ue()})]}):n?(0,Z.jsx)(K,{variant:`default`,children:I()}):(0,Z.jsx)(R,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void g(e.agentId),children:a()})]}),e.enabled?(0,Z.jsx)(Lt,{agentId:e.agentId,types:o,onToggle:t=>void _(e.agentId,t,o)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Ot as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ab as i,Bb as a,CC as o,Db as s,EC as c,Fb as l,Gb as u,Hb as d,Ib as f,Jb as ee,Kb as te,Lb as p,Mb as m,Nb as h,Ob as ne,PC as re,Pb as g,Qb as ie,Rb as ae,Rp as oe,SC as se,TC as ce,Ub as le,Vb as _,Wb as ue,Xb as de,Yb as v,Zb as y,_C as b,ax as x,bC as S,ex as C,gC as w,hC as T,ix as E,jb as D,kC as O,kb as k,mC as A,mw as j,nx as M,ox as N,pw as P,qb as F,rx as I,sw as L,tx as R,vC as z,wC as B,xC as V,yC as fe,zb as pe}from"./dist-DQy6UNW9.js";import{t as H}from"./button-CjrF4jCF.js";import{C as me,J as U,O as W,S as he,b as ge,j as _e,k as ve,ot as G,x as K,y as ye}from"./index-nY1Cemm1.js";var q=t(e(),1),J=[{id:`messages`,label:()=>N()},{id:`composer`,label:()=>x()},{id:`sidebar`,label:()=>E()},{id:`other`,label:()=>I()}],Y={showSource:{category:`messages`,label:()=>M(),help:()=>R()},showReport:{category:`messages`,label:()=>C(),help:()=>r()},copyAssistant:{category:`messages`,label:()=>ie()},copyUser:{category:`messages`,label:()=>y()},showDelete:{category:`messages`,label:()=>de()},showTools:{category:`messages`,label:()=>v(),help:()=>ee()},voiceInput:{category:`composer`,label:()=>F(),help:()=>te()},showChatAge:{category:`sidebar`,label:()=>u(),help:()=>ue()},showChatProvider:{category:`sidebar`,label:()=>le(),help:()=>d()}};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:()=>D()};function De({prefKey:e,ui:t}){let n=P(L.admin.setUiPrefDefault),r=P(L.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:l()}),(0,$.jsxs)(ye,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(he,{size:`sm`,className:`w-36`,children:(0,$.jsx)(me,{})}),(0,$.jsxs)(ge,{children:[(0,$.jsx)(K,{value:`on`,children:k()}),(0,$.jsx)(K,{value:`off`,children:ne()}),(0,$.jsx)(K,{value:`inherit`,children:s()})]})]}),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":g()}),g()]}):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),o=j(L.me.getMe,{host:G}),s=o?.ui,c=Z(o?.role)&&n,l=P(L.me.setUiPref).withOptimisticUpdate(ve),u=(0,q.useMemo)(()=>s?be(Object.keys(s.effective),e):[],[s,e]);return s?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(o?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(W,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":f()}),f()]}):null,c?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:h()}),(0,$.jsx)(`p`,{children:m()}),(0,$.jsx)(`p`,{children:i()})]}):null,(0,$.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),u.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:a()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:u.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=s.locked[e],a=s.effective[e],o=s.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${o&&!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:pe()}):o?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:ae()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&o?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:p()}):null,(0,$.jsx)(W,{checked:a,disabled:i,onCheckedChange:t=>void l({key:e,value:t===!0}),"aria-label":n})]}),c?(0,$.jsx)(De,{prefKey:e,ui:s}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:re()})}function ke(){let e=j(L.me.getMe,{host:G}),t=P(L.me.setLocale),n=P(L.me.setMyName),r=_e(),i=e?.locale??`default`,a=e?.name??``,[s,l]=(0,q.useState)(null),u=s??a,d=u.trim()!==a.trim();async function f(){try{await n({name:u}),l(null),r.success(se())}catch(e){r.error(V(),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:c()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ce()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:u,maxLength:120,placeholder:B(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,$.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:oe()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:S()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`,`default`].map(e=>(0,$.jsx)(H,{variant:i===e?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e==="default"?null:e}),children:e===`fr`?T():e===`en`?A():O()},e))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:b()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,$.jsx)(Oe,{})]})]})}export{ke as PreferencesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Ad as i,Bd as a,Dd as o,Fd as s,Gd as c,Hd as ee,Id as te,Jd as l,Kd as u,Ld as ne,Md as d,Nd as f,Od as p,Pd as m,Qd as h,Rd as g,Ud as _,Vd as v,Wd as y,Xd as b,Yd as x,Zd as S,_d as re,bd as ie,ef as C,gd as w,hd as T,jd as E,kd as D,md as O,mw as k,nf as A,pd as j,pw as M,qd as N,sw as P,tf as F,vd as I,xd as L,yd as R,zd as ae}from"./dist-DQy6UNW9.js";import{t as z}from"./button-CjrF4jCF.js";import{J as B,M as V,O as H,h as U,j as W,m as G,xt as K}from"./index-nY1Cemm1.js";import{t as q}from"./roleDescriptions-EkLHQ7dr.js";var J=t(e(),1),Y=n(),X=[{group:()=>A(),keys:[{key:`traces.read`,label:()=>S()},{key:`traces.read.content`,label:()=>b(),phi:!0},{key:`traces.write`,label:()=>x()}]},{group:()=>F(),keys:[{key:`kpi.read`,label:()=>S()},{key:`kpi.write`,label:()=>x()}]},{group:()=>C(),keys:[{key:`openclaw.query`,label:()=>l()},{key:`anomalies.read`,label:()=>N()},{key:`anomalies.report`,label:()=>u()}]},{group:()=>r(),keys:[{key:`chats.read`,label:()=>S()},{key:`selfheal`,label:()=>y()}]},{group:()=>h(),keys:[{key:`admin.manage`,label:()=>c()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=k(P.apiKeys.listRoles,{}),t=M(P.apiKeys.createRole),n=M(P.apiKeys.ensureRolesSeeded),r=M(P.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(P.apiKeys.listRoles,{});r&&e.setQuery(P.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=V(),l=W(),[u,h]=(0,J.useState)(!1),[y,b]=(0,J.useState)(Q),[x,S]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{l.error(ee(),e)})},[n,l]);let C=e??[];async function A(e,t){if(Z(e.permissions)||x.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await c({title:v({name:e.name}),description:a(),confirmLabel:ae()}))){S(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){l.error(g(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function N(){try{await t({key:y.key,name:y.name,description:y.description||void 0,permissions:[]}),b(Q),h(!1)}catch(e){l.error(ne(),e)}}let F=e===void 0,$=!F&&C.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,s(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,m()]}),(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:f()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{b(Q),h(!0)},children:d()})})]}),F?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(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:D()}),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?_({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:C.map(e=>{let t=Z(e.permissions),n=x.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)(G,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,p()]}):(0,Y.jsx)(G,{variant:`secondary`,children:o()})]}),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)(H,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?L():n?ie():r,onCheckedChange:()=>void A(e,r)})},r))]},e.key)})})]})})]}),(0,Y.jsx)(U,{open:u,onOpenChange:h,title:R(),description:I(),canSubmit:!!(y.key&&y.name),onSubmit:N,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:w()}),(0,Y.jsx)(B,{value:y.key,placeholder:T(),onChange:e=>b({...y,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:O()}),(0,Y.jsx)(B,{value:y.name,onChange:e=>b({...y,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(B,{value:y.description,onChange:e=>b({...y,description:e.target.value})})]})]})})]})}export{$ as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as ee,Cb as te,Cy as a,Dy as o,Eb as ne,Ey as s,Fy as re,Gy as ie,Hy as ae,Iy as oe,Jy as se,Ky as ce,Ly as le,My as ue,Ny as de,Oy as fe,Py as pe,Qy as me,Ry as he,Sb as ge,Sy as c,Tb as _e,Ty as l,Uy as ve,Vy as ye,Wy as be,Xy as xe,Yy as Se,Zy as Ce,_b as we,_y as u,ab as Te,bb as Ee,by as d,cb as De,cy as f,db as Oe,dw as ke,dy as p,eb as Ae,fb as je,fy as m,gb as Me,gy as Ne,hb as Pe,hy as h,ib as Fe,jy as Ie,ky as g,lb as Le,ly as _,mb as Re,mw as v,my as y,nb as ze,ob as Be,oy as b,pb as Ve,pw as x,py as S,qy as He,rb as Ue,sb as We,sw as C,sy as w,tb as Ge,ub as Ke,uy as T,vb as qe,vy as E,wb as Je,wy as D,xb as Ye,xy as O,yb as Xe,yy as k,zy as Ze}from"./dist-DQy6UNW9.js";import{n as Qe}from"./dist-Ztske_3A.js";import{i as $e}from"./dist-B7_ufbgZ.js";import{t as A}from"./button-CjrF4jCF.js";import{C as j,Dt as et,F as M,I as N,J as P,L as F,M as tt,Ot as nt,P as I,R as L,S as R,Tt as z,b as B,h as rt,j as it,kt as at,m as V,x as H,y as U,z as W}from"./index-nY1Cemm1.js";import{t as ot}from"./FilterBar-DFcZPoFt.js";import{t as st}from"./DataTableShell-lk84lOrM.js";import{t as ct}from"./roleDescriptions-EkLHQ7dr.js";var G=t(e(),1),K=n(),lt=[{value:`never`,label:()=>m(),days:null},{value:`30`,label:()=>p(),days:30},{value:`90`,label:()=>T(),days:90}],q=720*60*60*1e3,J=`__all__`,Y={name:``,roleKey:``,description:``};function X(){let e=at({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??J,[o,s]=(0,G.useState)(J),fe=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===J?void 0:e})}),l=v(C.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===J?void 0:o,disabled:a===J?void 0:a===`disabled`}}),u=v(C.apiKeys.listKeys,{}),d=v(C.apiKeys.listRoles,{}),f=x(C.apiKeys.createServiceAccount),p=x(C.apiKeys.updateServiceAccount),m=x(C.apiKeys.deleteServiceAccount),Ne=ke(C.apiKeys.mintApiKey),h=x(C.apiKeys.revokeApiKey),g=tt(),_=it(),y=n!==``||o!==J||a!==J;function b(){s(J),t({search:{},replace:!0})}let[S,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(Y),[D,O]=(0,G.useState)(null),[k,Qe]=(0,G.useState)(new Set),[M,N]=(0,G.useState)(null),F=(0,G.useRef)(!1),[I,L]=(0,G.useState)(new Set),[z,W]=(0,G.useState)({}),[q,X]=(0,G.useState)(null),Z=(0,G.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function Q(e){Qe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await p({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),_.success(be())):await f({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Y),O(null),w(!1)}catch(e){_.error(D?ie():ce(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),w(!0)}async function $(e){if(F.current)return;F.current=!0;let t=z[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await Ne({serviceAccountId:e._id,expiresAt:r});X({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(ve(),e)}finally{F.current=!1,N(null)}}async function mt(e){if(await g({title:ae(),description:(0,K.jsxs)(K.Fragment,{children:[ye(),` `,(0,K.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ee(),` `,(0,K.jsx)(`strong`,{children:Ze()}),` `,he()]}),confirmWord:e.name,confirmLabel:le(),destructive:!0}))try{await m({serviceAccountId:e._id}),_.success(oe(),e.name)}catch(e){_.error(re(),e)}}async function ht(e){if(await g({title:pe(),description:(0,K.jsxs)(K.Fragment,{children:[de(),` `,(0,K.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ue()]}),confirmLabel:Ie(),destructive:!0})&&!I.has(e._id)){L(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){_.error(i(),e)}finally{L(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:ne()}),(0,K.jsxs)(ot,{q:n,onQChange:fe,searchPlaceholder:_e(),onReset:b,canReset:y,children:[(0,K.jsxs)(U,{value:o,onValueChange:s,children:[(0,K.jsx)(R,{size:`sm`,className:`w-40`,children:(0,K.jsx)(j,{placeholder:Je()})}),(0,K.jsxs)(B,{children:[(0,K.jsx)(H,{value:J,children:te()}),(d??[]).map(e=>(0,K.jsx)(H,{value:e.key,children:e.key},e._id))]})]}),(0,K.jsxs)(U,{value:a,onValueChange:c,children:[(0,K.jsx)(R,{size:`sm`,className:`w-36`,children:(0,K.jsx)(j,{})}),(0,K.jsxs)(B,{children:[(0,K.jsx)(H,{value:J,children:ge()}),(0,K.jsx)(H,{value:`active`,children:Ye()}),(0,K.jsx)(H,{value:`disabled`,children:Ee()})]})]})]}),(0,K.jsx)(st,{title:Xe(),rows:l,addLabel:qe(),onAdd:()=>{E(Y),O(null),w(!0)},emptyHint:we(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,K.jsx)(ut,{account:e,keys:Z.get(e._id)??[],onRevoke:ht,revoking:I}),rowActions:e=>[{label:Ve(),onSelect:()=>pt(e)},{label:Me(),onSelect:()=>void $(e)},{label:k.has(e._id)?Pe():Re(),onSelect:()=>Q(e._id)},{label:je(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,K.jsx)(A,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Oe():Ke(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,K.jsx)($e,{}):(0,K.jsx)(et,{})})},{header:Le(),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:De(),sort:e=>e.roleKey,cell:e=>(0,K.jsx)(V,{variant:`secondary`,children:e.roleKey})},{header:We(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,K.jsx)(V,{variant:`destructive`,children:Ee()}):(0,K.jsx)(V,{variant:`outline`,children:Ye()})},{header:Be(),cell:e=>(0,K.jsxs)(U,{value:z[e._id]??`never`,onValueChange:t=>W(n=>({...n,[e._id]:t})),children:[(0,K.jsx)(R,{size:`sm`,className:`w-32`,children:(0,K.jsx)(j,{})}),(0,K.jsx)(B,{children:lt.map(e=>(0,K.jsx)(H,{value:e.value,children:e.label()},e.value))})]})},{header:Te(),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?Fe():Ue({count:t})})}}]}),(0,K.jsx)(rt,{open:S,onOpenChange:e=>{w(e),e||O(null)},title:D?ze():r(),description:D?Ge():me(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?Ae():Ce(),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:xe()}),(0,K.jsx)(P,{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:Se()}),(0,K.jsxs)(U,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,K.jsx)(R,{className:`w-full`,children:(0,K.jsx)(j,{placeholder:se()})}),(0,K.jsx)(B,{children:(d??[]).map(e=>(0,K.jsxs)(H,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).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:He()}),(0,K.jsx)(P,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,K.jsx)(dt,{minted:q,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:[g(),` `,(0,K.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,K.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{children:o()}),(0,K.jsx)(`th`,{children:s()}),(0,K.jsx)(`th`,{children:l()}),(0,K.jsx)(`th`,{children:D()}),(0,K.jsx)(`th`,{children:a()}),(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)(V,{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)(A,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?O():d()})})]},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)(I,{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)(L,{children:[(0,K.jsx)(W,{children:k()}),(0,K.jsx)(N,{children:E({name:e.accountName})})]}),(0,K.jsx)(`div`,{className:`oc-sa__minted-warning`,children:u()}),(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)(A,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":Ne(),children:[n?(0,K.jsx)(Qe,{}):(0,K.jsx)(z,{}),n?h():y()]})]}),(0,K.jsx)(F,{children:(0,K.jsx)(A,{onClick:()=>{r(!1),t()},children:S()})})]}):null})}function Z(e){return new Date(e).toLocaleString(`fr-FR`)}function Q(e){return e===null?!1:Date.now()-e>q}function ft(e){return e===null?_():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)(V,{variant:`destructive`,children:f()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,K.jsx)(V,{variant:`outline`,children:w()}):(0,K.jsx)(V,{variant:`outline`,children:b()})}export{X as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$x as r,AC as i,Ax as a,Bx as o,CS as s,Cx as c,DS as l,Dx as u,ES as d,Ex as f,Fx as p,Gx as m,Hx as h,Ix as g,Jx as _,Kx as v,Lx as ee,MC as te,Mx as ne,Nx as re,OS as ie,Ox as ae,Px as oe,Qx as se,Rx as ce,SS as le,Sx as ue,TS as de,Tx as fe,Ux as pe,Vx as me,Wx as he,Xx as ge,Yx as _e,Zx as ve,_S as ye,_x as be,aS as xe,bS as Se,bx as Ce,cS as we,cw as Te,cx as Ee,dS as De,dw as Oe,dx as y,eS as ke,fS as Ae,fx as je,gS as Me,gx as Ne,hC as Pe,hS as Fe,hx as b,iS as Ie,jC as Le,jx as Re,kS as ze,kx as Be,lS as Ve,lx as He,mC as Ue,mS as We,mw as x,mx as Ge,n as Ke,nS as qe,oS as Je,pS as Ye,pw as S,px as Xe,qx as Ze,rS as Qe,sS as $e,sw as C,sx as et,tS as tt,uS as nt,ux as rt,vS as it,vx as at,wS as ot,wx as st,xS as ct,xx as lt,yS as w,yx as ut,zx as dt}from"./dist-DQy6UNW9.js";import{n as T}from"./dist-Ztske_3A.js";import{t as ft}from"./TimeRangePicker-BiwaqlSJ.js";import{t as E}from"./x-12vni2tJ.js";import{t as D}from"./button-CjrF4jCF.js";import{$ as pt,C as O,Ct as k,J as A,O as j,Q as mt,S as M,at as ht,b as N,et as P,it as gt,m as F,nt as I,ot as L,rt as _t,tt as vt,x as R,y as z}from"./index-nY1Cemm1.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-Bv3IToK_.js";import{a as Tt,i as B,n as Et,o as V,r as H,t as Dt}from"./table-uMxWWF9Z.js";import{t as Ot}from"./FilterBar-DFcZPoFt.js";import{t as kt}from"./AdvancedFilter-B7F-AiE3.js";var U=Te(`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`}]]),W=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(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 Pt(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 G(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(a());if(e.size>Lt)throw Error(Be());let{source:n,width:r,height:i,cleanup:o}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let d=l.getContext(`2d`);if(!d)throw Error(u());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,s,c);let p=Nt(d.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},m=document.createElement(`canvas`);m.width=p.width,m.height=p.height;let h=m.getContext(`2d`);if(!h)throw Error(u());if(h.drawImage(l,p.x,p.y,p.width,p.height,0,0,p.width,p.height),t.variantFor){let e=h.getImageData(0,0,p.width,p.height);G(e.data,p.width,p.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),h.putImageData(e,0,0)}let g=G(h.getImageData(0,0,p.width,p.height).data,p.width,p.height),_=await q(m,`image/webp`,Bt)??await q(m,`image/png`);if(!_)throw Error(f());return{blob:_,hasAlpha:g}}finally{o()}}async function Ht(e){if(e.type===`image/svg+xml`)return K(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 K(e)}async function K(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 q(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var J=n(),Y=`__all__`,X={kind:`relative`,from:`now-24h`,to:`now`},Ut=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Z({title:e,description:t,children:n}){return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,J.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Wt(e){return e===`light`?te():e===`dark`?Le():i()}var Gt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Kt({tokens:e,mode:t}){let n=e.colors[t];return(0,J.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Gt.map(e=>{let t=n[e];return(0,J.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Q({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a}){return(0,J.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,J.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,J.jsx)(T,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,J.jsx)(Kt,{tokens:r,mode:i}):(0,J.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,J.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,J.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]})}function qt({selectedKey:e,resolvedMode:t}){let n=x(C.charts.listMyCharts),r=S(C.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ct()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,J.jsx)(Q,{selected:e===null,title:w(),subtitle:it(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?ye():n.via===`owner`?Me():Fe({group:n.via.group});return(0,J.jsx)(Q,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key)},n.key)})]}),n!==void 0&&n.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:We()}):null]})}function Jt(){let e=S(C.charts.importChart),[t,n]=(0,W.useState)(``),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[c,l]=(0,W.useState)(!1),[u,d]=(0,W.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(v())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(he());return}let r;try{r=JSON.parse(i)}catch{s(v());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ke()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:r()})]}),(0,J.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:se()}),(0,J.jsx)(A,{value:t,onChange:e=>n(e.target.value),placeholder:ve(),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:ge()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:_e(),rows:8,spellCheck:!1})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),_(),(0,J.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,J.jsx)(D,{size:`sm`,disabled:u,onClick:()=>void p(),children:Ze()})]}),o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,J.jsx)(`p`,{className:`oc-chart-import__ok`,children:m()}):null]})]})}function Yt({chart:e}){let t=Oe(C.charts.setChartLogo),n=S(C.charts.removeChartLogo),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(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 d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ee():g()}),(0,J.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,J.jsx)(`img`,{src:t,alt:``}):null}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,asChild:!0,children:(0,J.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,J.jsx)(U,{className:`size-4`}),t?oe():p(),(0,J.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ne()}):null,t?(0,J.jsx)(D,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:re()}):null]})}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ce()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,J.jsx)(f,{mode:`light`}),(0,J.jsx)(f,{mode:`dark`})]}),r?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:Re()}):null,a?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $({chart:e}){let t=x(C.me.getMe,{host:L}),n=S(C.charts.addChartDomain),r=S(C.charts.removeChartDomain),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),u(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:fe()}),(0,J.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:lt()}):d.map(e=>(0,J.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ce({domain:e}),onClick:()=>void p(e),children:(0,J.jsx)(E,{className:`size-3`})})]},e))}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(A,{value:i,onChange:e=>a(e.target.value),placeholder:c(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,J.jsx)(D,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:ue()})]}),(0,J.jsx)(`span`,{className:`oc-show__desc`,children:st()}),o?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function Xt({chart:e}){let t=S(C.charts.updateChart),n=S(C.charts.deleteChart),[r,i]=(0,W.useState)(!1),[a,s]=(0,W.useState)(e.name),[c,l]=(0,W.useState)(()=>JSON.stringify(e.tokens,null,2)),[u,d]=(0,W.useState)(null),[f,p]=(0,W.useState)(!1);function m(){s(e.name),l(JSON.stringify(e.tokens,null,2)),d(null),i(!0)}async function h(){if(e.chartId===void 0)return;d(null);let n;try{n=JSON.parse(c)}catch{d(v());return}p(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}}async function g(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:m,children:o()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void g(),children:dt()})]})})]}),r?(0,J.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:be()}),(0,J.jsx)(A,{value:a,onChange:e=>s(e.target.value),maxLength:60})]}),(0,J.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,J.jsx)(`span`,{className:`oc-chart-import__label`,children:Ne()}),(0,J.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),u?(0,J.jsx)(`p`,{className:`oc-chart-import__error`,children:u}):null,(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,disabled:f,onClick:()=>void h(),children:ut()}),(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:at()})]})]}):null,(0,J.jsx)(Yt,{chart:e}),(0,J.jsx)($,{chart:e})]})}function Zt(){let e=x(C.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),e!==void 0&&t.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:me()}):(0,J.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,J.jsx)(Xt,{chart:e},e.key))})]})}function Qt({chart:e,groups:t}){let n=S(C.charts.addChartToGroupPool),r=S(C.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(F,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Je():e.kind===`custom`&&e.scope===`personal`?y():$e()}),e.isGlobalDefault?(0,J.jsx)(F,{variant:`default`,children:xe()}):null]}),(0,J.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,J.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Qe()}),(a??[]).map(e=>(0,J.jsxs)(F,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,J.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":tt({group:e.name}),onClick:()=>void l(e.groupId),children:(0,J.jsx)(E,{className:`size-3`})})]},e.groupId)),s.length>0?(0,J.jsxs)(z,{value:``,onValueChange:e=>void c(e),children:[(0,J.jsx)(M,{size:`sm`,className:`w-56`,children:(0,J.jsx)(O,{placeholder:qe()})}),(0,J.jsx)(N,{children:s.map(e=>(0,J.jsx)(R,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:Ie()}):null]})]})}function $t({chart:e}){let t=S(C.charts.promoteChartToCommon),n=S(C.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,J.jsx)(F,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?rt():y()}),e.ownerLabel?(0,J.jsx)(`span`,{className:`oc-show__desc`,children:je({owner:e.ownerLabel})}):null]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,J.jsx)(D,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:He()}):null,(0,J.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ee()})]})]})}function en({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=S(C.admin.setDefaultThemeMode),i=S(C.admin.setDefaultLocale),a=S(C.charts.setDefaultChart),o=x(C.charts.listChartsAdmin),c=x(C.groups.listGroups,{}),u=e??`system`,f=t??`fr`;return(0,J.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:s()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ye()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:w()}),ht.map(e=>(0,J.jsx)(D,{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,J.jsx)(D,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:De()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:nt()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,J.jsx)(Qt,{chart:e,groups:c??[]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,J.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,J.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,J.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,J.jsx)($,{chart:e})]},e.key))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:Ge()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,J.jsx)(`p`,{className:`oc-show__desc`,children:et()}):(0,J.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,J.jsx)($t,{chart:e},e.key))})})()]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:ze()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,J.jsx)(D,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Wt(e)},e))})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h3`,{className:`oc-show__title`,children:l()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,J.jsx)(D,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?Pe():Ue()},e))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]})]})}function tn(){let e=x(C.me.getMe,{host:L}),t=gt(e?.resolvedThemeMode);return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsx)(qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,J.jsx)(Jt,{}),(0,J.jsx)(Zt,{}),e?.role===`admin`?(0,J.jsx)(en,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function nn(){let[e,t]=(0,W.useState)(!0),[n,r]=(0,W.useState)(`per-user`),[i,a]=(0,W.useState)(``),[o,s]=(0,W.useState)(Y),[c,l]=(0,W.useState)(Y),[u,d]=(0,W.useState)(X),f=i!==``||o!==Y||c!==Y;function p(){a(``),s(Y),l(Y),d(X)}return(0,J.jsxs)(`div`,{className:`oc-show`,children:[(0,J.jsx)(tn,{}),(0,J.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,J.jsx)(`summary`,{className:`oc-show__title`,children:ot()}),(0,J.jsxs)(Z,{title:`Buttons`,description:`Variants`,children:[(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(D,{variant:`outline`,children:`Outline`}),(0,J.jsx)(D,{variant:`ghost`,children:`Ghost`}),(0,J.jsx)(D,{variant:`destructive`,children:`Destructive`}),(0,J.jsx)(D,{variant:`link`,children:`Link`})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(D,{size:`sm`,children:`Small`}),(0,J.jsx)(D,{children:`Default`}),(0,J.jsx)(D,{size:`lg`,children:`Large`}),(0,J.jsx)(D,{size:`icon`,"aria-label":`more`,children:(0,J.jsx)(k,{})}),(0,J.jsx)(D,{disabled:!0,children:`Disabled`})]})]}),(0,J.jsx)(Z,{title:`Badges`,children:(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(F,{children:`Default`}),(0,J.jsx)(F,{variant:`secondary`,children:`Secondary`}),(0,J.jsx)(F,{variant:`outline`,children:`Outline`}),(0,J.jsx)(F,{variant:`destructive`,children:`Destructive`})]})}),(0,J.jsx)(Z,{title:`Inputs & selection`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(A,{placeholder:`Text input…`}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsxs)(z,{value:n,onValueChange:r,children:[(0,J.jsx)(M,{className:`w-56`,children:(0,J.jsx)(O,{placeholder:`Select…`})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(R,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,J.jsx)(R,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,J.jsxs)(`label`,{className:`oc-show__check`,children:[(0,J.jsx)(j,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,J.jsx)(Z,{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,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,J.jsxs)(z,{value:o,onValueChange:s,children:[(0,J.jsx)(M,{size:`sm`,children:(0,J.jsx)(O,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(R,{value:Y,children:`Toutes directions`}),(0,J.jsx)(R,{value:`inbound`,children:`inbound`}),(0,J.jsx)(R,{value:`outbound`,children:`outbound`}),(0,J.jsx)(R,{value:`internal`,children:`internal`})]})]}),(0,J.jsxs)(z,{value:c,onValueChange:l,children:[(0,J.jsx)(M,{size:`sm`,children:(0,J.jsx)(O,{})}),(0,J.jsxs)(N,{children:[(0,J.jsx)(R,{value:Y,children:`Toutes sévérités`}),(0,J.jsx)(R,{value:`info`,children:`info`}),(0,J.jsx)(R,{value:`warn`,children:`warn`}),(0,J.jsx)(R,{value:`critical`,children:`critical`})]})]})]}),(0,J.jsx)(kt,{fields:Ut,onChange:()=>{}}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,J.jsx)(ft,{value:u,onChange:d})]})]})}),(0,J.jsx)(Z,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,J.jsxs)(mt,{children:[(0,J.jsx)(_t,{asChild:!0,children:(0,J.jsx)(D,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,J.jsx)(k,{})})}),(0,J.jsxs)(pt,{align:`start`,children:[(0,J.jsx)(vt,{children:`Actions`}),(0,J.jsx)(I,{}),(0,J.jsx)(P,{children:`Edit`}),(0,J.jsx)(P,{children:`Duplicate`}),(0,J.jsx)(I,{}),(0,J.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,J.jsx)(Z,{title:`Card`,children:(0,J.jsxs)(wt,{className:`w-80`,children:[(0,J.jsxs)(yt,{children:[(0,J.jsx)(St,{children:`Instance`}),(0,J.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,J.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,J.jsxs)(bt,{className:`gap-2`,children:[(0,J.jsx)(D,{size:`sm`,children:`Save`}),(0,J.jsx)(D,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,J.jsx)(Z,{title:`Table`,children:(0,J.jsxs)(Dt,{children:[(0,J.jsx)(Tt,{children:(0,J.jsxs)(V,{children:[(0,J.jsx)(B,{className:`w-8`,children:(0,J.jsx)(j,{"aria-label":`select all`})}),(0,J.jsx)(B,{children:`Name`}),(0,J.jsx)(B,{children:`Mode`}),(0,J.jsx)(B,{className:`text-right`,children:`Status`}),(0,J.jsx)(B,{className:`w-8`})]})}),(0,J.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,J.jsxs)(V,{children:[(0,J.jsx)(H,{children:(0,J.jsx)(j,{"aria-label":`select ${e.n}`})}),(0,J.jsx)(H,{className:`font-medium`,children:e.n}),(0,J.jsx)(H,{children:(0,J.jsx)(F,{variant:`secondary`,children:e.m})}),(0,J.jsx)(H,{className:`text-right`,children:(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,J.jsx)(T,{className:`size-3.5`}),` `,e.s]})}),(0,J.jsx)(H,{children:(0,J.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,J.jsx)(k,{})})})]},e.n))})]})}),(0,J.jsx)(Z,{title:`App fragments`,description:`Chat-specific components`,children:(0,J.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,J.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,J.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,J.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,J.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,J.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,J.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,J.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,J.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,J.jsx)(`span`,{className:`oc-run-status__dot`}),(0,J.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{nn as ThemeShowroom};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Al as i,Bg as a,Bl as o,Cl as s,Dl as c,El as l,Fl as u,Gg as d,Gl as f,Hg as p,Hl as m,Il as h,Jg as g,Jl as _,Kg as v,Kl as ee,Ll as te,Ml as ne,Nl as y,Ol as re,Pl as ie,Qg as b,Rl as ae,Sl as oe,Tl as se,Ug as x,Ul as ce,Vg as le,Vl as ue,Wg as de,Wl as fe,Xg as S,Xl as pe,Yg as C,Yl as me,Zg as he,_l as ge,a_ as w,bl as _e,c_ as T,e_ as E,fl as D,gl as ve,hl as ye,i_ as O,jl as be,kl as xe,l_ as k,ml as A,mw as j,n_ as M,o_ as N,pl as P,pw as F,qg as I,ql as Se,r_ as L,s_ as R,sw as z,t_ as B,vl as Ce,wl as we,xl as Te,yl as Ee,zl as De}from"./dist-DQy6UNW9.js";import{n as Oe}from"./dist-Ztske_3A.js";import{n as ke}from"./TimeRangePicker-BiwaqlSJ.js";import{t as Ae}from"./x-12vni2tJ.js";import{t as V}from"./button-CjrF4jCF.js";import{A as je,C as H,F as Me,I as Ne,Ot as Pe,P as Fe,R as Ie,S as U,Tt as Le,a as Re,b as W,i as ze,kt as Be,m as G,o as Ve,ot as He,r as Ue,x as K,y as q,z as We}from"./index-nY1Cemm1.js";import{t as Ge}from"./FilterBar-DFcZPoFt.js";import{t as Ke}from"./AdvancedFilter-B7F-AiE3.js";import{t as qe}from"./DataTableShell-lk84lOrM.js";var J=t(e(),1),Y=n(),X=e=>e===null?`—`:String(Math.round(e));function Je(){let e=j(z.me.getMe,{host:He})?.role===`admin`,t=j(z.deliveryTiming.getDeliveryStatus,{}),n=F(z.deliveryTiming.startDeliveryRecord),r=F(z.deliveryTiming.stopDeliveryRecord),i=F(z.deliveryTiming.deleteDeliverySessions),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(new Set),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(!1),g=j(z.deliveryTiming.listDeliverySessions,a?{}:`skip`),_=j(z.deliveryTiming.getDeliveryReport,a?{sessionId:s??void 0}:`skip`),v=t?.recording??!1,ee=async()=>{p(!0);try{v?await r({}):await n({})}finally{p(!1)}},te=()=>{_&&navigator.clipboard?.writeText(je(_)).then(()=>{h(!0),window.setTimeout(()=>h(!1),1200)})},ne=e=>u(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),y=async()=>{let e=[...l];if(e.length!==0){p(!0);try{await i({sessionIds:e}),s!==null&&l.has(s)&&c(null),u(new Set)}finally{p(!1)}}};return(0,Y.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`h3`,{className:`text-sm font-semibold`,children:k()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:T()})]}),e?(0,Y.jsx)(V,{variant:v?`destructive`:`default`,size:`sm`,disabled:f||t===void 0,onClick:()=>void ee(),children:v?N():R()}):null]}),v?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(G,{variant:`secondary`,children:w()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:O({time:new Date(t.startedAt).toLocaleTimeString(`fr-FR`)})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?M():L()})}),a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Ye,{sessions:g,selected:s,checked:l,isAdmin:e,onSelect:c,onToggleCheck:ne}),e&&l.size>0?(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`destructive`,size:`sm`,disabled:f,onClick:()=>void y(),children:d({n:l.size})})}):null,(0,Y.jsx)(Xe,{report:_,copied:m,onCopy:te})]}):null]})}function Ye({sessions:e,selected:t,checked:n,isAdmin:r,onSelect:i,onToggleCheck:a}){return e?e.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:x()}),(0,Y.jsx)(`ul`,{className:`flex flex-col`,children:e.map(e=>{let o=t===e.sessionId;return(0,Y.jsxs)(`li`,{className:`flex items-center gap-2 border-t border-border py-1 text-sm first:border-t-0`,children:[r?(0,Y.jsx)(`input`,{type:`checkbox`,"aria-label":p(),checked:n.has(e.sessionId),onChange:()=>a(e.sessionId)}):null,(0,Y.jsx)(`button`,{type:`button`,className:`flex-1 truncate text-left ${o?`font-medium`:`text-muted-foreground`}`,onClick:()=>i(o?null:e.sessionId),children:new Date(e.startedAt).toLocaleString(`fr-FR`)}),e.active?(0,Y.jsx)(G,{variant:`secondary`,children:le()}):null]},e.sessionId)})})]}):null}function Xe({report:e,copied:t,onCopy:n}){if(!e)return null;if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:B()});let i=e.segments,o=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,a()]}),(0,Y.jsxs)(V,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Oe,{size:13,"aria-hidden":!0}):(0,Y.jsx)(Le,{size:13,"aria-hidden":!0}),t?v():I()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:E()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:r()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:b()})]})}),(0,Y.jsxs)(`tbody`,{children:[o(he(),i.A),o(S(),i.B),o(C(),i.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]})}var Ze=[50,100,200,500],Qe=`all`,Z=`__all__`,$e=[`2xx`,`4xx`,`5xx`],et=[`user`,`service`,`system`],tt=[`inbound`,`outbound`,`internal`],nt={kind:`relative`,from:`now-30d`,to:`now`},rt=[{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 it(){let e=Be({from:`/settings/traces`}),t=Pe({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Z,d=e.principalType??Z,p=e.direction??Z,g=e.roleKey??Z,v=e.q??``,b=Ue(e.from,e.to),x=(0,J.useMemo)(()=>Ve(e.adv),[e.adv]),{from:le,to:de}=ke(b),[S,C]=(0,J.useState)(null),[he,w]=(0,J.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),E=e=>void t({search:t=>({...t,kind:e})}),D=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),O=e=>void t({search:t=>({...t,statusClass:e===Z?void 0:e})}),k=e=>void t({search:t=>({...t,principalType:e===Z?void 0:e})}),A=e=>void t({search:t=>({...t,direction:e===Z?void 0:e})}),M=e=>void t({search:t=>({...t,roleKey:e===Z?void 0:e})}),N=e=>void t({search:t=>({...t,...Re(e)})}),P=e=>void t({search:t=>({...t,adv:ze(e)}),replace:!0}),F=j(z.observability.listEvents,{limit:n}),I=j(z.observability.listEvents,{limit:n,kind:r===Qe?void 0:r,filter:{q:v||void 0,from:le,to:de,statusClass:a===Z?void 0:a,principalType:d===Z?void 0:d,direction:p===Z?void 0:p,roleKey:g===Z?void 0:g,advanced:x.length>0?x:void 0}}),L=(0,J.useMemo)(()=>{let e=new Set;for(let t of F??[])e.add(t.kind);return[...e].sort()},[F]),R=(0,J.useMemo)(()=>{let e=new Set;for(let t of F??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[F]),B=v!==``||a!==Z||d!==Z||p!==Z||g!==Z||x.length>0||b.kind!==`relative`||b.from!==nt.from;function Oe(){t({search:{limit:100,kind:`all`},replace:!0})}let je=S?F?.filter(e=>e.correlationId===S):I;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Je,{}),(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[pe(),(0,Y.jsx)(`strong`,{children:me()}),_(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:Se()})]}),(0,Y.jsxs)(Ge,{q:v,onQChange:D,searchPlaceholder:ee(),timeRange:b,onTimeRangeChange:N,onReset:Oe,canReset:B,children:[(0,Y.jsxs)(q,{value:a,onValueChange:O,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:f()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Z,children:fe()}),$e.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:d,onValueChange:k,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:ce()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Z,children:m()}),et.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:p,onValueChange:A,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{placeholder:ue()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Z,children:o()}),tt.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:g,onValueChange:M,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{placeholder:De()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Z,children:ae()}),R.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:r,onValueChange:E,children:[(0,Y.jsx)(U,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(H,{placeholder:te()})}),(0,Y.jsxs)(W,{children:[(0,Y.jsx)(K,{value:Qe,children:h()}),L.map(e=>(0,Y.jsx)(K,{value:e,children:e},e))]})]}),(0,Y.jsxs)(q,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,Y.jsx)(U,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(W,{children:Ze.map(e=>(0,Y.jsx)(K,{value:String(e),children:u({count:e})},e))})]})]}),(0,Y.jsx)(Ke,{fields:rt,seed:x,onChange:P}),S?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:ie(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[y(),(0,Y.jsx)(`code`,{children:Q(S)})]}),(0,Y.jsx)(Ae,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:ne()})]})}):null,(0,Y.jsx)(qe,{title:be(),rows:je,emptyHint:S?i():xe(),columns:[{header:re(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:c(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(G,{variant:`secondary`,children:e.kind})},{header:l(),sort:e=>$(e)??null,cell:e=>{let t=$(e);return t?(0,Y.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,Y.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":se(),children:`✓`})}},{header:we(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(G,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:s(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(G,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Q(e.principalId)}):null]})},{header:oe(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(G,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Te(),sort:e=>e.route,cell:e=>e.route?(0,Y.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,Y.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:_e(),sort:e=>e.status,cell:e=>e.status===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsx)(`span`,{className:`oc-traces__status ${at(e.status)}`,children:e.status})},{header:Ee(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,Y.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Ce(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ge(),onClick:()=>C(e.correlationId),children:Q(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ve(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:ye()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(ot,{row:he,onClose:()=>w(null)})]})}function at(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 Q(e){return e.length>8?e.slice(0,8):e}function $(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 ot({row:e,onClose:t}){let n=(0,J.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,Y.jsx)(Fe,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(Me,{className:`max-w-lg`,children:[(0,Y.jsxs)(Ie,{children:[(0,Y.jsxs)(We,{className:`oc-traces__meta-title`,children:[A(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(G,{variant:`outline`,children:P()})]}),(0,Y.jsx)(Ne,{children:D()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{it as TracesTab};
@@ -1 +0,0 @@
1
- import{cw as e}from"./dist-DQy6UNW9.js";var t=e(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);export{t};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{XC as r,cw as i,ow as a,rw as o}from"./dist-DQy6UNW9.js";var s=i(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),c=i(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),l=t(e(),1),u=n();function d(e){let t=e+`CollectionProvider`,[n,i]=r(t),[s,c]=n(t,{collectionRef:{current:null},itemMap:new Map}),d=e=>{let{scope:t,children:n}=e,r=l.useRef(null),i=l.useRef(new Map).current;return(0,u.jsx)(s,{scope:t,itemMap:i,collectionRef:r,children:n})};d.displayName=t;let f=e+`CollectionSlot`,p=o(f),m=l.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,u.jsx)(p,{ref:a(t,c(f,n).collectionRef),children:r})});m.displayName=f;let h=e+`CollectionItemSlot`,g=`data-radix-collection-item`,_=o(h),v=l.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=l.useRef(null),s=a(t,o),d=c(h,n);return l.useEffect(()=>(d.itemMap.set(o,{ref:o,...i}),()=>void d.itemMap.delete(o))),(0,u.jsx)(_,{[g]:``,ref:s,children:r})});v.displayName=h;function y(t){let n=c(e+`CollectionConsumer`,t);return l.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${g}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:d,Slot:m,ItemSlot:v},y,i]}var f=l.createContext(void 0);function p(e){let t=l.useContext(f);return e||t||`ltr`}export{s as i,d as n,c as r,p as t};
@@ -1,5 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,BC as i,GC as a,HC as o,KC as s,UC as c,VC as l,WC as u,XC as d,YC as f,ew as p,ow as m,qC as h,rw as g,zC as _}from"./dist-DQy6UNW9.js";var v=t(e(),1),y=n(),b=`Dialog`,[x,S]=d(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,c=v.useRef(null),l=v.useRef(null),[u,d]=h({prop:r,defaultProp:i??!1,onChange:o,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:c,contentRef:l,contentId:a(),titleId:a(),descriptionId:a(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:s,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(E,n),o=m(t,a.triggerRef);return(0,y.jsx)(p.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":q(a.open),...i,ref:o,onClick:r(e.onClick,a.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)(s,{present:n||a.open,children:(0,y.jsx)(o,{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)(s,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=g(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=w(M,n);return(0,y.jsx)(i,{as:P,allowPinchZoom:!0,shards:[a.contentRef],children:(0,y.jsx)(p.div,{"data-state":q(a.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)(s,{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),i=v.useRef(null),a=m(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return _(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:r(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:r(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:r(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:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=w(I,n),d=v.useRef(null),f=m(t,d);return l(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(u,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":q(s.open),...o,ref:f,onDismiss:()=>s.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Z,{titleId:s.titleId}),(0,y.jsx)($,{contentRef:d,descriptionId:s.descriptionId})]})]})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(p.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)(p.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(G,n);return(0,y.jsx)(p.button,{type:`button`,...i,ref:t,onClick:r(e.onClick,()=>a.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}var J=`DialogTitleWarning`,[Y,X]=f(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
-
3
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
4
-
5
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Q=`DialogDescriptionWarning`,$=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${X(Q).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},ee=T,te=D,ne=j,re=N,ie=L,ae=H,oe=W,se=K;export{ne as a,te as c,re as i,Y as l,ie as n,ee as o,oe as r,ae as s,se as t,S as u};