@lacneu/atrium 0.104.2 → 0.104.4
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-D8xdWzT5.js → AccessTab-B2bpNynj.js} +1 -1
- package/dist/assets/{AdminSettings-CtNcFhMz.js → AdminSettings-C2bsOn0u.js} +1 -1
- package/dist/assets/{AdvancedFilter-Cod8SSd6.js → AdvancedFilter-DYTsdqhC.js} +1 -1
- package/dist/assets/{AgentFilesTab-Dfkkm3Fw.js → AgentFilesTab-BM2NUWub.js} +1 -1
- package/dist/assets/{AnomaliesTab-DlZ5M2UC.js → AnomaliesTab-BWiKxnXQ.js} +1 -1
- package/dist/assets/{AuditTab-Dh6gO6j5.js → AuditTab-CqpDXgVz.js} +1 -1
- package/dist/assets/{BridgeTab-Bnu9R5N4.js → BridgeTab-Cv2Co6h7.js} +1 -1
- package/dist/assets/{ChatDefaultsTab-CxmayDqi.js → ChatDefaultsTab-Dr-czhQm.js} +1 -1
- package/dist/assets/{ConfirmDialog-B7k0wvSi.js → ConfirmDialog-Bfi4_Ti8.js} +1 -1
- package/dist/assets/{DataTableShell-DvtkASQG.js → DataTableShell-1ZsZ0a2J.js} +1 -1
- package/dist/assets/{DeletedChatsTab-CnaK-AH0.js → DeletedChatsTab-By_xLvEC.js} +1 -1
- package/dist/assets/{DetailChips-DDAtgnjA.js → DetailChips-DkRU5HQ5.js} +1 -1
- package/dist/assets/{EntitySheet-DRzkWKlH.js → EntitySheet-D8Vdib4B.js} +1 -1
- package/dist/assets/{FeedbacksTab-D4LKaB_2.js → FeedbacksTab-YFBk45oU.js} +1 -1
- package/dist/assets/{FieldLabel-imj_Z0rZ.js → FieldLabel-Ce8urE01.js} +1 -1
- package/dist/assets/{FilesTab-D3XWSI2t.js → FilesTab-DL27Krkt.js} +1 -1
- package/dist/assets/{FilterBar-DCCuFxDn.js → FilterBar-DtNuk6dI.js} +1 -1
- package/dist/assets/{GroupsTab-DbayDYbZ.js → GroupsTab-CQrEUZSF.js} +1 -1
- package/dist/assets/{InstancesTab-031fn2Jt.js → InstancesTab-DiW-4KlM.js} +1 -1
- package/dist/assets/{IntegrationsTab-1whhDsmk.js → IntegrationsTab-DqWlrC3M.js} +1 -1
- package/dist/assets/{KnobRow-D6kXWvVI.js → KnobRow-4WODwFrS.js} +1 -1
- package/dist/assets/{KpiTab-2Vk6EtCf.js → KpiTab-BXC9YG9_.js} +1 -1
- package/dist/assets/{PreferencesTab-B5h49bYq.js → PreferencesTab-DarNzYdF.js} +1 -1
- package/dist/assets/{ProjectPage-BNKL-iOz.js → ProjectPage-BbYuFPDW.js} +1 -1
- package/dist/assets/{PromptInjectionsTab-Bmn1iSpB.js → PromptInjectionsTab-KMsWE-dW.js} +1 -1
- package/dist/assets/{RolesTab-DHxLatAl.js → RolesTab-DpN3MOih.js} +1 -1
- package/dist/assets/{ScheduledTab-NHSyQ677.js → ScheduledTab-BBofaJj5.js} +1 -1
- package/dist/assets/{ServiceAccountsTab-CKV8crhK.js → ServiceAccountsTab-CSIwvppo.js} +1 -1
- package/dist/assets/{SubAgentReportsTab-BWfXOTck.js → SubAgentReportsTab-BoNbdt38.js} +1 -1
- package/dist/assets/{ThemeShowroom-Do9I3hrR.js → ThemeShowroom-DdUZV2nA.js} +1 -1
- package/dist/assets/{TimeRangePicker-BZtw1JkM.js → TimeRangePicker-jsNw51TL.js} +1 -1
- package/dist/assets/{TimezoneCombobox-CeRN4N3z.js → TimezoneCombobox-zOqV7dxe.js} +1 -1
- package/dist/assets/{TracesTab-BNWFPad2.js → TracesTab-Dg_eyLYF.js} +1 -1
- package/dist/assets/{TrashTab-D5irFeF0.js → TrashTab-Dwjjxu8X.js} +1 -1
- package/dist/assets/{UsersTab-CHs3CRev.js → UsersTab-eQY9UCh5.js} +1 -1
- package/dist/assets/{VoiceTab-DRvjgMdZ.js → VoiceTab-BFVfbSld.js} +1 -1
- package/dist/assets/{alert-dialog-BcJMHbhI.js → alert-dialog-C6NSAwQv.js} +1 -1
- package/dist/assets/{api-CWqdeSbN.js → api-D64JTta1.js} +1 -1
- package/dist/assets/{badge-ChMMFtuW.js → badge-DwWXPxwl.js} +1 -1
- package/dist/assets/{button-C_rIPtCv.js → button-DeHzYOzP.js} +1 -1
- package/dist/assets/{card-BV8NO76j.js → card-WAOfM0PL.js} +1 -1
- package/dist/assets/check-pVsND9oZ.js +1 -0
- package/dist/assets/{checkbox-DPxJTQjc.js → checkbox-BuTZzFvU.js} +1 -1
- package/dist/assets/chevron-left-CjQ1kn0w.js +1 -0
- package/dist/assets/chevron-right-DkaFdk2G.js +1 -0
- package/dist/assets/chevron-up-s_deZUWR.js +1 -0
- package/dist/assets/chevrons-up-down-uk0IvxY8.js +1 -0
- package/dist/assets/{compatView-Cz5KNXa-.js → compatView-Db657dNx.js} +1 -1
- package/dist/assets/convexApi-DxRiI80M.js +1 -0
- package/dist/assets/{copy-DbstFM9Q.js → copy-4wREwP-V.js} +1 -1
- package/dist/assets/{cronDescribe-CkiSvbCK.js → cronDescribe-B-ifUeLg.js} +1 -1
- package/dist/assets/{deliveryRecorder-B_kVKMkR.js → deliveryRecorder-owdOglrQ.js} +1 -1
- package/dist/assets/{dialog-CPAskUwF.js → dialog-awuZdW9M.js} +1 -1
- package/dist/assets/{dispatchErrorInfo-7H2cJGwt.js → dispatchErrorInfo-C4Qh_2oR.js} +1 -1
- package/dist/assets/{dist-Bu9sqVcp.js → dist-B4zBnzNF.js} +1 -1
- package/dist/assets/{dist-BjZo0sql.js → dist-BtzRSR0_.js} +1 -1
- package/dist/assets/{dist-CzmY6YrA.js → dist-C0V3m4aH.js} +1 -1
- package/dist/assets/{dist-Uf18yR_a.js → dist-D4a9D7kU.js} +1 -1
- package/dist/assets/{dist-CYh9BuQS.js → dist-mViq22LZ.js} +1 -1
- package/dist/assets/{download-BaebAe6Z.js → download-BUlwPQI8.js} +1 -1
- package/dist/assets/{dropdown-menu-BVKVjups.js → dropdown-menu-C5VrCGFe.js} +1 -1
- package/dist/assets/{eye-LggiM6Z5.js → eye-BU60QIdS.js} +1 -1
- package/dist/assets/{format-AQELUhPa.js → format-g5Z3Txjl.js} +1 -1
- package/dist/assets/{groupManageView-DC3eSLA1.js → groupManageView-CKEYC6zY.js} +1 -1
- package/dist/assets/index-DLjKxzJ_.css +1 -0
- package/dist/assets/index-MNxzNMLb.js +158 -0
- package/dist/assets/{input-CSZu-bVE.js → input-CZ0jp9Rx.js} +1 -1
- package/dist/assets/{list-obbqPBzD.js → list-Bb0MIh_I.js} +1 -1
- package/dist/assets/loader-circle-1XN8tjq6.js +1 -0
- package/dist/assets/{lock-BlVhOk85.js → lock-xfEfLa2G.js} +1 -1
- package/dist/assets/{pencil-K7SBkvHL.js → pencil-CHRZ3__S.js} +1 -1
- package/dist/assets/plus-DrzxZ4iS.js +1 -0
- package/dist/assets/{popover-C-Y_Yoco.js → popover-UJtu3EZ6.js} +1 -1
- package/dist/assets/roleDescriptions-BW3e0J2_.js +1 -0
- package/dist/assets/rotate-ccw-CiOuaG2h.js +1 -0
- package/dist/assets/{search-Dz6sLH0-.js → search-NOJ0tWl2.js} +1 -1
- package/dist/assets/{select-CjcMQhwm.js → select-wXM6h61N.js} +1 -1
- package/dist/assets/{server-DcInl3Nh.js → server-C5TTb6-A.js} +1 -1
- package/dist/assets/{speech-ehUcmGCg.js → speech-BPCrvnrE.js} +1 -1
- package/dist/assets/{star-5ysDlx3k.js → star-N2N0cbAA.js} +1 -1
- package/dist/assets/{switch--NPD3Vp0.js → switch-Beq0wUQ_.js} +1 -1
- package/dist/assets/{table-rRR3TpMc.js → table-CegX53gV.js} +1 -1
- package/dist/assets/{tabs-B8emuY1B.js → tabs-CfQK0-wk.js} +1 -1
- package/dist/assets/{toast-C_YfUacM.js → toast-DtA87VYn.js} +1 -1
- package/dist/assets/{tooltip-Ct0TGxtk.js → tooltip-Dpar43UD.js} +1 -1
- package/dist/assets/{trash-2-xhtrhYsd.js → trash-2-CqKGt3lC.js} +1 -1
- package/dist/assets/{trashPage-3suR6eIy.js → trashPage-D9B1uAuS.js} +1 -1
- package/dist/assets/{trashView-CwUC01r_.js → trashView-TIQT30u4.js} +1 -1
- package/dist/assets/{triangle-alert-DoL9TI6v.js → triangle-alert-nUld87-H.js} +1 -1
- package/dist/assets/{usageView-BuRtXekW.js → usageView-DIPUGYx9.js} +1 -1
- package/dist/assets/{useChart-bV4rotdu.js → useChart-BTVKxdLu.js} +1 -1
- package/dist/assets/{useFontScale-DiSkEM6I.js → useFontScale-P_rNok04.js} +1 -1
- package/dist/assets/{useStartNewChat-8wVLrYnZ.js → useStartNewChat-GAbwTTkG.js} +1 -1
- package/dist/assets/{use_paginated_query-CebdO_HQ.js → use_paginated_query-C-Aw4n8b.js} +1 -1
- package/dist/assets/{users-CRbE186D.js → users-BUu1wJNm.js} +1 -1
- package/dist/assets/x-BNU-sWkh.js +1 -0
- package/dist/index.html +54 -54
- package/package.json +1 -1
- package/dist/assets/check-DdmANHSb.js +0 -1
- package/dist/assets/chevron-left-ByEQraEh.js +0 -1
- package/dist/assets/chevron-right-DMqzlhWH.js +0 -1
- package/dist/assets/chevron-up-B3KYmtzo.js +0 -1
- package/dist/assets/chevrons-up-down-CITEfz7_.js +0 -1
- package/dist/assets/convexApi-G20_TNBS.js +0 -1
- package/dist/assets/index-2h5cvmc2.css +0 -1
- package/dist/assets/index-CzYLP7A2.js +0 -158
- package/dist/assets/loader-circle-BqKiW3X9.js +0 -1
- package/dist/assets/plus-DTL4K-j9.js +0 -1
- package/dist/assets/roleDescriptions-DHny6e80.js +0 -1
- package/dist/assets/rotate-ccw-CvefWwHW.js +0 -1
- package/dist/assets/x-CcIT4ync.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Aj as i,Ap as a,Cd as o,Cj as s,Dj as c,Ej as l,Fj as u,Hj as d,Mh as f,Mj as p,Mp as m,Nh as h,Nj as g,Ns as _,Oj as ee,Pj as te,Sd as v,Sj as y,Tj as b,Uj as x,_j as S,ap as C,bQ as w,bj as ne,cp as re,gj as ie,jh as ae,jj as oe,jp as se,kh as ce,kj as T,kp as E,lp as D,op as O,sp as k,t as A,vj as j,wd as M,wj as N,xj as P,yQ as F,yj as I}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Aj as i,Ap as a,Cd as o,Cj as s,Dj as c,Ej as l,Fj as u,Hj as d,Mh as f,Mj as p,Mp as m,Nh as h,Nj as g,Ns as _,Oj as ee,Pj as te,Sd as v,Sj as y,Tj as b,Uj as x,_j as S,ap as C,bQ as w,bj as ne,cp as re,gj as ie,jh as ae,jj as oe,jp as se,kh as ce,kj as T,kp as E,lp as D,op as O,sp as k,t as A,vj as j,wd as M,wj as N,xj as P,yQ as F,yj as I}from"./api-D64JTta1.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-Ce8urE01.js";import{t as V}from"./checkbox-BuTZzFvU.js";import{c as H,d as U,l as le,u as W}from"./tooltip-Dpar43UD.js";import{a as G,i as K,n as q,r as J,t as Y}from"./select-wXM6h61N.js";import{t as X}from"./button-DeHzYOzP.js";import{r as ue}from"./toast-DtA87VYn.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:i,help:T},documentary_fetch:{label:ee,help:c},inbound_files:{label:l,help:b},history_summary:{label:h,help:f},file_curation:{label:m,help:D},quote_reply:{label:se,help:a}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
|
|
2
2
|
- gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
|
|
3
3
|
Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
|
|
4
4
|
- [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:j,references:S,files:ie,previous_summary:ae,new_messages:r,max_chars:ce,file_name:re,budget_chars:k,feedback:O,content:C,excerpt:E};function _e(){let e=w(A.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:s()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(R,{label:u(),help:te()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:N()}),(0,$.jsxs)(Y,{value:r._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:r},r._id)]})}function ve({instance:e}){let t=F(A.admin.upsertInstanceConfig),n=ue(),r=w(A.me.getMe,{host:de}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>L(i,a));(0,Q.useEffect)(()=>{c(L(i,a))},[a,e._id]);let[l,u]=(0,Q.useState)(!1),f=s.promptInjections,p=(e,t)=>c({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){u(!0);try{await t({instanceId:e._id,config:z(s,i,a)})}catch(e){n.error(d(),e)}finally{u(!1)}}async function h(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(d(),e)}}let g=e.config?.contentLocale??`default`,_=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:M()}),(0,$.jsxs)(Y,{value:g,onValueChange:e=>void h(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:v({locale:_})}),pe().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:H[e],i18n:me[e],row:f[e]??{enabled:!0,template:H[e].defaultTemplate[a]},contentLocale:a,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(X,{size:`sm`,onClick:()=>void m(),disabled:l,children:x()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),d=W(e,r,i),f=d?U(d,u):``;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()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:p()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,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:oe()}),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:()=>s(e=>!e),children:o?P():y()}),c&&(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:g()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ne()}),t.pluralDefaultTemplate!==void 0&&!l?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:_()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:I()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AF as i,BF as a,CF as o,DF as s,EF as c,FF as l,IF as u,LF as d,MF as f,NF as p,OF as m,PF as h,QP as g,RF as _,SF as v,TF as ee,XP as y,ZP as b,_F as x,bF as te,bQ as ne,dF as re,eF as ie,fF as ae,gF as oe,hF as S,iF as C,jF as w,kF as T,mF as E,nF as D,nm as O,pF as k,rF as A,t as j,tF as M,uF as N,vF as P,wF as F,xF as I,yF as L,yQ as R,zF as z}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AF as i,BF as a,CF as o,DF as s,EF as c,FF as l,IF as u,LF as d,MF as f,NF as p,OF as m,PF as h,QP as g,RF as _,SF as v,TF as ee,XP as y,ZP as b,_F as x,bF as te,bQ as ne,dF as re,eF as ie,fF as ae,gF as oe,hF as S,iF as C,jF as w,kF as T,mF as E,nF as D,nm as O,pF as k,rF as A,t as j,tF as M,uF as N,vF as P,wF as F,xF as I,yF as L,yQ as R,zF as z}from"./api-D64JTta1.js";import{t as B}from"./lock-xfEfLa2G.js";import{t as V}from"./checkbox-BuTZzFvU.js";import{t as H}from"./button-DeHzYOzP.js";import{t as U}from"./input-CZ0jp9Rx.js";import"./convexApi-DxRiI80M.js";import{r as W}from"./toast-DtA87VYn.js";import{t as G}from"./badge-DwWXPxwl.js";import{n as K}from"./ConfirmDialog-Bfi4_Ti8.js";import{t as q}from"./EntitySheet-D8Vdib4B.js";import{t as J}from"./roleDescriptions-BW3e0J2_.js";var Y=t(e(),1),X=n(),Z=[{group:()=>a(),keys:[{key:`traces.read`,label:()=>l()},{key:`traces.read.content`,label:()=>h(),phi:!0},{key:`traces.write`,label:()=>p()}]},{group:()=>z(),keys:[{key:`kpi.read`,label:()=>l()},{key:`kpi.write`,label:()=>p()}]},{group:()=>_(),keys:[{key:`openclaw.query`,label:()=>f()},{key:`anomalies.read`,label:()=>w()},{key:`anomalies.report`,label:()=>i()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>l()},{key:`selfheal`,label:()=>m()},{key:`media.repair`,label:()=>s()},{key:`feedback.respond`,label:()=>O()}]},{group:()=>u(),keys:[{key:`admin.manage`,label:()=>T()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=ne(j.apiKeys.listRoles,{}),t=R(j.apiKeys.createRole),n=R(j.apiKeys.ensureRolesSeeded),i=R(j.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(j.apiKeys.listRoles,{});r&&e.setQuery(j.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=K(),s=W(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[p,m]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(ee(),e)})},[n,s]);let h=e??[];async function _(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:F({name:e.name}),description:o(),confirmLabel:v()});return}if(p.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];m(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(I(),e)}finally{m(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function w(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),u(!1)}catch(e){s.error(te(),e)}}let T=e===void 0,O=!T&&h.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[L(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,P(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,x()]}),(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:oe()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(H,{size:`sm`,onClick:()=>{f($),u(!0)},children:S()})})]}),T?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):O?(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:ae()}),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?c({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:h.map(e=>{let t=Q(e.permissions),n=p.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,{}),` `,re()]}):(0,X.jsx)(G,{variant:`secondary`,children:N()})]}),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?C():n?A():r,onCheckedChange:()=>void _(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:l,onOpenChange:u,title:D(),description:M(),canSubmit:!!(d.key&&d.name),onSubmit:w,submitLabel:ie(),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:r()}),(0,X.jsx)(U,{value:d.key,placeholder:g(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,X.jsx)(U,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,X.jsx)(U,{value:d.description,onChange:e=>f({...d,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$J as r,$Y as i,AY as a,BX as o,BY as s,CY as c,DY as l,EY as u,FX as d,GJ as f,GX as p,GY as m,HX as h,HY as g,IX as _,JJ as ee,KJ as te,KX as ne,KY as re,LJ as v,LX as y,MX as ie,MY as ae,NX as oe,NY as b,OY as se,PX as ce,QJ as le,QY as ue,RX as de,RY as fe,SY as x,TY as pe,UJ as me,UX as he,UY as ge,VX as _e,VY as ve,WJ as ye,WX as be,WY as xe,XJ as Se,YJ as Ce,YY as we,ZJ as Te,_Q as S,_Y as Ee,aX as De,aY as Oe,bQ as ke,bY as Ae,cX as je,dX as Me,eX as Ne,eY as Pe,fQ as C,fX as Fe,gY as Ie,iX as Le,iY as Re,jY as ze,k as w,kY as Be,lQ as Ve,lX as He,nX as Ue,nY as We,oX as T,oY as Ge,pX as Ke,qJ as qe,qX as Je,qY as Ye,rX as Xe,rY as Ze,t as E,tX as Qe,tY as $e,uX as et,vY as D,wY as tt,xY as nt,yY as rt,zX as it,zY as at}from"./api-CWqdeSbN.js";import{t as O}from"./chevron-left-ByEQraEh.js";import{t as k}from"./chevron-right-DMqzlhWH.js";import{t as ot}from"./list-obbqPBzD.js";import{t as st}from"./loader-circle-BqKiW3X9.js";import{a as ct,i as lt,n as ut,r as dt,t as ft}from"./cronDescribe-CkiSvbCK.js";import{t as pt}from"./pencil-K7SBkvHL.js";import{t as mt}from"./rotate-ccw-CvefWwHW.js";import{t as ht}from"./trash-2-xhtrhYsd.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-CjcMQhwm.js";import{a as gt,c as _t,i as vt,n as yt,o as bt,r as xt,s as St,t as Ct}from"./alert-dialog-BcJMHbhI.js";import{n as F,r as I,t as wt}from"./popover-C-Y_Yoco.js";import{t as L}from"./button-C_rIPtCv.js";import{t as Tt}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as Et}from"./toast-C_YfUacM.js";import{t as R}from"./badge-ChMMFtuW.js";import{a as Dt,i as Ot,n as kt,o as At,r as jt,t as Mt}from"./dialog-CPAskUwF.js";import{t as Nt}from"./appHost-CH3EGcJw.js";import{r as Pt}from"./measureClone-CHN0WNEY.js";import{a as Ft,i as z,n as It,o as Lt,r as B,t as Rt}from"./table-rRR3TpMc.js";import{t as zt}from"./FilterBar-DCCuFxDn.js";/* empty css */import{t as Bt}from"./useTableLayout-Cmwnuzxb.js";import{a as Vt,c as V,i as H,l as U,n as Ht,o as Ut,r as Wt,s as W,t as Gt,u as Kt}from"./TimezoneCombobox-CeRN4N3z.js";var qt=w(`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=w(`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`}]]),G=t(e(),1),K=n();function Yt(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 Xt({value:e,onChange:t}){let n=U(e),r=(0,G.useMemo)(()=>new Date,[]),[i,o]=(0,G.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,G.useState)(!1),l=(0,G.useMemo)(()=>Yt(C()),[]),u=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{month:`long`,year:`numeric`}),[]),d=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{dateStyle:`medium`,timeStyle:`short`}),[]),f=V(i.year,i.month),p=n?.hour??9,m=n?.minute??0,h=(e,n,r,i,a)=>t(Kt(e,n,r,i,a)),g=(e,t,n)=>{o({year:e,month:t}),h(e,t,n,p,m)},_=e=>{let t=new Date(i.year,i.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},ee=n===null?ae():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,K.jsxs)(wt,{modal:!0,open:s,onOpenChange:c,children:[(0,K.jsx)(I,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":b(),children:[(0,K.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,K.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ee})]})}),(0,K.jsxs)(F,{align:`start`,className:`oc-dtp__pop`,children:[(0,K.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ze(),onClick:()=>_(-1),children:(0,K.jsx)(O,{size:15,"aria-hidden":!0})}),(0,K.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":a(),onClick:()=>_(1),children:(0,K.jsx)(k,{size:15,"aria-hidden":!0})})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),f.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,K.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:()=>g(e.year,e.month,e.day),children:e.day},t)})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,K.jsxs)(P,{value:String(p),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),Number(e),m),children:[(0,K.jsx)(j,{size:`sm`,"aria-label":Be(),children:(0,K.jsx)(A,{})}),(0,K.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,K.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,K.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,K.jsxs)(P,{value:String(m),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),p,Number(e)),children:[(0,K.jsx)(j,{size:`sm`,"aria-label":se(),children:(0,K.jsx)(A,{})}),(0,K.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,K.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function Zt(e,t){return{available:e,required:[14*t]}}function Qt(e,t){return e.length===0?null:t===null?e[0]:e.find(e=>e>=t)??e[e.length-1]}function q(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=q(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 tn(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($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function nn(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 rn(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 an(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var J=3;function on({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=C(),l=(0,G.useMemo)(()=>en(e),[e]),u=(0,G.useMemo)(()=>nn(s),[s]),d=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),f=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),p=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),m=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{weekday:`long`,day:`numeric`,month:`long`}),[s]),h=new Date,g=(0,G.useRef)(null),_=(0,G.useRef)(null),ee=(0,G.useRef)(null),[te,ne]=(0,G.useState)(0),re=Pt(()=>{let e=g.current,t=_.current;return e===null||t===null?null:Zt(e.clientWidth,t.getBoundingClientRect().width)},()=>[g.current],[s],{hysteresis:24}),v=t??(re===0?`month`:`agenda`),y=e=>{if(v===`year`){i({year:n.year+e,month:n.month});return}let t=new Date(n.year,n.month+e,1);i({year:t.getFullYear(),month:t.getMonth()})},ie=v===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,K.jsxs)(`div`,{ref:g,className:`oc-cal`,"data-mode":v,children:[(0,K.jsxs)(`span`,{ref:_,className:`oc-cal__event oc-cal__chipmeasure`,"aria-hidden":!0,children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:p.format(new Date(2e3,0,1,23,59))})]}),(0,K.jsxs)(`div`,{ref:ee,className:`oc-cal__head`,children:[(0,K.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":rt(),onClick:()=>y(-1),children:(0,K.jsx)(O,{})}),(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":D(),onClick:()=>y(1),children:(0,K.jsx)(k,{})}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>{i({year:h.getFullYear(),month:h.getMonth()}),ne(e=>e+1)},children:Ae()})]}),(0,K.jsx)(`span`,{className:`oc-cal__title`,children:ie}),(0,K.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,K.jsx)(L,{variant:v===`agenda`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`agenda`,onClick:()=>r(`agenda`),children:x()}),(0,K.jsx)(L,{variant:v===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`month`,onClick:()=>r(`month`),children:tt()}),(0,K.jsx)(L,{variant:v===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`year`,onClick:()=>r(`year`),children:c()})]})]}),v===`agenda`?(0,K.jsx)(ln,{cursor:n,byDay:l,dayFmt:m,timeFmt:p,now:h,onEventClick:a,anchorKey:`${n.year}-${n.month}-${te}`,headRef:ee}):v===`month`?(0,K.jsx)(un,{cursor:n,byDay:l,weekdays:u,timeFmt:p,now:h,onEventClick:a}):(0,K.jsx)(dn,{year:n.year,byDay:l,monthShortFmt:f,now:h,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,K.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function sn(e){return`cal-event:${e}`}function cn(e=document){let t=e.querySelector(`.oc-cal`);return t===null?[]:[t.querySelector(`.oc-cal__modes [aria-pressed="true"]`)??t.querySelector(`.oc-cal__head button`)]}function Y(e,t){let n=e.parentElement;for(;n!==null;){let e=getComputedStyle(n).overflowY;if((e===`auto`||e===`scroll`)&&n.scrollHeight>n.clientHeight)break;n=n.parentElement}if(n===null)return;let r=n.getBoundingClientRect().top+n.clientTop,i=t?.getBoundingClientRect().height??0;n.scrollTop+=Math.floor(e.getBoundingClientRect().top-r-i)}function ln({cursor:e,byDay:t,dayFmt:n,timeFmt:r,now:i,onEventClick:a,anchorKey:o,headRef:s}){let c=V(e.year,e.month).filter(e=>e.inMonth).map(e=>({c:e,list:t.get($t(e.year,e.month,e.day))??[]})).filter(({list:e})=>e.length>0),l=i.getFullYear()===e.year&&i.getMonth()===e.month?i.getDate():null,u=Qt(c.map(({c:e})=>e.day),l),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=c.length>0?c[0].c.day:null;return(0,G.useLayoutEffect)(()=>{if(u===null||f.current===o)return;f.current=o;let e=d.current?.querySelector(`[data-day="${u}"]`),t=s.current;e&&(u===p&&t!==null&&e.getBoundingClientRect().top>=t.getBoundingClientRect().bottom||Y(e,t))},[o,u,p,s]),c.length===0?(0,K.jsx)(`p`,{className:`oc-cal__agendaempty`,children:nt()}):(0,K.jsx)(`div`,{ref:d,className:`oc-cal__agenda`,children:c.map(({c:e,list:t})=>{let o=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`section`,{className:`oc-cal__agendaday`,"data-day":e.day,children:[(0,K.jsx)(`h4`,{className:`oc-cal__agendadate`+(o?` oc-cal__agendadate--today`:``),children:n.format(new Date(e.year,e.month,e.day))}),t.map(e=>{let t=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]}),n=`oc-cal__agendaitem`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),i=e.color?{"--cal-ev":e.color}:void 0;return a?(0,K.jsx)(L,{type:`button`,variant:`ghost`,"data-focus-key":sn(e.id),className:`${n} h-auto min-h-11 w-full justify-start font-normal`,style:i,onClick:()=>a(e),children:t},e.id):(0,K.jsx)(`div`,{className:n,style:i,children:t},e.id)})]},e.day)})})}function un({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=V(e.year,e.month);return(0,K.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,K.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,J).map(e=>(0,K.jsxs)(`button`,{type:`button`,"data-focus-key":sn(e.id),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,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>J?(0,K.jsx)(`span`,{className:`oc-cal__more`,children:Ee({count:o.length-J})}):null]},n)})]})}function dn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,K.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=tn(t,e,o),c=V(e,o);return(0,K.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,K.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,K.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,K.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var fn={h:36e5,min:6e4,s:1e3,ms:1};function pn(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])*fn[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 X(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 Z(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=X(t[0],0,59),r=X(t[1],0,23),i=X(t[2],1,31),a=X(t[3],1,12),o=X(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 Q=new Map;function mn(e){let t=Q.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 Q.set(e,n),n}function hn(e,t){if(t!==null){let n=mn(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 gn(e,t,n,r,i,a){if(a===null||mn(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=hn(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 _n(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=Z(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=hn(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=gn(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=gn(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 vn=`crons`;function yn(e,t){return`${e}\u0000${t}`}function bn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=yn(a.instanceName,e.id);i.set(o,a);let s=Ut(e)!==`active`,c=_n(s?null:pn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:vn,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 xn(e){return e?.data?.code??`unknown`}function Sn({status:e}){switch(W(e)){case`ok`:return(0,K.jsx)(R,{variant:`secondary`,children:re()});case`error`:return(0,K.jsx)(R,{variant:`destructive`,children:xe()});case`running`:return(0,K.jsx)(R,{variant:`outline`,children:ge()});case`other`:return(0,K.jsx)(R,{variant:`outline`,children:e});case`none`:return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function Cn(){let e=S(E.scheduled.listMyCrons),t=S(E.scheduled.getCronDetail),n=S(E.scheduled.listCronRuns),a=S(E.scheduled.updateCron),c=S(E.scheduled.removeCron),ae=S(E.scheduled.runCronNow),b=Et(),se=ke(E.me.getMe,{host:Nt})?.timezone,[x,Ee]=(0,G.useState)(null),[Ae,ze]=(0,G.useState)(!1),[w,Be]=(0,G.useState)(!1),[D,tt]=(0,G.useState)(null),[nt,rt]=(0,G.useState)(null),[O,k]=(0,G.useState)(null),[F,I]=(0,G.useState)(null),[wt,Pt]=(0,G.useState)(!1),[V,U]=(0,G.useState)(Ht),[W,Kt]=(0,G.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Yt=e=>{localStorage.setItem(`oc.sched.view`,e),Kt(e)},[Zt,Qt]=(0,G.useState)(null),[q,$t]=(0,G.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),en=(0,G.useMemo)(()=>{let e=[];for(let t of x??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,V)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[x,V]),tn=(0,G.useMemo)(()=>Zt===`year`?an(q.year):rn(q.year,q.month),[Zt,q]),nn=(0,G.useMemo)(()=>bn(en,tn.startMs,tn.endMs),[en,tn]),J=(0,G.useRef)(null),sn=e=>{let t=nn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||(J.current=e.id,gn(t.instanceName,t.job))},Y=(0,G.useCallback)(async()=>{ze(!0),Be(!1);try{Ee(await e({}))}catch{Be(!0)}finally{ze(!1)}},[e]);(0,G.useEffect)(()=>{Y()},[Y]);let ln=(0,G.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),un=(0,G.useRef)(null),dn=(0,G.useRef)(null),fn=Bt(dn,[x,V,W,C()]);(0,G.useEffect)(()=>{x!==null&&un.current!==null&&un.current.scrollIntoView({block:`center`})},[x]);let pn=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{tt(e);try{await t(),b.success(n),await Y()}catch(e){b.toast({variant:`error`,title:T({code:xn(e)})})}finally{tt(null)}},Z=(0,G.useRef)(0),Q=(0,G.useRef)(0),mn=()=>J.current===null?[]:cn(),hn=async(e,t)=>{if(t.id===null)return;let r=++Z.current;k({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;k({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;k(null),b.toast({variant:`error`,title:T({code:xn(e)})})}},gn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;I({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;I(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;I(null),b.toast({variant:`error`,title:T({code:xn(e)})})}},_n=async()=>{if(F===null)return;let e={};if(F.nameDirty&&F.name.trim()===``||F.messageDirty&&F.hasMessage&&F.message.trim()===``){b.toast({variant:`error`,title:me()});return}if(F.nameDirty&&F.name.trim()!==``&&(e.name=F.name.trim()),F.scheduleDirty){if(F.scheduleKind===`cron`&&F.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:F.cronExpr.trim(),...F.tz.trim()===``?{}:{tz:F.tz.trim()}};else if(F.scheduleKind===`every`){let t=Number(F.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[F.everyUnit])})}else if(F.scheduleKind===`at`&&F.at!==``){let t=Date.parse(F.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(F.scheduleDirty&&e.schedule===void 0){b.toast({variant:`error`,title:ye()});return}if(F.messageDirty&&F.hasMessage&&F.message.trim()!==``&&(e.message=F.message.trim()),Object.keys(e).length===0){I(null);return}let t=Q.current;Pt(!0);try{await a({instanceName:F.instanceName,jobId:F.jobId,patch:e}),b.success(Ze()),t===Q.current&&I(null),await Y()}catch(e){b.toast({variant:`error`,title:T({code:xn(e)})})}finally{Pt(!1)}},vn=x?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Je()}),(0,K.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":l(),children:[(0,K.jsx)(L,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":u(),title:u(),"aria-pressed":W===`list`,onClick:()=>Yt(`list`),children:(0,K.jsx)(ot,{})}),(0,K.jsx)(L,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":pe(),title:pe(),"aria-pressed":W===`calendar`,onClick:()=>Yt(`calendar`),children:(0,K.jsx)(qt,{})})]}),(0,K.jsxs)(L,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:Ae,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,K.jsx)(mt,{size:14,"aria-hidden":!0}),ne()]})]}),x!==null&&vn>0?(0,K.jsxs)(zt,{q:V.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:ve(),onReset:()=>U(Ht),canReset:Wt(V),children:[(0,K.jsxs)(P,{value:V.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,K.jsx)(j,{size:`sm`,className:`w-40`,children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`all`,children:s()}),(0,K.jsx)(N,{value:`active`,children:oe()}),(0,K.jsx)(N,{value:`paused`,children:ce()}),(0,K.jsx)(N,{value:`auto-disabled`,children:ie()})]})]}),(0,K.jsxs)(P,{value:V.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,K.jsx)(j,{size:`sm`,className:`w-40`,children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`all`,children:at()}),(0,K.jsx)(N,{value:`ok`,children:re()}),(0,K.jsx)(N,{value:`error`,children:xe()}),(0,K.jsx)(N,{value:`running`,children:ge()}),(0,K.jsx)(N,{value:`none`,children:g()})]})]})]}):null,x===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Ae,children:w?p():Ve()}):W===`calendar`?(0,K.jsxs)(K.Fragment,{children:[w?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,K.jsx)(on,{events:nn.events,mode:Zt,cursor:q,onModeChange:Qt,onCursorChange:$t,onEventClick:sn,footnote:Ie()})]}):(0,K.jsxs)(K.Fragment,{children:[w?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,(0,K.jsx)(`div`,{ref:dn,className:`oc-tablefit`,"data-layout":fn,children:x.map(e=>{let t=e.jobs.filter(e=>Vt(e,V)),n=Wt(V)&&e.jobs.length>0&&t.length===0;return(0,K.jsxs)(`section`,{style:{marginBottom:20},children:[x.length>1||e.error||!e.supported?(0,K.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,K.jsx)(R,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:h({code:e.error})}):e.jobs.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):n?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,K.jsxs)(Rt,{children:[(0,K.jsx)(Ft,{children:(0,K.jsxs)(Lt,{children:[(0,K.jsx)(z,{children:o()}),(0,K.jsx)(z,{children:it()}),(0,K.jsx)(z,{children:de()}),(0,K.jsx)(z,{children:y()}),(0,K.jsx)(z,{children:_()}),(0,K.jsx)(z,{children:Ye()}),(0,K.jsx)(z,{children:Ge()})]})}),(0,K.jsx)(It,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=D===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,K.jsxs)(Lt,{ref:t.id!==null&&t.id===ln?un:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,K.jsx)(B,{className:`oc-dt__lead font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??d()}),(0,K.jsx)(B,{"data-label":it(),children:(0,K.jsx)(R,{variant:`secondary`,children:t.agentId})}),(0,K.jsxs)(B,{className:`whitespace-nowrap`,"data-label":de(),children:[(0,K.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ft(t.schedule),n=e===null?null:ut(e);return n===null?null:(0,K.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,K.jsx)(B,{className:`whitespace-nowrap text-muted-foreground`,"data-label":y(),children:t.nextRunAtMs===null?`—`:pn.format(t.nextRunAtMs)}),(0,K.jsx)(B,{"data-label":_(),children:Ut(t)===`auto-disabled`?(0,K.jsx)(R,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${pn.format(t.autoDisabledAtMs)}`}`,children:ie()}):Ut(t)===`active`?(0,K.jsx)(R,{variant:`secondary`,children:oe()}):Ut(t)===`paused`?(0,K.jsx)(R,{variant:`outline`,children:ce()}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,K.jsxs)(B,{"data-label":Ye(),children:[(0,K.jsx)(Sn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,K.jsx)(R,{variant:`destructive`,title:t.lastDeliveryError??Ke(),children:m()}):null]}),(0,K.jsx)(B,{className:`oc-dt__actionsrow whitespace-nowrap`,children:t.id===null?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,K.jsx)(st,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,K.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Me(),"aria-label":Me(),disabled:D!==null,onClick:()=>void X(r,async()=>{let n=await ae({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},De()),children:(0,K.jsx)(dt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:H(t)===`pause`?et():He(),"aria-label":H(t)===`pause`?et():He(),disabled:D!==null,onClick:()=>void X(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:H(t)===`resume`}}),H(t)===`pause`?Le():Xe()),children:H(t)===`pause`?(0,K.jsx)(ct,{size:14,"aria-hidden":!0}):(0,K.jsx)(lt,{size:14,"aria-hidden":!0})}):null,s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Oe(),"aria-label":Oe(),disabled:D!==null,onClick:()=>{J.current=null,gn(e.instanceName,t)},children:(0,K.jsx)(pt,{size:14,"aria-hidden":!0})}):null,s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Re(),"aria-label":Re(),disabled:D!==null,onClick:()=>void hn(e.instanceName,t),children:(0,K.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,o?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:je(),"aria-label":je(),disabled:D!==null,onClick:()=>rt({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,K.jsx)(ht,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]},e.instanceName)})}),vn>0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:v()}):null]}),(0,K.jsx)(Ct,{open:nt!==null,onOpenChange:e=>{e||rt(null)},children:(0,K.jsxs)(vt,{children:[(0,K.jsxs)(St,{children:[(0,K.jsx)(_t,{children:Qe()}),(0,K.jsx)(gt,{children:Ne({name:nt?.name??``})})]}),(0,K.jsxs)(bt,{children:[(0,K.jsx)(xt,{children:i()}),(0,K.jsx)(yt,{onClick:()=>{let e=nt;rt(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Ue())},children:ue()})]})]})}),(0,K.jsx)(Mt,{open:O!==null,onOpenChange:e=>{e||(Z.current++,k(null))},children:(0,K.jsxs)(kt,{style:{maxWidth:640},children:[(0,K.jsx)(Dt,{children:(0,K.jsx)(At,{children:We({name:O?.name??``})})}),O?.entries===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):O!==null&&O.entries.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):O===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:O.entries.map((e,t)=>(0,K.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,K.jsx)(Sn,{status:e.status}),(0,K.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?pn.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,K.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[we({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,K.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,K.jsx)(Mt,{open:F!==null,onOpenChange:e=>{e||(Q.current++,I(null))},children:(0,K.jsxs)(kt,{className:`oc-cronedit`,returnFocus:mn,children:[(0,K.jsxs)(Dt,{children:[(0,K.jsx)(At,{children:Pe()}),(0,K.jsx)(jt,{children:r()})]}),F===null?null:F.loading?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:o()}),(0,K.jsx)(Tt,{value:F.name,maxLength:200,onChange:e=>I({...F,name:e.target.value,nameDirty:!0})})]}),(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:le()}),(0,K.jsxs)(P,{value:F.scheduleKind,onValueChange:e=>I({...F,scheduleKind:e,scheduleDirty:!0}),children:[(0,K.jsx)(j,{children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`cron`,children:Te()}),(0,K.jsx)(N,{value:`every`,children:Se()}),(0,K.jsx)(N,{value:`at`,children:Ce()})]})]}),F.scheduleKind===`cron`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Tt,{value:F.cronExpr,onChange:e=>I({...F,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,K.jsx)(Gt,{value:F.tz,onChange:e=>I({...F,tz:e,scheduleDirty:!0}),fallbackTz:se??void 0})]}):F.scheduleKind===`every`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Tt,{type:`number`,min:1,value:F.everyValue,onChange:e=>I({...F,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,K.jsxs)(P,{value:F.everyUnit,onValueChange:e=>I({...F,everyUnit:e,scheduleDirty:!0}),children:[(0,K.jsx)(j,{style:{maxWidth:160},children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`minutes`,children:ee()}),(0,K.jsx)(N,{value:`hours`,children:qe()}),(0,K.jsx)(N,{value:`days`,children:te()})]})]})]}):(0,K.jsx)(Xt,{value:F.at,onChange:e=>I({...F,at:e,scheduleDirty:!0})})]}),F.hasMessage?(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Fe()}),(0,K.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:F.message,onChange:e=>I({...F,message:e.target.value,messageDirty:!0})})]}):null]}),(0,K.jsxs)(Ot,{children:[(0,K.jsx)(L,{variant:`ghost`,onClick:()=>I(null),children:i()}),(0,K.jsxs)(L,{onClick:()=>void _n(),disabled:F===null||F.loading||wt,children:[wt?(0,K.jsx)(st,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,f()]})]})]})})]})}export{Cn as ScheduledTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$J as r,$Y as i,AY as a,BX as o,BY as s,CY as c,DY as l,EY as u,FX as d,GJ as f,GX as p,GY as m,HX as h,HY as g,IX as _,JJ as ee,KJ as te,KX as ne,KY as re,LJ as v,LX as y,MX as ie,MY as ae,NX as oe,NY as b,OY as se,PX as ce,QJ as le,QY as ue,RX as de,RY as fe,SY as x,TY as pe,UJ as me,UX as he,UY as ge,VX as _e,VY as ve,WJ as ye,WX as be,WY as xe,XJ as Se,YJ as Ce,YY as we,ZJ as Te,_Q as S,_Y as Ee,aX as De,aY as Oe,bQ as ke,bY as Ae,cX as je,dX as Me,eX as Ne,eY as Pe,fQ as C,fX as Fe,gY as Ie,iX as Le,iY as Re,jY as ze,k as w,kY as Be,lQ as Ve,lX as He,nX as Ue,nY as We,oX as T,oY as Ge,pX as Ke,qJ as qe,qX as Je,qY as Ye,rX as Xe,rY as Ze,t as E,tX as Qe,tY as $e,uX as et,vY as D,wY as tt,xY as nt,yY as rt,zX as it,zY as at}from"./api-D64JTta1.js";import{t as O}from"./chevron-left-CjQ1kn0w.js";import{t as k}from"./chevron-right-DkaFdk2G.js";import{t as ot}from"./list-Bb0MIh_I.js";import{t as st}from"./loader-circle-1XN8tjq6.js";import{a as ct,i as lt,n as ut,r as dt,t as ft}from"./cronDescribe-B-ifUeLg.js";import{t as pt}from"./pencil-CHRZ3__S.js";import{t as mt}from"./rotate-ccw-CiOuaG2h.js";import{t as ht}from"./trash-2-CqKGt3lC.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-wXM6h61N.js";import{a as gt,c as _t,i as vt,n as yt,o as bt,r as xt,s as St,t as Ct}from"./alert-dialog-C6NSAwQv.js";import{n as F,r as I,t as wt}from"./popover-UJtu3EZ6.js";import{t as L}from"./button-DeHzYOzP.js";import{t as Tt}from"./input-CZ0jp9Rx.js";import"./convexApi-DxRiI80M.js";import{r as Et}from"./toast-DtA87VYn.js";import{t as R}from"./badge-DwWXPxwl.js";import{a as Dt,i as Ot,n as kt,o as At,r as jt,t as Mt}from"./dialog-awuZdW9M.js";import{t as Nt}from"./appHost-CH3EGcJw.js";import{r as Pt}from"./measureClone-CHN0WNEY.js";import{a as Ft,i as z,n as It,o as Lt,r as B,t as Rt}from"./table-CegX53gV.js";import{t as zt}from"./FilterBar-DtNuk6dI.js";/* empty css */import{t as Bt}from"./useTableLayout-Cmwnuzxb.js";import{a as Vt,c as V,i as H,l as U,n as Ht,o as Ut,r as Wt,s as W,t as Gt,u as Kt}from"./TimezoneCombobox-zOqV7dxe.js";var qt=w(`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=w(`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`}]]),G=t(e(),1),K=n();function Yt(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 Xt({value:e,onChange:t}){let n=U(e),r=(0,G.useMemo)(()=>new Date,[]),[i,o]=(0,G.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,G.useState)(!1),l=(0,G.useMemo)(()=>Yt(C()),[]),u=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{month:`long`,year:`numeric`}),[]),d=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{dateStyle:`medium`,timeStyle:`short`}),[]),f=V(i.year,i.month),p=n?.hour??9,m=n?.minute??0,h=(e,n,r,i,a)=>t(Kt(e,n,r,i,a)),g=(e,t,n)=>{o({year:e,month:t}),h(e,t,n,p,m)},_=e=>{let t=new Date(i.year,i.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},ee=n===null?ae():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,K.jsxs)(wt,{modal:!0,open:s,onOpenChange:c,children:[(0,K.jsx)(I,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":b(),children:[(0,K.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,K.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ee})]})}),(0,K.jsxs)(F,{align:`start`,className:`oc-dtp__pop`,children:[(0,K.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ze(),onClick:()=>_(-1),children:(0,K.jsx)(O,{size:15,"aria-hidden":!0})}),(0,K.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":a(),onClick:()=>_(1),children:(0,K.jsx)(k,{size:15,"aria-hidden":!0})})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),f.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,K.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:()=>g(e.year,e.month,e.day),children:e.day},t)})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,K.jsxs)(P,{value:String(p),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),Number(e),m),children:[(0,K.jsx)(j,{size:`sm`,"aria-label":Be(),children:(0,K.jsx)(A,{})}),(0,K.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,K.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,K.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,K.jsxs)(P,{value:String(m),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),p,Number(e)),children:[(0,K.jsx)(j,{size:`sm`,"aria-label":se(),children:(0,K.jsx)(A,{})}),(0,K.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,K.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function Zt(e,t){return{available:e,required:[14*t]}}function Qt(e,t){return e.length===0?null:t===null?e[0]:e.find(e=>e>=t)??e[e.length-1]}function q(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=q(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 tn(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($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function nn(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 rn(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 an(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var J=3;function on({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=C(),l=(0,G.useMemo)(()=>en(e),[e]),u=(0,G.useMemo)(()=>nn(s),[s]),d=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),f=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),p=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),m=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{weekday:`long`,day:`numeric`,month:`long`}),[s]),h=new Date,g=(0,G.useRef)(null),_=(0,G.useRef)(null),ee=(0,G.useRef)(null),[te,ne]=(0,G.useState)(0),re=Pt(()=>{let e=g.current,t=_.current;return e===null||t===null?null:Zt(e.clientWidth,t.getBoundingClientRect().width)},()=>[g.current],[s],{hysteresis:24}),v=t??(re===0?`month`:`agenda`),y=e=>{if(v===`year`){i({year:n.year+e,month:n.month});return}let t=new Date(n.year,n.month+e,1);i({year:t.getFullYear(),month:t.getMonth()})},ie=v===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,K.jsxs)(`div`,{ref:g,className:`oc-cal`,"data-mode":v,children:[(0,K.jsxs)(`span`,{ref:_,className:`oc-cal__event oc-cal__chipmeasure`,"aria-hidden":!0,children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:p.format(new Date(2e3,0,1,23,59))})]}),(0,K.jsxs)(`div`,{ref:ee,className:`oc-cal__head`,children:[(0,K.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":rt(),onClick:()=>y(-1),children:(0,K.jsx)(O,{})}),(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":D(),onClick:()=>y(1),children:(0,K.jsx)(k,{})}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>{i({year:h.getFullYear(),month:h.getMonth()}),ne(e=>e+1)},children:Ae()})]}),(0,K.jsx)(`span`,{className:`oc-cal__title`,children:ie}),(0,K.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,K.jsx)(L,{variant:v===`agenda`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`agenda`,onClick:()=>r(`agenda`),children:x()}),(0,K.jsx)(L,{variant:v===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`month`,onClick:()=>r(`month`),children:tt()}),(0,K.jsx)(L,{variant:v===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`year`,onClick:()=>r(`year`),children:c()})]})]}),v===`agenda`?(0,K.jsx)(ln,{cursor:n,byDay:l,dayFmt:m,timeFmt:p,now:h,onEventClick:a,anchorKey:`${n.year}-${n.month}-${te}`,headRef:ee}):v===`month`?(0,K.jsx)(un,{cursor:n,byDay:l,weekdays:u,timeFmt:p,now:h,onEventClick:a}):(0,K.jsx)(dn,{year:n.year,byDay:l,monthShortFmt:f,now:h,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,K.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function sn(e){return`cal-event:${e}`}function cn(e=document){let t=e.querySelector(`.oc-cal`);return t===null?[]:[t.querySelector(`.oc-cal__modes [aria-pressed="true"]`)??t.querySelector(`.oc-cal__head button`)]}function Y(e,t){let n=e.parentElement;for(;n!==null;){let e=getComputedStyle(n).overflowY;if((e===`auto`||e===`scroll`)&&n.scrollHeight>n.clientHeight)break;n=n.parentElement}if(n===null)return;let r=n.getBoundingClientRect().top+n.clientTop,i=t?.getBoundingClientRect().height??0;n.scrollTop+=Math.floor(e.getBoundingClientRect().top-r-i)}function ln({cursor:e,byDay:t,dayFmt:n,timeFmt:r,now:i,onEventClick:a,anchorKey:o,headRef:s}){let c=V(e.year,e.month).filter(e=>e.inMonth).map(e=>({c:e,list:t.get($t(e.year,e.month,e.day))??[]})).filter(({list:e})=>e.length>0),l=i.getFullYear()===e.year&&i.getMonth()===e.month?i.getDate():null,u=Qt(c.map(({c:e})=>e.day),l),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=c.length>0?c[0].c.day:null;return(0,G.useLayoutEffect)(()=>{if(u===null||f.current===o)return;f.current=o;let e=d.current?.querySelector(`[data-day="${u}"]`),t=s.current;e&&(u===p&&t!==null&&e.getBoundingClientRect().top>=t.getBoundingClientRect().bottom||Y(e,t))},[o,u,p,s]),c.length===0?(0,K.jsx)(`p`,{className:`oc-cal__agendaempty`,children:nt()}):(0,K.jsx)(`div`,{ref:d,className:`oc-cal__agenda`,children:c.map(({c:e,list:t})=>{let o=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`section`,{className:`oc-cal__agendaday`,"data-day":e.day,children:[(0,K.jsx)(`h4`,{className:`oc-cal__agendadate`+(o?` oc-cal__agendadate--today`:``),children:n.format(new Date(e.year,e.month,e.day))}),t.map(e=>{let t=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]}),n=`oc-cal__agendaitem`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),i=e.color?{"--cal-ev":e.color}:void 0;return a?(0,K.jsx)(L,{type:`button`,variant:`ghost`,"data-focus-key":sn(e.id),className:`${n} h-auto min-h-11 w-full justify-start font-normal`,style:i,onClick:()=>a(e),children:t},e.id):(0,K.jsx)(`div`,{className:n,style:i,children:t},e.id)})]},e.day)})})}function un({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=V(e.year,e.month);return(0,K.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,K.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,J).map(e=>(0,K.jsxs)(`button`,{type:`button`,"data-focus-key":sn(e.id),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,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>J?(0,K.jsx)(`span`,{className:`oc-cal__more`,children:Ee({count:o.length-J})}):null]},n)})]})}function dn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,K.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=tn(t,e,o),c=V(e,o);return(0,K.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,K.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,K.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,K.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var fn={h:36e5,min:6e4,s:1e3,ms:1};function pn(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])*fn[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 X(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 Z(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=X(t[0],0,59),r=X(t[1],0,23),i=X(t[2],1,31),a=X(t[3],1,12),o=X(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 Q=new Map;function mn(e){let t=Q.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 Q.set(e,n),n}function hn(e,t){if(t!==null){let n=mn(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 gn(e,t,n,r,i,a){if(a===null||mn(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=hn(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 _n(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=Z(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=hn(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=gn(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=gn(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 vn=`crons`;function yn(e,t){return`${e}\u0000${t}`}function bn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=yn(a.instanceName,e.id);i.set(o,a);let s=Ut(e)!==`active`,c=_n(s?null:pn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:vn,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 xn(e){return e?.data?.code??`unknown`}function Sn({status:e}){switch(W(e)){case`ok`:return(0,K.jsx)(R,{variant:`secondary`,children:re()});case`error`:return(0,K.jsx)(R,{variant:`destructive`,children:xe()});case`running`:return(0,K.jsx)(R,{variant:`outline`,children:ge()});case`other`:return(0,K.jsx)(R,{variant:`outline`,children:e});case`none`:return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function Cn(){let e=S(E.scheduled.listMyCrons),t=S(E.scheduled.getCronDetail),n=S(E.scheduled.listCronRuns),a=S(E.scheduled.updateCron),c=S(E.scheduled.removeCron),ae=S(E.scheduled.runCronNow),b=Et(),se=ke(E.me.getMe,{host:Nt})?.timezone,[x,Ee]=(0,G.useState)(null),[Ae,ze]=(0,G.useState)(!1),[w,Be]=(0,G.useState)(!1),[D,tt]=(0,G.useState)(null),[nt,rt]=(0,G.useState)(null),[O,k]=(0,G.useState)(null),[F,I]=(0,G.useState)(null),[wt,Pt]=(0,G.useState)(!1),[V,U]=(0,G.useState)(Ht),[W,Kt]=(0,G.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Yt=e=>{localStorage.setItem(`oc.sched.view`,e),Kt(e)},[Zt,Qt]=(0,G.useState)(null),[q,$t]=(0,G.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),en=(0,G.useMemo)(()=>{let e=[];for(let t of x??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,V)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[x,V]),tn=(0,G.useMemo)(()=>Zt===`year`?an(q.year):rn(q.year,q.month),[Zt,q]),nn=(0,G.useMemo)(()=>bn(en,tn.startMs,tn.endMs),[en,tn]),J=(0,G.useRef)(null),sn=e=>{let t=nn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||(J.current=e.id,gn(t.instanceName,t.job))},Y=(0,G.useCallback)(async()=>{ze(!0),Be(!1);try{Ee(await e({}))}catch{Be(!0)}finally{ze(!1)}},[e]);(0,G.useEffect)(()=>{Y()},[Y]);let ln=(0,G.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),un=(0,G.useRef)(null),dn=(0,G.useRef)(null),fn=Bt(dn,[x,V,W,C()]);(0,G.useEffect)(()=>{x!==null&&un.current!==null&&un.current.scrollIntoView({block:`center`})},[x]);let pn=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{tt(e);try{await t(),b.success(n),await Y()}catch(e){b.toast({variant:`error`,title:T({code:xn(e)})})}finally{tt(null)}},Z=(0,G.useRef)(0),Q=(0,G.useRef)(0),mn=()=>J.current===null?[]:cn(),hn=async(e,t)=>{if(t.id===null)return;let r=++Z.current;k({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;k({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;k(null),b.toast({variant:`error`,title:T({code:xn(e)})})}},gn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;I({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;I(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;I(null),b.toast({variant:`error`,title:T({code:xn(e)})})}},_n=async()=>{if(F===null)return;let e={};if(F.nameDirty&&F.name.trim()===``||F.messageDirty&&F.hasMessage&&F.message.trim()===``){b.toast({variant:`error`,title:me()});return}if(F.nameDirty&&F.name.trim()!==``&&(e.name=F.name.trim()),F.scheduleDirty){if(F.scheduleKind===`cron`&&F.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:F.cronExpr.trim(),...F.tz.trim()===``?{}:{tz:F.tz.trim()}};else if(F.scheduleKind===`every`){let t=Number(F.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[F.everyUnit])})}else if(F.scheduleKind===`at`&&F.at!==``){let t=Date.parse(F.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(F.scheduleDirty&&e.schedule===void 0){b.toast({variant:`error`,title:ye()});return}if(F.messageDirty&&F.hasMessage&&F.message.trim()!==``&&(e.message=F.message.trim()),Object.keys(e).length===0){I(null);return}let t=Q.current;Pt(!0);try{await a({instanceName:F.instanceName,jobId:F.jobId,patch:e}),b.success(Ze()),t===Q.current&&I(null),await Y()}catch(e){b.toast({variant:`error`,title:T({code:xn(e)})})}finally{Pt(!1)}},vn=x?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Je()}),(0,K.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":l(),children:[(0,K.jsx)(L,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":u(),title:u(),"aria-pressed":W===`list`,onClick:()=>Yt(`list`),children:(0,K.jsx)(ot,{})}),(0,K.jsx)(L,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":pe(),title:pe(),"aria-pressed":W===`calendar`,onClick:()=>Yt(`calendar`),children:(0,K.jsx)(qt,{})})]}),(0,K.jsxs)(L,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:Ae,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,K.jsx)(mt,{size:14,"aria-hidden":!0}),ne()]})]}),x!==null&&vn>0?(0,K.jsxs)(zt,{q:V.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:ve(),onReset:()=>U(Ht),canReset:Wt(V),children:[(0,K.jsxs)(P,{value:V.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,K.jsx)(j,{size:`sm`,className:`w-40`,children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`all`,children:s()}),(0,K.jsx)(N,{value:`active`,children:oe()}),(0,K.jsx)(N,{value:`paused`,children:ce()}),(0,K.jsx)(N,{value:`auto-disabled`,children:ie()})]})]}),(0,K.jsxs)(P,{value:V.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,K.jsx)(j,{size:`sm`,className:`w-40`,children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`all`,children:at()}),(0,K.jsx)(N,{value:`ok`,children:re()}),(0,K.jsx)(N,{value:`error`,children:xe()}),(0,K.jsx)(N,{value:`running`,children:ge()}),(0,K.jsx)(N,{value:`none`,children:g()})]})]})]}):null,x===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Ae,children:w?p():Ve()}):W===`calendar`?(0,K.jsxs)(K.Fragment,{children:[w?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,K.jsx)(on,{events:nn.events,mode:Zt,cursor:q,onModeChange:Qt,onCursorChange:$t,onEventClick:sn,footnote:Ie()})]}):(0,K.jsxs)(K.Fragment,{children:[w?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,(0,K.jsx)(`div`,{ref:dn,className:`oc-tablefit`,"data-layout":fn,children:x.map(e=>{let t=e.jobs.filter(e=>Vt(e,V)),n=Wt(V)&&e.jobs.length>0&&t.length===0;return(0,K.jsxs)(`section`,{style:{marginBottom:20},children:[x.length>1||e.error||!e.supported?(0,K.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,K.jsx)(R,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:h({code:e.error})}):e.jobs.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):n?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,K.jsxs)(Rt,{children:[(0,K.jsx)(Ft,{children:(0,K.jsxs)(Lt,{children:[(0,K.jsx)(z,{children:o()}),(0,K.jsx)(z,{children:it()}),(0,K.jsx)(z,{children:de()}),(0,K.jsx)(z,{children:y()}),(0,K.jsx)(z,{children:_()}),(0,K.jsx)(z,{children:Ye()}),(0,K.jsx)(z,{children:Ge()})]})}),(0,K.jsx)(It,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=D===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,K.jsxs)(Lt,{ref:t.id!==null&&t.id===ln?un:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,K.jsx)(B,{className:`oc-dt__lead font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??d()}),(0,K.jsx)(B,{"data-label":it(),children:(0,K.jsx)(R,{variant:`secondary`,children:t.agentId})}),(0,K.jsxs)(B,{className:`whitespace-nowrap`,"data-label":de(),children:[(0,K.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ft(t.schedule),n=e===null?null:ut(e);return n===null?null:(0,K.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,K.jsx)(B,{className:`whitespace-nowrap text-muted-foreground`,"data-label":y(),children:t.nextRunAtMs===null?`—`:pn.format(t.nextRunAtMs)}),(0,K.jsx)(B,{"data-label":_(),children:Ut(t)===`auto-disabled`?(0,K.jsx)(R,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${pn.format(t.autoDisabledAtMs)}`}`,children:ie()}):Ut(t)===`active`?(0,K.jsx)(R,{variant:`secondary`,children:oe()}):Ut(t)===`paused`?(0,K.jsx)(R,{variant:`outline`,children:ce()}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,K.jsxs)(B,{"data-label":Ye(),children:[(0,K.jsx)(Sn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,K.jsx)(R,{variant:`destructive`,title:t.lastDeliveryError??Ke(),children:m()}):null]}),(0,K.jsx)(B,{className:`oc-dt__actionsrow whitespace-nowrap`,children:t.id===null?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,K.jsx)(st,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,K.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Me(),"aria-label":Me(),disabled:D!==null,onClick:()=>void X(r,async()=>{let n=await ae({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},De()),children:(0,K.jsx)(dt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:H(t)===`pause`?et():He(),"aria-label":H(t)===`pause`?et():He(),disabled:D!==null,onClick:()=>void X(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:H(t)===`resume`}}),H(t)===`pause`?Le():Xe()),children:H(t)===`pause`?(0,K.jsx)(ct,{size:14,"aria-hidden":!0}):(0,K.jsx)(lt,{size:14,"aria-hidden":!0})}):null,s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Oe(),"aria-label":Oe(),disabled:D!==null,onClick:()=>{J.current=null,gn(e.instanceName,t)},children:(0,K.jsx)(pt,{size:14,"aria-hidden":!0})}):null,s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Re(),"aria-label":Re(),disabled:D!==null,onClick:()=>void hn(e.instanceName,t),children:(0,K.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,o?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:je(),"aria-label":je(),disabled:D!==null,onClick:()=>rt({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,K.jsx)(ht,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]},e.instanceName)})}),vn>0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:v()}):null]}),(0,K.jsx)(Ct,{open:nt!==null,onOpenChange:e=>{e||rt(null)},children:(0,K.jsxs)(vt,{children:[(0,K.jsxs)(St,{children:[(0,K.jsx)(_t,{children:Qe()}),(0,K.jsx)(gt,{children:Ne({name:nt?.name??``})})]}),(0,K.jsxs)(bt,{children:[(0,K.jsx)(xt,{children:i()}),(0,K.jsx)(yt,{onClick:()=>{let e=nt;rt(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Ue())},children:ue()})]})]})}),(0,K.jsx)(Mt,{open:O!==null,onOpenChange:e=>{e||(Z.current++,k(null))},children:(0,K.jsxs)(kt,{style:{maxWidth:640},children:[(0,K.jsx)(Dt,{children:(0,K.jsx)(At,{children:We({name:O?.name??``})})}),O?.entries===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):O!==null&&O.entries.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):O===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:O.entries.map((e,t)=>(0,K.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,K.jsx)(Sn,{status:e.status}),(0,K.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?pn.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,K.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[we({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,K.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,K.jsx)(Mt,{open:F!==null,onOpenChange:e=>{e||(Q.current++,I(null))},children:(0,K.jsxs)(kt,{className:`oc-cronedit`,returnFocus:mn,children:[(0,K.jsxs)(Dt,{children:[(0,K.jsx)(At,{children:Pe()}),(0,K.jsx)(jt,{children:r()})]}),F===null?null:F.loading?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:o()}),(0,K.jsx)(Tt,{value:F.name,maxLength:200,onChange:e=>I({...F,name:e.target.value,nameDirty:!0})})]}),(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:le()}),(0,K.jsxs)(P,{value:F.scheduleKind,onValueChange:e=>I({...F,scheduleKind:e,scheduleDirty:!0}),children:[(0,K.jsx)(j,{children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`cron`,children:Te()}),(0,K.jsx)(N,{value:`every`,children:Se()}),(0,K.jsx)(N,{value:`at`,children:Ce()})]})]}),F.scheduleKind===`cron`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Tt,{value:F.cronExpr,onChange:e=>I({...F,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,K.jsx)(Gt,{value:F.tz,onChange:e=>I({...F,tz:e,scheduleDirty:!0}),fallbackTz:se??void 0})]}):F.scheduleKind===`every`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Tt,{type:`number`,min:1,value:F.everyValue,onChange:e=>I({...F,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,K.jsxs)(P,{value:F.everyUnit,onValueChange:e=>I({...F,everyUnit:e,scheduleDirty:!0}),children:[(0,K.jsx)(j,{style:{maxWidth:160},children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`minutes`,children:ee()}),(0,K.jsx)(N,{value:`hours`,children:qe()}),(0,K.jsx)(N,{value:`days`,children:te()})]})]})]}):(0,K.jsx)(Xt,{value:F.at,onChange:e=>I({...F,at:e,scheduleDirty:!0})})]}),F.hasMessage?(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Fe()}),(0,K.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:F.message,onChange:e=>I({...F,message:e.target.value,messageDirty:!0})})]}):null]}),(0,K.jsxs)(Ot,{children:[(0,K.jsx)(L,{variant:`ghost`,onClick:()=>I(null),children:i()}),(0,K.jsxs)(L,{onClick:()=>void _n(),disabled:F===null||F.loading||wt,children:[wt?(0,K.jsx)(st,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,f()]})]})]})})]})}export{Cn as ScheduledTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,AG as ee,BG as te,CG as i,CK as ne,DG as a,EG as o,FG as re,GG as ie,HG as ae,IG as oe,JG as se,KG as ce,LG as le,MG as ue,NG as de,OG as fe,PG as pe,QG as me,RG as he,SG as s,SK as ge,TG as c,UG as _e,VG as ve,WG as ye,XG as be,YG as xe,ZG as Se,_G as Ce,_K as we,_Q as Te,aG as l,aK as Ee,bG as u,bK as De,bQ as d,cG as f,cK as Oe,dG as p,dK as ke,eK as Ae,fG as m,fK as je,gG as Me,gK as Ne,hG as Pe,hK as Fe,iG as h,iK as Ie,jG as Le,kG as Re,lG as g,lK as ze,mG as _,mK as Be,nK as Ve,oG as v,oK as He,pG as y,pK as Ue,qG as We,rK as Ge,sG as b,sK as Ke,t as x,tK as qe,uG as S,uK as Je,vG as C,vK as w,wG as T,wK as Ye,xG as E,xK as Xe,yG as D,yK as O,yQ as k,zG as Ze}from"./api-CWqdeSbN.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as A}from"./check-DdmANHSb.js";import{r as et}from"./dist-CzmY6YrA.js";import{t as tt}from"./chevron-right-DMqzlhWH.js";import{t as j}from"./copy-DbstFM9Q.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import{t as L}from"./button-C_rIPtCv.js";import{t as R}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as nt}from"./toast-C_YfUacM.js";import{t as z}from"./badge-ChMMFtuW.js";import{n as B,t as V}from"./format-AQELUhPa.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./dialog-CPAskUwF.js";import{n as rt}from"./ConfirmDialog-B7k0wvSi.js";import{t as it}from"./EntitySheet-DRzkWKlH.js";import{t as at}from"./FilterBar-DCCuFxDn.js";import{t as ot}from"./DataTableShell-DvtkASQG.js";import{t as st}from"./roleDescriptions-DHny6e80.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>S(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>f(),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??``,i=e.status??Z,[a,o]=(0,J.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),Ce=d(x.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),l=d(x.apiKeys.listKeys,{}),u=d(x.apiKeys.listRoles,{}),f=k(x.apiKeys.createServiceAccount),p=k(x.apiKeys.updateServiceAccount),m=k(x.apiKeys.deleteServiceAccount),Me=Te(x.apiKeys.mintApiKey),Pe=k(x.apiKeys.revokeApiKey),h=rt(),g=nt(),_=n!==``||a!==Z||i!==Z;function v(){o(Z),t({search:{},replace:!0})}let[y,b]=(0,J.useState)(!1),[S,C]=(0,J.useState)(Q),[T,E]=(0,J.useState)(null),[D,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 l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{T?(await p({serviceAccountId:T,name:S.name,roleKey:S.roleKey,description:S.description}),g.success(ae())):await f({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),C(Q),E(null),b(!1)}catch(e){g.error(T?_e():ye(),e)}}function ft(e){C({name:e.name,roleKey:e.roleKey,description:e.description??``}),E(e._id),b(!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 Me({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){g.error(ve(),e)}finally{V.current=!1,B(null)}}async function mt(e){if(await h({title:te(),description:(0,Y.jsxs)(Y.Fragment,{children:[Ze(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,he(),` `,(0,Y.jsx)(`strong`,{children:le()}),` `,oe()]}),confirmWord:e.name,confirmLabel:re(),destructive:!0}))try{await m({serviceAccountId:e._id}),g.success(pe(),e.name)}catch(e){g.error(de(),e)}}async function ht(e){if(await h({title:ue(),description:(0,Y.jsxs)(Y.Fragment,{children:[Le(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ee()]}),confirmLabel:Re(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await Pe({keyId:e._id})}catch(e){g.error(fe(),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:Ye()}),(0,Y.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:ne(),onReset:v,canReset:_,children:[(0,Y.jsxs)(I,{value:a,onValueChange:o,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(M,{placeholder:ge()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:Z,children:Xe()}),(u??[]).map(e=>(0,Y.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(I,{value:i,onValueChange:c,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:De()}),(0,Y.jsx)(F,{value:`active`,children:O()}),(0,Y.jsx)(F,{value:`disabled`,children:w()})]})]})]}),(0,Y.jsx)(ot,{title:we(),rows:Ce,addLabel:Ne(),onAdd:()=>{C(Q),E(null),b(!0)},emptyHint:Fe(),isExpanded:e=>D.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:ke(),onSelect:()=>ft(e)},{label:Be(),onSelect:()=>void pt(e)}]:[],{label:D.has(e._id)?Ue():je(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Je(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":D.has(e._id)?ze():Oe(),onClick:()=>$(e._id),children:D.has(e._id)?(0,Y.jsx)(et,{}):(0,Y.jsx)(tt,{})})},{header:Ke(),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:He(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})},{header:Ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:w()}):(0,Y.jsx)(z,{variant:`outline`,children:O()})},{header:Ie(),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:Ge(),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?Ve():qe({count:t})})}}]}),(0,Y.jsx)(it,{open:y,onOpenChange:e=>{b(e),e||E(null)},title:T?Ae():Se(),description:T?r():be(),canSubmit:!!(S.name&&S.roleKey),onSubmit:dt,submitLabel:T?me():xe(),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:se()}),(0,Y.jsx)(R,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,Y.jsxs)(I,{value:S.roleKey||void 0,onValueChange:e=>C({...S,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(M,{placeholder:ce()})}),(0,Y.jsx)(P,{children:(u??[]).map(e=>(0,Y.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===S.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:ie()}),(0,Y.jsx)(R,{value:S.description,onChange:e=>C({...S,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:[a(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:c()}),(0,Y.jsx)(`th`,{children:T()}),(0,Y.jsx)(`th`,{children:i()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{children:E()}),(0,Y.jsx)(`th`,{children:u()}),(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)?D():C()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function ee(){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:Ce()}),(0,Y.jsx)(K,{children:Me({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:Pe()}),(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 ee(),"aria-label":_(),children:[n?(0,Y.jsx)(A,{}):(0,Y.jsx)(j,{}),n?y():m()]})]}),(0,Y.jsx)(U,{children:(0,Y.jsx)(L,{onClick:()=>{r(!1),t()},children:p()})})]}):null})}function dt(e){return e!==null&&Date.now()-e>X}function ft(e){return e===null?b():B(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(z,{variant:`outline`,children:l()}):(0,Y.jsx)(z,{variant:`outline`,children:h()})}export{$ as ServiceAccountsTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,AG as ee,BG as te,CG as i,CK as ne,DG as a,EG as o,FG as re,GG as ie,HG as ae,IG as oe,JG as se,KG as ce,LG as le,MG as ue,NG as de,OG as fe,PG as pe,QG as me,RG as he,SG as s,SK as ge,TG as c,UG as _e,VG as ve,WG as ye,XG as be,YG as xe,ZG as Se,_G as Ce,_K as we,_Q as Te,aG as l,aK as Ee,bG as u,bK as De,bQ as d,cG as f,cK as Oe,dG as p,dK as ke,eK as Ae,fG as m,fK as je,gG as Me,gK as Ne,hG as Pe,hK as Fe,iG as h,iK as Ie,jG as Le,kG as Re,lG as g,lK as ze,mG as _,mK as Be,nK as Ve,oG as v,oK as He,pG as y,pK as Ue,qG as We,rK as Ge,sG as b,sK as Ke,t as x,tK as qe,uG as S,uK as Je,vG as C,vK as w,wG as T,wK as Ye,xG as E,xK as Xe,yG as D,yK as O,yQ as k,zG as Ze}from"./api-D64JTta1.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as A}from"./check-pVsND9oZ.js";import{r as et}from"./dist-C0V3m4aH.js";import{t as tt}from"./chevron-right-DkaFdk2G.js";import{t as j}from"./copy-4wREwP-V.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-wXM6h61N.js";import{t as L}from"./button-DeHzYOzP.js";import{t as R}from"./input-CZ0jp9Rx.js";import"./convexApi-DxRiI80M.js";import{r as nt}from"./toast-DtA87VYn.js";import{t as z}from"./badge-DwWXPxwl.js";import{n as B,t as V}from"./format-g5Z3Txjl.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./dialog-awuZdW9M.js";import{n as rt}from"./ConfirmDialog-Bfi4_Ti8.js";import{t as it}from"./EntitySheet-D8Vdib4B.js";import{t as at}from"./FilterBar-DtNuk6dI.js";import{t as ot}from"./DataTableShell-1ZsZ0a2J.js";import{t as st}from"./roleDescriptions-BW3e0J2_.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>S(),days:null},{value:`30`,label:()=>g(),days:30},{value:`90`,label:()=>f(),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??``,i=e.status??Z,[a,o]=(0,J.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),Ce=d(x.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),l=d(x.apiKeys.listKeys,{}),u=d(x.apiKeys.listRoles,{}),f=k(x.apiKeys.createServiceAccount),p=k(x.apiKeys.updateServiceAccount),m=k(x.apiKeys.deleteServiceAccount),Me=Te(x.apiKeys.mintApiKey),Pe=k(x.apiKeys.revokeApiKey),h=rt(),g=nt(),_=n!==``||a!==Z||i!==Z;function v(){o(Z),t({search:{},replace:!0})}let[y,b]=(0,J.useState)(!1),[S,C]=(0,J.useState)(Q),[T,E]=(0,J.useState)(null),[D,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 l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{T?(await p({serviceAccountId:T,name:S.name,roleKey:S.roleKey,description:S.description}),g.success(ae())):await f({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),C(Q),E(null),b(!1)}catch(e){g.error(T?_e():ye(),e)}}function ft(e){C({name:e.name,roleKey:e.roleKey,description:e.description??``}),E(e._id),b(!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 Me({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){g.error(ve(),e)}finally{V.current=!1,B(null)}}async function mt(e){if(await h({title:te(),description:(0,Y.jsxs)(Y.Fragment,{children:[Ze(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,he(),` `,(0,Y.jsx)(`strong`,{children:le()}),` `,oe()]}),confirmWord:e.name,confirmLabel:re(),destructive:!0}))try{await m({serviceAccountId:e._id}),g.success(pe(),e.name)}catch(e){g.error(de(),e)}}async function ht(e){if(await h({title:ue(),description:(0,Y.jsxs)(Y.Fragment,{children:[Le(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ee()]}),confirmLabel:Re(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await Pe({keyId:e._id})}catch(e){g.error(fe(),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:Ye()}),(0,Y.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:ne(),onReset:v,canReset:_,children:[(0,Y.jsxs)(I,{value:a,onValueChange:o,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Y.jsx)(M,{placeholder:ge()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:Z,children:Xe()}),(u??[]).map(e=>(0,Y.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(I,{value:i,onValueChange:c,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:De()}),(0,Y.jsx)(F,{value:`active`,children:O()}),(0,Y.jsx)(F,{value:`disabled`,children:w()})]})]})]}),(0,Y.jsx)(ot,{title:we(),rows:Ce,addLabel:Ne(),onAdd:()=>{C(Q),E(null),b(!0)},emptyHint:Fe(),isExpanded:e=>D.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:ke(),onSelect:()=>ft(e)},{label:Be(),onSelect:()=>void pt(e)}]:[],{label:D.has(e._id)?Ue():je(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Je(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":D.has(e._id)?ze():Oe(),onClick:()=>$(e._id),children:D.has(e._id)?(0,Y.jsx)(et,{}):(0,Y.jsx)(tt,{})})},{header:Ke(),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:He(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})},{header:Ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:w()}):(0,Y.jsx)(z,{variant:`outline`,children:O()})},{header:Ie(),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:Ge(),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?Ve():qe({count:t})})}}]}),(0,Y.jsx)(it,{open:y,onOpenChange:e=>{b(e),e||E(null)},title:T?Ae():Se(),description:T?r():be(),canSubmit:!!(S.name&&S.roleKey),onSubmit:dt,submitLabel:T?me():xe(),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:se()}),(0,Y.jsx)(R,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,Y.jsxs)(I,{value:S.roleKey||void 0,onValueChange:e=>C({...S,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(M,{placeholder:ce()})}),(0,Y.jsx)(P,{children:(u??[]).map(e=>(0,Y.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===S.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:ie()}),(0,Y.jsx)(R,{value:S.description,onChange:e=>C({...S,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:[a(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:c()}),(0,Y.jsx)(`th`,{children:T()}),(0,Y.jsx)(`th`,{children:i()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{children:E()}),(0,Y.jsx)(`th`,{children:u()}),(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)?D():C()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function ee(){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:Ce()}),(0,Y.jsx)(K,{children:Me({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:Pe()}),(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 ee(),"aria-label":_(),children:[n?(0,Y.jsx)(A,{}):(0,Y.jsx)(j,{}),n?y():m()]})]}),(0,Y.jsx)(U,{children:(0,Y.jsx)(L,{onClick:()=>{r(!1),t()},children:p()})})]}):null})}function dt(e){return e!==null&&Date.now()-e>X}function ft(e){return e===null?b():B(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(z,{variant:`outline`,children:l()}):(0,Y.jsx)(z,{variant:`outline`,children:h()})}export{$ as ServiceAccountsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,Gh as a,Hh as o,Jh as s,Kh as c,Qh as l,Rh as u,Sg as d,Uh as f,Vh as p,Wh as m,Xh as h,Yh as g,Zh as _,_g as v,ag as y,bQ as b,bg as x,cg as S,dg as C,eg as w,fg as T,gg as E,hg as D,ig as O,lg as k,mg as A,ng as j,og as M,pg as N,qh as P,rg as F,sg as I,t as L,tg as R,ug as ee,vg as z,xg as B,yQ as V,yg as H,zh as U}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,Gh as a,Hh as o,Jh as s,Kh as c,Qh as l,Rh as u,Sg as d,Uh as f,Vh as p,Wh as m,Xh as h,Yh as g,Zh as _,_g as v,ag as y,bQ as b,bg as x,cg as S,dg as C,eg as w,fg as T,gg as E,hg as D,ig as O,lg as k,mg as A,ng as j,og as M,pg as N,qh as P,rg as F,sg as I,t as L,tg as R,ug as ee,vg as z,xg as B,yQ as V,yg as H,zh as U}from"./api-D64JTta1.js";import{t as W}from"./button-DeHzYOzP.js";import"./convexApi-DxRiI80M.js";import{n as G}from"./format-g5Z3Txjl.js";import{n as K}from"./ConfirmDialog-Bfi4_Ti8.js";import{t as q}from"./DataTableShell-1ZsZ0a2J.js";var J=t(e(),1),Y=n(),X={hung:()=>y(),wrong_result:()=>O(),error:()=>F(),other:()=>j()},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=V(L.subAgentReports.respondToReport),[i,u]=(0,J.useState)(e.thread),[d,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(!1);async function x(){let t=d.trim();if(!(!t||y)){b(!0);try{await n({reportId:e._id,text:t}),u(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),v(``)}finally{b(!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),` · `,R({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:w()}),(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:r()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?l():_()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:h()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:g(),value:d,maxLength:2e3,rows:3,onChange:e=>v(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 x(),disabled:!d.trim()||y,children:y?P():s()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[c({count:t.children.length}),t.childrenTruncated?` ${a()}`:``,t.textTruncated?` ${m()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${f()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(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:p()}),(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=b(L.subAgentReports.listForAdmin,{}),t=V(L.subAgentReports.readReport),n=V(L.subAgentReports.deleteReport),r=K(),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({reportId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function f(e){await r({title:i(),description:U(),confirmLabel:u(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&o(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,Y.jsx)(`strong`,{children:H()}),` `,z()]}),(0,Y.jsx)(q,{title:d(),rows:e,emptyHint:B(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Y.jsx)($,{data:s[e._id]}):null,columns:[{header:v(),cell:e=>G(e.at),sort:e=>e.at},{header:E(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:D(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:A(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${C({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:N(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:T(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ee()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?I():S(),onSelect:()=>void l(e)},{label:M(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$q as r,AJ as i,Aq as a,Bq as o,CJ as s,Cq as c,DJ as l,Dq as u,EJ as d,Eq as f,Fh as p,Fq as m,Gq as h,Hq as g,Ih as _,Iq as v,Jq as y,Kq as b,Lh as x,Lq as ee,MJ as te,Mq as ne,NJ as re,Nq as ie,OJ as ae,Oq as oe,Ph as se,Pq as ce,Qq as le,Rq as ue,SJ as de,Sq as fe,TJ as pe,Tq as me,Uq as he,Vq as ge,Wq as _e,Xq as S,Yq as ve,Zq as ye,_J as be,_Q as xe,_q as Se,aJ as Ce,aQ as we,bJ as Te,bQ as C,bq as Ee,cJ as De,dJ as Oe,dq as ke,eJ as Ae,fJ as je,fq as Me,gJ as Ne,gq as Pe,hJ as Fe,hq as w,iJ as Ie,jJ as Le,jq as T,kJ as Re,kq as ze,lJ as Be,mJ as Ve,mq as He,nJ as Ue,o as We,oJ as Ge,oQ as Ke,pJ as qe,pq as Je,qq as Ye,rJ as Xe,sJ as Ze,sQ as Qe,t as E,tJ as $e,uJ as et,vJ as tt,vq as nt,wJ as rt,wq as it,xJ as at,xq as ot,yJ as st,yQ as D,yq as O,zq as ct}from"./api-CWqdeSbN.js";import{t as k}from"./check-DdmANHSb.js";import{c as lt,g as A,i as ut,n as dt,r as j,s as M,t as ft}from"./dropdown-menu-BVKVjups.js";import{t as pt}from"./download-BaebAe6Z.js";import{t as N}from"./checkbox-DPxJTQjc.js";import{i as P,n as mt,r as ht}from"./useChart-bV4rotdu.js";import{t as F}from"./x-CcIT4ync.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CjcMQhwm.js";import{t as V}from"./button-C_rIPtCv.js";import{t as H}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{t as U}from"./badge-ChMMFtuW.js";import{t as W}from"./appHost-CH3EGcJw.js";import{t as gt}from"./localePickerView-C2RmOS86.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,t as St}from"./card-BV8NO76j.js";import{a as Ct,i as G,n as wt,o as K,r as q,t as Tt}from"./table-rRR3TpMc.js";import{t as Et}from"./TimeRangePicker-BZtw1JkM.js";import{t as Dt}from"./FilterBar-DCCuFxDn.js";import{t as Ot}from"./AdvancedFilter-Cod8SSd6.js";var J=t(e(),1),kt=.1,At=[248,248,248],jt=[24,24,24];function Mt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Nt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Nt(e,t,n)>=kt}function Pt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Ft(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var It=12*1024*1024,Lt=480,Rt=160,zt=.92;async function Bt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ce());if(e.size>It)throw Error(ie());let{source:n,width:r,height:i,cleanup:o}=await Vt(e);try{let o=e.type===`image/svg+xml`,s=Math.min(Lt/r,Rt/i,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(i*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(T());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Mt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(T());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);Y(e.data,f.width,f.height)?Pt(e.data,t.variantFor===`dark`?At:jt):Ft(e.data),m.putImageData(e,0,0)}let h=Y(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await X(p,`image/webp`,zt)??await X(p,`image/png`);if(!g)throw Error(a());return{blob:g,hasAlpha:h}}finally{o()}}async function Vt(e){if(e.type===`image/svg+xml`)return Ht(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ht(e)}async function Ht(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ne())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Ut(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Wt={kind:`relative`,from:`now-24h`,to:`now`},Gt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Kt(e){return e===`light`?Qe():e===`dark`?Ke():we()}var qt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Jt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:qt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Yt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:We(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Jt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":x(),title:x(),children:(0,Z.jsx)(pt,{className:`size-4`})}):null]})}function Xt({selectedKey:e,resolvedMode:t}){let n=C(E.charts.listMyCharts),r=D(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Yt,{selected:e===null,title:s(),subtitle:de(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?at():n.via===`owner`?Te():st({group:n.via.group});return(0,Z.jsx)(Yt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Ut(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:tt()}):null]})}function Zt(){let e=D(E.charts.importChart),[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{let e=await t.text();a(e)}catch{s(S())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(y());return}let r;try{r=JSON.parse(i)}catch{s(S());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ie()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,Z.jsx)(H,{value:t,onChange:e=>n(e.target.value),placeholder:$e(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:r(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(P,{className:`size-4`}),le(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,Z.jsx)(V,{size:`sm`,disabled:u,onClick:()=>void p(),children:ye()})]}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:ve()}):null]})]})}function Qt({chart:e}){let t=xe(E.charts.setChartLogo),n=D(E.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Bt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ge():o()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(V,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(P,{className:`size-4`}),t?ue():ct(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:v()}):null,t?(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ee()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:g()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(p,{mode:`light`}),(0,Z.jsx)(p,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $t({chart:e}){let t=C(E.me.getMe,{host:W}),n=D(E.charts.addChartDomain),r=D(E.charts.removeChartDomain),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function p(){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 m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ze()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:me()}):d.map(e=>(0,Z.jsxs)(U,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":it({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(F,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(H,{value:i,onChange:e=>a(e.target.value),placeholder:u(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(V,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void p(),children:f()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:oe()}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function en(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=D(E.charts.updateChart),n=D(E.charts.deleteChart),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.name),[s,l]=(0,J.useState)(()=>en(e.tokens)),[u,d]=(0,J.useState)(e.tokens.bpm??0),[f,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(!1);function v(){o(e.name),l(en(e.tokens)),d(e.tokens.bpm??0),m(null),i(!0)}async function y(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(s)}catch{m(S());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(O()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,size:`sm`,onClick:v,children:_e()}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:he()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ot()}),(0,Z.jsx)(H,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:_()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":_()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?p():`${u} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:se()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ee()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{size:`sm`,disabled:h,onClick:()=>void y(),children:c()}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:fe()})]})]}):null,(0,Z.jsx)(Qt,{chart:e}),(0,Z.jsx)($t,{chart:e})]})}function nn(){let e=C(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ye()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:h()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=D(E.charts.addChartToGroupPool),r=D(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(U,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?et():e.kind===`custom`&&e.scope===`personal`?w():Oe()}),e.isGlobalDefault?(0,Z.jsx)(U,{variant:`default`,children:Be()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ze()}),(a??[]).map(e=>(0,Z.jsxs)(U,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ce({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(F,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(B,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(I,{placeholder:Ge()})}),(0,Z.jsx)(R,{children:s.map(e=>(0,Z.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:De()}):null]})]})}function an({chart:e}){let t=D(E.charts.promoteChartToCommon),n=D(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(O()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(U,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?He():w()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Pe({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Je()}):null,(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Me()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=D(E.admin.setDefaultThemeMode),a=D(E.admin.setDefaultLocale),o=D(E.charts.setDefaultChart),c=C(E.charts.listChartsAdmin),u=C(E.groups.listGroups,{}),f=e??`system`,p=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:s()}),ht.map(e=>(0,Z.jsx)(V,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(V,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Fe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(rn,{chart:e,groups:u??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:qe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)($t,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:nt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ke()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(an,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:re()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(V,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Kt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Le()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:gt().map(e=>(0,Z.jsx)(V,{variant:p===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]})]})}function sn(){let e=C(E.me.getMe,{host:W}),t=mt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Xt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Zt,{}),(0,Z.jsx)(nn,{}),e?.role===`admin`?(0,Z.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Q),[c,l]=(0,J.useState)(Q),[u,d]=(0,J.useState)(Wt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Wt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(sn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:ae()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{children:`Default`}),(0,Z.jsx)(V,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(V,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(V,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(V,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(V,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{size:`sm`,children:`Small`}),(0,Z.jsx)(V,{children:`Default`}),(0,Z.jsx)(V,{size:`lg`,children:`Large`}),(0,Z.jsx)(V,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(V,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(U,{children:`Default`}),(0,Z.jsx)(U,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(U,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(U,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(H,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(B,{value:n,onValueChange:r,children:[(0,Z.jsx)(L,{className:`w-56`,children:(0,Z.jsx)(I,{placeholder:`Select…`})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(N,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(Dt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(B,{value:o,onValueChange:s,children:[(0,Z.jsx)(L,{size:`sm`,children:(0,Z.jsx)(I,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(z,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(z,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(B,{value:c,onValueChange:l,children:[(0,Z.jsx)(L,{size:`sm`,children:(0,Z.jsx)(I,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(z,{value:`info`,children:`info`}),(0,Z.jsx)(z,{value:`warn`,children:`warn`}),(0,Z.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(Ot,{fields:Gt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Et,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(lt,{asChild:!0,children:(0,Z.jsx)(V,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(A,{})})}),(0,Z.jsxs)(dt,{align:`start`,children:[(0,Z.jsx)(ut,{children:`Actions`}),(0,Z.jsx)(M,{}),(0,Z.jsx)(j,{children:`Edit`}),(0,Z.jsx)(j,{children:`Duplicate`}),(0,Z.jsx)(M,{}),(0,Z.jsx)(j,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(St,{className:`w-full max-w-80`,children:[(0,Z.jsxs)(_t,{children:[(0,Z.jsx)(bt,{children:`Instance`}),(0,Z.jsx)(xt,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(yt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(vt,{className:`gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,children:`Save`}),(0,Z.jsx)(V,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Tt,{children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(K,{children:[(0,Z.jsx)(G,{className:`w-8`,children:(0,Z.jsx)(N,{"aria-label":`select all`})}),(0,Z.jsx)(G,{children:`Name`}),(0,Z.jsx)(G,{children:`Mode`}),(0,Z.jsx)(G,{className:`text-right`,children:`Status`}),(0,Z.jsx)(G,{className:`w-8`})]})}),(0,Z.jsx)(wt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(K,{children:[(0,Z.jsx)(q,{children:(0,Z.jsx)(N,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(q,{className:`font-medium`,children:e.n}),(0,Z.jsx)(q,{children:(0,Z.jsx)(U,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(q,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(q,{children:(0,Z.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(A,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$q as r,AJ as i,Aq as a,Bq as o,CJ as s,Cq as c,DJ as l,Dq as u,EJ as d,Eq as f,Fh as p,Fq as m,Gq as h,Hq as g,Ih as _,Iq as v,Jq as y,Kq as b,Lh as x,Lq as ee,MJ as te,Mq as ne,NJ as re,Nq as ie,OJ as ae,Oq as oe,Ph as se,Pq as ce,Qq as le,Rq as ue,SJ as de,Sq as fe,TJ as pe,Tq as me,Uq as he,Vq as ge,Wq as _e,Xq as S,Yq as ve,Zq as ye,_J as be,_Q as xe,_q as Se,aJ as Ce,aQ as we,bJ as Te,bQ as C,bq as Ee,cJ as De,dJ as Oe,dq as ke,eJ as Ae,fJ as je,fq as Me,gJ as Ne,gq as Pe,hJ as Fe,hq as w,iJ as Ie,jJ as Le,jq as T,kJ as Re,kq as ze,lJ as Be,mJ as Ve,mq as He,nJ as Ue,o as We,oJ as Ge,oQ as Ke,pJ as qe,pq as Je,qq as Ye,rJ as Xe,sJ as Ze,sQ as Qe,t as E,tJ as $e,uJ as et,vJ as tt,vq as nt,wJ as rt,wq as it,xJ as at,xq as ot,yJ as st,yQ as D,yq as O,zq as ct}from"./api-D64JTta1.js";import{t as k}from"./check-pVsND9oZ.js";import{c as lt,g as A,i as ut,n as dt,r as j,s as M,t as ft}from"./dropdown-menu-C5VrCGFe.js";import{t as pt}from"./download-BUlwPQI8.js";import{t as N}from"./checkbox-BuTZzFvU.js";import{i as P,n as mt,r as ht}from"./useChart-BTVKxdLu.js";import{t as F}from"./x-BNU-sWkh.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-wXM6h61N.js";import{t as V}from"./button-DeHzYOzP.js";import{t as H}from"./input-CZ0jp9Rx.js";import"./convexApi-DxRiI80M.js";import{t as U}from"./badge-DwWXPxwl.js";import{t as W}from"./appHost-CH3EGcJw.js";import{t as gt}from"./localePickerView-C2RmOS86.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,t as St}from"./card-WAOfM0PL.js";import{a as Ct,i as G,n as wt,o as K,r as q,t as Tt}from"./table-CegX53gV.js";import{t as Et}from"./TimeRangePicker-jsNw51TL.js";import{t as Dt}from"./FilterBar-DtNuk6dI.js";import{t as Ot}from"./AdvancedFilter-DYTsdqhC.js";var J=t(e(),1),kt=.1,At=[248,248,248],jt=[24,24,24];function Mt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Nt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Nt(e,t,n)>=kt}function Pt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Ft(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var It=12*1024*1024,Lt=480,Rt=160,zt=.92;async function Bt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ce());if(e.size>It)throw Error(ie());let{source:n,width:r,height:i,cleanup:o}=await Vt(e);try{let o=e.type===`image/svg+xml`,s=Math.min(Lt/r,Rt/i,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(i*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(T());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Mt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(T());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);Y(e.data,f.width,f.height)?Pt(e.data,t.variantFor===`dark`?At:jt):Ft(e.data),m.putImageData(e,0,0)}let h=Y(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await X(p,`image/webp`,zt)??await X(p,`image/png`);if(!g)throw Error(a());return{blob:g,hasAlpha:h}}finally{o()}}async function Vt(e){if(e.type===`image/svg+xml`)return Ht(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ht(e)}async function Ht(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ne())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Ut(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Wt={kind:`relative`,from:`now-24h`,to:`now`},Gt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Kt(e){return e===`light`?Qe():e===`dark`?Ke():we()}var qt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Jt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:qt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Yt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:We(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Jt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":x(),title:x(),children:(0,Z.jsx)(pt,{className:`size-4`})}):null]})}function Xt({selectedKey:e,resolvedMode:t}){let n=C(E.charts.listMyCharts),r=D(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Yt,{selected:e===null,title:s(),subtitle:de(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?at():n.via===`owner`?Te():st({group:n.via.group});return(0,Z.jsx)(Yt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Ut(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:tt()}):null]})}function Zt(){let e=D(E.charts.importChart),[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{let e=await t.text();a(e)}catch{s(S())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(y());return}let r;try{r=JSON.parse(i)}catch{s(S());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ie()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,Z.jsx)(H,{value:t,onChange:e=>n(e.target.value),placeholder:$e(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:r(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(P,{className:`size-4`}),le(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,Z.jsx)(V,{size:`sm`,disabled:u,onClick:()=>void p(),children:ye()})]}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:ve()}):null]})]})}function Qt({chart:e}){let t=xe(E.charts.setChartLogo),n=D(E.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Bt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ge():o()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(V,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(P,{className:`size-4`}),t?ue():ct(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:v()}):null,t?(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ee()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:g()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(p,{mode:`light`}),(0,Z.jsx)(p,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $t({chart:e}){let t=C(E.me.getMe,{host:W}),n=D(E.charts.addChartDomain),r=D(E.charts.removeChartDomain),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function p(){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 m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ze()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:me()}):d.map(e=>(0,Z.jsxs)(U,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":it({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(F,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(H,{value:i,onChange:e=>a(e.target.value),placeholder:u(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(V,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void p(),children:f()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:oe()}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function en(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=D(E.charts.updateChart),n=D(E.charts.deleteChart),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.name),[s,l]=(0,J.useState)(()=>en(e.tokens)),[u,d]=(0,J.useState)(e.tokens.bpm??0),[f,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(!1);function v(){o(e.name),l(en(e.tokens)),d(e.tokens.bpm??0),m(null),i(!0)}async function y(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(s)}catch{m(S());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(O()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,size:`sm`,onClick:v,children:_e()}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:he()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ot()}),(0,Z.jsx)(H,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:_()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":_()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?p():`${u} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:se()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ee()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{size:`sm`,disabled:h,onClick:()=>void y(),children:c()}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:fe()})]})]}):null,(0,Z.jsx)(Qt,{chart:e}),(0,Z.jsx)($t,{chart:e})]})}function nn(){let e=C(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ye()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:h()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=D(E.charts.addChartToGroupPool),r=D(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(U,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?et():e.kind===`custom`&&e.scope===`personal`?w():Oe()}),e.isGlobalDefault?(0,Z.jsx)(U,{variant:`default`,children:Be()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ze()}),(a??[]).map(e=>(0,Z.jsxs)(U,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ce({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(F,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(B,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(I,{placeholder:Ge()})}),(0,Z.jsx)(R,{children:s.map(e=>(0,Z.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:De()}):null]})]})}function an({chart:e}){let t=D(E.charts.promoteChartToCommon),n=D(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(O()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(U,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?He():w()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Pe({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Je()}):null,(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Me()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=D(E.admin.setDefaultThemeMode),a=D(E.admin.setDefaultLocale),o=D(E.charts.setDefaultChart),c=C(E.charts.listChartsAdmin),u=C(E.groups.listGroups,{}),f=e??`system`,p=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:s()}),ht.map(e=>(0,Z.jsx)(V,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(V,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Fe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(rn,{chart:e,groups:u??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:qe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)($t,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:nt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ke()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(an,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:re()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(V,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Kt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Le()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:gt().map(e=>(0,Z.jsx)(V,{variant:p===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]})]})}function sn(){let e=C(E.me.getMe,{host:W}),t=mt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Xt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Zt,{}),(0,Z.jsx)(nn,{}),e?.role===`admin`?(0,Z.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Q),[c,l]=(0,J.useState)(Q),[u,d]=(0,J.useState)(Wt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Wt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(sn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:ae()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{children:`Default`}),(0,Z.jsx)(V,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(V,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(V,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(V,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(V,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{size:`sm`,children:`Small`}),(0,Z.jsx)(V,{children:`Default`}),(0,Z.jsx)(V,{size:`lg`,children:`Large`}),(0,Z.jsx)(V,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(V,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(U,{children:`Default`}),(0,Z.jsx)(U,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(U,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(U,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(H,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(B,{value:n,onValueChange:r,children:[(0,Z.jsx)(L,{className:`w-56`,children:(0,Z.jsx)(I,{placeholder:`Select…`})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(N,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(Dt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(B,{value:o,onValueChange:s,children:[(0,Z.jsx)(L,{size:`sm`,children:(0,Z.jsx)(I,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(z,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(z,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(B,{value:c,onValueChange:l,children:[(0,Z.jsx)(L,{size:`sm`,children:(0,Z.jsx)(I,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(z,{value:`info`,children:`info`}),(0,Z.jsx)(z,{value:`warn`,children:`warn`}),(0,Z.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(Ot,{fields:Gt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Et,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(lt,{asChild:!0,children:(0,Z.jsx)(V,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(A,{})})}),(0,Z.jsxs)(dt,{align:`start`,children:[(0,Z.jsx)(ut,{children:`Actions`}),(0,Z.jsx)(M,{}),(0,Z.jsx)(j,{children:`Edit`}),(0,Z.jsx)(j,{children:`Duplicate`}),(0,Z.jsx)(M,{}),(0,Z.jsx)(j,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(St,{className:`w-full max-w-80`,children:[(0,Z.jsxs)(_t,{children:[(0,Z.jsx)(bt,{children:`Instance`}),(0,Z.jsx)(xt,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(yt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(vt,{className:`gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,children:`Save`}),(0,Z.jsx)(V,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Tt,{children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(K,{children:[(0,Z.jsx)(G,{className:`w-8`,children:(0,Z.jsx)(N,{"aria-label":`select all`})}),(0,Z.jsx)(G,{children:`Name`}),(0,Z.jsx)(G,{children:`Mode`}),(0,Z.jsx)(G,{className:`text-right`,children:`Status`}),(0,Z.jsx)(G,{className:`w-8`})]})}),(0,Z.jsx)(wt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(K,{children:[(0,Z.jsx)(q,{children:(0,Z.jsx)(N,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(q,{className:`font-medium`,children:e.n}),(0,Z.jsx)(q,{children:(0,Z.jsx)(U,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(q,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(q,{children:(0,Z.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(A,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gf as r,Jf as i,Kf as a,Xf as o,Yf as s,Zf as c,aA as l,cA as u,dA as d,fA as f,hA as p,iA as m,lA as h,mA as g,oA as _,pA as v,qf as y,rA as b,sA as x,uA as S}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gf as r,Jf as i,Kf as a,Xf as o,Yf as s,Zf as c,aA as l,cA as u,dA as d,fA as f,hA as p,iA as m,lA as h,mA as g,oA as _,pA as v,qf as y,rA as b,sA as x,uA as S}from"./api-D64JTta1.js";import{n as C,t as w}from"./search-NOJ0tWl2.js";import{n as T,r as E,t as D}from"./popover-UJtu3EZ6.js";import{t as O}from"./button-DeHzYOzP.js";import{t as k}from"./input-CZ0jp9Rx.js";import{n as A}from"./format-g5Z3Txjl.js";var j=t(e(),1),M={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function N(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=M[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function P(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:N(e.from,t)??t-M.h,to:N(e.to,t)??t}}var F=[{label:p(),from:`now-5m`},{label:g(),from:`now-15m`},{label:v(),from:`now-30m`},{label:f(),from:`now-1h`},{label:d(),from:`now-3h`},{label:S(),from:`now-6h`},{label:h(),from:`now-12h`},{label:u(),from:`now-24h`},{label:x(),from:`now-2d`},{label:_(),from:`now-7d`},{label:l(),from:`now-30d`},{label:m(),from:`now-90d`},{label:b(),from:`now-520w`}];function I(e){return A(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function L(e){if(e.kind===`relative`){let t=F.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${I(e.from)} → ${I(e.to)}`}function R(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 z(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function B(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var V=n();function H(e){let[t,n]=(0,j.useState)(0);return(0,j.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,j.useMemo)(()=>{let{from:t,to:n}=P(e);return e.kind===`absolute`?{from:t,to:n}:{from:U(t),to:U(n)}},[e,t])}function U(e){return Math.floor(e/6e4)*6e4}function W({value:e,onChange:t}){let[n,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),f=P(e),[p,m]=(0,j.useState)(()=>R(f.from)),[h,g]=(0,j.useState)(()=>R(f.to));function _(t){if(t){let t=P(e);m(R(t.from)),g(R(t.to)),d(``)}l(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),l(!1)}function b(){let e=z(p),n=z(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),l(!1))}let x=(0,j.useMemo)(()=>{let e=u.trim().toLowerCase();return e===``?F:F.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[u]),S=z(p)!==null&&z(h)!==null;return(0,V.jsxs)(D,{open:n,onOpenChange:_,children:[(0,V.jsx)(E,{asChild:!0,children:(0,V.jsxs)(O,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,V.jsx)(C,{}),L(e)]})}),(0,V.jsx)(T,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border-border`,children:(0,V.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,V.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,V.jsx)(`div`,{className:`oc-timerange__section-title`,children:c()}),(0,V.jsxs)(`label`,{className:`oc-field`,children:[(0,V.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,V.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,V.jsxs)(`label`,{className:`oc-field`,children:[(0,V.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,V.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,V.jsx)(O,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:b,children:i()})]}),(0,V.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,V.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,V.jsx)(w,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,V.jsx)(k,{value:u,onChange:e=>d(e.target.value),placeholder:y(),"aria-label":a()})]}),(0,V.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,V.jsx)(`li`,{className:`oc-timerange__empty`,children:r()}):x.map(t=>(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})]})}export{H as n,B as r,W as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FY as r,IY as i,LY as a,PY as o}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FY as r,IY as i,LY as a,PY as o}from"./api-D64JTta1.js";import{t as s}from"./check-pVsND9oZ.js";import{t as c}from"./chevrons-up-down-uk0IvxY8.js";import{n as l,r as u,t as d}from"./popover-UJtu3EZ6.js";import{t as f}from"./input-CZ0jp9Rx.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()||o():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":a(),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:r()}):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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,$M as i,AB as a,BB as o,Bd as s,CN as c,DB as l,EN as u,FB as d,GM as f,Hd as p,IB as m,JB as h,JM as g,KB as _,KM as v,LB as y,MB as b,NB as x,OB as S,PB as C,QB as ee,QM as te,RB as ne,SN as re,TN as ie,UM as ae,VB as oe,Vd as se,WM as ce,XB as le,XM as ue,YB as de,YM as fe,ZB as pe,ZM as me,_N as he,aN as ge,aV as w,bN as _e,bQ as T,cN as ve,cV as E,dN as ye,dV as D,eN as be,eV as O,fN as xe,fV as k,gN as Se,gV as A,hN as Ce,hV as j,iN as we,iV as M,jB as Te,k as Ee,kB as De,lN as Oe,lV as ke,mN as Ae,mV as je,nN as Me,nV as Ne,oN as Pe,oV as Fe,pN as Ie,pV as Le,qB as Re,qM as ze,rN as Be,rV as N,sN as Ve,sV as He,t as P,tN as Ue,tV as We,uN as Ge,uV as Ke,vN as qe,wN as Je,xN as Ye,yN as Xe,yQ as F,zB as Ze}from"./api-CWqdeSbN.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as et}from"./check-DdmANHSb.js";import{t as tt}from"./copy-DbstFM9Q.js";import{n as nt,t as rt}from"./eye-LggiM6Z5.js";import{o as it,r as at}from"./deliveryRecorder-B_kVKMkR.js";import{t as ot}from"./x-CcIT4ync.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CjcMQhwm.js";import{i as V,n as H,r as st,t as ct}from"./tabs-B8emuY1B.js";import{t as U}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{t as W}from"./badge-ChMMFtuW.js";import{a as lt,n as G}from"./format-AQELUhPa.js";import{a as ut,n as dt,o as ft,r as pt,t as mt}from"./dialog-CPAskUwF.js";import{c as ht,o as gt,s as _t,u as vt}from"./searchSchemas-Dm-Qg010.js";import{t as yt}from"./appHost-CH3EGcJw.js";import{n as bt}from"./TimeRangePicker-BZtw1JkM.js";import{t as K}from"./FilterBar-DCCuFxDn.js";import{t as xt}from"./AdvancedFilter-Cod8SSd6.js";import{t as St}from"./DataTableShell-DvtkASQG.js";var Ct=Ee(`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`?pe():n===`agent`?`${le()} - ${r}`:e}function Tt(){let e=T(P.me.getMe,{host:yt})?.role===`admin`,t=T(P.deliveryTiming.getDeliveryStatus,{}),n=F(P.deliveryTiming.startDeliveryRecord),r=F(P.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!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 flex-wrap items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:A()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:j()})]}),e?(0,J.jsx)(U,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?Le():je()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(W,{variant:`secondary`,children:k()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:D({time:lt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?E():ke()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=T(P.deliveryTiming.listDeliverySessions,{}),n=F(P.deliveryTiming.deleteDeliverySessions),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=bt(c),m=c.to===`now`?1/0:p,g=i.trim()!==``||o!==`all`||c!==Y,_=()=>{a(``),s(`all`),l(Y)},v=(0,q.useMemo)(()=>{if(t===void 0)return;let e=i.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,i,o,f,m]),y=e=>{let t=new Set((v??[]).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)(K,{q:i,onQChange:a,searchPlaceholder:Fe(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:g,children:(0,J.jsxs)(B,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:`all`,children:w()}),(0,J.jsx)(z,{value:`active`,children:M()}),(0,J.jsx)(z,{value:`stopped`,children:N()})]})]})}),(0,J.jsx)(St,{title:He(),rows:v,emptyHint:S(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(U,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?h():de(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(nt,{size:15,"aria-hidden":!0}):(0,J.jsx)(rt,{size:15,"aria-hidden":!0})})},{header:Ne(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:We(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:O(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:r(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:ee(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(W,{variant:`secondary`,children:M()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:N()})}],rowActions:e?e=>[{label:Re(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:Re(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=T(P.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(at(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:_()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()});let r=e.segments,i=(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,` `,l()]}),(0,J.jsxs)(U,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(et,{size:13,"aria-hidden":!0}):(0,J.jsx)(tt,{size:13,"aria-hidden":!0}),t?De():a()]})]}),(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:Ze()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ne()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:y()})]})}),(0,J.jsxs)(`tbody`,{children:[i(m(),r.bridge),i(d(),r.A),i(C(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]})}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:p()},{value:`principalType`,label:se()},{value:`direction`,label:`direction`},{value:`roleKey`,label:s()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=Qe({from:`/settings/traces`}),t=$e({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,d=e.roleKey??Q,f=e.q??``,p=e.correlationId,m=gt(e.from,e.to),h=(0,q.useMemo)(()=>vt(e.adv),[e.adv]),{from:_,to:y}=bt(m),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),ee=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),ae=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),se=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,...ht(e)})}),w=e=>void t({search:t=>({...t,adv:_t(e)}),replace:!0}),E=T(P.observability.listEvents,{limit:n}),D=T(P.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...p?{correlationId:p}:{},filter:{q:f||void 0,from:_,to:y,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:d===Q?void 0:d,advanced:h.length>0?h:void 0}}),O=(0,q.useMemo)(()=>{let e=new Set;for(let t of E??[])e.add(t.kind);return[...e].sort()},[E]),k=(0,q.useMemo)(()=>{let e=new Set;for(let t of E??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[E]),A=f!==``||a!==Q||s!==Q||l!==Q||d!==Q||h.length>0||m.kind!==`relative`||m.from!==Nt.from;function j(){t({search:{limit:100,kind:`all`},replace:!0})}let M=b?E?.filter(e=>e.correlationId===b):D,Te=e.section,Ee=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(ct,{value:Te,onValueChange:e=>Ee(e),children:[(0,J.jsxs)(st,{className:`w-full`,children:[(0,J.jsxs)(V,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(it,{size:13,"aria-hidden":!0}),oe()]}),(0,J.jsxs)(V,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),o()]})]}),(0,J.jsx)(H,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(H,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),(0,J.jsx)(`strong`,{children:ie()}),Je(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,J.jsxs)(K,{q:f,onQChange:ae,searchPlaceholder:re(),timeRange:m,onTimeRangeChange:pe,onReset:j,canReset:A,children:[(0,J.jsxs)(B,{value:a,onValueChange:se,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:Ye()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:_e()}),At.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:s,onValueChange:ce,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:Xe()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:qe()}),jt.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:l,onValueChange:le,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:he()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:Se()}),Mt.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:d,onValueChange:de,children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:Ce()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:Ae()}),k.map(e=>(0,J.jsx)(z,{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:Ie(),"aria-label":Ie(),onChange:e=>{let t=e.target.value.trim();ne(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:O.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(B,{value:String(n),onValueChange:e=>ee(Number(e)),children:[(0,J.jsx)(L,{size:`sm`,className:`w-28`,children:(0,J.jsx)(I,{})}),(0,J.jsx)(R,{children:kt.map(e=>(0,J.jsx)(z,{value:String(e),children:xe({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:h,onChange:w}),b?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>x(null),title:ye(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Ge(),(0,J.jsx)(`code`,{children:$(b)})]}),(0,J.jsx)(ot,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:Oe()})]})}):null,(0,J.jsx)(St,{title:ve(),rows:M,emptyHint:b?Ve():Pe(),columns:[{header:ge(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:we(),sort:e=>e.kind,cell:e=>(0,J.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Be(),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":Me(),children:`✓`})}},{header:Ue(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(W,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:be(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:i(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:te(),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:me(),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:ue(),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:fe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:g(),onClick:()=>x(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ze(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:v()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:S,onClose:()=>C(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)(mt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(dt,{className:`max-w-lg`,children:[(0,J.jsxs)(ut,{children:[(0,J.jsxs)(ft,{className:`oc-traces__meta-title`,children:[f(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(W,{variant:`outline`,children:ce()})]}),(0,J.jsx)(pt,{children:ae()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,$M as i,AB as a,BB as o,Bd as s,CN as c,DB as l,EN as u,FB as d,GM as f,Hd as p,IB as m,JB as h,JM as g,KB as _,KM as v,LB as y,MB as b,NB as x,OB as S,PB as C,QB as ee,QM as te,RB as ne,SN as re,TN as ie,UM as ae,VB as oe,Vd as se,WM as ce,XB as le,XM as ue,YB as de,YM as fe,ZB as pe,ZM as me,_N as he,aN as ge,aV as w,bN as _e,bQ as T,cN as ve,cV as E,dN as ye,dV as D,eN as be,eV as O,fN as xe,fV as k,gN as Se,gV as A,hN as Ce,hV as j,iN as we,iV as M,jB as Te,k as Ee,kB as De,lN as Oe,lV as ke,mN as Ae,mV as je,nN as Me,nV as Ne,oN as Pe,oV as Fe,pN as Ie,pV as Le,qB as Re,qM as ze,rN as Be,rV as N,sN as Ve,sV as He,t as P,tN as Ue,tV as We,uN as Ge,uV as Ke,vN as qe,wN as Je,xN as Ye,yN as Xe,yQ as F,zB as Ze}from"./api-D64JTta1.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as et}from"./check-pVsND9oZ.js";import{t as tt}from"./copy-4wREwP-V.js";import{n as nt,t as rt}from"./eye-BU60QIdS.js";import{o as it,r as at}from"./deliveryRecorder-owdOglrQ.js";import{t as ot}from"./x-BNU-sWkh.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-wXM6h61N.js";import{i as V,n as H,r as st,t as ct}from"./tabs-CfQK0-wk.js";import{t as U}from"./button-DeHzYOzP.js";import"./convexApi-DxRiI80M.js";import{t as W}from"./badge-DwWXPxwl.js";import{a as lt,n as G}from"./format-g5Z3Txjl.js";import{a as ut,n as dt,o as ft,r as pt,t as mt}from"./dialog-awuZdW9M.js";import{c as ht,o as gt,s as _t,u as vt}from"./searchSchemas-Dm-Qg010.js";import{t as yt}from"./appHost-CH3EGcJw.js";import{n as bt}from"./TimeRangePicker-jsNw51TL.js";import{t as K}from"./FilterBar-DtNuk6dI.js";import{t as xt}from"./AdvancedFilter-DYTsdqhC.js";import{t as St}from"./DataTableShell-1ZsZ0a2J.js";var Ct=Ee(`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`?pe():n===`agent`?`${le()} - ${r}`:e}function Tt(){let e=T(P.me.getMe,{host:yt})?.role===`admin`,t=T(P.deliveryTiming.getDeliveryStatus,{}),n=F(P.deliveryTiming.startDeliveryRecord),r=F(P.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!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 flex-wrap items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:A()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:j()})]}),e?(0,J.jsx)(U,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?Le():je()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(W,{variant:`secondary`,children:k()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:D({time:lt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?E():ke()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=T(P.deliveryTiming.listDeliverySessions,{}),n=F(P.deliveryTiming.deleteDeliverySessions),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=bt(c),m=c.to===`now`?1/0:p,g=i.trim()!==``||o!==`all`||c!==Y,_=()=>{a(``),s(`all`),l(Y)},v=(0,q.useMemo)(()=>{if(t===void 0)return;let e=i.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,i,o,f,m]),y=e=>{let t=new Set((v??[]).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)(K,{q:i,onQChange:a,searchPlaceholder:Fe(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:g,children:(0,J.jsxs)(B,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:`all`,children:w()}),(0,J.jsx)(z,{value:`active`,children:M()}),(0,J.jsx)(z,{value:`stopped`,children:N()})]})]})}),(0,J.jsx)(St,{title:He(),rows:v,emptyHint:S(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(U,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?h():de(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(nt,{size:15,"aria-hidden":!0}):(0,J.jsx)(rt,{size:15,"aria-hidden":!0})})},{header:Ne(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:We(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:O(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:r(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:ee(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(W,{variant:`secondary`,children:M()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:N()})}],rowActions:e?e=>[{label:Re(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:Re(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=T(P.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(at(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:_()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()});let r=e.segments,i=(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,` `,l()]}),(0,J.jsxs)(U,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(et,{size:13,"aria-hidden":!0}):(0,J.jsx)(tt,{size:13,"aria-hidden":!0}),t?De():a()]})]}),(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:Ze()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ne()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:y()})]})}),(0,J.jsxs)(`tbody`,{children:[i(m(),r.bridge),i(d(),r.A),i(C(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]})}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:p()},{value:`principalType`,label:se()},{value:`direction`,label:`direction`},{value:`roleKey`,label:s()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=Qe({from:`/settings/traces`}),t=$e({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,d=e.roleKey??Q,f=e.q??``,p=e.correlationId,m=gt(e.from,e.to),h=(0,q.useMemo)(()=>vt(e.adv),[e.adv]),{from:_,to:y}=bt(m),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),ee=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),ae=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),se=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,...ht(e)})}),w=e=>void t({search:t=>({...t,adv:_t(e)}),replace:!0}),E=T(P.observability.listEvents,{limit:n}),D=T(P.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...p?{correlationId:p}:{},filter:{q:f||void 0,from:_,to:y,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:d===Q?void 0:d,advanced:h.length>0?h:void 0}}),O=(0,q.useMemo)(()=>{let e=new Set;for(let t of E??[])e.add(t.kind);return[...e].sort()},[E]),k=(0,q.useMemo)(()=>{let e=new Set;for(let t of E??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[E]),A=f!==``||a!==Q||s!==Q||l!==Q||d!==Q||h.length>0||m.kind!==`relative`||m.from!==Nt.from;function j(){t({search:{limit:100,kind:`all`},replace:!0})}let M=b?E?.filter(e=>e.correlationId===b):D,Te=e.section,Ee=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(ct,{value:Te,onValueChange:e=>Ee(e),children:[(0,J.jsxs)(st,{className:`w-full`,children:[(0,J.jsxs)(V,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(it,{size:13,"aria-hidden":!0}),oe()]}),(0,J.jsxs)(V,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),o()]})]}),(0,J.jsx)(H,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(H,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),(0,J.jsx)(`strong`,{children:ie()}),Je(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,J.jsxs)(K,{q:f,onQChange:ae,searchPlaceholder:re(),timeRange:m,onTimeRangeChange:pe,onReset:j,canReset:A,children:[(0,J.jsxs)(B,{value:a,onValueChange:se,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:Ye()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:_e()}),At.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:s,onValueChange:ce,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:Xe()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:qe()}),jt.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:l,onValueChange:le,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:he()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:Se()}),Mt.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:d,onValueChange:de,children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:Ce()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:Ae()}),k.map(e=>(0,J.jsx)(z,{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:Ie(),"aria-label":Ie(),onChange:e=>{let t=e.target.value.trim();ne(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:O.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(B,{value:String(n),onValueChange:e=>ee(Number(e)),children:[(0,J.jsx)(L,{size:`sm`,className:`w-28`,children:(0,J.jsx)(I,{})}),(0,J.jsx)(R,{children:kt.map(e=>(0,J.jsx)(z,{value:String(e),children:xe({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:h,onChange:w}),b?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>x(null),title:ye(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Ge(),(0,J.jsx)(`code`,{children:$(b)})]}),(0,J.jsx)(ot,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:Oe()})]})}):null,(0,J.jsx)(St,{title:ve(),rows:M,emptyHint:b?Ve():Pe(),columns:[{header:ge(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:we(),sort:e=>e.kind,cell:e=>(0,J.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Be(),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":Me(),children:`✓`})}},{header:Ue(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(W,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:be(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:i(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:te(),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:me(),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:ue(),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:fe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:g(),onClick:()=>x(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ze(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:v()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:S,onClose:()=>C(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)(mt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(dt,{className:`max-w-lg`,children:[(0,J.jsxs)(ut,{children:[(0,J.jsxs)(ft,{className:`oc-traces__meta-title`,children:[f(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(W,{variant:`outline`,children:ce()})]}),(0,J.jsx)(pt,{children:ae()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|