@lacneu/atrium 0.84.4 → 0.84.6
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{$w as e,Qw as t,Xw as n,Yw as r,Zw as i}from"./api-DS0UCfP0.js";var a={pending:e,user:t,admin:i,observer:n,agent:r};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-
|
|
1
|
+
import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-DS0UCfP0.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-DS0UCfP0.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-SBKa9qhz.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...p}=e,m=f(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:d,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as e}from"./api-DS0UCfP0.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
|
package/dist/index.html
CHANGED
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
document.documentElement.dataset.motion = "static";
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
|
-
<script type="module" crossorigin src="/assets/index-
|
|
65
|
+
<script type="module" crossorigin src="/assets/index-SBKa9qhz.js"></script>
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
|
|
67
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/dist-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/x-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/button-
|
|
72
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
67
|
+
<link rel="modulepreload" crossorigin href="/assets/api-DS0UCfP0.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-5dg443OC.js">
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/dist-C5S0CMYi.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/x-DSVIpKLV.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/button-wZk4ylVE.js">
|
|
72
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BpLlUFfO.css">
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
|
75
75
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lacneu/atrium",
|
|
3
|
-
"version": "0.84.
|
|
3
|
+
"version": "0.84.6",
|
|
4
4
|
"description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Bd as i,Bo as a,Fd as o,Fo as s,Gd as c,Gf as l,Go as u,Hd as d,Ho as f,Id as p,Io as m,Jd as h,Jo as g,Jt as _,Kd as v,Ko as y,Ld as b,Lo as x,Md as S,Mo as C,Nd as w,No as T,Pd as E,Po as D,Qd as O,Qo as k,Rd as ee,Ro as A,Ud as j,Uo as M,Vd as N,Vo as P,Wd as te,Wo as F,Xd as I,Xo as L,Yd as ne,Yo as re,Zd as R,Zo as z,_B as B,af as V,bB as H,dB as U,do as ie,ef as ae,fo as oe,gM as se,go as ce,ho as le,if as ue,mo as de,nf as fe,of as pe,pB as W,po as me,qd as he,qf as G,qo as K,rf as ge,sf as _e,t as q,tf as ve,uo as ye,yB as be,zd as xe,zo as Se}from"./api-NzmVMBHn.js";import{t as J}from"./button-BHiy_q9F.js";import{$ as Ce,B as we,Ct as Te,Dt as Y,Et as Ee,Q as De,St as Oe,Tt as ke,X as Ae,Z as je,at as Me,bt as Ne,et as Pe,nt as Fe,ot as Ie,q as Le,rt as Re,tt as ze,un as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-DRTZkZgA.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-DaOCauKc.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
|
|
2
|
-
`))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
|
|
3
|
-
`))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=H(q.me.getMe,{host:Le}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=H(q.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[t,i,a]);let s=H(q.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),c=H(q.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||s===void 0?i!==void 0&&i.length===0?[]:void 0:s.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(c!==void 0)return c.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,s,i,c]),[d,f]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let p=u?.find(e=>$(e)===d)??null,m=B(q.agentFiles.listAgentFiles),[h,v]=(0,X.useState)({status:`idle`}),y=p?.instanceName??null,b=p?.agentId??null,x=H(q.compat.forInstance,n&&y!==null?{instanceName:y}:`skip`),S=n&&y!==null?we(x,`agentFiles`):null,C=S===null?!1:S===`loading`?null:S.blocked,w=(0,X.useCallback)(async()=>{if(!(y===null||b===null)){v({status:`loading`});try{v({status:`done`,files:(await m({instanceName:y,agentId:b})).files})}catch(e){v({status:`error`,dashboardAbsent:tt(e)})}}},[m,y,b]);(0,X.useEffect)(()=>{C===!1&&w()},[w,C]);let[T,E]=(0,X.useState)(null),D=H(q.agentFileCuration.listCurations,t&&y!==null&&b!==null?{instanceName:y,agentId:b}:`skip`),k=H(q.agentFileCuration.curationSettings,t&&y!==null?{instanceName:y}:`skip`),ee=B(q.agentFileCuration.requestCuration),[A,j]=(0,X.useState)(null),[M,N]=(0,X.useState)(null),{toast:P}=Y(),te=(0,X.useMemo)(()=>{let e=new Map;for(let t of D??[])e.has(t.name)||e.set(t.name,t);return e},[D]),F=(0,X.useCallback)(async e=>{if(!(y===null||b===null)){j(e);try{let t=await ee({instanceName:y,agentId:b,name:e,trigger:`manual`});t.ok?P({title:re(),variant:`success`}):P({title:g({reason:t.reason??`unknown`}),variant:`error`})}catch{P({title:K(),variant:`error`})}finally{j(null)}}},[ee,y,b,P]),L=W(),z=(0,X.useMemo)(()=>new Intl.NumberFormat(L,{maximumFractionDigits:0}),[L]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ae,{value:a??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ce,{size:`sm`,"aria-label":pe(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:(i??[]).map(e=>(0,Q.jsx)(De,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ae,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(Ce,{size:`sm`,"aria-label":V(),children:(0,Q.jsx)(Pe,{})}),(0,Q.jsx)(je,{children:u.map(e=>(0,Q.jsx)(De,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()})]}),p===null?null:S===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):S!==null&&S.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Be,{size:14,"aria-hidden":!0}),` `,qe(S.gatewayVersion,S.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?_():fe(),` `,!h.dashboardAbsent&&(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:l()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Xe(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Ee,{variant:`outline`,children:ve()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ae({size:Z(e.size,L)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:r({pct:z.format(n)})}),i?(0,Q.jsx)(Be,{size:14,className:`oc-afiles__warn`,"aria-label":O()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>E(e),children:t?I():ne()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:k?.budgetChars??null,enabled:k?.enabled??!1,curation:te.get(e.name)??null,inFlight:A===e.name,onCurate:()=>void F(e.name),onReview:e=>N(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:R({used:Z(Qe(h.files),L),total:Z(Ye,L),pct:z.format(Ze(Qe(h.files)))})})]}),T&&p?(0,Q.jsx)(at,{instanceName:p.instanceName,agentId:p.agentId,name:T.name,isAdmin:t,onClose:()=>E(null),onSaved:()=>void w()}):null,M?(0,Q.jsx)(ot,{curationId:M,onClose:()=>N(null),onApplied:()=>{N(null),w()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(J,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:z()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Ee,{variant:`outline`,className:`oc-afiles__curate-status`,children:L()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(J,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:k()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:s}){let u=B(q.agentFiles.getAgentFile),f=B(q.agentFiles.setAgentFile),m=Y(),[g,_]=(0,X.useState)(null),[y,x]=(0,X.useState)(!1),[C,T]=(0,X.useState)(``),[D,O]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),[M,P]=(0,X.useState)(!1),[F,I]=(0,X.useState)(!1),L=(0,X.useCallback)(async r=>{x(!1);try{let i=await u({instanceName:e,agentId:t,name:n});_({content:i.content,updatedAtMs:i.updatedAtMs}),r||T(i.content),P(!1)}catch{x(!0)}},[u,e,t,n]);(0,X.useEffect)(()=>{L(!1)},[L]);async function ne(){if(g!==null){A(!0),I(!1);try{await f({instanceName:e,agentId:t,name:n,content:C,baseUpdatedAtMs:g.updatedAtMs??void 0}),m.success(d({name:n})),s(),await L(!1)}catch(e){nt(e)?P(!0):I(!0)}finally{A(!1)}}}let re=g!==null&&C!==g.content,R=(0,X.useMemo)(()=>g===null?null:et(g.content,C),[g,C]),z=C.length>Je,V=W(),H=(0,X.useMemo)(()=>new Intl.NumberFormat(V),[V]);return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ie,{children:h({name:n})}),(0,Q.jsxs)(Re,{children:[he({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,v()]})]})]}),y?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[i(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:l()})]}):g===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:C,readOnly:!r,spellCheck:!1,onChange:e=>T(e.target.value),"aria-label":h({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:c()}),M?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[xe(),` `,(0,Q.jsx)(J,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:ee()})]}):null,F?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:N()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${z?` is-over`:``}`,children:te({count:H.format(C.length),max:H.format(Je)})}),r?(0,Q.jsx)(J,{size:`sm`,disabled:!re||k||M,onClick:()=>O(!0),children:k?G():j()}):null]})]}),(0,Q.jsx)(Ve,{open:D,onOpenChange:O,children:(0,Q.jsxs)(Ue,{children:[(0,Q.jsxs)(He,{children:[(0,Q.jsx)(ke,{children:b({name:n})}),(0,Q.jsx)(Oe,{children:p({agent:t})})]}),R?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:o({added:R.added,removed:R.removed})}),R.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:E()}),R.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,R.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:w()}),R.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Te,{children:[(0,Q.jsx)(Ne,{children:se()}),(0,Q.jsx)(We,{onClick:()=>void ne(),children:S()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=H(q.agentFileCuration.getProposal,{curationId:e}),i=B(q.agentFileCuration.approveCuration),o=be(q.agentFileCuration.rejectCuration),{toast:c}=Y(),[l,d]=(0,X.useState)(null),[p,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(``),v=W(),b=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function S(){d(`approve`);try{let t=await i({curationId:e});t.ok?(c({title:y(),variant:`success`}),n()):c({title:t.reason===`conflict`?F():M({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:K(),variant:`error`})}finally{d(null)}}async function w(n){d(`reject`);try{let r=g.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?c({title:n?ie():u(),variant:`success`}):c({title:a(),variant:`error`}),t()}catch{c({title:K(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(ze,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ie,{children:r?f({name:r.name}):U()}),(0,Q.jsx)(Re,{children:P()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:U()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[Se({before:Z(r.beforeSize,v),after:Z(r.proposedSize,v)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Be,{size:13,"aria-hidden":!0}),` `,A()]}):null]}),b?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:x({added:b.added,removed:b.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ye({feedback:r.feedback})}):null,b&&b.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:C()}),(0,Q.jsx)(`ul`,{children:b.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:T()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:m()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),p?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:ce()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:le(),value:g,onChange:e=>_(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:de()}),(0,Q.jsx)(J,{variant:`outline`,onClick:()=>void w(!1),disabled:l!==null,children:l===`reject`?G():me()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void w(!0),disabled:l!==null,children:l===`reject`?G():oe()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(J,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:s()}),(0,Q.jsx)(J,{variant:`default`,onClick:()=>void S(),disabled:l!==null||r==null,children:l===`approve`?G():D()})]})]})})}export{rt as AgentFilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BT as i,FT as a,HT as o,IT as s,LT as c,MT as l,NT as u,PT as d,RT as f,UT as p,VT as m,WT as h,bB as g,ca as _,da as v,fa as y,jT as b,la as x,sa as S,t as C,ua as w,zT as T}from"./api-NzmVMBHn.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-DRTZkZgA.js";import{n as ee}from"./TimeRangePicker-BNzXp6XH.js";import{t as z}from"./FilterBar-BB9HpiR0.js";import{t as B}from"./AdvancedFilter-BbGwAk2J.js";import{t as V}from"./DataTableShell-tMQLeAkL.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:y()},{value:`realLabel`,label:v()},{value:`targetLabel`,label:w()},{value:`impersonated`,label:x()},{value:`resource`,label:_()},{value:`resourceId`,label:S()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,_=e.action??G,v=e.impersonated??G,y=e.resource??G,x=F(e.from,e.to),S=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:w,to:I}=ee(x),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=g(C.admin.listAudit,{filter:{q:n||void 0,from:w,to:I,action:_===G?void 0:_,resource:y===G?void 0:y,impersonated:v===G?void 0:v===`yes`,advanced:S.length>0?S:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||_!==G||v!==G||y!==G||S.length>0||x.kind!==`relative`||x.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:o(),timeRange:x,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:_,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:m()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:i()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:v,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:T()}),(0,U.jsx)(k,{value:`yes`,children:f()}),(0,U.jsx)(k,{value:`no`,children:c()})]})]}),(0,U.jsxs)(A,{value:y,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:s()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:a()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:S,onChange:Q}),(0,U.jsx)(V,{title:d(),rows:$,emptyHint:u(),columns:[{header:l(),cell:e=>N(e.at),sort:e=>e.at},{header:m(),cell:e=>e.action,sort:e=>e.action},{header:b(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:r(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:s(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,AO as i,BO as a,CO as o,DO as s,EO as c,FO as l,GO as u,HO as d,IO as f,JO as p,KO as ee,LO as te,MO as m,NO as h,OO as ne,PO as g,QO as _,RO as re,SO as v,TO as y,UO as ie,VO as ae,WO as b,XO as oe,YO as x,ZO as S,_O as C,ak as w,bB as T,bO as E,cO as D,ck as O,dO as k,ek as A,fO as j,gO as M,hO as N,ik as P,is as F,jO as I,kO as L,lO as R,lk as z,mO as B,nk as V,ns as H,ok as U,pO as W,qO as se,rk as G,sk as K,t as q,tk as ce,uO as le,uk as ue,vO as de,wO as fe,xO as pe,yB as J,yO as me,zO as he}from"./api-NzmVMBHn.js";import{t as ge}from"./button-BHiy_q9F.js";import{U as _e,ct as Y}from"./index-DRTZkZgA.js";import{t as ve}from"./DataTableShell-tMQLeAkL.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>ue(),incorrect:()=>z(),incoherence:()=>O(),formatting:()=>K(),latency:()=>U(),api_error:()=>w(),other:()=>P()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:V()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:ce()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:G()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=J(q.feedback.respondToFeedback),[s,c]=(0,X.useState)(e.thread),[m,h]=(0,X.useState)(``),[v,y]=(0,X.useState)(!1);async function C(){let t=m.trim();if(!(!t||v)){y(!0);try{await o({feedbackId:e._id,text:t}),c(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),h(``)}finally{y(!1)}}}let w=[];try{w=i.contextJson?JSON.parse(i.contextJson):[]}catch{w=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${A()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:ne(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:B()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:_()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?S():e.authorRole===`agent`?e.authorLabel??F():oe()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:x()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:p(),value:m,maxLength:2e3,rows:3,onChange:e=>h(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void C(),disabled:!m.trim()||v,children:v?se():ee()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:u()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||b()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||b()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,w.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae({count:i.contextCount??w.length,truncated:i.contextTruncated?a():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:he()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:te()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?f({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[l(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,g()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=T(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=_e(),[a,l]=(0,X.useState)(null),[u,d]=(0,X.useState)({});async function f(e){if(a===e._id){l(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});d(t=>({...t,[e._id]:n}))}l(e._id)}async function p(e){await r({title:le(),description:R(),confirmLabel:D(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&l(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,Z.jsx)(`strong`,{children:m()}),` `,I()]}),(0,Z.jsx)(ve,{title:i(),rows:e,emptyHint:L(),isExpanded:e=>a===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:s(),cell:e=>Y(e.at),sort:e=>e.at},{header:c(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:y(),cell:e=>e.messageRole===`user`?fe():o(),sort:e=>e.messageRole},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${pe({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:E(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:me(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:de(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:C()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:M()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:H()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:N()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?W():j(),onSelect:()=>void f(e)},{label:k(),onSelect:()=>void p(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as ee,Az as r,Cz as i,Dz as a,Ez as o,Mz as te,Oz as s,QR as ne,Sz as re,Tz as c,ZR as l,_z as u,az as d,bB as f,bz as p,cs as m,cz as ie,dB as ae,dz as oe,ez as se,fz as ce,gM as le,gz as h,hz as g,iz as ue,jz as de,kz as _,lz as fe,mz as pe,nz as me,oz as he,pB as ge,pz as _e,rz as ve,ss as ye,sz as be,t as v,tz as y,uz as b,vz as x,wz as S,xz as C,yB as w,yz as T}from"./api-NzmVMBHn.js";import{t as E}from"./button-BHiy_q9F.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-DRTZkZgA.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-BKRXY_Eg.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return C();case`audio`:return p();case`video`:return T();case`pdf`:return x();case`document`:return u();case`archive`:return h();default:return g()}}function K(){let[e,t]=(0,H.useState)(W),[n,u]=(0,H.useState)(W),[p,h]=(0,H.useState)(W),[g,x]=(0,H.useState)(W),[C,T]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=w(v.files.softDelete),Y=k();function Ie(){t(W),u(W),h(W),x(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ue())}catch(e){Y.error(ve(),e)}}let X=f(v.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:p===W?void 0:p,category:g===W?void 0:g,includeAutoGenerated:C||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ge(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:ae()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||p!==W||g!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":de(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:r()}),(0,U.jsx)(F,{value:`inbound`,children:_()}),(0,U.jsx)(F,{value:`outbound`,children:s()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:u,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":a(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:o()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:p,onValueChange:h,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":c(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:S()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:g,onValueChange:x,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":i(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:re()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:C,onCheckedChange:e=>T(e===!0),"aria-label":m()}),(0,U.jsx)(`span`,{children:m()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),be()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?ne():ee()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:pe()}),(0,U.jsx)(z,{children:_e()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{children:oe()}),(0,U.jsx)(z,{children:b()}),(0,U.jsx)(z,{className:`text-right`,children:fe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:ye()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?_():s()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),ie()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),se()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),d()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:l({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:me()}),(0,U.jsx)(Ce,{children:y()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:le()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:d()})]})]})})]})}export{K as FilesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,$T as i,AD as a,AE as o,B as s,BE as c,Bi as l,CD as u,CE as d,DD as f,DE as p,ED as m,EE as h,F as g,FE as _,G as v,GE as y,GT as b,H as x,HE as S,I as C,IE as w,JE as T,JT as E,K as D,KE as ee,KT as te,L as ne,LE as re,M as ie,MD as ae,ME as oe,Mx as se,N as ce,ND as le,NE as ue,Nx as de,OD as fe,OE as pe,P as me,PD as he,PE as ge,QE as _e,QT as ve,R as ye,RE as be,Ri as xe,SD as Se,SE as Ce,TD as we,TE as Te,U as Ee,UE as De,V as Oe,VE as ke,W as Ae,WE as je,XE as Me,XT as Ne,YE as Pe,YT as Fe,ZE as Ie,ZT as Le,_B as O,_D as Re,_E as ze,_N as k,aD as Be,aE as Ve,bB as A,bD as j,bE as M,cD as He,cE as Ue,dD as We,dE as Ge,eD as Ke,eE as qe,fD as Je,fE as Ye,gD as Xe,gE as Ze,gc as Qe,hD as $e,hE as N,hc as et,iD as tt,iE as nt,j as rt,jD as it,jE as at,kD as ot,kE as st,lD as ct,lE as lt,mD as ut,mc as dt,nD as ft,nE as pt,oD as mt,oE as ht,pD as gt,pE as _t,pc as vt,q as yt,qE as bt,qT as xt,rD as St,rE as Ct,sD as wt,sE as Tt,t as P,tD as Et,tE as Dt,uD as Ot,uE as kt,vD as At,vE as jt,vN as Mt,wD as Nt,wE as Pt,xD as Ft,xE as It,yB as F,yD as Lt,yE as Rt,z as zt,zE as Bt,zi as Vt}from"./api-NzmVMBHn.js";import{a as Ht,c as Ut}from"./FieldLabel-D-1TOAEd.js";import{t as I}from"./button-BHiy_q9F.js";import{$ as L,Bt as Wt,Dt as R,Et as z,Q as B,Rt as Gt,U as Kt,X as V,Z as H,_ as qt,at as U,et as W,jt as G,nt as K,ot as q,rt as Jt,tt as Yt,ut as Xt,zt as Zt}from"./index-DRTZkZgA.js";import{t as Qt}from"./DataTableShell-tMQLeAkL.js";import{InstanceConfigDialog as $t}from"./BridgeTab-fCJQhfcl.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],en=new Set(Y),tn=`conversational`;function nn(e){let t=new Set((e??[]).filter(e=>en.has(e)));return t.size===0?[tn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Ht},rn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function an(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function on(){let e=A(P.admin.listInstances,{}),t=A(P.agents.listAllInstanceAgents,{}),n=F(P.admin.upsertInstance),r=F(P.admin.deleteInstance),i=R(),[o,c]=(0,J.useState)(!1),[d,p]=(0,J.useState)(Z),[h,_]=(0,J.useState)(null),[y,b]=(0,J.useState)(null),[S,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null);async function ee(){try{await n({instanceId:T??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,...d.kind===`openclaw`?{authMode:d.authMode,personScopes:d.personScopes,identitySource:d.identitySource,systemIdentity:d.systemIdentity||void 0}:{},streamTransport:d.streamTransport}),p(Z),E(null),c(!1)}catch(e){i.error(ae(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[it(),(0,X.jsx)(`strong`,{children:a()}),ot()]}),(0,X.jsx)(Qt,{title:fe(),rows:e,addLabel:f(),onAdd:()=>{E(null),p(Z),c(!0)},emptyHint:m(),columns:[{header:we(),cell:e=>e.name,sort:e=>e.name},{header:Nt(),cell:e=>(0,X.jsx)(z,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:u(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Se(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:he(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(z,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?te():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:At(),onSelect:()=>{E(e._id),p(an(e)),c(!0)}},{label:le(),onSelect:()=>_(e.name)},{label:St(),onSelect:()=>w(e)},{label:Ft(),onSelect:()=>b(e)},{label:j(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:j(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,X.jsx)(qt,{open:o,onOpenChange:c,title:T?Re():Lt(),description:$e(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:ee,submitLabel:ut(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:gt(),children:[(0,X.jsx)(G,{value:d.name,disabled:T!==null,onChange:e=>p({...d,name:e.target.value})}),T?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Xe()}):null]}),(0,X.jsx)($,{label:Je(),children:(0,X.jsxs)(V,{value:d.kind,onValueChange:e=>p({...d,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(B,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,X.jsx)($,{label:l(),children:(0,X.jsxs)(V,{value:d.transport,onValueChange:e=>p({...d,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`ws`,children:Vt()}),(0,X.jsx)(B,{value:`rest`,children:xe()})]})]})}):null,(0,X.jsx)($,{label:We(),children:(0,X.jsx)(G,{value:d.gatewayUrl,onChange:e=>p({...d,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:Ot(),children:(0,X.jsx)(G,{value:d.bridgeUrl,placeholder:ct(),onChange:e=>p({...d,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:He(),children:(0,X.jsx)(G,{value:d.displayName,onChange:e=>p({...d,displayName:e.target.value})})}),(0,X.jsxs)($,{label:de(),children:[(0,X.jsxs)(V,{value:d.streamTransport,onValueChange:e=>p({...d,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsx)(H,{children:Ut.map(e=>(0,X.jsx)(B,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:se()})]}),(0,X.jsx)($,{label:wt(),children:(0,X.jsx)(G,{value:d.gatewayVersion,placeholder:mt(),onChange:e=>p({...d,gatewayVersion:e.target.value})})}),d.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:ne(),children:[(0,X.jsxs)(V,{value:d.authMode,onValueChange:e=>p({...d,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`token`,children:C()}),(0,X.jsx)(B,{value:`trusted-proxy`,children:g()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:d.authMode===`trusted-proxy`?ce():me()})]}),d.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:yt(),children:[(0,X.jsxs)(V,{value:d.personScopes,onValueChange:e=>p({...d,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`capped`,children:D()}),(0,X.jsx)(B,{value:`full`,children:v()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:d.personScopes===`full`?Ee():Ae()})]}):null,d.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:x(),children:[(0,X.jsxs)(V,{value:d.identitySource,onValueChange:e=>p({...d,identitySource:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(W,{})}),(0,X.jsxs)(H,{children:[(0,X.jsx)(B,{value:`canonical`,children:Oe()}),(0,X.jsx)(B,{value:`email`,children:s()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:d.identitySource===`email`?ye():zt()})]}):null,d.authMode===`trusted-proxy`?(0,X.jsx)($,{label:ie(),children:(0,X.jsx)(G,{value:d.systemIdentity,placeholder:rt(),onChange:e=>p({...d,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:Be(),children:(0,X.jsx)(G,{value:d.gatewayHttpUrl,placeholder:tt(),onChange:e=>p({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(hn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),y?(0,X.jsx)($t,{instance:y,onClose:()=>b(null)},y._id):null,S?(0,X.jsx)(sn,{instance:S,onClose:()=>w(null)},S._id):null]})}function sn({instance:e,onClose:t}){let n=A(P.instanceSecrets.listInstanceSecretStatus,{}),r=rn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(Yt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(q,{children:ft({instance:e.displayName??e.name})}),(0,X.jsx)(Jt,{children:Et()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(un,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(ln,{instance:e})}),(0,X.jsx)(cn,{instance:e})]})})}function cn({instance:e}){let t=O(P.instanceSync.forceInstanceSync),n=R(),[r,i]=(0,J.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(_());break;case`no_agents`:n.success(ue());break;case`no_bridge_url`:n.error(oe());break;case`deploy_misconfigured`:n.error(at());break;case`unauthorized`:n.error(st());break;case`not_served`:n.error(pe());break;default:n.error(o());break}}catch(e){n.error(ge(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?w():re()})})]})}function ln({instance:e}){let t=A(P.bridgeAuth.listBridgeAuthStatus,{}),n=O(P.bridgeAuth.mintBridgeSecret),r=F(P.bridgeAuth.revokeBridgeSecret),i=R(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(M(),e)}finally{o(!1)}}}async function g(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(It())}catch(e){i.error(M(),e)}finally{o(!1)}}}async function _(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:h(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(z,{variant:p?`outline`:`secondary`,children:p?`${Ie()} · ${f.prefix}…${f.lastFour}`:Me()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(I,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?d():Pt()}),p?(0,X.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void g(),disabled:a,children:Ce()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:Rt()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:l?Mt():k()})]}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:jt()})]}):null]})}function un({instanceId:e,field:t,updatedAt:n}){let i=O(P.instanceSecrets.setInstanceSecret),a=F(P.instanceSecrets.clearInstanceSecret),o=O(P.deviceIdentity.generateDeviceIdentity),s=R(),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(!1),_=n!==null,v=t===`deviceIdentity`,b=t===`token`?Ke():t===`deviceIdentity`?r():_e();async function x(){if(!(!l.trim()||d)){f(!0);try{await i({instanceId:e,field:t,plaintext:l}),u(``),m(null),g(!1),s.success(y())}catch(e){s.error(je(),e)}finally{f(!1)}}}async function C(){if(!d){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(De())}catch(e){s.error(je(),e)}finally{f(!1)}}}async function w(){if(!d){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(c())}catch(e){s.error(be(),e)}finally{f(!1)}}}let E=p?`openclaw devices approve ${p.id}`:``;async function D(){if(E)try{await navigator.clipboard.writeText(E),g(!0)}catch{}}return(0,X.jsxs)($,{label:b,children:[v?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(z,{variant:_?`outline`:`secondary`,children:_?Ie():Me()}),(0,X.jsx)(G,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:l,placeholder:_?T():Pe(),onChange:e=>u(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(I,{size:`sm`,onClick:()=>void x(),disabled:d||l.trim().length===0,children:bt()}),v?(0,X.jsx)(I,{size:`sm`,variant:`outline`,onClick:()=>void w(),disabled:d,children:S()}):null,_?(0,X.jsx)(I,{size:`sm`,variant:`destructive`,onClick:()=>void C(),disabled:d,children:ee()}):null]})]}),p?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:c()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Bt()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,X.jsx)(I,{variant:`outline`,size:`sm`,onClick:()=>void D(),children:h?Mt():k()})]}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:jt()})]}):null]})}var dn={conversational:Tt,documentary:Ve,summarizer:Qe,curator:dt},fn={conversational:ht,documentary:nt,summarizer:et,curator:vt},pn=e=>(dn[e]??(()=>e))(),Q=e=>(fn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Ge()}),t.map(e=>(0,X.jsx)(z,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:pn(e)},e)),(0,X.jsxs)(Gt,{children:[(0,X.jsx)(Wt,{asChild:!0,children:(0,X.jsx)(I,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:kt()})}),(0,X.jsxs)(Zt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:lt()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Ue()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(Xt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:pn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=A(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),a=F(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),o=F(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=F(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=nn(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=F(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=F(P.agents.removeInstanceAgent),u=Kt(),d=R();async function f(t,n){if(e)try{await a({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(N(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(N(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(N(),e)}}async function h(t,n){if(e&&await u({title:Dt({name:n}),description:qe(),confirmLabel:i(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(ve())}catch(e){d.error(N(),e)}}return(0,X.jsx)(Yt,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(U,{children:[(0,X.jsx)(q,{children:ze({name:e??``})}),(0,X.jsx)(Jt,{children:Ze()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Le()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Ne():r.discovery.lastPollOk?Fe():E({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:xt()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(Xt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{variant:`outline`,className:`oc-access__gone`,children:b()}),(0,X.jsx)(I,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:pt()})]}):i?(0,X.jsx)(z,{variant:`default`,children:te()}):(0,X.jsx)(I,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:Ct()})]}),t.enabled?(0,X.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(N(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(G,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:_t(),"aria-label":Ye(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{on as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Ck as i,Fl as a,Il as o,Ll as s,Ml as c,Nl as l,Pl as u,Sk as d,Tk as f,_B as p,_k as m,bB as h,bk as g,fk as _,gk as v,hk as y,jl as b,kl as x,mk as S,pk as C,t as w,vk as T,wk as E,xk as D,yB as O,yk as k}from"./api-NzmVMBHn.js";import{t as A}from"./button-BHiy_q9F.js";import{Et as j,jt as M,ut as N}from"./index-DRTZkZgA.js";var P=t(e(),1),F=n();function I(){let e=h(w.integrations.status.status,{}),t=O(w.admin.setIntegrationConfig),[n,r]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&r(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:f()});let c=n,l=(e,t,n)=>r({...c,[e]:{...c[e],[t]:n}}),u=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[E(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,d()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:k()}),note:T(),children:[(0,F.jsx)(R,{label:v(),children:(0,F.jsx)(M,{value:c.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>l(`langfuse`,`host`,e.target.value),onBlur:()=>u(`langfuse`,{host:c.langfuse.host??``})})}),(0,F.jsx)(z,{label:_(),checked:c.langfuse.enabled??!0,onChange:e=>{l(`langfuse`,`enabled`,e),u(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:k()}),note:m(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(M,{value:c.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>l(`opik`,`baseUrl`,e.target.value),onBlur:()=>u(`opik`,{baseUrl:c.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:S(),children:(0,F.jsx)(M,{value:c.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||C(),onChange:e=>l(`opik`,`workspace`,e.target.value),onBlur:()=>u(`opik`,{workspace:c.opik.workspace??``})})}),(0,F.jsx)(z,{label:_(),checked:c.opik.enabled??!0,onChange:e=>{l(`opik`,`enabled`,e),u(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:D()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:o(),children:[(0,F.jsx)(R,{label:a(),children:(0,F.jsx)(M,{value:c.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>l(`otlp`,`endpoint`,e.target.value),onBlur:()=>u(`otlp`,{endpoint:c.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:_(),checked:c.otlp.enabled??!0,onChange:e=>{l(`otlp`,`enabled`,e),u(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=p(w.integrations.otlpSecret.setOtlpHeaders),n=O(w.integrations.otlpSecret.clearOtlpHeaders),[i,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[d,f]=(0,P.useState)(!1),m=async()=>{f(!0),s(null);try{await t({headersJson:i}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{f(!1)}};return(0,F.jsxs)(R,{label:u(),children:[(0,F.jsx)(M,{value:i,placeholder:e?l():c(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:d||i.trim().length===0,onClick:()=>void m(),children:b()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:d,onClick:()=>void n({}),children:r()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:x()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{By as r,Gy as i,Hy as a,Iy as o,Jy as s,Ky as c,Ly as l,NA as u,Qk as d,Ry as f,Uy as ee,Vy as p,Wy as m,Xy as h,Yy as g,Zk as _,aA as te,bB as v,cA as y,oA as b,qy as ne,sA as x,t as S,zy as C}from"./api-NzmVMBHn.js";import{Gn as w,Kn as T,i as E,o as D,q as re,r as ie}from"./index-DRTZkZgA.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-Dgi0cIBy.js";import{n as N,t as P}from"./TimeRangePicker-BNzXp6XH.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=v(S.me.getMe,{host:re})?.permissions?.includes(`traces.read`)??!1,t=v(S.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:u()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:y()}),(0,R.jsx)(j,{children:b()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[_(),` p50 `,B(s.cP50),` `,x()]}),(0,R.jsxs)(`span`,{children:[d(),` p50 `,B(s.aP50),` `,x()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":y(),children:[(0,R.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:h(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:g(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:s(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:ne(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:c(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:i(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:m(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=E(e.from,e.to,ie,`now`),i=e=>void t({search:t=>({...t,...D(e)})}),{from:o,to:s}=N(n),{rowLimit:c,buckets:l}=J(o,s),u=v(S.kpi.listKpis,{limit:c,filter:{from:o,to:s}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>l&&e.set(t,n.slice(n.length-l));return e},[u,l]),f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[ee(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,R.jsx)(oe,{value:n,onChange:i})]});return u===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):u.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:r()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(Y,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function oe({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:C({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:f()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:l({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":o({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ae as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,$z as i,AP as a,BP as o,Bn as s,Bz as c,FP as l,Fz as u,GP as d,Gz as f,HP as p,Hn as m,Hz as ee,IP as te,Iz as h,JP as ne,Jz as re,KP as ie,Kz as ae,LP as g,Ln as oe,Lz as se,MP as ce,NP as le,PP as ue,Pz as de,QP as fe,Qn as pe,Qz as me,RP as he,Rn as ge,Rz as _e,UP as _,Un as v,Uz as y,VP as b,Vn as x,Vz as S,WP as C,Wn as w,Wz as T,XP as E,Xz as D,YP as O,Yz as k,ZP as A,Zz as j,aF as M,bB as N,cF as P,dB as F,dF as I,eB as ve,eF as ye,fF as be,hF as xe,iF as Se,ir as Ce,jP as we,lF as Te,mD as Ee,mF as De,nB as Oe,nF as ke,oB as Ae,oF as je,pF as Me,qP as Ne,qz as Pe,r as L,rB as Fe,rF as Ie,rr as Le,sF as Re,t as R,tB as ze,tF as Be,uF as Ve,yB as z,zP as B,zn as He,zz as Ue}from"./api-NzmVMBHn.js";import{t as V}from"./button-BHiy_q9F.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-DRTZkZgA.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-I1Uc-Ubw.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:L(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:L(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>xe()},{id:`composer`,label:()=>De()},{id:`sidebar`,label:()=>Me()},{id:`notifications`,label:()=>E()},{id:`other`,label:()=>be()}],X={showSource:{category:`messages`,label:()=>I(),help:()=>Ve()},showReport:{category:`messages`,label:()=>Te(),help:()=>P()},copyAssistant:{category:`messages`,label:()=>Re()},copyUser:{category:`messages`,label:()=>je()},showDelete:{category:`messages`,label:()=>M()},showTools:{category:`messages`,label:()=>Se(),help:()=>Ie()},voiceInput:{category:`composer`,label:()=>ke(),help:()=>Be()},showUsage:{category:`composer`,label:()=>ye(),help:()=>r()},autoReadAloud:{category:`composer`,label:()=>Ce(),help:()=>Le()},showChatAge:{category:`sidebar`,label:()=>fe(),help:()=>A()},notifSound:{category:`notifications`,label:()=>O(),help:()=>ne()},notifSystem:{category:`notifications`,label:()=>Ne(),help:()=>ie()},replySound:{category:`notifications`,label:()=>d(),help:()=>C()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>ue()};function ut({prefKey:e,ui:t}){let n=z(R.admin.setUiPrefDefault),r=z(R.admin.setFeatureEnabled),i=ct(e),o=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:he()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:ce()}),(0,J.jsx)(U,{value:`off`,children:we()}),(0,J.jsx)(U,{value:`inherit`,children:a()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":g()}),g()]}):null]}),o?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:o}):null]})}function dt({current:e,enabled:t}){let n=z(R.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[w(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?x():r?m():v()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:oe()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?ge():e?He():s()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=N(R.me.getMe,{host:G}),a=i?.ui,s=$(i?.role)&&n,c=z(R.me.setUiPref).withOptimisticUpdate(Je),u=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":B()}),B()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:te()}),(0,J.jsx)(`p`,{children:l()}),(0,J.jsx)(`p`,{children:le()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:_(),"aria-label":_(),className:`mb-2`}),u.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:p()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],l=a.effective[e],u=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:b()}):u?(0,J.jsx)(H,{variant:`secondary`,children:pe()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&u?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:o()}):null,(0,J.jsx)(nt,{checked:l,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:F()})}var pt={sm:()=>f(),md:()=>T(),lg:()=>y(),xl:()=>ee(),"2xl":()=>S(),"3xl":()=>c()};function mt(){let e=N(R.me.getMe,{host:G}),t=z(R.me.setLocale),n=z(R.me.setTimezone),r=z(R.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(R.me.getMe,{host:G});n&&e.setQuery(R.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=z(R.me.setMyName),o=Ke(),s=e?.locale??`default`,c=e?.name??``,[l,d]=(0,q.useState)(null),f=l??c,p=f.trim()!==c.trim();async function m(){try{await a({name:f}),d(null),o.success(i())}catch(e){o.error(me(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Fe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:ze(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:Ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:j()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Ae()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:Ue()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:se()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Pe()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ae()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:u()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:de()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
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,dB as C,dt as ue,dv as w,ey as de,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 j,pv as _e,py as ve,ry as ye,t as M,ty as be,uy as xe,vy as Se,xv as Ce,yB as N,yv as P,yy as we,zv as Te}from"./api-NzmVMBHn.js";import{t as Ee}from"./list-Dbcww3Mb.js";import{t as F}from"./button-BHiy_q9F.js";import{A as De,An as Oe,Bn as ke,C as Ae,D as I,Dt as je,E as Me,Ft as Ne,Gn as L,Hn as Pe,It as Fe,J as Ie,Kn as Le,Lt as Re,Mn as ze,Mt as Be,Nn as Ve,Nt as He,O as R,P as Ue,Pn as We,Pt as z,S as Ge,Sn as Ke,T as qe,Tn as Je,U as Ye,W as Xe,Y as Ze,_ as Qe,b as B,bn as $e,d as et,dn as tt,f as nt,g as rt,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-DRTZkZgA.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)(Re,{asChild:!0,children:(0,Z.jsx)(F,{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)(We,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=N(M.projects.renameProject),c=N(M.projects.setProjectColor),l=N(M.projects.moveProject),d=N(M.projects.deleteProject),f=N(M.projects.createProject),p=Ye(),m=Xe(),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(t),[y,b]=(0,X.useState)(!1),[x,te]=(0,X.useState)(!1),ne=S(M.projects.projectTreeCount,x?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{onOpenChange:e=>e&&te(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>a(),children:[(0,Z.jsx)(U,{}),` `,de()]}),(0,Z.jsxs)(z,{onSelect:()=>{v(t),g(!0)},children:[(0,Z.jsx)($e,{}),` `,E()]}),(0,Z.jsxs)(z,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:u(),label:we(),placeholder:Se(),confirmLabel:ce()});t&&await f({name:t,parentId:e})})},children:[(0,Z.jsx)(Oe,{}),` `,u()]}),(0,Z.jsxs)(z,{onSelect:()=>b(!0),children:[(0,Z.jsx)(pt,{}),` `,s()]}),(0,Z.jsx)(Ne,{children:_e()}),(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)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ne?.folders??0,r=ne?.chats??0;await p({title:ye({name:t}),description:n>0?be({folders:n,chats:r}):r>0?ge({count:r}):le(),confirmWord:P(),confirmLabel:me(),destructive:!0})&&await d({projectId:e})})},children:[(0,Z.jsx)(tt,{}),` `,P()]})]})]}),(0,Z.jsx)(Qe,{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=N(M.chats.pinChat),i=N(M.chats.deleteChat),a=N(M.chats.renameChat),o=N(M.chats.setChatSidebar),s=N(M.chats.moveChatToProject),l=Ye(),[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)(Be,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(He,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)($e,{}),` `,E()]}),(0,Z.jsxs)(z,{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)(z,{onSelect:()=>h(!0),children:[(0,Z.jsx)(pt,{}),` `,v()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(z,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Ke,{}):(0,Z.jsx)(Y,{}),e.inSidebar?oe():b()]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:w(),description:le(),confirmLabel:P(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(tt,{}),` `,P()]})]})]}),(0,Z.jsx)(Qe,{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=L(),n=S(M.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:C()}):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)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:O()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=L(),n=Ye(),o=Xe(),c=je(),g=N(M.projects.renameProject),_=N(M.projects.setProjectColor),v=N(M.projects.deleteProject),b=N(M.projects.createProject),x=N(M.projects.moveProject),te=N(M.projects.setProjectSidebar),re=N(M.chats.moveChatToProject),oe=N(M.chats.reorderChat),se=N(M.projects.reorderProject),C=S(M.projects.projectTreeCount,{projectId:e.project._id}),[w,de]=(0,X.useState)(xt),T=e=>{localStorage.setItem(bt,e),de(e)},D=S(M.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),O=S(M.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:k}=Le({from:`/project/$projectId`}),A=S(M.projects.listProjects,{}),j=S(M.chatReads.myBusyChats,{}),Te=(0,X.useMemo)(()=>new Set(j??[]),[j]),ke=S(M.chatReads.myChatReads,{}),Pe=(0,X.useMemo)(()=>yt(e.chats,ke??[]),[e.chats,ke]),{startNewChat:R,picker:Ke}=et(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[B,nt]=(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(B.trim()),180);return()=>clearTimeout(e)},[B]);let Q=S(M.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=De(it(lt,{activationConstraint:{distance:4}}),it(qe,{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||ve()}}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=I(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=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Me(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`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(w===`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(w===`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(w===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:Ze(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(!Ie(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(!Ie(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=rt(e.project),Bt=_t(e.chats,B),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ge,{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)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:fe(),onClick:()=>{te({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Ve,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:ue()}),(0,Z.jsx)(ze,{"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)(F,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ie(),title:ie(),"aria-pressed":w===`cards`,onClick:()=>T(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(F,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ae(),title:ae(),"aria-pressed":w===`columns`,onClick:()=>T(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(F,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":p(),title:p(),"aria-pressed":w===`list`,onClick:()=>T(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void R({projectId:e.project._id}),children:[(0,Z.jsx)(Je,{}),i()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await o({title:u(),label:we(),placeholder:Se(),confirmLabel:ce()});t&&await b({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(Oe,{}),u()]}),(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":xe(),children:(0,Z.jsx)(We,{})})}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(z,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)($e,{}),` `,E()]}),(0,Z.jsxs)(z,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,s()]}),(0,Z.jsx)(Ne,{children:_e()}),(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)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=C?.folders??0,a=C?.chats??0;await n({title:ye({name:e.project.name}),description:i>0?be({folders:i,chats:a}):a>0?ge({count:a}):le(),confirmWord:P(),confirmLabel:me(),destructive:!0})&&(await v({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(tt,{}),` `,P()]})]})]})]})]}),w===`columns`?(0,Z.jsx)(Ft,{data:D,currentId:e.project._id,busyIds:Te,suppressClick:$,locateChatId:k??null}):w===`list`?(0,Z.jsx)(Mt,{data:O,busyIds:Te,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:B,onChange:e=>nt(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:B.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:Te.has(t._id),unread:Pe.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:Ce()}),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&&Ue(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)(Qe,{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,Ke]}),(0,Z.jsx)(Ae,{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}=R({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=L(),a=B({id:`folder:${e._id}`}),o=R({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":rt(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?Te({count:e.folderCount})+` · `:``,x({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:nt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=N(M.chats.setChatSidebar),n=e.inSidebar?oe():b();return(0,Z.jsx)(F,{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)(Ke,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=L(),c=V(e.color),l=B({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||ve()}),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:nt(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:j(),"aria-label":j()}):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:C()});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=Ze(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&&Ze(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=L(),c=B({id:`folder:${e._id}`}),l=R({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":rt(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)(ke,{size:13}):(0,Z.jsx)(Pe,{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=L(),o=B({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||ve()}),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:C()}):(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=L(),s=R({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=B({id:`folder:${e._id}`}),o=R({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":rt(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=B({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||ve()}),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 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bw as r,CT as i,DT as a,ET as o,Gw as s,Hw as ee,Jw as c,Kw as l,OT as u,ST as d,TT as f,Uw as p,Vw as te,Ww as m,_T as h,aT as g,bB as _,bT as v,cT as ne,dT as y,eT as re,fT as b,gT as x,hT as ie,iT as ae,kT as S,lT as C,mT as w,nT as T,oT as E,pT as D,qw as O,rT as k,sT as A,t as j,tT as M,ts as N,uT as P,vT as F,wT as I,xT as L,yB as R,yT as z}from"./api-NzmVMBHn.js";import{t as B}from"./button-BHiy_q9F.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-DRTZkZgA.js";import{t as J}from"./roleDescriptions-Dj1fvyuY.js";var Y=t(e(),1),X=n(),Z=[{group:()=>S(),keys:[{key:`traces.read`,label:()=>I()},{key:`traces.read.content`,label:()=>i(),phi:!0},{key:`traces.write`,label:()=>d()}]},{group:()=>u(),keys:[{key:`kpi.read`,label:()=>I()},{key:`kpi.write`,label:()=>d()}]},{group:()=>a(),keys:[{key:`openclaw.query`,label:()=>L()},{key:`anomalies.read`,label:()=>v()},{key:`anomalies.report`,label:()=>z()}]},{group:()=>o(),keys:[{key:`chats.read`,label:()=>I()},{key:`selfheal`,label:()=>h()},{key:`feedback.respond`,label:()=>N()}]},{group:()=>f(),keys:[{key:`admin.manage`,label:()=>F()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=_(j.apiKeys.listRoles,{}),t=R(j.apiKeys.createRole),n=R(j.apiKeys.ensureRolesSeeded),i=R(j.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(j.apiKeys.listRoles,{});r&&e.setQuery(j.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=W(),o=V(),[u,d]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)($),[v,S]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{o.error(ie(),e)})},[n,o]);let N=e??[];async function F(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:w({name:e.name}),description:D(),confirmLabel:b()});return}if(v.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];S(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){o.error(y(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function I(){try{await t({key:f.key,name:f.name,description:f.description||void 0,permissions:[]}),h($),d(!1)}catch(e){o.error(P(),e)}}let L=e===void 0,z=!L&&N.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[C(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,ne(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,A()]}),(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:E()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{h($),d(!0)},children:g()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):z?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:T()}),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?x({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:N.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,{}),` `,M()]}):(0,X.jsx)(U,{variant:`secondary`,children:re()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?c():n?O():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:u,onOpenChange:d,title:l(),description:s(),canSubmit:!!(f.key&&f.name),onSubmit:I,submitLabel:m(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:p()}),(0,X.jsx)(K,{value:f.key,placeholder:ee(),onChange:e=>h({...f,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,X.jsx)(K,{value:f.name,onChange:e=>h({...f,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:r()}),(0,X.jsx)(K,{value:f.description,onChange:e=>h({...f,description:e.target.value})})]})]})})]})}export{se as RolesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AL as i,BR as a,CL as o,D as s,DL as c,EL as l,FL as u,FR as d,GL as ee,GR as f,HI as p,HL as m,HR as h,IL as g,IR as _,JI as te,JL as ne,JR as re,KL as ie,KR as ae,LR as oe,ML as se,NL as ce,OL as le,PL as ue,PR as de,QI as fe,QL as pe,RR as me,SL as v,TL as he,UL as ge,UR as _e,VL as ve,VR as ye,WL as be,WR as xe,XI as Se,XL as Ce,YI as we,YL as Te,YR as Ee,ZI as De,_B as y,aL as Oe,aR as ke,bB as Ae,cL as je,cR as Me,dB as Ne,dL as Pe,dR as Fe,eL as Ie,fR as Le,gR as Re,hR as ze,iL as Be,iR as Ve,jL as b,kL as He,lL as Ue,lR as x,mR as We,nL as Ge,nR as Ke,oL as qe,oR as Je,pB as S,pR as Ye,qL as Xe,qR as Ze,rL as Qe,rR as $e,sL as et,sR as tt,t as C,tL as nt,tR as rt,uL as it,wL as at,xL as ot,zR as st}from"./api-NzmVMBHn.js";import{t as ct}from"./list-Dbcww3Mb.js";import{t as w}from"./button-BHiy_q9F.js";import{$ as T,Bn as E,Bt as D,Ct as lt,Dn as ut,Dt as dt,Et as O,Q as k,Rt as A,St as ft,Tt as pt,Vn as j,X as M,Z as N,_n as mt,_t as ht,at as gt,bn as _t,bt as vt,dn as yt,et as P,gt as bt,hn as xt,it as St,jt as Ct,nt as wt,on as Tt,ot as Et,q as Dt,rt as Ot,tt as kt,vt as At,wt as jt,xn as Mt,xt as Nt,yt as Pt,zt as F}from"./index-DRTZkZgA.js";import{a as Ft,i as I,n as It,o as Lt,r as L,t as Rt}from"./table-BKRXY_Eg.js";import{t as zt}from"./FilterBar-BB9HpiR0.js";/* empty css */import{a as Bt,c as R,i as z,l as Vt,n as Ht,o as Ut,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-I1Uc-Ubw.js";var qt=s(`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=s(`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=Vt(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(S()),[]),l=(0,V.useMemo)(()=>new Intl.DateTimeFormat(S(),{month:`long`,year:`numeric`}),[]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(S(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=R(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?u():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(A,{modal:!0,open:o,onOpenChange:s,children:[(0,H.jsx)(D,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":g(),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)(F,{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":ue(),onClick:()=>_(-1),children:(0,H.jsx)(j,{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":ce(),onClick:()=>_(1),children:(0,H.jsx)(E,{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)),ee.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)(M,{value:String(f),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,H.jsx)(T,{size:`sm`,"aria-label":se(),children:(0,H.jsx)(P,{})}),(0,H.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(k,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(M,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),f,Number(e)),children:[(0,H.jsx)(T,{size:`sm`,"aria-label":b(),children:(0,H.jsx)(P,{})}),(0,H.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(k,{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:s}){let u=S(),d=(0,V.useMemo)(()=>Zt(e),[e]),ee=(0,V.useMemo)(()=>$t(u),[u]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(u,{month:`long`,year:`numeric`}),[u]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(u,{month:`long`}),[u]),m=(0,V.useMemo)(()=>new Intl.DateTimeFormat(u,{hour:`2-digit`,minute:`2-digit`}),[u]),h=new Date,g=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()})},_=t===`year`?String(n.year):f.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)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":at(),onClick:()=>g(-1),children:(0,H.jsx)(j,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,"aria-label":o(),onClick:()=>g(1),children:(0,H.jsx)(E,{})}),(0,H.jsx)(w,{variant:`ghost`,size:`sm`,onClick:()=>i({year:h.getFullYear(),month:h.getMonth()}),children:he()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:_}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(w,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:c()}),(0,H.jsx)(w,{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:d,weekdays:ee,timeFmt:m,now:h,onEventClick:a}):(0,H.jsx)(an,{year:n.year,byDay:d,monthShortFmt:p,now:h,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),s?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=R(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))??[],s=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`)+(s?` 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:v({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=R(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=Ut(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)(O,{variant:`secondary`,children:Te()});case`error`:return(0,H.jsx)(O,{variant:`destructive`,children:Xe()});case`running`:return(0,H.jsx)(O,{variant:`outline`,children:ie()});case`other`:return(0,H.jsx)(O,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=y(C.scheduled.listMyCrons),t=y(C.scheduled.getCronDetail),n=y(C.scheduled.listCronRuns),o=y(C.scheduled.updateCron),s=y(C.scheduled.removeCron),c=y(C.scheduled.runCronNow),l=dt(),u=Ae(C.me.getMe,{host:Dt})?.timezone,[g,se]=(0,V.useState)(null),[ce,ue]=(0,V.useState)(!1),[v,he]=(0,V.useState)(!1),[b,at]=(0,V.useState)(null),[E,D]=(0,V.useState)(null),[A,j]=(0,V.useState)(null),[F,R]=(0,V.useState)(null),[Vt,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ht),[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)Bt(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()=>{ue(!0),he(!1);try{se(await e({}))}catch{he(!0)}finally{ue(!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(S(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{at(e);try{await t(),l.success(n),await q()}catch(e){l.toast({variant:`error`,title:x({code:dn(e)})})}finally{at(null)}},Z=(0,V.useRef)(0),Q=(0,V.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;j({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;j({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;j(null),l.toast({variant:`error`,title:x({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;R({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;R(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;R(null),l.toast({variant:`error`,title:x({code:dn(e)})})}},mn=async()=>{if(F===null)return;let e={};if(F.nameDirty&&F.name.trim()===``||F.messageDirty&&F.hasMessage&&F.message.trim()===``){l.toast({variant:`error`,title:te()});return}if(F.nameDirty&&F.name.trim()!==``&&(e.name=F.name.trim()),F.scheduleDirty){if(F.scheduleKind===`cron`&&F.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:F.cronExpr.trim(),...F.tz.trim()===``?{}:{tz:F.tz.trim()}};else if(F.scheduleKind===`every`){let t=Number(F.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[F.everyUnit])})}else if(F.scheduleKind===`at`&&F.at!==``){let t=Date.parse(F.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(F.scheduleDirty&&e.schedule===void 0){l.toast({variant:`error`,title:we()});return}if(F.messageDirty&&F.hasMessage&&F.message.trim()!==``&&(e.message=F.message.trim()),Object.keys(e).length===0){R(null);return}let t=Q.current;Gt(!0);try{await o({instanceName:F.instanceName,jobId:F.jobId,patch:e}),l.success(je()),t===Q.current&&R(null),await q()}catch(e){l.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:Ee()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":i(),children:[(0,H.jsx)(w,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":He(),title:He(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(ct,{})}),(0,H.jsx)(w,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":le(),title:le(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:ce,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(xt,{size:14,"aria-hidden":!0}),re()]})]}),g!==null&&hn>0?(0,H.jsxs)(zt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:be(),onReset:()=>U(Ht),canReset:Wt(B),children:[(0,H.jsxs)(M,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(T,{size:`sm`,className:`w-40`,children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`all`,children:ge()}),(0,H.jsx)(k,{value:`active`,children:d()}),(0,H.jsx)(k,{value:`paused`,children:_()}),(0,H.jsx)(k,{value:`auto-disabled`,children:de()})]})]}),(0,H.jsxs)(M,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(T,{size:`sm`,className:`w-40`,children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`all`,children:m()}),(0,H.jsx)(k,{value:`ok`,children:Te()}),(0,H.jsx)(k,{value:`error`,children:Xe()}),(0,H.jsx)(k,{value:`running`,children:ie()}),(0,H.jsx)(k,{value:`none`,children:ee()})]})]})]}):null,g===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ce,children:v?Ze():Ne()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[v?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:ot()})]}):(0,H.jsxs)(H.Fragment,{children:[v?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):null,g.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):null,g.map(e=>{let t=e.jobs.filter(e=>Bt(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)(O,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:xe({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):(0,H.jsxs)(Rt,{children:[(0,H.jsx)(Ft,{children:(0,H.jsxs)(Lt,{children:[(0,H.jsx)(I,{children:h()}),(0,H.jsx)(I,{children:ye()}),(0,H.jsx)(I,{children:a()}),(0,H.jsx)(I,{children:st()}),(0,H.jsx)(I,{children:me()}),(0,H.jsx)(I,{children:Ce()}),(0,H.jsx)(I,{children:Pe()})]})}),(0,H.jsx)(It,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=b===r,a=e.manageSupported,s=e.kind===`openclaw`&&a;return(0,H.jsxs)(Lt,{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)(L,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??oe()}),(0,H.jsx)(L,{children:(0,H.jsx)(O,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(L,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=bt(t.schedule),n=e===null?null:ht(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(L,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(L,{children:Ut(t)===`auto-disabled`?(0,H.jsx)(O,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:de()}):Ut(t)===`active`?(0,H.jsx)(O,{variant:`secondary`,children:d()}):Ut(t)===`paused`?(0,H.jsx)(O,{variant:`outline`,children:_()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(L,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(O,{variant:`destructive`,title:t.lastDeliveryError??Re(),children:ne()}):null]}),(0,H.jsx)(L,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:We(),"aria-label":We(),disabled:b!==null,onClick:()=>void X(r,async()=>{let n=await c({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},Me()),children:(0,H.jsx)(Tt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:z(t)===`pause`?Ye():Le(),"aria-label":z(t)===`pause`?Ye():Le(),disabled:b!==null,onClick:()=>void X(r,()=>o({instanceName:e.instanceName,jobId:t.id,patch:{enabled:z(t)===`resume`}}),z(t)===`pause`?tt():Je()),children:z(t)===`pause`?(0,H.jsx)(Mt,{size:14,"aria-hidden":!0}):(0,H.jsx)(mt,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:it(),"aria-label":it(),disabled:b!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(_t,{size:14,"aria-hidden":!0})}):null,s?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:Ue(),"aria-label":Ue(),disabled:b!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,a?(0,H.jsx)(w,{variant:`ghost`,size:`icon-sm`,title:Fe(),"aria-label":Fe(),disabled:b!==null,onClick:()=>D({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(yt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:p()}):null]}),(0,H.jsx)(At,{open:E!==null,onOpenChange:e=>{e||D(null)},children:(0,H.jsxs)(Nt,{children:[(0,H.jsxs)(jt,{children:[(0,H.jsx)(pt,{children:Ve()}),(0,H.jsx)(ft,{children:$e({name:E?.name??``})})]}),(0,H.jsxs)(lt,{children:[(0,H.jsx)(vt,{children:Ke()}),(0,H.jsx)(Pt,{onClick:()=>{let e=E;D(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>s({instanceName:e.instanceName,jobId:e.jobId}),ke())},children:rt()})]})]})}),(0,H.jsx)(kt,{open:A!==null,onOpenChange:e=>{e||(Z.current++,j(null))},children:(0,H.jsxs)(wt,{style:{maxWidth:640},children:[(0,H.jsx)(gt,{children:(0,H.jsx)(Et,{children:et({name:A?.name??``})})}),A?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):A!==null&&A.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):A===null?null:(0,H.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:A.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:[pe({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(kt,{open:F!==null,onOpenChange:e=>{e||(Q.current++,R(null))},children:(0,H.jsxs)(wt,{className:`oc-cronedit`,children:[(0,H.jsxs)(gt,{children:[(0,H.jsx)(Et,{children:Oe()}),(0,H.jsx)(Ot,{children:Be()})]}),F===null?null:F.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(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:h()}),(0,H.jsx)(Ct,{value:F.name,maxLength:200,onChange:e=>R({...F,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:Qe()}),(0,H.jsxs)(M,{value:F.scheduleKind,onValueChange:e=>R({...F,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(T,{children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`cron`,children:Ge()}),(0,H.jsx)(k,{value:`every`,children:nt()}),(0,H.jsx)(k,{value:`at`,children:Ie()})]})]}),F.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Ct,{value:F.cronExpr,onChange:e=>R({...F,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:F.tz,onChange:e=>R({...F,tz:e,scheduleDirty:!0}),fallbackTz:u??void 0})]}):F.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Ct,{type:`number`,min:1,value:F.everyValue,onChange:e=>R({...F,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(M,{value:F.everyUnit,onValueChange:e=>R({...F,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(T,{style:{maxWidth:160},children:(0,H.jsx)(P,{})}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{value:`minutes`,children:r()}),(0,H.jsx)(k,{value:`hours`,children:fe()}),(0,H.jsx)(k,{value:`days`,children:De()})]})]})]}):(0,H.jsx)(Yt,{value:F.at,onChange:e=>R({...F,at:e,scheduleDirty:!0})})]}),F.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:ze()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:F.message,onChange:e=>R({...F,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(St,{children:[(0,H.jsx)(w,{variant:`ghost`,onClick:()=>R(null),children:Ke()}),(0,H.jsxs)(w,{onClick:()=>void mn(),disabled:F===null||F.loading||Vt,children:[Vt?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Se()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,AN as i,BN as ee,CN as a,CP as o,DN as s,DP as te,EN as c,EP as ne,FN as re,GN as ie,HN as ae,IN as oe,JN as se,KN as ce,LN as le,MN as l,NN as ue,ON as u,OP as de,PN as fe,QN as pe,RN as me,SN as d,SP as he,TN as f,TP as ge,UN as _e,VN as ve,WN as ye,XN as be,YN as xe,ZN as Se,_B 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,lN as x,lP as Ie,mN as S,mP as Le,nP as Re,oP as ze,pN as C,pP as Be,qN as Ve,rP as He,sP as Ue,t as w,tP as We,uN as T,uP as Ge,vN as E,vP as Ke,wN as D,wP as O,xN as k,xP as qe,yB as A,yN as j,yP as Je,zN as Ye}from"./api-NzmVMBHn.js";import{t as M}from"./button-BHiy_q9F.js";import{$ as N,Bn as Xe,Dt as Ze,Et as P,Gn as Qe,Hn as $e,In as F,Kn as et,Q as I,U as tt,Un as L,X as R,Z as z,_ as nt,at as B,ct as V,et as H,it as U,jt as rt,nt as W,ot as G,rt as it,st as K,tt as q}from"./index-DRTZkZgA.js";import{t as at}from"./FilterBar-BB9HpiR0.js";import{t as ot}from"./DataTableShell-tMQLeAkL.js";import{t as st}from"./roleDescriptions-Dj1fvyuY.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>S(),days:30},{value:`90`,label:()=>C(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=et({from:`/settings/serviceAccounts`}),t=Qe({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??Z,[a,s]=(0,J.useState)(Z),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),u=p(w.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),d=p(w.apiKeys.listKeys,{}),f=p(w.apiKeys.listRoles,{}),we=A(w.apiKeys.createServiceAccount),m=A(w.apiKeys.updateServiceAccount),h=A(w.apiKeys.deleteServiceAccount),g=Ce(w.apiKeys.mintApiKey),_=A(w.apiKeys.revokeApiKey),v=tt(),y=Ze(),b=n!==``||a!==Z||i!==Z;function x(){s(Z),t({search:{},replace:!0})}let[S,C]=(0,J.useState)(!1),[T,E]=(0,J.useState)(Q),[D,k]=(0,J.useState)(null),[j,F]=(0,J.useState)(new Set),[L,B]=(0,J.useState)(null),V=(0,J.useRef)(!1),[U,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 d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function $(e){F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{D?(await m({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),y.success(Ve())):await we({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Q),k(null),C(!1)}catch(e){y.error(D?se():xe(),e)}}function ft(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function pt(e){if(V.current)return;V.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;B(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(ce(),e)}finally{V.current=!1,B(null)}}async function mt(e){if(await v({title:ie(),description:(0,Y.jsxs)(Y.Fragment,{children:[ye(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,_e(),` `,(0,Y.jsx)(`strong`,{children:ae()}),` `,ve()]}),confirmWord:e.name,confirmLabel:ee(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Ye(),e.name)}catch(e){y.error(me(),e)}}async function ht(e){if(await v({title:le(),description:(0,Y.jsxs)(Y.Fragment,{children:[oe(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,re()]}),confirmLabel:fe(),destructive:!0})&&!U.has(e._id)){W(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(ue(),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:Fe()}),(0,Y.jsxs)(at,{q:n,onQChange:c,searchPlaceholder:de(),onReset:x,canReset:b,children:[(0,Y.jsxs)(R,{value:a,onValueChange:s,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(H,{placeholder:te()})}),(0,Y.jsxs)(z,{children:[(0,Y.jsx)(I,{value:Z,children:ne()}),(f??[]).map(e=>(0,Y.jsx)(I,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(R,{value:i,onValueChange:l,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(H,{})}),(0,Y.jsxs)(z,{children:[(0,Y.jsx)(I,{value:Z,children:ge()}),(0,Y.jsx)(I,{value:`active`,children:O()}),(0,Y.jsx)(I,{value:`disabled`,children:o()})]})]})]}),(0,Y.jsx)(ot,{title:he(),rows:u,addLabel:qe(),onAdd:()=>{E(Q),k(null),C(!0)},emptyHint:De(),isExpanded:e=>j.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:U}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Me(),onSelect:()=>ft(e)},{label:Je(),onSelect:()=>void pt(e)}]:[],{label:j.has(e._id)?Ke():Te(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Ne(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(M,{variant:`ghost`,size:`icon-sm`,"aria-label":j.has(e._id)?Le():Be(),onClick:()=>$(e._id),children:j.has(e._id)?(0,Y.jsx)($e,{}):(0,Y.jsx)(Xe,{})})},{header:je(),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:ke(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(P,{variant:`secondary`,children:e.roleKey})},{header:Ge(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(P,{variant:`destructive`,children:o()}):(0,Y.jsx)(P,{variant:`outline`,children:O()})},{header:Ie(),cell:e=>(0,Y.jsxs)(R,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(H,{})}),(0,Y.jsx)(z,{children:ct.map(e=>(0,Y.jsx)(I,{value:e.value,children:e.label()},e.value))})]})},{header:Oe(),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:L===e._id?Ue():ze({count:t})})}}]}),(0,Y.jsx)(nt,{open:S,onOpenChange:e=>{C(e),e||k(null)},title:D?Ee():Re(),description:D?Pe():We(),canSubmit:!!(T.name&&T.roleKey),onSubmit:dt,submitLabel:D?He():Ae(),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:r()}),(0,Y.jsx)(rt,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:pe()}),(0,Y.jsxs)(R,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(H,{placeholder:Se()})}),(0,Y.jsx)(z,{children:(f??[]).map(e=>(0,Y.jsxs)(I,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===T.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:be()}),(0,Y.jsx)(rt,{value:T.description,onChange:e=>E({...T,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:y()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:i()}),(0,Y.jsx)(`th`,{children:b()}),(0,Y.jsx)(`th`,{children:u()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{children:c()}),(0,Y.jsx)(`th`,{children:f()}),(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)(P,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:V(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)(M,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?D():a()}):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)(B,{children:[(0,Y.jsx)(G,{children:d()}),(0,Y.jsx)(it,{children:k({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:m()}),(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)(M,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":j(),children:[n?(0,Y.jsx)(L,{}):(0,Y.jsx)(F,{}),n?E():we()]})]}),(0,Y.jsx)(U,{children:(0,Y.jsx)(M,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function dt(e){return e===null?!1:Date.now()-e>X}function ft(e){return e===null?g():V(e)}function pt(e){return e===null?`—`:K(e)}function mt(e){return e.disabled?(0,Y.jsx)(P,{variant:`destructive`,children:h()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(P,{variant:`outline`,children:T()}):(0,Y.jsx)(P,{variant:`outline`,children:x()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +0,0 @@
|
|
|
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 ee,KF as b,LF as te,LI as ne,MF as re,MI as ie,NF as ae,NI as oe,OF as se,OI as x,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 ve,UF as ye,VF as be,WF as xe,XF as Se,YF as Ce,ZF as we,_B as Te,_F as Ee,_I as De,aI as Oe,bB as S,bF as C,bI as ke,cB as Ae,cI as je,dI as Me,eI as Ne,fI as Pe,gF as Fe,gI as Ie,hI as Le,iI as Re,jF as ze,jI as Be,kF as Ve,kI as He,lB as Ue,lI as We,mI as Ge,nI as Ke,oI as qe,pI as Je,qF as Ye,r as Xe,rI as Ze,sB as Qe,sI as $e,t as w,tI as T,uI as et,vF as tt,vI as nt,wF as E,wI as rt,wc as D,xF as it,xI as at,yB as O,yF as ot,yI as st,zF as ct}from"./api-NzmVMBHn.js";import{t as k}from"./x-B2aLNZur.js";import{t as A}from"./button-BHiy_q9F.js";import{$ as j,Et as M,Fn as lt,Ft as ut,G as dt,It as N,K as ft,Lt as pt,Mt as mt,Nt as ht,Pn as P,Pt as F,Q as I,Un as L,X as R,Z as z,et as B,jt as V,ln as H,q as U,ut as W}from"./index-DRTZkZgA.js";import{t as gt}from"./localePickerView-C2RmOS86.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,t as St}from"./card-Dgi0cIBy.js";import{a as Ct,i as G,n as wt,o as K,r as q,t as Tt}from"./table-BKRXY_Eg.js";import{t as Et}from"./TimeRangePicker-BNzXp6XH.js";import{t as Dt}from"./FilterBar-BB9HpiR0.js";import{t as Ot}from"./AdvancedFilter-BbGwAk2J.js";var J=t(e(),1),kt=.1,At=[248,248,248],jt=[24,24,24];function Mt(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 Nt(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 Pt(e,t,n){return Nt(e,t,n)>=kt}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ct());if(e.size>Lt)throw Error(de());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(v());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Mt(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(v());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);Pt(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?At:jt):It(e.data),p.putImageData(e,0,0)}let h=Pt(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),g=await Y(f,`image/webp`,Bt)??await Y(f,`image/png`);if(!g)throw Error(m());return{blob:g,hasAlpha:h}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(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 Ut(e)}async function Ut(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(te())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?Ue():e===`dark`?Ae():Qe()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Xe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(L,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(A,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":ve(),title:ve(),children:(0,X.jsx)(lt,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=S(w.charts.listMyCharts),r=O(w.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:a()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:x(),subtitle:d(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?p():n.via===`owner`?_e():rt({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()}):null]})}function Qt(){let e=O(w.charts.importChart),[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{a(await t.text())}catch{s(T())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(r());return}let o;try{o=JSON.parse(i)}catch{s(T());return}d(!0);try{await e({name:t.trim(),tokens:o}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:We()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:$e()}),(0,X.jsx)(V,{value:t,onChange:e=>n(e.target.value),placeholder:qe(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Oe()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:Re(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(H,{className:`size-4`}),Ze(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,X.jsx)(A,{size:`sm`,disabled:u,onClick:()=>void p(),children:Ke()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ne()}):null]})]})}function $t({chart:e}){let t=Te(w.charts.setChartLogo),n=O(w.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?b():g()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(H,{className:`size-4`}),t?ye():xe(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:be()}):null,t?(0,X.jsx)(A,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:_()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ye()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:o()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=S(w.me.getMe,{host:U}),n=O(w.charts.addChartDomain),r=O(w.charts.removeChartDomain),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.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,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ce()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:i()}):d.map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ve({domain:e}),onClick:()=>void p(e),children:(0,X.jsx)(k,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(V,{value:a,onChange:e=>o(e.target.value),placeholder:re(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&f()}}),(0,X.jsx)(A,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void f(),children:ze()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ae()}),s?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=O(w.charts.updateChart),n=O(w.charts.deleteChart),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.name),[s,c]=(0,J.useState)(()=>$(e.tokens)),[d,p]=(0,J.useState)(e.tokens.bpm??0),[m,h]=(0,J.useState)(null),[g,_]=(0,J.useState)(!1);function v(){o(e.name),c($(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(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:v,children:Ce()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:ee()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,X.jsx)(V,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:d,onChange:e=>p(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:d===0?l():`${d} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:he()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ge()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),m?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:m}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,disabled:g,onClick:()=>void y(),children:se()}),(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:u()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=S(w.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ue()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=O(w.charts.addChartToGroupPool),r=O(w.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(M,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?Le():e.kind===`custom`&&e.scope===`personal`?C():Ie()}),e.isGlobalDefault?(0,X.jsx)(M,{variant:`default`,children:Ge()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Pe()}),(a??[]).map(e=>(0,X.jsxs)(M,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":et({group:e.name}),onClick:()=>void l(e.groupId),children:(0,X.jsx)(k,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(R,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(j,{size:`sm`,className:`w-56`,children:(0,X.jsx)(B,{placeholder:Me()})}),(0,X.jsx)(z,{children:s.map(e=>(0,X.jsx)(I,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je()}):null]})]})}function an({chart:e}){let t=O(w.charts.promoteChartToCommon),n=O(w.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(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(M,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ot():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:it({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(A,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:tt()}):null,(0,X.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ee()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=O(w.admin.setDefaultThemeMode),i=O(w.admin.setDefaultLocale),a=O(w.charts.setDefaultChart),o=S(w.charts.listChartsAdmin),c=S(w.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ie()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:at()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:x()}),ft.map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(A,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ke()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:c??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:nt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:s()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Fe()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(A,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:y()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:h()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:gt().map(e=>(0,X.jsx)(A,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:le()})]})]})}function sn(){let e=S(w.me.getMe,{host:U}),t=dt(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:oe()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(A,{variant:`outline`,children:`Outline`}),(0,X.jsx)(A,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(A,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(A,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(A,{size:`sm`,children:`Small`}),(0,X.jsx)(A,{children:`Default`}),(0,X.jsx)(A,{size:`lg`,children:`Large`}),(0,X.jsx)(A,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(P,{})}),(0,X.jsx)(A,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(M,{children:`Default`}),(0,X.jsx)(M,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(M,{variant:`outline`,children:`Outline`}),(0,X.jsx)(M,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(V,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(R,{value:n,onValueChange:r,children:[(0,X.jsx)(j,{className:`w-56`,children:(0,X.jsx)(B,{placeholder:`Select…`})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(I,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(I,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(W,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Dt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(R,{value:o,onValueChange:s,children:[(0,X.jsx)(j,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(I,{value:Z,children:`Toutes directions`}),(0,X.jsx)(I,{value:`inbound`,children:`inbound`}),(0,X.jsx)(I,{value:`outbound`,children:`outbound`}),(0,X.jsx)(I,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(R,{value:c,onValueChange:l,children:[(0,X.jsx)(j,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(I,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(I,{value:`info`,children:`info`}),(0,X.jsx)(I,{value:`warn`,children:`warn`}),(0,X.jsx)(I,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(Ot,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Et,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(pt,{asChild:!0,children:(0,X.jsx)(A,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(P,{})})}),(0,X.jsxs)(ht,{align:`start`,children:[(0,X.jsx)(ut,{children:`Actions`}),(0,X.jsx)(N,{}),(0,X.jsx)(F,{children:`Edit`}),(0,X.jsx)(F,{children:`Duplicate`}),(0,X.jsx)(N,{}),(0,X.jsx)(F,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(St,{className:`w-80`,children:[(0,X.jsxs)(_t,{children:[(0,X.jsx)(bt,{children:`Instance`}),(0,X.jsx)(xt,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(yt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(vt,{className:`gap-2`,children:[(0,X.jsx)(A,{size:`sm`,children:`Save`}),(0,X.jsx)(A,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Tt,{children:[(0,X.jsx)(Ct,{children:(0,X.jsxs)(K,{children:[(0,X.jsx)(G,{className:`w-8`,children:(0,X.jsx)(W,{"aria-label":`select all`})}),(0,X.jsx)(G,{children:`Name`}),(0,X.jsx)(G,{children:`Mode`}),(0,X.jsx)(G,{className:`text-right`,children:`Status`}),(0,X.jsx)(G,{className:`w-8`})]})}),(0,X.jsx)(wt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(K,{children:[(0,X.jsx)(q,{children:(0,X.jsx)(W,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(q,{className:`font-medium`,children:e.n}),(0,X.jsx)(q,{children:(0,X.jsx)(M,{variant:`secondary`,children:e.m})}),(0,X.jsx)(q,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(L,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(q,{children:(0,X.jsx)(A,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(P,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
@@ -1 +0,0 @@
|
|
|
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 ee,IS as m,JS as h,Jk as g,KS as _,Kk as v,LS as te,MA as y,NA as b,NS as x,OA as ne,PS as S,QS as re,Qk as ie,RS as ae,SA as oe,TA as se,US as ce,VS as le,WS as ue,Wk as de,XS as fe,Xk as pe,YS as me,Yk as he,ZS as ge,Zk as _e,_A as ve,aC as ye,aa as C,bA as w,bB as T,cC as be,dA as E,dC as xe,eA as D,eC as Se,fA as O,fC as Ce,gA as k,gC as we,hA as A,hC as Te,iA as Ee,iC as De,ia as j,jA as M,kA as N,lA 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 P,sC as Ve,t as F,tA as He,tC as Ue,uA as I,uC as We,vA as Ge,wA as Ke,xA as qe,yA as Je,yB as L,zS as Ye}from"./api-NzmVMBHn.js";import{t as Xe}from"./x-B2aLNZur.js";import{i as Ze,n as Qe,r as $e,t as et}from"./tabs-JuirMY8K.js";import{t as R}from"./button-BHiy_q9F.js";import{$ as z,Et as B,Gn as tt,H as nt,In as rt,Kn as it,Mn as at,Nn as ot,On as st,Q as V,Un as ct,X as H,Z as U,a as lt,at as ut,ct as W,et as G,i as dt,lt as ft,nt as pt,o as mt,ot as ht,q as gt,rt as _t,s as vt,tt as yt}from"./index-DRTZkZgA.js";import{n as bt}from"./TimeRangePicker-BNzXp6XH.js";import{t as xt}from"./FilterBar-BB9HpiR0.js";import{t as St}from"./AdvancedFilter-BbGwAk2J.js";import{t as Ct}from"./DataTableShell-tMQLeAkL.js";var wt=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`}]]),K=t(e(),1),q=n(),J={kind:`relative`,from:`now-520w`,to:`now`},Y=e=>e===null?`-`:String(Math.round(e));function Tt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Ae():n===`agent`?`${Ie()} - ${r}`:e}function Et(){let e=T(F.me.getMe,{host:gt})?.role===`admin`,t=T(F.deliveryTiming.getDeliveryStatus,{}),n=L(F.deliveryTiming.startDeliveryRecord),r=L(F.deliveryTiming.stopDeliveryRecord),[i,o]=(0,K.useState)(!1),[s,c]=(0,K.useState)(!1),l=t?.recording??!1,d=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!1)}};return(0,q.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:b()}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}),e?(0,q.jsx)(R,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void d(),children:l?a():M()}):null]}),l?(0,q.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,q.jsx)(B,{variant:`secondary`,children:N()}),t?.startedAt?(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:ne({time:ft(t.startedAt)})}):null]}):null,(0,q.jsx)(`div`,{children:(0,q.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:i?se():u()})}),i?(0,q.jsx)(Dt,{isAdmin:e}):null]})}function Dt({isAdmin:e}){let t=T(F.deliveryTiming.listDeliverySessions,{}),n=L(F.deliveryTiming.deleteDeliverySessions),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(`all`),[c,l]=(0,K.useState)(J),[u,d]=(0,K.useState)(null),{from:f,to:ee}=bt(c),m=c.to===`now`?1/0:ee,h=r.trim()!==``||a!==`all`||c!==J,g=()=>{i(``),o(`all`),l(J)},_=(0,K.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,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(xt,{q:r,onQChange:i,searchPlaceholder:s(),timeRange:c,onTimeRangeChange:l,onReset:g,canReset:h,children:(0,q.jsxs)(H,{value:a,onValueChange:e=>o(e),children:[(0,q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,q.jsx)(G,{})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:`all`,children:oe()}),(0,q.jsx)(V,{value:`active`,children:qe()}),(0,q.jsx)(V,{value:`stopped`,children:w()})]})]})}),(0,q.jsx)(Ct,{title:Ke(),rows:_,emptyHint:p(),columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(R,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?E():O(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,q.jsx)(ot,{size:15,"aria-hidden":!0}):(0,q.jsx)(at,{size:15,"aria-hidden":!0})})},{header:Je(),sort:e=>e.startedAt,cell:e=>(0,q.jsx)(`span`,{className:`tabular-nums`,children:W(e.startedAt)})},{header:Ge(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,q.jsx)(`span`,{className:`tabular-nums`,children:W(e.stoppedAt)})},{header:ve(),sort:e=>e.count,cell:e=>(0,q.jsx)(`span`,{className:`tabular-nums`,children:Y(e.count)})},{header:k(),sort:e=>e.startedBy,cell:e=>Tt(e.startedBy)},{header:A(),sort:e=>e.active,cell:e=>e.active?(0,q.jsx)(B,{variant:`secondary`,children:qe()}):(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:w()})}],rowActions:e?e=>[{label:I(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:I(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,q.jsx)(Ot,{sessionId:e.sessionId})})]})}function Ot({sessionId:e}){let t=T(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,K.useState)(!1);return(0,q.jsx)(kt,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(nt(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function kt({report:e,copied:t,onCopy:n}){if(!e)return(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:Oe()});if(e.count===0||e.segments===null)return(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let r=e.segments,a=(e,t)=>(0,q.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,q.jsx)(`td`,{className:`py-1`,children:e}),(0,q.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,q.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[Y(t.p50),` / `,Y(t.p95),` / `,Y(t.max)]})]});return(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,de()]}),(0,q.jsxs)(R,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,q.jsx)(ct,{size:13,"aria-hidden":!0}):(0,q.jsx)(rt,{size:13,"aria-hidden":!0}),t?v():ze()]})]}),(0,q.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,q.jsx)(`th`,{className:`py-1 font-medium`,children:Me()}),(0,q.jsx)(`th`,{className:`py-1 text-right font-medium`,children:He()}),(0,q.jsx)(`th`,{className:`py-1 text-right font-medium`,children:D()})]})}),(0,q.jsxs)(`tbody`,{children:[a(i(),r.bridge),a(ie(),r.A),a(_e(),r.C)]})]}),(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:pe()}),e.truncated?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):null,(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]})}var At=[50,100,200,500],X=`all`,Z=`__all__`,jt=[`2xx`,`4xx`,`5xx`],Mt=[`user`,`service`,`system`],Nt=[`inbound`,`outbound`,`internal`],Pt={kind:`relative`,from:`now-30d`,to:`now`},Ft=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:Fe()},{value:`principalType`,label:C()},{value:`direction`,label:`direction`},{value:`roleKey`,label:j()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function It(){let e=it({from:`/settings/traces`}),t=tt({from:`/settings/traces`}),n=e.limit,i=e.kind,a=e.statusClass??Z,s=e.principalType??Z,c=e.direction??Z,l=e.roleKey??Z,u=e.q??``,d=e.correlationId,p=dt(e.from,e.to),g=(0,K.useMemo)(()=>vt(e.adv),[e.adv]),{from:v,to:y}=bt(p),[b,x]=(0,K.useState)(null),[ne,S]=(0,K.useState)(null),ie=e=>void t({search:t=>({...t,limit:e})}),oe=e=>void t({search:t=>({...t,kind:e})}),se=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),de=e=>void t({search:t=>({...t,statusClass:e===Z?void 0:e})}),pe=e=>void t({search:t=>({...t,principalType:e===Z?void 0:e})}),he=e=>void t({search:t=>({...t,direction:e===Z?void 0:e})}),_e=e=>void t({search:t=>({...t,roleKey:e===Z?void 0:e})}),ve=e=>void t({search:t=>({...t,...mt(e)})}),C=e=>void t({search:t=>({...t,adv:lt(e)}),replace:!0}),w=T(F.observability.listEvents,{limit:n}),E=T(F.observability.listEvents,{limit:n,kind:i===X?void 0:i,...d?{correlationId:d}:{},filter:{q:u||void 0,from:v,to:y,statusClass:a===Z?void 0:a,principalType:s===Z?void 0:s,direction:c===Z?void 0:c,roleKey:l===Z?void 0:l,advanced:g.length>0?g:void 0}}),D=(0,K.useMemo)(()=>{let e=new Set;for(let t of w??[])e.add(t.kind);return[...e].sort()},[w]),O=(0,K.useMemo)(()=>{let e=new Set;for(let t of w??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[w]),k=u!==``||a!==Z||s!==Z||c!==Z||l!==Z||g.length>0||p.kind!==`relative`||p.from!==Pt.from;function A(){t({search:{limit:100,kind:`all`},replace:!0})}let j=b?w?.filter(e=>e.correlationId===b):E,M=e.section,N=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,q.jsxs)(et,{value:M,onValueChange:e=>N(e),children:[(0,q.jsxs)($e,{className:`w-full`,children:[(0,q.jsxs)(Ze,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,q.jsx)(st,{size:13,"aria-hidden":!0}),Ee()]}),(0,q.jsxs)(Ze,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,q.jsx)(wt,{size:13,"aria-hidden":!0}),Be()]})]}),(0,q.jsx)(Qe,{value:`latency`,children:(0,q.jsx)(Et,{})}),(0,q.jsxs)(Qe,{value:`events`,className:`flex flex-col gap-3`,children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[we(),(0,q.jsx)(`strong`,{children:Te()}),je(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:Le()})]}),(0,q.jsxs)(xt,{q:u,onQChange:se,searchPlaceholder:Ce(),timeRange:p,onTimeRangeChange:ve,onReset:A,canReset:k,children:[(0,q.jsxs)(H,{value:a,onValueChange:de,children:[(0,q.jsx)(z,{size:`sm`,className:`w-32`,children:(0,q.jsx)(G,{placeholder:xe()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:We()}),jt.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:s,onValueChange:pe,children:[(0,q.jsx)(z,{size:`sm`,className:`w-32`,children:(0,q.jsx)(G,{placeholder:ke()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:be()}),Mt.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:c,onValueChange:he,children:[(0,q.jsx)(z,{size:`sm`,className:`w-32`,children:(0,q.jsx)(G,{placeholder:Ve()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:Pe()}),Nt.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsxs)(H,{value:l,onValueChange:_e,children:[(0,q.jsx)(z,{size:`sm`,className:`w-36`,children:(0,q.jsx)(G,{placeholder:ye()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(V,{value:Z,children:De()}),O.map(e=>(0,q.jsx)(V,{value:e,children:e},e))]})]}),(0,q.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:i===X?``:i,placeholder:P(),"aria-label":P(),onChange:e=>{let t=e.target.value.trim();oe(t===``?X:t)}}),(0,q.jsx)(`datalist`,{id:`oc-trace-kinds`,children:D.map(e=>(0,q.jsx)(`option`,{value:e},e))}),(0,q.jsxs)(H,{value:String(n),onValueChange:e=>ie(Number(e)),children:[(0,q.jsx)(z,{size:`sm`,className:`w-28`,children:(0,q.jsx)(G,{})}),(0,q.jsx)(U,{children:At.map(e=>(0,q.jsx)(V,{value:String(e),children:Ne({count:e})},e))})]})]}),(0,q.jsx)(St,{fields:Ft,seed:g,onChange:C}),b?(0,q.jsx)(`div`,{className:`oc-traces__followline`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>x(null),title:Ue(),children:[(0,q.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Se(),(0,q.jsx)(`code`,{children:Q(b)})]}),(0,q.jsx)(Xe,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`sr-only`,children:r()})]})}):null,(0,q.jsx)(Ct,{title:re(),rows:j,emptyHint:b?ge():fe(),columns:[{header:me(),sort:e=>e.at,cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:W(e.at)})},{header:h(),sort:e=>e.kind,cell:e=>(0,q.jsx)(B,{variant:`secondary`,children:e.kind})},{header:Re(),sort:e=>$(e)??null,cell:e=>{let t=$(e);return t?(0,q.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,q.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":_(),children:`✓`})}},{header:f(),sort:e=>e.direction,cell:e=>e.direction?(0,q.jsx)(B,{variant:`outline`,children:e.direction}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ue(),sort:e=>e.principalType,cell:e=>(0,q.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,q.jsx)(B,{variant:`outline`,children:e.principalType}),e.principalId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:Q(e.principalId)}):null]})},{header:ce(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,q.jsx)(B,{variant:`secondary`,children:e.roleKey}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ee(),sort:e=>e.route,cell:e=>e.route?(0,q.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,q.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:le(),sort:e=>e.status,cell:e=>e.status===null?(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,q.jsx)(`span`,{className:`oc-traces__status ${Lt(e.status)}`,children:e.status})},{header:o(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,q.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Ye(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,q.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:ae(),onClick:()=>x(e.correlationId),children:Q(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:te(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,q.jsx)(R,{variant:`outline`,size:`sm`,onClick:()=>S(e),children:m()}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,q.jsx)(Rt,{row:ne,onClose:()=>S(null)})]})]})}function Lt(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function Q(e){return e.length>8?e.slice(0,8):e}function $(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,K.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,q.jsx)(yt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,q.jsxs)(pt,{className:`max-w-lg`,children:[(0,q.jsxs)(ut,{children:[(0,q.jsxs)(ht,{className:`oc-traces__meta-title`,children:[d(),` `,(0,q.jsx)(`code`,{children:e.kind}),(0,q.jsx)(B,{variant:`outline`,children:S()})]}),(0,q.jsx)(_t,{children:x()})]}),(0,q.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{It as TracesTab};
|