@lacneu/atrium 0.43.0 → 0.44.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 (72) hide show
  1. package/dist/assets/AccessTab-DIQGYONr.js +1 -0
  2. package/dist/assets/{AdvancedFilter-UZD1c3U9.js → AdvancedFilter-DvEno3Aq.js} +1 -1
  3. package/dist/assets/AgentFilesTab-D58Ewnxq.js +3 -0
  4. package/dist/assets/AnomaliesTab-BlhZZGZK.js +1 -0
  5. package/dist/assets/AuditTab-BvVSi2_w.js +1 -0
  6. package/dist/assets/BridgeTab-D2Qg8iKI.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-CidvTjIU.js +1 -0
  8. package/dist/assets/DataTableShell-C_uiwnG-.js +1 -0
  9. package/dist/assets/{DetailChips-J-KcpPRO.js → DetailChips-Bi7POigs.js} +1 -1
  10. package/dist/assets/FeedbacksTab-DK6ZRozw.js +1 -0
  11. package/dist/assets/{FieldLabel-DYhOcc_e.js → FieldLabel-aA5o4R2f.js} +1 -1
  12. package/dist/assets/FilesTab-N0bxhD0W.js +1 -0
  13. package/dist/assets/{FilterBar-CzpwZuGf.js → FilterBar-hVahB9Hp.js} +1 -1
  14. package/dist/assets/GroupsTab-D-5SYzK-.js +1 -0
  15. package/dist/assets/InstancesTab-BuWsscmq.js +1 -0
  16. package/dist/assets/IntegrationsTab-x8t35z2u.js +1 -0
  17. package/dist/assets/{KpiTab-DIdsAXH_.js → KpiTab-DYi2oDFh.js} +1 -1
  18. package/dist/assets/PreferencesTab-DIS_GpwC.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-BKs4VaBY.js +4 -0
  20. package/dist/assets/RolesTab-oG79jIyV.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-OLN1AmBk.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-B5Jv9cGp.js +1 -0
  23. package/dist/assets/ThemeShowroom-jXfQmTvF.js +1 -0
  24. package/dist/assets/{TimeRangePicker-XUfGR5S2.js → TimeRangePicker-Ys5YJrFa.js} +1 -1
  25. package/dist/assets/TracesTab-DS0dtQjd.js +1 -0
  26. package/dist/assets/UsersTab-CtJNzVXo.js +1 -0
  27. package/dist/assets/VoiceTab-CPvagmjD.js +1 -0
  28. package/dist/assets/{button-CvJAYeHx.js → button-B39xibrh.js} +1 -1
  29. package/dist/assets/{card-1aYDgnwU.js → card-BV_9rQvt.js} +1 -1
  30. package/dist/assets/chevrons-up-down-BL8pPwMe.js +1 -0
  31. package/dist/assets/{compatView-BHy79k8P.js → compatView-CzBpE4XD.js} +1 -1
  32. package/dist/assets/dispatchErrorInfo-C7BQ_n4r.js +1 -0
  33. package/dist/assets/{dist-CX03UY-q.js → dist-BB8NhuRg.js} +1 -1
  34. package/dist/assets/{dist-Bcr-KIFN.js → dist-C2CRpdq8.js} +5 -5
  35. package/dist/assets/{dist-CEDhHgbc.js → dist-D1sIakMz.js} +1 -1
  36. package/dist/assets/{dist-BvTSSv91.js → dist-uBTiN353.js} +1 -1
  37. package/dist/assets/{highlighted-body-OFNGDK62-EleSp1r2.js → highlighted-body-OFNGDK62-YEbKkO5h.js} +1 -1
  38. package/dist/assets/{index--Drh_B6c.js → index-BygEdn-c.js} +72 -72
  39. package/dist/assets/{index-B4voP0zS.css → index-EeiigULY.css} +1 -1
  40. package/dist/assets/mermaid-GHXKKRXX-a-Uqa-4Y.js +1 -0
  41. package/dist/assets/roleDescriptions-BU3_Xc_1.js +1 -0
  42. package/dist/assets/{table-CrooMP5e.js → table-BNCY2kTQ.js} +1 -1
  43. package/dist/assets/{tabs-DMDS7i26.js → tabs-1TpabOuW.js} +1 -1
  44. package/dist/assets/x-BbitkL6D.js +1 -0
  45. package/dist/index.html +8 -8
  46. package/package.json +1 -1
  47. package/dist/assets/AccessTab-BmNF0xWT.js +0 -1
  48. package/dist/assets/AgentFilesTab-Iqk_KofY.js +0 -3
  49. package/dist/assets/AnomaliesTab-xDgaxiGt.js +0 -1
  50. package/dist/assets/AuditTab-C1YqkRR1.js +0 -1
  51. package/dist/assets/BridgeTab-mLReg09f.js +0 -1
  52. package/dist/assets/ChatDefaultsTab-DJu8Eoyy.js +0 -1
  53. package/dist/assets/DataTableShell-c6bvewGu.js +0 -1
  54. package/dist/assets/FeedbacksTab-CzAvDpW2.js +0 -1
  55. package/dist/assets/FilesTab-BnodMPSK.js +0 -1
  56. package/dist/assets/GroupsTab-C9Sz4tdf.js +0 -1
  57. package/dist/assets/InstancesTab-OTDf7MYw.js +0 -1
  58. package/dist/assets/IntegrationsTab-DC9WLLvC.js +0 -1
  59. package/dist/assets/PreferencesTab-Yy4nWGBM.js +0 -1
  60. package/dist/assets/PromptInjectionsTab-CILSRtdl.js +0 -4
  61. package/dist/assets/RolesTab-BQNU-vsJ.js +0 -1
  62. package/dist/assets/ServiceAccountsTab-De0P-S_F.js +0 -1
  63. package/dist/assets/SubAgentReportsTab-GFSfR2RF.js +0 -1
  64. package/dist/assets/ThemeShowroom-sg8sZwIW.js +0 -1
  65. package/dist/assets/TracesTab-DE3TeHRG.js +0 -1
  66. package/dist/assets/UsersTab-CwAl49kr.js +0 -1
  67. package/dist/assets/VoiceTab-Djb19TZI.js +0 -1
  68. package/dist/assets/chevrons-up-down-BEdda7QD.js +0 -1
  69. package/dist/assets/dispatchErrorInfo-AjCvuCVv.js +0 -1
  70. package/dist/assets/mermaid-GHXKKRXX-kZO9jf6G.js +0 -1
  71. package/dist/assets/roleDescriptions-DBwd5h4i.js +0 -1
  72. package/dist/assets/x-BVy5P5am.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Au as r,Cu as i,Du as a,E as o,Eu as s,Fu as c,Iu as l,Lu as u,Mu as d,Nu as f,Ou as p,Pu as m,Sj as h,Tu as g,ju as _,ku as v,pj as y,wu as b}from"./dist-C2CRpdq8.js";import{C as x,S,b as C,st as w,w as T,x as E}from"./index-BygEdn-c.js";var D=t(e(),1);function O(e){return e===`user`?a():e===`all`?s():g({group:e.group})}function k(e){return e===`common`?b():e===`owner`?i():g({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=h(o.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=h(o.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":l(),children:(0,A.jsx)(T,{placeholder:l()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):i===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:m()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:p()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:i.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Gf as i,Hf as a,Kf as o,Uf as s,Vf as c,Wf as l}from"./dist-Bcr-KIFN.js";import{i as u}from"./dist-BvTSSv91.js";import{t as d}from"./x-BVy5P5am.js";import{t as f}from"./button-CvJAYeHx.js";import{C as p,Nt as m,S as h,b as g,ot as _,w as v,x as y}from"./index--Drh_B6c.js";import{r as b}from"./TimeRangePicker-XUfGR5S2.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:o()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let o=(0,x.useRef)(t),w=!!(o.current&&o.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(o.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:s()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:a()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),r()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gf as r,Hf as i,Jf as a,Kf as o,Uf as s,Wf as c,qf as l}from"./dist-C2CRpdq8.js";import{i as u}from"./dist-uBTiN353.js";import{t as d}from"./x-BbitkL6D.js";import{t as f}from"./button-B39xibrh.js";import{C as p,Ft as m,S as h,b as g,ct as _,w as v,x as y}from"./index-BygEdn-c.js";import{r as b}from"./TimeRangePicker-Ys5YJrFa.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),l(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(g,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-40`,children:(0,S.jsx)(v,{placeholder:r()})}),(0,S.jsx)(y,{children:e.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(g,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(p,{size:`sm`,className:`w-28`,children:(0,S.jsx)(v,{})}),(0,S.jsx)(y,{children:C.map(e=>(0,S.jsx)(h,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(_,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:c()}),(0,S.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),onClick:()=>P(t.id),children:(0,S.jsx)(d,{})})]},t.id))}),(0,S.jsxs)(f,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(m,{}),i()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,$s as i,Cr as a,E as o,Gn as s,Gs as c,Jn as l,Js as u,Kn as d,Ks as f,Qs as p,Sj as m,Sr as h,Us as g,Wn as _,Ws as v,Xn as y,Xs as b,Yn as x,Ys as S,Zs as C,_c as w,_r as T,ac as E,ar as D,br as ee,cc as O,cr as k,dc as A,dr as j,ec as te,fc as ne,fr as M,gc as N,gr as P,hc as re,hj as F,hr as I,ic as L,ir as R,lc as ie,lr as z,mc as ae,mr as B,nE as V,nc as oe,oc as se,or as ce,pc as le,pj as H,pr as ue,qn as de,qs as fe,rc as pe,rr as me,sc as he,sr as ge,tc as _e,tl as U,uc as ve,ur as ye,vc as be,vr as W,xj as xe,xr as Se,yj as G,yr as Ce}from"./dist-C2CRpdq8.js";import{t as K}from"./button-B39xibrh.js";import{C as we,G as Te,J as Ee,K as De,S as Oe,V as q,W as ke,X as Ae,Y as je,Z as Me,b as Ne,bt as Pe,dt as Fe,kt as J,lt as Ie,mt as Le,pt as Re,q as ze,st as Be,ut as Ve,w as He,x as Ue,y as We}from"./index-BygEdn-c.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CzBpE4XD.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*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 Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=m(o.me.getMe,{host:Pe}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=m(o.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&s(i[0].name)},[t,i,a]);let c=m(o.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=m(o.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,l]),[d,f]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let p=u?.find(e=>$(e)===d)??null,h=G(o.agentFiles.listAgentFiles),[g,_]=(0,Y.useState)({status:`idle`}),v=p?.instanceName??null,y=p?.agentId??null,b=m(o.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),x=n&&v!==null?We(b,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,C=(0,Y.useCallback)(async()=>{if(!(v===null||y===null)){_({status:`loading`});try{_({status:`done`,files:(await h({instanceName:v,agentId:y})).files})}catch{_({status:`error`})}}},[h,v,y]);(0,Y.useEffect)(()=>{S===!1&&C()},[C,S]);let[T,E]=(0,Y.useState)(null),D=m(o.agentFileCuration.listCurations,t&&v!==null&&y!==null?{instanceName:v,agentId:y}:`skip`),k=m(o.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),j=G(o.agentFileCuration.requestCuration),[te,M]=(0,Y.useState)(null),[P,I]=(0,Y.useState)(null),{toast:L}=q(),R=(0,Y.useMemo)(()=>{let e=new Map;for(let t of D??[])e.has(t.name)||e.set(t.name,t);return e},[D]),z=(0,Y.useCallback)(async e=>{if(!(v===null||y===null)){M(e);try{let t=await j({instanceName:v,agentId:y,name:e,trigger:`manual`});t.ok?L({title:ee(),variant:`success`}):L({title:Ce({reason:t.reason??`unknown`}),variant:`error`})}catch{L({title:W(),variant:`error`})}finally{M(null)}}},[j,v,y,L]),B=F(),V=(0,Y.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":w(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:(i??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ne,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":N(),children:(0,Q.jsx)(He,{})}),(0,Q.jsx)(Ue,{children:u.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:re()})]}),p===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,qe(x.gatewayVersion,x.provider)]}):g.status===`loading`||g.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):g.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[le(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:r()})]}):g.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:g.files.map(e=>{let n=Ye(e.size),r=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)(Be,{variant:`outline`,children:ne()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:A({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` 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:ve({pct:V.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":ie()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>E(e),children:t?he():se()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:k?.budgetChars??null,enabled:k?.enabled??!1,curation:R.get(e.name)??null,inFlight:te===e.name,onCurate:()=>void z(e.name),onReview:e=>I(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:O({used:Z(Ze(g.files),B),total:Z(Je,B),pct:V.format(Xe(Ze(g.files)))})})]}),T&&p?(0,Q.jsx)(rt,{instanceName:p.instanceName,agentId:p.agentId,name:T.name,isAdmin:t,onClose:()=>E(null),onSaved:()=>void C()}):null,P?(0,Q.jsx)(it,{curationId:P,onClose:()=>I(null),onApplied:()=>{I(null),C()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:o,onCurate:s,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:h()}):o||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Be,{variant:`outline`,className:`oc-afiles__curate-status`,children:Se()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:a()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:a,onClose:s,onSaved:l}){let d=G(o.agentFiles.getAgentFile),m=G(o.agentFiles.setAgentFile),h=q(),[_,y]=(0,Y.useState)(null),[x,w]=(0,Y.useState)(!1),[T,D]=(0,Y.useState)(``),[ee,O]=(0,Y.useState)(!1),[k,A]=(0,Y.useState)(!1),[j,ne]=(0,Y.useState)(!1),[M,N]=(0,Y.useState)(!1),P=(0,Y.useCallback)(async r=>{w(!1);try{let i=await d({instanceName:e,agentId:t,name:n});y({content:i.content,updatedAtMs:i.updatedAtMs}),r||D(i.content),ne(!1)}catch{w(!0)}},[d,e,t,n]);(0,Y.useEffect)(()=>{P(!1)},[P]);async function re(){if(_!==null){A(!0),N(!1);try{await m({instanceName:e,agentId:t,name:n,content:T,baseUpdatedAtMs:_.updatedAtMs??void 0}),h.success(i({name:n})),l(),await P(!1)}catch(e){et(e)?ne(!0):N(!0)}finally{A(!1)}}}let I=_!==null&&T!==_.content,R=(0,Y.useMemo)(()=>_===null?null:$e(_.content,T),[_,T]),ie=T.length>X,z=F(),ae=(0,Y.useMemo)(()=>new Intl.NumberFormat(z),[z]);return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>!e&&s(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:E({name:n})}),(0,Q.jsxs)(Fe,{children:[L({agent:t,instance:e}),a?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,pe()]})]})]}),x?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[C(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void P(!1),children:r()})]}):_===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:T,readOnly:!a,spellCheck:!1,onChange:e=>D(e.target.value),"aria-label":E({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:oe()}),j?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[b(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void P(!0),children:S()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:p()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:_e({count:ae.format(T.length),max:ae.format(X)})}),a?(0,Q.jsx)(K,{size:`sm`,disabled:!I||k||j,onClick:()=>O(!0),children:k?U():te()}):null]})]}),(0,Q.jsx)(ke,{open:ee,onOpenChange:O,children:(0,Q.jsxs)(ze,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Me,{children:u({name:n})}),(0,Q.jsx)(Ee,{children:fe({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:f({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:v()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(je,{children:[(0,Q.jsx)(De,{children:V()}),(0,Q.jsx)(Te,{onClick:()=>void re(),children:g()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=m(o.agentFileCuration.getProposal,{curationId:e}),i=G(o.agentFileCuration.approveCuration),a=xe(o.agentFileCuration.rejectCuration),{toast:c}=q(),[u,f]=(0,Y.useState)(null),[p,h]=(0,Y.useState)(!1),[g,v]=(0,Y.useState)(``),b=F(),S=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function C(){f(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:T(),variant:`success`}),n()):c({title:t.reason===`conflict`?I():B({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:W(),variant:`error`})}finally{f(null)}}async function w(n){f(`reject`);try{let r=g.trim();(await a({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?s():P(),variant:`success`}):c({title:j(),variant:`error`}),t()}catch{c({title:W(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Ie,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ve,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?ue({name:r.name}):H()}),(0,Q.jsx)(Fe,{children:M()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:H()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[ye({before:Z(r.beforeSize,b),after:Z(r.proposedSize,b)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,z()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:k({added:S.added,removed:S.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:_({feedback:r.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:me()}),(0,Q.jsx)(`ul`,{children:S.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:R()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ge()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:y()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:x(),value:g,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>h(!1),disabled:u!==null,children:l()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void w(!1),disabled:u!==null,children:u===`reject`?U():de()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(!0),disabled:u!==null,children:u===`reject`?U():d()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>h(!0),disabled:u!==null||r==null,children:ce()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void C(),disabled:u!==null||r==null,children:u===`approve`?U():D()})]})]})})}export{tt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Av as r,Bv as i,Cv as ee,Dv as te,E as a,Ev as ne,Fv as re,Gv as o,Hv as ie,Iv as ae,Lv as oe,Mv as s,Nv as c,Ov as l,Pv as u,Rv as d,Sj as f,Sv as p,Tv as se,Uv as m,Vv as ce,Wv as h,_v as le,av as g,bv as _,cv as ue,dv as de,fv as fe,gv as pe,hv as me,iv as v,jv as he,kv as ge,lv as _e,mv as y,ov as b,pv as x,rv as S,sv as C,uv as w,vv as T,wv as E,xj as D,xv as O,yv as k,zv as A}from"./dist-C2CRpdq8.js";import{A as j,C as M,H as N,Jt as P,S as F,V as I,a as ve,b as L,bt as ye,qt as R,r as be,st as z,w as B,x as V}from"./index-BygEdn-c.js";import{n as xe}from"./TimeRangePicker-Ys5YJrFa.js";import{t as Se}from"./FilterBar-hVahB9Hp.js";import{t as Ce}from"./DataTableShell-C_uiwnG-.js";import{t as H}from"./dispatchErrorInfo-C7BQ_n4r.js";var U=t(e(),1),W=n(),G=`__all__`,we=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Te(e){return e===`open`?o():e===`acknowledged`?h():m()}var Ee=[`info`,`warn`,`critical`],De=[`detector`,`agent`,`user`],Oe={kind:`relative`,from:`now-30d`,to:`now`},ke=200,K=`all`;function q(){let e=P({from:`/settings/anomalies`}),t=R({from:`/settings/anomalies`}),n=e.q??``,o=e.status===K?G:e.status,m=e.severity??G,h=e.kind??G,[g,v]=(0,U.useState)(G),b=be(e.from,e.to),{from:S,to:H}=xe(b),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,status:e===G?K:e})}),Y=e=>void t({search:t=>({...t,severity:e===G?void 0:e})}),Pe=e=>void t({search:t=>({...t,kind:e===G?void 0:e})}),Fe=e=>void t({search:t=>({...t,...ve(e)})}),Ie=N(),X=I(),Z=D(a.anomalies.resolveAnomaly),Le=(f(a.me.getMe,{host:ye})?.permissions??[]).includes(`admin.manage`),Q=f(a.anomalies.listAnomalies,{limit:ke,filter:{q:n||void 0,from:S,to:H,anomalyStatus:o===G?void 0:o,severity:m===G?void 0:m,source:g===G?void 0:g,kind:h===G?void 0:h}}),$=(0,U.useMemo)(()=>{let e=new Set;for(let t of Q??[])e.add(t.kind);return[...e].sort()},[Q]),Re=n!==``||o!==`open`||m!==G||g!==G||h!==G||b.kind!==`relative`||b.from!==Oe.from;function ze(){v(G),t({search:{status:`open`},replace:!0})}async function Be(e){if(await Ie({title:ie(),description:(0,W.jsxs)(W.Fragment,{children:[ce(),` `,(0,W.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,i(),` `,(0,W.jsx)(`strong`,{children:A()}),`.`,` `,d()]}),confirmLabel:oe()}))try{await Z({anomalyId:e._id,status:`resolved`}),X.success(ae(),e.kind)}catch(e){X.error(re(),e)}}async function Ve(e){try{await Z({anomalyId:e._id,status:`acknowledged`}),X.success(u(),e.kind)}catch(e){X.error(c(),e)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,W.jsx)(`strong`,{children:he()}),` `,r(),` `,(0,W.jsx)(`strong`,{children:ge()}),` `,l(),` `,(0,W.jsx)(`strong`,{children:te()}),` `,ne(),` `,(0,W.jsx)(`span`,{className:`oc-filter__window`,children:se()})]}),(0,W.jsxs)(Se,{q:n,onQChange:q,searchPlaceholder:E(),timeRange:b,onTimeRangeChange:Fe,onReset:ze,canReset:Re,children:[(0,W.jsxs)(L,{value:o,onValueChange:J,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:ee()}),we.map(e=>(0,W.jsx)(F,{value:e.value,children:Te(e.value)},e.value))]})]}),(0,W.jsxs)(L,{value:m,onValueChange:Y,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:p()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:O()}),Ee.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:g,onValueChange:v,children:[(0,W.jsx)(M,{size:`sm`,className:`w-32`,children:(0,W.jsx)(B,{placeholder:_()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:k()}),De.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]}),(0,W.jsxs)(L,{value:h,onValueChange:Pe,children:[(0,W.jsx)(M,{size:`sm`,className:`w-36`,children:(0,W.jsx)(B,{placeholder:T()})}),(0,W.jsxs)(V,{children:[(0,W.jsx)(F,{value:G,children:le()}),$.map(e=>(0,W.jsx)(F,{value:e,children:e},e))]})]})]}),(0,W.jsx)(Ce,{title:pe(),rows:Q,emptyHint:o===`open`?me():y(),rowActions:e=>Le&&e.status===`open`?[{label:x(),onSelect:()=>void Be(e)},{label:fe(),onSelect:()=>void Ve(e)}]:[],columns:[{header:de(),cell:e=>(0,W.jsx)(`span`,{className:`oc-traces__time`,children:j(e.at)}),sort:e=>e.at},{header:T(),cell:e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:p(),cell:e=>(0,W.jsx)(je,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:w(),cell:e=>(0,W.jsx)(Me,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:_(),cell:e=>(0,W.jsx)(z,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:_e(),cell:e=>(0,W.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),sort:e=>e.message},{header:ue(),cell:e=>(0,W.jsx)(Ae,{row:e}),sort:e=>e.evidence??null},{header:C(),cell:e=>e.correlationId?(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:Ne(e.correlationId)}):(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function J(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Y(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Ae({row:e}){let t=R();if(e.kind===`subagent.failure`){let n=Y(e);return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,b()]}):null]})}let n=J(e);if(!n.dominantCode)return(0,W.jsx)(`span`,{className:`oc-traces__muted`,children:`—`});let r=H(n.dominantCode),i=n.sampleCorrelationId;return(0,W.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,W.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,W.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,W.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,W.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,W.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:i,limit:100}}),children:[`↗ `,b()]}):null]})}function je({severity:e}){return(0,W.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Me({status:e}){return e===`open`?(0,W.jsx)(z,{variant:`destructive`,children:g()}):e===`acknowledged`?(0,W.jsx)(z,{variant:`secondary`,children:v()}):(0,W.jsx)(z,{variant:`outline`,children:S()})}function Ne(e){return e.length>8?e.slice(0,8):e}export{q as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{By as r,E as i,Gy as a,Hy as o,Iy as s,Jy as c,Ky as l,Ly as u,Ry as d,Sj as f,Sn as p,Uy as m,Vy as h,Wy as g,Xy as _,Yy as v,_n as y,bn as b,qy as x,vn as S,xn as C,yn as w,zy as T}from"./dist-C2CRpdq8.js";import{A as E,C as D,Jt as O,S as k,a as A,b as j,i as M,o as N,qt as P,r as F,t as I,w as L,x as R}from"./index-BygEdn-c.js";import{n as ee}from"./TimeRangePicker-Ys5YJrFa.js";import{t as z}from"./FilterBar-hVahB9Hp.js";import{t as B}from"./AdvancedFilter-DvEno3Aq.js";import{t as V}from"./DataTableShell-C_uiwnG-.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:p()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:b()},{value:`impersonated`,label:w()},{value:`resource`,label:S()},{value:`resourceId`,label:y()}];function q(){let e=O({from:`/settings/audit`}),t=P({from:`/settings/audit`}),n=e.q??``,p=e.action??G,y=e.impersonated??G,b=e.resource??G,S=F(e.from,e.to),C=(0,H.useMemo)(()=>N(e.adv),[e.adv]),{from:w,to:I}=ee(S),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=f(i.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:p===G?void 0:p,resource:b===G?void 0:b,impersonated:y===G?void 0:y===`yes`,advanced:C.length>0?C:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||p!==G||y!==G||b!==G||C.length>0||S.kind!==`relative`||S.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:c(),timeRange:S,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:p,onValueChange:J,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:x()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:l()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:y,onValueChange:Y,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:a()}),(0,U.jsx)(k,{value:`yes`,children:g()}),(0,U.jsx)(k,{value:`no`,children:m()})]})]}),(0,U.jsxs)(j,{value:b,onValueChange:X,children:[(0,U.jsx)(D,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:o()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(k,{value:G,children:h()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:r(),rows:$,emptyHint:T(),columns:[{header:d(),cell:e=>E(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:u(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:s(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:o(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,$m as i,Am as a,As as o,Bm as s,Bt as c,Cs as l,D as u,Dm as d,Ds as f,E as p,Es as m,Fm as h,Gh as ee,Gm as g,Hm as _,Ht as v,Im as y,Jh as te,Jm as ne,Km as re,Kt as ie,Lm as ae,Mm as oe,Ms as se,Nm as ce,Om as le,Os as ue,Pm as de,Qh as fe,Qm as pe,Rm as me,Sh as he,Sj as b,Ss as ge,Ts as _e,Um as ve,Ut as ye,Vm as x,Vt as be,Wh as xe,Wm as Se,Xh as Ce,Xm as we,Yh as Te,Ym as Ee,Zh as De,Zm as Oe,_h as ke,ah as Ae,bh as je,bs as Me,ch as Ne,dh as Pe,eg as Fe,eh as S,fh as Ie,gh as Le,gs as Re,hh as ze,ig as Be,ih as Ve,jm as He,js as Ue,km as We,ks as Ge,lh as Ke,mh as qe,nh as Je,oh as Ye,ph as Xe,qm as Ze,rg as Qe,rh as $e,sh as et,tg as tt,th as nt,uh as rt,vh as it,ws as at,xh as ot,xj as st,xs as ct,yh as lt,yj as ut,zm as dt,zt as ft}from"./dist-C2CRpdq8.js";import{i as C,r as pt}from"./dist-uBTiN353.js";import{t as mt}from"./chevrons-up-down-BL8pPwMe.js";import{i as ht,n as w,o as gt,r as _t,s as vt}from"./FieldLabel-aA5o4R2f.js";import{i as yt,n as bt,r as xt,t as St}from"./tabs-1TpabOuW.js";import{t as Ct}from"./button-B39xibrh.js";import{$ as wt,A as Tt,C as T,Gt as Et,Jt as Dt,Kt as E,Mt as Ot,Q as kt,Rt as At,S as D,V as jt,b as O,bt as Mt,ct as k,dt as Nt,et as Pt,j as A,kt as j,lt as Ft,m as It,mt as Lt,p as Rt,pt as zt,qt as M,st as N,ut as Bt,w as P,x as F}from"./index-BygEdn-c.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as I,n as Ut,o as L,r as R,t as z}from"./table-BNCY2kTQ.js";import{t as Wt}from"./FilterBar-hVahB9Hp.js";import{a as B,n as Gt,o as V,r as H,s as Kt,t as qt}from"./compatView-CzBpE4XD.js";import{t as U}from"./dispatchErrorInfo-C7BQ_n4r.js";var Jt=u(`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`}]]),Yt=u(`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`}]]),W=t(e(),1);function G(e){return e.filter(e=>e.state===`error`)}function Xt(e){return e.reachable&&G(e.targets).length===0}function Zt(e){return e.state===`error`&&e.lastErrorCode!==null}function Qt(e){return!!e.lastDownstreamRejectCode}function K(e){return e.kind??`openclaw`}function $t(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function en(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 $t(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 q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,Y={q:``,state:J,instance:J,version:J},X={connected:0,error:1,idle:2};function tn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function nn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function rn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function an(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return V(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function on(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=rn(t.key,e),a=rn(t.key,r);return i&&a?0:i?1:a?-1:n*an(t.key,e,r)})}function sn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function cn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function ln(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>V(e,t)??Z(e,t))}var Q=n();function un({connections:e,displayByInstance:t}){let[n,r]=(0,W.useState)(Y),[i,o]=(0,W.useState)(null),c=(0,W.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]),l=(0,W.useMemo)(()=>sn(c),[c]),u=(0,W.useMemo)(()=>cn(c),[c]),d=(0,W.useMemo)(()=>ln(c),[c]),f=(0,W.useMemo)(()=>on(nn(c,n),i),[c,n,i]);function p(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Wt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:_(),onReset:()=>r(Y),canReset:tn(n),children:[(0,Q.jsxs)(O,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(T,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:s()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:J,children:x()}),l.map(e=>(0,Q.jsx)(D,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(O,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(T,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(P,{placeholder:dt()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:J,children:x()}),u.map(e=>(0,Q.jsx)(D,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(O,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(T,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(P,{placeholder:me()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(D,{value:J,children:x()}),d.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))]})]})]}),f.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,Q.jsxs)(z,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(L,{children:[(0,Q.jsx)($,{label:y(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:h(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:de(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:ce(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:oe(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(I,{children:He()}),(0,Q.jsx)($,{label:a(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(Ut,{children:f.map(e=>(0,Q.jsx)(dn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(I,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(pt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function dn({r:e}){let t=Zt(e)?U(e.lastErrorCode):null,n=Qt(e)?U(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(W.Fragment,{children:[(0,Q.jsxs)(L,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(R,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(R,{children:(0,Q.jsx)(pn,{state:e.state})}),(0,Q.jsx)(R,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(R,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(R,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(R,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:Se({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(R,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:A(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(L,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(R,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${A(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[ve({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${A(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?We():e===`error`?le():d()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(N,{variant:`secondary`,children:We()}):e===`error`?(0,Q.jsx)(N,{variant:`destructive`,children:le()}):(0,Q.jsx)(N,{variant:`outline`,children:d()})}function mn(){return b(p.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=b(p.compat.getBridgeCompat,{}),n=b(p.me.getMe,{host:Mt})?.role===`admin`,r=b(p.admin.listInstances,n?{}:`skip`),i=b(p.agents.usageForInstances,n?{}:`skip`),a=M(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=en(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Dt({from:`/settings/bridge`}),u=M({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Gt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(gn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Ne()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:et()}),(0,Q.jsxs)(z,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(L,{children:[(0,Q.jsx)(I,{children:ye()}),(0,Q.jsx)(I,{children:v()}),(0,Q.jsx)(I,{children:be()}),(0,Q.jsx)(I,{children:c()}),(0,Q.jsx)(I,{children:ft()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=It(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(L,{children:[(0,Q.jsx)(R,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(R,{children:t.provider}),(0,Q.jsx)(R,{children:t.label}),(0,Q.jsx)(R,{children:(0,Q.jsxs)(N,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(R,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(St,{value:s.some(e=>e.key===l)?l:s[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(xt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(yt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ot,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(bt,{value:e.key,children:(0,Q.jsx)(_n,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Re()}):null]})}function gn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,s=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:B(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:o(),children:[`(`,a,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,Ge({build:t.buildVersion??`?`})]}):null,` · `,ue(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?f():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:i()});let c=G(e.targets),l=!e.reachable,u=Xt(e),d=u?`ok`:`error`,p=Tt(e.checkedAt),m=e.startedAt==null?null:Tt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Q.jsx)(Et,{size:22}):l?(0,Q.jsx)(Yt,{size:22}):(0,Q.jsx)(j,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?pe():l?Oe():we({count:c.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Jt,{size:12,"aria-hidden":!0}),` `,Ee({time:p})]}),m?(0,Q.jsx)(`span`,{children:ne({time:m})}):null,s]}),l?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:U(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ze()})]})}function _n({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:qt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,W.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(Ot,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),f?(0,Q.jsx)(N,{variant:f===`beyond`?`destructive`:`secondary`,children:H(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:se()}),(0,Q.jsx)(yn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(vn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}),re({count:t.length})]}),p?(0,Q.jsx)(un,{connections:t,displayByInstance:c}):null]})}function vn({protocol:e}){let[t,n]=(0,W.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ye(),i.length>0?(0,Q.jsx)(N,{variant:`destructive`,children:Ve({count:i.length})}):(0,Q.jsx)(N,{variant:`secondary`,children:Ae()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[$e({version:e.vendoredVersion}),r?` · `+Je({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(C,{size:13,"aria-hidden":!0}):(0,Q.jsx)(E,{size:13,"aria-hidden":!0}),nt({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function yn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:ie({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:at({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:f()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:B(e.version)}),(0,Q.jsx)(N,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:H(e.state)})]},e.instanceName))})]})}function bn({instance:e,onClose:t}){return(0,Q.jsx)(Ft,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(zt,{children:[(0,Q.jsx)(Lt,{children:Be({instance:e.displayName??e.name})}),(0,Q.jsx)(Nt,{children:Qe()})]}),(0,Q.jsx)(Sn,{instance:e,onClose:t})]})})}function xn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(Et,{"aria-hidden":!0}):(0,Q.jsx)(j,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ie():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,Pe()]}):null}function Sn({instance:e,onClose:t}){let n=st(p.admin.upsertInstanceConfig),i=ut(p.bridge.validateMediaPaths),a=jt(),o=Vt(e.config?.contentLocale,void 0),[s,c]=(0,W.useState)(()=>ht(e.config??{},o)),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(!1),[m,h]=(0,W.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(Le(),e)}finally{f(!1)}}async function ne(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,o)}),t()}catch(e){a.error(Ce(),e)}finally{u(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:tt(),help:Te()}),(0,Q.jsxs)(O,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Q.jsx)(T,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(F,{children:vt.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:Fe(),help:te()}),(0,Q.jsxs)(O,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(T,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(P,{})}),(0,Q.jsx)(F,{children:gt.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:r(),help:ee()}),(0,Q.jsx)(k,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:he(),help:ot()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(w,{label:je(),help:lt()}),(0,Q.jsx)(k,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Rt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Q.jsx)(w,{label:fe(),help:xe()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),Ke({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:qe(),result:m.inbound}),(0,Q.jsx)(xn,{label:Xe(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ze()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(j,{"aria-hidden":!0}),rt()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(Ct,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Q.jsx)(At,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ke():it()]}),(0,Q.jsx)(Ct,{size:`sm`,onClick:()=>void ne(),disabled:l,children:De()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(Pt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?l():ge({count:e.length}),(0,Q.jsx)(C,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(wt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:ct()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(N,{variant:`secondary`,children:e},e))})]})]})}export{hn as BridgeTab,bn as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Bs as i,E as a,Fs as o,Gt as s,Is as c,Jc as l,Ls as u,Ns as d,Ps as f,Rs as p,Sj as m,Vs as h,Yc as g,_c as _,ci as v,di as y,fi as b,li as x,mi as S,ng as C,pi as w,pj as T,tl as E,ui as D,xj as O,yj as k,zs as A}from"./dist-C2CRpdq8.js";import{t as j}from"./button-B39xibrh.js";import{C as M,S as N,b as P,ct as F,d as I,f as L,kt as R,p as z,w as B,x as V,y as H}from"./index-BygEdn-c.js";import{i as U}from"./compatView-CzBpE4XD.js";/* empty css */var W=t(e(),1),G=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function K(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 q=n();function J({instance:e}){let t=O(a.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,s]=(0,W.useState)(n),[c,l]=(0,W.useState)(r===null?``:String(r)),[u,p]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{s(n),l(r===null?``:String(r)),p(`idle`)},[e._id,n,r]);let m=c.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!i||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=i!==n||(h??null)!==r;async function v(){p(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),p(`done`)}catch{p(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,q.jsx)(z,{checked:i,onCheckedChange:e=>s(e===!0),"aria-label":b()}),(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(F,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":y(),disabled:!i}),(0,q.jsx)(j,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?E():o()})]}),g?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:D()}),u===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):null,u===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]})}function Y({instance:e}){let t=O(a.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,W.useState)(n===null?``:String(n)),[s,c]=(0,W.useState)(`idle`);(0,W.useEffect)(()=>{i(n===null?``:String(n)),c(`idle`)},[e._id,n]);let l=r.trim(),u=l===``?null:/^\d+$/.test(l)?Number.parseInt(l,10):NaN,p=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function h(){c(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}return(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,q.jsx)(F,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,q.jsx)(j,{size:`sm`,disabled:!m||!p||s===`saving`,onClick:()=>void h(),children:s===`saving`?E():o()})]}),p?null:(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),s===`done`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:f()}):null,s===`error`?(0,q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d()}):null,(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:w()})]})}function X(){let e=k(a.agentFiles.getChatDefaults),[t,n]=(0,W.useState)({status:`loading`}),o=m(a.admin.listInstances,{}),[d,f]=(0,W.useState)(null);(0,W.useEffect)(()=>{!o||o.length===0||(!d||!o.some(e=>e.name===d))&&f(o[0].name)},[o,d]);let v=(o?.length??0)>1,y=o!==void 0&&o.length===0,b=m(a.compat.forInstance,d?{instanceName:d}:`skip`),x=d?H(b,`configDefaults`):`loading`,S=x===`loading`?null:x.blocked,w=(0,W.useMemo)(()=>v&&d?{instanceName:d}:{},[v,d]),E=(0,W.useRef)(0),D=(0,W.useCallback)(async()=>{let t=++E.current;n({status:`loading`});try{let r=K(await e(w));if(E.current!==t)return;n({status:`done`,current:r})}catch{if(E.current!==t)return;n({status:`error`})}},[e,w]);(0,W.useEffect)(()=>{S===!1&&(v&&!d||D())},[D,S,v,d]);let O=t.status===`done`?t.current:null,F=(0,W.useMemo)(()=>G.map(e=>({id:e,label:L(e)})),[]),z=(0,W.useMemo)(()=>[{id:`fast`,label:g()},{id:`standard`,label:l()}],[]);return(0,q.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),v&&d?(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()}),(0,q.jsxs)(P,{value:d,onValueChange:e=>f(e),children:[(0,q.jsx)(M,{size:`sm`,"aria-label":_(),children:(0,q.jsx)(B,{})}),(0,q.jsx)(V,{children:(o??[]).map(e=>(0,q.jsx)(N,{value:e.name,children:e.name},e.name))})]})]}):null,y?(0,q.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:C()}):x===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):x.blocked?(0,q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,q.jsx)(R,{size:14,"aria-hidden":!0}),` `,U(x.gatewayVersion,x.provider)]}):t.status===`loading`?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):t.status===`error`?(0,q.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[c(),` `,(0,q.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:r()})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,q.jsx)(I,{options:F,value:O?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]}),(0,q.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,q.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,q.jsx)(I,{options:z,value:O===null||O.fastModeDefault===null?null:O.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,q.jsx)(`p`,{className:`oc-cdefaults__help`,children:u()})]}),(0,q.jsx)(`p`,{className:`oc-cdefaults__note`,children:s()})]}),(()=>{let e=o?.find(e=>e.name===(d??o[0]?.name));return e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Y,{instance:e}),(0,q.jsx)(J,{instance:e})]}):null})()]})}export{X as ChatDefaultsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{af as r,ef as i,if as a,nf as o,of as s,rf as c,tf as l}from"./dist-C2CRpdq8.js";import{i as u,r as d}from"./dist-uBTiN353.js";import{t as f}from"./chevrons-up-down-BL8pPwMe.js";import{t as p}from"./button-B39xibrh.js";import{At as m,Ft as h,Vt as g,at as _,nt as v,ot as y,p as b,rt as x,tt as S}from"./index-BygEdn-c.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-BNCY2kTQ.js";var k=t(e(),1);function A(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function j(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=A(i,a);return n===`asc`?c:-c})}var M=n();function N({title:e,rows:t,columns:n,rowActions:A,onAdd:N,addLabel:P=s(),bulkActions:F,emptyHint:I=r(),isExpanded:L,renderExpanded:R}){let[z,B]=(0,k.useState)(new Set),[V,H]=(0,k.useState)(null),U=t??[],W=V?n[V.index]:void 0,G=V&&W?.sort?j(U,W.sort,V.dir):U;function K(e){H(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let q=+!!F+n.length+ +!!A,J=U.length>0&&z.size===U.length,Y=z.size>0&&!J;function X(){B(J?new Set:new Set(U.map(e=>e._id)))}function Z(e){B(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,M.jsxs)(`div`,{className:`oc-dt`,children:[(0,M.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,M.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,M.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[z.size>0&&F?F.map(e=>(0,M.jsxs)(p,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(m,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(p,{size:`sm`,onClick:N,children:[(0,M.jsx)(h,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):U.length===0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:I}):(0,M.jsxs)(O,{children:[(0,M.jsx)(C,{children:(0,M.jsxs)(E,{children:[F?(0,M.jsx)(w,{className:`w-8`,children:(0,M.jsx)(b,{"aria-label":c(),checked:J?!0:Y?`indeterminate`:!1,onCheckedChange:X})}):null,n.map((e,t)=>{let n=V?.index===t;return e.sort?(0,M.jsx)(w,{className:e.className,"aria-sort":n?V.dir===`asc`?`ascending`:`descending`:`none`,children:(0,M.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>K(t),"aria-label":i({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(f,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,M.jsx)(w,{className:e.className,children:e.header},e.header)}),A?(0,M.jsx)(w,{className:`w-8`}):null]})}),(0,M.jsx)(T,{children:G.map(e=>{let t=A?.(e)??[],r=L?.(e)??!1;return(0,M.jsxs)(k.Fragment,{children:[(0,M.jsxs)(E,{className:`group/row`,children:[F?(0,M.jsx)(D,{children:(0,M.jsx)(b,{"aria-label":o(),checked:z.has(e._id),onCheckedChange:()=>Z(e._id)})}):null,n.map(t=>(0,M.jsx)(D,{className:t.className,children:t.cell(e)},t.header)),A?(0,M.jsx)(D,{children:t.length>0?(0,M.jsxs)(S,{children:[(0,M.jsx)(y,{asChild:!0,children:(0,M.jsx)(p,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),className:`opacity-0 transition-opacity group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,children:(0,M.jsx)(g,{})})}),(0,M.jsx)(v,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(_,{}):null,(0,M.jsx)(x,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&R?(0,M.jsx)(E,{className:`oc-dt__expansion`,children:(0,M.jsx)(D,{colSpan:q,className:`oc-dt__expansion-cell`,children:R(e)})}):null]},e._id)})})]})]})}export{N as t};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{at as t}from"./index--Drh_B6c.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{st as t}from"./index-BygEdn-c.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -0,0 +1 @@
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,CS as o,DS as s,Dr as c,E as l,ES as u,FS as d,GS as f,HS as p,IS as m,JS as h,KS as g,LS as ee,MS as _,NS as v,OS as y,PS as te,QS as ne,RS as re,SS as ie,Sj as ae,TS as b,US as x,VS as S,WS as C,XS as w,YS as T,ZS as E,_S as D,aC as O,bS as k,cC as A,dC as j,dS as M,eC as N,fC as P,fS as F,gS as I,hS as L,iC as R,jS as z,kS as B,kr as V,lC as H,mS as U,nC as oe,oC as W,pS as G,qS as K,rC as q,sC as se,tC as ce,uC as le,vS as ue,wS as de,xS as fe,xj as J,yS as pe,zS as me}from"./dist-C2CRpdq8.js";import{t as he}from"./button-B39xibrh.js";import{A as ge,H as _e}from"./index-BygEdn-c.js";import{t as Y}from"./DataTableShell-C_uiwnG-.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>P(),incorrect:()=>j(),incoherence:()=>le(),formatting:()=>H(),latency:()=>A(),api_error:()=>se(),other:()=>W()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:R()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:q()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:O()})}function ye({data:e,closeReason:t}){let n=e.snapshot,i=J(l.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,u]=(0,X.useState)(``),[d,_]=(0,X.useState)(!1);async function v(){let t=c.trim();if(!(!t||d)){_(!0);try{await i({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{_(!1)}}}let y=[];try{y=n.contextJson?JSON.parse(n.contextJson):[]}catch{y=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${oe()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?r():e.authorRole===`agent`?e.authorLabel??V():ne()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:E()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:w(),value:c,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void v(),disabled:!c.trim()||d,children:d?T():h()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||g()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||g()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:C()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,y.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x({count:n.contextCount??y.length,truncated:n.contextTruncated?p():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:y.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,Z.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,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:me()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?re({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,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ee(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,m()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=ae(l.feedback.listForAdmin,{}),t=J(l.feedback.readSnapshot),n=J(l.feedback.deleteFeedback),r=_e(),[a,f]=(0,X.useState)(null),[p,m]=(0,X.useState)({});async function h(e){if(a===e._id){f(null);return}if(!p[e._id]){let n=await t({feedbackId:e._id});m(t=>({...t,[e._id]:n}))}f(e._id)}async function g(e){await r({title:G(),description:F(),confirmLabel:M(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&f(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[d(),` `,(0,Z.jsx)(`strong`,{children:te()}),` `,v()]}),(0,Z.jsx)(Y,{title:_(),rows:e,emptyHint:z(),isExpanded:e=>a===e._id&&!!p[e._id],renderExpanded:e=>p[e._id]?(0,Z.jsx)(ye,{data:p[e._id],closeReason:e.userCloseReason}):null,columns:[{header:i(),cell:e=>ge(e.at),sort:e=>e.at},{header:B(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:y(),cell:e=>e.messageRole===`user`?s():u(),sort:e=>e.messageRole},{header:b(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${de({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:o(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ie(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:fe(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:k()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:pe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:c()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:ue()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?I():L(),onSelect:()=>void h(e)},{label:U(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,Dj as n}from"./dist-Bcr-KIFN.js";import{_ as r,g as i,h as a,v as o}from"./index--Drh_B6c.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{D as t,kj as n}from"./dist-C2CRpdq8.js";import{_ as r,g as i,h as a,v as o}from"./index-BygEdn-c.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var s=t(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),c={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
2
2
  Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
3
3
  To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
4
4
  {references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,BA as i,CA as ee,DA as te,E as a,EA as o,FA as s,GA as ne,HA as re,IA as c,KA as ie,LA as ae,MA as l,Mr as u,NA as d,Nr as f,OA as oe,PA as p,RA as se,SA as ce,Sj as le,TA as ue,UA as m,VA as de,WA as h,_A as fe,bA as g,fA as pe,gA as me,hA as he,hj as ge,jA as _,kA as _e,mA as ve,nE as ye,pA as be,pj as xe,qA as v,vA as y,wA as b,xA as x,xj as S,yA as C,zA as w}from"./dist-C2CRpdq8.js";import{t as T}from"./button-B39xibrh.js";import{At as E,C as D,G as O,Ht as k,J as A,K as j,Pt as M,S as N,V as Se,Vt as Ce,W as we,X as Te,Y as Ee,Z as De,b as P,nt as Oe,ot as ke,p as Ae,q as je,rt as F,st as I,tt as Me,w as L,x as R}from"./index-BygEdn-c.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-BNCY2kTQ.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return c();case`audio`:return s();case`video`:return p();case`pdf`:return d();case`document`:return l();case`archive`:return _();default:return r()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[s,c]=(0,H.useState)(W),[l,d]=(0,H.useState)(W),[p,_]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=S(a.files.softDelete),Y=Se();function Ie(){t(W),r(W),c(W),d(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(C())}catch(e){Y.error(y(),e)}}let X=le(a.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:s===W?void 0:s,category:l===W?void 0:l,includeAutoGenerated:p||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||s!==W||l!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ie(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ne()}),(0,U.jsx)(N,{value:`inbound`,children:h()}),(0,U.jsx)(N,{value:`outbound`,children:m()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:r,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":re(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:de()}),Q.chats.map(e=>(0,U.jsx)(N,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:s,onValueChange:c,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":i(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:w()}),Q.instances.map(e=>(0,U.jsx)(N,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:l,onValueChange:d,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":se(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(N,{value:W,children:ae()}),Q.categories.map(e=>(0,U.jsx)(N,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Ae,{checked:p,onCheckedChange:e=>_(e===!0),"aria-label":f()}),(0,U.jsx)(`span`,{children:f()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(M,{size:14,"aria-hidden":!0}),ce()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?be():ve()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:te()}),(0,U.jsx)(z,{children:o()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{className:`text-right`,children:b()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(I,{variant:`outline`,style:{marginLeft:6},children:u()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(I,{variant:`secondary`,children:e.direction===`inbound`?h():m()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(Me,{children:[(0,U.jsx)(ke,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":x(),children:(0,U.jsx)(Ce,{size:16})})}),(0,U.jsxs)(Oe,{align:`end`,children:[e.url?(0,U.jsx)(F,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(k,{size:14}),ee()]})}):(0,U.jsxs)(F,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),he()]}),(0,U.jsxs)(F,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(E,{size:14}),g()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:pe({cap:Be})}):null]}),(0,U.jsx)(we,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Te,{children:[(0,U.jsx)(De,{children:fe()}),(0,U.jsx)(A,{children:me()})]}),(0,U.jsxs)(Ee,{children:[(0,U.jsx)(j,{children:ye()}),(0,U.jsx)(O,{onClick:()=>void Le(),children:g()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{af as r,of as i}from"./dist-Bcr-KIFN.js";import{t as a}from"./button-CvJAYeHx.js";import{Mt as o,jt as s,ot as c}from"./index--Drh_B6c.js";import{t as l}from"./TimeRangePicker-XUfGR5S2.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=i(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(s,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cf as r,sf as i}from"./dist-C2CRpdq8.js";import{t as a}from"./button-B39xibrh.js";import{Nt as o,Pt as s,ct as c}from"./index-BygEdn-c.js";import{t as l}from"./TimeRangePicker-Ys5YJrFa.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(o,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(a,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(s,{}),i()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Al as i,Bl as a,Cl as o,D as s,Dl as c,E as l,El as u,Fl as d,Gl as f,Hl as p,Il as m,Jl as h,Kl as g,Ll as _,Ml as v,Nl as y,Ol as b,Pl as x,Ql as S,Rl as C,Sj as w,Sl as T,Su as E,Tl as D,Ul as O,Vl as k,Wl as A,Xl as ee,Yl as te,Zl as ne,_l as j,_u as M,au as re,bl as ie,bu as ae,cu as N,du as P,eu as oe,fu as se,gl as ce,gu as F,hl as le,hu as I,iu as L,jl as ue,kl as de,lu as fe,ml as pe,mu as me,nu as he,ou as ge,pl as _e,pu as ve,ql as R,ru as ye,su as be,tu as xe,uu as Se,vl as Ce,vu as we,wl as Te,xj as z,xl as Ee,xu as De,yl as Oe,yu as ke,zl as Ae}from"./dist-C2CRpdq8.js";import{t as je}from"./x-BbitkL6D.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs-1TpabOuW.js";import{t as H}from"./button-B39xibrh.js";import{C as Pe,H as Fe,Kt as Ie,Mt as U,S as Le,V as W,b as Re,bt as ze,ct as G,dt as Be,jt as K,lt as Ve,mt as He,p as q,pt as Ue,st as J,u as We,ut as Ge,w as Ke,x as qe}from"./index-BygEdn-c.js";import{t as Je}from"./FilterBar-hVahB9Hp.js";import{t as Ye}from"./DataTableShell-C_uiwnG-.js";import{t as Y}from"./DetailChips-Bi7POigs.js";var Xe=s(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ze=s(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),X=s(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Qe=s(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Z=t(e(),1);function $e(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function et(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function tt(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function nt(e){switch(e){case`admin`:return O();case`user`:return p();case`pending`:return k();default:return e}}function rt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function it(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var Q=n(),$={name:``,description:``};function at(){let e=w(l.groups.listGroups,{}),t=w(l.me.getMe,{host:ze})?.role===`admin`,n=z(l.groups.createGroup),r=z(l.groups.updateGroup),i=z(l.groups.deleteGroup),a=Fe(),o=W(),[s,c]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)($),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(``),v=(0,Z.useMemo)(()=>{if(!e)return e;let t=g.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,g]);function y(){d(null),p($),c(!0)}function b(e){d(e),p({name:e.name,description:e.description??``}),c(!0)}async function x(){try{u?await r({groupId:u._id,name:f.name,description:f.description}):await n({name:f.name,description:f.description||void 0}),p($),d(null),c(!1)}catch(e){o.error(ce(),e)}}async function S(e){if(await a({title:ye({name:e.name}),description:he(),confirmWord:e.name,confirmLabel:xe(),cancelLabel:fe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){o.error(le(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:De()}),(0,Q.jsx)(Je,{q:g,onQChange:_,onReset:()=>_(``),canReset:g!==``,searchPlaceholder:me()}),(0,Q.jsx)(Ye,{title:E(),rows:v,addLabel:ae(),onAdd:t?y:void 0,emptyHint:ke(),columns:[{header:we(),cell:e=>e.name,sort:e=>e.name},{header:M(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:F(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(U,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:I(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:ve(),onSelect:()=>h({groupId:e._id,name:e.name})},...t?[{label:se(),onSelect:()=>b(e)},{label:P(),variant:`destructive`,onSelect:()=>void S(e)}]:[]]}),(0,Q.jsx)(We,{open:s,onOpenChange:c,title:u?be():N(),description:ge(),canSubmit:!!f.name.trim(),onSubmit:x,submitLabel:Se(),children:(0,Q.jsxs)(`div`,{className:`oc-form`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:re()}),(0,Q.jsx)(G,{value:f.name,onChange:e=>p({...f,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:L()}),(0,Q.jsx)(G,{value:f.description,onChange:e=>p({...f,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:m?.groupId??null,groupName:m?.name??``,open:m!==null,onOpenChange:e=>{e||h(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Xe,{size:14,"aria-hidden":!0}),g()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":A({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(H,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[f(),(0,Q.jsx)(Ie,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let o=w(l.groups.getGroup,n&&e?{groupId:e}:`skip`),s=w(l.groups.listAssignableInstances,n?{}:`skip`),c=w(l.groups.listAssignableUsers,n?{}:`skip`),u=z(l.groups.addMember),f=z(l.groups.removeMember),p=z(l.groups.bulkSetMembers),g=z(l.groups.setGroupManager),_=W(),[v,y]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(``),[T,E]=(0,Z.useState)(`members`),[D,O]=(0,Z.useState)(1),[k,A]=(0,Z.useState)(new Set),j=(0,Z.useRef)(null),M=(0,Z.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),re=(0,Z.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),ae=o?.viewerIsAdmin===!0,N=(0,Z.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Z.useEffect)(()=>{y(``),x(``),E(`members`),O(1),j.current=null},[n,e]),(0,Z.useEffect)(()=>{O(1)},[v]),(0,Z.useEffect)(()=>{n&&o&&e&&j.current!==e&&(j.current=e,A(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let P=(0,Z.useMemo)(()=>c?$e(c,v,k):[],[c,v,k]);async function se(t,n){if(e)try{n?await f({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){_.error(pe(),e)}}async function ce(t,n){if(e)try{await g({groupId:e,userId:t,manager:!n})}catch(e){_.error(Ce(),e)}}let F=rt(P,e=>M.has(e.userId)),le=P.filter(e=>M.has(e.userId)).length,I=it(P,D,ot);async function L(){if(!e||P.length===0)return;let t=P.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:F!==`all`})}catch(e){_.error(pe(),e)}}return(0,Q.jsx)(Ve,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ge,{className:`oc-access`,children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(He,{children:oe({name:t})}),(0,Q.jsx)(Be,{children:r()})]}),(0,Q.jsxs)(Ne,{value:T,onValueChange:E,className:`oc-access__tabs`,children:[(0,Q.jsxs)(Me,{className:`w-full`,children:[(0,Q.jsxs)(B,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),S(),o?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),ee(),o?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:N.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),de(),o?(0,Q.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:c===void 0||o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:v,onChange:e=>y(e.target.value),placeholder:ne(),className:`oc-access__search`}),P.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h()}):(0,Q.jsxs)(Q.Fragment,{children:[P.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void L(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()}),(0,Q.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[le,` / `,P.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=M.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:t,onCheckedChange:()=>void se(e.userId,t),"aria-label":a({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ae?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?Oe():ie(),title:r?Oe():ie(),onClick:()=>void ce(e.userId,r),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":Ee(),title:Ee(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:O})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:s===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:b,onChange:e=>x(e.target.value),placeholder:te(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:N,query:b},`${e}-${t._id}`))})]})}),(0,Q.jsx)(V,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:a}){let o=w(l.groups.listAssignableAgents,{instanceName:t}),s=z(l.groups.assignAgentToGroup),c=z(l.groups.removeAgentFromGroup),u=z(l.groups.bulkSetGroupAgents),d=W(),[f,p]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{p(1)},[a]),!e)return null;let m=et(o?.agents??[],a),h=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),b=rt(g,e=>r.has(`${t}/${e.agentId}`)),S=it(m,f,ot);async function C(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(_e(),e)}}async function T(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await u({groupId:e,instanceName:t,agentIds:n,assigned:b!==`all`})}catch(e){d.error(_e(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(U,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:v()}):null]}),o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):m.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:h?y():x()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(q,{checked:b===`all`?!0:b===`some`?`indeterminate`:!1,onCheckedChange:()=>void T(),"aria-label":R()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:R()})]}):null,S.pageItems.map(e=>{let n=`${t}/${e.agentId}`,a=r.has(n),o=e.presentInLastOk===!1,s=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,Q.jsx)(q,{checked:a,disabled:(o||s)&&!a,onCheckedChange:()=>void C(e.agentId,a),"aria-label":Ae({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":i(),title:i(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):null,o?(0,Q.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:ue()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:S.page,pageCount:S.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=w(l.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(l.charts.assignChartToGroup),r=z(l.charts.removeChartFromGroup),i=z(l.charts.setGroupDefaultChart),a=z(l.charts.addChartToGroupPool),s=z(l.charts.removeChartFromGroupPool),d=W();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:C()});let{pool:f,addable:p,canManagePool:m}=t;if(f.length===0&&!m)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:b()});async function h(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){d.error(j(),e)}}async function g(t){try{await i({groupId:e,chartKey:t})}catch(e){d.error(j(),e)}}async function _(t){try{await a({groupId:e,chartKey:t})}catch(e){d.error(j(),e)}}async function v(t){try{await s({groupId:e,chartKey:t})}catch(e){d.error(j(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:f.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(q,{checked:e.selected,onCheckedChange:()=>void h(e.chartKey,e.selected),"aria-label":Te({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":o(),title:o(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void g(e.chartKey),children:T()}):null,m?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":D({name:e.name}),title:D({name:e.name}),onClick:()=>void v(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),m?p.length>0?(0,Q.jsxs)(Re,{value:``,onValueChange:e=>void _(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ke,{placeholder:u()})}),(0,Q.jsx)(qe,{children:p.map(e=>(0,Q.jsx)(Le,{value:e.chartKey,children:e.name},e.chartKey))})]}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:c()}):null:null]})}export{at as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$y as i,Ab as a,Ai as o,Ax as s,Bb as c,Cb as l,Cx as u,Db as d,Dx as f,E as p,Eb as m,Ex as h,Fb as g,Fx as _,Gb as v,Hb as y,Ib as b,Ix as ee,JE as x,Jb as S,Jt as te,Kb as C,Kh as ne,Lb as re,Lx as w,Mb as ie,Mi as ae,Mx as oe,Nb as se,Nx as ce,Ob as le,Ox as ue,Pb as de,Px as fe,Qb as pe,Qy as me,Rb as he,Sb as ge,Sj as T,Sx as _e,Tb as ve,Tx as ye,Ub as E,Vb as be,Wb as xe,Xb as Se,Xt as Ce,YE as D,Yb as we,Yt as Te,Zb as Ee,Zy as De,_b as Oe,_x as ke,ab as Ae,ax as je,bb as Me,bx as Ne,cb as Pe,cx as Fe,db as Ie,dx as Le,eb as Re,ex as O,fb as ze,fx as Be,gb as Ve,gx as He,hb as Ue,hx as We,ib as Ge,ix as Ke,jb as qe,ji as Je,jx as Ye,kb as Xe,ki as Ze,kx as Qe,lb as $e,lx as et,mb as tt,mx as nt,nb as rt,nx as it,ob as at,ox as ot,pb as st,px as ct,qb as k,qh as lt,rb as ut,rx as dt,sb as ft,sx as pt,tb as mt,tx as ht,ub as gt,ux as _t,vb as A,vx as vt,wb as yt,wx as bt,xb as j,xj as M,xx as xt,yb as St,yj as N,yx as Ct,zb as wt}from"./dist-C2CRpdq8.js";import{a as Tt,c as Et}from"./FieldLabel-aA5o4R2f.js";import{t as P}from"./button-B39xibrh.js";import{$ as Dt,C as F,H as Ot,Q as kt,S as I,V as L,b as R,ct as z,dt as B,et as At,lt as V,mt as H,p as U,pt as W,st as G,u as jt,ut as K,w as q,x as J}from"./index-BygEdn-c.js";import{t as Mt}from"./DataTableShell-C_uiwnG-.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-D2Qg8iKI.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Pt=new Set(X),Ft=`conversational`;function It(e){let t=new Set((e??[]).filter(e=>Pt.has(e)));return t.size===0?[Ft]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},Lt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Rt(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,streamTransport:e.streamTransport??`reactive`}}function zt(){let e=T(p.admin.listInstances,{}),t=T(p.agents.listAllInstanceAgents,{}),n=M(p.admin.upsertInstance),r=M(p.admin.deleteInstance),i=L(),[a,o]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(Q),[d,m]=(0,Y.useState)(null),[g,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null);async function C(){try{await n({instanceId:x??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),l(Q),S(null),o(!1)}catch(e){i.error(_(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[fe(),(0,Z.jsx)(`strong`,{children:ce()}),oe()]}),(0,Z.jsx)(Mt,{title:Ye(),rows:e,addLabel:s(),onAdd:()=>{S(null),l(Q),o(!0)},emptyHint:Qe(),columns:[{header:ue(),cell:e=>e.name,sort:e=>e.name},{header:f(),cell:e=>(0,Z.jsx)(G,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:h(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ye(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:w(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(G,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?me():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:xt(),onSelect:()=>{S(e._id),l(Rt(e)),o(!0)}},{label:ee(),onSelect:()=>m(e.name)},{label:ot(),onSelect:()=>b(e)},{label:bt(),onSelect:()=>v(e)},{label:u(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:u(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:a,onOpenChange:o,title:x?Ne():_e(),description:vt(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:C,submitLabel:ke(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:He(),children:[(0,Z.jsx)(z,{value:c.name,disabled:x!==null,onChange:e=>l({...c,name:e.target.value})}),x?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ct()}):null]}),(0,Z.jsx)($,{label:We(),children:(0,Z.jsxs)(R,{value:c.kind,onValueChange:e=>l({...c,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(I,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(I,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:Ce(),children:(0,Z.jsxs)(R,{value:c.transport,onValueChange:e=>l({...c,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(I,{value:`ws`,children:Te()}),(0,Z.jsx)(I,{value:`rest`,children:te()})]})]})}):null,(0,Z.jsx)($,{label:nt(),children:(0,Z.jsx)(z,{value:c.gatewayUrl,onChange:e=>l({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ct(),children:(0,Z.jsx)(z,{value:c.bridgeUrl,placeholder:Be(),onChange:e=>l({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Le(),children:(0,Z.jsx)(z,{value:c.displayName,onChange:e=>l({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:lt(),children:[(0,Z.jsxs)(R,{value:c.streamTransport,onValueChange:e=>l({...c,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(J,{children:Et.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ne()})]}),(0,Z.jsx)($,{label:_t(),children:(0,Z.jsx)(z,{value:c.gatewayVersion,placeholder:et(),onChange:e=>l({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Fe(),children:(0,Z.jsx)(z,{value:c.gatewayHttpUrl,placeholder:pt(),onChange:e=>l({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||m(null)}}),g?(0,Z.jsx)(Nt,{instance:g,onClose:()=>v(null)},g._id):null,y?(0,Z.jsx)(Bt,{instance:y,onClose:()=>b(null)},y._id):null]})}function Bt({instance:e,onClose:t}){let n=T(p.instanceSecrets.listInstanceSecretStatus,{}),r=Lt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(V,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(H,{children:je({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:Ke()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Ut,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ht,{instance:e})}),(0,Z.jsx)(Vt,{instance:e})]})})}function Vt({instance:e}){let t=N(p.instanceSync.forceInstanceSync),n=L(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(he());break;case`no_agents`:n.success(b());break;case`no_bridge_url`:n.error(g());break;case`deploy_misconfigured`:n.error(de());break;case`unauthorized`:n.error(ie());break;case`not_served`:n.error(qe());break;default:n.error(se());break}}catch(e){n.error(re(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?wt():c()})})]})}function Ht({instance:e}){let t=T(p.bridgeAuth.listBridgeAuthStatus,{}),n=N(p.bridgeAuth.mintBridgeSecret),i=M(p.bridgeAuth.revokeBridgeSecret),a=L(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(!1),g=(t??[]).find(t=>t.instanceId===e._id),_=g!==void 0;async function v(){if(!o){s(!0);try{u((await n({instanceId:e._id})).plaintext),h(!1)}catch(e){a.error(l(),e)}finally{s(!1)}}}async function y(){if(!o){s(!0);try{await i({instanceId:e._id}),u(null),a.success(yt())}catch(e){a.error(l(),e)}finally{s(!1)}}}async function b(){if(c)try{await navigator.clipboard.writeText(c),h(!0)}catch{}}return(0,Z.jsxs)($,{label:Xe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:_?`outline`:`secondary`,children:_?`${O()} · ${g.prefix}…${g.lastFour}`:r()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void v(),disabled:o,children:_?m():d()}),_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:o,children:ve()}):null]})]}),c?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ge()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void b(),children:f?D():x()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),h(!1)},children:j()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let i=N(p.instanceSecrets.setInstanceSecret),a=M(p.instanceSecrets.clearInstanceSecret),o=N(p.deviceIdentity.generateDeviceIdentity),s=L(),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,b=t===`deviceIdentity`,ee=t===`token`?dt():t===`deviceIdentity`?it():ht();async function te(){if(!(!c.trim()||u)){d(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),m(null),g(!1),s.success(S())}catch(e){s.error(k(),e)}finally{d(!1)}}}async function ne(){if(!u){d(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(C())}catch(e){s.error(k(),e)}finally{d(!1)}}}async function re(){if(!u){d(!0);try{m(await o({instanceId:e})),g(!1),s.success(E())}catch(e){s.error(be(),e)}finally{d(!1)}}}let w=f?`openclaw devices approve ${f.id}`:``;async function ie(){if(w)try{await navigator.clipboard.writeText(w),g(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(G,{variant:_?`outline`:`secondary`,children:_?O():r()}),(0,Z.jsx)(z,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?Ee():pe(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void te(),disabled:u||c.trim().length===0,children:Se()}),b?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void re(),disabled:u,children:v()}):null,_?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void ne(),disabled:u,children:we()}):null]})]}),f?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:E()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:w}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void ie(),children:h?D():x()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:j()})]}):null]})}var Wt={conversational:st,documentary:Ie,summarizer:ae,curator:o},Gt={conversational:ze,documentary:gt,summarizer:Je,curator:Ze},Kt=e=>(Wt[e]??(()=>e))(),qt=e=>(Gt[e]??(()=>``))();function Jt({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Oe()}),t.map(e=>(0,Z.jsx)(G,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(At,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:Ve()})}),(0,Z.jsxs)(Dt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Ue()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:tt()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(U,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Kt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:qt(r)})]})]},r)})})]})]})]})}function Yt({instanceName:e,open:t,onOpenChange:n}){let r=T(p.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=M(p.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=M(p.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=M(p.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(p.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(p.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=M(p.agents.removeInstanceAgent),l=Ot(),u=L();async function d(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(A(),e)}}async function f(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){u.error(A(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){u.error(A(),e)}}async function h(t,n){if(e&&await l({title:ft({name:n}),description:at(),confirmLabel:Ae(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Ge())}catch(e){u.error(A(),e)}}return(0,Z.jsx)(V,{open:t,onOpenChange:n,children:(0,Z.jsxs)(K,{className:`oc-access`,children:[(0,Z.jsxs)(W,{children:[(0,Z.jsx)(H,{children:Me({name:e??``})}),(0,Z.jsx)(B,{children:St()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ut()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?rt():r.discovery.lastPollOk?mt():Re({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(U,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void d(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:De()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(e.agentId,i),children:Pe()})]}):n?(0,Z.jsx)(G,{variant:`default`,children:me()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void f(e.agentId),children:$e()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void m(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{zt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,CC as i,E as a,EC as o,Ga as s,Ja as c,Ka as l,Qa as u,SC as d,Sj as f,TC as p,Xa as m,Ya as h,Za as g,_C as _,bC as v,gC as y,hC as b,mC as x,pC as S,qa as C,vC as w,wC as T,xC as E,xj as D,yC as O,yj as k}from"./dist-C2CRpdq8.js";import{t as A}from"./button-B39xibrh.js";import{ct as j,p as M,st as N}from"./index-BygEdn-c.js";var P=t(e(),1),F=n();function I(){let e=f(a.integrations.status.status,{}),t=D(a.admin.setIntegrationConfig),[n,s]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:o()});let c=n,l=(e,t,n)=>s({...c,[e]:{...c[e],[t]:n}}),m=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,F.jsx)(`strong`,{children:T()}),` `,i()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:v()}),note:O(),children:[(0,F.jsx)(R,{label:_(),children:(0,F.jsx)(j,{value:c.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>m(`langfuse`,{host:c.langfuse.host??``})})}),(0,F.jsx)(z,{label:S(),checked:c.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),m(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:v()}),note:w(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(j,{value:c.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>m(`opik`,{baseUrl:c.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(j,{value:c.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||x(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>m(`opik`,{workspace:c.opik.workspace??``})})}),(0,F.jsx)(z,{label:S(),checked:c.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),m(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:d()}):(0,F.jsx)(N,{variant:`outline`,children:E()}):(0,F.jsx)(N,{variant:`outline`,children:r()}),note:u(),children:[(0,F.jsx)(R,{label:g(),children:(0,F.jsx)(j,{value:c.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>m(`otlp`,{endpoint:c.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:S(),checked:c.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),m(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(M,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=k(a.integrations.otlpSecret.setOtlpHeaders),n=D(a.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[o,u]=(0,P.useState)(null),[d,f]=(0,P.useState)(!1),p=async()=>{f(!0),u(null);try{await t({headersJson:r}),i(``)}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:m(),children:[(0,F.jsx)(j,{value:r,placeholder:e?h():c(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||r.trim().length===0,onClick:()=>void p(),children:C()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:l()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:s()})]})}export{I as IntegrationsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$p as r,E as i,Mw as a,Qp as o,XC as s,ZC as c,am as l,aw as u,bj as d,cm as f,dm as p,em as m,im as h,iw as g,lm as _,nm as v,om as y,ow as b,rm as x,sm as S,sw as C,tm as w,um as T}from"./dist-Bcr-KIFN.js";import{Gt as E,Kt as D,a as ee,n as te,r as ne,vt as re}from"./index--Drh_B6c.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-1aYDgnwU.js";import{n as N,t as P}from"./TimeRangePicker-XUfGR5S2.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=d(i.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=d(i.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:a()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:C()}),(0,I.jsx)(j,{children:u()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[s(),` p50 `,R(l.cP50),` `,b()]}),(0,I.jsxs)(`span`,{children:[c(),` p50 `,R(l.aP50),` `,b()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":C(),children:[(0,I.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:p(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:T(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:_(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:f(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:S(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:y(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=D({from:`/settings/kpi`}),t=E({from:`/settings/kpi`}),n=ne(e.from,e.to,te,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=K(a,o),u=d(i.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[u,c]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return u===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}):u.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:v()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,i=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&i>0?` oc-kpi__value--error`:``),children:Q(i)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:w({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:m()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:r({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":o({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,E as i,Pw as a,QC as o,Sj as s,am as c,cm as l,cw as u,dm as d,em as f,fm as p,im as m,lm as h,lw as g,nm as _,om as v,ow as y,pm as b,rm as x,sm as S,sw as C,tm as w,um as T}from"./dist-C2CRpdq8.js";import{Jt as E,a as ee,bt as te,n as ne,qt as re,r as D}from"./index-BygEdn-c.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BV_9rQvt.js";import{n as N,t as P}from"./TimeRangePicker-Ys5YJrFa.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=s(i.me.getMe,{host:te})?.permissions?.includes(`traces.read`)??!1,t=s(i.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:a()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:g()}),(0,I.jsx)(j,{children:C()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),s=e=>74-e*68/i,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[o(),` p50 `,R(l.cP50),` `,u()]}),(0,I.jsxs)(`span`,{children:[r(),` p50 `,R(l.aP50),` `,u()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":g(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:b(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:p(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:T(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:h(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=E({from:`/settings/kpi`}),t=re({from:`/settings/kpi`}),n=D(e.from,e.to,ne,`now`),r=e=>void t({search:t=>({...t,...ee(e)})}),{from:a,to:o}=N(n),{rowLimit:l,buckets:u}=K(a,o),d=s(i.kpi.listKpis,{limit:l,filter:{from:a,to:o}}),f=(0,F.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>u&&e.set(t,n.slice(n.length-u));return e},[d,u]),p=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:v()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return d===void 0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):d.length===0?(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:m()})]}):(0,I.jsxs)(I.Fragment,{children:[p,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(f.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:f.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:x({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:_()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:w({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":f({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{q as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,A as i,AO as a,BO as o,CO as s,DO as c,E as l,EO as u,F as d,FO as f,G as ee,I as te,IO as ne,L as re,LO as ie,M as ae,MO as oe,N as se,NO as ce,OO as le,P as ue,PO as p,QA as m,RO as h,SO as g,Sj as _,TO as de,VO as fe,X as pe,XA as me,YA as v,Z as y,ZA as b,_O as x,_x as S,aj as C,bO as w,cO as T,cj as E,dO as D,ej as O,fO as k,gO as A,hO as j,ij as M,j as N,jO as P,kO as F,lO as I,mO as L,n as R,nj as z,pO as he,pj as ge,rj as _e,sO as ve,tj as ye,uO as be,vO as xe,wO as Se,xO as Ce,xj as B,yO as V,zO as we}from"./dist-C2CRpdq8.js";import{t as H}from"./button-B39xibrh.js";import{C as Te,M as Ee,S as U,V as De,_t as Oe,b as ke,bt as W,ct as G,p as K,st as q,vt as Ae,w as je,x as Me,yt as Ne}from"./index-BygEdn-c.js";import{t as Pe}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function Fe({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,Y.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var X=[{id:`messages`,label:()=>fe()},{id:`composer`,label:()=>o()},{id:`sidebar`,label:()=>we()},{id:`other`,label:()=>h()}],Z={showSource:{category:`messages`,label:()=>ie(),help:()=>ne()},showReport:{category:`messages`,label:()=>f(),help:()=>p()},copyAssistant:{category:`messages`,label:()=>ce()},copyUser:{category:`messages`,label:()=>oe()},showDelete:{category:`messages`,label:()=>P()},showTools:{category:`messages`,label:()=>a(),help:()=>F()},voiceInput:{category:`composer`,label:()=>le(),help:()=>c()},showUsage:{category:`composer`,label:()=>u(),help:()=>de()},autoReadAloud:{category:`composer`,label:()=>y(),help:()=>pe()},showChatAge:{category:`sidebar`,label:()=>Se(),help:()=>s()},showChatProvider:{category:`sidebar`,label:()=>g(),help:()=>Ce()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ie(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var Le=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`],Re={voiceInput:`voiceInput`};function ze(e){return Le.includes(e)}function $(e){return e===`admin`}function Be(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Ve(e){return e===`on`?!0:e===`off`?!1:null}function He(e){return ze(e)?Re[e]:void 0}var Ue={voiceInput:()=>D()};function We({prefKey:e,ui:t}){let n=B(l.admin.setUiPrefDefault),r=B(l.admin.setFeatureEnabled),i=He(e),a=i?Ue[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:j()}),(0,Y.jsxs)(ke,{value:Be(t.defaults[e]),onValueChange:t=>void n({key:e,value:Ve(t)}),children:[(0,Y.jsx)(Te,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(je,{})}),(0,Y.jsxs)(Me,{children:[(0,Y.jsx)(U,{value:`on`,children:I()}),(0,Y.jsx)(U,{value:`off`,children:T()}),(0,Y.jsx)(U,{value:`inherit`,children:ve()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":L()}),L()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Ge({current:e,enabled:t}){let n=B(l.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Ae(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[re(),e?(0,Y.jsx)(q,{variant:`secondary`,children:Ne(e,Oe())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?ue():r?d():te()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:i()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?N():e?ae():se()})]})]})}function Ke(){let[e,t]=(0,J.useState)(``),[n,r]=(0,J.useState)(!1),i=_(l.me.getMe,{host:W}),a=i?.ui,o=$(i?.role)&&n,s=B(l.me.setUiPref).withOptimisticUpdate(Ee),c=(0,J.useMemo)(()=>a?Ie(Object.keys(a.effective),e):[],[a,e]);return a?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":A()}),A()]}):null,o?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:he()}),(0,Y.jsx)(`p`,{children:k()}),(0,Y.jsx)(`p`,{children:be()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:w(),"aria-label":w(),className:`mb-2`}),c.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:V()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(q,{variant:`outline`,children:xe()}):l?(0,Y.jsx)(q,{variant:`secondary`,children:ee()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:x()}):null,(0,Y.jsx)(Fe,{checked:c,disabled:i,onCheckedChange:t=>void s({key:e,value:t}),"aria-label":n})]}),o?(0,Y.jsx)(We,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,Y.jsx)(Ge,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:ge()})}function qe(){let e=_(l.me.getMe,{host:W}),t=B(l.me.setLocale),n=B(l.me.setMyName),i=De(),a=e?.locale??`default`,o=e?.name??``,[s,c]=(0,J.useState)(null),u=s??o,d=u.trim()!==o.trim();async function f(){try{await n({name:u}),c(null),i.success(ye())}catch(e){i.error(O(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:C()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:u,maxLength:120,placeholder:_e(),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!d,onClick:()=>void f(),children:S()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:z()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:r()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Pe().map(e=>(0,Y.jsx)(H,{variant:a===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:a==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:E()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:me()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),(0,Y.jsx)(Ke,{})]})]})}export{qe as PreferencesTab};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,$t as i,Ah as a,Bh as o,Dh as s,E as c,Eh as l,Fh as u,Fi as d,Hh as f,Ih as p,Ii as m,Lh as h,Li as g,Mh as _,Nh as v,Ni as ee,Oh as y,Ph as b,Pi as x,Qn as S,Qt as C,Rh as w,Sj as T,Th as te,Uh as ne,Vh as re,Xh as E,Zh as ie,Zn as ae,Zt as D,er as O,jh as k,kh as A,nr as j,tr as M,wh as N,xj as P,zh as F}from"./dist-C2CRpdq8.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as oe}from"./FieldLabel-aA5o4R2f.js";import{t as U}from"./button-B39xibrh.js";import{C as W,S as G,V as K,b as q,bt as se,p as ce,w as J,x as Y}from"./index-BygEdn-c.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:w,help:h},documentary_fetch:{label:p,help:u},inbound_files:{label:b,help:v},history_summary:{label:g,help:m},file_curation:{label:j,help:M}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
+ - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
+ Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
+ - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:l,references:te,files:N,previous_summary:d,new_messages:x,max_chars:ee,file_name:O,budget_chars:r,feedback:S,content:ae};function pe(){let e=T(c.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:k()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:ne(),help:f()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:_()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=P(c.admin.upsertInstanceConfig),n=K(),r=T(c.me.getMe,{host:se}),a=e.config??{},o=X(e.config?.contentLocale,r?.defaultLocale??void 0),[s,l]=(0,Q.useState)(()=>R(a,o));(0,Q.useEffect)(()=>{l(R(a,o))},[o,e._id]);let[u,d]=(0,Q.useState)(!1),f=s.promptInjections,p=(e,t)=>l({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){d(!0);try{await t({instanceId:e._id,config:V(s,a,o)})}catch(e){n.error(E(),e)}finally{d(!1)}}async function h(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(E(),e)}}let g=e.config?.contentLocale??`default`,_=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:i()}),(0,$.jsxs)(q,{value:g,onValueChange:e=>void h(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(J,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:D({locale:_})}),le().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}),oe.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:f[e]??{enabled:!0,template:z[e].defaultTemplate[o]},contentLocale:o,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void m(),disabled:u,children:ie()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:c}){let[l,u]=(0,Q.useState)(!1),d=r.template.trim()!==t.defaultTemplate[i],f=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),m=I(e,r,i),h=m?L(m,p):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(ce,{checked:r.enabled,onCheckedChange:e=>c({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),d&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:o()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>c({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:F()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>u(e=>!e),children:l?A():a()}),d&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c({template:t.defaultTemplate[i]}),children:re()})]})]}),l&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:y()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:s()})})]})}export{pe as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Ay as i,Cy as a,Dy as o,E as s,Er as c,Ey as l,Fy as u,Jv as d,Kv as f,My as p,Ny as m,Oy as h,Py as g,Qv as _,Sj as v,Sy as y,Ty as b,Xv as x,Yv as S,Zv as C,_y as ee,by as te,cy as ne,dy as re,ey as ie,fy as w,gy as T,hy as E,jy as D,ky as O,ly as k,my as A,oy as j,py as M,qv as N,sy as P,uy as F,vy as I,wy as L,xj as R,xy as z,yy as ae}from"./dist-C2CRpdq8.js";import{t as B}from"./button-B39xibrh.js";import{H as V,Lt as H,V as U,ct as W,p as G,st as K,u as q}from"./index-BygEdn-c.js";import{t as J}from"./roleDescriptions-BU3_Xc_1.js";var Y=t(e(),1),X=n(),Z=[{group:()=>u(),keys:[{key:`traces.read`,label:()=>i()},{key:`traces.read.content`,label:()=>O(),phi:!0},{key:`traces.write`,label:()=>h()}]},{group:()=>g(),keys:[{key:`kpi.read`,label:()=>i()},{key:`kpi.write`,label:()=>h()}]},{group:()=>m(),keys:[{key:`openclaw.query`,label:()=>o()},{key:`anomalies.read`,label:()=>l()},{key:`anomalies.report`,label:()=>b()}]},{group:()=>p(),keys:[{key:`chats.read`,label:()=>i()},{key:`selfheal`,label:()=>a()},{key:`feedback.respond`,label:()=>c()}]},{group:()=>D(),keys:[{key:`admin.manage`,label:()=>L()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=v(s.apiKeys.listRoles,{}),t=R(s.apiKeys.createRole),n=R(s.apiKeys.ensureRolesSeeded),i=R(s.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(s.apiKeys.listRoles,{});r&&e.setQuery(s.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=V(),o=U(),[c,l]=(0,Y.useState)(!1),[u,p]=(0,Y.useState)($),[m,h]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(z(),e)})},[n,o]);let g=e??[];async function b(e,t){if(Q(e.permissions)||m.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:te({name:e.name}),description:ae(),confirmLabel:I()}))){h(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(ee(),e)}finally{h(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function D(){try{await t({key:u.key,name:u.name,description:u.description||void 0,permissions:[]}),p($),l(!1)}catch(e){o.error(T(),e)}}let O=e===void 0,L=!O&&g.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,A(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,M()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:w()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{p($),l(!0)},children:re()})})]}),O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ne()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?y({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:g.map(e=>{let t=Q(e.permissions),n=m.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(K,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,P()]}):(0,X.jsx)(K,{variant:`secondary`,children:j()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(i=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(i),disabled:t||n,"aria-label":`${e.key} · ${i}`,title:t?ie():n?r():i,onCheckedChange:()=>void b(e,i)})},i))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:c,onOpenChange:l,title:_(),description:C(),canSubmit:!!(u.key&&u.name),onSubmit:D,submitLabel:x(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,X.jsx)(W,{value:u.key,placeholder:d(),onChange:e=>p({...u,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:N()}),(0,X.jsx)(W,{value:u.name,onChange:e=>p({...u,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,X.jsx)(W,{value:u.description,onChange:e=>p({...u,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$E as i,AD as a,BD as ee,BE as o,CD as te,DD as ne,E as s,ED as re,FD as ie,GD as ae,GE as c,HD as oe,HE as l,ID as se,JD as ce,JE as u,KD as le,KE as d,LD as ue,MD as de,ND as fe,OD as pe,PD as me,QD as he,QE as f,RD as ge,SD as _e,Sj as p,TD as ve,UD as ye,UE as m,VD as be,VE as xe,WD as Se,WE as Ce,XD as we,XE as Te,YD as Ee,YE as h,ZD as De,ZE as g,_D as Oe,aD as _,aO as ke,bD as Ae,cD as v,dD as je,eD as y,eO as b,fD as Me,gD as Ne,hD as Pe,iD as x,iO as Fe,jD as Ie,kD as Le,lD as S,mD as Re,nD as C,nO as ze,oD as w,oO as Be,pD as Ve,qD as He,qE as T,rD as E,rO as Ue,sD as D,tD as O,tO as k,uD as We,vD as Ge,wD as Ke,xD as qe,xj as A,yD as Je,yj as Ye,zD as Xe}from"./dist-C2CRpdq8.js";import{n as j}from"./dist-BB8NhuRg.js";import{i as Ze}from"./dist-uBTiN353.js";import{t as M}from"./button-B39xibrh.js";import{A as N,C as P,H as Qe,Jt as $e,Kt as et,S as F,Ut as I,V as tt,b as L,ct as R,dt as z,ft as B,k as V,lt as H,mt as nt,pt as rt,qt as it,st as U,u as at,ut as W,w as G,x as K}from"./index-BygEdn-c.js";import{t as ot}from"./FilterBar-hVahB9Hp.js";import{t as st}from"./DataTableShell-C_uiwnG-.js";import{t as ct}from"./roleDescriptions-BU3_Xc_1.js";var q=t(e(),1),J=n(),Y=[{value:`never`,label:()=>d(),days:null},{value:`30`,label:()=>c(),days:30},{value:`90`,label:()=>Ce(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=$e({from:`/settings/serviceAccounts`}),t=it({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[o,c]=(0,q.useState)(Z),l=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),u=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),d=p(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:i===Z?void 0:i===`disabled`}}),f=p(s.apiKeys.listKeys,{}),m=p(s.apiKeys.listRoles,{}),xe=A(s.apiKeys.createServiceAccount),Ce=A(s.apiKeys.updateServiceAccount),Te=A(s.apiKeys.deleteServiceAccount),h=Ye(s.apiKeys.mintApiKey),g=A(s.apiKeys.revokeApiKey),_=Qe(),v=tt(),y=n!==``||o!==Z||i!==Z;function x(){c(Z),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Q),[E,D]=(0,q.useState)(null),[O,j]=(0,q.useState)(new Set),[N,I]=(0,q.useState)(null),z=(0,q.useRef)(!1),[B,V]=(0,q.useState)(new Set),[H,nt]=(0,q.useState)({}),[rt,W]=(0,q.useState)(null),X=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);function $(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await Ce({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(Ke())):await xe({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),D(null),C(!1)}catch(e){v.error(E?ve():re(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),D(e._id),C(!0)}async function pt(e){if(z.current)return;z.current=!0;let t=H[e._id]??`never`,n=Y.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});W({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(te(),e)}finally{z.current=!1,I(null)}}async function mt(e){if(await _({title:_e(),description:(0,J.jsxs)(J.Fragment,{children:[qe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ae(),` `,(0,J.jsx)(`strong`,{children:Je()}),` `,Ge()]}),confirmWord:e.name,confirmLabel:Oe(),destructive:!0}))try{await Te({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(Pe(),e)}}async function ht(e){if(await _({title:Re(),description:(0,J.jsxs)(J.Fragment,{children:[Ve(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Me()]}),confirmLabel:je(),destructive:!0})&&!B.has(e._id)){V(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(We(),e)}finally{V(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:Be()}),(0,J.jsxs)(ot,{q:n,onQChange:l,searchPlaceholder:ke(),onReset:x,canReset:y,children:[(0,J.jsxs)(L,{value:o,onValueChange:c,children:[(0,J.jsx)(P,{size:`sm`,className:`w-40`,children:(0,J.jsx)(G,{placeholder:Fe()})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:Ue()}),(m??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:i,onValueChange:u,children:[(0,J.jsx)(P,{size:`sm`,className:`w-36`,children:(0,J.jsx)(G,{})}),(0,J.jsxs)(K,{children:[(0,J.jsx)(F,{value:Z,children:ze()}),(0,J.jsx)(F,{value:`active`,children:k()}),(0,J.jsx)(F,{value:`disabled`,children:b()})]})]})]}),(0,J.jsx)(st,{title:r(),rows:d,addLabel:he(),onAdd:()=>{T(Q),D(null),C(!0)},emptyHint:De(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,J.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:B}),rowActions:e=>[{label:He(),onSelect:()=>ft(e)},{label:we(),onSelect:()=>void pt(e)},{label:O.has(e._id)?Ee():ce(),onSelect:()=>$(e._id)},{label:le(),variant:`destructive`,onSelect:()=>void mt(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ae():Se(),onClick:()=>$(e._id),children:O.has(e._id)?(0,J.jsx)(Ze,{}):(0,J.jsx)(et,{})})},{header:ye(),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)(U,{variant:`secondary`,children:e.roleKey})},{header:be(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:b()}):(0,J.jsx)(U,{variant:`outline`,children:k()})},{header:ee(),cell:e=>(0,J.jsxs)(L,{value:H[e._id]??`never`,onValueChange:t=>nt(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(P,{size:`sm`,className:`w-32`,children:(0,J.jsx)(G,{})}),(0,J.jsx)(K,{children:Y.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Xe(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:N===e._id?ge():ue({count:t})})}}]}),(0,J.jsx)(at,{open:S,onOpenChange:e=>{C(e),e||D(null)},title:E?se():fe(),description:E?ie():de(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?me():Ie(),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:a()}),(0,J.jsx)(R,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Le()}),(0,J.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(P,{className:`w-full`,children:(0,J.jsx)(G,{placeholder:pe()})}),(0,J.jsx)(K,{children:(m??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(m??[]).find(e=>e.key===w.roleKey),t=e?ct(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:ne()}),(0,J.jsx)(R,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(ut,{minted:rt,onClose:()=>W(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:[S(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:D()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:x()}),(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:C()}),(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)(U,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:N(t.createdAt)}),(0,J.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:pt(t.expiresAt)}),(0,J.jsx)(`td`,{children:mt(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():y()})})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function a(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(H,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(rt,{children:[(0,J.jsx)(nt,{children:i()}),(0,J.jsx)(z,{children:f({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:g()}),(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 a(),"aria-label":Te(),children:[n?(0,J.jsx)(j,{}):(0,J.jsx)(I,{}),n?h():u()]})]}),(0,J.jsx)(B,{children:(0,J.jsx)(M,{onClick:()=>{r(!1),t()},children:T()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?m():N(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,J.jsx)(U,{variant:`destructive`,children:l()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(U,{variant:`outline`,children:xe()}):(0,J.jsx)(U,{variant:`outline`,children:o()})}export{$ as ServiceAccountsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,Ca as i,E as a,Ea as o,Gi as s,Hi as c,Ji as l,Ki as u,Qi as d,Sa as f,Sj as p,Ta as m,Ui as h,Wi as g,Xi as _,Yi as v,Zi as y,_a as b,aa as x,ba as S,ca as C,da as w,ea as T,fa as E,ga as D,ha as O,ia as k,la as A,ma as j,na as M,oa as N,pa as P,qi as F,ra as I,sa as L,ta as R,ua as ee,va as z,wa as B,xa as V,xj as H,ya as U}from"./dist-C2CRpdq8.js";import{t as W}from"./button-B39xibrh.js";import{A as G,H as K}from"./index-BygEdn-c.js";import{t as q}from"./DataTableShell-C_uiwnG-.js";var J=t(e(),1),Y=n(),X={hung:()=>A(),wrong_result:()=>C(),error:()=>L(),other:()=>N()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=H(a.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[c,f]=(0,J.useState)(``),[p,m]=(0,J.useState)(!1);async function h(){let t=c.trim();if(!(!t||p)){m(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{m(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,x({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:k()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?M():R()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:T()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:r(),value:c,maxLength:2e3,rows:3,onChange:e=>f(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void h(),disabled:!c.trim()||p,children:p?y():d()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[_({count:t.children.length}),t.childrenTruncated?` ${v()}`:``,t.textTruncated?` ${l()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${F()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:s()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=p(a.subAgentReports.listForAdmin,{}),t=H(a.subAgentReports.readReport),n=H(a.subAgentReports.deleteReport),r=K(),[s,l]=(0,J.useState)(null),[u,d]=(0,J.useState)({});async function _(e){if(s===e._id){l(null);return}if(!u[e._id]){let n=await t({reportId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function v(e){await r({title:g(),description:h(),confirmLabel:c(),destructive:!0})&&(await n({reportId:e._id}),s===e._id&&l(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[B(),` `,(0,Y.jsx)(`strong`,{children:i()}),` `,f()]}),(0,Y.jsx)(q,{title:o(),rows:e,emptyHint:m(),isExpanded:e=>s===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Y.jsx)($,{data:u[e._id]}):null,columns:[{header:V(),cell:e=>G(e.at),sort:e=>e.at},{header:S(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:U(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:z(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${O({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:b(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:j()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:P()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:s===e._id?w():E(),onSelect:()=>void _(e)},{label:ee(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,$k as i,Ak as a,Bi as o,Bk as s,Ck as c,D as l,Dk as u,E as d,Ek as f,Fk as p,GO as m,Gk as h,HO as g,Hk as _,Ik as v,JO as y,Jk as ee,KO as b,Kk as te,Lk as ne,Mk as re,Nk as ie,Ok as ae,Pk as oe,QO as se,Qk as ce,Ri as le,Rk as ue,Sj as x,Sk as de,Tk as fe,UO as pe,Uk as me,Vi as S,Vk as he,WO as ge,Wk as _e,XO as C,Xk as ve,YO as ye,Yk as be,ZO as xe,Zk as Se,_k as Ce,aA as we,ak as Te,bk as Ee,cA as De,ck as w,dj as Oe,dk as ke,eA as T,ek as Ae,fk as je,gk as Me,hk as Ne,iA as Pe,ik as Fe,jk as Ie,kk as Le,lA as Re,lj as ze,lk as Be,mk as Ve,n as He,nA as Ue,nk as We,oA as Ge,ok as Ke,pk as qe,qO as Je,qk as Ye,rA as Xe,rk as Ze,sA as Qe,sk as $e,tA as et,tk as tt,uA as nt,uj as rt,uk as it,vk as at,wk as ot,xj as E,xk as st,yj as ct,yk as lt,zi as ut,zk as dt}from"./dist-C2CRpdq8.js";import{n as D}from"./dist-BB8NhuRg.js";import{t as O}from"./x-BbitkL6D.js";import{t as k}from"./button-B39xibrh.js";import{C as A,Ht as ft,S as j,Vt as M,at as N,b as P,bt as F,ct as I,gt as pt,ht as mt,it as ht,nt as gt,ot as _t,p as L,rt as R,st as z,tt as vt,w as B,x as V}from"./index-BygEdn-c.js";import{t as yt}from"./localePickerView-C2RmOS86.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,t as Tt}from"./card-BV_9rQvt.js";import{a as Et,i as H,n as Dt,o as U,r as W,t as Ot}from"./table-BNCY2kTQ.js";import{t as kt}from"./TimeRangePicker-Ys5YJrFa.js";import{t as At}from"./FilterBar-hVahB9Hp.js";import{t as jt}from"./AdvancedFilter-DvEno3Aq.js";var G=l(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),K=t(e(),1),Mt=.1,Nt=[248,248,248],Pt=[24,24,24];function Ft(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function It(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return It(e,t,n)>=Mt}function Lt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Rt(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var zt=12*1024*1024,Bt=480,Vt=160,Ht=.92;async function Ut(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ke());if(e.size>zt)throw Error(it());let{source:n,width:r,height:i,cleanup:a}=await Wt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Bt/r,Vt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(w());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Ft(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(w());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?Lt(e.data,t.variantFor===`dark`?Nt:Pt):Rt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Ht)??await Y(f,`image/png`);if(!h)throw Error($e());return{blob:h,hasAlpha:m}}finally{a()}}async function Wt(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Be())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Q={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Oe():e===`dark`?rt():ze()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:He(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":S(),title:S(),children:(0,X.jsx)(ft,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=x(d.charts.listMyCharts),r=E(d.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:T(),subtitle:i(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?ce():n.via===`owner`?Se():ve({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()}):null]})}function Qt(){let e=E(d.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1),[m,h]=(0,K.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(u())}}}async function _(){if(s(null),l(!1),t.trim()===``){s(fe());return}let a;try{a=JSON.parse(r)}catch{s(u());return}h(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{h(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:p()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(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:ie()}),(0,X.jsx)(I,{value:t,onChange:e=>n(e.target.value),placeholder:re(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ie()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:a(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),Le(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:ae()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:f()}):null]})]})}function $t({chart:e}){let t=ct(d.charts.setChartLogo),n=E(d.charts.removeChartLogo),[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Ut(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=s(e),n=s(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`?at():Ce()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(G,{className:`size-4`}),t?Ne():Me(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:qe()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ve()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:lt()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:je()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=x(d.me.getMe,{host:F}),n=E(d.charts.addChartDomain),r=E(d.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function f(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function p(t){s(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:Ke()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:We()}):u.map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":tt({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(I,{value:i,onChange:e=>a(e.target.value),placeholder:Fe(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void f(),children:Ze()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Te()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=E(d.charts.updateChart),n=E(d.charts.deleteChart),[i,a]=(0,K.useState)(!1),[s,c]=(0,K.useState)(e.name),[l,f]=(0,K.useState)(()=>tn(e.tokens)),[p,m]=(0,K.useState)(e.tokens.bpm??0),[h,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(!1);function y(){c(e.name),f(tn(e.tokens)),m(e.tokens.bpm??0),g(null),a(!0)}async function ee(){if(e.chartId===void 0)return;g(null);let n;try{n=JSON.parse(l)}catch{g(u());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;p>0?e.bpm=p:delete e.bpm}v(!0);try{await t({chartId:e.chartId,name:s.trim(),tokens:n}),a(!1)}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(C()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:y,children:st()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:Ee()})]})})]}),i?(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:se()}),(0,X.jsx)(I,{value:s,onChange:e=>c(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:o()}),(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:p,onChange:e=>m(Number(e.target.value)),"aria-label":o()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:p===0?ut():`${p} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:le()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:l,onChange:e=>f(e.target.value),rows:10,spellCheck:!1})]}),h?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:h}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:_,onClick:()=>void ee(),children:Ae()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:r()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function rn(){let e=x(d.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ot()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:de()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=E(d.charts.addChartToGroupPool),r=E(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),c=t.filter(e=>!o.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(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)(z,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?he():e.kind===`custom`&&e.scope===`personal`?b():_()}),e.isGlobalDefault?(0,X.jsx)(z,{variant:`default`,children:s()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ue()}),(a??[]).map(e=>(0,X.jsxs)(z,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":v({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(P,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(B,{placeholder:ne()})}),(0,X.jsx)(V,{children:c.map(e=>(0,X.jsx)(j,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:dt()}):null]})]})}function on({chart:e}){let t=E(d.charts.promoteChartToCommon),n=E(d.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(C()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(z,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?m():b()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:ge()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:pe()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=E(d.admin.setDefaultThemeMode),i=E(d.admin.setDefaultLocale),a=E(d.charts.setDefaultChart),o=x(d.charts.listChartsAdmin),s=x(d.groups.listGroups,{}),c=e??`system`,l=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:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(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:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:T()}),pt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:_e()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:nt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:De()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:yt().map(e=>(0,X.jsx)(k,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()})]})]})}function cn(){let e=x(d.me.getMe,{host:F}),t=mt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(Q),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Q)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:we()}),(0,X.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(M,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)($,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{children:`Default`}),(0,X.jsx)(z,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(z,{variant:`outline`,children:`Outline`}),(0,X.jsx)(z,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)($,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(I,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(P,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(B,{placeholder:`Select…`})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(j,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(L,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(At,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(P,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes directions`}),(0,X.jsx)(j,{value:`inbound`,children:`inbound`}),(0,X.jsx)(j,{value:`outbound`,children:`outbound`}),(0,X.jsx)(j,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(P,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(j,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(j,{value:`info`,children:`info`}),(0,X.jsx)(j,{value:`warn`,children:`warn`}),(0,X.jsx)(j,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(jt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(kt,{value:u,onChange:d})]})]})}),(0,X.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(vt,{children:[(0,X.jsx)(_t,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(M,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(ht,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{children:`Edit`}),(0,X.jsx)(R,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(R,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)($,{title:`Card`,children:(0,X.jsxs)(Tt,{className:`w-80`,children:[(0,X.jsxs)(bt,{children:[(0,X.jsx)(Ct,{children:`Instance`}),(0,X.jsx)(wt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(St,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(xt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)($,{title:`Table`,children:(0,X.jsxs)(Ot,{children:[(0,X.jsx)(Et,{children:(0,X.jsxs)(U,{children:[(0,X.jsx)(H,{className:`w-8`,children:(0,X.jsx)(L,{"aria-label":`select all`})}),(0,X.jsx)(H,{children:`Name`}),(0,X.jsx)(H,{children:`Mode`}),(0,X.jsx)(H,{className:`text-right`,children:`Status`}),(0,X.jsx)(H,{className:`w-8`})]})}),(0,X.jsx)(Dt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(U,{children:[(0,X.jsx)(W,{children:(0,X.jsx)(L,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(W,{className:`font-medium`,children:e.n}),(0,X.jsx)(W,{children:(0,X.jsx)(z,{variant:`secondary`,children:e.m})}),(0,X.jsx)(W,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(W,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(M,{})})})]},e.n))})]})}),(0,X.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bn as r,Cm as i,Fn as a,In as o,Ln as s,Rn as c,Sm as l,Vn as u,_m as d,bm as f,fm as p,gm as m,hm as h,mm as g,pm as _,vm as v,wm as y,xm as b,ym as x,zn as S}from"./dist-Bcr-KIFN.js";import{t as C}from"./button-CvJAYeHx.js";import{A as w,Ht as T,St as E,bt as D,jt as O,ot as k,xt as A,yt as j}from"./index--Drh_B6c.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:y(),from:`now-5m`},{label:i(),from:`now-15m`},{label:l(),from:`now-30m`},{label:b(),from:`now-1h`},{label:f(),from:`now-3h`},{label:x(),from:`now-6h`},{label:v(),from:`now-12h`},{label:d(),from:`now-24h`},{label:m(),from:`now-2d`},{label:h(),from:`now-7d`},{label:g(),from:`now-30d`},{label:_(),from:`now-90d`},{label:p(),from:`now-520w`}];function L(e){return w(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,i]=(0,M.useState)(!1),[l,d]=(0,M.useState)(``),f=F(e),[p,m]=(0,M.useState)(()=>z(f.from)),[h,g]=(0,M.useState)(()=>z(f.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),d(``)}i(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),i(!1))}let b=(0,M.useMemo)(()=>{let e=l.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[l]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(A,{open:n,onOpenChange:_,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(j,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:u()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,H.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:c()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(O,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(k,{value:l,onChange:e=>d(e.target.value),placeholder:s(),"aria-label":o()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:a()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bn as r,Cm as i,Em as a,Hn as o,Ln as s,Rn as c,Sm as l,Tm as u,Un as d,Vn as f,_m as p,bm as m,gm as h,hm as g,mm as _,vm as v,wm as y,xm as b,ym as x,zn as S}from"./dist-C2CRpdq8.js";import{t as C}from"./button-B39xibrh.js";import{A as w,Ct as T,Nt as E,St as D,Wt as O,ct as k,wt as A,xt as j}from"./index-BygEdn-c.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:a(),from:`now-5m`},{label:u(),from:`now-15m`},{label:y(),from:`now-30m`},{label:i(),from:`now-1h`},{label:l(),from:`now-3h`},{label:b(),from:`now-6h`},{label:m(),from:`now-12h`},{label:x(),from:`now-24h`},{label:v(),from:`now-2d`},{label:p(),from:`now-7d`},{label:h(),from:`now-30d`},{label:g(),from:`now-90d`},{label:_(),from:`now-520w`}];function L(e){return w(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,i]=(0,M.useState)(!1),[a,l]=(0,M.useState)(``),u=F(e),[p,m]=(0,M.useState)(()=>z(u.from)),[h,g]=(0,M.useState)(()=>z(u.to));function _(t){if(t){let t=F(e);m(z(t.from)),g(z(t.to)),l(``)}i(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),i(!1)}function y(){let e=B(p),n=B(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),i(!1))}let b=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),x=B(p)!==null&&B(h)!==null;return(0,H.jsxs)(T,{open:n,onOpenChange:_,children:[(0,H.jsx)(A,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(O,{}),R(e)]})}),(0,H.jsx)(D,{children:(0,H.jsx)(j,{align:`end`,sideOffset:6,className:`oc-timerange__panel z-50 rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:d()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,H.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,H.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:r()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(E,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(k,{value:a,onChange:e=>l(e.target.value),placeholder:S(),"aria-label":c()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:s()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};