@lacneu/atrium 0.75.2 → 0.76.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 (88) hide show
  1. package/dist/assets/AccessTab-CvennLZY.js +1 -0
  2. package/dist/assets/AdvancedFilter-BhtomjOR.js +1 -0
  3. package/dist/assets/AgentFilesTab-Cxl01-Ai.js +3 -0
  4. package/dist/assets/AnomaliesTab-fdxX14pi.js +1 -0
  5. package/dist/assets/AuditTab-CTbBbxeq.js +1 -0
  6. package/dist/assets/BridgeTab-CZSFpGCy.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-Ds6KJoPI.js +1 -0
  8. package/dist/assets/DataTableShell-Cqy89YR_.js +1 -0
  9. package/dist/assets/{DetailChips-Lo0Kvu7k.js → DetailChips-FjHhAofU.js} +1 -1
  10. package/dist/assets/FeedbacksTab-Dabgccl5.js +1 -0
  11. package/dist/assets/FieldLabel-DK93YUC8.js +1 -0
  12. package/dist/assets/FilesTab-DpdpCRjg.js +1 -0
  13. package/dist/assets/{FilterBar-CnjTuIOw.js → FilterBar-DSMg3ZU9.js} +1 -1
  14. package/dist/assets/GroupsTab-CH8QCy4j.js +1 -0
  15. package/dist/assets/InstancesTab-BN2QEHuC.js +1 -0
  16. package/dist/assets/IntegrationsTab-Cji4AFDZ.js +1 -0
  17. package/dist/assets/KpiTab-Cmz2kQg_.js +1 -0
  18. package/dist/assets/PreferencesTab-CJRl2a1t.js +1 -0
  19. package/dist/assets/{ProjectPage-LzMKBi2V.css → ProjectPage-BXsrYrrF.css} +1 -1
  20. package/dist/assets/ProjectPage-Cj_VBnz0.js +1 -0
  21. package/dist/assets/PromptInjectionsTab-URavZk7V.js +4 -0
  22. package/dist/assets/RolesTab-CFRaPLL_.js +1 -0
  23. package/dist/assets/ScheduledTab-BFUIiyW4.js +1 -0
  24. package/dist/assets/ServiceAccountsTab-CfVem6Qr.js +1 -0
  25. package/dist/assets/SubAgentReportsTab-BKE4z_wO.js +1 -0
  26. package/dist/assets/ThemeShowroom-9TEVKzL5.js +1 -0
  27. package/dist/assets/{TimeRangePicker-DLQwf08l.js → TimeRangePicker-D2DOA7Ue.js} +1 -1
  28. package/dist/assets/TimezoneCombobox-DBZErd9-.js +1 -0
  29. package/dist/assets/TracesTab-D5G56hxo.js +1 -0
  30. package/dist/assets/UsersTab-TYF0NG-e.js +1 -0
  31. package/dist/assets/VoiceTab-BMFyc4v0.js +1 -0
  32. package/dist/assets/{api-CMppRsht.js → api-6pZGS4Dp.js} +5 -5
  33. package/dist/assets/{button-IhgT55aN.js → button-D-5ueVCd.js} +1 -1
  34. package/dist/assets/{card-ClDtGwk1.js → card-BGf8kBDa.js} +1 -1
  35. package/dist/assets/chevrons-up-down-BB83Ko2B.js +1 -0
  36. package/dist/assets/{compatView-ok0H4ab7.js → compatView-CrdwEqYG.js} +1 -1
  37. package/dist/assets/dispatchErrorInfo-CtOA6PvF.js +1 -0
  38. package/dist/assets/{dist-BkRhMuSu.js → dist-BOmZ13fI.js} +1 -1
  39. package/dist/assets/{dist-1Lc_y6Gf.js → dist-D_KJFUY3.js} +1 -1
  40. package/dist/assets/{highlighted-body-OFNGDK62-__Py8DCh.js → highlighted-body-OFNGDK62-DRUUpIgA.js} +1 -1
  41. package/dist/assets/{index-DIPoQZi2.css → index-BeCBdUIg.css} +1 -1
  42. package/dist/assets/index-CGjQ2eS7.js +324 -0
  43. package/dist/assets/{list-B4i6cI-4.js → list-CJW1tnnv.js} +1 -1
  44. package/dist/assets/mermaid-GHXKKRXX-C5fOHsAw.js +1 -0
  45. package/dist/assets/{pdf-CZxpuHbO.js → pdf-DJBOM64C.js} +1 -1
  46. package/dist/assets/roleDescriptions-B5YpxuQ5.js +1 -0
  47. package/dist/assets/{table-E4WVxNnB.js → table-CenHt_bu.js} +1 -1
  48. package/dist/assets/tabs--EBTCh_O.js +1 -0
  49. package/dist/assets/x-C51XT3xK.js +1 -0
  50. package/dist/index.html +7 -10
  51. package/package.json +1 -1
  52. package/dist/assets/AccessTab-DuyiTRVr.js +0 -1
  53. package/dist/assets/AdvancedFilter-BzF0GRUD.js +0 -1
  54. package/dist/assets/AgentFilesTab-BzZ4iNiw.js +0 -3
  55. package/dist/assets/AnomaliesTab-Aksn6eYz.js +0 -1
  56. package/dist/assets/AuditTab-BqKVttX3.js +0 -1
  57. package/dist/assets/BridgeTab-BxMufTiI.js +0 -1
  58. package/dist/assets/ChatDefaultsTab-6xoE3T9G.js +0 -1
  59. package/dist/assets/DataTableShell-BInsTzwk.js +0 -1
  60. package/dist/assets/FeedbacksTab-ZNCSDc3k.js +0 -1
  61. package/dist/assets/FieldLabel-8IB11dM6.js +0 -81
  62. package/dist/assets/FilesTab-B3bm4Kq2.js +0 -1
  63. package/dist/assets/GroupsTab-B-8I0P6D.js +0 -1
  64. package/dist/assets/InstancesTab-DvyrJSBO.js +0 -1
  65. package/dist/assets/IntegrationsTab-DYG99wtP.js +0 -1
  66. package/dist/assets/KpiTab-C1rebj1v.js +0 -1
  67. package/dist/assets/PreferencesTab-mg8QORuA.js +0 -1
  68. package/dist/assets/ProjectPage-CNYuUcd2.js +0 -1
  69. package/dist/assets/PromptInjectionsTab-j_2hboca.js +0 -4
  70. package/dist/assets/RolesTab-CY_nK9vi.js +0 -1
  71. package/dist/assets/ScheduledTab-DCUrDndB.js +0 -1
  72. package/dist/assets/ServiceAccountsTab-BNL5015A.js +0 -1
  73. package/dist/assets/SubAgentReportsTab-B5VH_bLL.js +0 -1
  74. package/dist/assets/ThemeShowroom-CN3wPvKh.js +0 -1
  75. package/dist/assets/TimezoneCombobox-PqzYbV3J.js +0 -1
  76. package/dist/assets/TracesTab-CESxAkKQ.js +0 -1
  77. package/dist/assets/UsersTab-N5fFzUTq.js +0 -1
  78. package/dist/assets/VoiceTab-CfcROoO4.js +0 -1
  79. package/dist/assets/check-7d2-JR5i.js +0 -1
  80. package/dist/assets/chevron-up-Od7h9avP.js +0 -1
  81. package/dist/assets/chevrons-up-down-DJIIcTyy.js +0 -1
  82. package/dist/assets/dispatchErrorInfo-BvZIc7oP.js +0 -1
  83. package/dist/assets/dist-CNchpxsr.js +0 -1
  84. package/dist/assets/index-C3dl90Xw.js +0 -238
  85. package/dist/assets/mermaid-GHXKKRXX-CFE134PH.js +0 -1
  86. package/dist/assets/roleDescriptions-YEECob2A.js +0 -1
  87. package/dist/assets/tabs-BPsz_527.js +0 -1
  88. package/dist/assets/x-CdHbCgxq.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bp as r,Fp as i,Gp as a,Hp as o,Ip as s,Jp as c,Kp as l,Lp as u,Nz as d,Rp as f,Up as p,Vp as m,Wp as h,Yp as g,qp as _,t as v,wz as y,zp as b}from"./api-6pZGS4Dp.js";import{$ as x,Et as S,Q as C,X as w,Z as T,et as E}from"./index-CGjQ2eS7.js";var D=t(e(),1);function O(e){return e===`user`?b():e===`all`?f():u({group:e.group})}function k(e){return e===`common`?s():e===`owner`?i():u({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=d(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),i=d(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}),(0,A.jsxs)(w,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":c(),children:(0,A.jsx)(E,{placeholder:c()})}),(0,A.jsx)(T,{children:(e??[]).map(e=>(0,A.jsx)(C,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):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:l()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:i.user.label}),(0,A.jsx)(S,{variant:`secondary`,children:i.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:a()}),i.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.groups.map(e=>(0,A.jsx)(S,{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:h()}),i.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(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)(S,{variant:`default`,children:r()}):null,(0,A.jsx)(S,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(S,{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:p()}),i.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(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)(S,{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:o()}),i.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:i.permissions.map(e=>(0,A.jsx)(S,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{cg as r,dg as i,fg as a,lg as o,og as s,sg as c,ug as l}from"./api-6pZGS4Dp.js";import{t as u}from"./x-C51XT3xK.js";import{t as d}from"./button-D-5ueVCd.js";import{$ as f,Q as p,Vn as m,X as h,Z as g,et as _,hn as v,jt as y}from"./index-CGjQ2eS7.js";import{r as b}from"./TimeRangePicker-D2DOA7Ue.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)(m,{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)(h,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-40`,children:(0,S.jsx)(_,{placeholder:o()})}),(0,S.jsx)(g,{children:e.map(e=>(0,S.jsx)(p,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(h,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(f,{size:`sm`,className:`w-28`,children:(0,S.jsx)(_,{})}),(0,S.jsx)(g,{children:C.map(e=>(0,S.jsx)(p,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),onClick:()=>P(t.id),children:(0,S.jsx)(u,{})})]},t.id))}),(0,S.jsxs)(d,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(v,{}),s()]})]}):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{$u as r,Aj as i,Az as a,Cd as o,Dd as s,Ed as c,Ez as ee,Fa as l,Ia as u,La as d,Ma as f,Mz as p,Na as m,Nz as h,Pa as g,Qu as _,Ra as v,Sd as y,Td as b,_d as x,_o as S,ad as C,ao as w,bd as T,bo as E,cd as D,co as O,dd as k,df as te,do as A,ed as j,eo as M,fd as N,fo as P,gd as F,go as ne,gt as I,hd as L,ho as R,id as z,io as re,ld as B,lo as V,md as H,mo as U,nd as ie,no as ae,od as W,oo as G,pd as oe,pf as K,po as se,rd as ce,ro as le,sd as ue,so as de,t as q,td as fe,to as pe,ud as me,uo as he,vd as ge,vo as _e,wd as ve,wz as J,xd as ye,yd as be,yo as xe}from"./api-6pZGS4Dp.js";import{t as Y}from"./button-D-5ueVCd.js";import{$ as Se,B as Ce,Ct as we,Dt as Te,Et as Ee,Q as De,St as Oe,Tt as ke,X as Ae,Z as je,at as Me,bt as Ne,et as Pe,ln as Fe,nt as Ie,ot as Le,q as Re,rt as ze,tt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-CGjQ2eS7.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CrdwEqYG.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*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 Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(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<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=h(q.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=h(q.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,l]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&l(r[0].name)},[t,r,i]);let u=h(q.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),d=h(q.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return i===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,u,r,d]),[p,m]=(0,X.useState)(null);(0,X.useEffect)(()=>{!f||f.length===0||(!p||!f.some(e=>$(e)===p))&&m($(f[0]))},[f,p]);let g=f?.find(e=>$(e)===p)??null,_=a(q.agentFiles.listAgentFiles),[v,C]=(0,X.useState)({status:`idle`}),w=g?.instanceName??null,E=g?.agentId??null,D=h(q.compat.forInstance,n&&w!==null?{instanceName:w}:`skip`),O=n&&w!==null?Ce(D,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,A=(0,X.useCallback)(async()=>{if(!(w===null||E===null)){C({status:`loading`});try{C({status:`done`,files:(await _({instanceName:w,agentId:E})).files})}catch(e){C({status:`error`,dashboardAbsent:tt(e)})}}},[_,w,E]);(0,X.useEffect)(()=>{k===!1&&A()},[A,k]);let[j,M]=(0,X.useState)(null),N=h(q.agentFileCuration.listCurations,t&&w!==null&&E!==null?{instanceName:w,agentId:E}:`skip`),P=h(q.agentFileCuration.curationSettings,t&&w!==null?{instanceName:w}:`skip`),z=a(q.agentFileCuration.requestCuration),[re,B]=(0,X.useState)(null),[V,H]=(0,X.useState)(null),{toast:U}=Te(),ie=(0,X.useMemo)(()=>{let e=new Map;for(let t of N??[])e.has(t.name)||e.set(t.name,t);return e},[N]),ae=(0,X.useCallback)(async e=>{if(!(w===null||E===null)){B(e);try{let t=await z({instanceName:w,agentId:E,name:e,trigger:`manual`});t.ok?U({title:S(),variant:`success`}):U({title:ne({reason:t.reason??`unknown`}),variant:`error`})}catch{U({title:R(),variant:`error`})}finally{B(null)}}},[z,w,E,U]),W=ee(),G=(0,X.useMemo)(()=>new Intl.NumberFormat(W,{maximumFractionDigits:0}),[W]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:J()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ae,{value:i??``,onValueChange:e=>l(e),children:[(0,Q.jsx)(Se,{size:`sm`,"aria-label":c(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:(r??[]).map(e=>(0,Q.jsx)(De,{value:e.name,children:e.name},e.name))})]}):null,f.length>0?(0,Q.jsxs)(Ae,{value:p??``,onValueChange:e=>m(e),children:[(0,Q.jsx)(Se,{size:`sm`,"aria-label":b(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:f.map(e=>(0,Q.jsx)(De,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ve()})]}),g===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:J()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Fe,{size:14,"aria-hidden":!0}),` `,qe(O.gatewayVersion,O.provider)]}):v.status===`loading`||v.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:J()}):v.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v.dashboardAbsent?I():y(),` `,!v.dashboardAbsent&&(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:te()})]}):v.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:v.files.map(e=>{let n=Xe(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)(Ee,{variant:`outline`,children:ye()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:T({size:Z(e.size,W)})}),(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:be({pct:G.format(n)})}),r?(0,Q.jsx)(Fe,{size:14,className:`oc-afiles__warn`,"aria-label":ge()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>M(e),children:t?F():L()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:P?.budgetChars??null,enabled:P?.enabled??!1,curation:ie.get(e.name)??null,inFlight:re===e.name,onCurate:()=>void ae(e.name),onReview:e=>H(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:x({used:Z(Qe(v.files),W),total:Z(Ye,W),pct:G.format(Ze(Qe(v.files)))})})]}),j&&g?(0,Q.jsx)(at,{instanceName:g.instanceName,agentId:g.agentId,name:j.name,isAdmin:t,onClose:()=>M(null),onSaved:()=>void A()}):null,V?(0,Q.jsx)(ot,{curationId:V,onClose:()=>H(null),onApplied:()=>{H(null),A()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(Y,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:xe()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ee,{variant:`outline`,className:`oc-afiles__curate-status`,children:_e()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:E()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:o,onClose:s,onSaved:c}){let l=a(q.agentFiles.getAgentFile),u=a(q.agentFiles.setAgentFile),d=Te(),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,v]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),[w,T]=(0,X.useState)(!1),[E,O]=(0,X.useState)(!1),A=(0,X.useCallback)(async r=>{h(!1);try{let i=await l({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||v(i.content),T(!1)}catch{h(!0)}},[l,e,t,n]);(0,X.useEffect)(()=>{A(!1)},[A]);async function M(){if(f!==null){S(!0),O(!1);try{await u({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:f.updatedAtMs??void 0}),d.success(D({name:n})),c(),await A(!1)}catch(e){nt(e)?T(!0):O(!0)}finally{S(!1)}}}let P=f!==null&&g!==f.content,F=(0,X.useMemo)(()=>f===null?null:et(f.content,g),[f,g]),ne=g.length>Je,I=ee(),L=(0,X.useMemo)(()=>new Intl.NumberFormat(I),[I]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&s(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Le,{children:H({name:n})}),(0,Q.jsxs)(ze,{children:[oe({agent:t,instance:e}),o?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,N()]})]})]}),m?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[W(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void A(!1),children:te()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:J()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!o,spellCheck:!1,onChange:e=>v(e.target.value),"aria-label":H({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:k()}),w?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[C(),` `,(0,Q.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>void A(!0),children:z()})]}):null,E?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:ue()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:me({count:L.format(g.length),max:L.format(Je)})}),o?(0,Q.jsx)(Y,{size:`sm`,disabled:!P||x||w,onClick:()=>b(!0),children:x?K():B()}):null]})]}),(0,Q.jsx)(Ve,{open:y,onOpenChange:b,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(ke,{children:ce({name:n})}),(0,Q.jsx)(Oe,{children:ie({agent:t})})]}),F?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:fe({added:F.added,removed:F.removed})}),F.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:j()}),F.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,F.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:r()}),F.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(we,{children:[(0,Q.jsx)(Ne,{children:i()}),(0,Q.jsx)(We,{onClick:()=>void M(),children:_()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=h(q.agentFileCuration.getProposal,{curationId:e}),i=a(q.agentFileCuration.approveCuration),o=p(q.agentFileCuration.rejectCuration),{toast:s}=Te(),[c,_]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(``),C=ee(),T=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function E(){_(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:U(),variant:`success`}),n()):s({title:t.reason===`conflict`?P():A({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:R(),variant:`error`})}finally{_(null)}}async function D(n){_(`reject`);try{let r=x.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?m():se(),variant:`success`}):s({title:O(),variant:`error`}),t()}catch{s({title:R(),variant:`error`})}finally{_(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Ie,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Le,{children:r?he({name:r.name}):J()}),(0,Q.jsx)(ze,{children:V()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:J()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[de({before:Z(r.beforeSize,C),after:Z(r.proposedSize,C)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Fe,{size:13,"aria-hidden":!0}),` `,G()]}):null]}),T?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:w({added:T.added,removed:T.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:f({feedback:r.feedback})}):null,T&&T.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:M()}),(0,Q.jsx)(`ul`,{children:T.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:pe()}),(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:re()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),y?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:v()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:d(),value:x,onChange:e=>S(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`ghost`,onClick:()=>b(!1),disabled:c!==null,children:u()}),(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>void D(!1),disabled:c!==null,children:c===`reject`?K():l()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void D(!0),disabled:c!==null,children:c===`reject`?K():g()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(Y,{variant:`outline`,onClick:()=>b(!0),disabled:c!==null||r==null,children:le()}),(0,Q.jsx)(Y,{variant:`default`,onClick:()=>void E(),disabled:c!==null||r==null,children:c===`approve`?K():ae()})]})]})})}export{rt as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as ee,CC as a,DC as o,EC as te,FC as ne,GC as re,HC as s,IC as ie,JC as ae,KC as oe,LC as se,MC as ce,Mz as le,NC as ue,Nz as c,OC as de,PC as fe,QC as l,RC as pe,SC as me,TC as u,UC as he,VC as ge,WC as d,XC as f,YC as p,ZC as m,_C as _e,aC as h,bC as ve,cC as g,dC as _,fC as ye,gC as be,hC as xe,iC as v,jC as Se,kC as y,lC as b,mC as x,oC as S,pC as C,qC as w,sC as T,t as E,uC as D,vC as O,wC as k,xC as A,yC as j,zC as Ce}from"./api-6pZGS4Dp.js";import{$ as M,Dt as we,Et as N,Gn as Te,Q as P,U as Ee,Wn as F,X as I,Z as L,at as R,ct as z,et as B,i as V,nt as H,o as De,ot as U,q as Oe,tt as W}from"./index-CGjQ2eS7.js";import{n as ke}from"./TimeRangePicker-D2DOA7Ue.js";import{t as Ae}from"./FilterBar-DSMg3ZU9.js";import{t as je}from"./DataTableShell-Cqy89YR_.js";import{t as G}from"./dispatchErrorInfo-CtOA6PvF.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?r():e===`acknowledged`?l():m()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Te({from:`/settings/anomalies`}),t=F({from:`/settings/anomalies`}),n=e.q??``,r=e.status===Y?J:e.status,l=e.severity??J,m=e.kind??J,[h,g]=(0,K.useState)(J),_=V(e.from,e.to),{from:v,to:b}=ke(_),S=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),T=e=>void t({search:t=>({...t,status:e===J?Y:e})}),D=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),R=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),H=e=>void t({search:t=>({...t,...De(e)})}),U=Ee(),W=we(),G=le(E.anomalies.resolveAnomaly),X=(c(E.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=c(E.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:v,to:b,anomalyStatus:r===J?void 0:r,severity:l===J?void 0:l,source:h===J?void 0:h,kind:m===J?void 0:m}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||r!==`open`||l!==J||h!==J||m!==J||_.kind!==`relative`||_.from!==Ie.from;function Ue(){g(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:f(),description:(0,q.jsxs)(q.Fragment,{children:[p(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ae(),` `,(0,q.jsx)(`strong`,{children:w()}),`.`,` `,oe()]}),confirmLabel:re()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(d(),e.kind)}catch(e){W.error(he(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(s(),e.kind)}catch(e){W.error(ge(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,q.jsx)(`strong`,{children:Ce()}),` `,pe(),` `,(0,q.jsx)(`strong`,{children:se()}),` `,ie(),` `,(0,q.jsx)(`strong`,{children:ne()}),` `,fe(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:ue()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:S,searchPlaceholder:ce(),timeRange:_,onTimeRangeChange:H,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:r,onValueChange:T,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(P,{value:J,children:Se()}),Me.map(e=>(0,q.jsx)(P,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:l,onValueChange:D,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:i()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(P,{value:J,children:te()}),Pe.map(e=>(0,q.jsx)(P,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:h,onValueChange:g,children:[(0,q.jsx)(M,{size:`sm`,className:`w-32`,children:(0,q.jsx)(B,{placeholder:u()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(P,{value:J,children:k()}),Fe.map(e=>(0,q.jsx)(P,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:m,onValueChange:R,children:[(0,q.jsx)(M,{size:`sm`,className:`w-36`,children:(0,q.jsx)(B,{placeholder:a()})}),(0,q.jsxs)(L,{children:[(0,q.jsx)(P,{value:J,children:me()}),Q.map(e=>(0,q.jsx)(P,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:A(),rows:Z,emptyHint:r===`open`?ve():j(),rowActions:e=>X&&e.status===`open`?[{label:O(),onSelect:()=>void We(e)},{label:_e(),onSelect:()=>void Ge(e)}]:[],columns:[{header:be(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:z(e.at)}),sort:e=>e.at},{header:a(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:y(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:o({when:z(e.firstAt)}),children:de({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:i(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:xe(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:u(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:x(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:C(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:ye(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(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 Re({row:e}){let t=F();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,_()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,_()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,_()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=c(E.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[D(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(H,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(R,{children:(0,q.jsx)(U,{children:b()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:g()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:T()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:S()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:h()}):(0,q.jsx)(N,{variant:`outline`,children:v()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Ai as i,Gw as a,Jw as o,Kw as s,Mi as c,Ni as l,Nz as u,Pi as d,Qw as f,Ww as p,Xw as m,Yw as h,Zw as g,eT as _,iT as v,ji as y,ki as b,nT as x,qw as S,rT as C,t as w,tT as T}from"./api-6pZGS4Dp.js";import{$ as E,Gn as D,Q as O,Wn as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-CGjQ2eS7.js";import{n as ee}from"./TimeRangePicker-D2DOA7Ue.js";import{t as z}from"./FilterBar-DSMg3ZU9.js";import{t as B}from"./AdvancedFilter-BhtomjOR.js";import{t as V}from"./DataTableShell-Cqy89YR_.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:d()},{value:`realLabel`,label:l()},{value:`targetLabel`,label:c()},{value:`impersonated`,label:y()},{value:`resource`,label:i()},{value:`resourceId`,label:b()}];function q(){let e=D({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,i=e.action??G,c=e.impersonated??G,l=e.resource??G,d=F(e.from,e.to),y=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:b,to:I}=ee(d),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,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=u(w.admin.listAudit,{filter:{q:n||void 0,from:b,to:I,action:i===G?void 0:i,resource:l===G?void 0:l,impersonated:c===G?void 0:c===`yes`,advanced:y.length>0?y: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!==``||i!==G||c!==G||l!==G||y.length>0||d.kind!==`relative`||d.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:[v(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:C()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:x(),timeRange:d,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:T()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(O,{value:G,children:_()}),te.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:c,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(O,{value:G,children:r()}),(0,U.jsx)(O,{value:`yes`,children:f()}),(0,U.jsx)(O,{value:`no`,children:g()})]})]}),(0,U.jsxs)(A,{value:l,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:m()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(O,{value:G,children:h()}),ne.map(e=>(0,U.jsx)(O,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:y,onChange:Q}),(0,U.jsx)(V,{title:o(),rows:$,emptyHint:S(),columns:[{header:s(),cell:e=>N(e.at),sort:e=>e.at},{header:T(),cell:e=>e.action,sort:e=>e.action},{header:a(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:p(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:m(),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{$b as r,$r as i,$y as a,Au as o,Ay as s,Az as c,Bu as l,By as u,Cb as d,D as f,Dy as p,Ey as m,Fu as h,Fy as g,Gy as _,Hy as v,Iu as y,Iy as ee,Jy as te,Kb as ne,Ky as re,Lu as ie,Ly as ae,Mu as oe,My as se,Mz as ce,Nu as le,Ny as ue,Nz as b,Oy as de,Pu as fe,Py as pe,Qb as me,Qr as he,Qy as ge,Ru as _e,Ry as ve,Sb as ye,Tu as be,Uy as xe,Vu as Se,Vy as Ce,Wy as we,Xb as Te,Xy as Ee,Yy as De,Zb as Oe,Zr as ke,Zy as Ae,_b as je,_t as Me,ab as Ne,ax as Pe,bb as Fe,cb as Ie,db as Le,eb as Re,ei as ze,ex as Be,fb as Ve,gb as He,hb as Ue,ib as We,ii as Ge,ju as Ke,jy as qe,ku as Je,ky as Ye,lb as Xe,mb as Ze,nb as Qe,nx as $e,ob as et,ox as tt,pb as nt,qb as rt,qy as it,rb as at,rx as ot,sb as st,t as x,tb as S,ti as ct,tx as lt,ub as ut,vb as dt,wb as ft,xb as pt,yb as mt,zu as ht,zy as gt}from"./api-6pZGS4Dp.js";import{t as _t}from"./chevrons-up-down-BB83Ko2B.js";import{i as vt,n as C,o as yt,r as bt,s as xt}from"./FieldLabel-DK93YUC8.js";import{i as St,n as Ct,r as wt,t as Tt}from"./tabs--EBTCh_O.js";import{t as Et}from"./button-D-5ueVCd.js";import{$ as w,Bt as Dt,Dt as Ot,En as kt,Et as T,F as At,Gn as jt,Ln as E,Q as D,Rn as Mt,Rt as Nt,Vn as O,Wn as Pt,X as k,Z as A,at as Ft,ct as It,et as j,fn as M,jt as N,ln as P,lt as F,nt as Lt,ot as Rt,q as zt,rt as Bt,tt as Vt,ut as Ht,zn as I,zt as Ut}from"./index-CGjQ2eS7.js";import{r as Wt}from"./locales-CPjguROj.js";import{a as L,i as R,n as z,o as B,r as V,t as H}from"./table-CenHt_bu.js";import{t as Gt}from"./FilterBar-DSMg3ZU9.js";import{a as U,n as Kt,o as W,r as qt,s as Jt,t as Yt}from"./compatView-CrdwEqYG.js";import{t as G}from"./dispatchErrorInfo-CtOA6PvF.js";var Xt=f(`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`}]]),Zt=f(`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`}]]),K=t(e(),1);function Qt(e){return e.filter(e=>e.state===`error`)}function $t(e){return e.reachable&&Qt(e.targets).length===0}function en(e){return $t(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function tn(e){return e.state===`error`&&e.lastErrorCode!==null}function nn(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function rn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function an(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,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return rn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,on={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(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 ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(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 W(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(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 pn(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 mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>W(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(on),[i,a]=(0,K.useState)(null),o=(0,K.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+(e.downstreamRejectCount??0),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]),c=(0,K.useMemo)(()=>fn(o),[o]),l=(0,K.useMemo)(()=>pn(o),[o]),d=(0,K.useMemo)(()=>mn(o),[o]),f=(0,K.useMemo)(()=>dn(cn(o,n),i),[o,n,i]);function p(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ce(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(k,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:gt()})}),(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{value:Y,children:u()}),c.map(e=>(0,Q.jsx)(D,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(k,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(j,{placeholder:ve()})}),(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{value:Y,children:u()}),l.map(e=>(0,Q.jsx)(D,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(k,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(j,{placeholder:ae()})}),(0,Q.jsxs)(A,{children:[(0,Q.jsx)(D,{value:Y,children:u()}),d.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))]})]})]}),f.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):(0,Q.jsxs)(H,{className:`oc-conn__table`,children:[(0,Q.jsx)(L,{children:(0,Q.jsxs)(B,{children:[(0,Q.jsx)($,{label:g(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:pe(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:ue(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:se(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:qe(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(R,{children:s()}),(0,Q.jsx)($,{label:Ye(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(z,{children:f.map(e=>(0,Q.jsx)(gn,{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)(R,{"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)(Mt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(_t,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=tn(e)?G(e.lastErrorCode):null,n=nn(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(B,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(V,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(V,{children:(0,Q.jsx)(vn,{state:e.state})}),(0,Q.jsx)(V,{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)(V,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(V,{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)(V,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:xe({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(V,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(B,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(V,{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?` · ${F(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:[v({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?de():e===`error`?p():m()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(T,{variant:`secondary`,children:de()}):e===`error`?(0,Q.jsx)(T,{variant:`destructive`,children:p()}):(0,Q.jsx)(T,{variant:`outline`,children:m()})}function yn(){return b(x.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=b(x.compat.getBridgeCompat,{}),n=b(x.me.getMe,{host:zt})?.role===`admin`,r=b(x.admin.listInstances,n?{}:`skip`),a=b(x.agents.usageForInstances,n?{}:`skip`),o=Pt(),s=()=>void o({to:`/settings/anomalies`,search:{status:`open`}}),c=an(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=jt({from:`/settings/bridge`}),u=Pt({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,p=d!==null&&Kt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:s}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ut()}),a&&a.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Xe()}),(0,Q.jsxs)(H,{children:[(0,Q.jsx)(L,{children:(0,Q.jsxs)(B,{children:[(0,Q.jsx)(R,{children:ct()}),(0,Q.jsx)(R,{children:ze()}),(0,Q.jsx)(R,{children:i()}),(0,Q.jsx)(R,{children:he()}),(0,Q.jsx)(R,{children:ke()})]})}),(0,Q.jsx)(z,{children:a.flatMap(e=>{let t=At(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(B,{children:[(0,Q.jsx)(V,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(V,{children:t.provider}),(0,Q.jsx)(V,{children:t.label}),(0,Q.jsx)(V,{children:(0,Q.jsxs)(T,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(V,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Q.jsxs)(Tt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(wt,{className:`w-full`,children:c.map(e=>(0,Q.jsxs)(St,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(M,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),c.map(e=>(0,Q.jsx)(Ct,{value:e.key,children:(0,Q.jsx)(Sn,{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,p?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null]})}function xn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:U(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ht(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,_e({build:t.buildVersion??`?`})]}):null,` · `,ie(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?y():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:Re()});let s=Qt(e.targets),c=!e.reachable,l=en(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=It(e.checkedAt),p=e.startedAt==null?null:It(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:l===`ok`?(0,Q.jsx)(E,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(P,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?a():l===`gateways_unreachable`?De({count:u.length}):c?ge():Ae({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Xt,{size:12,"aria-hidden":!0}),` `,Ee({time:f})]}),p?(0,Q.jsx)(`span`,{children:it({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:te({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:re()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Jt(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:Yt(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,K.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)(M,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(T,{variant:f===`beyond`?`destructive`:`secondary`,children:qt(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Se()}),(0,Q.jsx)(wn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(Cn,{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)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),_({count:t.length})]}),p?(0,Q.jsx)(hn,{connections:t,displayByInstance:c}):null]})}function Cn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ie(),i.length>0?(0,Q.jsx)(T,{variant:`destructive`,children:et({count:i.length})}):a>0?(0,Q.jsx)(T,{variant:`destructive`,children:Ne()}):(0,Q.jsx)(T,{variant:`secondary`,children:st()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[We({version:e.vendoredVersion}),r?` · `+at({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Me({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):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)(O,{size:13,"aria-hidden":!0}):(0,Q.jsx)(I,{size:13,"aria-hidden":!0}),Qe({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 wn({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:l()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Ge({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:le({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:y()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):(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:U(e.version)}),(0,Q.jsx)(T,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Vt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Lt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(Ft,{children:[(0,Q.jsx)(Rt,{children:tt({instance:e.displayName??e.name})}),(0,Q.jsx)(Bt,{children:Pe()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({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)(E,{"aria-hidden":!0}):(0,Q.jsx)(P,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Ze():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,nt()]}):null}function Dn({instance:e,onClose:t}){let n=ce(x.admin.upsertInstanceConfig),i=c(x.bridge.validateMediaPaths),a=Ot(),o=Wt(e.config?.contentLocale,void 0),[s,l]=(0,K.useState)(()=>vt(e.config??{},o)),[u,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function ee(){m(!0),g(null);try{g(await i({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(dt(),e)}finally{m(!1)}}async function te(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:bt(s,r,o)}),t()}catch(e){a.error(me(),e)}finally{f(!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)(C,{label:ot(),help:Oe()}),(0,Q.jsxs)(k,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(A,{children:xt.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:$e(),help:Te()}),(0,Q.jsxs)(k,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(w,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(j,{})}),(0,Q.jsx)(A,{children:yt.map(e=>(0,Q.jsx)(D,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:lt(),help:rt()}),(0,Q.jsx)(N,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:ft(),help:d()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(C,{label:ye(),help:pt()}),(0,Q.jsx)(N,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Ht,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(C,{label:Be(),help:ne()})]}),y&&h!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(P,{"aria-hidden":!0}),Le({reason:h.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:He(),result:h.inbound}),(0,Q.jsx)(En,{label:Ue(),result:h.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:je()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(P,{"aria-hidden":!0}),Ve()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Q.jsxs)(Et,{variant:`outline`,size:`sm`,onClick:()=>void ee(),disabled:p,children:[p?(0,Q.jsx)(kt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?mt():Fe()]}),(0,Q.jsx)(Et,{size:`sm`,onClick:()=>void te(),disabled:u,children:r()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Nt,{children:[(0,Q.jsx)(Dt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?oe():Ke({count:e.length}),(0,Q.jsx)(O,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ut,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:o()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(T,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Az as r,Ed as i,Gu as a,Hu as o,Ju as s,Ku as c,Mz as l,Nz as u,Uu as d,Wu as f,Xu as p,Yu as m,_s as h,bs as g,df as _,ds as v,fs as y,gs as b,hs as x,ix as S,ms as C,of as w,pf as T,ps as E,qu as D,ri as O,sf as k,t as A,vs as j,wz as M,ys as N}from"./api-6pZGS4Dp.js";import{t as P}from"./button-D-5ueVCd.js";import{$ as F,B as I,M as L,N as R,Q as z,X as B,Z as V,et as H,jt as U,ln as W,ut as G}from"./index-CGjQ2eS7.js";import{i as K}from"./compatView-CrdwEqYG.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(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 X=n();function Z({instance:e}){let t=l(A.admin.upsertInstanceConfig),n=u(A.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),c(`idle`)},[e._id,r]);let p=`__none__`,m=i!==r;async function g(){c(`saving`);try{let n={...e.config??{}};i===``||i===p?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let _=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:h()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:b()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(B,{value:i===``?p:i,onValueChange:e=>a(e===p?``:e),children:[(0,X.jsx)(F,{className:`oc-cdefaults__select`,"aria-label":h(),children:(0,X.jsx)(H,{placeholder:x()})}),(0,X.jsxs)(V,{children:[(0,X.jsx)(z,{value:p,children:x()}),_.map(e=>(0,X.jsx)(z,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!m||s===`saving`,onClick:()=>void g(),children:s===`saving`?T():f()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null]})}function Q({instance:e}){let t=l(A.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[s,c]=(0,q.useState)(r===null?``:String(r)),[u,p]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),c(r===null?``:String(r)),p(`idle`)},[e._id,n,r]);let m=s.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,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(G,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":j()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":C(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?T():f()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function $({instance:e}){let t=l(A.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,s]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),s(`idle`)},[e._id,n]);let c=r.trim(),u=c===``?null:/^\d+$/.test(c)?Number.parseInt(c,10):NaN,p=u===null||Number.isInteger(u)&&u>=1e3&&u<=2e5,m=(u??null)!==n;async function h(){s(`saving`);try{let n={...e.config??{}};u===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=u,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(U,{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,X.jsx)(P,{size:`sm`,disabled:!m||!p||a===`saving`,onClick:()=>void h(),children:a===`saving`?T():f()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:v()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:d()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:o()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:N()})]})}function ee(){let e=r(A.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),o=u(A.admin.listInstances,{}),[l,d]=(0,q.useState)(null);(0,q.useEffect)(()=>{!o||o.length===0||(!l||!o.some(e=>e.name===l))&&d(o[0].name)},[o,l]);let f=(o?.length??0)>1,h=o!==void 0&&o.length===0,g=u(A.compat.forInstance,l?{instanceName:l}:`skip`),v=l?I(g,`configDefaults`):`loading`,y=v===`loading`?null:v.blocked,b=(0,q.useMemo)(()=>f&&l?{instanceName:l}:{},[f,l]),x=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++x.current;n({status:`loading`});try{let r=Y(await e(b));if(x.current!==t)return;n({status:`done`,current:r})}catch{if(x.current!==t)return;n({status:`error`})}},[e,b]);(0,q.useEffect)(()=>{y===!1&&(f&&!l||C())},[C,y,f,l]);let T=t.status===`done`?t.current:null,E=(0,q.useMemo)(()=>J.map(e=>({id:e,label:R(e)})),[]),j=(0,q.useMemo)(()=>[{id:`fast`,label:k()},{id:`standard`,label:w()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),f&&l?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,X.jsxs)(B,{value:l,onValueChange:e=>d(e),children:[(0,X.jsx)(F,{size:`sm`,"aria-label":i(),children:(0,X.jsx)(H,{})}),(0,X.jsx)(V,{children:(o??[]).map(e=>(0,X.jsx)(z,{value:e.name,children:e.name},e.name))})]})]}):null,h?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):v===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):v.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(W,{size:14,"aria-hidden":!0}),` `,K(v.gatewayVersion,v.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[a(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:_()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()}),(0,X.jsx)(L,{options:E,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,X.jsx)(L,{options:j,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:c()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:O()})]}),(()=>{let e=o?.find(e=>e.name===(l??o[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ch as r,Sh as i,bh as a,vh as o,wh as s,xh as c,yh as l}from"./api-6pZGS4Dp.js";import{t as u}from"./chevrons-up-down-BB83Ko2B.js";import{t as d}from"./button-D-5ueVCd.js";import{It as f,Lt as p,Mt as m,Nn as h,Nt as g,Pt as _,Rn as v,Vn as y,hn as b,un as x,ut as S}from"./index-CGjQ2eS7.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-CenHt_bu.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)(d,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...z]),B(new Set)},children:[e.variant===`destructive`?(0,M.jsx)(x,{}):null,e.label,` (`,z.size,`)`]},e.label)):null,N?(0,M.jsxs)(d,{size:`sm`,onClick:N,children:[(0,M.jsx)(b,{}),` `,P]}):null]})]}),t===void 0?(0,M.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):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)(S,{"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":o({column:e.header}),children:[e.header,n?V.dir===`asc`?(0,M.jsx)(v,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(y,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,M.jsx)(u,{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)(S,{"aria-label":a(),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)(m,{children:[(0,M.jsx)(p,{asChild:!0,children:(0,M.jsx)(d,{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)(h,{})})}),(0,M.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,M.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,M.jsx)(f,{}):null,(0,M.jsx)(_,{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{Et as t}from"./index-C3dl90Xw.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{Et as t}from"./index-CGjQ2eS7.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{$D as r,AD as i,BD as a,CD as o,CO as s,DD as c,ED as l,Eo as u,FD as d,GD as f,HD as p,ID as m,JD as h,KD as g,LD as ee,MD as te,Mz as _,ND as v,Nz as ne,OD as y,PD as re,QD as b,RD as ie,SD as ae,SO as x,TD as S,UD as C,VD as w,WD as T,XD as E,YD as D,ZD as O,_O as k,aO as A,bO as j,cO as M,dO as N,eO as P,fO as F,gO as I,hO as L,iO as R,jD as z,kD as B,lO as V,mO as H,nO as U,oO as W,pO as oe,qD as G,rO as K,sO as q,t as J,tO as se,uO as ce,vO as le,wD as ue,wO as de,wo as fe,xO as pe,yO as me,zD as he}from"./api-6pZGS4Dp.js";import{t as ge}from"./button-D-5ueVCd.js";import{U as _e,ct as Y}from"./index-CGjQ2eS7.js";import{t as ve}from"./DataTableShell-Cqy89YR_.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>de(),incorrect:()=>s(),incoherence:()=>x(),formatting:()=>pe(),latency:()=>j(),api_error:()=>me(),other:()=>le()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:I()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:L()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=_(J.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[d,f]=(0,X.useState)(!1);async function m(){let t=c.trim();if(!(!t||d)){f(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{f(!1)}}}let g=[];try{g=i.contextJson?JSON.parse(i.contextJson):[]}catch{g=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${H()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:p(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),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`?N():e.authorRole===`agent`?e.authorLabel??u():ce()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:V()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:M(),value:c,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void m(),disabled:!c.trim()||d,children:d?q():W()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||R()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(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:i.displayedText||R()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,g.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:se({count:i.contextCount??g.length,truncated:i.contextTruncated?P():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:g.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,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:b()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.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:O()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?E({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[D(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,h()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=ne(J.feedback.listForAdmin,{}),t=_(J.feedback.readSnapshot),n=_(J.feedback.deleteFeedback),r=_e(),[s,u]=(0,X.useState)(null),[p,h]=(0,X.useState)({});async function y(e){if(s===e._id){u(null);return}if(!p[e._id]){let n=await t({feedbackId:e._id});h(t=>({...t,[e._id]:n}))}u(e._id)}async function b(e){await r({title:ue(),description:o(),confirmLabel:ae(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&u(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[G(),` `,(0,Z.jsx)(`strong`,{children:g()}),` `,f()]}),(0,Z.jsx)(ve,{title:T(),rows:e,emptyHint:C(),isExpanded:e=>s===e._id&&!!p[e._id],renderExpanded:e=>p[e._id]?(0,Z.jsx)(be,{data:p[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:w(),cell:e=>Y(e.at),sort:e=>e.at},{header:a(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:he(),cell:e=>e.messageRole===`user`?ie():ee(),sort:e=>e.messageRole},{header:m(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${d({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:re(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:v(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:te(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:z()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:i()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:fe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:B()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:s===e._id?c():l(),onSelect:()=>void y(e)},{label:S(),onSelect:()=>void b(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -0,0 +1 @@
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{Bz as t,D as n}from"./api-6pZGS4Dp.js";import{I as r,L as i,R as a,Xt as o,Yt as s,z as c}from"./index-CGjQ2eS7.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var l=n(`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`}]]),u=[`gateway-http`,`shared-fs`,`off`],d=[`inline`,`shared-fs`],f=[`reactive`,`sse`],p=`reactive`;t.object({mediaMode:t.optional(t.union(t.literal(`gateway-http`),t.literal(`shared-fs`),t.literal(`off`))),inboundMediaMode:t.optional(t.union(t.literal(`inline`),t.literal(`shared-fs`))),rehydration:t.optional(t.boolean()),mediaMaxMb:t.optional(t.number()),summarizeThresholdChars:t.optional(t.number()),curationEnabled:t.optional(t.boolean()),curationBudgetChars:t.optional(t.number()),converterAgentId:t.optional(t.string()),voiceEnabled:t.optional(t.boolean()),talkEnabled:t.optional(t.boolean()),voiceEngine:t.optional(t.union(t.literal(`browser`),t.literal(`gateway`))),voiceLang:t.optional(t.string()),voiceRate:t.optional(t.number()),voiceAutoRead:t.optional(t.boolean()),contentLocale:t.optional(t.string()),inboundAgentMount:t.optional(t.string()),outboundAgentMount:t.optional(t.string()),promptInjections:t.optional(t.record(t.string(),t.object({enabled:t.optional(t.boolean()),template:t.optional(t.string())})))});var m={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function h(e,t){let n={};for(let r of o){let i=e?.[r];n[r]={enabled:i?.enabled??!0,template:typeof i?.template==`string`&&i.template.length>0?i.template:s[r].defaultTemplate[t]}}return n}function g(e,t){let n={};for(let r of o){let i=s[r],a=e[r];if(!a)continue;let o={};i.togglable&&a.enabled===!1&&(o.enabled=!1);let c=a.template.trim();c.length>0&&c!==i.defaultTemplate[t]&&(o.template=c),(o.enabled!==void 0||o.template!==void 0)&&(n[r]=o)}return n}function _(e,t){return{mediaMode:e.mediaMode??m.mediaMode,inboundMediaMode:e.inboundMediaMode??m.inboundMediaMode,rehydration:e.rehydration??m.rehydration,mediaMaxMb:e.mediaMaxMb??m.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??m.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??m.outboundAgentMount,promptInjections:h(e.promptInjections,t)}}var v=[`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`];function y(e,t,n){let r={},i=n=>{(e[n]!==m[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=g(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of v){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var b=e();function x({text:e}){return(0,b.jsx)(a,{delayDuration:150,children:(0,b.jsxs)(r,{children:[(0,b.jsx)(c,{asChild:!0,children:(0,b.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,b.jsx)(l,{"aria-hidden":!0})})}),(0,b.jsx)(i,{className:`max-w-xs text-pretty`,children:e})]})})}function S({label:e,help:t}){return(0,b.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,b.jsx)(x,{text:t})]})}export{p as a,f as c,_ as i,S as n,d as o,y as r,u as s,x as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AR as r,Aj as ee,Ao as i,BR as a,CR as te,DR as ne,ER as re,Ez as ie,FR as ae,GR as oe,HR as o,IR as s,LR as c,MR as l,Mz as u,NR as d,Nz as se,OR as f,PR as p,RR as ce,SR as le,TR as ue,UR as de,VR as m,WR as fe,_R as pe,bR as me,dR as he,fR as ge,gR as _e,hR as ve,jR as h,kR as g,ko as ye,mR as be,pR as xe,t as _,uR as v,vR as y,wR as b,wz as x,xR as S,yR as C,zR as w}from"./api-6pZGS4Dp.js";import{t as T}from"./button-D-5ueVCd.js";import{$ as E,Ct as D,Dt as O,Et as k,Lt as A,Mt as j,Nn as M,Nt as Se,Pn as N,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,et as R,mn as Ee,un as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-CGjQ2eS7.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CenHt_bu.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return p();case`audio`:return d();case`video`:return l();case`pdf`:return h();case`document`:return r();case`archive`:return g();default:return f()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[l,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[h,g]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=u(_.files.softDelete),Y=O();function Ie(){t(W),r(W),d(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(pe())}catch(e){Y.error(_e(),e)}}let X=se(_.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:l===W?void 0:l,category:f===W?void 0:f,includeAutoGenerated:h||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ie(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:x()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||l!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(E,{size:`sm`,"aria-label":fe(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:de()}),(0,U.jsx)(F,{value:`inbound`,children:o()}),(0,U.jsx)(F,{value:`outbound`,children:m()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:r,children:[(0,U.jsx)(E,{size:`sm`,"aria-label":a(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:w()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:l,onValueChange:d,children:[(0,U.jsx)(E,{size:`sm`,"aria-label":ce(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:c()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:f,onValueChange:p,children:[(0,U.jsx)(E,{size:`sm`,"aria-label":s(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ae()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:h,onCheckedChange:e=>g(e===!0),"aria-label":i()}),(0,U.jsx)(`span`,{children:i()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Ee,{size:14,"aria-hidden":!0}),me()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?he():ge()}):(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:ne()}),(0,U.jsx)(z,{children:re()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{children:b()}),(0,U.jsx)(z,{children:te()}),(0,U.jsx)(z,{className:`text-right`,children:le()})]})}),(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)(k,{variant:`outline`,style:{marginLeft:6},children:ye()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(k,{variant:`secondary`,children:e.direction===`inbound`?o():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)(j,{children:[(0,U.jsx)(A,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":C(),children:(0,U.jsx)(M,{size:16})})}),(0,U.jsxs)(Se,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(N,{size:14}),S()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(N,{size:14}),xe()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(De,{size:14}),y()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:v({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:ve()}),(0,U.jsx)(Ce,{children:be()})]}),(0,U.jsxs)(D,{children:[(0,U.jsx)(Te,{children:ee()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:y()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{_h as r,vh as i}from"./api-CMppRsht.js";import{t as a}from"./button-IhgT55aN.js";import{cn as o,jt as s,ln as c}from"./index-C3dl90Xw.js";import{t as l}from"./TimeRangePicker-DLQwf08l.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)(o,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(s,{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)(c,{}),r()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Eh as r,Th as i}from"./api-6pZGS4Dp.js";import{t as a}from"./button-D-5ueVCd.js";import{jt as o,mn as s,pn as c}from"./index-CGjQ2eS7.js";import{t as l}from"./TimeRangePicker-D2DOA7Ue.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)(c,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(o,{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{$f as r,Af as i,Ap as a,Bf as o,Cp as s,D as c,Df as l,Dp as u,Ef as d,Ep as f,Ff as p,Gf as m,Hf as h,If as g,Jf as _,Kf as v,Lf as y,Mf as b,Mp as x,Mz as S,Nf as C,Np as w,Nz as T,Of as E,Op as D,Pf as O,Pp as k,Qf as ee,Rf as A,Sp as te,Tf as j,Tp as M,Uf as N,Vf as ne,Wf as re,Xf as P,Yf as ie,Zf as F,_p as ae,ap as I,bp as L,cp as oe,dp as se,ep as ce,fp as le,gp as ue,hp as de,ip as fe,jf as pe,jp as me,kf as R,kp as he,lp as ge,mp as _e,np as ve,op as ye,pp as be,qf as xe,rp as Se,sp as Ce,t as z,tp as we,up as Te,vp as Ee,wp as De,xp as Oe,yp as ke,zf as Ae}from"./api-6pZGS4Dp.js";import{t as je}from"./x-C51XT3xK.js";import{i as B,n as V,r as Me,t as Ne}from"./tabs--EBTCh_O.js";import{t as H}from"./button-D-5ueVCd.js";import{$ as Pe,Bn as Fe,Dt as U,Et as W,Q as Ie,U as Le,X as Re,Z as ze,_ as Be,at as Ve,dn as G,et as He,fn as K,jt as q,nt as Ue,ot as We,q as Ge,rt as Ke,tt as qe,ut as J,zn as Je}from"./index-CGjQ2eS7.js";import{t as Ye}from"./FilterBar-DSMg3ZU9.js";import{t as Xe}from"./DataTableShell-Cqy89YR_.js";import{t as Y}from"./DetailChips-FjHhAofU.js";var Ze=c(`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=c(`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=c(`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 we();case`user`:return ce();case`pending`:return r();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=T(z.groups.listGroups,{}),t=T(z.me.getMe,{host:Ge})?.role===`admin`,n=S(z.groups.createGroup),r=S(z.groups.updateGroup),i=S(z.groups.deleteGroup),o=Le(),c=U(),[d,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)($),[v,y]=(0,Z.useState)(null),[b,C]=(0,Z.useState)(``),O=(0,Z.useMemo)(()=>{if(!e)return e;let t=b.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,b]);function ee(){h(null),_($),p(!0)}function A(e){h(e),_({name:e.name,description:e.description??``}),p(!0)}async function j(){try{m?await r({groupId:m._id,name:g.name,description:g.description}):await n({name:g.name,description:g.description||void 0}),_($),h(null),p(!1)}catch(e){c.error(E(),e)}}async function N(e){if(await o({title:de({name:e.name}),description:_e(),confirmWord:e.name,confirmLabel:be(),cancelLabel:Oe(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(l(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}),(0,Q.jsx)(Ye,{q:b,onQChange:C,onReset:()=>C(``),canReset:b!==``,searchPlaceholder:f()}),(0,Q.jsx)(Xe,{title:k(),rows:O,addLabel:x(),onAdd:t?ee:void 0,emptyHint:me(),columns:[{header:a(),cell:e=>e.name,sort:e=>e.name},{header:he(),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:D(),cell:e=>(0,Q.jsx)(Y,{icon:(0,Q.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:u(),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)(G,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:M(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:De(),onSelect:()=>A(e)},{label:s(),variant:`destructive`,onSelect:()=>void N(e)}]:[]]}),(0,Q.jsx)(Be,{open:d,onOpenChange:p,title:m?ke():L(),description:Ee(),canSubmit:!!g.name.trim(),onSubmit:j,submitLabel:te(),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:ae()}),(0,Q.jsx)(q,{value:g.name,onChange:e=>_({...g,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:ue()}),(0,Q.jsx)(q,{value:g.description,onChange:e=>_({...g,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(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)(Fe,{size:14,"aria-hidden":!0}),fe()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ve({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:[Se(),(0,Q.jsx)(Je,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let a=T(z.groups.getGroup,n&&e?{groupId:e}:`skip`),o=T(z.groups.listAssignableInstances,n?{}:`skip`),s=T(z.groups.listAssignableUsers,n?{}:`skip`),c=S(z.groups.addMember),l=S(z.groups.removeMember),u=S(z.groups.bulkSetMembers),f=S(z.groups.setGroupManager),p=U(),[m,h]=(0,Z.useState)(``),[g,v]=(0,Z.useState)(``),[y,x]=(0,Z.useState)(`members`),[w,E]=(0,Z.useState)(1),[D,O]=(0,Z.useState)(new Set),k=(0,Z.useRef)(null),A=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),te=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),j=a?.viewerIsAdmin===!0,M=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{h(``),v(``),x(`members`),E(1),k.current=null},[n,e]),(0,Z.useEffect)(()=>{E(1)},[m]),(0,Z.useEffect)(()=>{n&&a&&e&&k.current!==e&&(k.current=e,O(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let N=(0,Z.useMemo)(()=>s?$e(s,m,D):[],[s,m,D]);async function re(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(d(),e)}}async function ie(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(i(),e)}}let F=rt(N,e=>A.has(e.userId)),ae=N.filter(e=>A.has(e.userId)).length,L=it(N,w,ot);async function ce(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await u({groupId:e,userIds:t,member:F!==`all`})}catch(e){p.error(d(),e)}}return(0,Q.jsx)(qe,{open:n,onOpenChange:r,children:(0,Q.jsxs)(Ue,{className:`oc-access`,children:[(0,Q.jsxs)(Ve,{children:[(0,Q.jsx)(We,{children:le({name:t})}),(0,Q.jsx)(Ke,{children:se()})]}),(0,Q.jsxs)(Ne,{value:y,onValueChange:x,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}),Te(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(B,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),oe(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,Q.jsxs)(B,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ze,{size:13,"aria-hidden":!0}),ne(),a?(0,Q.jsx)(W,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(V,{value:`members`,children:s===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):s.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:m,onChange:e=>h(e.target.value),placeholder:ge(),className:`oc-access__search`}),N.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ye()}):(0,Q.jsxs)(Q.Fragment,{children:[N.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:F===`all`?!0:F===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Q.jsxs)(W,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,N.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=A.has(e.userId),n=tt(e),r=te.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":ee({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)(W,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&j?(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?pe():b(),title:r?pe():b(),onClick:()=>void ie(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":C(),title:C(),children:(0,Q.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:E})]})]})}),(0,Q.jsx)(V,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:g,onChange:e=>v(e.target.value),placeholder:Ce(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,query:g},`${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:i}){let a=T(z.groups.listAssignableAgents,{instanceName:t}),o=S(z.groups.assignAgentToGroup),s=S(z.groups.removeAgentFromGroup),c=S(z.groups.bulkSetGroupAgents),l=U(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let f=et(a?.agents??[],i),p=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let g=f.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),_=rt(g,e=>r.has(`${t}/${e.agentId}`)),y=it(f,u,ot);async function b(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(j(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:_!==`all`})}catch(e){l.error(j(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__kind`,children:n}),p?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__stale`,children:re()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):f.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:p?m():v()}):(0,Q.jsxs)(Q.Fragment,{children:[g.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(J,{checked:_===`all`?!0:_===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(J,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void b(e.agentId,i),"aria-label":F({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":h(),title:h(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:N()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=T(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=S(z.charts.assignChartToGroup),r=S(z.charts.removeChartFromGroup),i=S(z.charts.setGroupDefaultChart),a=S(z.charts.addChartToGroupPool),s=S(z.charts.removeChartFromGroupPool),c=U();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:P()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:o()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function m(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function h(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(R(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(J,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":g({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":p(),title:p(),children:(0,Q.jsx)(G,{size:14,fill:`currentColor`})}):(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void m(e.chartKey),children:O()}):null,d?(0,Q.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":y({name:e.name}),title:y({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,Q.jsx)(je,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,Q.jsxs)(Re,{value:``,onValueChange:e=>void h(e),children:[(0,Q.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(He,{placeholder:A()})}),(0,Q.jsx)(ze,{children:u.map(e=>(0,Q.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):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{$T as r,AE as i,AT as a,Az as o,BE as s,BT as c,CE as l,CT as u,DE as d,DT as f,EE as p,ET as m,FE as h,FT as g,Fs as _,GE as v,GT as y,HE as b,HT as x,IE as S,IT as C,Is as w,JE as ee,JT as T,Jb as te,KE as ne,KT as E,LE as re,LT as ie,Ls as ae,ME as oe,MM as D,MT as O,Mz as k,NE as se,NT as ce,Nz as A,OE as le,PE as j,PT as M,QT as ue,RE as de,RT as fe,Rs as pe,SE as me,ST as he,TE as ge,TT as _e,UE as ve,UT as ye,VE as be,VT as xe,WE as Se,WT as Ce,XT as we,YT as Te,Yb as Ee,ZT as De,_E as Oe,_T as ke,aE as Ae,aT as je,bE as Me,bT as Ne,cE as Pe,cT as Fe,ci as Ie,dE as Le,dT as Re,eE as ze,fE as Be,fT as Ve,gE as He,gT as Ue,hE as We,hT as Ge,iE as N,jE as Ke,jM as P,jT as qe,kE as Je,kT as F,lE as Ye,lT as Xe,mE as Ze,mT as Qe,nE as $e,oE as et,oT as I,oi as tt,pE as nt,pT as rt,qE as it,qT as at,rE as ot,sE as st,sT as ct,si as lt,t as L,tE as ut,uE as R,uT as dt,vE as ft,vT as pt,wE as mt,wT as ht,xE as gt,xT as _t,yE as vt,yT as yt,zE as bt,zT as xt}from"./api-6pZGS4Dp.js";import{a as St,c as Ct}from"./FieldLabel-DK93YUC8.js";import{t as z}from"./button-D-5ueVCd.js";import{$ as B,Bt as wt,Dt as V,Et as H,Q as U,Rt as Tt,U as Et,X as W,Z as G,_ as Dt,at as K,et as q,jt as J,nt as Ot,ot as kt,rt as At,tt as jt,ut as Mt,zt as Nt}from"./index-CGjQ2eS7.js";import{t as Pt}from"./DataTableShell-Cqy89YR_.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-CZSFpGCy.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:St},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(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 Vt(){let e=A(L.admin.listInstances,{}),t=A(L.agents.listAllInstanceAgents,{}),n=k(L.admin.upsertInstance),r=k(L.admin.deleteInstance),a=V(),[o,c]=(0,Y.useState)(!1),[u,f]=(0,Y.useState)(Q),[m,g]=(0,Y.useState)(null),[_,y]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null);async function E(){try{await n({instanceId:w??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),f(Q),T(null),c(!1)}catch(e){a.error(ne(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),(0,Z.jsx)(`strong`,{children:Se()}),ve()]}),(0,Z.jsx)(Pt,{title:b(),rows:e,addLabel:be(),onAdd:()=>{T(null),f(Q),c(!0)},emptyHint:s(),columns:[{header:bt(),cell:e=>e.name,sort:e=>e.name},{header:de(),cell:e=>(0,Z.jsx)(H,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:re(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:S(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ee(),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)(H,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?I():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:oe(),onSelect:()=>{T(e._id),f(Bt(e)),c(!0)}},{label:it(),onSelect:()=>g(e.name)},{label:Oe(),onSelect:()=>C(e)},{label:h(),onSelect:()=>y(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(Dt,{open:o,onOpenChange:c,title:w?Ke():se(),description:Je(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:E,submitLabel:le(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:d(),children:[(0,Z.jsx)(J,{value:u.name,disabled:w!==null,onChange:e=>f({...u,name:e.target.value})}),w?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i()}):null]}),(0,Z.jsx)($,{label:p(),children:(0,Z.jsxs)(W,{value:u.kind,onValueChange:e=>f({...u,kind:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(U,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(U,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:Ie(),children:(0,Z.jsxs)(W,{value:u.transport,onValueChange:e=>f({...u,transport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(q,{})}),(0,Z.jsxs)(G,{children:[(0,Z.jsx)(U,{value:`ws`,children:lt()}),(0,Z.jsx)(U,{value:`rest`,children:tt()})]})]})}):null,(0,Z.jsx)($,{label:ge(),children:(0,Z.jsx)(J,{value:u.gatewayUrl,onChange:e=>f({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:mt(),children:(0,Z.jsx)(J,{value:u.bridgeUrl,placeholder:l(),onChange:e=>f({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:me(),children:(0,Z.jsx)(J,{value:u.displayName,onChange:e=>f({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ee(),children:[(0,Z.jsxs)(W,{value:u.streamTransport,onValueChange:e=>f({...u,streamTransport:e}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(q,{})}),(0,Z.jsx)(G,{children:Ct.map(e=>(0,Z.jsx)(U,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:te()})]}),(0,Z.jsx)($,{label:gt(),children:(0,Z.jsx)(J,{value:u.gatewayVersion,placeholder:Me(),onChange:e=>f({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:vt(),children:(0,Z.jsx)(J,{value:u.gatewayHttpUrl,placeholder:ft(),onChange:e=>f({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:m,open:m!==null,onOpenChange:e=>{e||g(null)}}),_?(0,Z.jsx)(Ft,{instance:_,onClose:()=>y(null)},_._id):null,x?(0,Z.jsx)(Ht,{instance:x,onClose:()=>C(null)},x._id):null]})}function Ht({instance:e,onClose:t}){let n=A(L.instanceSecrets.listInstanceSecretStatus,{}),r=zt[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)(jt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Ot,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(kt,{children:He({instance:e.displayName??e.name})}),(0,Z.jsx)(At,{children:We()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=o(L.instanceSync.forceInstanceSync),n=V(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Te());break;case`no_agents`:n.success(at());break;case`no_bridge_url`:n.error(E());break;case`deploy_misconfigured`:n.error(y());break;case`unauthorized`:n.error(ye());break;case`not_served`:n.error(x());break;default:n.error(Ce());break}}catch(e){n.error(T(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?we():De()})})]})}function Wt({instance:e}){let t=A(L.bridgeAuth.listBridgeAuthStatus,{}),n=o(L.bridgeAuth.mintBridgeSecret),r=k(L.bridgeAuth.revokeBridgeSecret),i=V(),[a,s]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(!1),p=(t??[]).find(t=>t.instanceId===e._id),m=p!==void 0;async function h(){if(!a){s(!0);try{u((await n({instanceId:e._id})).plaintext),f(!1)}catch(e){i.error(M(),e)}finally{s(!1)}}}async function _(){if(!a){s(!0);try{await r({instanceId:e._id}),u(null),i.success(g())}catch(e){i.error(M(),e)}finally{s(!1)}}}async function v(){if(l)try{await navigator.clipboard.writeText(l),f(!0)}catch{}}return(0,Z.jsxs)($,{label:c(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:xt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:m?`outline`:`secondary`,children:m?`${Le()} · ${p.prefix}…${p.lastFour}`:R()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{size:`sm`,onClick:()=>void h(),disabled:a,children:m?ie():fe()}),m?(0,Z.jsx)(z,{size:`sm`,variant:`destructive`,onClick:()=>void _(),disabled:a,children:C()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ce()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void v(),children:d?D():P()})]}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),f(!1)},children:O()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let i=o(L.instanceSecrets.setInstanceSecret),a=k(L.instanceSecrets.clearInstanceSecret),s=o(L.deviceIdentity.generateDeviceIdentity),c=V(),[l,u]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?Ze():t===`deviceIdentity`?nt():Be();async function b(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),g(!1),c.success(Ae())}catch(e){c.error(N(),e)}finally{f(!1)}}}async function x(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),c.success(ot())}catch(e){c.error(N(),e)}finally{f(!1)}}}async function S(){if(!d){f(!0);try{m(await s({instanceId:e})),g(!1),c.success(ze())}catch(e){c.error(ue(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function w(){if(C)try{await navigator.clipboard.writeText(C),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ut()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(H,{variant:_?`outline`:`secondary`,children:_?Le():R()}),(0,Z.jsx)(J,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:_?Pe():Ye(),onChange:e=>u(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{size:`sm`,onClick:()=>void b(),disabled:d||l.trim().length===0,children:st()}),v?(0,Z.jsx)(z,{size:`sm`,variant:`outline`,onClick:()=>void S(),disabled:d,children:$e()}):null,_?(0,Z.jsx)(z,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:d,children:et()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:ze()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:h?D():P()})]}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:O()})]}):null]})}var Kt={conversational:_t,documentary:yt,summarizer:pe,curator:w},qt={conversational:Ne,documentary:pt,summarizer:ae,curator:_},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:_e()}),t.map(e=>(0,Z.jsx)(H,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(Tt,{children:[(0,Z.jsx)(wt,{asChild:!0,children:(0,Z.jsx)(z,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ht()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:u()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:he()}),(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)(Mt,{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:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=A(L.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(L.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(L.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(L.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=k(L.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(L.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(L.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=k(L.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(L.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(L.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=k(L.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(L.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(L.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=k(L.agents.removeInstanceAgent),u=Et(),d=V();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(F(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(F(),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){d.error(F(),e)}}async function h(t,n){if(e&&await u({title:Ge({name:n}),description:Qe(),confirmLabel:rt(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(Ve())}catch(e){d.error(F(),e)}}return(0,Z.jsx)(jt,{open:t,onOpenChange:n,children:(0,Z.jsxs)(Ot,{className:`oc-access`,children:[(0,Z.jsxs)(K,{children:[(0,Z.jsx)(kt,{children:qe({name:e??``})}),(0,Z.jsx)(At,{children:a()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Re()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?dt():r.discovery.lastPollOk?Xe():Fe({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ct()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(Mt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:je()}),(0,Z.jsx)(z,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:Ue()})]}):i?(0,Z.jsx)(H,{variant:`default`,children:I()}):(0,Z.jsx)(z,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:ke()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(F(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(J,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:f(),"aria-label":m(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}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{Vt as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,AO as i,Az as a,DO as o,EO as s,FO as c,IO as l,LO as u,MO as d,Mz as f,NO as p,Nz as m,OO as h,PO as g,Qc as _,RO as v,Zc as y,al as b,el as x,il as S,jO as C,kO as w,nl as T,rl as E,t as D,tl as O,zO as k}from"./api-6pZGS4Dp.js";import{t as A}from"./button-D-5ueVCd.js";import{Et as j,jt as M,ut as N}from"./index-CGjQ2eS7.js";var P=t(e(),1),F=n();function I(){let e=m(D.integrations.status.status,{}),t=f(D.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:k()});let a=n,_=(e,t,n)=>r({...a,[e]:{...a[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[v(),` `,(0,F.jsx)(`strong`,{children:u()}),` `,l()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:d(),children:[(0,F.jsx)(R,{label:i(),children:(0,F.jsx)(M,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>_(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:s(),checked:a.langfuse.enabled??!0,onChange:e=>{_(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:p()}),note:C(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>_(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||o(),onChange:e=>_(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:s(),checked:a.opik.enabled??!0,onChange:e=>{_(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:b()}),note:S(),children:[(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(M,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>_(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:s(),checked:a.otlp.enabled??!0,onChange:e=>{_(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=a(D.integrations.otlpSecret.setOtlpHeaders),n=f(D.integrations.otlpSecret.clearOtlpHeaders),[i,o]=(0,P.useState)(``),[s,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),d=async()=>{u(!0),c(null);try{await t({headersJson:i}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:T(),children:[(0,F.jsx)(M,{value:i,placeholder:e?O():x(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:l||i.trim().length===0,onClick:()=>void d(),children:r()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:_()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:y()})]})}export{I as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,Nz as i,Qv as a,Sk as o,ay as s,bk as c,cy as l,dk as u,dy as d,ey as f,fk as p,fy as m,iy as h,ly as g,ny as _,oy as ee,qk as te,ry as ne,sy as v,t as y,ty as b,uy as x,xk as S,yk as C}from"./api-6pZGS4Dp.js";import{Gn as w,Wn as T,i as E,o as re,q as ie,r as D}from"./index-CGjQ2eS7.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BGf8kBDa.js";import{n as N,t as P}from"./TimeRangePicker-D2DOA7Ue.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=i(y.me.getMe,{host:ie})?.permissions?.includes(`traces.read`)??!1,t=i(y.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,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:te()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:o()}),(0,R.jsx)(j,{children:c()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,R.jsx)(H,{series:n})})]})]})}function H({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,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),c=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[u(),` p50 `,B(c.cP50),` `,S()]}),(0,R.jsxs)(`span`,{children:[p(),` p50 `,B(c.aP50),` `,S()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":o(),children:[(0,R.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:m(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:d(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:x(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:g(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:l(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:v(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:ee(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=w({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=E(e.from,e.to,D,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:a,to:o}=N(n),{rowLimit:c,buckets:l}=J(a,o),u=i(y.kpi.listKpis,{limit:c,filter:{from:a,to:o}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[s(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:h()})]}),(0,R.jsx)(Y,{value:n,onChange:r})]});return u===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})]}):u.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:_()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,i=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&i>0?` oc-kpi__value--error`:``),children:Q(i)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:b({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:f()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:r({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.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,o=Math.max(i-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":a({max:Q(r),unit:n}),children:e.map((e,a)=>{let s=r>0?e.value/r*(Z-1):0,c=a*i,l=Z-s;return(0,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:o,height:s,children:(0,R.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{ae as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$R as i,CP as a,DP as o,EP as s,En as c,GN as l,JN as u,JR as ee,KN as d,Mz as f,Nz as p,OE as te,OP as m,QN as ne,QR as re,SP as ie,TP as ae,Tn as oe,WN as se,XN as ce,XR as le,YN as ue,YR as de,ZN as h,ZR as fe,_P as pe,aP as me,an as he,az as ge,bP as g,bn as _,cP as v,cn as y,cz as b,dP as x,dn as S,dz as C,eP as w,ez as T,fP as E,fn as D,fz as O,gP as k,gz as A,hP as j,hz as M,iP as N,iz as P,kP as F,lP as I,ln as L,lz as _e,mP as ve,mz as ye,nP as be,nz as xe,oP as Se,on as Ce,oz as we,pP as Te,pz as Ee,qN as De,qR as Oe,r as R,rP as z,rz as ke,sP as Ae,sn as je,sz as Me,t as B,tP as Ne,tz as Pe,uP as Fe,un as Ie,uz as Le,vP as Re,wP as ze,wz as Be,xP as Ve,yP as He,yz as Ue}from"./api-6pZGS4Dp.js";import{t as V}from"./button-D-5ueVCd.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-CGjQ2eS7.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-DBZErd9-.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.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,J.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 Y=[{id:`messages`,label:()=>F()},{id:`composer`,label:()=>m()},{id:`sidebar`,label:()=>o()},{id:`notifications`,label:()=>Fe()},{id:`other`,label:()=>s()}],X={showSource:{category:`messages`,label:()=>ae(),help:()=>ze()},showReport:{category:`messages`,label:()=>a(),help:()=>ie()},copyAssistant:{category:`messages`,label:()=>Ve()},copyUser:{category:`messages`,label:()=>g()},showDelete:{category:`messages`,label:()=>He()},showTools:{category:`messages`,label:()=>Re(),help:()=>pe()},voiceInput:{category:`composer`,label:()=>k(),help:()=>j()},showUsage:{category:`composer`,label:()=>ve(),help:()=>Te()},autoReadAloud:{category:`composer`,label:()=>c(),help:()=>oe()},showChatAge:{category:`sidebar`,label:()=>E(),help:()=>x()},notifSound:{category:`notifications`,label:()=>I(),help:()=>v()},notifSystem:{category:`notifications`,label:()=>Ae(),help:()=>Se()},replySound:{category:`notifications`,label:()=>me(),help:()=>N()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>u()};function ut({prefKey:e,ui:t}){let n=f(B.admin.setUiPrefDefault),r=f(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ne()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:d()}),(0,J.jsx)(U,{value:`off`,children:l()}),(0,J.jsx)(U,{value:`inherit`,children:se()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":h()}),h()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=f(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[D(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?L():r?Ie():S()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:he()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?Ce():e?je():y()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=p(B.me.getMe,{host:G}),o=a?.ui,s=$(a?.role)&&n,c=f(B.me.setUiPref).withOptimisticUpdate(Je),l=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":r()}),r()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ce()}),(0,J.jsx)(`p`,{children:ue()}),(0,J.jsx)(`p`,{children:De()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:z(),"aria-label":z(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:be()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:Ne()}):l?(0,J.jsx)(H,{variant:`secondary`,children:_()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:w()}):null,(0,J.jsx)(nt,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:Be()})}var pt={sm:()=>P(),md:()=>ke(),lg:()=>xe(),xl:()=>Pe(),"2xl":()=>T(),"3xl":()=>i()};function mt(){let e=p(B.me.getMe,{host:G}),t=f(B.me.setLocale),n=f(B.me.setTimezone),r=f(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:G});n&&e.setQuery(B.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=f(B.me.setMyName),a=Ke(),o=e?.locale??`default`,s=e?.name??``,[c,l]=(0,q.useState)(null),u=c??s,d=u.trim()!==s.trim();async function m(){try{await i({name:u}),l(null),a.success(O())}catch(e){a.error(C(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:u,maxLength:120,placeholder:ye(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!d,onClick:()=>void m(),children:te()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ee()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Le()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Ue()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:le()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Me()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -1 +1 @@
1
- .oc-projpage{height:100%;padding:24px clamp(16px,5vw,48px);overflow-y:auto}.oc-projpage__body{flex-direction:column;gap:20px;max-width:860px;margin:0 auto;display:flex}.oc-projpage__hint{color:var(--muted-foreground);font-size:.85rem}.oc-projpage__notfound{flex-direction:column;align-items:flex-start;gap:10px;max-width:860px;margin:48px auto;display:flex}.oc-projpage__crumbs{color:var(--muted-foreground);flex-wrap:wrap;align-items:center;gap:2px;font-size:.8rem;display:flex}.oc-projpage__crumb{align-items:center;gap:2px;display:inline-flex}.oc-projpage__crumblink{color:inherit;border-radius:6px;padding:2px 4px;text-decoration:none}.oc-projpage__crumblink:hover{color:var(--foreground);background:color-mix(in oklab, var(--proj-hue) 14%, transparent)}.oc-projpage__crumbsep{opacity:.6;padding:0 2px}.oc-projpage__crumbcur{color:var(--foreground);padding:2px 4px;font-weight:500}.oc-projpage__head{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.oc-projpage__dot{background:var(--proj-hue);border-radius:4px;flex:none;width:12px;height:12px}.oc-projpage__title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin:0;font-size:1.25rem;font-weight:600;overflow:hidden}.oc-projpage__actions{flex:none;align-items:center;gap:6px;display:flex}.oc-projpage__section{flex-direction:column;gap:10px;display:flex}.oc-projpage__subtitle{text-transform:uppercase;letter-spacing:.04em;color:var(--muted-foreground);margin:0;font-size:.78rem;font-weight:600}.oc-projpage__cards{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;display:grid}.oc-projpage__card{border:1px solid var(--border);border-left:3px solid color-mix(in oklab, var(--proj-hue) 55%, transparent);border-radius:var(--radius);background:var(--card);color:var(--foreground);flex-direction:column;gap:6px;padding:12px 14px;text-decoration:none;transition:background .14s,border-color .14s,transform .14s;display:flex}.oc-projpage__card:hover{background:color-mix(in oklab, var(--proj-hue) 8%, var(--card));border-color:color-mix(in oklab, var(--proj-hue) 35%, var(--border));transform:translateY(-1px)}@media (prefers-reduced-motion:reduce){.oc-projpage__card{transition:none}.oc-projpage__card:hover{transform:none}}.oc-projpage__cardhead{align-items:center;gap:7px;min-width:0;display:flex}.oc-projpage__cardico{color:var(--proj-hue);flex:none}.oc-projpage__cardname{text-overflow:ellipsis;white-space:nowrap;font-weight:500;overflow:hidden}.oc-projpage__cardmeta{color:var(--muted-foreground);font-size:.75rem}.oc-projpage__cardage{color:var(--muted-foreground);opacity:.8;font-size:.72rem}.oc-projpage__convhead{justify-content:space-between;align-items:center;gap:12px;display:flex}.oc-projpage__filter{max-width:240px;height:30px}.oc-projpage__chats{flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.oc-projpage__chatrow{border-radius:8px;align-items:center;gap:4px;display:flex}.oc-projpage__chatrow:hover{background:color-mix(in oklab, var(--proj-hue) 8%, transparent)}.oc-projpage__chatbtn{text-align:left;cursor:pointer;min-width:0;color:var(--foreground);font:inherit;background:0 0;border:none;flex:1;align-items:center;gap:8px;padding:8px 10px;display:flex;position:relative}.oc-projpage__chattitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oc-projpage__chatpin{color:var(--muted-foreground);flex:none}.oc-projpage__chatage{color:var(--muted-foreground);flex:none;font-size:.72rem}.oc-projpage__chatmenu{opacity:0;flex:none}.oc-projpage__chatrow:hover .oc-projpage__chatmenu,.oc-projpage__chatrow:focus-within .oc-projpage__chatmenu{opacity:1}.oc-projpage__viewtoggle{border:1px solid var(--border);border-radius:calc(var(--radius) - 2px);gap:2px;padding:2px;display:inline-flex}.oc-projpage__card.is-over,.oc-projpage__colentry.is-over,.oc-projpage__col.is-over{outline:2px solid color-mix(in oklab, var(--proj-hue,var(--highlight)) 60%, transparent);outline-offset:-2px;background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__card.is-dragging,.oc-projpage__chatrow.is-dragging,.oc-projpage__colentry.is-dragging{opacity:.35}.oc-projpage__cdrop.is-over .oc-projpage__crumblink{background:color-mix(in oklab, var(--proj-hue) 22%, transparent);color:var(--foreground)}.oc-projpage__dragghost{border:1px solid var(--border);background:var(--card);color:var(--foreground);border-radius:8px;align-items:center;gap:6px;padding:5px 10px;font-size:.82rem;display:inline-flex;box-shadow:0 4px 14px #0000002e}.oc-projpage__barbtn{opacity:.45;color:var(--muted-foreground);flex:none}.oc-projpage__barbtn.is-on{opacity:1;color:color-mix(in srgb, var(--proj-hue,var(--highlight)) 70%, var(--foreground))}.oc-projpage__chatrow:hover .oc-projpage__barbtn,.oc-projpage__chatrow:focus-within .oc-projpage__barbtn,.oc-projpage__colentry--chat:hover .oc-projpage__barbtn,.oc-projpage__colentry--chat:focus-within .oc-projpage__barbtn{opacity:1}.oc-projpage__cols{border:1px solid var(--border);border-radius:var(--radius);scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--muted-foreground) 45%, transparent) transparent;background:linear-gradient(to right, var(--background) 30%, transparent) left center, linear-gradient(to left, var(--background) 30%, transparent) right center, linear-gradient(to right, color-mix(in srgb, var(--foreground) 16%, transparent), transparent) left center, linear-gradient(to left, color-mix(in srgb, var(--foreground) 16%, transparent), transparent) right center;background-repeat:no-repeat;background-size:40px 100%,40px 100%,16px 100%,16px 100%;background-attachment:local,local,scroll,scroll;align-items:stretch;gap:0;min-height:320px;display:flex;overflow-x:auto}.oc-projpage__cols::-webkit-scrollbar{height:8px}.oc-projpage__cols::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--muted-foreground) 45%, transparent);border-radius:4px}.oc-projpage__cols::-webkit-scrollbar-track{background:0 0}.oc-projpage__col{border-right:1px solid var(--border);flex-direction:column;flex:0 0 220px;gap:1px;min-width:200px;padding:6px;display:flex;overflow-y:auto}.oc-projpage__col.is-last{border-right:none;flex:1 0 240px}.oc-projpage__colempty{color:var(--muted-foreground);margin:0;padding:8px;font-size:.78rem}.oc-projpage__colentry{cursor:pointer;color:var(--foreground);font:inherit;text-align:left;background:0 0;border:none;border-radius:7px;align-items:center;gap:7px;min-width:0;padding:6px 8px;font-size:.84rem;display:flex;position:relative}.oc-projpage__colentry--folder:hover,.oc-projpage__colentry--folder:focus-visible{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__colentry--folder.is-selected{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 18%, transparent)}.oc-projpage__colentry--chat{padding:0;position:relative}.oc-projpage__colentry--chat .oc-projpage__barbtn{position:absolute;top:50%;right:3px;transform:translateY(-50%)}.oc-projpage__colchatbtn{cursor:pointer;min-width:0;color:var(--foreground);font:inherit;text-align:left;background:0 0;border:none;border-radius:7px;flex:1 1 0;align-items:center;gap:7px;padding:6px 8px;font-size:.84rem;display:flex;position:relative;overflow:hidden}.oc-projpage__colchatbtn:hover,.oc-projpage__colchatbtn:focus-visible{background:color-mix(in oklab, var(--highlight) 8%, transparent)}.oc-projpage__colico{color:var(--proj-hue,var(--muted-foreground));flex:none}.oc-projpage__colname{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oc-projpage__colchev{color:var(--muted-foreground);opacity:.7;flex:none}.oc-projpage__cardmenu{opacity:0;flex:none;margin-left:auto}.oc-projpage__card:hover .oc-projpage__cardmenu,.oc-projpage__card:focus-within .oc-projpage__cardmenu,.oc-projpage__cardmenu[aria-expanded=true]{opacity:1}.oc-projpage__colmenu{opacity:0;position:absolute;top:50%;right:2px;transform:translateY(-50%)}.oc-projpage__colmenu--chat{right:26px}.oc-projpage__colentry:hover .oc-projpage__colmenu,.oc-projpage__colentry:focus-within .oc-projpage__colmenu,.oc-projpage__colmenu[aria-expanded=true]{opacity:1}.oc-projpage__colentry--folder:hover .oc-projpage__colchev,.oc-projpage__colentry--folder:focus-within .oc-projpage__colchev{opacity:0}.oc-projpage__colentry--chat .oc-projpage__colchatbtn{padding-right:52px}.oc-projpage__treemenu{opacity:0;flex:none}.oc-projpage__treerow:hover .oc-projpage__treemenu,.oc-projpage__treerow:focus-within .oc-projpage__treemenu,.oc-projpage__treemenu[aria-expanded=true]{opacity:1}.oc-projpage__tree{border:1px solid var(--border);border-radius:var(--radius);flex-direction:column;align-items:stretch;gap:1px;min-height:320px;padding:6px;display:flex}.oc-projpage__treegroup{flex-direction:column;gap:1px;display:flex}.oc-projpage__treerow{padding:5px 8px;padding-left:calc(8px + var(--tree-depth,0) * 18px);cursor:pointer;border-radius:7px;align-items:center;gap:7px;min-width:0;font-size:.84rem;display:flex;position:relative}.oc-projpage__treerow--folder:hover,.oc-projpage__treerow--folder:focus-visible{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__treerow--chat{padding-top:0;padding-bottom:0}.oc-projpage__treerow--chat .oc-projpage__colchatbtn{padding-left:0}.oc-projpage__treechev{cursor:pointer;color:color-mix(in srgb, var(--proj-hue,var(--muted-foreground)) 80%, var(--muted-foreground));background:0 0;border:none;border-radius:5px;flex:none;justify-content:center;align-items:center;margin:0;padding:1px;display:inline-flex}.oc-projpage__treechev:hover,.oc-projpage__treechev:focus-visible{background:color-mix(in srgb, var(--proj-hue,var(--muted-foreground)) 18%, transparent)}.oc-projpage__chatrow.is-locate,.oc-projpage__colentry.is-locate,.oc-projpage__treerow.is-locate{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent);animation:1.6s ease-out 2 oc-locate-flash}@keyframes oc-locate-flash{0%{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 38%, transparent)}to{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}}@media (prefers-reduced-motion:reduce){.oc-projpage__chatrow.is-locate,.oc-projpage__colentry.is-locate,.oc-projpage__treerow.is-locate{animation:none}}.oc-projpage__hitico{color:var(--muted-foreground);flex:none;align-self:flex-start;margin-top:2px}.oc-projpage__hitbody{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.oc-projpage__hitpath{color:var(--muted-foreground);opacity:.85;text-overflow:ellipsis;white-space:nowrap;font-size:.7rem;overflow:hidden}.oc-projpage__hitsnippet{color:var(--muted-foreground);text-overflow:ellipsis;white-space:nowrap;font-size:.78rem;overflow:hidden}
1
+ .oc-projpage{height:100%;padding:24px clamp(16px,5vw,48px);overflow-y:auto}.oc-projpage__body{flex-direction:column;gap:20px;max-width:860px;margin:0 auto;display:flex}.oc-projpage__hint{color:var(--muted-foreground);font-size:.85rem}.oc-projpage__notfound{flex-direction:column;align-items:flex-start;gap:10px;max-width:860px;margin:48px auto;display:flex}.oc-projpage__crumbs{color:var(--muted-foreground);flex-wrap:wrap;align-items:center;gap:2px;font-size:.8rem;display:flex}.oc-projpage__crumb{align-items:center;gap:2px;display:inline-flex}.oc-projpage__crumblink{color:inherit;border-radius:6px;padding:2px 4px;text-decoration:none}.oc-projpage__crumblink:hover{color:var(--foreground);background:color-mix(in oklab, var(--proj-hue) 14%, transparent)}.oc-projpage__crumbsep{opacity:.6;padding:0 2px}.oc-projpage__crumbcur{color:var(--foreground);padding:2px 4px;font-weight:500}.oc-projpage__head{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.oc-projpage__dot{background:var(--proj-hue);border-radius:4px;flex:none;width:12px;height:12px}.oc-projpage__title{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;margin:0;font-size:1.25rem;font-weight:600;overflow:hidden}.oc-projpage__actions{flex:none;align-items:center;gap:6px;display:flex}.oc-projpage__section{flex-direction:column;gap:10px;display:flex}.oc-projpage__subtitle{text-transform:uppercase;letter-spacing:.04em;color:var(--muted-foreground);margin:0;font-size:.78rem;font-weight:600}.oc-projpage__cards{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;display:grid}.oc-projpage__card{border:1px solid var(--border);border-left:3px solid color-mix(in oklab, var(--proj-hue) 55%, transparent);border-radius:var(--radius);background:var(--card);color:var(--foreground);flex-direction:column;gap:6px;padding:12px 14px;text-decoration:none;transition:background .14s,border-color .14s,transform .14s;display:flex}.oc-projpage__card:hover{background:color-mix(in oklab, var(--proj-hue) 8%, var(--card));border-color:color-mix(in oklab, var(--proj-hue) 35%, var(--border));transform:translateY(-1px)}@media (prefers-reduced-motion:reduce){.oc-projpage__card{transition:none}.oc-projpage__card:hover{transform:none}}.oc-projpage__cardhead{align-items:center;gap:7px;min-width:0;display:flex}.oc-projpage__cardico{color:var(--proj-hue);flex:none}.oc-projpage__cardname{text-overflow:ellipsis;white-space:nowrap;font-weight:500;overflow:hidden}.oc-projpage__cardmeta{color:var(--muted-foreground);font-size:.75rem}.oc-projpage__cardage{color:var(--muted-foreground);opacity:.8;font-size:.72rem}.oc-projpage__convhead{justify-content:space-between;align-items:center;gap:12px;display:flex}.oc-projpage__filter{max-width:240px;height:30px}.oc-projpage__chats{flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.oc-projpage__chatrow{border-radius:8px;align-items:center;gap:4px;display:flex}.oc-projpage__chatrow:hover{background:color-mix(in oklab, var(--proj-hue) 8%, transparent)}.oc-projpage__chatbtn{text-align:left;cursor:pointer;min-width:0;color:var(--foreground);font:inherit;background:0 0;border:none;flex:1;align-items:center;gap:8px;padding:8px 10px;display:flex;position:relative}.oc-projpage__chattitle{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oc-projpage__chatpin{color:var(--muted-foreground);flex:none}.oc-projpage__chatage{color:var(--muted-foreground);flex:none;font-size:.72rem}.oc-projpage__chatmenu{opacity:0;flex:none}.oc-projpage__chatrow:hover .oc-projpage__chatmenu,.oc-projpage__chatrow:focus-within .oc-projpage__chatmenu{opacity:1}.oc-projpage__viewtoggle{border:1px solid var(--border);border-radius:calc(var(--radius) - 2px);gap:2px;padding:2px;display:inline-flex}.oc-projpage__card.is-over,.oc-projpage__colentry.is-over,.oc-projpage__col.is-over{outline:2px solid color-mix(in oklab, var(--proj-hue,var(--highlight)) 60%, transparent);outline-offset:-2px;background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__card.is-dragging,.oc-projpage__chatrow.is-dragging,.oc-projpage__colentry.is-dragging{opacity:.35}.oc-projpage__cdrop.is-over .oc-projpage__crumblink{background:color-mix(in oklab, var(--proj-hue) 22%, transparent);color:var(--foreground)}.oc-projpage__dragghost{border:1px solid var(--border);background:var(--card);color:var(--foreground);border-radius:8px;align-items:center;gap:6px;padding:5px 10px;font-size:.82rem;display:inline-flex;box-shadow:0 4px 14px #0000002e}.oc-projpage__barbtn{opacity:.45;color:var(--muted-foreground);flex:none}.oc-projpage__barbtn.is-on{opacity:1;color:color-mix(in srgb, var(--proj-hue,var(--highlight)) 70%, var(--foreground))}.oc-projpage__chatrow:hover .oc-projpage__barbtn,.oc-projpage__chatrow:focus-within .oc-projpage__barbtn,.oc-projpage__colentry--chat:hover .oc-projpage__barbtn,.oc-projpage__colentry--chat:focus-within .oc-projpage__barbtn{opacity:1}.oc-projpage__cols{border:1px solid var(--border);border-radius:var(--radius);scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--muted-foreground) 45%, transparent) transparent;background:linear-gradient(to right, var(--background) 30%, transparent) left center, linear-gradient(to left, var(--background) 30%, transparent) right center, linear-gradient(to right, color-mix(in srgb, var(--foreground) 16%, transparent), transparent) left center, linear-gradient(to left, color-mix(in srgb, var(--foreground) 16%, transparent), transparent) right center;background-repeat:no-repeat;background-size:40px 100%,40px 100%,16px 100%,16px 100%;background-attachment:local,local,scroll,scroll;align-items:stretch;gap:0;min-height:320px;display:flex;overflow-x:auto}.oc-projpage__cols::-webkit-scrollbar{height:8px}.oc-projpage__cols::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--muted-foreground) 45%, transparent);border-radius:4px}.oc-projpage__cols::-webkit-scrollbar-track{background:0 0}.oc-projpage__col{border-right:1px solid var(--border);flex-direction:column;flex:0 0 220px;gap:1px;min-width:200px;padding:6px;display:flex;overflow-y:auto}.oc-projpage__col.is-last{border-right:none;flex:1 0 240px}.oc-projpage__colempty{color:var(--muted-foreground);margin:0;padding:8px;font-size:.78rem}.oc-projpage__colentry{cursor:pointer;color:var(--foreground);font:inherit;text-align:left;background:0 0;border:none;border-radius:7px;align-items:center;gap:7px;min-width:0;padding:6px 8px;font-size:.84rem;display:flex;position:relative}.oc-projpage__colentry--folder:hover,.oc-projpage__colentry--folder:focus-visible{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__colentry--folder.is-selected{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 18%, transparent)}.oc-projpage__colentry--chat{padding:0;position:relative}.oc-projpage__colentry--chat .oc-projpage__barbtn{position:absolute;top:50%;right:3px;transform:translateY(-50%)}.oc-projpage__colchatbtn{cursor:pointer;min-width:0;color:var(--foreground);font:inherit;text-align:left;background:0 0;border:none;border-radius:7px;flex:1 1 0;align-items:center;gap:7px;padding:6px 8px;font-size:.84rem;display:flex;position:relative;overflow:hidden}.oc-projpage__colchatbtn:hover,.oc-projpage__colchatbtn:focus-visible{background:color-mix(in oklab, var(--highlight) 8%, transparent)}.oc-projpage__colico{color:var(--proj-hue,var(--muted-foreground));flex:none}.oc-projpage__colname{text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;overflow:hidden}.oc-projpage__colchev{color:var(--muted-foreground);opacity:.7;flex:none}.oc-projpage__cardmenu{opacity:0;flex:none;margin-left:auto}.oc-projpage__card:hover .oc-projpage__cardmenu,.oc-projpage__card:focus-within .oc-projpage__cardmenu,.oc-projpage__cardmenu[aria-expanded=true]{opacity:1}.oc-projpage__colmenu{opacity:0;position:absolute;top:50%;right:2px;transform:translateY(-50%)}.oc-projpage__colmenu--chat{right:26px}.oc-projpage__colentry:hover .oc-projpage__colmenu,.oc-projpage__colentry:focus-within .oc-projpage__colmenu,.oc-projpage__colmenu[aria-expanded=true]{opacity:1}.oc-projpage__colentry--folder:hover .oc-projpage__colchev,.oc-projpage__colentry--folder:focus-within .oc-projpage__colchev{opacity:0}.oc-projpage__colentry--chat .oc-projpage__colchatbtn{padding-right:52px}.oc-projpage__treemenu{opacity:0;flex:none}.oc-projpage__treerow:hover .oc-projpage__treemenu,.oc-projpage__treerow:focus-within .oc-projpage__treemenu,.oc-projpage__treemenu[aria-expanded=true]{opacity:1}.oc-projpage__tree{border:1px solid var(--border);border-radius:var(--radius);flex-direction:column;align-items:stretch;gap:1px;min-height:320px;padding:6px;display:flex}.oc-projpage__treegroup{flex-direction:column;gap:1px;display:flex}.oc-projpage__treerow{padding:5px 8px;padding-left:calc(8px + var(--tree-depth,0) * 18px);cursor:pointer;border-radius:7px;align-items:center;gap:7px;min-width:0;font-size:.84rem;display:flex;position:relative}.oc-projpage__treerow--folder:hover,.oc-projpage__treerow--folder:focus-visible{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}.oc-projpage__treerow--chat{padding-top:0;padding-bottom:0}.oc-projpage__treerow--chat .oc-projpage__colchatbtn{padding-left:0}.oc-projpage__treechev{cursor:pointer;color:color-mix(in srgb, var(--proj-hue,var(--muted-foreground)) 80%, var(--muted-foreground));background:0 0;border:none;border-radius:5px;flex:none;justify-content:center;align-items:center;margin:0;padding:1px;display:inline-flex}.oc-projpage__treechev:hover,.oc-projpage__treechev:focus-visible{background:color-mix(in srgb, var(--proj-hue,var(--muted-foreground)) 18%, transparent)}.oc-projpage__chatrow.is-locate,.oc-projpage__colentry.is-locate,.oc-projpage__treerow.is-locate{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent);animation:1.6s ease-out 2 oc-locate-flash}@keyframes oc-locate-flash{0%{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 38%, transparent)}to{background:color-mix(in oklab, var(--proj-hue,var(--highlight)) 10%, transparent)}}@media (prefers-reduced-motion:reduce){.oc-projpage__chatrow.is-locate,.oc-projpage__colentry.is-locate,.oc-projpage__treerow.is-locate{animation:none}}.oc-projpage__hitico{color:var(--muted-foreground);flex:none;align-self:flex-start;margin-top:2px}.oc-projpage__hitbody{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.oc-projpage__hitpath{color:var(--muted-foreground);opacity:.85;text-overflow:ellipsis;white-space:nowrap;font-size:.7rem;overflow:hidden}.oc-projpage__hitsnippet{color:var(--muted-foreground);text-overflow:ellipsis;white-space:nowrap;font-size:.78rem;overflow:hidden}.oc-projpage__hiddenbadge{color:var(--oc-muted-fg);gap:.375rem;font-size:.8125rem;font-weight:500}
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,A_ as i,D as a,D_ as o,Ev as s,F_ as c,Fv as l,H_ as u,I_ as d,J_ as f,K_ as ee,L_ as te,M_ as p,Mz as m,N as h,N_ as g,Nv as ne,Nz as _,O_ as v,Ov as y,P as re,Pv as ie,Q_ as b,Sv as x,T_ as S,Tv as ae,U_ as oe,V_ as se,Vh as ce,W_ as le,X_ as C,Y_ as ue,Z_ as de,_v as fe,av as pe,bv as me,cv as he,dv as ge,ev as w,fv as _e,gv as ve,iv as ye,j_ as be,k_ as xe,kv as Se,mv as T,nv as Ce,ov as E,pv as D,q_ as O,rv as we,sv as k,t as A,tv as Te,uv as Ee,vv as De,wz as j,yv as Oe}from"./api-6pZGS4Dp.js";import{t as ke}from"./list-CJW1tnnv.js";import{t as M}from"./button-D-5ueVCd.js";import{A as Ae,An as je,C as Me,Cn as Ne,D as N,Dt as Pe,E as Fe,Ft as Ie,Gn as Le,It as Re,J as ze,Kn as Be,Lt as Ve,Mn as He,Mt as Ue,Nn as We,Nt as Ge,O as P,On as F,P as Ke,Pt as I,S as qe,T as Je,U as Ye,Vn as Xe,W as Ze,Wn as L,Y as Qe,_ as $e,_n as R,b as z,d as et,f as tt,g as B,h as V,j as H,jn as nt,jt as U,k as rt,kn as it,m as at,p as ot,un as st,v as W,vn as G,w as ct,wn as lt,x as K,xn as q,y as ut,yn as dt,zn as ft}from"./index-CGjQ2eS7.js";var pt=a(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),mt=a(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),ht=a(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),J=a(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function gt({className:e}){return(0,X.jsx)(Ve,{asChild:!0,children:(0,X.jsx)(M,{variant:`ghost`,size:`icon-xs`,"aria-label":g(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)(We,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=m(A.projects.renameProject),s=m(A.projects.setProjectColor),u=m(A.projects.moveProject),f=m(A.projects.deleteProject),ee=m(A.projects.createProject),te=Ye(),h=Ze(),[g,y]=(0,Y.useState)(!1),[re,b]=(0,Y.useState)(t),[x,S]=(0,Y.useState)(!1),[ce,le]=(0,Y.useState)(!1),C=_(A.projects.projectTreeCount,ce?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Ue,{onOpenChange:e=>e&&le(!0),children:[(0,X.jsx)(gt,{className:i}),(0,X.jsxs)(Ge,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(I,{onSelect:()=>a(),children:[(0,X.jsx)(je,{}),` `,ve()]}),(0,X.jsxs)(I,{onSelect:()=>{b(t),y(!0)},children:[(0,X.jsx)(dt,{}),` `,p()]}),(0,X.jsxs)(I,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:k(),label:l(),placeholder:ie(),confirmLabel:ne()});t&&await ee({name:t,parentId:e})})},children:[(0,X.jsx)(it,{}),` `,k()]}),(0,X.jsxs)(I,{onSelect:()=>S(!0),children:[(0,X.jsx)(mt,{}),` `,oe()]}),(0,X.jsx)(Ie,{children:xe()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e,color:null}),"aria-label":v(),children:`✕`}),at.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void s({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(Re,{}),(0,X.jsxs)(I,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=C?.folders??0,r=C?.chats??0;await te({title:Oe({name:t}),description:n>0?fe({folders:n,chats:r}):r>0?De({count:r}):d(),confirmWord:c(),confirmLabel:me(),destructive:!0})&&await f({projectId:e})})},children:[(0,X.jsx)(st,{}),` `,c()]})]})]}),(0,X.jsx)($e,{open:g,onOpenChange:y,title:ae(),canSubmit:re.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:re.trim()}),y(!1)},submitLabel:p(),children:(0,X.jsx)(U,{value:re,onChange:e=>b(e.target.value),autoFocus:!0})}),x?(0,X.jsx)(ot,{open:x,onOpenChange:S,title:se(),movingFolderId:e,currentId:r,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function Q({chat:e,currentFolderId:t,className:n}){let r=m(A.chats.pinChat),a=m(A.chats.deleteChat),s=m(A.chats.renameChat),l=m(A.chats.setChatSidebar),f=m(A.chats.moveChatToProject),ee=Ye(),[te,h]=(0,Y.useState)(!1),[g,ne]=(0,Y.useState)(e.title??``),[_,v]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Ue,{children:[(0,X.jsx)(gt,{className:n}),(0,X.jsxs)(Ge,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(I,{onSelect:()=>{ne(e.title??``),h(!0)},children:[(0,X.jsx)(dt,{}),` `,p()]}),(0,X.jsxs)(I,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(R,{}):(0,X.jsx)(G,{}),e.pinned?be():i()]}),(0,X.jsxs)(I,{onSelect:()=>v(!0),children:[(0,X.jsx)(mt,{}),` `,le()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(I,{onSelect:()=>void l({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(q,{}):(0,X.jsx)(J,{}),e.inSidebar?D():T()]}),(0,X.jsx)(Re,{}),(0,X.jsxs)(I,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await ee({title:o(),description:d(),confirmLabel:c(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,X.jsx)(st,{}),` `,c()]})]})]}),(0,X.jsx)($e,{open:te,onOpenChange:h,title:S(),canSubmit:g.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:g.trim()}),h(!1)},submitLabel:p(),children:(0,X.jsx)(U,{value:g,onChange:e=>ne(e.target.value),autoFocus:!0})}),_?(0,X.jsx)(ot,{open:_,onOpenChange:v,title:u(),currentId:t,onPick:t=>void f({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=Be({from:`/project/$projectId`}),t=L(),n=_(A.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:j()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:ue()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:f()}),(0,X.jsx)(M,{variant:`outline`,onClick:()=>void t({to:`/`}),children:O()})]}):(0,X.jsx)(Et,{page:n})})}function Et({page:e}){let t=L(),n=Ye(),i=Ze(),a=Pe(),o=m(A.projects.renameProject),u=m(A.projects.setProjectColor),f=m(A.projects.deleteProject),g=m(A.projects.createProject),y=m(A.projects.moveProject),x=m(A.projects.setProjectSidebar),S=m(A.chats.moveChatToProject),le=m(A.chats.reorderChat),ue=m(A.projects.reorderProject),pe=_(A.projects.projectTreeCount,{projectId:e.project._id}),[w,ve]=(0,Y.useState)(xt),be=e=>{localStorage.setItem(bt,e),ve(e)},T=_(A.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),E=_(A.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:D}=Le({from:`/project/$projectId`}),O=_(A.projects.listProjects,{}),Te=_(A.chatReads.myBusyChats,{}),j=(0,Y.useMemo)(()=>new Set(Te??[]),[Te]),je=_(A.chatReads.myChatReads,{}),Be=(0,Y.useMemo)(()=>yt(e.chats,je??[]),[e.chats,je]),{startNewChat:P,picker:Xe}=et(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[R,z]=(0,Y.useState)(``),[tt,V]=(0,Y.useState)(!1),[H,G]=(0,Y.useState)(e.project.name),[q,ft]=(0,Y.useState)(!1),[J,gt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>gt(R.trim()),180);return()=>clearTimeout(e)},[R]);let Z=_(A.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),Q=Ae(rt(ct,{activationConstraint:{distance:4}}),rt(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,Y.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,Y.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=T?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||Se()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(O??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=N(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=N(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=N(n(`crumb:`));if(a.length>0)return a;let o=N(n(`col:`));return o.length>0?o:Fe(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`columns`){for(let e of T?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=E?.chats.find(e=>e._id===t);return e?{list:E.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(w===`columns`){for(let e of T?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=E?.folders.find(e=>e._id===t);if(!e||!E)return null;let n=e.parentId??E.rootId;return{list:Qe(E.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),o=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(o)await S({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ze(O??[],t,e)){a.error(he());return}await y({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await S({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await le({chatId:e,...a});return}if(!o&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!ze(O??[],e,n.parentId)){a.error(he());return}await y({projectId:e,parentId:n.parentId})}let o=vt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await ue({projectId:e,...o});return}}catch{a.error(he())}},[,Lt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=B(e.project),Bt=_t(e.chats,R),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,X.jsxs)(qe,{sensors:Q,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":ee(),children:[Vt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(Dt,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(M,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:re(),onClick:()=>{x({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)(He,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:h()}),(0,X.jsx)(nt,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":_e(),children:[(0,X.jsx)(M,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":_e(),title:_e(),"aria-pressed":w===`cards`,onClick:()=>be(`cards`),children:(0,X.jsx)(ht,{})}),(0,X.jsx)(M,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ge(),title:ge(),"aria-pressed":w===`columns`,onClick:()=>be(`columns`),children:(0,X.jsx)(pt,{})}),(0,X.jsx)(M,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ee(),title:Ee(),"aria-pressed":w===`list`,onClick:()=>be(`list`),children:(0,X.jsx)(ke,{})})]}),(0,X.jsxs)(M,{variant:`outline`,size:`sm`,onClick:()=>void P({projectId:e.project._id}),children:[(0,X.jsx)(lt,{}),Ce()]}),(0,X.jsxs)(M,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:k(),label:l(),placeholder:ie(),confirmLabel:ne()});t&&await g({name:t,parentId:e.project._id})},children:[(0,X.jsx)(it,{}),k()]}),(0,X.jsxs)(Ue,{children:[(0,X.jsx)(Ve,{asChild:!0,children:(0,X.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),children:(0,X.jsx)(We,{})})}),(0,X.jsxs)(Ge,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(I,{onSelect:()=>{G(e.project.name),V(!0)},children:[(0,X.jsx)(dt,{}),` `,p()]}),(0,X.jsxs)(I,{onSelect:()=>ft(!0),children:[(0,X.jsx)(mt,{}),` `,oe()]}),(0,X.jsx)(Ie,{children:xe()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void u({projectId:e.project._id,color:null}),"aria-label":v(),children:`✕`}),at.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void u({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(Re,{}),(0,X.jsxs)(I,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=pe?.folders??0,a=pe?.chats??0;await n({title:Oe({name:e.project.name}),description:i>0?fe({folders:i,chats:a}):a>0?De({count:a}):d(),confirmWord:c(),confirmLabel:me(),destructive:!0})&&(await f({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,X.jsx)(st,{}),` `,c()]})]})]})]})]}),w===`columns`?(0,X.jsx)(Ft,{data:T,currentId:e.project._id,busyIds:j,suppressClick:$,locateChatId:D??null}):w===`list`?(0,X.jsx)(Mt,{data:E,busyIds:j,suppressClick:$,locateChatId:D??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ye()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(W,{items:e.children.map(e=>`folder:${e._id}`),strategy:ut,children:e.children.map(t=>(0,X.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:we()}),e.chats.length>0?(0,X.jsx)(U,{value:R,onChange:e=>z(e.target.value),placeholder:r(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?de():C()}):Bt.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b({term:R.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(W,{items:Bt.map(e=>`chat:${e._id}`),strategy:K,children:Bt.map(t=>(0,X.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:j.has(t._id),unread:Be.has(t._id),locate:t._id===D,suppressClick:$},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:te()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&Ke(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(Ne,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ce()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)($e,{open:tt,onOpenChange:V,title:ae(),canSubmit:H.trim().length>0,onSubmit:async()=>{await o({projectId:e.project._id,name:H.trim()}),V(!1)},submitLabel:p(),children:(0,X.jsx)(U,{value:H,onChange:e=>G(e.target.value),autoFocus:!0})}),q?(0,X.jsx)(ot,{open:q,onOpenChange:ft,title:se(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void y({projectId:e.project._id,parentId:t})}):null,Xe]}),(0,X.jsx)(Me,{children:Ct?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,X.jsx)(F,{size:13,"aria-hidden":!0}):(0,X.jsx)(Ne,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=P({id:Ct(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=L(),a=z({id:`folder:${e._id}`}),o=P({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(F,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?Te({count:e.folderCount})+` · `:``,w({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:tt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=m(A.chats.setChatSidebar),n=e.inSidebar?D():T();return(0,X.jsx)(M,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(q,{}):(0,X.jsx)(J,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=L(),c=V(e.color),l=z({id:`chat:${e._id}`}),u=jt(a);return(0,X.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||Se()}),e.pinned?(0,X.jsx)(G,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:tt(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,title:y(),"aria-label":y()}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:x(),"aria-label":x()}):null]}),(0,X.jsx)(kt,{chat:e}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:j()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=Qe(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{items:u.map(e=>`chat:${e._id}`),strategy:K,children:u.map(e=>(0,X.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(W,{items:d.map(e=>`folder:${e._id}`),strategy:K,children:d.map(t=>(0,X.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:de()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=L(),c=z({id:`folder:${e._id}`}),l=P({id:$(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":B(e),transform:H.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?E():pe(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(ft,{size:13}):(0,X.jsx)(Xe,{size:13})}),(0,X.jsx)(F,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=L(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||Se()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:j()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=L(),s=P({id:St(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(W,{items:e.folders.map(e=>`folder:${e._id}`),strategy:K,children:e.folders.map(t=>(0,X.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(W,{items:e.chats.map(e=>`chat:${e._id}`),strategy:K,children:e.chats.map(t=>(0,X.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:C()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=P({id:$(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(F,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,X.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||Se()}),n?(0,X.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,X.jsx)(Q,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
@@ -0,0 +1,4 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$a as r,$b as i,A as a,Ab as o,Ba as s,Bb as c,Bs as l,Db as u,Eb as d,Fb as f,Gb as p,Ha as m,Hb as h,Hs as g,Ib as _,Lb as ee,Mb as te,Mz as ne,Nb as re,Nz as v,Ob as y,Pb as b,Qa as x,Qb as S,Rb as C,Ua as w,Ub as ie,Us as ae,Va as oe,Vb as se,Vs as T,Wb as E,Xa as D,Za as O,di as k,jb as A,kb as j,li as M,t as N,ui as P,za as F,zb as I,zs as L}from"./api-6pZGS4Dp.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-DK93YUC8.js";import{t as H}from"./button-D-5ueVCd.js";import{$ as U,Dt as W,Q as G,Qt as K,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-CGjQ2eS7.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:c,help:I},documentary_fetch:{label:C,help:ee},inbound_files:{label:_,help:f},history_summary:{label:ae,help:g},file_curation:{label:r,help:w},quote_reply:{label:x,help:O}},he={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`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:y,references:u,files:d,previous_summary:T,new_messages:l,max_chars:L,file_name:m,budget_chars:oe,feedback:s,content:F,excerpt:D};function _e(){let e=v(N.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:re()})});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)(z,{label:p(),help:E()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:b()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=ne(N.admin.upsertInstanceConfig),n=W(),r=v(N.me.getMe,{host:ue}),a=e.config??{},o=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>R(a,o));(0,Q.useEffect)(()=>{c(R(a,o))},[o,e._id]);let[l,u]=(0,Q.useState)(!1),d=s.promptInjections,f=(e,t)=>c({...s,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:B(s,a,o)})}catch(e){n.error(S(),e)}finally{u(!1)}}async function m(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(S(),e)}}let h=e.config?.contentLocale??`default`,g=fe[Z(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:k()}),(0,$.jsxs)(q,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:M({locale:g})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:P()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:d[e]??{enabled:!0,template:J[e].defaultTemplate[o]},contentLocale:o,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void p(),disabled:l,children:i()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:s}){let[c,l]=(0,Q.useState)(!1),u=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=le(e,r,i),m=p?K(p,f):``;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)(de,{checked:r.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:h()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>s({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:se()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?A():te()}),u&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate[i]}),children:ie()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:o()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:a()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:j()})})]})}export{_e as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aw as r,Bw as i,Co as a,Cw as o,Dw as s,Ew as ee,Fw as c,Hw as l,Iw as u,Lw as d,Mw as f,Mz as p,Nw as m,Nz as h,Ow as g,Pw as _,Rw as v,Sw as y,Tw as b,Uw as x,Vw as S,_w as te,aw as ne,bw as re,cw as ie,ew as ae,gw as C,hw as w,iw as T,jw as E,kw as D,mw as O,nw as k,ow as A,rw as j,sw as M,t as N,tw as P,vw as F,ww as I,xw as L,yw as R,zw as z}from"./api-6pZGS4Dp.js";import{t as B}from"./button-D-5ueVCd.js";import{Dt as V,Et as H,Tn as U,U as W,_ as G,jt as K,ut as q}from"./index-CGjQ2eS7.js";import{t as J}from"./roleDescriptions-B5YpxuQ5.js";var Y=t(e(),1),X=n(),Z=[{group:()=>x(),keys:[{key:`traces.read`,label:()=>v()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>u()}]},{group:()=>l(),keys:[{key:`kpi.read`,label:()=>v()},{key:`kpi.write`,label:()=>u()}]},{group:()=>S(),keys:[{key:`openclaw.query`,label:()=>c()},{key:`anomalies.read`,label:()=>_()},{key:`anomalies.report`,label:()=>m()}]},{group:()=>i(),keys:[{key:`chats.read`,label:()=>v()},{key:`selfheal`,label:()=>E()},{key:`feedback.respond`,label:()=>a()}]},{group:()=>z(),keys:[{key:`admin.manage`,label:()=>f()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=h(N.apiKeys.listRoles,{}),t=p(N.apiKeys.createRole),n=p(N.apiKeys.ensureRolesSeeded),i=p(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),c=V(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[m,_]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(D(),e)})},[n,c]);let v=e??[];async function x(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:g({name:e.name}),description:s(),confirmLabel:ee()});return}if(m.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];_(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(b(),e)}finally{_(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function S(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),u(!1)}catch(e){c.error(I(),e)}}let E=e===void 0,z=!E&&v.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[o(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,y(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,L()]}),(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:re()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{f($),u(!0)},children:R()})})]}),E?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:F()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(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:C()}),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?r({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:v.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)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(U,{}),` `,w()]}):(0,X.jsx)(H,{variant:`secondary`,children:O()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?ie():n?M():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:l,onOpenChange:u,title:A(),description:ne(),canSubmit:!!(d.key&&d.name),onSubmit:S,submitLabel:T(),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:j()}),(0,X.jsx)(K,{value:d.key,placeholder:k(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:P()}),(0,X.jsx)(K,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(K,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{se as RolesTab};