@lacneu/atrium 0.102.0 → 0.103.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-gaTBs3lV.js +1 -0
- package/dist/assets/{AdminSettings-B8n1yLsD.js → AdminSettings-CMjix9zl.js} +1 -1
- package/dist/assets/{AdvancedFilter-Bb66m5kb.js → AdvancedFilter-5BMuHHt6.js} +1 -1
- package/dist/assets/AgentFilesTab-D3tMMo2R.js +3 -0
- package/dist/assets/AnomaliesTab-CdFgsRwT.js +1 -0
- package/dist/assets/AuditTab-Yw1LvjgD.js +1 -0
- package/dist/assets/BridgeTab-CBE4zTQ1.js +1 -0
- package/dist/assets/ChatDefaultsTab-CIX9WUCl.js +1 -0
- package/dist/assets/{ConfirmDialog-BXcki0Ee.js → ConfirmDialog-Dy8WCeAF.js} +1 -1
- package/dist/assets/{DataTableShell-DRFFBx_j.js → DataTableShell-2_QPZexc.js} +1 -1
- package/dist/assets/DeletedChatsTab-Fzk38aqT.js +1 -0
- package/dist/assets/{DetailChips-Cv1sxdhU.js → DetailChips-DaliQU_Q.js} +1 -1
- package/dist/assets/{EntitySheet-B2B48bss.js → EntitySheet-D-JZB54h.js} +1 -1
- package/dist/assets/FeedbacksTab-DWmslsAt.js +1 -0
- package/dist/assets/{FieldLabel-Tea3wyVe.js → FieldLabel-D63ry-fi.js} +1 -1
- package/dist/assets/FilesTab-DzHfzOnQ.js +1 -0
- package/dist/assets/{FilterBar-DTVwlDpF.js → FilterBar-Bynn2H7k.js} +1 -1
- package/dist/assets/GroupsTab-hxsjfQDc.js +1 -0
- package/dist/assets/InstancesTab-DsJ_BBfc.js +1 -0
- package/dist/assets/IntegrationsTab-Cf3lTCzz.js +1 -0
- package/dist/assets/KnobRow-3my9jz_H.js +1 -0
- package/dist/assets/KpiTab-C6dn6jVl.js +1 -0
- package/dist/assets/PreferencesTab-DiDi7mpY.js +1 -0
- package/dist/assets/ProjectPage-DDto6xkD.js +1 -0
- package/dist/assets/PromptInjectionsTab-D3drsS9C.js +4 -0
- package/dist/assets/RolesTab-DDYieLTF.js +1 -0
- package/dist/assets/ScheduledTab-D-yTTYHC.js +1 -0
- package/dist/assets/ServiceAccountsTab-fJYmH0eU.js +1 -0
- package/dist/assets/SubAgentReportsTab-GXHpWbrW.js +1 -0
- package/dist/assets/ThemeShowroom-uU3PL_6V.js +1 -0
- package/dist/assets/{TimeRangePicker-D3PJq1H8.js → TimeRangePicker-DzJYDik_.js} +1 -1
- package/dist/assets/{TimezoneCombobox-CPTpWNQm.js → TimezoneCombobox-BY91kPSf.js} +1 -1
- package/dist/assets/TracesTab-C7zX1NUU.js +1 -0
- package/dist/assets/TrashTab-BVZJggvr.js +1 -0
- package/dist/assets/UsersTab-HdsTBYR0.js +1 -0
- package/dist/assets/VoiceTab-CnZ-twTR.js +1 -0
- package/dist/assets/{alert-dialog-BoEv1f8g.js → alert-dialog-DRrmbZYC.js} +1 -1
- package/dist/assets/{api-DSJJn0d7.js → api-CUskDNHD.js} +5 -5
- package/dist/assets/{badge-C4po8DQ1.js → badge-TiMZiv59.js} +1 -1
- package/dist/assets/{button-Dio0PVrp.js → button-CbHyzXCb.js} +1 -1
- package/dist/assets/capabilities-CASxhKEd.js +1 -0
- package/dist/assets/{card-CerX9wDn.js → card-vUc-7TYj.js} +1 -1
- package/dist/assets/check-Da8rPJKX.js +1 -0
- package/dist/assets/{checkbox-CsI4ggnp.js → checkbox-Czxm5pNj.js} +1 -1
- package/dist/assets/chevron-left-DxPC6E1S.js +1 -0
- package/dist/assets/chevron-right-BjOti-z8.js +1 -0
- package/dist/assets/chevron-up-DfOJb3vW.js +1 -0
- package/dist/assets/chevrons-up-down-Bp7zuoEk.js +1 -0
- package/dist/assets/{compatView--1YlftIc.js → compatView-Dj1HQXxr.js} +1 -1
- package/dist/assets/confTabs-BzReq467.css +1 -0
- package/dist/assets/convexApi-BPSJUy2j.js +1 -0
- package/dist/assets/{copy-BaUCUMp2.js → copy-C1_4Ewod.js} +1 -1
- package/dist/assets/{cronDescribe-CAuRX7uW.js → cronDescribe-BC0AcJer.js} +1 -1
- package/dist/assets/{deliveryRecorder-C7NQZrrH.js → deliveryRecorder-CGhwQ1sg.js} +1 -1
- package/dist/assets/{dialog-BfrsWZiD.js → dialog-DpoEg_Ex.js} +1 -1
- package/dist/assets/dispatchErrorInfo-BOJ5cTZo.js +1 -0
- package/dist/assets/{dist-ClkJChBn.js → dist-BmXC8pZv.js} +1 -1
- package/dist/assets/{dist-D7doQlva.js → dist-BqsRl4o3.js} +1 -1
- package/dist/assets/{dist-D-RIDSJc.js → dist-CHsekWGV.js} +1 -1
- package/dist/assets/{dist-Cw3aN_jM.js → dist-Cv-LvOB4.js} +1 -1
- package/dist/assets/{dist-CkbybbG7.js → dist-DQawXTf-.js} +1 -1
- package/dist/assets/{dist-ChrIV8UV.js → dist-HZSdA3kh.js} +1 -1
- package/dist/assets/{download-DWgC7zCa.js → download-Do4pcXOL.js} +1 -1
- package/dist/assets/{dropdown-menu-DHMOOlaP.js → dropdown-menu-BWxfj48Z.js} +1 -1
- package/dist/assets/{eye-B-ipuYEd.js → eye-yUMVb9gl.js} +1 -1
- package/dist/assets/{format-DGKgJf2p.js → format-zM-c-1S6.js} +1 -1
- package/dist/assets/{groupManageView-BMBqgRhV.js → groupManageView-DY6vPM1h.js} +1 -1
- package/dist/assets/index-B7hQ_j0i.js +158 -0
- package/dist/assets/index-D8Eob_Mc.css +1 -0
- package/dist/assets/{input-BSpTsBA6.js → input-DCbMcJYs.js} +1 -1
- package/dist/assets/{list-eSch39T9.js → list-DIWFv1eJ.js} +1 -1
- package/dist/assets/loader-circle-BO0Lx5va.js +1 -0
- package/dist/assets/{lock-0lxfSnTE.js → lock-X9ZGk2P9.js} +1 -1
- package/dist/assets/{pencil-aUWxuLhy.js → pencil-1kZxxbnV.js} +1 -1
- package/dist/assets/plus-CSOLqt7C.js +1 -0
- package/dist/assets/{popover-DBaIbsBr.js → popover-DiT_Oo6e.js} +1 -1
- package/dist/assets/roleDescriptions-CmJBKAaf.js +1 -0
- package/dist/assets/rotate-ccw-C-v_7YX7.js +1 -0
- package/dist/assets/{search-BK6bzZNi.js → search-D9Un2NMX.js} +1 -1
- package/dist/assets/searchSchemas-Dm-Qg010.js +55 -0
- package/dist/assets/{select-qM3ZfTHx.js → select-DCBGpD8v.js} +1 -1
- package/dist/assets/{server-DLnWqkX-.js → server-BSDuYUUF.js} +1 -1
- package/dist/assets/{speech-CrNma2Ue.js → speech-CfxX6OY3.js} +1 -1
- package/dist/assets/{star-CM6J2w_J.js → star-DjK6DoNA.js} +1 -1
- package/dist/assets/switch-Dt_I92ZY.js +1 -0
- package/dist/assets/{table-D2SJC960.js → table-GXZ7yFCE.js} +1 -1
- package/dist/assets/{tabs-mZfLmn2f.js → tabs-dQ50HGoj.js} +1 -1
- package/dist/assets/{toast-xNFwDnUy.js → toast-C8rSAMgh.js} +1 -1
- package/dist/assets/{tooltip-v_AyOWn6.js → tooltip-D3qNpGhD.js} +1 -1
- package/dist/assets/{trash-2-B4WSfc7G.js → trash-2-8oRd823U.js} +1 -1
- package/dist/assets/trashPage-CoBMe_r-.js +1 -0
- package/dist/assets/{trashView-Ct0Xw-a9.js → trashView-CIgTWQjI.js} +1 -1
- package/dist/assets/{triangle-alert-BkDa-x8g.js → triangle-alert-DQoWKyu_.js} +1 -1
- package/dist/assets/{usageView-C9Y6E0Zu.js → usageView-B0Wg081i.js} +1 -1
- package/dist/assets/{useChart-CKFEN42T.js → useChart-xKc_wRHf.js} +1 -1
- package/dist/assets/{useFontScale-ByBFat3y.js → useFontScale-C03nea0B.js} +1 -1
- package/dist/assets/{useStartNewChat-BszDHUjD.js → useStartNewChat-B66bn5hT.js} +2 -2
- package/dist/assets/{use_paginated_query-CQj09xXv.js → use_paginated_query-BatXdmTn.js} +1 -1
- package/dist/assets/{users-BJqaWlH1.js → users-DHMAZ7v8.js} +1 -1
- package/dist/assets/x-6-84PEVq.js +1 -0
- package/dist/index.html +57 -57
- package/package.json +2 -2
- package/dist/assets/AccessTab-JmFp20Kp.js +0 -1
- package/dist/assets/AgentFilesTab-C3CUT4Ep.js +0 -3
- package/dist/assets/AnomaliesTab-BQ2Bu98W.js +0 -1
- package/dist/assets/AuditTab-BV-XydO_.js +0 -1
- package/dist/assets/BridgeTab-D4RFq-Rb.js +0 -1
- package/dist/assets/ChatDefaultsTab-D0d9yEow.js +0 -1
- package/dist/assets/DeletedChatsTab-COYSFkNf.js +0 -1
- package/dist/assets/FeedbacksTab-6URuFdfg.js +0 -1
- package/dist/assets/FilesTab-esMtHJXt.js +0 -1
- package/dist/assets/GroupsTab-Io16XZHz.js +0 -1
- package/dist/assets/InstancesTab-BevtM68H.js +0 -1
- package/dist/assets/IntegrationsTab-DMY6VTUC.js +0 -1
- package/dist/assets/KnobRow-BsOT2O6U.js +0 -1
- package/dist/assets/KpiTab-KPPcgUxA.js +0 -1
- package/dist/assets/PreferencesTab-DJ9p401L.js +0 -1
- package/dist/assets/ProjectPage-BxEF71jN.js +0 -1
- package/dist/assets/PromptInjectionsTab-Vdb1lF36.js +0 -4
- package/dist/assets/RolesTab-DU0g4d-R.js +0 -1
- package/dist/assets/ScheduledTab-B6gWc0HN.js +0 -1
- package/dist/assets/ServiceAccountsTab-Dmb_LH0V.js +0 -1
- package/dist/assets/SubAgentReportsTab-D9rclslo.js +0 -1
- package/dist/assets/ThemeShowroom-N4qzUtlq.js +0 -1
- package/dist/assets/TracesTab-DiAkOmei.js +0 -1
- package/dist/assets/TrashTab-BMSJ7ANC.js +0 -1
- package/dist/assets/UsersTab-BQaLsUCK.js +0 -1
- package/dist/assets/VoiceTab-BSh-05Ze.js +0 -1
- package/dist/assets/capabilities-BTqhMVxR.js +0 -1
- package/dist/assets/check-DmQzfrws.js +0 -1
- package/dist/assets/chevron-left-DQ9FCoo_.js +0 -1
- package/dist/assets/chevron-right-C_b_y922.js +0 -1
- package/dist/assets/chevron-up-Dsqj2Oaj.js +0 -1
- package/dist/assets/chevrons-up-down-Pva00Np5.js +0 -1
- package/dist/assets/confTabs-CCBW5ofF.css +0 -1
- package/dist/assets/convexApi-CyScjgcq.js +0 -1
- package/dist/assets/dispatchErrorInfo-Bb7JyJFO.js +0 -1
- package/dist/assets/index-D6RuTaB7.css +0 -1
- package/dist/assets/index-DQC7YnEQ.js +0 -158
- package/dist/assets/loader-circle-BNhIFGdg.js +0 -1
- package/dist/assets/plus-Djbdyc2E.js +0 -1
- package/dist/assets/roleDescriptions-x3mUxTcX.js +0 -1
- package/dist/assets/rotate-ccw-BD-9XzMC.js +0 -1
- package/dist/assets/searchSchemas-CS2ZgsHC.js +0 -64
- package/dist/assets/trashPage-WtAhGCt7.js +0 -1
- package/dist/assets/x-CK8d5DC1.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$z as r,FZ as i,PB as a,Qz as o,_k as s,bk as c,cB as l,ck as u,dk as d,fk as f,gk as p,hk as m,lB as h,lk as g,mk as ee,oB as te,pk as _,sB as v,sk as y,t as b,uk as x,vk as S,xk as C,yk as w}from"./api-CUskDNHD.js";import{n as T,t as ne}from"./useNavigate-D3GIoxyW.js";import"./convexApi-BPSJUy2j.js";import{c as re,n as ie,o as E}from"./searchSchemas-Dm-Qg010.js";import{t as D}from"./appHost-CH3EGcJw.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-vUc-7TYj.js";import{n as N,t as P}from"./TimeRangePicker-DzJYDik_.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=i(b.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=i(b.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:a()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:h()}),(0,R.jsx)(j,{children:v()})]}),(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),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),s=e=>74-e*68/i,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),u=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:[o(),` p50 `,B(u.cP50),` `,l()]}),(0,R.jsxs)(`span`,{children:[r(),` p50 `,B(u.aP50),` `,l()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":h(),children:[(0,R.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:c(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:w(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:S(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:s(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:p(),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 Y(){let e=T({from:`/settings/kpi`}),t=ne({from:`/settings/kpi`}),n=E(e.from,e.to,ie,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=J(a,o),l=i(b.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),p=(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:_()})]}),(0,R.jsx)(ae,{value:n,onChange:r})]});return l===void 0?(0,R.jsxs)(R.Fragment,{children:[p,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:f()})]}):l.length===0?(0,R.jsxs)(R.Fragment,{children:[p,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:d()})]}):(0,R.jsxs)(R.Fragment,{children:[p,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,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:x({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:g()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:u({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":y({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{Y as KpiTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,$X as i,CK as a,DK as o,EK as s,FZ as c,GG as l,JG as u,JX as d,KG as f,OK as p,PZ as m,QG as h,QX as ee,SK as g,TK as te,TZ as ne,Tl as re,UG as ie,WG as ae,XG as _,XX as oe,YG as se,YI as ce,YX as le,ZG as ue,ZX as de,_K as fe,_Z as pe,aK as me,aZ as he,al as v,bK as y,bZ as b,cK as x,cZ as S,cl as C,dK as w,dZ as T,dl as E,eK as D,eZ as O,fK as k,fZ as A,gK as j,gZ as M,hK as N,hZ as P,iK as F,iZ as I,il as L,lK as R,lZ as ge,ll as _e,mK as ve,mZ as ye,nK as z,nZ as be,oK as xe,oZ as Se,ol as Ce,pK as we,pZ as Te,qG as Ee,rK as De,rZ as Oe,sK as ke,sZ as Ae,sl as je,t as B,tK as Me,tZ as Ne,uK as Pe,uZ as Fe,ul as Ie,vK as Le,wK as Re,wl as ze,xK as Be,yK as Ve,yl as He}from"./api-CUskDNHD.js";import{t as V}from"./checkbox-Czxm5pNj.js";import{a as Ue,i as We,n as Ge,r as H,t as Ke}from"./select-DCBGpD8v.js";import{t as U}from"./button-CbHyzXCb.js";import{t as W}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{c as qe,d as Je,r as Ye,t as Xe,u as Ze}from"./useFontScale-C03nea0B.js";import{r as Qe}from"./toast-C8rSAMgh.js";import{t as G}from"./badge-TiMZiv59.js";import{t as K}from"./appHost-CH3EGcJw.js";import{t as $e}from"./localePickerView-C2RmOS86.js";import{t as et}from"./switch-Dt_I92ZY.js";import{t as tt}from"./TimezoneCombobox-BY91kPSf.js";var q=t(e(),1),J=[{id:`messages`,label:()=>p()},{id:`composer`,label:()=>o()},{id:`sidebar`,label:()=>s()},{id:`notifications`,label:()=>R()},{id:`other`,label:()=>te()}],Y={showSource:{category:`messages`,label:()=>Re(),help:()=>a()},showReport:{category:`messages`,label:()=>g(),help:()=>Be()},copyAssistant:{category:`messages`,label:()=>y()},copyUser:{category:`messages`,label:()=>Ve()},showDelete:{category:`messages`,label:()=>Le()},showTools:{category:`messages`,label:()=>fe(),help:()=>j()},voiceInput:{category:`composer`,label:()=>N(),help:()=>ve()},showUsage:{category:`composer`,label:()=>we(),help:()=>k()},autoReadAloud:{category:`composer`,label:()=>re(),help:()=>ze()},showChatAge:{category:`sidebar`,label:()=>w(),help:()=>Pe()},notifSound:{category:`notifications`,label:()=>x(),help:()=>ke()},notifSystem:{category:`notifications`,label:()=>xe(),help:()=>me()},replySound:{category:`notifications`,label:()=>F(),help:()=>De()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function nt(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var 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 Z(e){return e===`admin`}function Q(e){return e===!0?`on`:e===!1?`off`:`inherit`}function ot(e){return e===`on`||e!==`off`&&null}function st(e){return at(e)?it[e]:void 0}var $=n(),ct={voiceInput:()=>Ee()};function lt({prefKey:e,ui:t}){let n=m(B.admin.setUiPrefDefault),r=m(B.admin.setFeatureEnabled),i=st(e),a=i?ct[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ue()}),(0,$.jsxs)(Ke,{value:Q(t.defaults[e]),onValueChange:t=>void n({key:e,value:ot(t)}),children:[(0,$.jsx)(We,{size:`sm`,className:`w-36`,children:(0,$.jsx)(Ue,{})}),(0,$.jsxs)(Ge,{children:[(0,$.jsx)(H,{value:`on`,children:l()}),(0,$.jsx)(H,{value:`off`,children:ae()}),(0,$.jsx)(H,{value:`inherit`,children:ie()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(V,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":_()}),_()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function ut({current:e,enabled:t}){let n=m(B.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ze(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,$.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[E(),e?(0,$.jsx)(G,{variant:`secondary`,children:Je(e,qe())}):null]}),(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:a?C():r?_e():Ie()})]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:L()}):null,(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?v():e?Ce():je()})]})]})}function dt(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=c(B.me.getMe,{host:K}),o=a?.ui,s=Z(a?.role)&&n,l=m(B.me.setUiPref).withOptimisticUpdate(Ye),d=(0,q.useMemo)(()=>o?nt(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(a?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(V,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":h()}),h()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:se()}),(0,$.jsx)(`p`,{children:u()}),(0,$.jsx)(`p`,{children:f()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:z(),"aria-label":z(),className:`mb-2`}),d.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:Me()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:d.map(e=>(0,$.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,i=t?.help?.(),a=o.locked[e],c=o.effective[e],u=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${a?` is-locked`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,a?(0,$.jsx)(G,{variant:`outline`,children:D()}):u?(0,$.jsx)(G,{variant:`secondary`,children:He()}):null]}),i?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:i}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!a&&u?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:r()}):null,(0,$.jsx)(et,{checked:c,disabled:a,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),s?(0,$.jsx)(lt,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,$.jsx)(ut,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:ne()})}var ft={sm:()=>he(),md:()=>I(),lg:()=>Oe(),xl:()=>be(),"2xl":()=>Ne(),"3xl":()=>O()};function pt(){let e=c(B.me.getMe,{host:K}),t=m(B.me.setLocale),n=m(B.me.setTimezone),r=m(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:K});n&&e.setQuery(B.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=m(B.me.setMyName),o=Qe(),s=e?.locale??`default`,l=e?.name??``,[u,f]=(0,q.useState)(null),p=u??l,h=p.trim()!==l.trim();async function g(){try{await a({name:p}),f(null),o.success(Te())}catch(e){o.error(A(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:M()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:p,maxLength:120,placeholder:P(),onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&h&&(e.preventDefault(),g())}}),(0,$.jsx)(U,{size:`sm`,disabled:!h,onClick:()=>void g(),children:ce()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:T()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:Fe()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[$e().map(e=>(0,$.jsx)(U,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(U,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:b()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ge()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:i()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,$.jsx)(U,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:de()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:oe()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:S()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:Xe.map(t=>(0,$.jsx)(U,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:ft[t]()},t))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:le()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,$.jsx)(dt,{})]})]})}export{pt as PreferencesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,BD as i,CO as a,E as o,FD as s,FO as c,FZ as l,HD as u,HO as d,ID as ee,KD as te,LD as ne,LO as f,Ms as p,OO as m,PO as h,PZ as g,QD as re,RD as _,RO as v,SO as y,TO as ie,TZ as b,UO as ae,VD as x,WD as S,WO as oe,XD as se,ZD as ce,_O as C,aO as le,bO as ue,cO as de,dO as fe,fO as pe,gO as w,hO as me,iO as T,jO as he,js as ge,jw as _e,kO as ve,lO as ye,mO as E,nO as D,oO as be,pO as xe,rO as O,sO as Se,t as k,tD as A,tO as Ce,uO as j,xO as we,yO as Te,zD as M}from"./api-CUskDNHD.js";import{n as Ee,t as N}from"./useNavigate-D3GIoxyW.js";import{A as De,B as Oe,C as P,D as ke,E as F,F as Ae,G as je,H as Me,I,J as Ne,K as L,R as Pe,S as R,T as Fe,U as Ie,V as Le,W as z,_ as Re,a as B,f as V,h as ze,i as Be,j as Ve,m as He,n as H,o as U,p as W,r as Ue,s as G,t as We,u as Ge,w as Ke,x as qe,y as Je,z as Ye}from"./useStartNewChat-B66bn5hT.js";import{r as Xe}from"./dist-BmXC8pZv.js";import{t as Ze}from"./chevron-right-BjOti-z8.js";import{c as Qe,g as $e,i as et,n as tt,r as K,s as nt,t as rt}from"./dropdown-menu-BWxfj48Z.js";import{n as it,t as at}from"./eye-yUMVb9gl.js";import{t as ot}from"./list-DIWFv1eJ.js";import{t as st}from"./pencil-1kZxxbnV.js";import{t as ct}from"./trash-2-8oRd823U.js";import{t as q}from"./button-CbHyzXCb.js";import{t as lt}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{r as ut}from"./toast-C8rSAMgh.js";import{n as dt,r as ft}from"./ConfirmDialog-Dy8WCeAF.js";import{t as pt}from"./EntitySheet-D-JZB54h.js";import{r as mt,t as ht}from"./trashView-CIgTWQjI.js";var gt=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`}]]),_t=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`}]]),vt=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`}]]),J=o(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Y=t(e(),1),X=n();function yt({className:e}){return(0,X.jsx)(Qe,{asChild:!0,children:(0,X.jsx)(q,{variant:`ghost`,size:`icon-xs`,"aria-label":u(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,X.jsx)($e,{})})})}function Z({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=g(k.projects.renameProject),s=g(k.projects.setProjectColor),c=g(k.projects.moveProject),u=g(k.projects.deleteProject),ee=g(k.projects.createProject),te=dt(),f=mt(),p=ft(),[v,y]=(0,Y.useState)(!1),[b,ce]=(0,Y.useState)(t),[C,le]=(0,Y.useState)(!1),[ue,de]=(0,Y.useState)(!1),fe=l(k.projects.projectTreeCount,ue?{projectId:e}:`skip`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(rt,{onOpenChange:e=>e&&de(!0),children:[(0,X.jsx)(yt,{className:i}),(0,X.jsxs)(tt,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(K,{onSelect:()=>a(),children:[(0,X.jsx)(L,{}),` `,ie()]}),(0,X.jsxs)(K,{onSelect:()=>{ce(t),y(!0)},children:[(0,X.jsx)(st,{}),` `,x()]}),(0,X.jsxs)(K,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await p({title:w(),label:oe(),placeholder:ae(),confirmLabel:d()});t&&await ee({name:t,parentId:e})})},children:[(0,X.jsx)(je,{}),` `,w()]}),(0,X.jsxs)(K,{onSelect:()=>le(!0),children:[(0,X.jsx)(_t,{}),` `,re()]}),(0,X.jsx)(et,{children:_()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e,color:null}),"aria-label":ne(),children:`✕`}),Be.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void s({projectId:e,color:t.value})},t.value))]}),(0,X.jsx)(nt,{}),(0,X.jsxs)(K,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=fe?.folders??0,r=fe?.chats??0;await te({title:m({name:t}),description:ht({folders:n,chats:r,days:f}),confirmWord:S(),confirmLabel:ve(),destructive:!0})&&await u({projectId:e})})},children:[(0,X.jsx)(ct,{}),` `,S()]})]})]}),(0,X.jsx)(pt,{open:v,onOpenChange:y,title:h(),canSubmit:b.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:b.trim()}),y(!1)},submitLabel:x(),children:(0,X.jsx)(lt,{value:b,onChange:e=>ce(e.target.value),autoFocus:!0})}),C?(0,X.jsx)(Ue,{open:C,onOpenChange:le,title:se(),movingFolderId:e,currentId:r,onPick:t=>void c({projectId:e,parentId:t})}):null]})}function bt({chat:e,currentFolderId:t,className:n}){let o=g(k.chats.pinChat),c=g(k.chats.deleteChat),l=g(k.chats.renameChat),u=g(k.chats.setChatSidebar),d=g(k.chats.moveChatToProject),te=dt(),ne=mt(),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(e.title??``),[re,_]=(0,Y.useState)(!1);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(rt,{children:[(0,X.jsx)(yt,{className:n}),(0,X.jsxs)(tt,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,X.jsxs)(K,{onSelect:()=>{h(e.title??``),p(!0)},children:[(0,X.jsx)(st,{}),` `,x()]}),(0,X.jsxs)(K,{onSelect:()=>void o({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,X.jsx)(Ye,{}):(0,X.jsx)(Oe,{}),e.pinned?i():M()]}),(0,X.jsxs)(K,{onSelect:()=>_(!0),children:[(0,X.jsx)(_t,{}),` `,r()]}),e.pinned&&e.inSidebar?null:(0,X.jsxs)(K,{onSelect:()=>void u({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,X.jsx)(Le,{}):(0,X.jsx)(J,{}),e.inSidebar?y():a()]}),(0,X.jsx)(nt,{}),(0,X.jsxs)(K,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await te({title:ee(),description:s({days:ne}),confirmLabel:S(),destructive:!0})&&await c({chatId:e._id})})},children:[(0,X.jsx)(ct,{}),` `,S()]})]})]}),(0,X.jsx)(pt,{open:f,onOpenChange:p,title:A(),canSubmit:m.trim().length>0,onSubmit:async()=>{await l({chatId:e._id,title:m.trim()}),p(!1)},submitLabel:x(),children:(0,X.jsx)(lt,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),re?(0,X.jsx)(Ue,{open:re,onOpenChange:_,title:ce(),currentId:t,onPick:t=>void d({chatId:e._id,projectId:t})}):null]})}function xt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function St(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 Ct(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 wt=`oc.projpage.view`;function Tt(){let e=localStorage.getItem(wt);return e===`cards`||e===`list`?e:`columns`}var Q=e=>`into:${e}`,Et=e=>`col:${e??`null`}`,Dt=e=>`crumb:${e}`;function Ot(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 kt(){let{projectId:e}=Ne({from:`/project/$projectId`}),t=N(),n=l(k.projects.projectPage,{projectId:e});return(0,X.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}):n===null?(0,X.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,X.jsx)(`h2`,{children:T()}),(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:O()}),(0,X.jsx)(q,{variant:`outline`,onClick:()=>void t({to:`/`}),children:D()})]}):(0,X.jsx)(At,{page:n})})}function At({page:e}){let t=N(),n=dt(),r=mt(),i=ft(),a=ut(),o=g(k.projects.renameProject),s=g(k.projects.setProjectColor),u=g(k.projects.deleteProject),ee=g(k.projects.createProject),f=g(k.projects.moveProject),y=g(k.projects.setProjectSidebar),ie=g(k.chats.moveChatToProject),b=g(k.chats.reorderChat),ce=g(k.projects.reorderProject),me=l(k.projects.projectTreeCount,{projectId:e.project._id}),[T,he]=(0,Y.useState)(Tt),ye=e=>{localStorage.setItem(wt,e),he(e)},E=l(k.projects.folderColumns,T===`columns`?{projectId:e.project._id}:`skip`),D=l(k.projects.projectTreeList,T===`list`?{projectId:e.project._id}:`skip`),{c:O}=Ee({from:`/project/$projectId`}),A=l(k.projects.listProjects,{}),j=l(k.chatReads.myBusyChats,{}),M=(0,Y.useMemo)(()=>new Set(j??[]),[j]),{byChat:Oe}=Pe(j??null),P=l(k.chatReads.myChatReads,{}),F=(0,Y.useMemo)(()=>Ct(e.chats,P??[]),[e.chats,P]),{startNewChat:I,picker:Ne}=We(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[L,Le]=(0,Y.useState)(``),[B,V]=(0,Y.useState)(!1),[H,Ye]=(0,Y.useState)(e.project.name),[Xe,Ze]=(0,Y.useState)(!1),[J,yt]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=setTimeout(()=>yt(L.trim()),180);return()=>clearTimeout(e)},[L]);let Z=l(k.search.searchConversations,J.length>=2?{query:J,projectId:e.project._id}:`skip`),bt=Fe(Ke(Re,{activationConstraint:{distance:4}}),Ke(Je,{activationConstraint:{delay:250,tolerance:8}})),Q=(0,Y.useRef)(!1),Et=()=>{Q.current=!0,setTimeout(()=>{Q.current=!1},0)},[Dt,kt]=(0,Y.useState)(null),At=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=E?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||v()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).find(t=>t._id===e)?.name??``}}return null},Nt=e=>kt(At(String(e.active.id))),$=(0,Y.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=R(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=R(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=R(n(`crumb:`));if(a.length>0)return a;let o=R(n(`col:`));return o.length>0?o:qe(n(t?`folder:`:`chat:`))},[]),It=t=>{if(T===`columns`){for(let e of E?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(T===`list`){let e=D?.chats.find(e=>e._id===t);return e?{list:D.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},Lt=t=>{if(T===`columns`){for(let e of E?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(T===`list`){let e=D?.folders.find(e=>e._id===t);if(!e||!D)return null;let n=e.parentId??D.rootId;return{list:Ve(D.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{kt(null),Et();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),o=i.startsWith(`chat:`);try{let e=Ot(r);if(e!==void 0){if(o){let t=i.slice(5);await ie({chatId:t,projectId:e})}else{let t=i.slice(7);if(t===e)return;if(!De(A??[],t,e)){a.error(C());return}await f({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=It(t);if(!n)return;n.list.some(t=>t._id===e)||await ie({chatId:e,projectId:n.folderId});let a=St(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await b({chatId:e,...a});return}if(!o&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!De(A??[],e,n.parentId)){a.error(C());return}await f({projectId:e,parentId:n.parentId})}let o=St(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await ce({projectId:e,...o});return}}catch{a.error(C())}},[,Bt]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=U(e.project),Ut=xt(e.chats,L),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{Q.current||e()};return(0,X.jsx)(Ae.Provider,{value:Oe,children:(0,X.jsxs)(He,{sensors:bt,collisionDetection:$,onDragStart:Nt,onDragEnd:zt,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,X.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":Ce(),children:[Wt.map(e=>(0,X.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,X.jsx)(jt,{folderId:e._id,children:(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,X.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,X.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,X.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,X.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,X.jsxs)(q,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:p(),onClick:()=>{y({projectId:e.project._id,hidden:!1})},children:[(0,X.jsx)(it,{"aria-hidden":!0}),(0,X.jsx)(`span`,{children:ge()}),(0,X.jsx)(at,{"aria-hidden":!0})]}):null,(0,X.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":we(),children:[(0,X.jsx)(q,{variant:T===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":we(),title:we(),"aria-pressed":T===`cards`,onClick:()=>ye(`cards`),children:(0,X.jsx)(vt,{})}),(0,X.jsx)(q,{variant:T===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ue(),title:ue(),"aria-pressed":T===`columns`,onClick:()=>ye(`columns`),children:(0,X.jsx)(gt,{})}),(0,X.jsx)(q,{variant:T===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Te(),title:Te(),"aria-pressed":T===`list`,onClick:()=>ye(`list`),children:(0,X.jsx)(ot,{})})]}),(0,X.jsxs)(q,{variant:`outline`,size:`sm`,onClick:()=>void I({projectId:e.project._id}),children:[(0,X.jsx)(Ie,{}),fe()]}),(0,X.jsxs)(q,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:w(),label:oe(),placeholder:ae(),confirmLabel:d()});t&&await ee({name:t,parentId:e.project._id})},children:[(0,X.jsx)(je,{}),w()]}),(0,X.jsxs)(rt,{children:[(0,X.jsx)(Qe,{asChild:!0,children:(0,X.jsx)(q,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),children:(0,X.jsx)($e,{})})}),(0,X.jsxs)(tt,{align:`end`,className:`w-48`,children:[(0,X.jsxs)(K,{onSelect:()=>{Ye(e.project.name),V(!0)},children:[(0,X.jsx)(st,{}),` `,x()]}),(0,X.jsxs)(K,{onSelect:()=>Ze(!0),children:[(0,X.jsx)(_t,{}),` `,re()]}),(0,X.jsx)(et,{children:_()}),(0,X.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,X.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e.project._id,color:null}),"aria-label":ne(),children:`✕`}),Be.map(t=>(0,X.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void s({projectId:e.project._id,color:t.value})},t.value))]}),(0,X.jsx)(nt,{}),(0,X.jsxs)(K,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=me?.folders??0,o=me?.chats??0;await n({title:m({name:e.project.name}),description:ht({folders:a,chats:o,days:r}),confirmWord:S(),confirmLabel:ve(),destructive:!0})&&(await u({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,X.jsx)(ct,{}),` `,S()]})]})]})]})]}),T===`columns`?(0,X.jsx)(Rt,{data:E,currentId:e.project._id,busyIds:M,suppressClick:Q,locateChatId:O??null}):T===`list`?(0,X.jsx)(Ft,{data:D,busyIds:M,suppressClick:Q,locateChatId:O??null}):(0,X.jsxs)(X.Fragment,{children:[e.children.length>0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:xe()}),(0,X.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,X.jsx)(G,{items:e.children.map(e=>`folder:${e._id}`),strategy:Ge,children:e.children.map(t=>(0,X.jsx)(Mt,{child:t,parentId:e.project._id,now:Vt,suppressClick:Q},t._id))})})]}):null,(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:pe()}),e.chats.length>0?(0,X.jsx)(lt,{value:L,onChange:e=>Le(e.target.value),placeholder:de(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?be():le()}):Ut.length===0&&(Z??[]).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:Se({term:L.trim()})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,X.jsx)(G,{items:Ut.map(e=>`chat:${e._id}`),strategy:W,children:Ut.map(t=>(0,X.jsx)(Pt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:M.has(t._id),unread:F.has(t._id),locate:t._id===O,suppressClick:Q},t._id))})})]}),J.length>=2&&Z!==void 0?(0,X.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,X.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:te()}),Z.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:Se({term:J})}):(0,X.jsx)(`ul`,{className:`oc-projpage__chats`,children:Z.map(e=>(0,X.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&J&&ke(e.messageId,J),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,X.jsx)(Me,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,X.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||_e()}),e.projectPath&&e.projectPath.length>1?(0,X.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,X.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,X.jsx)(pt,{open:B,onOpenChange:V,title:h(),canSubmit:H.trim().length>0,onSubmit:async()=>{await o({projectId:e.project._id,name:H.trim()}),V(!1)},submitLabel:x(),children:(0,X.jsx)(lt,{value:H,onChange:e=>Ye(e.target.value),autoFocus:!0})}),Xe?(0,X.jsx)(Ue,{open:Xe,onOpenChange:Ze,title:se(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void f({projectId:e.project._id,parentId:t})}):null,Ne]}),(0,X.jsx)(ze,{children:Dt?(0,X.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Dt.kind===`folder`?(0,X.jsx)(z,{size:13,"aria-hidden":!0}):(0,X.jsx)(Me,{size:13,"aria-hidden":!0}),(0,X.jsx)(`span`,{children:Dt.label})]}):null})]})})}function jt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=P({id:Dt(e)});return(0,X.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Mt({child:e,parentId:t,now:n,suppressClick:r}){let i=N(),a=V({id:`folder:${e._id}`}),o=P({id:Q(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":U(e),transform:F.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,X.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,X.jsx)(z,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,X.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,X.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?j({count:e.folderCount})+` · `:``,ye({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,X.jsx)(`span`,{className:`oc-projpage__cardage`,children:H(e.lastActivityAt,n)})]})}function Nt({chat:e}){let t=g(k.chats.setChatSidebar),n=e.inSidebar?y():a();return(0,X.jsx)(q,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,X.jsx)(Le,{}):(0,X.jsx)(J,{})})}function Pt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,Y.useContext)(Ae).get(e._id),c=N(),l=B(e.color),u=V({id:`chat:${e._id}`}),d=$(a);return(0,X.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:F.Transform.toString(u.transform),transition:u.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||v()}),e.pinned?(0,X.jsx)(Oe,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,X.jsx)(`span`,{className:`oc-projpage__chatage`,children:H(e.updatedAt,n)}),r?(0,X.jsx)(`span`,{className:I(s,f()).className,title:I(s,f()).label,"aria-label":I(s,f()).label}):null,i&&!r?(0,X.jsx)(`span`,{className:`oc-chatitem__unread`,title:he(),"aria-label":he()}):null]}),(0,X.jsx)(Nt,{chat:e}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function $(e){let t=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ft({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,Y.useState)(new Set),o=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b()});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=Ve(e.folders,a);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(G,{items:u.map(e=>`chat:${e._id}`),strategy:W,children:u.map(e=>(0,X.jsx)(Lt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,X.jsx)(G,{items:d.map(e=>`folder:${e._id}`),strategy:W,children:d.map(t=>(0,X.jsx)(It,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,X.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Ve(e.folders,null).length===0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:be()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=N(),c=V({id:`folder:${e._id}`}),l=P({id:Q(e._id)});return(0,X.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,X.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":U(e),transform:F.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,X.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?me():E(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,X.jsx)(Ze,{size:13}):(0,X.jsx)(Xe,{size:13})}),(0,X.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,Y.useContext)(Ae).get(e._id),o=N(),s=V({id:`chat:${e._id}`}),c=$(r),l=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:F.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||v()}),n?(0,X.jsx)(`span`,{className:I(a,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,X.jsx)(Nt,{chat:e})]})}function Rt({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,X.jsx)(`p`,{className:`oc-projpage__hint`,children:b()}):(0,X.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,X.jsx)(zt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function zt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=N(),s=P({id:Et(e.folderId)});return(0,X.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,X.jsx)(G,{items:e.folders.map(e=>`folder:${e._id}`),strategy:W,children:e.folders.map(t=>(0,X.jsx)(Bt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,X.jsx)(G,{items:e.chats.map(e=>`chat:${e._id}`),strategy:W,children:e.chats.map(t=>(0,X.jsx)(Vt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,X.jsx)(`p`,{className:`oc-projpage__colempty`,children:le()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=V({id:`folder:${e._id}`}),o=P({id:Q(e._id)});return(0,X.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":U(e),transform:F.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,X.jsx)(z,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,X.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,X.jsx)(Z,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,Y.useContext)(Ae).get(e._id),s=V({id:`chat:${e._id}`}),c=$(r),l=B(e.color);return(0,X.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:F.Transform.toString(s.transform),transition:s.transition},children:[(0,X.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,X.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,X.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,X.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||v()}),n?(0,X.jsx)(`span`,{className:I(o,``).className,"aria-hidden":!0}):null]}),(0,X.jsx)(bt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,X.jsx)(Nt,{chat:e})]})}export{kt as ProjectPage};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$f as i,$m as a,BA as o,FA as s,FZ as c,GA as l,HA as u,IA as d,JA as f,KA as p,LA as m,Os as h,PZ as ee,QA as g,Qf as te,Qm as ne,RA as re,UA as _,VA as v,WA as y,XA as b,Xf as x,YA as S,Yf as C,ZA as ie,Zf as ae,Zm as oe,cj as se,cp as ce,eh as w,ej as T,fd as E,lp as D,md as O,op as k,pd as A,qA as j,sj as M,sp as N,t as P,th as F,zA as I}from"./api-CUskDNHD.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-D63ry-fi.js";import{t as V}from"./checkbox-Czxm5pNj.js";import{a as H,c as le,o as U,s as W}from"./tooltip-D3qNpGhD.js";import{a as G,i as K,n as q,r as J,t as Y}from"./select-DCBGpD8v.js";import{t as X}from"./button-CbHyzXCb.js";import{r as ue}from"./toast-C8rSAMgh.js";import{t as de}from"./appHost-CH3EGcJw.js";import{r as Z,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:S,help:f},documentary_fetch:{label:j,help:p},inbound_files:{label:l,help:y},history_summary:{label:F,help:w},file_curation:{label:D,help:i},quote_reply:{label:ce,help:N}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
|
+
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
|
+
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
|
+
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:m,references:d,files:s,previous_summary:a,new_messages:ne,max_chars:oe,file_name:te,budget_chars:ae,feedback:x,content:C,excerpt:k};function _e(){let e=c(P.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:u()})});let i=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(R,{label:T(),help:r()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:_()}),(0,$.jsxs)(Y,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsx)(q,{children:e.map(e=>(0,$.jsx)(J,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:i},i._id)]})}function ve({instance:e}){let t=ee(P.admin.upsertInstanceConfig),n=ue(),r=c(P.me.getMe,{host:de}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>L(i,a));(0,Q.useEffect)(()=>{s(L(i,a))},[a,e._id]);let[l,u]=(0,Q.useState)(!1),d=o.promptInjections,f=(e,t)=>s({...o,promptInjections:{...d,[e]:{...d[e],...t}}});async function p(){u(!0);try{await t({instanceId:e._id,config:z(o,i,a)})}catch(e){n.error(M(),e)}finally{u(!1)}}async function m(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(M(),e)}}let h=e.config?.contentLocale??`default`,g=fe[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:O()}),(0,$.jsxs)(Y,{value:h,onValueChange:e=>void m(e),children:[(0,$.jsx)(K,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(G,{})}),(0,$.jsxs)(q,{children:[(0,$.jsx)(J,{value:`default`,children:E({locale:g})}),pe().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:A()})]}),U.map(e=>(0,$.jsx)(ye,{injKey:e,def:H[e],i18n:me[e],row:d[e]??{enabled:!0,template:H[e].defaultTemplate[a]},contentLocale:a,onChange:t=>f(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(X,{size:`sm`,onClick:()=>void p(),disabled:l,children:se()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),f=W(e,r,i),p=f?le(f,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(V,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:ie()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:b()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?o():v()}),l&&(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:g()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:p}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:I()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:h()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:re()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AP as i,BP as ee,FP as te,FZ as a,GP as o,HP as ne,IP as s,JP as c,KP as l,LP as re,MP as ie,NP as u,Np as d,OP as f,PP as ae,PZ as p,QP as m,RP as h,SP as g,UP as _,VP as v,WP as y,XP as b,YP as x,ZP as S,_P as C,bP as w,eF as T,gP as E,hP as D,iF as O,jP as k,kP as A,mP as j,nF as M,qP as N,rF as P,t as F,tF as I,vP as L,xP as oe,yP as R,zP as z}from"./api-CUskDNHD.js";import{t as B}from"./lock-X9ZGk2P9.js";import{t as V}from"./checkbox-Czxm5pNj.js";import{t as H}from"./button-CbHyzXCb.js";import{t as U}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{r as W}from"./toast-C8rSAMgh.js";import{t as G}from"./badge-TiMZiv59.js";import{n as K}from"./ConfirmDialog-Dy8WCeAF.js";import{t as q}from"./EntitySheet-D-JZB54h.js";import{t as J}from"./roleDescriptions-CmJBKAaf.js";var Y=t(e(),1),X=n(),Z=[{group:()=>O(),keys:[{key:`traces.read`,label:()=>r()},{key:`traces.read.content`,label:()=>m(),phi:!0},{key:`traces.write`,label:()=>S()}]},{group:()=>P(),keys:[{key:`kpi.read`,label:()=>r()},{key:`kpi.write`,label:()=>S()}]},{group:()=>M(),keys:[{key:`openclaw.query`,label:()=>b()},{key:`anomalies.read`,label:()=>x()},{key:`anomalies.report`,label:()=>c()}]},{group:()=>I(),keys:[{key:`chats.read`,label:()=>r()},{key:`selfheal`,label:()=>l()},{key:`media.repair`,label:()=>o()},{key:`feedback.respond`,label:()=>d()}]},{group:()=>T(),keys:[{key:`admin.manage`,label:()=>N()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=a(F.apiKeys.listRoles,{}),t=p(F.apiKeys.createRole),n=p(F.apiKeys.ensureRolesSeeded),r=p(F.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(F.apiKeys.listRoles,{});r&&e.setQuery(F.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=K(),c=W(),[l,d]=(0,Y.useState)(!1),[m,b]=(0,Y.useState)($),[x,S]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(_(),e)})},[n,c]);let T=e??[];async function O(e,t){if(Q(e.permissions))return;if(e.builtin){await o({title:ne({name:e.name}),description:v(),confirmLabel:ee()});return}if(x.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 r({roleId:e._id,permissions:n})}catch(e){c.error(z(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function M(){try{await t({key:m.key,name:m.name,description:m.description||void 0,permissions:[]}),b($),d(!1)}catch(e){c.error(h(),e)}}let N=e===void 0,P=!N&&T.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,s(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,te()]}),(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:ae()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(H,{size:`sm`,onClick:()=>{b($),d(!0)},children:u()})})]}),N?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):P?(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:i()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?y({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:T.map(e=>{let t=Q(e.permissions),n=x.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)(G,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(B,{}),` `,A()]}):(0,X.jsx)(G,{variant:`secondary`,children:f()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(V,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?g():n?oe():r,onCheckedChange:()=>void O(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:l,onOpenChange:d,title:w(),description:R(),canSubmit:!!(m.key&&m.name),onSubmit:M,submitLabel:L(),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:C()}),(0,X.jsx)(U,{value:m.key,placeholder:E(),onChange:e=>b({...m,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:D()}),(0,X.jsx)(U,{value:m.name,onChange:e=>b({...m,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,X.jsx)(U,{value:m.description,onChange:e=>b({...m,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$Y as r,BJ as i,CJ as a,DY as o,DZ as s,E as c,EY as l,FJ as u,FZ as d,GJ as f,HJ as p,IJ as m,JJ as h,JY as g,KJ as _,LJ as v,MZ as y,OY as ee,PJ as te,QY as ne,RJ as re,SJ as ie,SY as b,TY as ae,TZ as oe,UJ as se,VJ as ce,WJ as le,XY as ue,YJ as de,YY as fe,ZY as pe,_J as me,_Y as he,aX as ge,aY as _e,bJ as ve,bY as ye,cJ as be,cX as xe,cY as Se,dJ as Ce,dY as we,eX as Te,eY as Ee,fJ as De,gJ as Oe,gY as ke,hJ as Ae,hY as je,iX as Me,iY as Ne,kY as Pe,lJ as Fe,lX as Ie,lY as Le,mJ as Re,mY as ze,nX as Be,nY as Ve,oX as He,oY as Ue,pJ as We,qJ as x,rX as Ge,rY as Ke,sJ as qe,sX as Je,sY as Ye,t as S,tJ as Xe,tX as Ze,tY as Qe,uJ as $e,vJ as et,vY as tt,wJ as nt,wY as rt,xJ as it,xY as at,yJ as ot,yY as st,zJ as ct}from"./api-CUskDNHD.js";import{t as C}from"./chevron-left-DxPC6E1S.js";import{t as w}from"./chevron-right-BjOti-z8.js";import{t as lt}from"./list-DIWFv1eJ.js";import{t as ut}from"./loader-circle-BO0Lx5va.js";import{a as dt,i as ft,n as pt,r as mt,t as ht}from"./cronDescribe-BC0AcJer.js";import{t as gt}from"./pencil-1kZxxbnV.js";import{t as _t}from"./rotate-ccw-C-v_7YX7.js";import{t as vt}from"./trash-2-8oRd823U.js";import{a as T,i as E,n as D,r as O,t as k}from"./select-DCBGpD8v.js";import{a as yt,c as bt,i as xt,n as St,o as Ct,r as wt,s as Tt,t as Et}from"./alert-dialog-DRrmbZYC.js";import{n as A,r as j,t as M}from"./popover-DiT_Oo6e.js";import{t as N}from"./button-CbHyzXCb.js";import{t as Dt}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{r as Ot}from"./toast-C8rSAMgh.js";import{t as P}from"./badge-TiMZiv59.js";import{a as kt,i as At,n as jt,o as Mt,r as Nt,t as Pt}from"./dialog-DpoEg_Ex.js";import{t as Ft}from"./appHost-CH3EGcJw.js";import{a as It,i as F,n as Lt,o as Rt,r as I,t as zt}from"./table-GXZ7yFCE.js";import{t as Bt}from"./FilterBar-Bynn2H7k.js";/* empty css */import{a as Vt,c as L,i as R,l as Ht,n as Ut,o as z,r as Wt,s as Gt,t as Kt,u as B}from"./TimezoneCombobox-BY91kPSf.js";var qt=c(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Jt=c(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),V=t(e(),1),H=n();function U(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Ht(e),r=(0,V.useMemo)(()=>new Date,[]),[i,a]=(0,V.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,c]=(0,V.useState)(!1),l=(0,V.useMemo)(()=>U(s()),[]),u=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s(),{month:`long`,year:`numeric`}),[]),d=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s(),{dateStyle:`medium`,timeStyle:`short`}),[]),p=L(i.year,i.month),m=n?.hour??9,g=n?.minute??0,v=(e,n,r,i,a)=>t(B(e,n,r,i,a)),y=(e,t,n)=>{a({year:e,month:t}),v(e,t,n,m,g)},ee=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},te=n===null?h():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,H.jsxs)(M,{modal:!0,open:o,onOpenChange:c,children:[(0,H.jsx)(j,{asChild:!0,children:(0,H.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":de(),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)(A,{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":x(),onClick:()=>ee(-1),children:(0,H.jsx)(C,{size:15,"aria-hidden":!0})}),(0,H.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,H.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":_(),onClick:()=>ee(1),children:(0,H.jsx)(w,{size:15,"aria-hidden":!0})})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),p.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:()=>y(e.year,e.month,e.day),children:e.day},t)})]}),(0,H.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,H.jsxs)(k,{value:String(m),onValueChange:e=>v(i.year,i.month,n?.day??r.getDate(),Number(e),g),children:[(0,H.jsx)(E,{size:`sm`,"aria-label":f(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(D,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,H.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,H.jsxs)(k,{value:String(g),onValueChange:e=>v(i.year,i.month,n?.day??r.getDate(),m,Number(e)),children:[(0,H.jsx)(E,{size:`sm`,"aria-label":le(),children:(0,H.jsx)(T,{})}),(0,H.jsx)(D,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,H.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function W(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=W(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function Qt(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function $t(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function en(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function tn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var G=3;function nn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:a,onEventClick:o,footnote:c}){let l=s(),u=(0,V.useMemo)(()=>Zt(e),[e]),d=(0,V.useMemo)(()=>$t(l),[l]),f=(0,V.useMemo)(()=>new Intl.DateTimeFormat(l,{month:`long`,year:`numeric`}),[l]),p=(0,V.useMemo)(()=>new Intl.DateTimeFormat(l,{month:`long`}),[l]),h=(0,V.useMemo)(()=>new Intl.DateTimeFormat(l,{hour:`2-digit`,minute:`2-digit`}),[l]),g=new Date,_=e=>{if(t===`year`){a({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);a({year:r.getFullYear(),month:r.getMonth()})},y=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)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":v(),onClick:()=>_(-1),children:(0,H.jsx)(C,{})}),(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,"aria-label":m(),onClick:()=>_(1),children:(0,H.jsx)(w,{})}),(0,H.jsx)(N,{variant:`ghost`,size:`sm`,onClick:()=>a({year:g.getFullYear(),month:g.getMonth()}),children:re()})]}),(0,H.jsx)(`span`,{className:`oc-cal__title`,children:y}),(0,H.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,H.jsx)(N,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:i()}),(0,H.jsx)(N,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:ct()})]})]}),t===`month`?(0,H.jsx)(rn,{cursor:n,byDay:u,weekdays:d,timeFmt:h,now:g,onEventClick:o}):(0,H.jsx)(an,{year:n.year,byDay:u,monthShortFmt:p,now:g,onOpenMonth:e=>{a({year:n.year,month:e}),r(`month`)}}),c?(0,H.jsx)(`p`,{className:`oc-cal__footnote`,children:c}):null]})}function rn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=L(e.year,e.month);return(0,H.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,H.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],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:u({count:o.length-G})}):null]},n)})]})}function an({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,H.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=Qt(t,e,o),c=L(e,o);return(0,H.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,H.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,H.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,H.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var on={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*on[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=z(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Gt(e)){case`ok`:return(0,H.jsx)(P,{variant:`secondary`,children:Se()});case`error`:return(0,H.jsx)(P,{variant:`destructive`,children:Ue()});case`running`:return(0,H.jsx)(P,{variant:`outline`,children:_e()});case`other`:return(0,H.jsx)(P,{variant:`outline`,children:e});case`none`:return(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=y(S.scheduled.listMyCrons),t=y(S.scheduled.getCronDetail),n=y(S.scheduled.listCronRuns),i=y(S.scheduled.updateCron),c=y(S.scheduled.removeCron),u=y(S.scheduled.runCronNow),f=Ot(),m=d(S.me.getMe,{host:Ft})?.timezone,[h,_]=(0,V.useState)(null),[v,re]=(0,V.useState)(!1),[le,de]=(0,V.useState)(!1),[x,ct]=(0,V.useState)(null),[C,w]=(0,V.useState)(null),[A,j]=(0,V.useState)(null),[M,L]=(0,V.useState)(null),[Ht,Gt]=(0,V.useState)(!1),[B,U]=(0,V.useState)(Ut),[W,Xt]=(0,V.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[Qt,$t]=(0,V.useState)(`month`),[G,rn]=(0,V.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),an=(0,V.useMemo)(()=>{let e=[];for(let t of h??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,B)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[h,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()=>{re(!0),de(!1);try{_(await e({}))}catch{de(!0)}finally{re(!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)(()=>{h!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[h]);let Y=(0,V.useMemo)(()=>new Intl.DateTimeFormat(s(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ct(e);try{await t(),f.success(n),await q()}catch(e){f.toast({variant:`error`,title:b({code:dn(e)})})}finally{ct(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),f.toast({variant:`error`,title:b({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;L(null),f.toast({variant:`error`,title:b({code:dn(e)})})}},mn=async()=>{if(M===null)return;let e={};if(M.nameDirty&&M.name.trim()===``||M.messageDirty&&M.hasMessage&&M.message.trim()===``){f.toast({variant:`error`,title:qe()});return}if(M.nameDirty&&M.name.trim()!==``&&(e.name=M.name.trim()),M.scheduleDirty){if(M.scheduleKind===`cron`&&M.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:M.cronExpr.trim(),...M.tz.trim()===``?{}:{tz:M.tz.trim()}};else if(M.scheduleKind===`every`){let t=Number(M.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[M.everyUnit])})}else if(M.scheduleKind===`at`&&M.at!==``){let t=Date.parse(M.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(M.scheduleDirty&&e.schedule===void 0){f.toast({variant:`error`,title:be()});return}if(M.messageDirty&&M.hasMessage&&M.message.trim()!==``&&(e.message=M.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Gt(!0);try{await i({instanceName:M.instanceName,jobId:M.jobId,patch:e}),f.success(it()),t===Q.current&&L(null),await q()}catch(e){f.toast({variant:`error`,title:b({code:dn(e)})})}finally{Gt(!1)}},hn=h?.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:Ie()}),(0,H.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":se(),children:[(0,H.jsx)(N,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":p(),title:p(),"aria-pressed":W===`list`,onClick:()=>Zt(`list`),children:(0,H.jsx)(lt,{})}),(0,H.jsx)(N,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ce(),title:ce(),"aria-pressed":W===`calendar`,onClick:()=>Zt(`calendar`),children:(0,H.jsx)(qt,{})})]}),(0,H.jsxs)(N,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:v,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,H.jsx)(_t,{size:14,"aria-hidden":!0}),xe()]})]}),h!==null&&hn>0?(0,H.jsxs)(Bt,{q:B.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:Ke(),onReset:()=>U(Ut),canReset:Wt(B),children:[(0,H.jsxs)(k,{value:B.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,H.jsx)(E,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`all`,children:Ve()}),(0,H.jsx)(O,{value:`active`,children:fe()}),(0,H.jsx)(O,{value:`paused`,children:ue()}),(0,H.jsx)(O,{value:`auto-disabled`,children:g()})]})]}),(0,H.jsxs)(k,{value:B.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,H.jsx)(E,{size:`sm`,className:`w-40`,children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`all`,children:Qe()}),(0,H.jsx)(O,{value:`ok`,children:Se()}),(0,H.jsx)(O,{value:`error`,children:Ue()}),(0,H.jsx)(O,{value:`running`,children:_e()}),(0,H.jsx)(O,{value:`none`,children:Ne()})]})]})]}):null,h===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":v,children:le?Je():oe()}):W===`calendar`?(0,H.jsxs)(H.Fragment,{children:[le?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):null,h.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):(0,H.jsx)(nn,{events:sn.events,mode:Qt,cursor:G,onModeChange:$t,onCursorChange:rn,onEventClick:K,footnote:te()})]}):(0,H.jsxs)(H.Fragment,{children:[le?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):null,h.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:He()}):null,h.map(e=>{let t=e.jobs.filter(e=>Vt(e,B)),n=Wt(B)&&e.jobs.length>0&&t.length===0;return(0,H.jsxs)(`section`,{style:{marginBottom:20},children:[h.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)(P,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Me({code:e.error})}):e.jobs.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}):n?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:Ee()}):(0,H.jsxs)(zt,{children:[(0,H.jsx)(It,{children:(0,H.jsxs)(Rt,{children:[(0,H.jsx)(F,{children:Be()}),(0,H.jsx)(F,{children:Ze()}),(0,H.jsx)(F,{children:Te()}),(0,H.jsx)(F,{children:r()}),(0,H.jsx)(F,{children:ne()}),(0,H.jsx)(F,{children:Le()}),(0,H.jsx)(F,{children:nt()})]})}),(0,H.jsx)(Lt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,s=x===r,c=e.manageSupported,d=e.kind===`openclaw`&&c;return(0,H.jsxs)(Rt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,H.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??pe()}),(0,H.jsx)(I,{children:(0,H.jsx)(P,{variant:`secondary`,children:t.agentId})}),(0,H.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,H.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ht(t.schedule),n=e===null?null:pt(e);return n===null?null:(0,H.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,H.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,H.jsx)(I,{children:z(t)===`auto-disabled`?(0,H.jsx)(P,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:g()}):z(t)===`active`?(0,H.jsx)(P,{variant:`secondary`,children:fe()}):z(t)===`paused`?(0,H.jsx)(P,{variant:`outline`,children:ue()}):(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,H.jsxs)(I,{children:[(0,H.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,H.jsx)(P,{variant:`destructive`,title:t.lastDeliveryError??Pe(),children:Ye()}):null]}),(0,H.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):s?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,H.jsxs)(`span`,{className:`oc-cronactions`,children:[d?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:o(),"aria-label":o(),disabled:x!==null,onClick:()=>void X(r,async()=>{let n=await u({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},at()),children:(0,H.jsx)(mt,{size:14,"aria-hidden":!0})}):null,d&&t.enabled!==null?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:R(t)===`pause`?l():ae(),"aria-label":R(t)===`pause`?l():ae(),disabled:x!==null,onClick:()=>void X(r,()=>i({instanceName:e.instanceName,jobId:t.id,patch:{enabled:R(t)===`resume`}}),R(t)===`pause`?ye():st()),children:R(t)===`pause`?(0,H.jsx)(dt,{size:14,"aria-hidden":!0}):(0,H.jsx)(ft,{size:14,"aria-hidden":!0})}):null,d?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:a(),"aria-label":a(),disabled:x!==null,onClick:()=>void pn(e.instanceName,t),children:(0,H.jsx)(gt,{size:14,"aria-hidden":!0})}):null,d?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:ie(),"aria-label":ie(),disabled:x!==null,onClick:()=>void ln(e.instanceName,t),children:(0,H.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,c?(0,H.jsx)(N,{variant:`ghost`,size:`icon-sm`,title:rt(),"aria-label":rt(),disabled:x!==null,onClick:()=>w({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,H.jsx)(vt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ge()})]},e.instanceName)}),hn>0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Xe()}):null]}),(0,H.jsx)(Et,{open:C!==null,onOpenChange:e=>{e||w(null)},children:(0,H.jsxs)(xt,{children:[(0,H.jsxs)(Tt,{children:[(0,H.jsx)(bt,{children:he()}),(0,H.jsx)(yt,{children:ke({name:C?.name??``})})]}),(0,H.jsxs)(Ct,{children:[(0,H.jsx)(wt,{children:je()}),(0,H.jsx)(St,{onClick:()=>{let e=C;w(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),tt())},children:ze()})]})]})}),(0,H.jsx)(Pt,{open:A!==null,onOpenChange:e=>{e||(Z.current++,j(null))},children:(0,H.jsxs)(jt,{style:{maxWidth:640},children:[(0,H.jsx)(kt,{children:(0,H.jsx)(Mt,{children:ve({name:A?.name??``})})}),A?.entries===null?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):A!==null&&A.entries.length===0?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):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:[we({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,H.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,H.jsx)(Pt,{open:M!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,H.jsxs)(jt,{className:`oc-cronedit`,children:[(0,H.jsxs)(kt,{children:[(0,H.jsx)(Mt,{children:et()}),(0,H.jsx)(Nt,{children:me()})]}),M===null?null:M.loading?(0,H.jsx)(`p`,{className:`oc-admin__hint`,children:oe()}):(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:Be()}),(0,H.jsx)(Dt,{value:M.name,maxLength:200,onChange:e=>L({...M,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:Oe()}),(0,H.jsxs)(k,{value:M.scheduleKind,onValueChange:e=>L({...M,scheduleKind:e,scheduleDirty:!0}),children:[(0,H.jsx)(E,{children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`cron`,children:Ae()}),(0,H.jsx)(O,{value:`every`,children:Re()}),(0,H.jsx)(O,{value:`at`,children:We()})]})]}),M.scheduleKind===`cron`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Dt,{value:M.cronExpr,onChange:e=>L({...M,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,H.jsx)(Kt,{value:M.tz,onChange:e=>L({...M,tz:e,scheduleDirty:!0}),fallbackTz:m??void 0})]}):M.scheduleKind===`every`?(0,H.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,H.jsx)(Dt,{type:`number`,min:1,value:M.everyValue,onChange:e=>L({...M,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,H.jsxs)(k,{value:M.everyUnit,onValueChange:e=>L({...M,everyUnit:e,scheduleDirty:!0}),children:[(0,H.jsx)(E,{style:{maxWidth:160},children:(0,H.jsx)(T,{})}),(0,H.jsxs)(D,{children:[(0,H.jsx)(O,{value:`minutes`,children:De()}),(0,H.jsx)(O,{value:`hours`,children:Ce()}),(0,H.jsx)(O,{value:`days`,children:$e()})]})]})]}):(0,H.jsx)(Yt,{value:M.at,onChange:e=>L({...M,at:e,scheduleDirty:!0})})]}),M.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:ee()}),(0,H.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:M.message,onChange:e=>L({...M,message:e.target.value,messageDirty:!0})})]}):null]}),(0,H.jsxs)(At,{children:[(0,H.jsx)(N,{variant:`ghost`,onClick:()=>L(null),children:je()}),(0,H.jsxs)(N,{onClick:()=>void mn(),disabled:M===null||M.loading||Ht,children:[Ht?(0,H.jsx)(ut,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Fe()]})]})]})})]})}export{pn as ScheduledTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$W as r,AG as i,AW as a,BG as ee,BW as o,CG as te,CW as s,DG as ne,DW as c,EG as re,EW as l,FG as ie,FW as ae,FZ as u,GW as d,HG as oe,HW as f,IG as p,IW as m,JW as se,KW as ce,LG as h,LW as le,MG as ue,MW as g,MZ as de,NG as fe,NW as _,OG as pe,OW as v,PG as me,PW as y,PZ as b,QW as he,RG as ge,RW as x,SG as _e,SW as S,TG as ve,TW as ye,UW as be,VG as xe,VW as C,WW as w,XW as Se,YW as Ce,ZW as we,_G as Te,aG as Ee,bG as De,cG as Oe,dG as ke,eG as Ae,fG as je,gG as Me,hG as Ne,iG as Pe,jG as Fe,jW as T,kG as Ie,kW as E,lG as Le,mG as Re,nG as ze,oG as Be,pG as Ve,qW as He,rG as Ue,sG as We,t as D,tG as Ge,uG as Ke,vG as qe,wG as Je,wW as O,xG as Ye,yG as Xe,zG as Ze,zW as k}from"./api-CUskDNHD.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as A}from"./check-Da8rPJKX.js";import{r as et}from"./dist-BmXC8pZv.js";import{t as tt}from"./chevron-right-BjOti-z8.js";import{t as j}from"./copy-C1_4Ewod.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-DCBGpD8v.js";import{t as L}from"./button-CbHyzXCb.js";import{t as R}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{r as nt}from"./toast-C8rSAMgh.js";import{t as z}from"./badge-TiMZiv59.js";import{n as B,t as V}from"./format-zM-c-1S6.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./dialog-DpoEg_Ex.js";import{n as rt}from"./ConfirmDialog-Dy8WCeAF.js";import{t as it}from"./EntitySheet-D-JZB54h.js";import{t as at}from"./FilterBar-Bynn2H7k.js";import{t as ot}from"./DataTableShell-2_QPZexc.js";import{t as st}from"./roleDescriptions-CmJBKAaf.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>v(),days:null},{value:`30`,label:()=>c(),days:30},{value:`90`,label:()=>l(),days:90}],X=720*60*60*1e3,Z=`__all__`,Q={name:``,roleKey:``,description:``};function $(){let e=Qe({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,a=e.status??Z,[o,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})}),ae=u(D.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:o===Z?void 0:o,disabled:a===Z?void 0:a===`disabled`}}),d=u(D.apiKeys.listKeys,{}),f=u(D.apiKeys.listRoles,{}),m=b(D.apiKeys.createServiceAccount),le=b(D.apiKeys.updateServiceAccount),g=b(D.apiKeys.deleteServiceAccount),_=de(D.apiKeys.mintApiKey),v=b(D.apiKeys.revokeApiKey),y=rt(),x=nt(),S=n!==``||o!==Z||a!==Z;function ye(){s(Z),t({search:{},replace:!0})}let[be,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(Q),[E,O]=(0,J.useState)(null),[k,A]=(0,J.useState)(new Set),[j,B]=(0,J.useState)(null),V=(0,J.useRef)(!1),[H,U]=(0,J.useState)(new Set),[W,G]=(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){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{E?(await le({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),x.success(Be())):await m({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Q),O(null),C(!1)}catch(e){x.error(E?We():Oe(),e)}}function ft(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function pt(e){if(V.current)return;V.current=!0;let t=W[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 _({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){x.error(Ee(),e)}finally{V.current=!1,B(null)}}async function mt(e){if(await y({title:Pe(),description:(0,Y.jsxs)(Y.Fragment,{children:[Ue(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,ze(),` `,(0,Y.jsx)(`strong`,{children:Ge()}),` `,Ae()]}),confirmWord:e.name,confirmLabel:r(),destructive:!0}))try{await g({serviceAccountId:e._id}),x.success(he(),e.name)}catch(e){x.error(we(),e)}}async function ht(e){if(await y({title:Se(),description:(0,Y.jsxs)(Y.Fragment,{children:[Ce(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,se()]}),confirmLabel:He(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await v({keyId:e._id})}catch(e){x.error(ce(),e)}finally{U(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:oe()}),(0,Y.jsxs)(at,{q:n,onQChange:c,searchPlaceholder:xe(),onReset:ye,canReset:S,children:[(0,Y.jsxs)(I,{value:o,onValueChange:s,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(M,{placeholder:ee()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:Z,children:Ze()}),(f??[]).map(e=>(0,Y.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(I,{value:a,onValueChange:l,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:Z,children:ge()}),(0,Y.jsx)(F,{value:`active`,children:h()}),(0,Y.jsx)(F,{value:`disabled`,children:p()})]})]})]}),(0,Y.jsx)(ot,{title:ie(),rows:ae,addLabel:me(),onAdd:()=>{T(Q),O(null),C(!0)},emptyHint:fe(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,Y.jsx)(lt,{account:e,keys:X.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Ie(),onSelect:()=>ft(e)},{label:ue(),onSelect:()=>void pt(e)}]:[],{label:k.has(e._id)?Fe():i(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:pe(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?ne():re(),onClick:()=>$(e._id),children:k.has(e._id)?(0,Y.jsx)(et,{}):(0,Y.jsx)(tt,{})})},{header:ve(),sort:e=>e.name,cell:e=>(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Y.jsx)(`span`,{children:e.name}),e.description?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Je(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})},{header:te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:p()}):(0,Y.jsx)(z,{variant:`outline`,children:h()})},{header:_e(),cell:e=>(0,Y.jsxs)(I,{value:W[e._id]??`never`,onValueChange:t=>G(n=>({...n,[e._id]:t})),children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(M,{})}),(0,Y.jsx)(P,{children:ct.map(e=>(0,Y.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Ye(),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:j===e._id?De():Xe({count:t})})}}]}),(0,Y.jsx)(it,{open:be,onOpenChange:e=>{C(e),e||O(null)},title:E?qe():Ne(),description:E?Te():Re(),canSubmit:!!(w.name&&w.roleKey),onSubmit:dt,submitLabel:E?Me():Ve(),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:je()}),(0,Y.jsx)(R,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:ke()}),(0,Y.jsxs)(I,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(M,{placeholder:Ke()})}),(0,Y.jsx)(P,{children:(f??[]).map(e=>(0,Y.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===w.roleKey),t=e?st(e):null;return t?(0,Y.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:Le()}),(0,Y.jsx)(R,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:K,onClose:()=>q(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[d(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:be()}),(0,Y.jsx)(`th`,{children:f()}),(0,Y.jsx)(`th`,{children:C()}),(0,Y.jsx)(`th`,{children:o()}),(0,Y.jsx)(`th`,{children:k()}),(0,Y.jsx)(`th`,{children:x()}),(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)(z,{variant:`secondary`,children:e.roleKey})}),(0,Y.jsx)(`td`,{children:B(t.createdAt)}),(0,Y.jsx)(`td`,{className:dt(t.lastUsedAt)?`oc-sa__stale`:``,children:ft(t.lastUsedAt)}),(0,Y.jsx)(`td`,{children:pt(t.expiresAt)}),(0,Y.jsx)(`td`,{children:mt(t)}),(0,Y.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,Y.jsx)(L,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?le():m()}):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)(H,{children:[(0,Y.jsx)(G,{children:ae()}),(0,Y.jsx)(K,{children:y({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:_()}),(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)(L,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":g(),children:[n?(0,Y.jsx)(A,{}):(0,Y.jsx)(j,{}),n?T():a()]})]}),(0,Y.jsx)(U,{children:(0,Y.jsx)(L,{onClick:()=>{r(!1),t()},children:E()})})]}):null})}function dt(e){return e!==null&&Date.now()-e>X}function ft(e){return e===null?ye():B(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:O()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(z,{variant:`outline`,children:s()}):(0,Y.jsx)(z,{variant:`outline`,children:S()})}export{$ as ServiceAccountsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Bh as i,Ch as a,Dh as o,Eh as s,FZ as c,Fh as l,Hh as u,Ih as d,Lh as f,Mh as p,Nh as m,Oh as h,PZ as g,Ph as _,Rh as v,Sh as y,Th as b,Uh as x,Vh as S,Wh as C,_h as w,bh as T,ch as E,dh as D,fh as O,gh as k,hh as A,jh as j,kh as M,lh as N,mh as P,oh as F,ph as I,sh as ee,t as L,uh as R,vh as z,wh as B,xh as V,yh as H,zh as U}from"./api-CUskDNHD.js";import{t as W}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{n as G}from"./format-zM-c-1S6.js";import{n as K}from"./ConfirmDialog-Dy8WCeAF.js";import{t as q}from"./DataTableShell-2_QPZexc.js";var J=t(e(),1),Y=n(),X={hung:()=>o(),wrong_result:()=>s(),error:()=>b(),other:()=>B()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=g(L.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(!1);async function u(){let t=o.trim();if(!(!t||c)){l(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),s(``)}finally{l(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,a({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:y()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?T():H()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:z()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:w(),value:o,maxLength:2e3,rows:3,onChange:e=>s(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void u(),disabled:!o.trim()||c,children:c?A():k()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[P({count:t.children.length}),t.childrenTruncated?` ${I()}`:``,t.textTruncated?` ${O()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${D()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:R()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=c(L.subAgentReports.listForAdmin,{}),t=g(L.subAgentReports.readReport),n=g(L.subAgentReports.deleteReport),a=K(),[o,s]=(0,J.useState)(null),[y,b]=(0,J.useState)({});async function w(e){if(o===e._id){s(null);return}if(!y[e._id]){let n=await t({reportId:e._id});b(t=>({...t,[e._id]:n}))}s(e._id)}async function T(e){await a({title:E(),description:ee(),confirmLabel:F(),destructive:!0})&&(await n({reportId:e._id}),o===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,Y.jsx)(`strong`,{children:S()}),` `,i()]}),(0,Y.jsx)(q,{title:C(),rows:e,emptyHint:x(),isExpanded:e=>o===e._id&&!!y[e._id],renderExpanded:e=>y[e._id]?(0,Y.jsx)($,{data:y[e._id]}):null,columns:[{header:U(),cell:e=>G(e.at),sort:e=>e.at},{header:v(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:f(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:d(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${m({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:l(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:_(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:p()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:j()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:o===e._id?M():r(),onSelect:()=>void w(e)},{label:h(),onSelect:()=>void T(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,AK as i,Aq as a,BK as o,Bq as s,CZ as c,Cq as l,Dq as u,Eq as d,FK as f,FZ as p,Fq as m,GK as h,Gq as ee,HK as g,Hq as _,IK as te,Iq as ne,JK as re,Jq as ie,KK as ae,Kq as oe,LK as v,Lq as se,MK as ce,MZ as le,Mq as ue,NK as y,Nq as de,Oq as fe,PK as pe,PZ as b,Pq as me,QK as he,RK as ge,Rq as _e,SZ as ve,Sq as ye,Tq as be,UK as xe,Uq as Se,VK as Ce,Vq as x,WK as we,Wq as Te,XK as Ee,Xq as De,YK as S,Yq as Oe,ZK as ke,Zq as Ae,_q as je,ah as C,aq as Me,bq as Ne,cq as Pe,dq as Fe,eq as Ie,fq as Le,gq as Re,hq as ze,ih as w,iq as Be,jK as Ve,jq as He,kK as Ue,kq as We,lq as Ge,mq as T,nh as Ke,nq as qe,oq as Je,pq as Ye,qK as Xe,qq as Ze,r as Qe,rh as $e,rq as et,sq as tt,t as E,tq as nt,uq as rt,vq as it,wq as at,xZ as ot,xq as st,yq as ct,zK as lt,zq as ut}from"./api-CUskDNHD.js";import{t as D}from"./check-Da8rPJKX.js";import{c as dt,g as O,i as ft,n as pt,r as k,s as A,t as mt}from"./dropdown-menu-BWxfj48Z.js";import{t as ht}from"./download-Do4pcXOL.js";import{t as j}from"./checkbox-Czxm5pNj.js";import{i as M,n as gt,r as _t}from"./useChart-xKc_wRHf.js";import{t as N}from"./x-6-84PEVq.js";import{a as P,i as F,n as I,r as L,t as R}from"./select-DCBGpD8v.js";import{t as z}from"./button-CbHyzXCb.js";import{t as B}from"./input-DCbMcJYs.js";import"./convexApi-BPSJUy2j.js";import{t as V}from"./badge-TiMZiv59.js";import{t as H}from"./appHost-CH3EGcJw.js";import{t as vt}from"./localePickerView-C2RmOS86.js";import{a as yt,i as bt,n as xt,o as St,r as Ct,t as wt}from"./card-vUc-7TYj.js";import{a as Tt,i as U,n as Et,o as W,r as G,t as Dt}from"./table-GXZ7yFCE.js";import{t as Ot}from"./TimeRangePicker-DzJYDik_.js";import{t as kt}from"./FilterBar-Bynn2H7k.js";import{t as At}from"./AdvancedFilter-5BMuHHt6.js";var K=t(e(),1),jt=.1,Mt=[248,248,248],Nt=[24,24,24];function Pt(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 Ft(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function q(e,t,n){return Ft(e,t,n)>=jt}function It(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 Lt(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 Rt=12*1024*1024,zt=480,Bt=160,Vt=.92;async function Ht(e,t={}){if(!e.type.startsWith(`image/`))throw Error(he());if(e.size>Rt)throw Error(ke());let{source:n,width:r,height:i,cleanup:a}=await Ut(e);try{let a=e.type===`image/svg+xml`,o=Math.min(zt/r,Bt/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(S());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Pt(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(S());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);q(e.data,d.width,d.height)?It(e.data,t.variantFor===`dark`?Mt:Nt):Lt(e.data),p.putImageData(e,0,0)}let m=q(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Vt)??await Y(f,`image/png`);if(!h)throw Error(re());return{blob:h,hasAlpha:m}}finally{a()}}async function Ut(e){if(e.type===`image/svg+xml`)return J(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return J(e)}async function J(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Ee())),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`?c():e===`dark`?ve():ot()}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:Qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(D,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(z,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":C(),title:C(),children:(0,X.jsx)(ht,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=p(E.charts.listMyCharts),r=b(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:x(),subtitle:s(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?ut():n.via===`owner`?_e():se({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:ne()}):null]})}function Qt(){let e=b(E.charts.importChart),[t,n]=(0,K.useState)(``),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(!1);async function d(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),c(!1);try{let e=await t.text();i(e)}catch{o(T())}}}async function f(){if(o(null),c(!1),t.trim()===``){o(Le());return}let a;try{a=JSON.parse(r)}catch{o(T());return}u(!0);try{await e({name:t.trim(),tokens:a}),c(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{u(!1)}}return(0,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:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:st()})]}),(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:Ne()}),(0,X.jsx)(B,{value:t,onChange:e=>n(e.target.value),placeholder:ct(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:it()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:je(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),Re(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void d(e)})]})}),(0,X.jsx)(z,{size:`sm`,disabled:l,onClick:()=>void f(),children:ze()})]}),a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:Ye()}):null]})]})}function $t({chart:e}){let t=le(E.charts.setChartLogo),n=b(E.charts.removeChartLogo),[i,a]=(0,K.useState)(!1),[o,s]=(0,K.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Ht(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!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),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!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`?Me():Be()}),(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)(z,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(M,{className:`size-4`}),t?qe():et(),(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)(z,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void f(e),children:Ie()}):null,t?(0,X.jsx)(z,{variant:`ghost`,size:`sm`,disabled:i,onClick:()=>void d(e),children:nt()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Je()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(p,{mode:`light`}),(0,X.jsx)(p,{mode:`dark`})]}),i?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:r()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=p(E.me.getMe,{host:H}),n=b(E.charts.addChartDomain),r=b(E.charts.removeChartDomain),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Xe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:xe()}):u.map(e=>(0,X.jsxs)(V,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":g({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(N,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(B,{value:i,onChange:e=>a(e.target.value),placeholder:h(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(z,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:we()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ae()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=b(E.charts.updateChart),n=b(E.charts.deleteChart),[r,i]=(0,K.useState)(!1),[a,s]=(0,K.useState)(e.name),[c,l]=(0,K.useState)(()=>$(e.tokens)),[u,d]=(0,K.useState)(e.tokens.bpm??0),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1);function ee(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),i(!0)}async function g(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(T());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function _(){if(e.chartId!==void 0&&window.confirm(v()))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)(z,{variant:`outline`,size:`sm`,onClick:ee,children:Pe()}),(0,X.jsx)(z,{variant:`ghost`,size:`sm`,onClick:()=>void _(),children:tt()})]})})]}),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:lt()}),(0,X.jsx)(B,{value:a,onChange:e=>s(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:w()}),(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:u,onChange:e=>d(Number(e.target.value)),"aria-label":w()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?$e():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ke()})]}),(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:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{size:`sm`,disabled:m,onClick:()=>void g(),children:Ce()}),(0,X.jsx)(z,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:o()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=p(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ge()}):(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=b(E.charts.addChartToGroupPool),r=b(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function f(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)(V,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?fe():e.kind===`custom`&&e.scope===`personal`?y():We()}),e.isGlobalDefault?(0,X.jsx)(V,{variant:`default`,children:u()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:be()}),(a??[]).map(e=>(0,X.jsxs)(V,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":l({group:e.name}),onClick:()=>void f(e.groupId),children:(0,X.jsx)(N,{className:`size-3`})})]},e.groupId)),s.length>0?(0,X.jsxs)(R,{value:``,onValueChange:e=>void c(e),children:[(0,X.jsx)(F,{size:`sm`,className:`w-56`,children:(0,X.jsx)(P,{placeholder:at()})}),(0,X.jsx)(I,{children:s.map(e=>(0,X.jsx)(L,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:d()}):null]})]})}function an({chart:e}){let t=b(E.charts.promoteChartToCommon),n=b(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function a(){if(e.chartId!==void 0&&window.confirm(v()))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)(V,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ce():y()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:pe({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(z,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Ve()}):null,(0,X.jsx)(z,{variant:`ghost`,size:`sm`,onClick:()=>void a(),children:i()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=b(E.admin.setDefaultThemeMode),i=b(E.admin.setDefaultLocale),o=b(E.charts.setDefaultChart),s=p(E.charts.listChartsAdmin),c=p(E.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(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:m()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:x()}),_t.map(e=>(0,X.jsx)(z,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(s??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(z,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:de()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ue()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).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:He()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:a()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(s??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(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:te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(()=>{let e=(s??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ue()}):(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:Ae()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:De()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(z,{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:Oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:vt().map(e=>(0,X.jsx)(z,{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:Ze()})]})]})}function sn(){let e=p(E.me.getMe,{host:H}),t=gt(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,K.useState)(!0),[n,r]=(0,K.useState)(`per-user`),[i,a]=(0,K.useState)(``),[o,s]=(0,K.useState)(Z),[c,l]=(0,K.useState)(Z),[u,d]=(0,K.useState)(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)(z,{children:`Default`}),(0,X.jsx)(z,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(z,{variant:`outline`,children:`Outline`}),(0,X.jsx)(z,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(z,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(z,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(z,{size:`sm`,children:`Small`}),(0,X.jsx)(z,{children:`Default`}),(0,X.jsx)(z,{size:`lg`,children:`Large`}),(0,X.jsx)(z,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(O,{})}),(0,X.jsx)(z,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(V,{children:`Default`}),(0,X.jsx)(V,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(V,{variant:`outline`,children:`Outline`}),(0,X.jsx)(V,{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)(B,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(R,{value:n,onValueChange:r,children:[(0,X.jsx)(F,{className:`w-56`,children:(0,X.jsx)(P,{placeholder:`Select…`})}),(0,X.jsxs)(I,{children:[(0,X.jsx)(L,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(L,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(j,{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)(kt,{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)(F,{size:`sm`,children:(0,X.jsx)(P,{})}),(0,X.jsxs)(I,{children:[(0,X.jsx)(L,{value:Z,children:`Toutes directions`}),(0,X.jsx)(L,{value:`inbound`,children:`inbound`}),(0,X.jsx)(L,{value:`outbound`,children:`outbound`}),(0,X.jsx)(L,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(R,{value:c,onValueChange:l,children:[(0,X.jsx)(F,{size:`sm`,children:(0,X.jsx)(P,{})}),(0,X.jsxs)(I,{children:[(0,X.jsx)(L,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(L,{value:`info`,children:`info`}),(0,X.jsx)(L,{value:`warn`,children:`warn`}),(0,X.jsx)(L,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(At,{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)(Ot,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(mt,{children:[(0,X.jsx)(dt,{asChild:!0,children:(0,X.jsx)(z,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(O,{})})}),(0,X.jsxs)(pt,{align:`start`,children:[(0,X.jsx)(ft,{children:`Actions`}),(0,X.jsx)(A,{}),(0,X.jsx)(k,{children:`Edit`}),(0,X.jsx)(k,{children:`Duplicate`}),(0,X.jsx)(A,{}),(0,X.jsx)(k,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(wt,{className:`w-80`,children:[(0,X.jsxs)(yt,{children:[(0,X.jsx)(St,{children:`Instance`}),(0,X.jsx)(Ct,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(xt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(bt,{className:`gap-2`,children:[(0,X.jsx)(z,{size:`sm`,children:`Save`}),(0,X.jsx)(z,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Dt,{children:[(0,X.jsx)(Tt,{children:(0,X.jsxs)(W,{children:[(0,X.jsx)(U,{className:`w-8`,children:(0,X.jsx)(j,{"aria-label":`select all`})}),(0,X.jsx)(U,{children:`Name`}),(0,X.jsx)(U,{children:`Mode`}),(0,X.jsx)(U,{className:`text-right`,children:`Status`}),(0,X.jsx)(U,{className:`w-8`})]})}),(0,X.jsx)(Et,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(W,{children:[(0,X.jsx)(G,{children:(0,X.jsx)(j,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(G,{className:`font-medium`,children:e.n}),(0,X.jsx)(G,{children:(0,X.jsx)(V,{variant:`secondary`,children:e.m})}),(0,X.jsx)(G,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(D,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(G,{children:(0,X.jsx)(z,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(O,{})})})]},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 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ak as r,Bf as i,Ck as a,Dk as o,Ek as s,Ff as c,If as l,Lf as u,Mk as d,Nk as f,Ok as p,Pk as m,Rf as h,Sk as g,Tk as _,Vf as v,jk as y,kk as b,wk as x,zf as S}from"./api-CUskDNHD.js";import{n as C,t as w}from"./search-D9Un2NMX.js";import{i as T,n as E,r as D,t as O}from"./dist-HZSdA3kh.js";import{t as k}from"./button-CbHyzXCb.js";import{t as A}from"./input-DCbMcJYs.js";import{n as j}from"./format-zM-c-1S6.js";var M=t(e(),1),N={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function P(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=N[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function F(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:P(e.from,t)??t-N.h,to:P(e.to,t)??t}}var I=[{label:m(),from:`now-5m`},{label:f(),from:`now-15m`},{label:d(),from:`now-30m`},{label:y(),from:`now-1h`},{label:r(),from:`now-3h`},{label:b(),from:`now-6h`},{label:p(),from:`now-12h`},{label:o(),from:`now-24h`},{label:s(),from:`now-2d`},{label:_(),from:`now-7d`},{label:x(),from:`now-30d`},{label:a(),from:`now-90d`},{label:g(),from:`now-520w`}];function L(e){return j(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function R(e){if(e.kind===`relative`){let t=I.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${L(e.from)} → ${L(e.to)}`}function z(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function B(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function V(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var H=n();function U(e){let[t,n]=(0,M.useState)(0);return(0,M.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,M.useMemo)(()=>{let{from:t,to:n}=F(e);return e.kind===`absolute`?{from:t,to:n}:{from:W(t),to:W(n)}},[e,t])}function W(e){return Math.floor(e/6e4)*6e4}function G({value:e,onChange:t}){let[n,r]=(0,M.useState)(!1),[a,o]=(0,M.useState)(``),s=F(e),[d,f]=(0,M.useState)(()=>z(s.from)),[p,m]=(0,M.useState)(()=>z(s.to));function g(t){if(t){let t=F(e);f(z(t.from)),m(z(t.to)),o(``)}r(t)}function _(e){t({kind:`relative`,from:e,to:`now`}),r(!1)}function y(){let e=B(d),n=B(p);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),r(!1))}let b=(0,M.useMemo)(()=>{let e=a.trim().toLowerCase();return e===``?I:I.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[a]),x=B(d)!==null&&B(p)!==null;return(0,H.jsxs)(D,{open:n,onOpenChange:g,children:[(0,H.jsx)(T,{asChild:!0,children:(0,H.jsxs)(k,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,H.jsx)(C,{}),R(e)]})}),(0,H.jsx)(E,{children:(0,H.jsx)(O,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,children:(0,H.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,H.jsx)(`div`,{className:`oc-timerange__section-title`,children:v()}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:i()}),(0,H.jsx)(A,{type:`datetime-local`,value:d,onChange:e=>f(e.target.value)})]}),(0,H.jsxs)(`label`,{className:`oc-field`,children:[(0,H.jsx)(`span`,{className:`oc-field__label`,children:S()}),(0,H.jsx)(A,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,H.jsx)(k,{size:`sm`,className:`oc-timerange__apply`,disabled:!x,onClick:y,children:h()})]}),(0,H.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,H.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,H.jsx)(w,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,H.jsx)(A,{value:a,onChange:e=>o(e.target.value),placeholder:u(),"aria-label":l()})]}),(0,H.jsx)(`ul`,{className:`oc-timerange__list`,children:b.length===0?(0,H.jsx)(`li`,{className:`oc-timerange__empty`,children:c()}):b.map(t=>(0,H.jsx)(`li`,{children:(0,H.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>_(t.from),children:t.label})},t.from))})]})]})})})]})}export{U as n,V as r,G as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$J as r,QJ as i,XJ as a,ZJ as o}from"./api-CUskDNHD.js";import{t as s}from"./check-Da8rPJKX.js";import{t as c}from"./chevrons-up-down-Bp7zuoEk.js";import{n as l,r as u,t as d}from"./popover-DiT_Oo6e.js";import{t as f}from"./input-DCbMcJYs.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(f,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||a():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(u,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":r(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(c,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(l,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(f,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:i(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:o()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(s,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$z as r,AB as i,AM as a,Ad as o,BM as s,CB as c,CM as l,DB as u,DM as d,E as f,EB as p,EM as m,FM as ee,FZ as h,Gz as g,HM as _,IM as v,Jz as y,Kz as b,LM as te,MB as x,MM as ne,Md as S,NB as C,NM as re,OB as ie,OM as ae,PB as w,PM as oe,PZ as T,Qz as se,RM as ce,SB as E,SM as le,TB as D,TM as ue,UM as de,VM as fe,WM as pe,Xz as O,Yz as k,Zz as A,_B as me,_M as he,aB as ge,bB as j,bM as _e,cM as M,dB as N,dM as ve,eB as P,fB as ye,fM as be,gB as xe,gM as Se,hB as Ce,hM as we,iB as Te,jB as Ee,jM as De,jd as Oe,kB as ke,kM as Ae,lM as je,mB as Me,mM as Ne,nB as Pe,pB as Fe,pM as Ie,qz as Le,rB as Re,sM as ze,t as F,tB as Be,uB as Ve,uM as He,vB as Ue,vM as We,wB as Ge,wM as Ke,xB as I,xM as qe,yB as Je,yM as Ye,zM as Xe}from"./api-CUskDNHD.js";import{n as Ze,t as Qe}from"./useNavigate-D3GIoxyW.js";import{t as $e}from"./check-Da8rPJKX.js";import{t as et}from"./copy-C1_4Ewod.js";import{n as tt,t as nt}from"./eye-yUMVb9gl.js";import{o as rt,r as it}from"./deliveryRecorder-CGhwQ1sg.js";import{t as at}from"./x-6-84PEVq.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-DCBGpD8v.js";import{i as H,n as U,r as ot,t as st}from"./tabs-dQ50HGoj.js";import{t as W}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{t as G}from"./badge-TiMZiv59.js";import{a as ct,n as K}from"./format-zM-c-1S6.js";import{a as lt,n as ut,o as dt,r as ft,t as pt}from"./dialog-DpoEg_Ex.js";import{c as mt,o as ht,s as gt,u as _t}from"./searchSchemas-Dm-Qg010.js";import{t as vt}from"./appHost-CH3EGcJw.js";import{n as yt}from"./TimeRangePicker-DzJYDik_.js";import{t as bt}from"./FilterBar-Bynn2H7k.js";import{t as xt}from"./AdvancedFilter-5BMuHHt6.js";import{t as St}from"./DataTableShell-2_QPZexc.js";var Ct=f(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?Ce():n===`agent`?`${Me()} - ${r}`:e}function Tt(){let e=h(F.me.getMe,{host:vt})?.role===`admin`,t=h(F.deliveryTiming.getDeliveryStatus,{}),n=T(F.deliveryTiming.startDeliveryRecord),r=T(F.deliveryTiming.stopDeliveryRecord),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),l=t?.recording??!1,d=async()=>{c(!0);try{l?await r({}):await n({})}finally{c(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:w()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}),e?(0,J.jsx)(W,{variant:l?`destructive`:`default`,size:`sm`,disabled:s||t===void 0,onClick:()=>void d(),children:l?Ee():x()}):null]}),l?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(G,{variant:`secondary`,children:i()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:ke({time:ct(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>o(e=>!e),children:a?p():u()})}),a?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=h(F.deliveryTiming.listDeliverySessions,{}),n=T(F.deliveryTiming.deleteDeliverySessions),[r,i]=(0,q.useState)(``),[a,o]=(0,q.useState)(`all`),[s,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=yt(s),m=s.to===`now`?1/0:p,ee=r.trim()!==``||a!==`all`||s!==Y,g=()=>{i(``),o(`all`),l(Y)},_=(0,q.useMemo)(()=>{if(t===void 0)return;let e=r.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(a===`all`||(a===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,r,a,f,m]),v=e=>{let t=new Set((_??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(bt,{q:r,onQChange:i,searchPlaceholder:Ge(),timeRange:s,onTimeRangeChange:l,onReset:g,canReset:ee,children:(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:`all`,children:c()}),(0,J.jsx)(B,{value:`active`,children:E()}),(0,J.jsx)(B,{value:`stopped`,children:I()})]})]})}),(0,J.jsx)(St,{title:D(),rows:_,emptyHint:b(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(W,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?ye():Fe(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(tt,{size:15,"aria-hidden":!0}):(0,J.jsx)(nt,{size:15,"aria-hidden":!0})})},{header:j(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:K(e.startedAt)})},{header:Je(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:K(e.stoppedAt)})},{header:Ue(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:me(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:xe(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(G,{variant:`secondary`,children:E()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:I()})}],rowActions:e?e=>[{label:N(),variant:`destructive`,onSelect:()=>v([e.sessionId])}]:void 0,bulkActions:e?[{label:N(),variant:`destructive`,onSelect:e=>v(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=h(F.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(it(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ie()});let i=e.segments,a=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,g()]}),(0,J.jsxs)(W,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)($e,{size:13,"aria-hidden":!0}):(0,J.jsx)(et,{size:13,"aria-hidden":!0}),t?Le():y()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Re()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Pe()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:Be()})]})}),(0,J.jsxs)(`tbody`,{children:[a(P(),i.bridge),a(r(),i.A),a(se(),i.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:A()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:O()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:S()},{value:`principalType`,label:Oe()},{value:`direction`,label:`direction`},{value:`roleKey`,label:o()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=Ze({from:`/settings/traces`}),t=Qe({from:`/settings/traces`}),n=e.limit,r=e.kind,i=e.statusClass??Q,o=e.principalType??Q,c=e.direction??Q,u=e.roleKey??Q,f=e.q??``,p=e.correlationId,g=ht(e.from,e.to),y=(0,q.useMemo)(()=>_t(e.adv),[e.adv]),{from:b,to:x}=yt(g),[S,C]=(0,q.useState)(null),[ie,w]=(0,q.useState)(null),T=e=>void t({search:t=>({...t,limit:e})}),se=e=>void t({search:t=>({...t,kind:e})}),E=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),D=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),O=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),k=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),A=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),me=e=>void t({search:t=>({...t,...mt(e)})}),j=e=>void t({search:t=>({...t,adv:gt(e)}),replace:!0}),M=h(F.observability.listEvents,{limit:n}),N=h(F.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...p?{correlationId:p}:{},filter:{q:f||void 0,from:b,to:x,statusClass:i===Q?void 0:i,principalType:o===Q?void 0:o,direction:c===Q?void 0:c,roleKey:u===Q?void 0:u,advanced:y.length>0?y:void 0}}),P=(0,q.useMemo)(()=>{let e=new Set;for(let t of M??[])e.add(t.kind);return[...e].sort()},[M]),ye=(0,q.useMemo)(()=>{let e=new Set;for(let t of M??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[M]),xe=f!==``||i!==Q||o!==Q||c!==Q||u!==Q||y.length>0||g.kind!==`relative`||g.from!==Nt.from;function Ce(){t({search:{limit:100,kind:`all`},replace:!0})}let Ee=S?M?.filter(e=>e.correlationId===S):N,Oe=e.section,ke=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(st,{value:Oe,onValueChange:e=>ke(e),children:[(0,J.jsxs)(ot,{className:`w-full`,children:[(0,J.jsxs)(H,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(rt,{size:13,"aria-hidden":!0}),ge()]}),(0,J.jsxs)(H,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),Te()]})]}),(0,J.jsx)(U,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(U,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[pe(),(0,J.jsx)(`strong`,{children:de()}),_(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:fe()})]}),(0,J.jsxs)(bt,{q:f,onQChange:E,searchPlaceholder:s(),timeRange:g,onTimeRangeChange:me,onReset:Ce,canReset:xe,children:[(0,J.jsxs)(V,{value:i,onValueChange:D,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:Xe()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:ce()}),At.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:o,onValueChange:O,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:te()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:v()}),jt.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:c,onValueChange:k,children:[(0,J.jsx)(R,{size:`sm`,className:`w-32`,children:(0,J.jsx)(L,{placeholder:ee()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:oe()}),Mt.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsxs)(V,{value:u,onValueChange:A,children:[(0,J.jsx)(R,{size:`sm`,className:`w-36`,children:(0,J.jsx)(L,{placeholder:re()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:Q,children:ne()}),ye.map(e=>(0,J.jsx)(B,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:r===Z?``:r,placeholder:De(),"aria-label":De(),onChange:e=>{let t=e.target.value.trim();se(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:P.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(V,{value:String(n),onValueChange:e=>T(Number(e)),children:[(0,J.jsx)(R,{size:`sm`,className:`w-28`,children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:kt.map(e=>(0,J.jsx)(B,{value:String(e),children:a({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:y,onChange:j}),S?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>C(null),title:Ae(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[ae(),(0,J.jsx)(`code`,{children:$(S)})]}),(0,J.jsx)(at,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:d()})]})}):null,(0,J.jsx)(St,{title:m(),rows:Ee,emptyHint:S?ue():Ke(),columns:[{header:l(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:K(e.at)})},{header:le(),sort:e=>e.kind,cell:e=>(0,J.jsx)(G,{variant:`secondary`,children:e.kind})},{header:qe(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":_e(),children:`✓`})}},{header:Ye(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(G,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:We(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(G,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:he(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(G,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:Se(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:we(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:Ne(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:Ie(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:be(),onClick:()=>C(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ve(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(W,{variant:`outline`,size:`sm`,onClick:()=>w(e),children:He()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:ie,onClose:()=>w(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(pt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(ut,{className:`max-w-lg`,children:[(0,J.jsxs)(lt,{children:[(0,J.jsxs)(dt,{className:`oc-traces__meta-title`,children:[je(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(G,{variant:`outline`,children:M()})]}),(0,J.jsx)(ft,{children:ze()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{DZ as r,E as i,FZ as a,PZ as o,SD as s,_D as c,aD as l,cD as u,dD as d,fD as f,gD as p,hD as m,iD as h,lD as g,mD as _,nD as v,oD as y,oM as b,pD as x,rD as S,sD as C,t as w,uD as T,vD as E,xD as D}from"./api-CUskDNHD.js";import{t as O}from"./use_paginated_query-BatXdmTn.js";import{t as k}from"./trash-2-8oRd823U.js";import{t as A}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{r as j}from"./toast-C8rSAMgh.js";import{n as M}from"./format-zM-c-1S6.js";import{n as N}from"./ConfirmDialog-Dy8WCeAF.js";import{r as P}from"./fileMetaView-Ci5C4w9Q.js";import{r as F}from"./trashView-CIgTWQjI.js";import{n as I,t as L}from"./trashPage-CoBMe_r-.js";var R=i(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=a(w.blobSweep.listBlobSweeps,{}),t=a(w.blobQuarantine.quarantineSettings,{}),n=o(w.blobSweep.startBlobSweep),i=N(),{toast:s}=j(),[D,O]=(0,z.useState)(!1),F=r(),I=e=>P(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){s({title:v(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await i({title:y({count:H.orphans.count}),description:l({size:I(H.orphans.bytes)}),confirmLabel:C(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:E()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(A,{variant:`outline`,size:`sm`,disabled:D||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,p()]}),(0,V.jsxs)(A,{variant:`ghost`,size:`sm`,className:`text-destructive`,disabled:D||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(k,{}),` `,C()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:c({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:b()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:m({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:_()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:x({date:M(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:f({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:d({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:T({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:g({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:u()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?S({date:M(L.lastApply.finishedAt??L.lastApply.startedAt)}):h({date:M(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(w.trash.adminListTrash,{},{initialNumItems:50}),r=F(),i=o(w.trash.adminRestoreChat),a=o(w.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:s({days:r})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:b()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:D()}):(0,V.jsx)(L,{items:e,onRestore:e=>i({chatId:e}),onPurge:e=>a({chatId:e})}),(0,V.jsx)(I,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AL as r,BL as i,CL as a,Cj as o,DL as s,Dj as c,EL as l,Ej as u,FL as d,FZ as f,Fx as p,HL as m,IL as ee,Ix as h,LL as g,Lx as _,ML as te,NL as ne,OL as re,Oj as v,PL as y,PZ as b,RL as ie,SL as ae,Sj as x,TL as oe,Tj as S,VL as C,YI as se,_L as ce,_j as w,bL as le,bj as T,gL as ue,gj as E,hL as de,jL as fe,kL as pe,mL as me,t as D,vL as he,vj as O,wL as ge,wj as k,xL as _e,xj as A,yL as ve,yj as j,zL as ye}from"./api-CUskDNHD.js";import{n as be,t as M}from"./useNavigate-D3GIoxyW.js";import{c as N,i as P,n as F,r as xe,t as Se}from"./dropdown-menu-BWxfj48Z.js";import{t as I}from"./checkbox-Czxm5pNj.js";import{t as L}from"./server-BSDuYUUF.js";import{t as R}from"./star-DjK6DoNA.js";import{a as z,i as B,n as V,r as H,t as U}from"./select-DCBGpD8v.js";import{t as W}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{r as G}from"./toast-C8rSAMgh.js";import{t as K}from"./badge-TiMZiv59.js";import{a as Ce,n as we,o as Te,r as Ee,t as De}from"./dialog-DpoEg_Ex.js";import{t as Oe}from"./appHost-CH3EGcJw.js";import{n as ke,r as Ae}from"./ConfirmDialog-Dy8WCeAF.js";import{a as q}from"./groupManageView-DY6vPM1h.js";import{a as je,o as J,t as Y}from"./AdminSettings-CMjix9zl.js";import{t as Me}from"./FilterBar-Bynn2H7k.js";import{t as Ne}from"./DataTableShell-2_QPZexc.js";import{t as Pe}from"./DetailChips-DaliQU_Q.js";var X=t(e(),1),Z=n();function Fe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=f(D.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=f(D.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,l=s?`${s.instanceName}/${s.agentId}`:null,d=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),p=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!d.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],m=new Map;for(let e of p){let t=m.get(e.instanceName)??[];t.push(e),m.set(e.instanceName,t)}return(0,Z.jsx)(De,{open:n,onOpenChange:r,children:(0,Z.jsxs)(we,{className:`oc-access`,children:[(0,Z.jsxs)(Ce,{children:[(0,Z.jsx)(Te,{children:v({user:t})}),(0,Z.jsx)(Ee,{children:c()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?u():S()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:k()}):p.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:A()}):[...m.entries()].map(([t,n])=>(0,Z.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:l},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:r,assigned:i,defaultKey:a}){let s=b(D.agents.assignAgent),c=b(D.agents.removeAgent),l=b(D.agents.setDefaultAgent),u=G();if(!e)return null;async function d(n,r){try{r?await c({profileId:e,instanceName:t,agentId:n}):await s({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(o(),q(e))}}async function f(n){try{await l({profileId:e,instanceName:t,agentId:n})}catch(e){u.error(x(),q(e))}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=i.has(n),o=a===n,s=e.state===`deleted`,c=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row${c?` is-disabled`:``}`,children:[(0,Z.jsx)(I,{checked:r,disabled:(s||c)&&!r,onCheckedChange:()=>void d(e.agentId,r),"aria-label":T({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,s?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:j()}):null,e.outOfPool?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:O()}):null,r?o?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":w(),title:w(),children:(0,Z.jsx)(R,{size:14,fill:`currentColor`})}):(0,Z.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault`,"aria-label":E(),title:E(),disabled:c,onClick:()=>void f(e.agentId),children:(0,Z.jsx)(R,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return p();case`user`:return h();case`admin`:return _();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),r=Y.filter(e=>n.has(J[e])).length;return(0,Z.jsxs)(Se,{children:[(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsx)(W,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?m():C({count:r})})}),(0,Z.jsxs)(F,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(P,{children:i()}),Y.map(e=>{let r=J[e];return(0,Z.jsxs)(xe,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(I,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:je[e]()})]},e)})]})]})}function Re(){let e=be({from:`/settings/users`}),t=M({from:`/settings/users`}),n=e.q??``,i=e.role??Q,o=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),u=f(D.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),p=f(D.me.getMe,{host:Oe}),m=b(D.admin.setRole),h=b(D.admin.setUserPermissions),_=b(D.admin.startImpersonation),v=b(D.admin.deleteUser),x=b(D.admin.setUserName),S=ke(),C=Ae(),w=G(),[T,E]=(0,X.useState)(null),O=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of u??[])e.add(t.role);return[...e]},[u]),k=n!==``||i!==Q;function A(){t({search:{},replace:!0})}async function j(e){try{await m(e)}catch(e){w.error(ye(),e)}}async function N(e){try{await h(e)}catch(e){w.error(ie(),e)}}async function P(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await S({title:fe(),description:r({user:t}),confirmWord:pe(),confirmLabel:re(),destructive:!0}))try{await v({profileId:e._id}),w.success(l({user:t}))}catch(e){w.error(s(),e)}}async function F(e){let t=e.email||e.name||e.userId.slice(0,8),n=await C({title:ge(),label:a({user:t}),placeholder:ae(),defaultValue:e.name??``,confirmLabel:se()});if(n!==null)try{await x({profileId:e._id,name:n}),w.success(_e())}catch(e){w.error(le(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Me,{q:n,onQChange:o,searchPlaceholder:g(),onReset:A,canReset:k,children:(0,Z.jsxs)(U,{value:i,onValueChange:c,children:[(0,Z.jsx)(B,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:Q,children:ee()}),O.map(e=>(0,Z.jsx)(H,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Ne,{title:d(),rows:u,emptyHint:y(),rowActions:e=>{let t=[{label:me(),onSelect:()=>E({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:oe(),onSelect:()=>void F(e)}];return e.userId!==p?.userId&&t.push({label:ne(),onSelect:()=>void _({profileId:e._id})},{label:te(),variant:`destructive`,onSelect:()=>void P(e)}),t},columns:[{header:ve(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:he(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(U,{value:e.role,onValueChange:t=>void j({profileId:e._id,role:t}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(H,{value:`user`,children:$(`user`)}),(0,Z.jsx)(H,{value:`admin`,children:$(`admin`)})]})]})},{header:ce(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:ue()}):(0,Z.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:de(),cell:e=>(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(L,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Fe,{profileId:T?.profileId??null,userLabel:T?.label??``,open:T!==null,onOpenChange:e=>{e||E(null)}})]})}export{Re as UsersTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Al as r,Au as i,Bu as a,Cl as o,DZ as ee,Dl as s,Du as c,El as l,Eu as u,FZ as d,Fu as te,Gu as f,Hu as p,Hy as m,Iu as h,Ju as g,KR as _,Ku as v,Ll as ne,Lu as y,MZ as re,Mu as b,Nu as x,Ol as S,Ou as C,PZ as w,Pu as ie,Ru as ae,Sl as oe,TZ as T,Uu as se,Vu as ce,Wu as E,Xu as le,Yu as ue,_l as de,_v as fe,bl as pe,gl as me,hl as he,ju as D,kl as ge,ku as O,qu as k,rl as A,t as j,vl as M,xl as N,yv as P,zu as F}from"./api-CUskDNHD.js";import{n as I,t as L}from"./useNavigate-D3GIoxyW.js";import{d as _e,f as ve,i as ye,l as be,n as xe,o as R,r as Se,s as z,t as Ce,u as we}from"./speech-CfxX6OY3.js";import{t as B}from"./checkbox-Czxm5pNj.js";import{a as V,i as H,n as U,r as W,t as G}from"./select-DCBGpD8v.js";import{i as K,n as q,r as Te,t as Ee}from"./tabs-dQ50HGoj.js";import{t as J}from"./button-CbHyzXCb.js";import"./convexApi-BPSJUy2j.js";import{t as Y}from"./badge-TiMZiv59.js";import{t as X}from"./appHost-CH3EGcJw.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>se()],[`fr-FR`,()=>r()],[`en-US`,()=>ge()],[`en-GB`,()=>S()],[`de-DE`,()=>s()],[`es-ES`,()=>l()]],Oe=[[`0.75`,()=>ce()],[`1`,()=>a()],[`1.25`,()=>F()],[`1.5`,()=>ae()]],$=0;function ke({instance:e}){let t=w(j.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,a]=(0,Z.useState)(r),[o,s]=(0,Z.useState)(`idle`),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),g=re(j.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{a({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),s(`idle`)},[e._id]);let _=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function v(){s(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),s(`idle`)}catch{s(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(Y,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:i.enabled,onCheckedChange:e=>a({...i,enabled:e===!0}),"aria-label":f()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:f()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()}),(0,Q.jsxs)(G,{value:i.engine,onValueChange:e=>a({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":M(),children:(0,Q.jsx)(V,{})}),(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{value:`browser`,children:de()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:me()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:he()}):null,i.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,Q.jsxs)(G,{value:i.lang,onValueChange:e=>a({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":E(),children:(0,Q.jsx)(V,{})}),(0,Q.jsx)(U,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,Q.jsxs)(G,{value:i.rate,onValueChange:e=>a({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":p(),children:(0,Q.jsx)(V,{})}),(0,Q.jsx)(U,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:i.autoRead,onCheckedChange:e=>a({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":y()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:h()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(J,{size:`sm`,disabled:!_||o===`saving`,onClick:()=>void v(),children:o===`saving`?m():P()}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,disabled:!i.enabled||c,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(d(!1),z(),R(),i.engine!==`gateway`){ye(x(),{lang:Se(i.lang,ee()),rate:t});return}l(!0),g({instanceName:e.name,text:x()}).then(({mime:e,audioBase64:r})=>{n===$&&xe(r,e,{rate:t})}).catch(()=>{n===$&&d(!0)}).finally(()=>l(!1))},children:c?m():te()}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>{$++,l(!1),z(),R()},children:ie()})]}),o===`error`||u?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:u?A():fe()}):null]})}function Ae({stt:e}){let t=d(j.me.getMe,{host:X}),n=w(j.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,a=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:D()}),(0,Q.jsx)(Y,{variant:e?`secondary`:`outline`,children:e?c():u()}),(0,Q.jsx)(Y,{variant:r?`secondary`:`destructive`,children:r?oe():N()})]}),a?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":o()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:o()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]})}function je(){let e=d(j.admin.listInstances,{}),t=(0,Z.useMemo)(()=>be(),[]),n=(0,Z.useMemo)(()=>Ce(),[]),{section:r}=I({from:`/settings/voice`}),i=L({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(Y,{variant:t?`secondary`:`destructive`,children:t?ue():g()}),(0,Q.jsx)(Y,{variant:n?`secondary`:`destructive`,children:n?k():v()})]}),(0,Q.jsxs)(Ee,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(Te,{className:`w-full`,children:[(0,Q.jsxs)(K,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(we,{size:13,"aria-hidden":!0}),pe()]}),(0,Q.jsxs)(K,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(_e,{size:13,"aria-hidden":!0}),D()]}),(0,Q.jsxs)(K,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ve,{size:13,"aria-hidden":!0}),O()]})]}),(0,Q.jsx)(q,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(q,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(q,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:O()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:C()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=w(j.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(Y,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":_()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]})]})}export{je as VoiceTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{C as r,T as i,h as a,r as o,v as s}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{C as r,T as i,h as a,r as o,v as s}from"./api-CUskDNHD.js";import{a as c,c as l,i as u,l as d,n as f,o as p,r as ee,s as m,t as h,u as g}from"./dist-DQawXTf-.js";import{n as _}from"./button-CbHyzXCb.js";var v=t(e(),1),y=n(),b=`AlertDialog`,[x,te]=a(b,[g]),S=g(),C=e=>{let{__scopeAlertDialog:t,...n}=e,r=S(t);return(0,y.jsx)(p,{...r,...n,modal:!0})};C.displayName=b;var w=`AlertDialogTrigger`,T=v.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=S(n);return(0,y.jsx)(l,{...i,...r,ref:t})});T.displayName=w;var E=`AlertDialogPortal`,D=e=>{let{__scopeAlertDialog:t,...n}=e,r=S(t);return(0,y.jsx)(c,{...r,...n})};D.displayName=E;var O=`AlertDialogOverlay`,k=v.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=S(n);return(0,y.jsx)(u,{...i,...r,ref:t})});k.displayName=O;var A=`AlertDialogContent`,[j,M]=x(A),N=r(`AlertDialogContent`),P=v.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...a}=e,o=S(n),c=v.useRef(null),l=i(t,c),u=v.useRef(null);return(0,y.jsx)(d,{contentName:A,titleName:F,docsSlug:`alert-dialog`,children:(0,y.jsx)(j,{scope:n,cancelRef:u,children:(0,y.jsxs)(f,{role:`alertdialog`,...o,...a,ref:l,onOpenAutoFocus:s(a.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,y.jsx)(N,{children:r}),(0,y.jsx)(U,{contentRef:c})]})})})});P.displayName=A;var F=`AlertDialogTitle`,I=v.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=S(n);return(0,y.jsx)(m,{...i,...r,ref:t})});I.displayName=F;var L=`AlertDialogDescription`,R=v.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=S(n);return(0,y.jsx)(ee,{...i,...r,ref:t})});R.displayName=L;var z=`AlertDialogAction`,B=v.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=S(n);return(0,y.jsx)(h,{...i,...r,ref:t})});B.displayName=z;var V=`AlertDialogCancel`,H=v.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=M(V,n),o=S(n),s=i(t,a);return(0,y.jsx)(h,{...o,...r,ref:s})});H.displayName=V;var U=({contentRef:e})=>{let t=`\`${A}\` requires a description for the component to be accessible for screen reader users.
|
|
2
2
|
|
|
3
3
|
You can add a description to the \`${A}\` by passing a \`${L}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
4
|
|