@lacneu/atrium 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/assets/AccessTab-TkrgrzLa.js +1 -0
  2. package/dist/assets/AdvancedFilter-CxFcwq_P.js +1 -0
  3. package/dist/assets/AgentFilesTab-CatKzUVP.js +3 -0
  4. package/dist/assets/{AnomaliesTab-Dc0ZBmMT.js → AnomaliesTab-DSRyvaxR.js} +1 -1
  5. package/dist/assets/AuditTab-C5iOM0e2.js +1 -0
  6. package/dist/assets/BridgeTab-B7qr2P6q.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-iOv_x32i.js +1 -0
  8. package/dist/assets/{DataTableShell-67hI2aZh.js → DataTableShell-DQ-E7MMz.js} +1 -1
  9. package/dist/assets/{DetailChips-CTU-lZny.js → DetailChips-DLGo-JpY.js} +1 -1
  10. package/dist/assets/FeedbacksTab-CvsErlG2.js +1 -0
  11. package/dist/assets/{FieldLabel-D8l7ss4W.js → FieldLabel-D8ek_B4M.js} +2 -2
  12. package/dist/assets/FilesTab-B33o68UO.js +1 -0
  13. package/dist/assets/{FilterBar-DZBiB1MF.js → FilterBar-C2YZIUUe.js} +1 -1
  14. package/dist/assets/{GroupsTab-CdmZ136v.js → GroupsTab-CdvzID07.js} +1 -1
  15. package/dist/assets/{InstancesTab-BcQzLsnJ.js → InstancesTab-CGkYjfNo.js} +1 -1
  16. package/dist/assets/IntegrationsTab-CQpiJULa.js +1 -0
  17. package/dist/assets/{KpiTab-BNADRVU3.js → KpiTab-BSPnCroi.js} +1 -1
  18. package/dist/assets/PreferencesTab-C7qcojIg.js +1 -0
  19. package/dist/assets/{PromptInjectionsTab-C0cMSQ8x.js → PromptInjectionsTab-CogXAvHV.js} +2 -2
  20. package/dist/assets/RolesTab--gHOFpff.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-Cp2DaUB7.js +1 -0
  22. package/dist/assets/{SubAgentReportsTab-DP-c7pwV.js → SubAgentReportsTab-UtnXHw5b.js} +1 -1
  23. package/dist/assets/ThemeShowroom-cqNDsPWJ.js +1 -0
  24. package/dist/assets/TimeRangePicker-BrRrLGuZ.js +1 -0
  25. package/dist/assets/TracesTab-nnYTuzmk.js +1 -0
  26. package/dist/assets/UsersTab-C0cFq4Am.js +1 -0
  27. package/dist/assets/button-C-Nb2Vgm.js +1 -0
  28. package/dist/assets/{card-DdObfJrM.js → card-DfgoJ62e.js} +1 -1
  29. package/dist/assets/chevrons-up-down-BX1oFIbx.js +1 -0
  30. package/dist/assets/{compatView-Ihz_y_lK.js → compatView-DkKdPV6Y.js} +1 -1
  31. package/dist/assets/{dispatchErrorInfo-CiUDlf_q.js → dispatchErrorInfo-B5yYJpqG.js} +1 -1
  32. package/dist/assets/dist-BUmwZkrg.js +5 -0
  33. package/dist/assets/dist-dqCqhBJa.js +44 -0
  34. package/dist/assets/{dist-DErYNbMW.js → dist-nuTFLy00.js} +1 -1
  35. package/dist/assets/{dist-CkXWG_t8.js → dist-uaKglBXL.js} +1 -1
  36. package/dist/assets/{highlighted-body-OFNGDK62-rg7WOukZ.js → highlighted-body-OFNGDK62-CFixeKPt.js} +1 -1
  37. package/dist/assets/index-Chpx7q4s.js +227 -0
  38. package/dist/assets/index-CwMQjTTm.css +2 -0
  39. package/dist/assets/mermaid-GHXKKRXX-l2fnQUrB.js +1 -0
  40. package/dist/assets/roleDescriptions-BAcwraVL.js +1 -0
  41. package/dist/assets/{table-fGxqLVNE.js → table-DwL2Ye60.js} +1 -1
  42. package/dist/assets/{tabs-Bh17c652.js → tabs-B6uAHd27.js} +1 -1
  43. package/dist/assets/x-BK7YTQm6.js +1 -0
  44. package/dist/index.html +8 -8
  45. package/package.json +1 -1
  46. package/dist/assets/AccessTab-CQwLWARe.js +0 -1
  47. package/dist/assets/AdvancedFilter-Dsn2CdBY.js +0 -1
  48. package/dist/assets/AgentFilesTab-Cnvrgsf0.js +0 -3
  49. package/dist/assets/AuditTab-Bi5vISLS.js +0 -1
  50. package/dist/assets/BridgeTab-H12vdjQc.js +0 -1
  51. package/dist/assets/ChatDefaultsTab-rV2R20Ad.js +0 -1
  52. package/dist/assets/FeedbacksTab-CLE-RiFB.js +0 -1
  53. package/dist/assets/FilesTab-DlWojbFd.js +0 -1
  54. package/dist/assets/IntegrationsTab-DFEnr5e6.js +0 -1
  55. package/dist/assets/PreferencesTab-CJUrE633.js +0 -1
  56. package/dist/assets/RolesTab-Bwgnt5Nh.js +0 -1
  57. package/dist/assets/ServiceAccountsTab-C-KmfNqX.js +0 -1
  58. package/dist/assets/ThemeShowroom-ioH8EI6M.js +0 -1
  59. package/dist/assets/TimeRangePicker-BJ_SDnZN.js +0 -1
  60. package/dist/assets/TracesTab-CfxNJ_IN.js +0 -1
  61. package/dist/assets/UsersTab-C9upk4jg.js +0 -1
  62. package/dist/assets/button-HRR8tdJ2.js +0 -1
  63. package/dist/assets/chevrons-up-down-DLfMeWLX.js +0 -1
  64. package/dist/assets/dist-CKhDstdM.js +0 -44
  65. package/dist/assets/dist-DdcF2Plv.js +0 -5
  66. package/dist/assets/index-DR0RpyTI.js +0 -226
  67. package/dist/assets/index-GVGG9WDP.css +0 -2
  68. package/dist/assets/mermaid-GHXKKRXX-CHQslKq1.js +0 -1
  69. package/dist/assets/roleDescriptions-B8pJ6mkq.js +0 -1
  70. package/dist/assets/x-Dnhgu6fy.js +0 -1
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{An as r,Bn as i,Cn as a,Dn as o,En as s,Fn as ee,In as c,LT as l,Ln as te,Mn as ne,Nn as u,On as d,Pn as re,Rn as ie,Sn as f,Sr as p,Tn as m,Vn as h,_E as g,_n as _,bn as v,br as ae,fn as y,gn as b,hn as x,jn as S,kb as C,kn as oe,mE as w,mn as T,pn as E,uE as D,vn as O,wn as k,xn as A,yn as j,zT as se,zn as M}from"./dist-CKhDstdM.js";import{t as N}from"./button-HRR8tdJ2.js";import{$ as P,A as F,B as I,C as L,D as R,E as z,F as ce,I as le,L as ue,N as de,P as fe,Q as pe,R as me,S as B,T as V,X as H,et as he,mt as U,nt as ge,ot as _e,rt as ve,w as W,z as ye}from"./index-DR0RpyTI.js";import{i as G}from"./compatView-Ihz_y_lK.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=g(D.me.getMe,{host:_e}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),a=g(D.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,K.useState)(null);(0,K.useEffect)(()=>{!t||!a||a.length===0||(!o||!a.some(e=>e.name===o))&&s(a[0].name)},[t,a,o]);let d=g(D.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),f=g(D.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),p=(0,K.useMemo)(()=>{if(e!==void 0){if(t)return o===null||d===void 0?a!==void 0&&a.length===0?[]:void 0:d.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(f!==void 0)return f.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,d,a,f]),[m,_]=(0,K.useState)(null);(0,K.useEffect)(()=>{!p||p.length===0||(!m||!p.some(e=>$(e)===m))&&_($(p[0]))},[p,m]);let v=p?.find(e=>$(e)===m)??null,y=w(D.agentFiles.listAgentFiles),[b,x]=(0,K.useState)({status:`idle`}),C=v?.instanceName??null,T=v?.agentId??null,E=g(D.compat.forInstance,n&&C!==null?{instanceName:C}:`skip`),O=n&&C!==null?R(E,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,A=(0,K.useCallback)(async()=>{if(!(C===null||T===null)){x({status:`loading`});try{x({status:`done`,files:(await y({instanceName:C,agentId:T})).files})}catch{x({status:`error`})}}},[y,C,T]);(0,K.useEffect)(()=>{k===!1&&A()},[A,k]);let[j,P]=(0,K.useState)(null),F=se(),I=(0,K.useMemo)(()=>new Intl.NumberFormat(F,{maximumFractionDigits:0}),[F]);return e===void 0||p===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(a?.length??0)>1?(0,Q.jsxs)(B,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":i(),children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(L,{children:(a??[]).map(e=>(0,Q.jsx)(W,{value:e.name,children:e.name},e.name))})]}):null,p.length>0?(0,Q.jsxs)(B,{value:m??``,onValueChange:e=>_(e),children:[(0,Q.jsx)(V,{size:`sm`,"aria-label":M(),children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(L,{children:p.map(e=>(0,Q.jsx)(W,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]}),v===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(U,{size:14,"aria-hidden":!0}),` `,G(O.gatewayVersion)]}):b.status===`loading`||b.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):b.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[c(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:ae()})]}):b.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:b.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)(H,{variant:`outline`,children:ee()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:re({size:Z(e.size,F)})}),(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:u({pct:I.format(n)})}),i?(0,Q.jsx)(U,{size:14,className:`oc-afiles__warn`,"aria-label":ne()}):(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():oe()})]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:S({used:Z(be(b.files),F),total:Z(J,F),pct:I.format(X(be(b.files)))})})]}),j&&v?(0,Q.jsx)(Te,{instanceName:v.instanceName,agentId:v.agentId,name:j.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void A()}):null]})}function Te({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:ee}){let c=w(D.agentFiles.getAgentFile),te=w(D.agentFiles.setAgentFile),ne=F(),[u,re]=(0,K.useState)(null),[ie,h]=(0,K.useState)(!1),[g,S]=(0,K.useState)(``),[oe,M]=(0,K.useState)(!1),[L,R]=(0,K.useState)(!1),[z,B]=(0,K.useState)(!1),[V,H]=(0,K.useState)(!1),U=(0,K.useCallback)(async r=>{h(!1);try{let i=await c({instanceName:e,agentId:t,name:n});re({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),B(!1)}catch{h(!0)}},[c,e,t,n]);(0,K.useEffect)(()=>{U(!1)},[U]);async function _e(){if(u!==null){R(!0),H(!1);try{await te({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:u.updatedAtMs??void 0}),ne.success(f({name:n})),ee(),await U(!1)}catch(e){Ce(e)?B(!0):H(!0)}finally{R(!1)}}}let W=u!==null&&g!==u.content,G=(0,K.useMemo)(()=>u===null?null:Se(u.content,g),[u,g]),J=g.length>q,Y=se(),X=(0,K.useMemo)(()=>new Intl.NumberFormat(Y),[Y]);return(0,Q.jsx)(pe,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(P,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(ve,{children:d({name:n})}),(0,Q.jsxs)(he,{children:[o({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,s()]})]})]}),ie?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!1),children:ae()})]}):u===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!r,spellCheck:!1,onChange:e=>S(e.target.value),"aria-label":d({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:m()}),z?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[j(),` `,(0,Q.jsx)(N,{variant:`outline`,size:`sm`,onClick:()=>void U(!0),children:O()})]}):null,V?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:A()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${J?` is-over`:``}`,children:k({count:X.format(g.length),max:X.format(q)})}),r?(0,Q.jsx)(N,{size:`sm`,disabled:!W||L||z,onClick:()=>M(!0),children:L?p():a()}):null]})]}),(0,Q.jsx)(de,{open:oe,onOpenChange:M,children:(0,Q.jsxs)(le,{children:[(0,Q.jsxs)(ye,{children:[(0,Q.jsx)(I,{children:_({name:n})}),(0,Q.jsx)(ue,{children:b({agent:t})})]}),G?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:x({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:T()}),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:E()}),G.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(ce,{children:C()}),(0,Q.jsx)(fe,{onClick:()=>void _e(),children:y()})]})]})})]})})}export{we as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bp as r,Gp as i,Hp as a,Ip as o,Jp as s,Kp as c,Lp as l,Rp as u,Up as ee,Vp as d,Wp as f,Xp as p,Yp as m,_E as h,qp as g,uE as _,zp as v}from"./dist-CKhDstdM.js";import{n as y}from"./TimeRangePicker-BJ_SDnZN.js";import{At as b,C as x,E as S,S as C,T as w,a as T,i as E,kt as D,o as O,r as k,t as A,w as j}from"./index-DR0RpyTI.js";import{t as M}from"./FilterBar-DZBiB1MF.js";import{t as N}from"./AdvancedFilter-Dsn2CdBY.js";import{t as P}from"./DataTableShell-67hI2aZh.js";var F=t(e(),1),I=n(),L={kind:`relative`,from:A,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=b({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,A=e.action??R,B=e.impersonated??R,V=e.resource??R,H=k(e.from,e.to),U=(0,F.useMemo)(()=>O(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,...T(e)})}),Z=e=>void t({search:t=>({...t,adv:E(e)}),replace:!0}),Q=h(_.admin.listAudit,{filter:{q:n||void 0,from:W,to:G,action:A===R?void 0:A,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!==``||A!==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:[p(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,I.jsxs)(M,{q:n,onQChange:K,searchPlaceholder:s(),timeRange:H,onTimeRangeChange:X,onReset:re,canReset:ne,children:[(0,I.jsxs)(C,{value:A,onValueChange:q,children:[(0,I.jsx)(w,{size:`sm`,className:`w-40`,children:(0,I.jsx)(S,{placeholder:g()})}),(0,I.jsxs)(x,{children:[(0,I.jsx)(j,{value:R,children:c()}),$.map(e=>(0,I.jsx)(j,{value:e,children:e},e))]})]}),(0,I.jsxs)(C,{value:B,onValueChange:J,children:[(0,I.jsx)(w,{size:`sm`,className:`w-40`,children:(0,I.jsx)(S,{})}),(0,I.jsxs)(x,{children:[(0,I.jsx)(j,{value:R,children:i()}),(0,I.jsx)(j,{value:`yes`,children:f()}),(0,I.jsx)(j,{value:`no`,children:ee()})]})]}),(0,I.jsxs)(C,{value:V,onValueChange:Y,children:[(0,I.jsx)(w,{size:`sm`,className:`w-40`,children:(0,I.jsx)(S,{placeholder:a()})}),(0,I.jsxs)(x,{children:[(0,I.jsx)(j,{value:R,children:d()}),te.map(e=>(0,I.jsx)(j,{value:e,children:e},e))]})]})]}),(0,I.jsx)(N,{fields:z,seed:U,onChange:Z}),(0,I.jsx)(P,{title:r(),rows:Q,emptyHint:v(),columns:[{header:u(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:g(),cell:e=>e.action,sort:e=>e.action},{header:l(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:o(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),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{$c as r,$l as i,Bc as a,Bt as o,Cl as s,Fc as c,Gc as l,Gl as u,Gt as d,Hc as f,Ht as p,Ic as m,It as h,Jc as g,Jt as _,Kc as v,Kl as ee,Kt as y,Lc as b,Qc as te,Ql as ne,Rc as re,Sl as ie,Uc as ae,Ut as oe,Vc as se,Vt as ce,Wc as le,Wt as ue,Xc as de,Xl as fe,Xt as pe,Yc as x,Yl as me,Yt as he,Zc as ge,Zl as _e,Zt as ve,_E as S,_l as ye,al as be,au as xe,bl as Se,cl as C,dE as w,dl as Ce,el as we,eu as Te,fl as Ee,gE as De,gl as Oe,hl as ke,il as Ae,iu as je,ll as Me,mE as Ne,ml as Pe,nl as Fe,nu as Ie,ol as Le,pl as Re,qc as ze,qt as Be,rl as Ve,sl as He,tl as Ue,tu as We,uE as T,ul as Ge,vl as Ke,xl as qe,yl as Je,zc as Ye}from"./dist-CKhDstdM.js";import{i as E,r as Xe}from"./dist-CkXWG_t8.js";import{t as Ze}from"./chevrons-up-down-DLfMeWLX.js";import{i as Qe,n as D,o as $e,r as et,s as tt}from"./FieldLabel-D8l7ss4W.js";import{t as O}from"./button-HRR8tdJ2.js";import{$ as nt,A as rt,C as k,Dt as A,E as j,H as it,Ot as at,Q as ot,S as M,St as st,T as N,U as ct,V as lt,X as P,Z as F,_t as ut,et as dt,kt as ft,mt as I,nt as pt,ot as mt,rt as ht,w as L,x as gt}from"./index-DR0RpyTI.js";import{a as _t,i as R,n as vt,o as z,r as B,t as yt}from"./table-fGxqLVNE.js";import{t as bt}from"./FilterBar-DZBiB1MF.js";import{a as V,n as xt,o as H,r as U,s as St,t as Ct}from"./compatView-Ihz_y_lK.js";import{t as W}from"./dispatchErrorInfo-CiUDlf_q.js";var wt=w(`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`}]]),Tt=w(`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`}]]),G=t(e(),1);function Et(e){return e.filter(e=>e.state===`error`)}function Dt(e){return e.reachable&&Et(e.targets).length===0}function Ot(e){return e.state===`error`&&e.lastErrorCode!==null}function kt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function At(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function jt(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,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return At(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function Mt(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var q=`__all__`,Nt={q:``,state:q,instance:q,version:q},J={connected:0,error:1,idle:2};function Pt(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function Ft(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 Y(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function X(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function It(e,t,n){switch(e){case`state`:return(J[t.state]??99)-(J[n.state]??99);case`instance`:return Y(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Y(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return H(e,r)??Y(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Y(t.targetLabel,n.targetLabel)}}function Lt(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=X(t.key,e),a=X(t.key,r);return i&&a?0:i?1:a?-1:n*It(t.key,e,r)})}function Rt(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(J[e]??99)-(J[t]??99))}function zt(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)=>Y(e.label,t.label))}function Bt(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>H(e,t)??Y(e,t))}var Z=n();function Vt({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(Nt),[o,s]=(0,G.useState)(null),c=(0,G.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]),u=(0,G.useMemo)(()=>Rt(c),[c]),d=(0,G.useMemo)(()=>zt(c),[c]),p=(0,G.useMemo)(()=>Bt(c),[c]),m=(0,G.useMemo)(()=>Lt(Ft(c,n),o),[c,n,o]);function h(e){s(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(bt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:de(),onReset:()=>i(Nt),canReset:Pt(n),children:[(0,Z.jsxs)(M,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:g()})}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(L,{value:q,children:x()}),u.map(e=>(0,Z.jsx)(L,{value:e,children:Ut(e)},e))]})]}),(0,Z.jsxs)(M,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:ze()})}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(L,{value:q,children:x()}),d.map(e=>(0,Z.jsx)(L,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(M,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:v()})}),(0,Z.jsxs)(k,{children:[(0,Z.jsx)(L,{value:q,children:x()}),p.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Z.jsxs)(yt,{className:`oc-conn__table`,children:[(0,Z.jsx)(_t,{children:(0,Z.jsxs)(z,{children:[(0,Z.jsx)(Q,{label:le(),sortKey:`target`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:ae(),sortKey:`state`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:f(),sortKey:`instance`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:se(),sortKey:`host`,sort:o,onSort:h}),(0,Z.jsx)(Q,{label:a(),sortKey:`version`,sort:o,onSort:h}),(0,Z.jsx)(R,{children:Ye()}),(0,Z.jsx)(Q,{label:re(),sortKey:`lastOk`,sort:o,onSort:h})]})}),(0,Z.jsx)(vt,{children:m.map(e=>(0,Z.jsx)(Ht,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(R,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(Xe,{size:13,"aria-hidden":!0}):(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Ze,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function Ht({r:e}){let t=Ot(e)?W(e.lastErrorCode):null,n=kt(e)?W(e.lastDownstreamRejectCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(z,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(B,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(B,{children:(0,Z.jsx)(Wt,{state:e.state})}),(0,Z.jsx)(B,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(B,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(B,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(B,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:te({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(B,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:new Date(e.lastOkAt).toLocaleTimeString(`fr-FR`)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Z.jsx)(z,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(B,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${new Date(e.lastErrorAt).toLocaleTimeString(`fr-FR`)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ge({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${new Date(e.lastDownstreamRejectAt).toLocaleTimeString(`fr-FR`)}`:``]}):null]})}):null]})}function Ut(e){return e===`connected`?b():e===`error`?m():c()}function Wt({state:e}){return e===`connected`?(0,Z.jsx)(P,{variant:`secondary`,children:b()}):e===`error`?(0,Z.jsx)(P,{variant:`destructive`,children:m()}):(0,Z.jsx)(P,{variant:`outline`,children:c()})}function Gt(){return S(T.bridgeHealth.getBridgeHealth,{})}function Kt(){let e=Gt(),t=S(T.compat.getBridgeCompat,{}),n=S(T.me.getMe,{host:mt})?.role===`admin`,r=S(T.admin.listInstances,n?{}:`skip`),i=ft(),a=()=>void i({to:`/settings/anomalies`,search:{status:`open`}}),o=jt(e?e.targets:[],t?t.targets:[],r??[]),s=t?.compat??null,c=t===void 0?`loading`:t===null?`nodata`:`ready`,l=s!==null&&xt(s,`hermes`)&&!o.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(qt,{health:e,compat:t,onSeeAnomalies:a}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Me()}),o.map(e=>(0,Z.jsx)(Jt,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:s,compatStatus:c,compatReachable:t?.reachable??!0},e.key)),l?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):null]})}function qt({health:e,compat:t,onSeeAnomalies:n}){let r=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:V(t.bridgeVersion)}),` · `,he(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?_():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:He()});let i=Et(e.targets),a=!e.reachable,o=Dt(e),s=o?`ok`:`error`,c=new Date(e.checkedAt).toLocaleString(`fr-FR`),l=e.startedAt==null?null:new Date(e.startedAt).toLocaleString(`fr-FR`);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${s}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:o?(0,Z.jsx)(A,{size:22}):a?(0,Z.jsx)(Tt,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:o?Le():a?be():Ae({count:i.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(wt,{size:12,"aria-hidden":!0}),` `,Ve({time:c})]}),l?(0,Z.jsx)(`span`,{children:Fe({time:l})}):null,r]}),a?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ue()})]})}function Jt({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a}){let o=r?St(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:Ct(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,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(ut,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:Mt(e)}),d?(0,Z.jsx)(P,{variant:d===`beyond`?`destructive`:`secondary`,children:U(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ve()}),(0,Z.jsx)(Yt,{support:o,compatStatus:i,compatReachable:a,manifest:r,instanceRows:c}),(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(E,{size:13,"aria-hidden":!0}):(0,Z.jsx)(at,{size:13,"aria-hidden":!0}),we({count:t.length})]}),f?(0,Z.jsx)(Vt,{connections:t,displayByInstance:s}):null]})}function Yt({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:d()}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:ue({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:_()}),e?(0,Z.jsx)(Qt,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:V(e.version)}),(0,Z.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:U(e.state)})]},e.instanceName))})]})}function Xt({instance:e,onClose:t}){return(0,Z.jsx)(ot,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(ht,{children:xe({instance:e.displayName??e.name})}),(0,Z.jsx)(dt,{children:je()})]}),(0,Z.jsx)(Zt,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.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,Z.jsx)(A,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Re():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Ee()]}):null}function Zt({instance:e,onClose:t}){let n=De(T.admin.upsertInstanceConfig),r=Ne(T.bridge.validateMediaPaths),a=rt(),[o,c]=(0,G.useState)(()=>Qe(e.config??{})),[l,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){a.error(ye(),e)}finally{p(!1)}}async function b(){d(!0);try{let r=e.config??{};await n({instanceId:e._id,config:et(o,r)}),t()}catch(e){a.error(_e(),e)}finally{d(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Ie(),help:fe()}),(0,Z.jsxs)(M,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(k,{children:tt.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:We(),help:me()}),(0,Z.jsxs)(M,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(k,{children:$e.map(e=>(0,Z.jsx)(L,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Te(),help:ee()}),(0,Z.jsx)(F,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:s(),help:ie()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:qe(),help:Se()}),(0,Z.jsx)(F,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(gt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:i(),help:u()})]}),v&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),Ge({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:ke(),result:m.inbound}),(0,Z.jsx)($,{label:Pe(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),Ce()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(O,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:f,children:[f?(0,Z.jsx)(st,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,f?Ke():Je()]}),(0,Z.jsx)(O,{size:`sm`,onClick:()=>void b(),disabled:l,children:ne()})]})]})})}function Qt({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(lt,{children:[(0,Z.jsx)(ct,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?oe():p({count:e.length}),(0,Z.jsx)(E,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(it,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{Kt as BridgeTab,Xt as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$t as r,Bn as i,LT as a,Qt as o,Sr as s,_E as c,an as ee,br as te,cn as ne,en as re,gr as ie,hr as ae,in as oe,kb as se,ln as l,mE as u,nn as d,on as ce,rn as f,ru as p,sn as m,tn as le,uE as h,un as ue}from"./dist-CKhDstdM.js";import{t as g}from"./button-HRR8tdJ2.js";import{A as de,B as fe,C as pe,D as me,E as he,F as _,I as v,L as y,N as b,P as x,R as S,S as C,T as w,g as T,h as E,mt as D,w as O,z as k}from"./index-DR0RpyTI.js";import{i as A}from"./compatView-Ihz_y_lK.js";/* empty css */var j=t(e(),1),M=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function N(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var P=n();function F(){let e=u(h.agentFiles.getChatDefaults),t=u(h.agentFiles.setChatDefaults),n=de(),[F,I]=(0,j.useState)({status:`loading`}),[L,R]=(0,j.useState)({thinkingDefault:null,fastModeDefault:null}),[ge,z]=(0,j.useState)(!1),[B,V]=(0,j.useState)(!1),H=c(h.admin.listInstances,{}),[U,W]=(0,j.useState)(null);(0,j.useEffect)(()=>{!H||H.length===0||(!U||!H.some(e=>e.name===U))&&W(H[0].name)},[H,U]);let G=(H?.length??0)>1,_e=H!==void 0&&H.length===0,ve=c(h.compat.forInstance,U?{instanceName:U}:`skip`),K=U?me(ve,`configDefaults`):`loading`,q=K===`loading`?null:K.blocked,J=(0,j.useMemo)(()=>G&&U?{instanceName:U}:{},[G,U]),Y=(0,j.useRef)(0),X=(0,j.useCallback)(async()=>{let t=++Y.current;I({status:`loading`});try{let n=N(await e(J));if(Y.current!==t)return;I({status:`done`,current:n}),R(n)}catch{if(Y.current!==t)return;I({status:`error`})}},[e,J]);(0,j.useEffect)(()=>{q===!1&&(G&&!U||X())},[X,q,G,U]);let Z=F.status===`done`?F.current:null,Q=Z!==null&&L.thinkingDefault!==null&&L.thinkingDefault!==Z.thinkingDefault,$=Z!==null&&L.fastModeDefault!==null&&L.fastModeDefault!==Z.fastModeDefault,ye=Q||$;async function be(){V(!0);try{await t({...J,...Q?{thinkingDefault:L.thinkingDefault}:{},...$?{fastModeDefault:L.fastModeDefault}:{}}),n.success(f()),await X()}catch(e){n.error(d(),e)}finally{V(!1)}}let xe=(0,j.useMemo)(()=>M.map(e=>({id:e,label:T(e)})),[]),Se=(0,j.useMemo)(()=>[{id:`fast`,label:ie()},{id:`standard`,label:ae()}],[]);return(0,P.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),G&&U?(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,P.jsxs)(C,{value:U,onValueChange:e=>W(e),disabled:B,children:[(0,P.jsx)(w,{size:`sm`,"aria-label":i(),children:(0,P.jsx)(he,{})}),(0,P.jsx)(pe,{children:(H??[]).map(e=>(0,P.jsx)(O,{value:e.name,children:e.name},e.name))})]})]}):null,_e?(0,P.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:p()}):K===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):K.blocked?(0,P.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,P.jsx)(D,{size:14,"aria-hidden":!0}),` `,A(K.gatewayVersion)]}):F.status===`loading`?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):F.status===`error`?(0,P.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ee(),` `,(0,P.jsx)(g,{variant:`outline`,size:`sm`,onClick:()=>void X(),children:te()})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,P.jsx)(E,{options:xe,value:L.thinkingDefault,onChange:e=>R({...L,thinkingDefault:e}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()})]}),(0,P.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,P.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,P.jsx)(E,{options:Se,value:L.fastModeDefault===null?null:L.fastModeDefault?`fast`:`standard`,onChange:e=>R({...L,fastModeDefault:e===`fast`}),disabled:B}),(0,P.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]}),(0,P.jsx)(`div`,{className:`oc-cdefaults__actions`,children:(0,P.jsx)(g,{size:`sm`,disabled:!ye||B,onClick:()=>z(!0),children:B?s():oe()})}),(0,P.jsx)(`p`,{className:`oc-cdefaults__note`,children:le()})]}),(0,P.jsx)(b,{open:ge,onOpenChange:z,children:(0,P.jsxs)(v,{children:[(0,P.jsxs)(k,{children:[(0,P.jsx)(fe,{children:re()}),(0,P.jsx)(y,{children:r()})]}),(0,P.jsxs)(S,{children:[(0,P.jsx)(_,{children:se()}),(0,P.jsx)(x,{onClick:()=>void be(),children:o()})]})]})})]})}export{F as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$g as r,Ag as i,Bg as a,Cg as o,Dg as s,Eg as c,Fg as l,Gg as u,Hg as d,Ig as f,Jg as p,Kg as m,Lg as h,Mg as g,Ng as _,Og as v,Pg as y,Qg as ee,Rg as te,Sg as ne,Tg as re,Ug as ie,Vg as ae,Wg as b,Xg as x,Yg as S,Zg as C,_E as w,_g as T,a_ as E,bg as D,c_ as O,d_ as k,dg as A,e_ as j,f_ as M,fg as N,gE as P,gg as F,hg as I,i_ as L,jg as R,kg as z,l_ as oe,mg as B,n_ as V,o_ as H,pg as U,qg as W,r_ as G,s_ as K,t_ as q,uE as J,u_ as se,vg as ce,wg as le,xg as ue,yg as de,zg as fe}from"./dist-CKhDstdM.js";import{t as pe}from"./button-HRR8tdJ2.js";import{j as me}from"./index-DR0RpyTI.js";import{t as he}from"./DataTableShell-67hI2aZh.js";var Y=t(e(),1),X=n(),Z={altered_words:()=>M(),incorrect:()=>k(),incoherence:()=>se(),formatting:()=>oe(),latency:()=>O(),api_error:()=>K(),other:()=>H()},Q=e=>Z[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:L()}):e===!1?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:G()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:E()})}function ge({data:e,closeReason:t}){let n=e.snapshot,i=P(J.feedback.respondToFeedback),[o,s]=(0,Y.useState)(e.thread),[c,l]=(0,Y.useState)(``),[g,_]=(0,Y.useState)(!1);async function v(){let t=c.trim();if(!(!t||g)){_(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{_(!1)}}}let y=[];try{y=n.contextJson?JSON.parse(n.contextJson):[]}catch{y=[]}return(0,X.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,X.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,X.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,X.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${V()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:q()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),(0,X.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),o.length>0?(0,X.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,X.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?r():ee()}),(0,X.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,X.jsx)(`p`,{className:`oc-fbadmin__meta`,children:C()}),(0,X.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:x(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,X.jsx)(pe,{size:`sm`,onClick:()=>void v(),disabled:!c.trim()||g,children:g?S():p()})})]}),(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:W()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||m()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||m()})]}):null,n.promptText?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,X.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,y.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie({count:n.contextCount??y.length,truncated:n.contextTruncated?d():``})}),(0,X.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.map((e,t)=>(0,X.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,X.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae()}),(0,X.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,X.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,X.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?te({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,X.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,n.clientInfo.plugins.join(`, `),(0,X.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,f()]})]}):null,n.clientInfo?.userAgent?(0,X.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function _e(){let e=w(J.feedback.listForAdmin,{}),t=P(J.feedback.readSnapshot),n=P(J.feedback.deleteFeedback),r=me(),[a,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)({});async function p(e){if(a===e._id){u(null);return}if(!d[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}u(e._id)}async function m(e){await r({title:U(),description:N(),confirmLabel:A(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&u(null))}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,X.jsx)(`strong`,{children:y()}),` `,_()]}),(0,X.jsx)(he,{title:g(),rows:e,emptyHint:R(),isExpanded:e=>a===e._id&&!!d[e._id],renderExpanded:e=>d[e._id]?(0,X.jsx)(ge,{data:d[e._id],closeReason:e.userCloseReason}):null,columns:[{header:i(),cell:e=>new Date(e.at).toLocaleString(`fr-FR`),sort:e=>e.at},{header:z(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:v(),cell:e=>e.messageRole===`user`?s():c(),sort:e=>e.messageRole},{header:re(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${le({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:o(),cell:e=>(0,X.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ne(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:ue(),cell:e=>e.userClosedAt==null?e.answered?(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:D()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill`,children:de()}):(0,X.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ce()}),sort:e=>e.userClosedAt==null?+!!e.answered:2}],rowActions:e=>[{label:a===e._id?F():I(),onSelect:()=>void p(e)},{label:B(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{_e as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Bw as ee,Fw as i,Gw as te,Hw as a,Iw as ne,Jw as re,Kw as ie,LT as o,Lw as s,Pw as c,Qw as l,Rw as u,Uw as d,Vw as f,Ww as ae,Xw as oe,Yw as se,Zw as ce,_E as le,aT as ue,cT as de,dT as p,eT as m,fT as h,gE as fe,hT as pe,iT as g,kb as me,lT as he,mT as ge,nT as _,oT as _e,pT as ve,qw as v,rT as y,sT as b,tT as x,uE as S,uT as C,zT as w,zw as T}from"./dist-CKhDstdM.js";import{t as E}from"./button-HRR8tdJ2.js";import{A as D,B as O,C as k,E as A,F as j,G as M,I as N,K as P,L as F,N as ye,P as be,R as xe,S as I,T as L,Tt as R,W as Se,X as Ce,Y as we,ht as Te,w as z,wt as Ee,yt as De,z as Oe}from"./index-DR0RpyTI.js";import{a as ke,i as B,n as Ae,o as V,r as H,t as je}from"./table-fGxqLVNE.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return g();case`audio`:return y();case`video`:return _();case`pdf`:return x();case`document`:return m();case`archive`:return r();default:return l()}}function q(){let[e,t]=(0,U.useState)(G),[n,r]=(0,U.useState)(G),[l,m]=(0,U.useState)(G),[g,_]=(0,U.useState)(G),[y,x]=(0,U.useState)(null),q=fe(S.files.softDelete),J=D();function Me(){t(G),r(G),m(G),_(G)}async function Ne(){let e=y;if(x(null),e)try{await q({fileId:e.id}),J.success(f())}catch(e){J.error(ee(),e)}}let Y=le(S.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:l===G?void 0:l,category:g===G?void 0:g}),X=(0,U.useMemo)(()=>new Intl.DateTimeFormat(w(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(Y===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let{files:Z,facets:Q,truncated:Pe,cap:Fe}=Y,$=e!==G||n!==G||l!==G||g!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(I,{value:e,onValueChange:t,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:ve()}),(0,W.jsx)(z,{value:`inbound`,children:h()}),(0,W.jsx)(z,{value:`outbound`,children:p()})]})]}),(0,W.jsxs)(I,{value:n,onValueChange:r,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":C(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:he()}),Q.chats.map(e=>(0,W.jsx)(z,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(I,{value:l,onValueChange:m,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":de(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:b()}),Q.instances.map(e=>(0,W.jsx)(z,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(I,{value:g,onValueChange:_,children:[(0,W.jsx)(L,{size:`sm`,"aria-label":_e(),children:(0,W.jsx)(A,{})}),(0,W.jsxs)(k,{children:[(0,W.jsx)(z,{value:G,children:ue()}),Q.categories.map(e=>(0,W.jsx)(z,{value:e,children:K(e)},e))]})]}),$?(0,W.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Me,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(De,{size:14,"aria-hidden":!0}),ae()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?i():ne()}):(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:ce()}),(0,W.jsx)(B,{children:oe()}),(0,W.jsx)(B,{children:se()}),(0,W.jsx)(B,{children:re()}),(0,W.jsx)(B,{children:v()}),(0,W.jsx)(B,{className:`text-right`,children:ie()})]})}),(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)(Ce,{variant:`secondary`,children:e.direction===`inbound`?h():p()})}),(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)(Se,{children:[(0,W.jsx)(we,{asChild:!0,children:(0,W.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":d(),children:(0,W.jsx)(Ee,{size:16})})}),(0,W.jsxs)(M,{align:`end`,children:[e.url?(0,W.jsx)(P,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(R,{size:14}),te()]})}):(0,W.jsxs)(P,{disabled:!0,children:[(0,W.jsx)(R,{size:14}),s()]}),(0,W.jsxs)(P,{variant:`destructive`,onSelect:()=>x({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Te,{size:14}),a()]})]})]})})]},e._id))})]}),Pe?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:c({cap:Fe})}):null]}),(0,W.jsx)(ye,{open:y!==null,onOpenChange:e=>!e&&x(null),children:(0,W.jsxs)(N,{children:[(0,W.jsxs)(Oe,{children:[(0,W.jsx)(O,{children:T()}),(0,W.jsx)(F,{children:u()})]}),(0,W.jsxs)(xe,{children:[(0,W.jsx)(j,{children:me()}),(0,W.jsx)(be,{onClick:()=>void Ne(),children:a()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,A_ as i,B_ as a,C_ as o,D_ as s,E_ as c,F_ as l,G_ as u,H_ as ee,I_ as te,J_ as ne,K_ as re,L_ as ie,M_ as ae,N_ as d,O_ as oe,P_ as f,Q_ as p,R_ as m,S_ as h,T_ as g,U_ as _,V_ as v,W_ as y,X_ as b,Y_ as se,Z_ as ce,_E as le,__ as ue,_t as x,av as S,b_ as C,bt as w,ev as T,ft as E,gE as D,g_ as O,gt as k,h_ as A,ht as j,iv as M,j_ as N,k_ as P,mE as F,m_ as I,mt as L,nv as R,p_ as z,pt as B,q_ as V,rv as H,tv as U,uE as W,v_ as de,vt as fe,w_ as pe,x_ as me,y_ as he,yt as ge,z_ as _e}from"./dist-CKhDstdM.js";import{t as G}from"./button-HRR8tdJ2.js";import{C as ve,E as ye,S as be,T as xe,X as K,Z as q,w as Se,x as Ce}from"./index-DR0RpyTI.js";import{t as we}from"./DataTableShell-67hI2aZh.js";var J=t(e(),1),Y=n();function Te(){let e=le(W.integrations.status.status,{}),t=D(W.admin.setIntegrationConfig),[n,x]=(0,J.useState)(null);if((0,J.useEffect)(()=>{e&&n===null&&x(e.config)},[e,n]),!e||!n)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:S()});let E=n,k=(e,t,n)=>x({...E,[e]:{...E[e],[t]:n}}),j=(e,n)=>void t({[e]:n});return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[M(),` `,(0,Y.jsx)(`strong`,{children:H()}),` `,R()]}),(0,Y.jsxs)(X,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:T()}):(0,Y.jsx)(K,{variant:`outline`,children:r()}),note:ce(),children:[(0,Y.jsx)(Z,{label:se(),children:(0,Y.jsx)(q,{value:E.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>k(`langfuse`,`host`,e.target.value),onBlur:()=>j(`langfuse`,{host:E.langfuse.host??``})})}),(0,Y.jsx)(Q,{label:u(),checked:E.langfuse.enabled??!0,onChange:e=>{k(`langfuse`,`enabled`,e),j(`langfuse`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:T()}):(0,Y.jsx)(K,{variant:`outline`,children:r()}),note:b(),children:[(0,Y.jsx)(Z,{label:ne(),children:(0,Y.jsx)(q,{value:E.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>k(`opik`,`baseUrl`,e.target.value),onBlur:()=>j(`opik`,{baseUrl:E.opik.baseUrl??``})})}),(0,Y.jsx)(Z,{label:V(),children:(0,Y.jsx)(q,{value:E.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||re(),onChange:e=>k(`opik`,`workspace`,e.target.value),onBlur:()=>j(`opik`,{workspace:E.opik.workspace??``})})}),(0,Y.jsx)(Q,{label:u(),checked:E.opik.enabled??!0,onChange:e=>{k(`opik`,`enabled`,e),j(`opik`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,Y.jsx)(K,{variant:`secondary`,children:U()}):(0,Y.jsx)(K,{variant:`outline`,children:T()}):(0,Y.jsx)(K,{variant:`outline`,children:w()}),note:ge(),children:[(0,Y.jsx)(Z,{label:fe(),children:(0,Y.jsx)(q,{value:E.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>k(`otlp`,`endpoint`,e.target.value),onBlur:()=>j(`otlp`,{endpoint:E.otlp.endpoint??``})})}),(0,Y.jsx)(Ee,{headersSet:e.otlp.headersSet}),(0,Y.jsx)(Q,{label:u(),checked:E.otlp.enabled??!0,onChange:e=>{k(`otlp`,`enabled`,e),j(`otlp`,{enabled:e})}})]}),(0,Y.jsxs)(X,{title:y(),status:(0,Y.jsx)(K,{variant:`outline`,children:p()}),note:_(),children:[(0,Y.jsx)(Z,{label:ee(),children:(0,Y.jsx)($,{value:E.tts.auto??`off`,options:[[`off`,v()],[`always`,a()],[`inbound`,_e()],[`tagged`,m()]],onChange:e=>{k(`tts`,`auto`,e),j(`tts`,{auto:e})}})}),(0,Y.jsx)(Z,{label:ie(),children:(0,Y.jsx)($,{value:E.tts.provider??`openai`,options:[[`openai`,`OpenAI`],[`elevenlabs`,`ElevenLabs`],[`microsoft`,te()],[`azure`,`Azure Speech`],[`google`,`Google Gemini`]],onChange:e=>{k(`tts`,`provider`,e),j(`tts`,{provider:e})}})}),(0,Y.jsx)(Z,{label:l(),children:(0,Y.jsx)(q,{value:E.tts.model??``,placeholder:`eleven_multilingual_v2`,onChange:e=>k(`tts`,`model`,e.target.value),onBlur:()=>j(`tts`,{model:E.tts.model??``})})}),(0,Y.jsx)(Z,{label:f(),children:(0,Y.jsx)(q,{value:E.tts.voice??``,placeholder:d(),onChange:e=>k(`tts`,`voice`,e.target.value),onBlur:()=>j(`tts`,{voice:E.tts.voice??``})})})]}),(0,Y.jsxs)(X,{title:ae(),status:(0,Y.jsx)(K,{variant:`outline`,children:p()}),note:e.secrets.openai?N():i(),children:[(0,Y.jsx)(Q,{label:P(),checked:E.talk.enabled??!1,onChange:e=>{k(`talk`,`enabled`,e),j(`talk`,{enabled:e})}}),(0,Y.jsx)(Z,{label:oe(),children:(0,Y.jsx)($,{value:E.talk.realtimeProvider??`openai`,options:[[`openai`,`OpenAI (gpt-realtime)`],[`google`,`Google`]],onChange:e=>{k(`talk`,`realtimeProvider`,e),j(`talk`,{realtimeProvider:e})}})}),(0,Y.jsx)(Z,{label:s(),children:(0,Y.jsx)(q,{value:E.talk.realtimeModel??``,placeholder:`gpt-realtime-2`,onChange:e=>k(`talk`,`realtimeModel`,e.target.value),onBlur:()=>j(`talk`,{realtimeModel:E.talk.realtimeModel??``})})}),(0,Y.jsx)(Z,{label:f(),children:(0,Y.jsx)(q,{value:E.talk.voice??``,placeholder:`cedar / marin`,onChange:e=>k(`talk`,`voice`,e.target.value),onBlur:()=>j(`talk`,{voice:E.talk.voice??``})})}),(0,Y.jsx)(Z,{label:c(),children:(0,Y.jsx)($,{value:E.talk.transport??`webrtc`,options:[[`webrtc`,g()],[`provider-websocket`,`Provider WebSocket`],[`gateway-relay`,`Gateway relay`]],onChange:e=>{k(`talk`,`transport`,e),j(`talk`,{transport:e})}})}),(0,Y.jsx)(Z,{label:pe(),children:(0,Y.jsx)(q,{value:E.talk.speechLocale??``,placeholder:`fr-CA`,onChange:e=>k(`talk`,`speechLocale`,e.target.value),onBlur:()=>j(`talk`,{speechLocale:E.talk.speechLocale??``})})}),(0,Y.jsx)(Q,{label:o(),checked:E.talk.interruptOnSpeech??!0,onChange:e=>{k(`talk`,`interruptOnSpeech`,e),j(`talk`,{interruptOnSpeech:e})}})]}),(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:h()}),(0,Y.jsx)(K,{variant:`outline`,children:me()})]}),(0,Y.jsxs)(`p`,{className:`oc-uipa__note`,children:[C(),(0,Y.jsx)(`code`,{children:` voicewake.get/set`}),`.`]})]}),(0,Y.jsx)(we,{title:he(),rows:e.cursors.map(e=>({...e,_id:e.vendor})),emptyHint:de(),columns:[{header:ue(),cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.vendor}),sort:e=>e.vendor},{header:O(),cell:e=>e.lastAt>0?new Date(e.lastAt).toLocaleString(`fr-FR`):`—`,sort:e=>e.lastAt>0?e.lastAt:null},{header:A(),cell:e=>String(e.failureCount),sort:e=>e.failureCount},{header:I(),cell:e=>e.lastErrorStatus??`—`,sort:e=>e.lastErrorStatus??null},{header:z(),cell:e=>e.lastError??`—`,sort:e=>e.lastError??null}]})]})}function X({title:e,status:t,note:n,children:r}){return(0,Y.jsxs)(`section`,{className:`oc-int__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,Y.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,Y.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function Z({label:e,children:t}){return(0,Y.jsxs)(`label`,{className:`oc-int__field`,children:[(0,Y.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function Q({label:e,checked:t,onChange:n}){return(0,Y.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,Y.jsx)(Ce,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,Y.jsx)(`span`,{children:e})]})}function $({value:e,options:t,onChange:n}){return(0,Y.jsxs)(be,{value:e,onValueChange:n,children:[(0,Y.jsx)(xe,{size:`sm`,className:`w-full`,children:(0,Y.jsx)(ye,{})}),(0,Y.jsx)(ve,{children:t.map(([e,t])=>(0,Y.jsx)(Se,{value:e,children:t},e))})]})}function Ee({headersSet:e}){let t=F(W.integrations.otlpSecret.setOtlpHeaders),n=D(W.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),l=async()=>{c(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}};return(0,Y.jsxs)(Z,{label:x(),children:[(0,Y.jsx)(q,{value:r,placeholder:e?k():j(),onChange:e=>i(e.target.value)}),(0,Y.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,Y.jsx)(G,{size:`sm`,disabled:s||r.trim().length===0,onClick:()=>void l(),children:L()}),e?(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,disabled:s,onClick:()=>void n({}),children:B()}):null]}),a?(0,Y.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,Y.jsx)(`p`,{className:`oc-uipa__note`,children:E()})]})}export{Te as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AS as i,BS as a,CT as o,DT as s,ET as c,FS as l,GS as u,HS as d,IS as f,JS as p,KS as ee,LS as m,LT as te,MS as h,MT as g,NS as ne,OT as re,PS as ie,QS as ae,RS as oe,ST as se,TT as ce,US as le,VS as ue,WS as _,XS as de,YS as fe,ZS as pe,_E as v,_T as y,_h as b,aC as x,bT as S,cC as C,eC as w,gE as T,iC as E,jS as D,kT as O,lC as k,nC as A,oC as j,qS as M,rC as N,sC as P,tC as F,uE as I,vT as L,wT as R,xT as z,yT as B,zS as V}from"./dist-CKhDstdM.js";import{t as H}from"./button-HRR8tdJ2.js";import{A as me,C as he,E as ge,O as _e,S as ve,T as ye,Z as U,ot as W,w as G,x as K}from"./index-DR0RpyTI.js";var q=t(e(),1),J=[{id:`messages`,label:()=>k()},{id:`composer`,label:()=>C()},{id:`sidebar`,label:()=>P()},{id:`other`,label:()=>j()}],Y={showSource:{category:`messages`,label:()=>x(),help:()=>E()},showReport:{category:`messages`,label:()=>N(),help:()=>A()},copyAssistant:{category:`messages`,label:()=>F()},copyUser:{category:`messages`,label:()=>w()},showDelete:{category:`messages`,label:()=>r()},showTools:{category:`messages`,label:()=>ae(),help:()=>pe()},voiceInput:{category:`composer`,label:()=>de(),help:()=>fe()},showChatAge:{category:`sidebar`,label:()=>p(),help:()=>M()},showChatProvider:{category:`sidebar`,label:()=>ee(),help:()=>u()}};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:()=>ie()};function De({prefKey:e,ui:t}){let n=T(I.admin.setUiPrefDefault),r=T(I.admin.setFeatureEnabled),a=Te(e),o=a?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:oe()}),(0,$.jsxs)(ve,{value:we(t.defaults[e]),onValueChange:t=>void n({key:e,value:Q(t)}),children:[(0,$.jsx)(ye,{size:`sm`,className:`w-36`,children:(0,$.jsx)(ge,{})}),(0,$.jsxs)(he,{children:[(0,$.jsx)(G,{value:`on`,children:h()}),(0,$.jsx)(G,{value:`off`,children:D()}),(0,$.jsx)(G,{value:`inherit`,children:i()})]})]}),a?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(K,{checked:t.featuresEnabled[a]===!0,onCheckedChange:e=>void r({key:a,enabled:e===!0}),"aria-label":m()}),m()]}):null]}),o?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function Oe(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=v(I.me.getMe,{host:W}),o=i?.ui,s=Z(i?.role)&&n,c=T(I.me.setUiPref).withOptimisticUpdate(_e),u=(0,q.useMemo)(()=>o?be(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":V()}),V()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:f()}),(0,$.jsx)(`p`,{children:l()}),(0,$.jsx)(`p`,{children:ne()})]}):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:le()}):(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=o.locked[e],l=o.effective[e],u=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}${u&&!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:d()}):u?null:(0,$.jsx)(`span`,{className:`oc-prefs__def`,children:ue()})]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:a()}):null,(0,$.jsx)(K,{checked:l,disabled:i,onCheckedChange:t=>void c({key:e,value:t===!0}),"aria-label":n})]}),s?(0,$.jsx)(De,{prefKey:e,ui:o}):null]},e)})]},e.id))})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:te()})}function ke(){let e=v(I.me.getMe,{host:W}),t=T(I.me.setLocale),n=T(I.me.setMyName),r=me(),i=e?.locale??`default`,a=e?.name??``,[l,u]=(0,q.useState)(null),d=l??a,f=d.trim()!==a.trim();async function p(){try{await n({name:d}),u(null),r.success(ce())}catch(e){r.error(R(),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:O()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(U,{className:`max-w-xs`,value:d,maxLength:120,placeholder:s(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,$.jsx)(H,{size:`sm`,disabled:!f,onClick:()=>void p(),children:b()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:o()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(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`?L():e===`en`?y():g()},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:S()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:B()})]}),(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{$f as r,Ap as i,Cp as a,Dp as o,Ep as s,Fp as c,Jf as ee,Kf as l,Mp as u,Np as d,Op as f,Pp as p,Qf as m,Sp as h,Tp as g,Xf as te,Yf as ne,Zf as re,_E as _,_p as v,bp as y,cp as b,dp as x,ep as S,fp as ie,gE as C,gp as ae,hp as w,jp as T,kp as E,lp as D,mp as O,op as k,pp as A,qf as j,sp as M,uE as N,up as P,vp as F,wp as I,xp as L,yp as R}from"./dist-CKhDstdM.js";import{t as z}from"./button-HRR8tdJ2.js";import{A as B,X as V,Z as H,j as U,m as W,x as G,xt as K}from"./index-DR0RpyTI.js";import{t as q}from"./roleDescriptions-B8pJ6mkq.js";var J=t(e(),1),Y=n(),X=[{group:()=>c(),keys:[{key:`traces.read`,label:()=>i()},{key:`traces.read.content`,label:()=>E(),phi:!0},{key:`traces.write`,label:()=>f()}]},{group:()=>p(),keys:[{key:`kpi.read`,label:()=>i()},{key:`kpi.write`,label:()=>f()}]},{group:()=>d(),keys:[{key:`openclaw.query`,label:()=>o()},{key:`anomalies.read`,label:()=>s()},{key:`anomalies.report`,label:()=>g()}]},{group:()=>u(),keys:[{key:`chats.read`,label:()=>i()},{key:`selfheal`,label:()=>a()}]},{group:()=>T(),keys:[{key:`admin.manage`,label:()=>I()}]}],oe=X.flatMap(e=>e.keys.map(e=>e.key));function Z(e){return e.includes(`*`)}var Q={key:``,name:``,description:``};function $(){let e=_(N.apiKeys.listRoles,{}),t=C(N.apiKeys.createRole),n=C(N.apiKeys.ensureRolesSeeded),i=C(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=U(),o=B(),[s,c]=(0,J.useState)(!1),[u,d]=(0,J.useState)(Q),[f,p]=(0,J.useState)(new Set);(0,J.useEffect)(()=>{n({}).catch(e=>{o.error(L(),e)})},[n,o]);let g=e??[];async function T(e,t){if(Z(e.permissions)||f.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await a({title:y({name:e.name}),description:R(),confirmLabel:F()}))){p(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(v(),e)}finally{p(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function E(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),d(Q),c(!1)}catch(e){o.error(ae(),e)}}let I=e===void 0,$=!I&&g.length===0;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[w(),` `,(0,Y.jsx)(`code`,{children:`admin`}),` `,O(),` `,(0,Y.jsx)(`code`,{children:`traces.read.content`}),` `,A()]}),(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:ie()}),(0,Y.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,Y.jsx)(z,{size:`sm`,onClick:()=>{d(Q),c(!0)},children:x()})})]}),I?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):$?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):(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:b()}),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?h({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:g.map(e=>{let t=Z(e.permissions),n=f.has(e._id);return(0,Y.jsxs)(`tr`,{children:[(0,Y.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,Y.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,Y.jsx)(`span`,{children:e.name}),(0,Y.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,Y.jsxs)(V,{variant:`outline`,className:`gap-1`,children:[(0,Y.jsx)(K,{}),` `,M()]}):(0,Y.jsx)(V,{variant:`secondary`,children:k()})]}),q(e)?(0,Y.jsx)(`p`,{className:`oc-matrix__roledesc`,children:q(e)}):null]}),oe.map(i=>(0,Y.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,Y.jsx)(G,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?S():n?r():i,onCheckedChange:()=>void T(e,i)})},i))]},e.key)})})]})})]}),(0,Y.jsx)(W,{open:s,onOpenChange:c,title:m(),description:re(),canSubmit:!!(u.key&&u.name),onSubmit:E,submitLabel:te(),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:ne()}),(0,Y.jsx)(H,{value:u.key,placeholder:ee(),onChange:e=>d({...u,key:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,Y.jsx)(H,{value:u.name,onChange:e=>d({...u,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,Y.jsx)(H,{value:u.description,onChange:e=>d({...u,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{$x as r,Ax as i,Bx as ee,CS as a,Cx as o,DS as te,Dx as s,ES as ne,Ex as c,Fx as re,Gx as ie,Hx as ae,Ix as oe,Jx as se,Kx as ce,Lx as le,Mx as l,Nx as ue,OS as de,Ox as u,Px as fe,Qx as pe,Rx as me,SS as he,Sx as d,TS as ge,Tx as f,Ux as _e,Vx as ve,Wx as ye,Xx as be,Yx as xe,Zx as Se,_E as p,_S as Ce,_x as we,aS as Te,bS as Ee,bx as m,cS as De,dS as Oe,dx as ke,eS as Ae,fS as je,fx as h,gE as g,gS as Me,gx as _,hS as Ne,hx as v,iS as Pe,jx as y,kS as Fe,kx as b,lS as Ie,lx as x,mE as Le,mS as Re,mx as S,nS as ze,oS as Be,pS as Ve,px as C,qx as He,rS as Ue,sS as We,tS as Ge,uE as w,uS as Ke,ux as T,vS as qe,vx as E,wS as D,wx as O,xS as Je,xx as k,yS as Ye,yx as A,zx as Xe}from"./dist-CKhDstdM.js";import{n as j}from"./dist-DErYNbMW.js";import{i as Ze}from"./dist-CkXWG_t8.js";import{t as M}from"./button-HRR8tdJ2.js";import{$ as N,A as Qe,At as $e,C as P,E as F,Et as I,Ot as et,Q as L,S as R,T as z,X as B,Z as V,et as H,j as tt,kt as nt,m as rt,nt as U,rt as W,tt as G,w as K}from"./index-DR0RpyTI.js";import{t as it}from"./FilterBar-DZBiB1MF.js";import{t as at}from"./DataTableShell-67hI2aZh.js";import{t as ot}from"./roleDescriptions-B8pJ6mkq.js";var q=t(e(),1),J=n(),st=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>S(),days:30},{value:`90`,label:()=>C(),days:90}],ct=720*60*60*1e3,Y=`__all__`,X={name:``,roleKey:``,description:``};function Z(){let e=$e({from:`/settings/serviceAccounts`}),t=nt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Y,[o,s]=(0,q.useState)(Y),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Y?void 0:e})}),u=p(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Y?void 0:o,disabled:i===Y?void 0:i===`disabled`}}),d=p(w.apiKeys.listKeys,{}),f=p(w.apiKeys.listRoles,{}),we=g(w.apiKeys.createServiceAccount),m=g(w.apiKeys.updateServiceAccount),ke=g(w.apiKeys.deleteServiceAccount),h=Le(w.apiKeys.mintApiKey),_=g(w.apiKeys.revokeApiKey),v=tt(),y=Qe(),b=n!==``||o!==Y||i!==Y;function x(){s(Y),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[T,E]=(0,q.useState)(X),[O,k]=(0,q.useState)(null),[A,j]=(0,q.useState)(new Set),[N,I]=(0,q.useState)(null),L=(0,q.useRef)(!1),[H,U]=(0,q.useState)(new Set),[W,G]=(0,q.useState)({}),[ct,Z]=(0,q.useState)(null),Q=(0,q.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{O?(await m({serviceAccountId:O,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(He())):await we({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(X),k(null),C(!1)}catch(e){y.error(O?se():xe(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function pt(e){if(L.current)return;L.current=!0;let t=W[e._id]??`never`,n=st.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;I(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});Z({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ce(),e)}finally{L.current=!1,I(null)}}async function mt(e){if(await v({title:ie(),description:(0,J.jsxs)(J.Fragment,{children:[ye(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,_e(),` `,(0,J.jsx)(`strong`,{children:ae()}),` `,ve()]}),confirmWord:e.name,confirmLabel:ee(),destructive:!0}))try{await ke({serviceAccountId:e._id}),y.success(Xe(),e.name)}catch(e){y.error(me(),e)}}async function ht(e){if(await v({title:le(),description:(0,J.jsxs)(J.Fragment,{children:[oe(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,re()]}),confirmLabel:fe(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ue(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,J.jsxs)(it,{q:n,onQChange:c,searchPlaceholder:de(),onReset:x,canReset:b,children:[(0,J.jsxs)(R,{value:o,onValueChange:s,children:[(0,J.jsx)(z,{size:`sm`,className:`w-40`,children:(0,J.jsx)(F,{placeholder:te()})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(K,{value:Y,children:ne()}),(f??[]).map(e=>(0,J.jsx)(K,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(R,{value:i,onValueChange:l,children:[(0,J.jsx)(z,{size:`sm`,className:`w-36`,children:(0,J.jsx)(F,{})}),(0,J.jsxs)(P,{children:[(0,J.jsx)(K,{value:Y,children:ge()}),(0,J.jsx)(K,{value:`active`,children:D()}),(0,J.jsx)(K,{value:`disabled`,children:a()})]})]})]}),(0,J.jsx)(at,{title:he(),rows:u,addLabel:Je(),onAdd:()=>{E(X),k(null),C(!0)},emptyHint:Ee(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:Q.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[{label:Me(),onSelect:()=>ft(e)},{label:Ye(),onSelect:()=>void pt(e)},{label:A.has(e._id)?qe():Ce(),onSelect:()=>$(e._id)},{label:Ne(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Re():Ve(),onClick:()=>$(e._id),children:A.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(et,{})})},{header:je(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Oe(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(B,{variant:`secondary`,children:e.roleKey})},{header:Ke(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(B,{variant:`destructive`,children:a()}):(0,J.jsx)(B,{variant:`outline`,children:D()})},{header:Ie(),cell:e=>(0,J.jsxs)(R,{value:W[e._id]??`never`,onValueChange:t=>G(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(z,{size:`sm`,className:`w-32`,children:(0,J.jsx)(F,{})}),(0,J.jsx)(P,{children:st.map(e=>(0,J.jsx)(K,{value:e.value,children:e.label()},e.value))})]})},{header:De(),sort:e=>(Q.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Q.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?We():Be({count:t})})}}]}),(0,J.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:O?Te():ze(),description:O?Pe():Ge(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:O?Ue():Ae(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,J.jsx)(V,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,J.jsxs)(R,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(z,{className:`w-full`,children:(0,J.jsx)(F,{placeholder:Se()})}),(0,J.jsx)(P,{children:(f??[]).map(e=>(0,J.jsxs)(K,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.roleKey),t=e?ot(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:be()}),(0,J.jsx)(V,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:ct,onClose:()=>Z(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[l(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:i()}),(0,J.jsx)(`th`,{children:b()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{children:s()}),(0,J.jsx)(`th`,{children:c()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(B,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:Q(t.createdAt)}),(0,J.jsx)(`td`,{className:$(t.lastUsedAt)?`oc-sa__stale`:``,children:dt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:ft(t.expiresAt)}),(0,J.jsx)(`td`,{children:pt(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?O():o()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(L,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(N,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(U,{children:[(0,J.jsx)(W,{children:d()}),(0,J.jsx)(H,{children:k({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:m()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":A(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(I,{}),n?E():we()]})]}),(0,J.jsx)(G,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function Q(e){return new Date(e).toLocaleString(`fr-FR`)}function $(e){return e===null?!1:Date.now()-e>ct}function dt(e){return e===null?h():new Date(e).toLocaleString(`fr-FR`)}function ft(e){return e===null?`—`:new Date(e).toLocaleDateString(`fr-FR`)}function pt(e){return e.disabled?(0,J.jsx)(B,{variant:`destructive`,children:ke()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(B,{variant:`outline`,children:T()}):(0,J.jsx)(B,{variant:`outline`,children:x()})}export{Z as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,Aw as a,BC as o,CC as s,Cw as c,DC as l,Dw as u,EC as d,Ew as f,FC as p,FT as m,GC as h,HC as g,IC as _,JC as v,KC as ee,LC as te,MC as ne,Mw as re,NC as ie,NT as ae,OC as oe,Ow as se,PC as ce,PT as le,QC as ue,RC as de,SC as fe,Sw as y,TC as pe,Tw as me,UC as he,VC as ge,WC as _e,XC as ve,YC as b,ZC as ye,_C as be,_E as x,_T as xe,_w as Se,a as S,aw as Ce,bC as we,bw as Te,cw as Ee,dC as De,dE as Oe,dw as ke,ew as Ae,fC as je,fw as Me,gC as Ne,gE as C,gw as Pe,hC as Fe,hw as Ie,i as Le,iw as Re,jC as ze,jw as Be,kC as Ve,kw as He,lw as Ue,mC as w,mE as We,mw as Ge,n as Ke,nw as qe,o as T,ow as Je,pC as Ye,pw as Xe,qC as Ze,r as Qe,rw as $e,sw as et,tw as tt,uC as nt,uE as E,uw as rt,vC as D,vT as it,vw as at,wC as ot,ww as st,xC as ct,xw as lt,yC as ut,yw as dt,zC as ft}from"./dist-CKhDstdM.js";import{n as O}from"./dist-DErYNbMW.js";import{t as pt}from"./TimeRangePicker-BJ_SDnZN.js";import{t as k}from"./x-Dnhgu6fy.js";import{t as A}from"./button-HRR8tdJ2.js";import{C as j,E as M,G as mt,J as N,K as P,S as F,T as I,Tt as ht,W as gt,X as L,Y as _t,Z as R,at as vt,it as yt,ot as bt,q as xt,w as z,wt as B,x as V}from"./index-DR0RpyTI.js";import{a as St,i as Ct,n as wt,o as Tt,r as Et,t as Dt}from"./card-DdObfJrM.js";import{a as Ot,i as H,n as kt,o as U,r as W,t as At}from"./table-fGxqLVNE.js";import{t as jt}from"./FilterBar-DZBiB1MF.js";import{t as Mt}from"./AdvancedFilter-Dsn2CdBY.js";var G=Oe(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=t(e(),1),Nt=.1,Pt=[248,248,248],Ft=[24,24,24];function It(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Lt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Lt(e,t,n)>=Nt}function Rt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function zt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Bt=12*1024*1024,Vt=480,Ht=160,Ut=.92;async function Wt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ie());if(e.size>Bt)throw Error(ne());let{source:n,width:r,height:a,cleanup:o}=await Gt(e);try{let o=e.type===`image/svg+xml`,s=Math.min(Vt/r,Ht/a,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(a*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(i());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=It(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(i());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);q(e.data,f.width,f.height)?Rt(e.data,t.variantFor===`dark`?Pt:Ft):zt(e.data),m.putImageData(e,0,0)}let h=q(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await Y(p,`image/webp`,Ut)??await Y(p,`image/png`);if(!g)throw Error(Ve());return{blob:g,hasAlpha:h}}finally{o()}}async function Gt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ze())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Kt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?m():e===`dark`?le():ae()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(O,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":T(),title:T(),children:(0,X.jsx)(ht,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=x(E.charts.listMyCharts),r=C(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:st()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:y(),subtitle:lt(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Te():n.via===`owner`?dt():at({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Kt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()}):null]})}function $t(){let e=C(E.charts.importChart),[t,n]=(0,K.useState)(``),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[u,d]=(0,K.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(b())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(Ze());return}let r;try{r=JSON.parse(i)}catch{s(b());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,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:$e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:tt()}),(0,X.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:Ae(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:ue(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),ye(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:u,onClick:()=>void p(),children:ve()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:v()}):null]})]})}function en({chart:e}){let t=We(E.charts.setChartLogo),n=C(E.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,s]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Wt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function m({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?o():ft()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?te():de(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:p()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:_()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ge()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(m,{mode:`light`}),(0,X.jsx)(m,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ce()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=x(E.me.getMe,{host:bt}),n=C(E.charts.addChartDomain),r=C(E.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,c]=(0,K.useState)(null),[u,f]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let p=e.domains??[];async function m(){let t=i.trim();if(t!==``){c(null),f(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{f(!1)}}}async function h(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:oe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:p.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ot()}):p.map(e=>(0,X.jsxs)(L,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":s({domain:e}),onClick:()=>void h(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(R,{value:i,onChange:e=>a(e.target.value),placeholder:d(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&m()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:u,onClick:()=>void m(),children:pe()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:l()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function nn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function rn({chart:e}){let t=C(E.charts.updateChart),n=C(E.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(e.name),[s,c]=(0,K.useState)(()=>nn(e.tokens)),[l,u]=(0,K.useState)(e.tokens.bpm??0),[d,f]=(0,K.useState)(null),[p,m]=(0,K.useState)(!1);function h(){o(e.name),c(nn(e.tokens)),u(e.tokens.bpm??0),f(null),i(!0)}async function _(){if(e.chartId===void 0)return;f(null);let n;try{n=JSON.parse(s)}catch{f(b());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}m(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(D()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:h,children:he()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:g()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:we()}),(0,X.jsx)(R,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:S()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":S()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?Le():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ut()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),d?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:d}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:p,onClick:()=>void _(),children:fe()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ct()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function an(){let e=x(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(rn,{chart:e},e.key))})]})}function on({chart:e,groups:t}){let n=C(E.charts.addChartToGroupPool),r=C(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(L,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Ue():e.kind===`custom`&&e.scope===`personal`?w():rt()}),e.isGlobalDefault?(0,X.jsx)(L,{variant:`default`,children:Ee()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Je()}),(a??[]).map(e=>(0,X.jsxs)(L,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Re({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(F,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(I,{size:`sm`,className:`w-56`,children:(0,X.jsx)(M,{placeholder:Ce()})}),(0,X.jsx)(j,{children:s.map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:et()}):null]})]})}function sn({chart:e}){let t=C(E.charts.promoteChartToCommon),n=C(E.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(D()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(L,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?Ye():w()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Fe({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:je()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:De()})]})]})}function cn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(E.admin.setDefaultThemeMode),i=C(E.admin.setDefaultLocale),o=C(E.charts.setDefaultChart),s=x(E.charts.listChartsAdmin),c=x(E.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:f()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:y()}),vt.map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ge()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(on,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:nt()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(sn,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:re()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`fr`,`en`].map(e=>(0,X.jsx)(A,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e}),children:e===`fr`?it():xe()},e))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:se()})]})]})}function ln(){let e=x(E.me.getMe,{host:bt}),t=yt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(an,{}),e?.role===`admin`?(0,X.jsx)(cn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function un(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[d,f]=(0,K.useState)(Q),p=i!==``||o!==Z||c!==Z;function m(){a(``),s(Z),l(Z),f(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(ln,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:u()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(B,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(L,{children:`Default`}),(0,X.jsx)(L,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(L,{variant:`outline`,children:`Outline`}),(0,X.jsx)(L,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(R,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(F,{value:n,onValueChange:r,children:[(0,X.jsx)(I,{className:`w-56`,children:(0,X.jsx)(M,{placeholder:`Select…`})}),(0,X.jsxs)(j,{children:[(0,X.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(V,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(jt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:d,onTimeRangeChange:f,onReset:m,canReset:p,children:[(0,X.jsxs)(F,{value:o,onValueChange:s,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(M,{})}),(0,X.jsxs)(j,{children:[(0,X.jsx)(z,{value:Z,children:`Toutes directions`}),(0,X.jsx)(z,{value:`inbound`,children:`inbound`}),(0,X.jsx)(z,{value:`outbound`,children:`outbound`}),(0,X.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(F,{value:c,onValueChange:l,children:[(0,X.jsx)(I,{size:`sm`,children:(0,X.jsx)(M,{})}),(0,X.jsxs)(j,{children:[(0,X.jsx)(z,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(z,{value:`info`,children:`info`}),(0,X.jsx)(z,{value:`warn`,children:`warn`}),(0,X.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Mt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(pt,{value:d,onChange:f})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(gt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(B,{})})}),(0,X.jsxs)(mt,{align:`start`,children:[(0,X.jsx)(xt,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Dt,{className:`w-80`,children:[(0,X.jsxs)(St,{children:[(0,X.jsx)(Tt,{children:`Instance`}),(0,X.jsx)(Et,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(wt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(Ct,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(At,{children:[(0,X.jsx)(Ot,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(V,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(kt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(V,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(L,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(O,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(B,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{un as ThemeShowroom};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Cc as i,Dc as a,Ec as o,Mc as s,Nc as c,Oc as l,Pc as u,Sc as d,Tc as f,dE as p,jc as m,kc as h,wc as g}from"./dist-CKhDstdM.js";import{t as _}from"./button-HRR8tdJ2.js";import{Z as v,ct as y,lt as b,st as x,ut as S,vt as C}from"./index-DR0RpyTI.js";var w=p(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),T=t(e(),1),E={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function D(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=E[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function O(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:D(e.from,t)??t-E.h,to:D(e.to,t)??t}}var k=[{label:u(),from:`now-5m`},{label:c(),from:`now-15m`},{label:s(),from:`now-30m`},{label:m(),from:`now-1h`},{label:r(),from:`now-3h`},{label:h(),from:`now-6h`},{label:l(),from:`now-12h`},{label:a(),from:`now-24h`},{label:o(),from:`now-2d`},{label:f(),from:`now-7d`},{label:g(),from:`now-30d`},{label:i(),from:`now-90d`},{label:d(),from:`now-520w`}];function A(e){return new Date(e).toLocaleString(`fr-FR`,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function j(e){if(e.kind===`relative`){let t=k.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${A(e.from)} → ${A(e.to)}`}function M(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function N(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function P(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var F=n();function I(e){let[t,n]=(0,T.useState)(0);return(0,T.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,T.useMemo)(()=>{let{from:t,to:n}=O(e);return e.kind===`absolute`?{from:t,to:n}:{from:L(t),to:L(n)}},[e,t])}function L(e){return Math.floor(e/6e4)*6e4}function R({value:e,onChange:t}){let[n,r]=(0,T.useState)(!1),[i,a]=(0,T.useState)(``),o=O(e),[s,c]=(0,T.useState)(()=>M(o.from)),[l,u]=(0,T.useState)(()=>M(o.to));function d(t){if(t){let t=O(e);c(M(t.from)),u(M(t.to)),a(``)}r(t)}function f(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function p(){let e=N(s),n=N(l);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let m=(0,T.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?k:k.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),h=N(s)!==null&&N(l)!==null;return(0,F.jsxs)(b,{open:n,onOpenChange:d,children:[(0,F.jsx)(S,{asChild:!0,children:(0,F.jsxs)(_,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,F.jsx)(w,{}),j(e)]})}),(0,F.jsx)(y,{children:(0,F.jsx)(x,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,F.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,F.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,F.jsx)(`div`,{className:`oc-timerange__section-title`,children:`Plage absolue`}),(0,F.jsxs)(`label`,{className:`oc-field`,children:[(0,F.jsx)(`span`,{className:`oc-field__label`,children:`De`}),(0,F.jsx)(v,{type:`datetime-local`,value:s,onChange:e=>c(e.target.value)})]}),(0,F.jsxs)(`label`,{className:`oc-field`,children:[(0,F.jsx)(`span`,{className:`oc-field__label`,children:`À`}),(0,F.jsx)(v,{type:`datetime-local`,value:l,onChange:e=>u(e.target.value)})]}),(0,F.jsx)(_,{size:`sm`,className:`oc-timerange__apply`,disabled:!h,onClick:p,children:`Appliquer`})]}),(0,F.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,F.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,F.jsx)(C,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,F.jsx)(v,{value:i,onChange:e=>a(e.target.value),placeholder:`Rechercher une plage`,"aria-label":`Rechercher une plage relative`})]}),(0,F.jsx)(`ul`,{className:`oc-timerange__list`,children:m.length===0?(0,F.jsx)(`li`,{className:`oc-timerange__empty`,children:`Aucune plage.`}):m.map(t=>(0,F.jsx)(`li`,{children:(0,F.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>f(t.from),children:t.label})},t.from))})]})]})})})]})}export{I as n,P as r,R as t};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,$v as i,Av as a,Cd as o,Cv as s,Dd as c,Dv as l,Ed as u,Ev as d,Fv as f,Gu as p,Gv as m,Hv as h,Iv as g,Ju as ee,Jv as _,Ku as v,Kv as y,Mv as b,Nv as x,Od as te,Ov as S,Pv as C,Qu as ne,Qv as w,Sd as re,Sv as ie,Td as ae,Tv as oe,Uv as se,Vv as ce,Wv as le,Xu as ue,Xv as T,Yu as de,Yv as E,Zu as fe,Zv as D,_E as O,_d as pe,ad as me,ay as k,bd as he,cd as ge,cy as A,dE as j,dd as _e,dy as M,ed as ve,ey as N,fd as ye,gE as P,gd as be,hd as xe,id as Se,iy as F,jv as I,kd as Ce,kv as we,ld as Te,ly as Ee,md as De,nd as Oe,ny as ke,od as Ae,oy as je,pd as Me,qu as Ne,qv as Pe,rd as Fe,ry as Ie,sd as Le,sy as Re,td as ze,ty as Be,uE as L,ud as Ve,uy as He,vd as Ue,wd as We,wv as Ge,xd as Ke,yd as qe}from"./dist-CKhDstdM.js";import{n as Je}from"./dist-DErYNbMW.js";import{n as R}from"./TimeRangePicker-BJ_SDnZN.js";import{t as Ye}from"./x-Dnhgu6fy.js";import{i as z,n as B,r as Xe,t as Ze}from"./tabs-Bh17c652.js";import{t as V}from"./button-HRR8tdJ2.js";import{$ as Qe,At as $e,C as H,Ct as et,E as U,Et as tt,Q as nt,S as W,T as G,X as K,a as rt,et as it,i as at,k as ot,kt as st,nt as ct,o as lt,ot as ut,r as dt,rt as ft,w as q}from"./index-DR0RpyTI.js";import{t as pt}from"./FilterBar-DZBiB1MF.js";import{t as mt}from"./AdvancedFilter-Dsn2CdBY.js";import{t as ht}from"./DataTableShell-67hI2aZh.js";var gt=j(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),_t=j(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),vt=j(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),J=t(e(),1),Y=n(),X={kind:`relative`,from:`now-520w`,to:`now`},Z=e=>e===null?`-`:String(Math.round(e));function yt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?y():n===`agent`?`${m()} - ${r}`:e}function bt(){let e=O(L.me.getMe,{host:ut})?.role===`admin`,t=O(L.deliveryTiming.getDeliveryStatus,{}),n=P(L.deliveryTiming.startDeliveryRecord),r=P(L.deliveryTiming.stopDeliveryRecord),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!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:M()}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:He()})]}),e?(0,Y.jsx)(V,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?A():Ee()}):null]}),c?(0,Y.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,Y.jsx)(K,{variant:`secondary`,children:Re()}),t?.startedAt?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:je({time:new Date(t.startedAt).toLocaleTimeString()})}):null]}):null,(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?Ie():F()})}),i?(0,Y.jsx)(xt,{isAdmin:e}):null]})}function xt({isAdmin:e}){let t=O(L.deliveryTiming.listDeliverySessions,{}),n=P(L.deliveryTiming.deleteDeliverySessions),[r,a]=(0,J.useState)(``),[o,c]=(0,J.useState)(`all`),[l,u]=(0,J.useState)(X),[d,f]=(0,J.useState)(null),{from:p,to:m}=R(l),g=l.to===`now`?1/0:m,ee=r.trim()!==``||o!==`all`||l!==X,v=()=>{a(``),c(`all`),u(X)},y=(0,J.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=p&&t.startedAt<=g).map(e=>({...e,_id:e.sessionId}))},[t,r,o,p,g]),b=e=>{let t=new Set((y??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),d!==null&&r.includes(d)&&f(null))};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(pt,{q:r,onQChange:a,searchPlaceholder:Be(),timeRange:l,onTimeRangeChange:u,onReset:v,canReset:ee,children:(0,Y.jsxs)(W,{value:o,onValueChange:e=>c(e),children:[(0,Y.jsx)(G,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:`all`,children:N()}),(0,Y.jsx)(q,{value:`active`,children:i()}),(0,Y.jsx)(q,{value:`stopped`,children:w()})]})]})}),(0,Y.jsx)(ht,{title:ke(),rows:y,emptyHint:s(),columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":d===e.sessionId?se():le(),onClick:()=>f(t=>t===e.sessionId?null:e.sessionId),children:d===e.sessionId?(0,Y.jsx)(gt,{size:15,"aria-hidden":!0}):(0,Y.jsx)(et,{size:15,"aria-hidden":!0})})},{header:D(),sort:e=>e.startedAt,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.startedAt).toLocaleString()})},{header:T(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,Y.jsx)(`span`,{className:`tabular-nums`,children:new Date(e.stoppedAt).toLocaleString()})},{header:E(),sort:e=>e.count,cell:e=>(0,Y.jsx)(`span`,{className:`tabular-nums`,children:Z(e.count)})},{header:_(),sort:e=>e.startedBy,cell:e=>yt(e.startedBy)},{header:Pe(),sort:e=>e.active,cell:e=>e.active?(0,Y.jsx)(K,{variant:`secondary`,children:i()}):(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:w()})}],rowActions:e?e=>[{label:h(),variant:`destructive`,onSelect:()=>b([e.sessionId])}]:void 0,bulkActions:e?[{label:h(),variant:`destructive`,onSelect:e=>b(e)}]:void 0,isExpanded:e=>e.sessionId===d,renderExpanded:e=>(0,Y.jsx)(St,{sessionId:e.sessionId})})]})}function St({sessionId:e}){let t=O(L.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,J.useState)(!1);return(0,Y.jsx)(Ct,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(ot(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ct({report:e,copied:t,onCopy:n}){if(!e)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ce()});if(e.count===0||e.segments===null)return(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:k()});let r=e.segments,i=(e,t)=>(0,Y.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,Y.jsx)(`td`,{className:`py-1`,children:e}),(0,Y.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,Y.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Z(t.p50),` / `,Z(t.p95),` / `,Z(t.max)]})]});return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,ie()]}),(0,Y.jsxs)(V,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,Y.jsx)(Je,{size:13,"aria-hidden":!0}):(0,Y.jsx)(tt,{size:13,"aria-hidden":!0}),t?Ge():oe()]})]}),(0,Y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,Y.jsx)(`th`,{className:`py-1 font-medium`,children:C()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:x()}),(0,Y.jsx)(`th`,{className:`py-1 text-right font-medium`,children:b()})]})}),(0,Y.jsxs)(`tbody`,{children:[i(I(),r.bridge),i(a(),r.A),i(we(),r.C)]})]}),(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),e.truncated?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):null,(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]})}var wt=[50,100,200,500],Tt=`all`,Q=`__all__`,Et=[`2xx`,`4xx`,`5xx`],Dt=[`user`,`service`,`system`],Ot=[`inbound`,`outbound`,`internal`],kt={kind:`relative`,from:`now-30d`,to:`now`},At=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:`latence (ms)`},{value:`principalType`,label:`principal`},{value:`direction`,label:`direction`},{value:`roleKey`,label:`rôle`},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function jt(){let e=$e({from:`/settings/traces`}),t=st({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,d=e.roleKey??Q,p=e.q??``,m=dt(e.from,e.to),h=(0,J.useMemo)(()=>lt(e.adv),[e.adv]),{from:_,to:v}=R(m),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),C=e=>void t({search:t=>({...t,limit:e})}),w=e=>void t({search:t=>({...t,kind:e})}),ie=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),oe=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),se=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),T=e=>void t({search:t=>({...t,...rt(e)})}),E=e=>void t({search:t=>({...t,adv:at(e)}),replace:!0}),D=O(L.observability.listEvents,{limit:n}),k=O(L.observability.listEvents,{limit:n,kind:i===Tt?void 0:i,filter:{q:p||void 0,from:_,to:v,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:d===Q?void 0:d,advanced:h.length>0?h:void 0}}),A=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])e.add(t.kind);return[...e].sort()},[D]),j=(0,J.useMemo)(()=>{let e=new Set;for(let t of D??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[D]),M=p!==``||a!==Q||s!==Q||l!==Q||d!==Q||h.length>0||m.kind!==`relative`||m.from!==kt.from;function N(){t({search:{limit:100,kind:`all`},replace:!0})}let P=y?D?.filter(e=>e.correlationId===y):k,[F,I]=(0,J.useState)(`events`);return(0,Y.jsxs)(Ze,{value:F,onValueChange:e=>I(e),children:[(0,Y.jsxs)(Xe,{className:`w-full`,children:[(0,Y.jsxs)(z,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(_t,{size:13,"aria-hidden":!0}),g()]}),(0,Y.jsxs)(z,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,Y.jsx)(vt,{size:13,"aria-hidden":!0}),f()]})]}),(0,Y.jsx)(B,{value:`latency`,children:(0,Y.jsx)(bt,{})}),(0,Y.jsxs)(B,{value:`events`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ce(),(0,Y.jsx)(`strong`,{children:te()}),c(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:u()})]}),(0,Y.jsxs)(pt,{q:p,onQChange:ie,searchPlaceholder:ae(),timeRange:m,onTimeRangeChange:T,onReset:N,canReset:M,children:[(0,Y.jsxs)(W,{value:a,onValueChange:oe,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:We()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:o()}),Et.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:s,onValueChange:se,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:re()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:Ke()}),Dt.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:l,onValueChange:ce,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(U,{placeholder:he()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:qe()}),Ot.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:d,onValueChange:le,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(U,{placeholder:Ue()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Q,children:pe()}),j.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:i,onValueChange:w,children:[(0,Y.jsx)(G,{size:`sm`,className:`w-44`,children:(0,Y.jsx)(U,{placeholder:be()})}),(0,Y.jsxs)(H,{children:[(0,Y.jsx)(q,{value:Tt,children:xe()}),A.map(e=>(0,Y.jsx)(q,{value:e,children:e},e))]})]}),(0,Y.jsxs)(W,{value:String(n),onValueChange:e=>C(Number(e)),children:[(0,Y.jsx)(G,{size:`sm`,className:`w-28`,children:(0,Y.jsx)(U,{})}),(0,Y.jsx)(H,{children:wt.map(e=>(0,Y.jsx)(q,{value:String(e),children:De({count:e})},e))})]})]}),(0,Y.jsx)(mt,{fields:At,seed:h,onChange:E}),y?(0,Y.jsx)(`div`,{className:`oc-traces__followline`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>b(null),title:Me(),children:[(0,Y.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ye(),(0,Y.jsx)(`code`,{children:$(y)})]}),(0,Y.jsx)(Ye,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`sr-only`,children:_e()})]})}):null,(0,Y.jsx)(ht,{title:Ve(),rows:P,emptyHint:y?Te():ge(),columns:[{header:Le(),sort:e=>e.at,cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:new Date(e.at).toLocaleString(`fr-FR`)})},{header:Ae(),sort:e=>e.kind,cell:e=>(0,Y.jsx)(K,{variant:`secondary`,children:e.kind})},{header:me(),sort:e=>Nt(e)??null,cell:e=>{let t=Nt(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:Fe(),sort:e=>e.direction,cell:e=>e.direction?(0,Y.jsx)(K,{variant:`outline`,children:e.direction}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Oe(),sort:e=>e.principalType,cell:e=>(0,Y.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,Y.jsx)(K,{variant:`outline`,children:e.principalType}),e.principalId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ze(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,Y.jsx)(K,{variant:`secondary`,children:e.roleKey}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ve(),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:r(),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 ${Mt(e.status)}`,children:e.status})},{header:ne(),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:fe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,Y.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ue(),onClick:()=>b(e.correlationId),children:$(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:de(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,Y.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:ee()}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,Y.jsx)(Pt,{row:x,onClose:()=>S(null)})]})]})}function Mt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Nt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Pt({row:e,onClose:t}){let n=(0,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)(nt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,Y.jsxs)(Qe,{className:`max-w-lg`,children:[(0,Y.jsxs)(ct,{children:[(0,Y.jsxs)(ft,{className:`oc-traces__meta-title`,children:[Ne(),` `,(0,Y.jsx)(`code`,{children:e.kind}),(0,Y.jsx)(K,{variant:`outline`,children:v()})]}),(0,Y.jsx)(it,{children:p()})]}),(0,Y.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{jt as TracesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,Gh as a,Hh as o,Ih as s,Jh as c,Kh as l,Lh as u,Qh as d,Rh as ee,Uh as te,Vh as ne,Wh as re,Xh as ie,Yh as ae,Zh as oe,_E as f,_h as se,_u as p,ag as ce,cg as m,cu as h,du as g,eg as le,fu as _,gE as v,gu as y,hu as b,ig as ue,lg as x,lu as S,mu as C,ng as de,og as fe,ou as w,pu as T,qh as E,rg as pe,sg as me,su as D,tg as he,uE as O,ug as k,uu as A,vu as j,zh as M}from"./dist-CKhDstdM.js";import{t as N}from"./button-HRR8tdJ2.js";import{$ as P,A as F,At as ge,C as I,E as L,G as R,K as z,M as _e,Q as B,S as V,T as H,W as U,X as W,Y as ve,_t as G,d as K,et as ye,f as be,gt as q,j as xe,kt as Se,nt as Ce,ot as we,p as J,q as Te,rt as Ee,w as Y,x as X}from"./index-DR0RpyTI.js";import{t as De}from"./FilterBar-DZBiB1MF.js";import{t as Oe}from"./DataTableShell-67hI2aZh.js";import{t as ke}from"./DetailChips-CTU-lZny.js";var Z=t(e(),1),Q=n();function Ae({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=f(O.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=f(O.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Q.jsx)(B,{open:n,onOpenChange:r,children:(0,Q.jsxs)(P,{className:`oc-access`,children:[(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(Ee,{children:j({user:t})}),(0,Q.jsx)(ye,{children:p()})]}),i?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?y():b()}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):u.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:g()}):[...d.entries()].map(([t,n])=>(0,Q.jsx)(je,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function je({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=v(O.agents.assignAgent),s=v(O.agents.removeAgent),c=v(O.agents.setDefaultAgent),l=F();if(!e)return null;async function u(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(T(),e)}}async function d(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){l.error(_(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(G,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`;return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(X,{checked:r,disabled:s&&!r,onCheckedChange:()=>void u(e.agentId,r),"aria-label":A({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:S()}):null,e.outOfPool?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:h()}):null,r?o?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":D(),title:D(),children:(0,Q.jsx)(q,{size:14,fill:`currentColor`})}):(0,Q.jsx)(N,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":w(),title:w(),onClick:()=>void d(e.agentId),children:(0,Q.jsx)(q,{size:14})}):null]},e.agentId)})]})}var $=`__all__`;function Me({granted:e,onToggle:t}){let n=new Set(e),r=K.filter(e=>n.has(J[e])).length;return(0,Q.jsxs)(U,{children:[(0,Q.jsx)(ve,{asChild:!0,children:(0,Q.jsx)(N,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?k():x({count:r})})}),(0,Q.jsxs)(R,{align:`start`,className:`w-52`,children:[(0,Q.jsx)(Te,{children:m()}),K.map(e=>{let r=J[e];return(0,Q.jsxs)(z,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Q.jsx)(X,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Q.jsx)(`span`,{children:be[e]??e})]},e)})]})]})}function Ne(){let e=ge({from:`/settings/users`}),t=Se({from:`/settings/users`}),n=e.q??``,p=e.role??$,m=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),h=e=>void t({search:t=>({...t,role:e===$?void 0:e})}),g=f(O.admin.listUsers,{filter:{q:n||void 0,role:p===$?void 0:p},withAgents:!0}),_=f(O.me.getMe,{host:we}),y=v(O.admin.setRole),b=v(O.admin.setUserPermissions),x=v(O.admin.startImpersonation),S=v(O.admin.deleteUser),C=v(O.admin.setUserName),w=xe(),T=_e(),D=F(),[k,A]=(0,Z.useState)(null),j=(0,Z.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of g??[])e.add(t.role);return[...e]},[g]),N=n!==``||p!==$;function P(){t({search:{},replace:!0})}async function R(e){try{await y(e)}catch(e){D.error(me(),e)}}async function z(e){try{await b(e)}catch(e){D.error(fe(),e)}}async function B(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await w({title:r(),description:d({user:t}),confirmWord:oe(),confirmLabel:ie(),destructive:!0}))try{await S({profileId:e._id}),D.success(c({user:t}))}catch(e){D.error(ae(),e)}}async function U(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:l(),label:a({user:t}),placeholder:re(),defaultValue:e.name??``,confirmLabel:se()});if(n!==null)try{await C({profileId:e._id,name:n}),D.success(te())}catch(e){D.error(o(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(De,{q:n,onQChange:m,searchPlaceholder:ce(),onReset:P,canReset:N,children:(0,Q.jsxs)(V,{value:p,onValueChange:h,children:[(0,Q.jsx)(H,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(L,{})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(Y,{value:$,children:ue()}),j.map(e=>(0,Q.jsx)(Y,{value:e,children:e},e))]})]})}),(0,Q.jsx)(Oe,{title:pe(),rows:g,emptyHint:de(),rowActions:e=>{let t=[{label:s(),onSelect:()=>A({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:E(),onSelect:()=>void U(e)}];return e.userId!==_?.userId&&t.push({label:he(),onSelect:()=>void x({profileId:e._id})},{label:le(),variant:`destructive`,onSelect:()=>void B(e)}),t},columns:[{header:ne(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsx)(`span`,{children:t}),n?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:i(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Q.jsxs)(V,{value:e.role,onValueChange:t=>void R({profileId:e._id,role:t}),children:[(0,Q.jsx)(H,{size:`sm`,className:`w-28`,children:(0,Q.jsx)(L,{})}),(0,Q.jsxs)(I,{children:[(0,Q.jsx)(Y,{value:`pending`,children:`pending`}),(0,Q.jsx)(Y,{value:`user`,children:`user`}),(0,Q.jsx)(Y,{value:`admin`,children:`admin`})]})]})},{header:M(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:ee()}):(0,Q.jsx)(Me,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),z({profileId:e._id,permissions:[...n]})}})},{header:u(),cell:e=>(0,Q.jsx)(ke,{icon:(0,Q.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Q.jsx)(Ae,{profileId:k?.profileId??null,userLabel:k?.label??``,open:k!==null,onOpenChange:e=>{e||A(null)}})]})}export{Ne as UsersTab};
@@ -1 +0,0 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{aE as n,n as r,t as i}from"./dist-CKhDstdM.js";e();var a=t(),o=i(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function s({className:e,variant:t=`default`,size:i=`default`,asChild:s=!1,...c}){return(0,a.jsx)(s?n:`button`,{"data-slot":`button`,"data-variant":t,"data-size":i,className:r(o({variant:t,size:i,className:e})),...c})}export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{dE as e}from"./dist-CKhDstdM.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};