@lacneu/atrium 0.84.4 → 0.84.5
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.
- package/dist/assets/{AccessTab-U9gkqPi_.js → AccessTab-8bz2EDDf.js} +1 -1
- package/dist/assets/{AdvancedFilter-BbGwAk2J.js → AdvancedFilter-BDMSRiwU.js} +1 -1
- package/dist/assets/AgentFilesTab-DQdpfF8v.js +3 -0
- package/dist/assets/{AnomaliesTab-j2y9uU-G.js → AnomaliesTab-DPefNWza.js} +1 -1
- package/dist/assets/AuditTab-CgfSSk0X.js +1 -0
- package/dist/assets/{BridgeTab-fCJQhfcl.js → BridgeTab-D0ZbevIl.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-CU8MWJDx.js → ChatDefaultsTab-DIhwQZ-e.js} +1 -1
- package/dist/assets/{DataTableShell-tMQLeAkL.js → DataTableShell-yD_nPHl_.js} +1 -1
- package/dist/assets/{DetailChips-BJrU9abA.js → DetailChips-DVgEoxGq.js} +1 -1
- package/dist/assets/FeedbacksTab-CaveJx4M.js +1 -0
- package/dist/assets/{FieldLabel-D-1TOAEd.js → FieldLabel-DgfHtxL5.js} +1 -1
- package/dist/assets/FilesTab-Dwd-4D88.js +1 -0
- package/dist/assets/{FilterBar-BB9HpiR0.js → FilterBar-Dp85xc2n.js} +1 -1
- package/dist/assets/{GroupsTab-Cvthu-9e.js → GroupsTab-CYTXD0Ye.js} +1 -1
- package/dist/assets/InstancesTab-CXgt6j0O.js +1 -0
- package/dist/assets/IntegrationsTab-CmZZ5qVG.js +1 -0
- package/dist/assets/KpiTab-DAPN0ZX5.js +1 -0
- package/dist/assets/PreferencesTab-a4rIWqWr.js +1 -0
- package/dist/assets/ProjectPage-C6BaHO7Z.js +1 -0
- package/dist/assets/{PromptInjectionsTab-BLc91QlQ.js → PromptInjectionsTab-BEjRNnxi.js} +2 -2
- package/dist/assets/RolesTab-RSEarqlZ.js +1 -0
- package/dist/assets/ScheduledTab-Bjs625Yx.js +1 -0
- package/dist/assets/ServiceAccountsTab-3sDRXsF1.js +1 -0
- package/dist/assets/{SubAgentReportsTab-t74GNChq.js → SubAgentReportsTab-E1wAejSf.js} +1 -1
- package/dist/assets/ThemeShowroom-DP3CQmeY.js +1 -0
- package/dist/assets/{TimeRangePicker-BNzXp6XH.js → TimeRangePicker-BlCtUw8V.js} +1 -1
- package/dist/assets/{TimezoneCombobox-I1Uc-Ubw.js → TimezoneCombobox-B_GmUBef.js} +1 -1
- package/dist/assets/TracesTab-7jaPaE0x.js +1 -0
- package/dist/assets/{UsersTab-DeLrFIwE.js → UsersTab-qyCOb7pd.js} +1 -1
- package/dist/assets/VoiceTab-3zc3qoTb.js +1 -0
- package/dist/assets/api-DS0UCfP0.js +44 -0
- package/dist/assets/{button-BHiy_q9F.js → button-wZk4ylVE.js} +1 -1
- package/dist/assets/{card-Dgi0cIBy.js → card-CurFse5M.js} +1 -1
- package/dist/assets/chevrons-up-down-D0x6gTDo.js +1 -0
- package/dist/assets/{compatView-DaOCauKc.js → compatView-C5M9dPiM.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-Cv5NrLNL.js → dispatchErrorInfo-C8Rn3ysk.js} +1 -1
- package/dist/assets/{dist-Bq7TOaac.js → dist-5dg443OC.js} +1 -1
- package/dist/assets/{dist-Dlw2jmvE.js → dist-C5S0CMYi.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-B_P-O6Hv.js → highlighted-body-OFNGDK62-B6danJ4Z.js} +1 -1
- package/dist/assets/index-BpLlUFfO.css +1 -0
- package/dist/assets/{index-DRTZkZgA.js → index-SBKa9qhz.js} +41 -41
- package/dist/assets/{list-Dbcww3Mb.js → list-BEBtqnHm.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-B0YF1hFv.js +1 -0
- package/dist/assets/{pdf-qp966rql.js → pdf-D6nf3wYq.js} +1 -1
- package/dist/assets/roleDescriptions-q9e87Q_C.js +1 -0
- package/dist/assets/{table-BKRXY_Eg.js → table-DlldEKg7.js} +1 -1
- package/dist/assets/{tabs-JuirMY8K.js → tabs-DJM-iyEY.js} +1 -1
- package/dist/assets/x-DSVIpKLV.js +1 -0
- package/dist/index.html +7 -7
- package/package.json +1 -1
- package/dist/assets/AgentFilesTab-B8Yjl6k_.js +0 -3
- package/dist/assets/AuditTab-Hce8hJqk.js +0 -1
- package/dist/assets/FeedbacksTab-ChbJhdh0.js +0 -1
- package/dist/assets/FilesTab-BK5AB6xP.js +0 -1
- package/dist/assets/InstancesTab-BGpPt4KT.js +0 -1
- package/dist/assets/IntegrationsTab-D7z-nVKE.js +0 -1
- package/dist/assets/KpiTab-1TZebhaA.js +0 -1
- package/dist/assets/PreferencesTab-IF07Bg1d.js +0 -1
- package/dist/assets/ProjectPage-D2cJu3qQ.js +0 -1
- package/dist/assets/RolesTab-CWanW3h-.js +0 -1
- package/dist/assets/ScheduledTab-Bd-mayHR.js +0 -1
- package/dist/assets/ServiceAccountsTab-BhZ24YSZ.js +0 -1
- package/dist/assets/ThemeShowroom-CxUfL_C0.js +0 -1
- package/dist/assets/TracesTab-DmBA2Kdl.js +0 -1
- package/dist/assets/VoiceTab-BwqfO1Qw.js +0 -1
- package/dist/assets/api-NzmVMBHn.js +0 -44
- package/dist/assets/chevrons-up-down-ByP4WpSK.js +0 -1
- package/dist/assets/index-ButHo2z6.css +0 -1
- package/dist/assets/mermaid-GHXKKRXX-BXcnFAbM.js +0 -1
- package/dist/assets/roleDescriptions-Dj1fvyuY.js +0 -1
- package/dist/assets/x-B2aLNZur.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Av as r,Bv as i,Cg as a,D as o,Dv as s,Ev as c,Fv as l,Gv as u,Hv as d,Iv as f,Jv as p,Kv as m,Lv as h,Mv as g,Nv as _,Ov as v,Pv as y,Qv as b,Rv as x,Tv as ee,Uv as te,Vv as ne,Wv as re,Xv as ie,Yv as ae,Zv as oe,_v as se,_y as ce,bB as S,bv as le,dt as ue,dv as de,ey as C,fB as w,ft as fe,fv as pe,fy as T,gv as E,hv as D,iy as me,jv as O,lv as k,ly as he,mv as A,ny as ge,oy as _e,pv as ve,py as ye,ry as be,t as j,ty as xe,uy as Se,vy as Ce,xB as M,xv as we,yv as N,yy as Te,zv as Ee}from"./api-DS0UCfP0.js";import{t as De}from"./list-BEBtqnHm.js";import{t as P}from"./button-wZk4ylVE.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as F,Dt as Me,E as Ne,Ft as Pe,Gn as I,Hn as Fe,It as Ie,J as Le,Kn as Re,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as L,P as We,Pn as Ge,Pt as R,S as Ke,Sn as qe,T as Je,Tn as Ye,U as Xe,W as Ze,Y as Qe,_ as $e,b as z,bn as et,d as tt,dn as nt,f as rt,g as B,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-SBKa9qhz.js";var ft=o(`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`}]]),pt=o(`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`}]]),mt=o(`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`}]]),Y=o(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":se(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ge,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=S(j.projects.renameProject),c=S(j.projects.setProjectColor),l=S(j.projects.moveProject),d=S(j.projects.deleteProject),f=S(j.projects.createProject),p=Xe(),m=Ze(),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(t),[y,b]=(0,X.useState)(!1),[x,te]=(0,X.useState)(!1),ne=M(j.projects.projectTreeCount,x?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&te(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,C()]}),(0,Z.jsxs)(R,{onSelect:()=>{v(t),g(!0)},children:[(0,Z.jsx)(et,{}),` `,E()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:u(),label:Te(),placeholder:Ce(),confirmLabel:ce()});t&&await f({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,u()]}),(0,Z.jsxs)(R,{onSelect:()=>b(!0),children:[(0,Z.jsx)(pt,{}),` `,s()]}),(0,Z.jsx)(Pe,{children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":pe(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ne?.folders??0,r=ne?.chats??0;await p({title:be({name:t}),description:n>0?xe({folders:n,chats:r}):r>0?ge({count:r}):le(),confirmWord:N(),confirmLabel:me(),destructive:!0})&&await d({projectId:e})})},children:[(0,Z.jsx)(nt,{}),` `,N()]})]})]}),(0,Z.jsx)($e,{open:h,onOpenChange:g,title:he(),canSubmit:_.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:_.trim()}),g(!1)},submitLabel:E(),children:(0,Z.jsx)(W,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),y?(0,Z.jsx)(ot,{open:y,onOpenChange:b,title:ee(),movingFolderId:e,currentId:r,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=S(j.chats.pinChat),i=S(j.chats.deleteChat),a=S(j.chats.renameChat),o=S(j.chats.setChatSidebar),s=S(j.chats.moveChatToProject),l=Xe(),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(e.title??``),[m,h]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)(et,{}),` `,E()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?D():A()]}),(0,Z.jsxs)(R,{onSelect:()=>h(!0),children:[(0,Z.jsx)(pt,{}),` `,v()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{}),e.inSidebar?oe():b()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:de(),description:le(),confirmLabel:N(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(nt,{}),` `,N()]})]})]}),(0,Z.jsx)($e,{open:u,onOpenChange:d,title:k(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:E(),children:(0,Z.jsx)(W,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,Z.jsx)(ot,{open:m,onOpenChange:h,title:c(),currentId:t,onPick:t=>void s({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}=st({from:`/project/$projectId`}),t=I(),n=M(j.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:w()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:_()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:g()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:O()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=I(),n=Xe(),o=Ze(),c=Me(),g=S(j.projects.renameProject),_=S(j.projects.setProjectColor),v=S(j.projects.deleteProject),b=S(j.projects.createProject),x=S(j.projects.moveProject),te=S(j.projects.setProjectSidebar),re=S(j.chats.moveChatToProject),oe=S(j.chats.reorderChat),se=S(j.projects.reorderProject),de=M(j.projects.projectTreeCount,{projectId:e.project._id}),[C,w]=(0,X.useState)(xt),T=e=>{localStorage.setItem(bt,e),w(e)},D=M(j.projects.folderColumns,C===`columns`?{projectId:e.project._id}:`skip`),O=M(j.projects.projectTreeList,C===`list`?{projectId:e.project._id}:`skip`),{c:k}=Re({from:`/project/$projectId`}),A=M(j.projects.listProjects,{}),_e=M(j.chatReads.myBusyChats,{}),Ee=(0,X.useMemo)(()=>new Set(_e??[]),[_e]),Ae=M(j.chatReads.myChatReads,{}),Fe=(0,X.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:L,picker:qe}=tt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,rt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=M(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Oe(it(lt,{activationConstraint:{distance:4}}),it(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=D?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||ye()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(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=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:Ne(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(C===`columns`){for(let e of D?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(C===`list`){let e=O?.chats.find(e=>e._id===t);return e?{list:O.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(C===`columns`){for(let e of D?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(C===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:Qe(O.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),a=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(a)await re({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(A??[],t,e)){c.error(m());return}await x({projectId:t,parentId:e})}return}if(a&&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 re({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await oe({chatId:e,...a});return}if(!a&&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(!Le(A??[],e,n.parentId)){c.error(m());return}await x({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({projectId:e,...a});return}}catch{c.error(m())}},[,Lt]=(0,X.useState)(0);(0,X.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,z),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":r(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:fe(),onClick:()=>{te({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(He,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:ue()}),(0,Z.jsx)(Be,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":ie(),children:[(0,Z.jsx)(P,{variant:C===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ie(),title:ie(),"aria-pressed":C===`cards`,onClick:()=>T(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:C===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ae(),title:ae(),"aria-pressed":C===`columns`,onClick:()=>T(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:C===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":p(),title:p(),"aria-pressed":C===`list`,onClick:()=>T(`list`),children:(0,Z.jsx)(De,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Ye,{}),i()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:u(),label:Te(),placeholder:Ce(),confirmLabel:ce()});t&&await b({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),u()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":Se(),children:(0,Z.jsx)(Ge,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)(et,{}),` `,E()]}),(0,Z.jsxs)(R,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,s()]}),(0,Z.jsx)(Pe,{children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void _({projectId:e.project._id,color:null}),"aria-label":pe(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void _({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=de?.folders??0,a=de?.chats??0;await n({title:be({name:e.project.name}),description:i>0?xe({folders:i,chats:a}):a>0?ge({count:a}):le(),confirmWord:N(),confirmLabel:me(),destructive:!0})&&(await v({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(nt,{}),` `,N()]})]})]})]})]}),C===`columns`?(0,Z.jsx)(Ft,{data:D,currentId:e.project._id,busyIds:Ee,suppressClick:$,locateChatId:k??null}):C===`list`?(0,Z.jsx)(Mt,{data:O,busyIds:Ee,suppressClick:$,locateChatId:k??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:d()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ne()}),e.chats.length>0?(0,Z.jsx)(W,{value:z,onChange:e=>rt(e.target.value),placeholder:h(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?l():y()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:f({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:Ee.has(t._id),unread:Fe.has(t._id),locate:t._id===k,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:we()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:f({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||a()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:he(),canSubmit:U.trim().length>0,onSubmit:async()=>{await g({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:E(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:ee(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void x({projectId:e.project._id,parentId:t})}):null,qe]}),(0,Z.jsx)(je,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Ct(e)});return(0,Z.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=I(),a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.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,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{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,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?Ee({count:e.folderCount})+` · `:``,x({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:rt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=S(j.chats.setChatSidebar),n=e.inSidebar?oe():b();return(0,Z.jsx)(P,{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,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=I(),c=V(e.color),l=z({id:`chat:${e._id}`}),u=jt(a);return(0,Z.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,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ye()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:rt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:T(),"aria-label":T()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:_e(),"aria-label":_e()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.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,X.useState)(new Set),o=(0,X.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,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:w()});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,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.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,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:l()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=I(),c=z({id:`folder:${e._id}`}),l=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.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,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?re():te(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Ae,{size:13}):(0,Z.jsx)(Fe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{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=I(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.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,Z.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,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||ye()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:w()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.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=I(),s=L({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.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,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.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,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:y()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.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,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{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,Z.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,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||ye()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Cx as i,Dx as a,Ex as o,Hi as s,Ix as c,Lx as l,Oo as u,Ox as d,Sx as f,Tx as p,Ui as m,Vi as h,_c as g,_o as _,_x as v,bB as
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ao as r,Cx as i,Dx as a,Ex as o,Hi as s,Ix as c,Lx as l,Oo as u,Ox as d,Sx as f,Tx as p,Ui as m,Vi as h,_c as g,_o as _,_x as v,bB as ee,bc as y,bo as b,bx as te,ct as x,dx as ne,fx as S,gx as C,hx as w,jo as T,ko as E,kx as D,mx as re,px as ie,t as O,ux as ae,vc as oe,vo as se,vx as k,wx as A,xB as j,xc as M,xo as N,xx as P,yc as F,yo as I,yx as L}from"./api-DS0UCfP0.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-DgfHtxL5.js";import{t as H}from"./button-wZk4ylVE.js";import{$ as U,Dt as ce,Q as W,Qt as G,X as K,Xt as le,Yt as q,Z as J,Zt as ue,et as Y,q as de,ut as fe}from"./index-SBKa9qhz.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:A,help:i},documentary_fetch:{label:f,help:P},inbound_files:{label:te,help:L},history_summary:{label:M,help:y},file_curation:{label:T,help:N},quote_reply:{label:r,help:E}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
2
|
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
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:
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:S,references:ne,files:ae,previous_summary:F,new_messages:oe,max_chars:g,file_name:b,budget_chars:I,feedback:se,content:_,excerpt:u};function _e(){let e=j(O.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:v()})});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:D(),help:d()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:k()}),(0,$.jsxs)(K,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(J,{children:e.map(e=>(0,$.jsx)(W,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=ee(O.admin.upsertInstanceConfig),n=ce(),r=j(O.me.getMe,{host:de}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[o,u]=(0,Q.useState)(()=>R(i,a));(0,Q.useEffect)(()=>{u(R(i,a))},[a,e._id]);let[d,f]=(0,Q.useState)(!1),p=o.promptInjections,g=(e,t)=>u({...o,promptInjections:{...p,[e]:{...p[e],...t}}});async function _(){f(!0);try{await t({instanceId:e._id,config:B(o,i,a)})}catch(e){n.error(c(),e)}finally{f(!1)}}async function v(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(c(),e)}}let y=e.config?.contentLocale??`default`,b=Z[X(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:m()}),(0,$.jsxs)(K,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(U,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(J,{children:[(0,$.jsx)(W,{value:`default`,children:h({locale:b})}),pe().map(e=>(0,$.jsx)(W,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:s()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:q[e],i18n:me[e],row:p[e]??{enabled:!0,template:q[e].defaultTemplate[a]},contentLocale:a,onChange:t=>g(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void _(),disabled:d,children:l()})})]})}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}}`])),m=ue(e,r,i),h=m?G(m,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)(fe,{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:o()})]}),(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:p()}),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?w():C()}),u&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate[i]}),children:a()})]})]}),c&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:re()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:x()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ie()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,Bw as i,CT as a,DT as o,ET as s,Gw as c,Hw as l,Jw as u,Kw as d,OT as f,ST as p,TT as m,Uw as h,Vw as g,Ww as _,_T as v,aT as y,bB as b,bT as x,cT as ee,dT as te,eT as ne,fT as re,gT as ie,hT as ae,iT as S,kT as C,lT as w,mT as T,nT as E,oT as D,pT as O,qw as k,rT as A,sT as j,t as M,tT as N,ts as P,uT as F,vT as I,wT as L,xB as oe,xT as R,yT as z}from"./api-DS0UCfP0.js";import{t as B}from"./button-wZk4ylVE.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-SBKa9qhz.js";import{t as J}from"./roleDescriptions-q9e87Q_C.js";var Y=t(e(),1),X=n(),Z=[{group:()=>r(),keys:[{key:`traces.read`,label:()=>m()},{key:`traces.read.content`,label:()=>L(),phi:!0},{key:`traces.write`,label:()=>a()}]},{group:()=>C(),keys:[{key:`kpi.read`,label:()=>m()},{key:`kpi.write`,label:()=>a()}]},{group:()=>f(),keys:[{key:`openclaw.query`,label:()=>p()},{key:`anomalies.read`,label:()=>R()},{key:`anomalies.report`,label:()=>x()}]},{group:()=>o(),keys:[{key:`chats.read`,label:()=>m()},{key:`selfheal`,label:()=>I()},{key:`media.repair`,label:()=>v()},{key:`feedback.respond`,label:()=>P()}]},{group:()=>s(),keys:[{key:`admin.manage`,label:()=>z()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=oe(M.apiKeys.listRoles,{}),t=b(M.apiKeys.createRole),n=b(M.apiKeys.ensureRolesSeeded),r=b(M.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(M.apiKeys.listRoles,{});r&&e.setQuery(M.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),o=V(),[s,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)($),[v,x]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(ae(),e)})},[n,o]);let C=e??[];async function P(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:T({name:e.name}),description:O(),confirmLabel:re()});return}if(v.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];x(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){o.error(te(),e)}finally{x(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function I(){try{await t({key:p.key,name:p.name,description:p.description||void 0,permissions:[]}),m($),f(!1)}catch(e){o.error(F(),e)}}let L=e===void 0,R=!L&&C.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[w(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ee(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,j()]}),(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:D()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{m($),f(!0)},children:y()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:A()}):(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:E()}),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?ie({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:C.map(e=>{let t=Q(e.permissions),n=v.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)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,N()]}):(0,X.jsx)(U,{variant:`secondary`,children:ne()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.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?u():n?k():r,onCheckedChange:()=>void P(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:s,onOpenChange:f,title:d(),description:c(),canSubmit:!!(p.key&&p.name),onSubmit:I,submitLabel:_(),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:h()}),(0,X.jsx)(K,{value:p.key,placeholder:l(),onChange:e=>m({...p,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:g()}),(0,X.jsx)(K,{value:p.name,onChange:e=>m({...p,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,X.jsx)(K,{value:p.description,onChange:e=>m({...p,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,$L as i,AL as a,BR as o,CL as s,D as c,DL as l,EL as u,FL as ee,FR as d,GL as f,GR as p,HL as m,HR as h,IL as g,IR as _,JL as te,JR as ne,KL as re,KR as ie,LL as ae,LR as oe,ML as se,NL as ce,OL as le,PL as ue,QI as de,RR as fe,SL as pe,TL as v,UI as me,UL as he,UR as ge,VR as _e,WL as ve,WR as ye,XI as be,XL as xe,XR as Se,YI as Ce,YL as we,YR as Te,ZI as Ee,ZL as De,_R as Oe,aL as ke,aR as Ae,cL as je,cR as Me,dL as Ne,eL as Pe,fB as Fe,fL as Ie,fR as Le,gR as Re,hR as ze,iL as Be,iR as Ve,jL as He,kL as Ue,lL as We,lR as Ge,mB as y,mR as Ke,nL as qe,nR as Je,oL as Ye,oR as Xe,pR as Ze,qL as Qe,qR as $e,rL as et,rR as tt,sL as nt,sR as rt,t as b,tL as it,uL as at,uR as x,vB as S,wL as ot,xB as st,zR as ct}from"./api-DS0UCfP0.js";import{t as lt}from"./list-BEBtqnHm.js";import{t as C}from"./button-wZk4ylVE.js";import{$ as w,Bn as T,Bt as E,Ct as ut,Dn as dt,Dt as ft,Et as D,Q as O,Rt as k,St as pt,Tt as mt,Vn as A,X as j,Z as M,_n as ht,_t as gt,at as _t,bn as vt,bt as yt,dn as bt,et as N,gt as xt,hn as St,it as Ct,jt as wt,nt as Tt,on as Et,ot as Dt,q as Ot,rt as kt,tt as At,vt as jt,wt as Mt,xn as Nt,xt as Pt,yt as Ft,zt as P}from"./index-SBKa9qhz.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-DlldEKg7.js";import{t as Bt}from"./FilterBar-Dp85xc2n.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as z,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-B_GmUBef.js";var qt=c(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Jt=c(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),V=t(e(),1),H=n();function U(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Ht(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,V.useState)(!1),c=(0,V.useMemo)(()=>U(y()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{month:`long`,year:`numeric`}),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),d=L(i.year,i.month),f=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(B(e,n,r,i,a)),h=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,f,p)},_=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},te=n===null?g():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(k,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(E,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":ae(),children:[(0,H.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,H.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:te})]})}),(0,H.jsxs)(P,{align:`start`,className:`oc-dtp__pop`,children:[(0,H.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ee(),onClick:()=>_(-1),children:(0,H.jsx)(A,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ue(),onClick:()=>_(1),children:(0,H.jsx)(T,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),d.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>h(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(j,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,H.jsx)(w,{size:`sm`,"aria-label":ce(),children:(0,H.jsx)(N,{})}),(0,H.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(j,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,H.jsx)(w,{size:`sm`,"aria-label":se(),children:(0,H.jsx)(N,{})}),(0,H.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function Qt(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function en(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=y(),c=(0,V.useMemo)(()=>Zt(e),[e]),ee=(0,V.useMemo)(()=>$t(s),[s]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),m=new Date,h=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},g=t===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,H.jsxs)(`div`,{className:`oc-cal`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,H.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":v(),onClick:()=>h(-1),children:(0,H.jsx)(A,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":ot(),onClick:()=>h(1),children:(0,H.jsx)(T,{})}),(0,H.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>i({year:m.getFullYear(),month:m.getMonth()}),children:u()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:g}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:le()}),(0,H.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:l()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:c,weekdays:ee,timeFmt:p,now:m,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:c,monthShortFmt:f,now:m,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],c=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,H.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(c?` oc-cal__day--today`:``),children:[(0,H.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,G).map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,H.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,H.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,H.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>G?(0,H.jsx)(`span`,{className:`oc-cal__more`,children:s({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=L(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*on[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=z(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Gt(e)){case`ok`:return(0,H.jsx)(D,{variant:`secondary`,children:xe()});case`error`:return(0,H.jsx)(D,{variant:`destructive`,children:te()});case`running`:return(0,H.jsx)(D,{variant:`outline`,children:Qe()});case`other`:return(0,H.jsx)(D,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=S(b.scheduled.listMyCrons),t=S(b.scheduled.getCronDetail),n=S(b.scheduled.listCronRuns),s=S(b.scheduled.updateCron),c=S(b.scheduled.removeCron),l=S(b.scheduled.runCronNow),u=ft(),ee=st(b.me.getMe,{host:Ot})?.timezone,[g,ae]=(0,V.useState)(null),[se,ce]=(0,V.useState)(!1),[le,ue]=(0,V.useState)(!1),[v,ot]=(0,V.useState)(null),[T,E]=(0,V.useState)(null),[k,A]=(0,V.useState)(null),[P,L]=(0,V.useState)(null),[Ht,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ut),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,B]),on=(0,V.useMemo)(()=>Qt===`year`?tn(G.year):en(G.year,G.month),[Qt,G]),sn=(0,V.useMemo)(()=>un(an,on.startMs,on.endMs),[an,on]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,V.useCallback)(async()=>{ce(!0),ue(!1);try{ae(await e({}))}catch{ue(!0)}finally{ce(!1)}},[e]);(0,V.useEffect)(()=>{q()},[q]);let cn=(0,V.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,V.useRef)(null);(0,V.useEffect)(()=>{g!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[g]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(y(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ot(e);try{await t(),u.success(n),await q()}catch(e){u.toast({variant:`error`,title:x({code:dn(e)})})}finally{ot(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;A({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;A({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;A(null),u.toast({variant:`error`,title:x({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;L(null),u.toast({variant:`error`,title:x({code:dn(e)})})}},mn=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){u.toast({variant:`error`,title:Ce()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){u.toast({variant:`error`,title:be()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Gt(!0);try{await s({instanceName:P.instanceName,jobId:P.jobId,patch:e}),u.success(We()),t===Q.current&&L(null),await q()}catch(e){u.toast({variant:`error`,title:x({code:dn(e)})})}finally{Gt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Se()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":He(),children:[(0,H.jsx)(C,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":a(),title:a(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(lt,{})}),(0,H.jsx)(C,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ue(),title:Ue(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:se,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(St,{size:14,"aria-hidden":!0}),Te()]})]}),g!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:f(),onReset:()=>U(Ut),canReset:Wt(B),children:[(0,H.jsxs)(j,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(w,{size:`sm`,className:`w-40`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`all`,children:ve()}),(0,H.jsx)(O,{value:`active`,children:_()}),(0,H.jsx)(O,{value:`paused`,children:oe()}),(0,H.jsx)(O,{value:`auto-disabled`,children:d()})]})]}),(0,H.jsxs)(j,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(w,{size:`sm`,className:`w-40`,children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`all`,children:he()}),(0,H.jsx)(O,{value:`ok`,children:xe()}),(0,H.jsx)(O,{value:`error`,children:te()}),(0,H.jsx)(O,{value:`running`,children:Qe()}),(0,H.jsx)(O,{value:`none`,children:re()})]})]})]}):null,g===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":se,children:le?ne():Fe()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[le?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:pe()})]}):(0,H.jsxs)(H.Fragment,{children:[le?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):null,g.map(e=>{let t=e.jobs.filter(e=>Vt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,H.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,H.jsx)(D,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:p({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:ge()}),(0,H.jsx)(F,{children:h()}),(0,H.jsx)(F,{children:_e()}),(0,H.jsx)(F,{children:o()}),(0,H.jsx)(F,{children:ct()}),(0,H.jsx)(F,{children:De()}),(0,H.jsx)(F,{children:Ie()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=v===r,a=e.manageSupported,o=e.kind===`openclaw`&&a;return(0,H.jsxs)(Rt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??fe()}),(0,H.jsx)(I,{children:(0,H.jsx)(D,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=xt(t.schedule),n=e===null?null:gt(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(I,{children:z(t)===`auto-disabled`?(0,H.jsx)(D,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:d()}):z(t)===`active`?(0,H.jsx)(D,{variant:`secondary`,children:_()}):z(t)===`paused`?(0,H.jsx)(D,{variant:`outline`,children:oe()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(I,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(D,{variant:`destructive`,title:t.lastDeliveryError??Oe(),children:we()}):null]}),(0,H.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,H.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[o?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:ze(),"aria-label":ze(),disabled:v!==null,onClick:()=>void X(r,async()=>{let n=await l({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Ge()),children:(0,H.jsx)(Et,{size:14,"aria-hidden":!0})}):null,o&&t.enabled!==null?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?Ke():Ze(),"aria-label":R(t)===`pause`?Ke():Ze(),disabled:v!==null,onClick:()=>void X(r,()=>s({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?Me():rt()),children:R(t)===`pause`?(0,H.jsx)(Nt,{size:14,"aria-hidden":!0}):(0,H.jsx)(ht,{size:14,"aria-hidden":!0})}):null,o?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Ne(),"aria-label":Ne(),disabled:v!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(vt,{size:14,"aria-hidden":!0})}):null,o?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:at(),"aria-label":at(),disabled:v!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,a?(0,H.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:v!==null,onClick:()=>E({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(bt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ie()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:me()}):null]}),(0,H.jsx)(jt,{open:T!==null,onOpenChange:e=>{e||E(null)},children:(0,H.jsxs)(Pt,{children:[(0,H.jsxs)(Mt,{children:[(0,H.jsx)(mt,{children:Ae()}),(0,H.jsx)(pt,{children:Ve({name:T?.name??``})})]}),(0,H.jsxs)(ut,{children:[(0,H.jsx)(yt,{children:tt()}),(0,H.jsx)(Ft,{onClick:()=>{let e=T;E(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Xe())},children:Je()})]})]})}),(0,H.jsx)(At,{open:k!==null,onOpenChange:e=>{e||(Z.current++,A(null))},children:(0,H.jsxs)(Tt,{style:{maxWidth:640},children:[(0,H.jsx)(_t,{children:(0,H.jsx)(Dt,{children:je({name:k?.name??``})})}),k?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):k!==null&&k.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):k===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:k.entries.map((e,t)=>(0,H.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,H.jsx)(fn,{status:e.status}),(0,H.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,H.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,H.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[i({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(At,{open:P!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,H.jsxs)(Tt,{className:`oc-cronedit`,children:[(0,H.jsxs)(_t,{children:[(0,H.jsx)(Dt,{children:Ye()}),(0,H.jsx)(kt,{children:ke()})]}),P===null?null:P.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ge()}),(0,H.jsx)(wt,{value:P.name,maxLength:200,onChange:e=>L({...P,name:e.target.value,nameDirty:!0})})]}),(0,H.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Be()}),(0,H.jsxs)(j,{value:P.scheduleKind,onValueChange:e=>L({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(w,{children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`cron`,children:et()}),(0,H.jsx)(O,{value:`every`,children:qe()}),(0,H.jsx)(O,{value:`at`,children:it()})]})]}),P.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(wt,{value:P.cronExpr,onChange:e=>L({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:P.tz,onChange:e=>L({...P,tz:e,scheduleDirty:!0}),fallbackTz:ee??void 0})]}):P.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(wt,{type:`number`,min:1,value:P.everyValue,onChange:e=>L({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(j,{value:P.everyUnit,onValueChange:e=>L({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(w,{style:{maxWidth:160},children:(0,H.jsx)(N,{})}),(0,H.jsxs)(M,{children:[(0,H.jsx)(O,{value:`minutes`,children:Pe()}),(0,H.jsx)(O,{value:`hours`,children:r()}),(0,H.jsx)(O,{value:`days`,children:de()})]})]})]}):(0,H.jsx)(Yt,{value:P.at,onChange:e=>L({...P,at:e,scheduleDirty:!0})})]}),P.hasMessage?(0,H.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,H.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Re()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>L({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(Ct,{children:[(0,H.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:tt()}),(0,H.jsxs)(C,{onClick:()=>void mn(),disabled:P===null||P.loading||Ht,children:[Ht?(0,H.jsx)(dt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Ee()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,AP as ee,BN as te,CN as a,CP as ne,DN as o,DP as re,EN as s,EP as ie,FN as ae,GN as oe,HN as se,IN as ce,JN as le,KN as ue,LN as de,MN as c,NN as l,ON as u,OP as fe,PN as pe,QN as me,RN as he,SN as d,SP as ge,TN as f,TP as _e,UN as ve,VN as ye,WN as be,XN as xe,YN as Se,ZN as Ce,_N as we,_P as Te,aP as Ee,bB as p,bN as m,bP as De,cP as Oe,dN as h,dP as ke,eP as Ae,fN as g,fP as je,gN as _,gP as Me,hN as v,hP as Ne,iP as Pe,jN as y,kN as b,kP as Fe,lP as Ie,mN as x,mP as Le,nP as Re,oP as ze,pN as S,pP as Be,qN as Ve,rP as He,sP as Ue,t as C,tP as We,uN as w,uP as Ge,vB as Ke,vN as T,vP as qe,wN as E,wP as D,xB as O,xN as k,xP as Je,yN as A,yP as Ye,zN as Xe}from"./api-DS0UCfP0.js";import{t as j}from"./button-wZk4ylVE.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as K,tt as q}from"./index-SBKa9qhz.js";import{t as at}from"./FilterBar-Dp85xc2n.js";import{t as ot}from"./DataTableShell-yD_nPHl_.js";import{t as st}from"./roleDescriptions-q9e87Q_C.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>_(),days:null},{value:`30`,label:()=>v(),days:30},{value:`90`,label:()=>x(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,o]=(0,J.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),l=O(C.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),u=O(C.apiKeys.listKeys,{}),d=O(C.apiKeys.listRoles,{}),f=p(C.apiKeys.createServiceAccount),we=p(C.apiKeys.updateServiceAccount),m=p(C.apiKeys.deleteServiceAccount),h=Ke(C.apiKeys.mintApiKey),g=p(C.apiKeys.revokeApiKey),_=nt(),v=Qe(),y=n!==``||a!==Z||i!==Z;function b(){o(Z),t({search:{},replace:!0})}let[x,S]=(0,J.useState)(!1),[w,T]=(0,J.useState)(Q),[E,k]=(0,J.useState)(null),[A,P]=(0,J.useState)(new Set),[I,z]=(0,J.useState)(null),B=(0,J.useRef)(!1),[H,W]=(0,J.useState)(new Set),[G,it]=(0,J.useState)({}),[K,q]=(0,J.useState)(null),X=(0,J.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[u]);function $(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await we({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(le())):await f({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),k(null),S(!1)}catch(e){v.error(E?Se():xe(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),S(!0)}async function pt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=ct.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Ve(),e)}finally{B.current=!1,z(null)}}async function mt(e){if(await _({title:ue(),description:(0,Y.jsxs)(Y.Fragment,{children:[oe(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,be(),` `,(0,Y.jsx)(`strong`,{children:ve()}),` `,se()]}),confirmWord:e.name,confirmLabel:ye(),destructive:!0}))try{await m({serviceAccountId:e._id}),v.success(te(),e.name)}catch(e){v.error(Xe(),e)}}async function ht(e){if(await _({title:he(),description:(0,Y.jsxs)(Y.Fragment,{children:[de(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ce()]}),confirmLabel:ae(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(pe(),e)}finally{W(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}),(0,Y.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:Fe(),onReset:b,canReset:y,children:[(0,Y.jsxs)(L,{value:a,onValueChange:o,children:[(0,Y.jsx)(M,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(V,{placeholder:fe()})}),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(F,{value:Z,children:re()}),(d??[]).map(e=>(0,Y.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(L,{value:i,onValueChange:c,children:[(0,Y.jsx)(M,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(V,{})}),(0,Y.jsxs)(R,{children:[(0,Y.jsx)(F,{value:Z,children:ie()}),(0,Y.jsx)(F,{value:`active`,children:_e()}),(0,Y.jsx)(F,{value:`disabled`,children:D()})]})]})]}),(0,Y.jsx)(ot,{title:ne(),rows:l,addLabel:ge(),onAdd:()=>{T(Q),k(null),S(!0)},emptyHint:Je(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Te(),onSelect:()=>ft(e)},{label:De(),onSelect:()=>void pt(e)}]:[],{label:A.has(e._id)?Ye():qe(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Me(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Ne():Le(),onClick:()=>$(e._id),children:A.has(e._id)?(0,Y.jsx)(et,{}):(0,Y.jsx)(Ze,{})})},{header:Be(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:je(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:ke(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(N,{variant:`destructive`,children:D()}):(0,Y.jsx)(N,{variant:`outline`,children:_e()})},{header:Ge(),cell:e=>(0,Y.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(M,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(V,{})}),(0,Y.jsx)(R,{children:ct.map(e=>(0,Y.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Ie(),sort:e=>(X.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(X.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,Y.jsx)(`span`,{className:`oc-sa__keycount`,children:I===e._id?Oe():Ue({count:t})})}}]}),(0,Y.jsx)(rt,{open:x,onOpenChange:e=>{S(e),e||k(null)},title:E?ze():He(),description:E?Ee():Re(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?Pe():We(),children:(0,Y.jsxs)(`div`,{className:`oc-form`,children:[(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Ae()}),(0,Y.jsx)(U,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,Y.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,Y.jsx)(M,{className:`w-full`,children:(0,Y.jsx)(V,{placeholder:me()})}),(0,Y.jsx)(R,{children:(d??[]).map(e=>(0,Y.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(d??[]).find(e=>e.key===w.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Ce()}),(0,Y.jsx)(U,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:K,onClose:()=>q(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[l(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:y()}),(0,Y.jsx)(`th`,{children:i()}),(0,Y.jsx)(`th`,{children:b()}),(0,Y.jsx)(`th`,{children:u()}),(0,Y.jsx)(`th`,{children:o()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{})]})}),(0,Y.jsx)(`tbody`,{children:t.map(t=>(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`td`,{children:(0,Y.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,Y.jsx)(`td`,{children:(0,Y.jsx)(N,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:B(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,Y.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?f():E()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,Y.jsx)(q,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,Y.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,Y.jsxs)(z,{children:[(0,Y.jsx)(G,{children:a()}),(0,Y.jsx)(it,{children:d({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:k()}),(0,Y.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Y.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,Y.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":m(),children:[n?(0,Y.jsx)(I,{}):(0,Y.jsx)(P,{}),n?A():T()]})]}),(0,Y.jsx)(H,{children:(0,Y.jsx)(j,{onClick:()=>{r(!1),t()},children:we()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?S():B(e)}function pt(e){return e===null?`—`:K(e)}function mt(e){return e.disabled?(0,Y.jsx)(N,{variant:`destructive`,children:g()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(N,{variant:`outline`,children:h()}):(0,Y.jsx)(N,{variant:`outline`,children:w()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +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 a,Dc as o,Ec as s,Fc as c,Gc as l,Hc as u,Ic as d,Jc as f,Kc as p,Lc as m,Mc as h,Nc as g,Oc as _,Pc as v,Qc as y,Rc as b,Uc as x,Vc as S,Wc as C,Xc as w,Yc as T,Zc as E,al as D,bB as O,cl as k,el as A,il as j,jc as M,kc as N,ll as P,nl as F,ol as I,qc as ee,rl as L,sl as R,t as z,tl as B,ul as V,
|
|
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 a,Dc as o,Ec as s,Fc as c,Gc as l,Hc as u,Ic as d,Jc as f,Kc as p,Lc as m,Mc as h,Nc as g,Oc as _,Pc as v,Qc as y,Rc as b,Uc as x,Vc as S,Wc as C,Xc as w,Yc as T,Zc as E,al as D,bB as O,cl as k,el as A,il as j,jc as M,kc as N,ll as P,nl as F,ol as I,qc as ee,rl as L,sl as R,t as z,tl as B,ul as V,xB as H,zc as U}from"./api-DS0UCfP0.js";import{t as W}from"./button-wZk4ylVE.js";import{U as G,ct as K}from"./index-SBKa9qhz.js";import{t as q}from"./DataTableShell-yD_nPHl_.js";var J=t(e(),1),Y=n(),X={hung:()=>ee(),wrong_result:()=>p(),error:()=>l(),other:()=>C()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=O(z.subAgentReports.respondToReport),[r,o]=(0,J.useState)(e.thread),[s,l]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1);async function _(){let t=s.trim();if(!(!t||f)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{p(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,x({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?a():U()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:b()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:m(),value:s,maxLength:2e3,rows:3,onChange:e=>l(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void _(),disabled:!s.trim()||f,children:f?c():d()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[v({count:t.children.length}),t.childrenTruncated?` ${g()}`:``,t.textTruncated?` ${h()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${M()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:i()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=H(z.subAgentReports.listForAdmin,{}),t=O(z.subAgentReports.readReport),n=O(z.subAgentReports.deleteReport),i=G(),[a,c]=(0,J.useState)(null),[l,u]=(0,J.useState)({});async function d(e){if(a===e._id){c(null);return}if(!l[e._id]){let n=await t({reportId:e._id});u(t=>({...t,[e._id]:n}))}c(e._id)}async function p(e){await i({title:_(),description:o(),confirmLabel:s(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&c(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,Y.jsx)(`strong`,{children:R()}),` `,I()]}),(0,Y.jsx)(q,{title:V(),rows:e,emptyHint:P(),isExpanded:e=>a===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Y.jsx)($,{data:l[e._id]}):null,columns:[{header:D(),cell:e=>K(e.at),sort:e=>e.at},{header:j(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:L(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:F(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${r({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:B(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:A(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:y()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:E()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?T():w(),onSelect:()=>void d(e)},{label:f(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,AF as i,AI as a,BF as o,CF as s,CI as c,Cc as l,DF as u,DI as d,EF as f,EI as p,FF as m,FI as h,GF as g,HF as _,IF as v,II as y,JF as b,KF as ee,LF as x,LI as te,MF as ne,MI as re,NF as ie,NI as ae,OF as oe,OI as se,PF as ce,PI as le,QF as ue,RF as de,RI as fe,SF as pe,SI as me,Sc as he,TF as ge,TI as _e,Tc as S,UF as ve,VF as ye,WF as be,XF as xe,YF as Se,ZF as Ce,_F as we,_I as Te,aI as Ee,bB as C,bF as De,bI as Oe,cB as ke,cI as Ae,dI as je,eI as Me,fI as Ne,gI as Pe,hI as Fe,iI as Ie,jF as Le,jI as Re,kF as ze,kI as w,lB as Be,lI as Ve,mI as He,nI as T,oI as Ue,pI as We,qF as Ge,r as Ke,rI as qe,sI as Je,t as E,tI as Ye,uB as Xe,uI as Ze,vB as Qe,vF as $e,vI as et,wF as tt,wI as nt,wc as D,xB as O,xF as k,xI as rt,yF as it,yI as at,zF as ot,zI as st}from"./api-DS0UCfP0.js";import{t as A}from"./x-DSVIpKLV.js";import{t as j}from"./button-wZk4ylVE.js";import{$ as M,Et as N,Fn as ct,Ft as lt,G as ut,It as P,K as dt,Lt as ft,Mt as pt,Nt as mt,Pn as F,Pt as I,Q as L,Un as R,X as z,Z as B,et as V,jt as H,ln as U,q as W,ut as G}from"./index-SBKa9qhz.js";import{t as ht}from"./localePickerView-C2RmOS86.js";import{a as gt,i as _t,n as vt,o as yt,r as bt,t as xt}from"./card-CurFse5M.js";import{a as St,i as K,n as Ct,o as q,r as J,t as wt}from"./table-DlldEKg7.js";import{t as Tt}from"./TimeRangePicker-BlCtUw8V.js";import{t as Et}from"./FilterBar-Dp85xc2n.js";import{t as Dt}from"./AdvancedFilter-BDMSRiwU.js";var Y=t(e(),1),Ot=.1,kt=[248,248,248],At=[24,24,24];function jt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Mt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Nt(e,t,n){return Mt(e,t,n)>=Ot}function Pt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Ft(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var It=12*1024*1024,Lt=480,Rt=160,zt=.92;async function Bt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(o());if(e.size>It)throw Error(ot());let{source:n,width:r,height:i,cleanup:a}=await Vt(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Lt/r,Rt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(x());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=jt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(x());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);Nt(e.data,d.width,d.height)?Pt(e.data,t.variantFor===`dark`?kt:At):Ft(e.data),p.putImageData(e,0,0)}let m=Nt(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await X(f,`image/webp`,zt)??await X(f,`image/png`);if(!h)throw Error(v());return{blob:h,hasAlpha:m}}finally{a()}}async function Vt(e){if(e.type===`image/svg+xml`)return Ht(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ht(e)}async function Ht(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(de())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Ut(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Wt={kind:`relative`,from:`now-24h`,to:`now`},Gt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Kt(e){return e===`light`?Xe():e===`dark`?Be():ke()}var qt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Jt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:qt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Yt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:Ke(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(R,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Jt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":S(),title:S(),children:(0,Z.jsx)(ct,{className:`size-4`})}):null]})}function Xt({selectedKey:e,resolvedMode:t}){let n=O(E.charts.listMyCharts),r=C(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Re()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Yt,{selected:e===null,title:w(),subtitle:se(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?d():n.via===`owner`?p():_e({group:n.via.group});return(0,Z.jsx)(Yt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Ut(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:nt()}):null]})}function Zt(){let e=C(E.charts.importChart),[t,n]=(0,Y.useState)(``),[r,i]=(0,Y.useState)(``),[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{i(await t.text())}catch{o(T())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Me());return}let a;try{a=JSON.parse(r)}catch{o(T());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ze()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,Z.jsx)(H,{value:t,onChange:e=>n(e.target.value),placeholder:Je(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:Ee(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(U,{className:`size-4`}),Ie(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,Z.jsx)(j,{size:`sm`,disabled:l,onClick:()=>void f(),children:qe()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ye()}):null]})]})}function Qt({chart:e}){let t=Qe(E.charts.setChartLogo),n=C(E.charts.removeChartLogo),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Bt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function d(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?Ge():ee()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(U,{className:`size-4`}),t?be():g(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:_()}):null,t?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:ve()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:b()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(f,{mode:`light`}),(0,Z.jsx)(f,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ye()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $t({chart:e}){let t=O(E.me.getMe,{host:W}),n=C(E.charts.addChartDomain),r=C(E.charts.removeChartDomain),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function f(){let t=a.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function p(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:m()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Le()}):d.map(e=>(0,Z.jsxs)(N,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":i({domain:e}),onClick:()=>void p(e),children:(0,Z.jsx)(A,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(H,{value:a,onChange:e=>o(e.target.value),placeholder:ie(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:ne()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ce()}),s?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function en(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=C(E.charts.updateChart),n=C(E.charts.deleteChart),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(e.name),[s,c]=(0,Y.useState)(()=>en(e.tokens)),[d,p]=(0,Y.useState)(e.tokens.bpm??0),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1);function v(){o(e.name),c(en(e.tokens)),p(e.tokens.bpm??0),h(null),i(!0)}async function y(){if(e.chartId===void 0)return;h(null);let n;try{n=JSON.parse(s)}catch{h(T());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;d>0?e.bpm=d:delete e.bpm}_(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){h(e instanceof Error?e.message:String(e))}finally{_(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(ge()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:v,children:xe()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:Se()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:u()}),(0,Z.jsx)(H,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>p(Number(e.target.value)),"aria-label":D()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?l():`${d} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:he()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),m?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,disabled:g,onClick:()=>void y(),children:ze()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:oe()})]})]}):null,(0,Z.jsx)(Qt,{chart:e}),(0,Z.jsx)($t,{chart:e})]})}function nn(){let e=O(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:r()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ce()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=C(E.charts.addChartToGroupPool),r=C(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(N,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Pe():e.kind===`custom`&&e.scope===`personal`?k():Te()}),e.isGlobalDefault?(0,Z.jsx)(N,{variant:`default`,children:Fe()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:We()}),(a??[]).map(e=>(0,Z.jsxs)(N,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":je({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(A,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(z,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(V,{placeholder:Ne()})}),(0,Z.jsx)(B,{children:s.map(e=>(0,Z.jsx)(L,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:He()}):null]})]})}function an({chart:e}){let t=C(E.charts.promoteChartToCommon),n=C(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(ge()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(N,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?De():k()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:pe({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:it()}):null,(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:$e()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(E.admin.setDefaultThemeMode),i=C(E.admin.setDefaultLocale),a=C(E.charts.setDefaultChart),o=O(E.charts.listChartsAdmin),l=O(E.groups.listGroups,{}),u=e??`system`,d=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:ae()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:re()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:c()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:w()}),dt.map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(rn,{chart:e,groups:l??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:at()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:et()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)($t,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:tt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:we()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(an,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:st()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(j,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Kt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:te()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:ht().map(e=>(0,Z.jsx)(j,{variant:d===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:h()})]})]})}function sn(){let e=O(E.me.getMe,{host:W}),t=ut(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Xt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Zt,{}),(0,Z.jsx)(nn,{}),e?.role===`admin`?(0,Z.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,Y.useState)(!0),[n,r]=(0,Y.useState)(`per-user`),[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(Q),[c,l]=(0,Y.useState)(Q),[u,d]=(0,Y.useState)(Wt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Wt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(sn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:le()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(j,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Small`}),(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{size:`lg`,children:`Large`}),(0,Z.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(N,{children:`Default`}),(0,Z.jsx)(N,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(N,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(N,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(H,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(z,{value:n,onValueChange:r,children:[(0,Z.jsx)(M,{className:`w-56`,children:(0,Z.jsx)(V,{placeholder:`Select…`})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(L,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(L,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(G,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(Et,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(z,{value:o,onValueChange:s,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(L,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(L,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(L,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(L,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(z,{value:c,onValueChange:l,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(L,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(L,{value:`info`,children:`info`}),(0,Z.jsx)(L,{value:`warn`,children:`warn`}),(0,Z.jsx)(L,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(Dt,{fields:Gt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Tt,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(pt,{children:[(0,Z.jsx)(ft,{asChild:!0,children:(0,Z.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(F,{})})}),(0,Z.jsxs)(mt,{align:`start`,children:[(0,Z.jsx)(lt,{children:`Actions`}),(0,Z.jsx)(P,{}),(0,Z.jsx)(I,{children:`Edit`}),(0,Z.jsx)(I,{children:`Duplicate`}),(0,Z.jsx)(P,{}),(0,Z.jsx)(I,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(xt,{className:`w-80`,children:[(0,Z.jsxs)(gt,{children:[(0,Z.jsx)(yt,{children:`Instance`}),(0,Z.jsx)(bt,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(vt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(_t,{className:`gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Save`}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(wt,{children:[(0,Z.jsx)(St,{children:(0,Z.jsxs)(q,{children:[(0,Z.jsx)(K,{className:`w-8`,children:(0,Z.jsx)(G,{"aria-label":`select all`})}),(0,Z.jsx)(K,{children:`Name`}),(0,Z.jsx)(K,{children:`Mode`}),(0,Z.jsx)(K,{className:`text-right`,children:`Status`}),(0,Z.jsx)(K,{className:`w-8`})]})}),(0,Z.jsx)(Ct,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(q,{children:[(0,Z.jsx)(J,{children:(0,Z.jsx)(G,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(J,{className:`font-medium`,children:e.n}),(0,Z.jsx)(J,{children:(0,Z.jsx)(N,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(J,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(R,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(J,{children:(0,Z.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(F,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Qy as i,Zy as a,ab as o,ao as s,cb as c,co as l,eb as u,ib as d,io as f,lb as p,lo as m,nb as h,ob as g,oo as _,rb as v,ro as y,sb as b,so as x,tb as S}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Qy as i,Zy as a,ab as o,ao as s,cb as c,co as l,eb as u,ib as d,io as f,lb as p,lo as m,nb as h,ob as g,oo as _,rb as v,ro as y,sb as b,so as x,tb as S}from"./api-DS0UCfP0.js";import{t as C}from"./button-wZk4ylVE.js";import{Ht as w,Ln as T,Ut as E,Vt as D,Wt as O,ct as k,jt as A,mn as j}from"./index-SBKa9qhz.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:p(),from:`now-5m`},{label:c(),from:`now-15m`},{label:b(),from:`now-30m`},{label:g(),from:`now-1h`},{label:o(),from:`now-3h`},{label:d(),from:`now-6h`},{label:v(),from:`now-12h`},{label:h(),from:`now-24h`},{label:S(),from:`now-2d`},{label:u(),from:`now-7d`},{label:r(),from:`now-30d`},{label:i(),from:`now-90d`},{label:a(),from:`now-520w`}];function L(e){return k(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[i,a]=(0,M.useState)(``),o=F(e),[c,u]=(0,M.useState)(()=>z(o.from)),[d,p]=(0,M.useState)(()=>z(o.to));function h(t){if(t){let t=F(e);u(z(t.from)),p(z(t.to)),a(``)}r(t)}function g(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function v(){let e=B(c),n=B(d);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=i.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[i]),S=B(c)!==null&&B(d)!==null;return(0,H.jsxs)(E,{open:n,onOpenChange:h,children:[(0,H.jsx)(O,{asChild:!0,children:(0,H.jsxs)(C,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(T,{}),R(e)]})}),(0,H.jsx)(w,{children:(0,H.jsx)(D,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:m()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,H.jsx)(A,{type:`datetime-local`,value:c,onChange:e=>u(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:x()}),(0,H.jsx)(A,{type:`datetime-local`,value:d,onChange:e=>p(e.target.value)})]}),(0,H.jsx)(C,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:v,children:_()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(j,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:i,onChange:e=>a(e.target.value),placeholder:s(),"aria-label":f()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:y()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>g(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BL as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BL as r,RL as i,VL as a,zL as o}from"./api-DS0UCfP0.js";import{t as s}from"./chevrons-up-down-D0x6gTDo.js";import{Bt as c,Rt as l,Un as u,jt as d,zt as f}from"./index-SBKa9qhz.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(d,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||i():e;return(0,D.jsxs)(l,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(c,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(s,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(f,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(d,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:r(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:o()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(u,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,$k as i,AA as a,BS as o,CA as s,D as c,DA as l,EA as u,FS as d,GS as f,Gk as p,HS as m,IS as h,JS as g,Jk as _,KS as v,Kk as y,LS as ee,MA as b,NA as x,NS as S,OA as C,PA as w,PS as T,QS as te,Qk as ne,RS as re,SA as E,TA as ie,US as ae,VS as oe,WS as se,XS as ce,Xk as le,YS as ue,Yk as de,ZS as fe,Zk as pe,_A as me,aA as he,aC as ge,aa as D,bA as O,bB as k,cC as _e,dA as A,dC as ve,eA as j,eC as ye,fA as M,fC as be,gA as N,gC as xe,hA as Se,hC as Ce,iA as we,iC as Te,ia as Ee,jA as De,kA as Oe,lC as ke,mA as Ae,mC as je,nA as Me,nC as Ne,oC as Pe,oa as Fe,pA as Ie,pC as Le,qS as Re,qk as ze,rA as Be,rC as Ve,sC as He,t as P,tA as Ue,tC as We,uA as Ge,uC as Ke,vA as qe,wA as Je,xA as F,xB as I,yA as Ye,zS as Xe}from"./api-DS0UCfP0.js";import{t as Ze}from"./x-DSVIpKLV.js";import{i as L,n as R,r as Qe,t as $e}from"./tabs-DJM-iyEY.js";import{t as z}from"./button-wZk4ylVE.js";import{$ as B,Et as V,Gn as et,H as tt,In as nt,Kn as rt,Mn as it,Nn as at,On as ot,Q as H,Un as st,X as U,Z as W,a as ct,at as lt,ct as G,et as K,i as ut,lt as dt,nt as ft,o as pt,ot as mt,q as ht,rt as gt,s as _t,tt as vt}from"./index-SBKa9qhz.js";import{n as yt}from"./TimeRangePicker-BlCtUw8V.js";import{t as bt}from"./FilterBar-Dp85xc2n.js";import{t as xt}from"./AdvancedFilter-BDMSRiwU.js";import{t as St}from"./DataTableShell-yD_nPHl_.js";var Ct=c(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Se():n===`agent`?`${Ae()} - ${r}`:e}function Tt(){let e=I(P.me.getMe,{host:ht})?.role===`admin`,t=I(P.deliveryTiming.getDeliveryStatus,{}),n=k(P.deliveryTiming.startDeliveryRecord),r=k(P.deliveryTiming.stopDeliveryRecord),[i,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),d=t?.recording??!1,f=async()=>{c(!0);try{d?await r({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:w()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}),e?(0,J.jsx)(z,{variant:d?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void f(),children:d?De():b()}):null]}),d?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(V,{variant:`secondary`,children:a()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:Oe({time:dt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:i?u():l()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=I(P.deliveryTiming.listDeliverySessions,{}),n=k(P.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=yt(c),m=c.to===`now`?1/0:p,h=r.trim()!==``||a!==`all`||c!==Y,g=()=>{i(``),o(`all`),l(Y)},_=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,m]),v=e=>{let t=new Set((_??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:Je(),timeRange:c,onTimeRangeChange:l,onReset:g,canReset:h,children:(0,J.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:`all`,children:s()}),(0,J.jsx)(H,{value:`active`,children:E()}),(0,J.jsx)(H,{value:`stopped`,children:F()})]})]})}),(0,J.jsx)(St,{title:ie(),rows:_,emptyHint:y(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?M():Ie(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(at,{size:15,"aria-hidden":!0}):(0,J.jsx)(it,{size:15,"aria-hidden":!0})})},{header:O(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:Ye(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:qe(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:me(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:N(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(V,{variant:`secondary`,children:E()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:F()})}],rowActions:e?e=>[{label:A(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:A(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=I(P.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(tt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()});let r=e.segments,a=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,p()]}),(0,J.jsxs)(z,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(st,{size:13,"aria-hidden":!0}):(0,J.jsx)(nt,{size:13,"aria-hidden":!0}),t?ze():_()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Be()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Me()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Ue()})]})}),(0,J.jsxs)(`tbody`,{children:[a(j(),r.bridge),a(i(),r.A),a(ne(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:de()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:le()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Fe()},{value:`principalType`,label:D()},{value:`direction`,label:`direction`},{value:`roleKey`,label:Ee()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=rt({from:`/settings/traces`}),t=et({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Q,s=e.principalType??Q,c=e.direction??Q,l=e.roleKey??Q,u=e.q??``,d=e.correlationId,p=ut(e.from,e.to),_=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:y,to:b}=yt(p),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),ie=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),me=e=>void t({search:t=>({...t,...pt(e)})}),D=e=>void t({search:t=>({...t,adv:ct(e)}),replace:!0}),O=I(P.observability.listEvents,{limit:n}),k=I(P.observability.listEvents,{limit:n,kind:i===Z?void 0:i,...d?{correlationId:d}:{},filter:{q:u||void 0,from:y,to:b,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:c===Q?void 0:c,roleKey:l===Q?void 0:l,advanced:_.length>0?_:void 0}}),A=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])e.add(t.kind);return[...e].sort()},[O]),j=(0,q.useMemo)(()=>{let e=new Set;for(let t of O??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[O]),M=u!==``||a!==Q||s!==Q||c!==Q||l!==Q||_.length>0||p.kind!==`relative`||p.from!==Nt.from;function N(){t({search:{limit:100,kind:`all`},replace:!0})}let Se=x?O?.filter(e=>e.correlationId===x):k,Ee=e.section,De=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)($e,{value:Ee,onValueChange:e=>De(e),children:[(0,J.jsxs)(Qe,{className:`w-full`,children:[(0,J.jsxs)(L,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(ot,{size:13,"aria-hidden":!0}),he()]}),(0,J.jsxs)(L,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),we()]})]}),(0,J.jsx)(R,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(R,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[xe(),(0,J.jsx)(`strong`,{children:Ce()}),je(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:Le()})]}),(0,J.jsxs)(bt,{q:u,onQChange:E,searchPlaceholder:be(),timeRange:p,onTimeRangeChange:me,onReset:N,canReset:M,children:[(0,J.jsxs)(U,{value:a,onValueChange:ie,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ve()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Ke()}),At.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:s,onValueChange:le,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:ke()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:_e()}),jt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:c,onValueChange:de,children:[(0,J.jsx)(B,{size:`sm`,className:`w-32`,children:(0,J.jsx)(K,{placeholder:He()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Pe()}),Mt.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsxs)(U,{value:l,onValueChange:pe,children:[(0,J.jsx)(B,{size:`sm`,className:`w-36`,children:(0,J.jsx)(K,{placeholder:ge()})}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{value:Q,children:Te()}),j.map(e=>(0,J.jsx)(H,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===Z?``:i,placeholder:Ve(),"aria-label":Ve(),onChange:e=>{let t=e.target.value.trim();ne(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:A.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(U,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,J.jsx)(B,{size:`sm`,className:`w-28`,children:(0,J.jsx)(K,{})}),(0,J.jsx)(W,{children:kt.map(e=>(0,J.jsx)(H,{value:String(e),children:Ne({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:_,onChange:D}),x?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>S(null),title:We(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ye(),(0,J.jsx)(`code`,{children:$(x)})]}),(0,J.jsx)(Ze,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:r()})]})}):null,(0,J.jsx)(St,{title:te(),rows:Se,emptyHint:x?fe():ce(),columns:[{header:ue(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:g(),sort:e=>e.kind,cell:e=>(0,J.jsx)(V,{variant:`secondary`,children:e.kind})},{header:Re(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":v(),children:`✓`})}},{header:f(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(V,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:se(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(V,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:ae(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(V,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:m(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:oe(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:o(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Xe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:re(),onClick:()=>S(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:h()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:C,onClose:()=>w(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(vt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ft,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(mt,{className:`oc-traces__meta-title`,children:[d(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(V,{variant:`outline`,children:T()})]}),(0,J.jsx)(gt,{children:S()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$x as i,BD as a,FD as o,Fp as s,GD as c,Gx as l,HD as u,ID as d,JD as f,Jx as p,KD as
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,$x as i,BD as a,FD as o,Fp as s,GD as c,Gx as l,HD as u,ID as d,JD as f,Jx as p,KD as m,Kx as h,LD as ee,Np as g,PD as te,Pp as _,QD as ne,Qx as v,RD as y,UD as re,VD as ie,WD as ae,XD as oe,Xx as b,YD as se,Yx as x,ZD as ce,Zx as S,aO as C,bB as w,cO as T,eO as le,eS as E,hD as ue,iO as de,nO as fe,nS as D,oO as O,qD as pe,qx as k,rO as me,rS as A,sO as j,t as M,tO as he,tS as N,xB as P,zD as ge}from"./api-DS0UCfP0.js";import{t as F}from"./button-wZk4ylVE.js";import{$ as I,Dt as L,Et as R,Ft as z,Gn as _e,Kn as ve,Lt as ye,Mt as be,Nt as xe,Pt as Se,Q as B,U as Ce,W as we,X as V,Z as H,at as Te,c as U,et as W,fn as G,l as Ee,nt as De,ot as Oe,pn as K,q as ke,rt as Ae,tt as je,u as q,ut as J}from"./index-SBKa9qhz.js";import{t as Y}from"./FilterBar-Dp85xc2n.js";import{t as Me}from"./DataTableShell-yD_nPHl_.js";import{t as Ne}from"./DetailChips-DVgEoxGq.js";var X=t(e(),1),Z=n();function Pe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let a=P(M.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),o=P(M.agents.listUserAgents,n&&e?{profileId:e}:`skip`),s=new Set((o??[]).map(e=>`${e.instanceName}/${e.agentId}`)),c=(o??[]).find(e=>e.isDefault)??null,l=c?`${c.instanceName}/${c.agentId}`:null,u=new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),d=[...(a?.agents??[]).map(e=>({...e,outOfPool:!1})),...(o??[]).filter(e=>!u.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],f=new Map;for(let e of d){let t=f.get(e.instanceName)??[];t.push(e),f.set(e.instanceName,t)}return(0,Z.jsx)(je,{open:n,onOpenChange:r,children:(0,Z.jsxs)(De,{className:`oc-access`,children:[(0,Z.jsxs)(Te,{children:[(0,Z.jsx)(Oe,{children:A({user:t})}),(0,Z.jsx)(Ae,{children:D()})]}),a?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:a.inGroup?N():E()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:a===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i()}):d.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:b()}):[...f.entries()].map(([t,n])=>(0,Z.jsx)(Fe,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:s,defaultKey:l},t))})]})})}function Fe({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let o=w(M.agents.assignAgent),s=w(M.agents.removeAgent),c=w(M.agents.setDefaultAgent),u=L();if(!e)return null;async function d(n,r){try{r?await s({profileId:e,instanceName:t,agentId:n}):await o({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(v(),e)}}async function f(n){try{await c({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(S(),e)}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(K,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(J,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":x({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:p()}):null,e.outOfPool?(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:k()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":h(),title:h(),children:(0,Z.jsx)(G,{size:14,fill:`currentColor`})}):(0,Z.jsx)(F,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":l(),title:l(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(G,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return g();case`user`:return _();case`admin`:return s();default:return e}}function Ie({granted:e,onToggle:t}){let n=new Set(e),r=U.filter(e=>n.has(q[e])).length;return(0,Z.jsxs)(be,{children:[(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsx)(F,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?T():j({count:r})})}),(0,Z.jsxs)(xe,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(z,{children:O()}),U.map(e=>{let r=q[e];return(0,Z.jsxs)(Se,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(J,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:Ee[e]()})]},e)})]})]})}function Le(){let e=ve({from:`/settings/users`}),t=_e({from:`/settings/users`}),n=e.q??``,i=e.role??Q,s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),p=P(M.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),h=P(M.me.getMe,{host:ke}),g=w(M.admin.setRole),_=w(M.admin.setUserPermissions),v=w(M.admin.startImpersonation),b=w(M.admin.deleteUser),x=w(M.admin.setUserName),S=Ce(),T=we(),E=L(),[D,O]=(0,X.useState)(null),k=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of p??[])e.add(t.role);return[...e]},[p]),A=n!==``||i!==Q;function j(){t({search:{},replace:!0})}async function N(e){try{await g(e)}catch(e){E.error(C(),e)}}async function F(e){try{await _(e)}catch(e){E.error(de(),e)}}async function R(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:ce(),description:oe({user:t}),confirmWord:se(),confirmLabel:f(),destructive:!0}))try{await b({profileId:e._id}),E.success(m({user:t}))}catch(e){E.error(pe(),e)}}async function z(e){let t=e.email||e.name||e.userId.slice(0,8),n=await T({title:ae(),label:re({user:t}),placeholder:u(),defaultValue:e.name??``,confirmLabel:ue()});if(n!==null)try{await x({profileId:e._id,name:n}),E.success(ie())}catch(e){E.error(a(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{q:n,onQChange:s,searchPlaceholder:me(),onReset:j,canReset:A,children:(0,Z.jsxs)(V,{value:i,onValueChange:l,children:[(0,Z.jsx)(I,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:Q,children:fe()}),k.map(e=>(0,Z.jsx)(B,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Me,{title:he(),rows:p,emptyHint:le(),rowActions:e=>{let t=[{label:te(),onSelect:()=>O({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:c(),onSelect:()=>void z(e)}];return e.userId!==h?.userId&&t.push({label:r(),onSelect:()=>void v({profileId:e._id})},{label:ne(),variant:`destructive`,onSelect:()=>void R(e)}),t},columns:[{header:ge(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:y(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(V,{value:e.role,onValueChange:t=>void N({profileId:e._id,role:t}),children:[(0,Z.jsx)(I,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(B,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(B,{value:`user`,children:$(`user`)}),(0,Z.jsx)(B,{value:`admin`,children:$(`admin`)})]})]})},{header:ee(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:d()}):(0,Z.jsx)(Ie,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),F({profileId:e._id,permissions:[...n]})}})},{header:o(),cell:e=>(0,Z.jsx)(Ne,{icon:(0,Z.jsx)(K,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Pe,{profileId:D?.profileId??null,userLabel:D?.label??``,open:D!==null,onOpenChange:e=>{e||O(null)}})]})}export{Le as UsersTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,Ci as i,In as a,Jn as o,Sd as ee,Si as s,Ti as c,Xn as te,Yn as ne,Zn as l,_i as u,ai as d,ar as f,bB as p,bi as m,ci as h,cr as g,di as re,er as _,fB as v,fi as y,fk as b,gi as x,gr as S,hi as ie,ii as C,li as ae,lr as oe,mB as se,mi as w,ni as T,nr as E,oi as D,or as O,pi as k,qf as A,ri as ce,si as j,sr as M,t as N,ti as le,tr as ue,ui as de,vB as fe,vi as pe,wd as P,wi as F,xB as I,xi as L,yi as R}from"./api-DS0UCfP0.js";import{i as z,n as B,r as me,t as he}from"./tabs-DJM-iyEY.js";import{t as V}from"./button-wZk4ylVE.js";import{$ as H,$t as ge,Cn as _e,Et as U,Gn as ve,Kn as ye,Q as W,Wn as be,X as G,Z as K,an as xe,en as Se,et as q,in as J,nn as Ce,q as we,rn as Y,sn as Te,tn as Ee,ut as X}from"./index-SBKa9qhz.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>pe()],[`fr-FR`,()=>oe()],[`en-US`,()=>g()],[`en-GB`,()=>M()],[`de-DE`,()=>O()],[`es-ES`,()=>f()]],Oe=[[`0.75`,()=>x()],[`1`,()=>ie()],[`1.25`,()=>w()],[`1.5`,()=>k()]],$=0;function ke({instance:e}){let t=p(N.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,s]=(0,Z.useState)(r),[c,d]=(0,Z.useState)(`idle`),[f,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(!1),b=fe(N.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{s({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),d(`idle`)},[e._id]);let x=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function S(){d(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),d(`idle`)}catch{d(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:i.enabled,onCheckedChange:e=>s({...i,enabled:e===!0}),"aria-label":m()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,Q.jsxs)(G,{value:i.engine,onValueChange:e=>s({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":l(),children:(0,Q.jsx)(q,{})}),(0,Q.jsxs)(K,{children:[(0,Q.jsx)(W,{value:`browser`,children:te()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:ne()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()}):null,i.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:R()}),(0,Q.jsxs)(G,{value:i.lang,onValueChange:e=>s({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":R(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,Q.jsxs)(G,{value:i.rate,onValueChange:e=>s({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":u(),children:(0,Q.jsx)(q,{})}),(0,Q.jsx)(K,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:i.autoRead,onCheckedChange:e=>s({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":y()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:re()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!x||c===`saving`,onClick:()=>void S(),children:c===`saving`?A():P()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!i.enabled||f,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(v(!1),J(),Y(),i.engine!==`gateway`){Ce(h(),{lang:Ee(i.lang,se()),rate:t});return}g(!0),b({instanceName:e.name,text:h()}).then(({mime:e,audioBase64:r})=>{n===$&&Se(r,e,{rate:t})}).catch(()=>{n===$&&v(!0)}).finally(()=>g(!1))},children:f?A():de()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,g(!1),J(),Y()},children:ae()})]}),c===`error`||_?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_?a():ee()}):null]})}function Ae({stt:e}){let t=I(N.me.getMe,{host:we}),n=p(N.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:D()}),(0,Q.jsx)(U,{variant:e?`secondary`:`outline`,children:e?T():le()}),(0,Q.jsx)(U,{variant:r?`secondary`:`destructive`,children:r?ue():_()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":E()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:d()})]})}function je(){let e=I(N.admin.listInstances,{}),t=(0,Z.useMemo)(()=>xe(),[]),n=(0,Z.useMemo)(()=>ge(),[]),{section:a}=ye({from:`/settings/voice`}),o=ve({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:c()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(U,{variant:t?`secondary`:`destructive`,children:t?F():i()}),(0,Q.jsx)(U,{variant:n?`secondary`:`destructive`,children:n?s():L()})]}),(0,Q.jsxs)(he,{value:a,onValueChange:e=>void o({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(me,{className:`w-full`,children:[(0,Q.jsxs)(z,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),r()]}),(0,Q.jsxs)(z,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),D()]}),(0,Q.jsxs)(z,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(be,{size:13,"aria-hidden":!0}),C()]})]}),(0,Q.jsx)(B,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(B,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(B,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:C()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:j()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=p(N.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(U,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:S()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":b()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()})]})]})}export{je as VoiceTab};
|