@xopcai/xopc 0.0.57 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +6 -0
  2. package/README.zh-CN.md +6 -0
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agents-DEL6G6-C.js → agents-BgeuYTaG.js} +2 -2
  5. package/dist/gateway/static/root/assets/{agents-DEL6G6-C.js.map → agents-BgeuYTaG.js.map} +1 -1
  6. package/dist/gateway/static/root/assets/{apps-page-DXlDJBf0.js → apps-page-DXOoxQ3t.js} +2 -2
  7. package/dist/gateway/static/root/assets/{apps-page-DXlDJBf0.js.map → apps-page-DXOoxQ3t.js.map} +1 -1
  8. package/dist/gateway/static/root/assets/{channels-settings-IWwRmmCH.js → channels-settings-BtblELP8.js} +2 -2
  9. package/dist/gateway/static/root/assets/{channels-settings-IWwRmmCH.js.map → channels-settings-BtblELP8.js.map} +1 -1
  10. package/dist/gateway/static/root/assets/{cron-dreaming-jobs-DIwTeQzu.js → cron-dreaming-jobs-D5kvbjSY.js} +2 -2
  11. package/dist/gateway/static/root/assets/{cron-dreaming-jobs-DIwTeQzu.js.map → cron-dreaming-jobs-D5kvbjSY.js.map} +1 -1
  12. package/dist/gateway/static/root/assets/{cron-page-CcRCqnzx.js → cron-page-4hk422N-.js} +2 -2
  13. package/dist/gateway/static/root/assets/{cron-page-CcRCqnzx.js.map → cron-page-4hk422N-.js.map} +1 -1
  14. package/dist/gateway/static/root/assets/{dist-CgucsbDd.js → dist-CEmPWsYK.js} +2 -2
  15. package/dist/gateway/static/root/assets/{dist-CgucsbDd.js.map → dist-CEmPWsYK.js.map} +1 -1
  16. package/dist/gateway/static/root/assets/{extension-debug-page-BX1pf7rr.js → extension-debug-page-z0vfOyIu.js} +2 -2
  17. package/dist/gateway/static/root/assets/{extension-debug-page-BX1pf7rr.js.map → extension-debug-page-z0vfOyIu.js.map} +1 -1
  18. package/dist/gateway/static/root/assets/{extension-page-DPm5vzVN.js → extension-page-CFaT0yHk.js} +2 -2
  19. package/dist/gateway/static/root/assets/{extension-page-DPm5vzVN.js.map → extension-page-CFaT0yHk.js.map} +1 -1
  20. package/dist/gateway/static/root/assets/{extension-settings-page-DAly-C6g.js → extension-settings-page-7atlEJU0.js} +2 -2
  21. package/dist/gateway/static/root/assets/{extension-settings-page-DAly-C6g.js.map → extension-settings-page-7atlEJU0.js.map} +1 -1
  22. package/dist/gateway/static/root/assets/{heartbeat-config-api-SijGy10-.js → heartbeat-config-api-DnmmSrTx.js} +2 -2
  23. package/dist/gateway/static/root/assets/{heartbeat-config-api-SijGy10-.js.map → heartbeat-config-api-DnmmSrTx.js.map} +1 -1
  24. package/dist/gateway/static/root/assets/{index-DHte7V8E.js → index-DvMI6Vqn.js} +4 -4
  25. package/dist/gateway/static/root/assets/{index-DHte7V8E.js.map → index-DvMI6Vqn.js.map} +1 -1
  26. package/dist/gateway/static/root/assets/{logs-page-DEnawdQ8.js → logs-page-XKXcjB3g.js} +2 -2
  27. package/dist/gateway/static/root/assets/{logs-page-DEnawdQ8.js.map → logs-page-XKXcjB3g.js.map} +1 -1
  28. package/dist/gateway/static/root/assets/{sessions-page-CGn5wKzh.js → sessions-page-1DyACBG7.js} +2 -2
  29. package/dist/gateway/static/root/assets/{sessions-page-CGn5wKzh.js.map → sessions-page-1DyACBG7.js.map} +1 -1
  30. package/dist/gateway/static/root/assets/{settings-page-BV20X-TN.js → settings-page-TrmEN1eQ.js} +2 -2
  31. package/dist/gateway/static/root/assets/{settings-page-BV20X-TN.js.map → settings-page-TrmEN1eQ.js.map} +1 -1
  32. package/dist/gateway/static/root/assets/{skills-page-C1Ns0BHu.js → skills-page-Dcvjtm-1.js} +2 -2
  33. package/dist/gateway/static/root/assets/{skills-page-C1Ns0BHu.js.map → skills-page-Dcvjtm-1.js.map} +1 -1
  34. package/dist/gateway/static/root/assets/{use-image-provider-credentials-BZqTDErY.js → use-image-provider-credentials-D6TXcMU2.js} +2 -2
  35. package/dist/gateway/static/root/assets/{use-image-provider-credentials-BZqTDErY.js.map → use-image-provider-credentials-D6TXcMU2.js.map} +1 -1
  36. package/dist/gateway/static/root/index.html +1 -1
  37. package/dist/package.js +1 -1
  38. package/dist/src/agent/embedded/run-turn.js +6 -0
  39. package/dist/src/agent/embedded/run-turn.js.map +1 -1
  40. package/dist/src/agent/embedded/xopc-auth-storage.d.ts +20 -0
  41. package/dist/src/agent/embedded/xopc-auth-storage.js +38 -0
  42. package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -0
  43. package/dist/src/agent/embedded/xopc-stream-bridge.d.ts +11 -0
  44. package/dist/src/agent/embedded/xopc-stream-bridge.js +24 -0
  45. package/dist/src/agent/embedded/xopc-stream-bridge.js.map +1 -0
  46. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{i as t,t as n}from"./vendor-react-DbimaAId.js";import{Ar as r,Br as i,Cn as a,Dn as o,Dt as s,Ei as c,En as l,Et as u,In as d,Ln as f,Mn as p,Mt as m,Nt as h,Oi as ee,Ot as g,Pr as _,Pt as v,Q as y,Qn as te,Sn as b,T as x,X as S,Xr as ne,Z as C,_n as re,a as ie,bt as ae,ei as oe,hr as se,i as ce,jn as le,jt as ue,kn as w,kt as de,mi as fe,oi as T,pr as pe,qr as me,r as he,vn as ge,xt as _e,zn as ve}from"./index-DHte7V8E.js";import{C as E,S as ye,T as be,_ as xe,a as Se,b as Ce,c as we,d as D,f as Te,g as Ee,h as De,i as Oe,l as ke,m as Ae,n as je,o as Me,p as Ne,s as Pe,t as Fe,u as Ie,v as O,w as k,x as Le,y as Re}from"./cron-dreaming-jobs-DIwTeQzu.js";import{a as ze,i as A,n as j,r as M,t as Be}from"./dist-CgucsbDd.js";import{s as Ve,t as He}from"./heartbeat-config-api-SijGy10-.js";var N=e(t(),1),P=n();function Ue({open:e,onOpenChange:t,action:n,c:r,onDismiss:i,onConfirm:a}){return(0,P.jsx)(h,{open:e,onOpenChange:t,children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,P.jsxs)(de,{className:`xopc-dialog-content-pane pointer-events-auto relative w-full max-w-md rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[(0,P.jsx)(v,{className:`text-base font-semibold text-fg`,children:n===`delete`?r.delete:r.runNow}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n===`delete`?r.confirmDelete:r.confirmRun}),(0,P.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,onClick:i,children:r.cancel}),(0,P.jsx)(p,{type:`button`,variant:`primary`,className:n===`delete`?`bg-red-600 hover:bg-red-700`:void 0,onClick:()=>void a(),children:n===`delete`?r.delete:r.runNow})]})]})})]})})}var We=`*/5 * * * *`,Ge=`xopc.recentWorkspaceDirs.v1`;function Ke(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function qe(e){let t=Ke(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function Je(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function F(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function Ye(e){let t=e.trim();if(t)try{let e=localStorage.getItem(Ge),n=e?JSON.parse(e):[],r=[t,...(Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.trim().length>0):[]).filter(e=>e!==t)].slice(0,10);localStorage.setItem(Ge,JSON.stringify(r))}catch{}}function I(e){return f(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,l,e&&`cursor-not-allowed opacity-60`)}function L(){return f(w,o)}var R=f(w,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),z=f(w,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function Xe({open:e,onDismiss:t,detailJob:n,detailLoading:i,detailHistory:a,c:o,chatWorkingDirNotSet:s,statusLabels:c}){return(0,P.jsx)(h,{open:e,onOpenChange:e=>{e||t()},children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,P.jsxs)(de,{className:f(`xopc-drawer-right fixed right-0 top-0 z-[60] flex h-full w-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,`dark:border-edge`),"aria-describedby":void 0,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,P.jsx)(v,{className:`min-w-0 truncate text-base font-semibold text-fg`,children:n?.name?.trim()||n?.id||`—`}),(0,P.jsx)(g,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":o.close,children:(0,P.jsx)(ve,{className:`size-5`,strokeWidth:1.75})})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:i?(0,P.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):n?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.scheduleLabel}),(0,P.jsx)(`dd`,{className:`mt-1 font-mono text-fg`,children:(0,P.jsx)(`code`,{children:n.schedule})})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.messageLabel}),(0,P.jsx)(`dd`,{className:`mt-1 min-w-0 break-words text-fg`,children:(0,P.jsx)(C,{content:Se(n),compact:!0,className:`text-sm`})})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.mode}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.sessionTarget===`isolated`?o.modeAgentOption:o.modeDirectOption})]}),n.sessionTarget===`isolated`?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.agentProfile}),(0,P.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.agentId?.trim()?n.agentId.trim():o.agentProfileDefault})]}):null,n.sessionTarget===`isolated`?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.workingDirectoryLabel}),(0,P.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:n.workingDirectory?.trim()?n.workingDirectory.trim():s})]}):null,n.delivery?.channel===`local`||n.sessionTarget===`isolated`&&!n.delivery?.to?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.deliveryTarget}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.delivery?.channel===`local`?o.deliveryTargetLocalChannel:o.deliveryLocalOnly})]}):n.delivery?.to?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.deliveryTarget}),(0,P.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,P.jsx)(`code`,{className:`text-xs`,children:n.delivery?.channel??``}),` → `,Re(n,o.channelLocal)]})]}):null,(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.status}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.enabled?o.enabled:o.disabled})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.nextRun}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.next_run?Le(n.next_run,o.timeLabels):`—`})]})]}),(0,P.jsx)(`h3`,{className:`mt-6 text-sm font-semibold text-fg`,children:o.detailRunHistory}),a.length===0?(0,P.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:o.noRunsYet}):(0,P.jsx)(`div`,{className:`mt-2 overflow-x-auto`,children:(0,P.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.colStarted}),(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.status}),(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.colDuration}),(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.colDetail}),(0,P.jsx)(`th`,{className:`py-1.5 font-medium`,children:o.colChat})]})}),(0,P.jsx)(`tbody`,{children:a.map(e=>(0,P.jsxs)(`tr`,{className:`border-b border-edge/60`,children:[(0,P.jsx)(`td`,{className:`whitespace-nowrap py-1.5 pr-2 text-fg`,children:(0,P.jsx)(`time`,{dateTime:e.startedAt,children:k(e.startedAt)})}),(0,P.jsx)(`td`,{className:`py-1.5 pr-2`,children:(0,P.jsx)(`span`,{className:f(`inline-flex rounded px-1.5 py-0.5 font-medium`,e.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,e.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`),children:O(e.status,c)})}),(0,P.jsx)(`td`,{className:`py-1.5 pr-2 text-fg-muted`,children:Ce(e.duration)}),(0,P.jsx)(`td`,{className:`max-w-[8rem] truncate py-1.5 pr-2 text-fg-muted`,title:e.summary||e.error||``,children:be(e.summary||e.error,120)}),(0,P.jsx)(`td`,{className:`whitespace-nowrap py-1.5`,children:e.sessionKey?.trim()?(0,P.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:o.openChatTitle,"aria-label":o.openChatTitle,onClick:()=>F(e.sessionKey),children:o.openChat}):(0,P.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]}):null})]})]})})}function Ze(e){let{open:t,onRequestClose:n,c:r,chatM:i,agentsMessages:a,isDark:o,channels:s,sessionChatIds:c,cronAgentSelectOptions:l,hasElectronFolderPicker:u,openNativeFolderPicker:d,applyWorkingDirectory:ee,wdModalOpen:_,onWdModalOpenChange:b,defaultModelResolver:re,formMode:ae,formJobId:oe,formName:se,onFormNameChange:le,formSchedule:w,onFormScheduleChange:fe,formSubmitting:T,formSessionTarget:ge,onFormSessionTargetChange:_e,formAgentLocalOnly:E,onFormAgentLocalOnlyChange:be,formModel:xe,onFormModelUserChange:Se,formAgentId:Ce,onFormAgentIdChange:we,formWorkingDirectory:D,onFormWorkingDirectoryChange:Te,formChannel:Ee,onFormChannelChange:De,formChatId:Oe,onFormChatIdChange:ke,formMessage:Ae,onFormMessageChange:je,formMessageMdMode:Me,onSetMessageMdMode:Ne,messageEditorNonce:Pe,needsDeliveryChat:Fe,showChannelPicker:Ie,canSubmit:O,onSubmit:k,onRefreshRecipients:Le}=e;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(h,{open:t,onOpenChange:e=>!e&&n(),children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,P.jsxs)(de,{className:`xopc-dialog-content-pane pointer-events-auto relative flex max-h-[min(90vh,800px)] w-full max-w-md flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none sm:max-w-lg lg:max-w-xl dark:border-edge`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,P.jsx)(v,{className:`text-base font-semibold text-fg`,children:ae===`edit`?r.editJob:r.addJob}),(0,P.jsx)(g,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":r.close,children:(0,P.jsx)(ve,{className:`size-5`,strokeWidth:1.75})})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.name}),(0,P.jsx)(`input`,{type:`text`,className:I(),value:se,onChange:e=>le(e.target.value),placeholder:r.namePlaceholder})]}),(0,P.jsx)(Ve,{value:w,onChange:fe,disabled:T,labels:r.schedulePicker}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.mode}),(0,P.jsxs)(`select`,{className:L(),value:ge,onChange:e=>{let t=e.target.value;_e(t,re,xe.trim())},children:[(0,P.jsx)(`option`,{value:`main`,children:r.modeDirectOption}),(0,P.jsx)(`option`,{value:`isolated`,children:r.modeAgentOption})]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:ge===`main`?r.modeDirect:r.modeAgent})]}),ge===`isolated`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.model}),(0,P.jsx)(ie,{value:xe,placeholder:i.modelPlaceholder,searchPlaceholder:i.modelSearchPlaceholder,noMatches:i.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:Se})]}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.agentProfile}),(0,P.jsxs)(`select`,{className:L(),value:Ce,disabled:T,onChange:e=>we(e.target.value),children:[(0,P.jsx)(`option`,{value:``,children:r.agentProfileDefault}),l.map(e=>(0,P.jsx)(`option`,{value:e.id,children:`${e.id} — ${x(e,a)}`},e.id))]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.agentProfileHint})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.workingDirectoryLabel}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsxs)(`button`,{type:`button`,disabled:T,className:f(`inline-flex min-h-8 max-w-[min(16rem,48vw)] min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,S.transition,S.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T&&`cursor-not-allowed opacity-60`),title:D.trim()?`${D.trim()}\n${i.workingDirectory.chooseFolder}`:`${r.workingDirectoryHint}\n${i.workingDirectory.selectWorkingDirectory}`,onClick:e=>{e.stopPropagation(),!T&&(u?(async()=>{let e=await d();e&&ee(e)})():b(!0))},children:[(0,P.jsx)(me,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:D.trim()?he(D.trim()):i.workingDirectory.notSet})]}),D.trim()?(0,P.jsx)(`button`,{type:`button`,disabled:T,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:()=>Te(``),children:r.workingDirectoryReset}):null]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.workingDirectoryHint})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-hover/45 px-3 py-2 dark:bg-surface-hover/30`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:f(`ui-checkbox`,`mt-0.5`),checked:E,onChange:e=>be(e.target.checked)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.agentLocalOnly}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.agentLocalOnlyHint})]})]})]}):null,Ie?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.channel}),(0,P.jsxs)(`select`,{className:L(),value:Ee,onChange:e=>{let t=e.target.value;De(t)},children:[(0,P.jsx)(`option`,{value:`local`,children:r.channelLocal}),s.map(e=>(0,P.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name))]})]}),Fe?(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.recipient}),(0,P.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:r.refreshRecipientHint,onClick:()=>void Le(),children:[(0,P.jsx)(pe,{className:`size-3.5`,strokeWidth:1.75}),r.refreshList]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,P.jsx)(`input`,{type:`text`,className:f(I(),`min-w-0 w-full sm:flex-1`),value:Oe,onChange:e=>ke(e.target.value),placeholder:r.recipientPlaceholder}),(0,P.jsxs)(`select`,{className:R,value:Oe,onChange:e=>{let t=e.target.value;t&&ke(t)},children:[(0,P.jsx)(`option`,{value:``,children:r.selectRecipient}),c.length>0?c.map(e=>(0,P.jsx)(`option`,{value:e.chatId,children:ye(e,r.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,P.jsx)(`option`,{value:``,disabled:!0,children:r.noRecentChatsOption})]})]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.length>0?r.enterManuallyOrSelect:r.noRecentChats})]}):null]}):null,(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.message}),(0,P.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[(0,P.jsxs)(`button`,{type:`button`,className:f(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Me===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>Ne(`edit`),children:[(0,P.jsx)(te,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),r.messageEdit]}),(0,P.jsxs)(`button`,{type:`button`,className:f(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Me===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>Ne(`preview`),children:[(0,P.jsx)(ne,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),r.messagePreview]})]})]}),(0,P.jsx)(`div`,{className:f(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,T&&`pointer-events-none opacity-60`),children:Me===`edit`?(0,P.jsx)(y,{initialContent:Ae,onChange:je,isDark:o,className:`h-[min(18rem,40vh)] min-h-[12rem]`},`cron-msg-${oe??`new`}-${Pe}`):(0,P.jsx)(`div`,{className:`h-[min(18rem,40vh)] min-h-[12rem] max-h-[min(24rem,50vh)] overflow-y-auto px-3 py-2`,children:Ae.trim()?(0,P.jsx)(C,{content:Ae,compact:!0,className:`text-sm`}):(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.messagePlaceholder})})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.messageMarkdownHint})]})]})}),(0,P.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,onClick:n,children:r.cancel}),(0,P.jsx)(p,{type:`button`,variant:`primary`,disabled:T||!O,onClick:k,children:T?r.loading:ae===`edit`?r.save:r.create})]})]})})]})}),u?null:(0,P.jsx)(ce,{open:_,onOpenChange:b,initialAbsolutePath:D.trim()||void 0,onConfirm:async e=>{await ee(e),b(!1)},wd:i.workingDirectory})]})}function Qe({c:e,mainTab:t,onMainTabChange:n,jobSort:r,onJobSortChange:i,historyRange:a,onHistoryRangeChange:o,historyJobFilter:c,onHistoryJobFilterChange:l,historyStatusFilter:d,onHistoryStatusFilterChange:p,jobs:m}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,P.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":e.title,children:[(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`myTasks`,className:f(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,t===`myTasks`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>n(`myTasks`),children:e.tabMyTasks}),(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`systemTasks`,className:f(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,t===`systemTasks`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>n(`systemTasks`),children:e.tabSystemTasks}),(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`history`,className:f(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,t===`history`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>n(`history`),children:e.tabRunHistory})]}),(0,P.jsxs)(`div`,{className:f(`flex min-w-0 items-center gap-2`,t===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`),children:[t===`myTasks`||t===`systemTasks`?(0,P.jsxs)(`select`,{className:z,value:r,onChange:e=>i(e.target.value),"aria-label":e.sortCreatedDesc,children:[(0,P.jsx)(`option`,{value:`created_desc`,children:e.sortCreatedDesc}),(0,P.jsx)(`option`,{value:`created_asc`,children:e.sortCreatedAsc})]}):null,t===`history`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:f(s,`shrink-0`),role:`group`,"aria-label":e.runHistoryTitle,children:[`day`,`week`,`month`].map(t=>(0,P.jsx)(`button`,{type:`button`,className:f(u,`px-2.5 py-1`,a===t&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,a===t&&`text-fg`),onClick:()=>o(t),children:t===`day`?e.historyRangeDay:t===`week`?e.historyRangeWeek:e.historyRangeMonth},t))}),(0,P.jsxs)(`select`,{className:z,value:c,onChange:e=>l(e.target.value),"aria-label":e.filterAllTasks,children:[(0,P.jsx)(`option`,{value:``,children:e.filterAllTasks}),m.map(e=>(0,P.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))]}),(0,P.jsxs)(`select`,{className:z,value:d,onChange:e=>p(e.target.value),"aria-label":e.filterAllStatuses,children:[(0,P.jsx)(`option`,{value:``,children:e.filterAllStatuses}),(0,P.jsx)(`option`,{value:`success`,children:e.execStatusSuccess}),(0,P.jsx)(`option`,{value:`failed`,children:e.execStatusFailed}),(0,P.jsx)(`option`,{value:`cancelled`,children:e.execStatusCancelled}),(0,P.jsx)(`option`,{value:`running`,children:e.execStatusRunning})]})]}):null]})]})}function $e({c:e,loading:t,runHistoryLoading:n,onRefresh:r,onOpenTemplatePicker:i,onAddJob:a}){let o=t||n;return(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:o,title:e.refresh,"aria-label":e.refresh,onClick:()=>void r(),children:(0,P.jsx)(pe,{className:f(`size-4`,o&&`animate-spin`),strokeWidth:1.75})}),(0,P.jsxs)(p,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:i,children:[(0,P.jsx)(_,{className:`size-4`,strokeWidth:1.75}),e.fromTemplate]}),(0,P.jsxs)(p,{type:`button`,variant:`primary`,className:`gap-2`,onClick:a,children:[(0,P.jsx)(se,{className:`size-4`,strokeWidth:1.75}),e.addJob]})]})}function et({c:e,runHistoryLoading:t,runHistory:n,filteredRunHistory:i,jobs:a,onRefreshHistory:o,onOpenJobDetail:s,statusLabels:c}){return(0,P.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:e.tabRunHistory}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.runHistoryHint})]}),(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:t,title:e.refresh,"aria-label":e.refresh,onClick:()=>void o(),children:(0,P.jsx)(pe,{className:f(`size-4`,t&&`animate-spin`),strokeWidth:1.75})})]}),t&&n.length===0?(0,P.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):i.length===0?(0,P.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-edge-subtle px-6 py-16 text-center dark:border-edge-subtle`,children:[(0,P.jsx)(T,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,P.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n.length===0?e.emptyHistoryTitle:e.noRunsYet}),(0,P.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:n.length===0?e.emptyHistoryHint:e.runHistoryHint})]}):(0,P.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,P.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colStarted}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colJob}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.status}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colDuration}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colDetail}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colChat})]})}),(0,P.jsx)(`tbody`,{children:i.map(t=>(0,P.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,P.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,P.jsx)(`time`,{dateTime:t.startedAt,children:k(t.startedAt)})}),(0,P.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:a.some(e=>e.id===t.jobId)?(0,P.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let e=a.find(e=>e.id===t.jobId);e&&s(e)},children:t.jobName||t.jobId}):(0,P.jsx)(`span`,{className:`text-fg-muted`,children:t.jobName||t.jobId})}),(0,P.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,P.jsx)(`span`,{className:f(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,t.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,t.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`,t.status===`running`&&`bg-accent/15 text-accent`,t.status===`cancelled`&&`bg-surface-hover text-fg-muted`),children:O(t.status,c)})}),(0,P.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:Ce(t.duration)}),(0,P.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:t.summary||t.error||``,children:be(t.summary||t.error,96)}),(0,P.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:t.sessionKey?.trim()?(0,P.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:e.openChatTitle,"aria-label":e.openChatTitle,onClick:()=>F(t.sessionKey),children:e.openChat}):(0,P.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},t.id))})]})})]})}function B({job:e,c:t,localeTag:n,scheduleBadgeLabels:r,absorbCardClickJobIdRef:i,scheduleAbsorbNextMenuCardClick:a,onOpenDetail:o,onToggle:s,onEdit:c,onRunNow:l,onDelete:u}){return(0,P.jsxs)(`article`,{role:`button`,tabIndex:0,className:f(`flex cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-base text-left transition-colors duration-150 ease-out dark:border-edge-subtle`,`hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:()=>{if(i.current===e.id){i.current=null;return}o(e)},onKeyDown:t=>{if(t.key===`Enter`||t.key===` `){if(t.preventDefault(),i.current===e.id){i.current=null;return}o(e)}},children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,className:f(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,e.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`),onClick:t=>{t.stopPropagation(),s(e,!e.enabled)},children:(0,P.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}),(0,P.jsxs)(A,{children:[(0,P.jsx)(ze,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 w-8 shrink-0 p-0`,"aria-label":t.jobCardMenuAria,onClick:e=>e.stopPropagation(),children:(0,P.jsx)(oe,{className:`size-4`,strokeWidth:1.75})})}),(0,P.jsx)(M,{children:(0,P.jsxs)(Be,{className:`z-50 min-w-[10rem] rounded-xl border border-edge-subtle bg-surface-panel p-1 shadow-elevated dark:border-edge-subtle`,sideOffset:4,align:`end`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(j,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{a(e.id),c(e)},children:t.edit}),(0,P.jsx)(j,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{a(e.id),l(e)},children:t.runNow}),(0,P.jsx)(j,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-red-600 outline-none data-highlighted:bg-red-500/10 dark:text-red-400`,onSelect:()=>{a(e.id),u(e)},children:t.delete})]})})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[(0,P.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:e.name||e.id}),(0,P.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:Se(e),children:(0,P.jsx)(C,{content:Se(e),compact:!0})})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 border-t border-edge-subtle/90 px-4 py-2.5 text-xs text-fg-muted dark:border-edge-subtle`,children:[(0,P.jsx)(T,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:E(e,n,r)})]})]})}function tt({c:e,language:t,localeTag:n,scheduleBadgeLabels:a,loading:o,sortedSystemJobs:s,heartbeat:l,keepAwake:u,wakeSupported:d,onWakeUnsupportedClick:m,onKeepAwakeToggle:h,absorbCardClickJobIdRef:ee,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:te,onDelete:b}){let x=je(l.intervalMs,n,le(t).heartbeatSettings.intervalPresets);return(0,P.jsxs)(`section`,{"aria-labelledby":`cron-system-tasks-panel`,className:`flex flex-col gap-4`,children:[(0,P.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:e.tabSystemTasks}),(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.systemTasksIntro}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[(0,P.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),(0,P.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:e.wakeBanner})]}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[(0,P.jsx)(`span`,{className:`text-sm text-fg`,children:e.keepAwake}),(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":u,disabled:!d,title:d?void 0:e.wakeLockUnavailable,className:f(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,u?`justify-end bg-accent`:`justify-start bg-surface-hover`,!d&&`cursor-not-allowed opacity-50`),onClick:()=>{d?h():m()},children:(0,P.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-4 dark:bg-surface-hover/20`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.systemHeartbeatTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.systemHeartbeatHint})]}),(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,P.jsxs)(c,{to:`/settings/heartbeat`,children:[e.systemHeartbeatSettingsLink,(0,P.jsx)(fe,{className:`size-3.5 opacity-70`,"aria-hidden":!0})]})})]}),(0,P.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:e.systemHeartbeatStatus}),(0,P.jsx)(`dd`,{className:`text-fg`,children:l.enabled?e.enabled:e.disabled})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:e.systemHeartbeatInterval}),(0,P.jsx)(`dd`,{className:`text-fg`,children:e.systemHeartbeatEvery.replace(/\{\{value\}\}/g,x)})]})]})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`mb-2 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.systemDreamingTitle}),(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,P.jsxs)(c,{to:`/settings/dreams`,children:[e.systemDreamingSettingsLink,(0,P.jsx)(fe,{className:`size-3.5 opacity-70`,"aria-hidden":!0})]})})]}),(0,P.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:e.systemDreamingHint}),o&&s.length===0?(0,P.jsx)(`div`,{className:`flex justify-center py-12`,"aria-busy":`true`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):s.length===0?(0,P.jsx)(`p`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/30 px-3 py-4 text-sm text-fg-muted dark:border-edge-subtle`,children:e.systemDreamingEmpty}):(0,P.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:s.map(t=>(0,P.jsx)(B,{job:t,c:e,localeTag:n,scheduleBadgeLabels:a,absorbCardClickJobIdRef:ee,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:te,onDelete:b},t.id))})]})]})}function nt(e,t){let n=e.templates;if(!n||typeof n!=`object`)return;let r=n[t];if(!r||typeof r!=`object`)return;let i=r.title?.trim(),a=r.prompt?.trim();if(!(!i||!a))return{title:i,description:(r.description??``).trim(),prompt:a}}var rt=[`daily`,`monitoring`,`reports`,`automation`],V=[{templateId:`morning_briefing`,category:`daily`,defaultSchedule:`0 7 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`standup_prep`,category:`daily`,defaultSchedule:`0 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`end_of_day_wrap_up`,category:`daily`,defaultSchedule:`0 18 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`inbox_triage`,category:`daily`,defaultSchedule:`30 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`competitor_watch`,category:`monitoring`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`trending_topics_monitor`,category:`monitoring`,defaultSchedule:`0 10 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`tech_radar_stack`,category:`monitoring`,defaultSchedule:`0 11 * * 3`,defaultSessionTarget:`isolated`},{templateId:`dependency_check_audit`,category:`monitoring`,defaultSchedule:`0 9 * * 0`,defaultSessionTarget:`isolated`},{templateId:`weekly_review`,category:`reports`,defaultSchedule:`0 17 * * 5`,defaultSessionTarget:`isolated`},{templateId:`code_quality_report`,category:`reports`,defaultSchedule:`0 14 * * 1`,defaultSessionTarget:`isolated`},{templateId:`git_activity_summary`,category:`reports`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`user_feedback_digest`,category:`reports`,defaultSchedule:`0 16 * * 5`,defaultSessionTarget:`isolated`},{templateId:`stale_todo_or_issue_sweep`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`},{templateId:`release_notes_or_changelog_draft`,category:`automation`,defaultSchedule:`0 10 * * 4`,defaultSessionTarget:`isolated`},{templateId:`workspace_cleanup_suggestions`,category:`automation`,defaultSchedule:`30 18 * * 5`,defaultSessionTarget:`isolated`},{templateId:`smoke_or_ci_health_reminder`,category:`automation`,defaultSchedule:`0 8 * * 1`,defaultSessionTarget:`isolated`}];function it(e){return V.find(t=>t.templateId===e)}function H(e){let{cron:t,localeTag:n,scheduleBadgeLabels:r,categoryFilter:i,onCategoryFilterChange:a,onSelectTemplate:o}=e,s=i===`all`?[...V]:V.filter(e=>e.category===i);return(0,P.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.fromTemplate,children:[(0,P.jsx)(p,{type:`button`,variant:i===`all`?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>a(`all`),children:t.templateFilterAll}),rt.map(e=>(0,P.jsx)(p,{type:`button`,variant:i===e?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>a(e),children:t.templateCategories[e]},e))]}),s.length===0?(0,P.jsx)(`p`,{className:`text-center text-sm text-fg-muted`,children:t.templatesEmptyHint}):(0,P.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:s.map(e=>{let i=nt(t,e.templateId);if(!i)return null;let a=E({schedule:e.defaultSchedule,timezone:void 0,next_run:void 0},n,r);return(0,P.jsxs)(`button`,{type:`button`,className:f(`flex flex-col gap-1.5 rounded-xl border border-edge-subtle bg-surface-base p-4 text-left transition-colors`,`hover:border-accent/40 hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:()=>o(e.templateId),"aria-label":`${t.templateCategories[e.category]} — ${i.title}`,children:[(0,P.jsx)(`span`,{className:`font-semibold text-fg`,children:i.title}),(0,P.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:i.description}),(0,P.jsx)(`span`,{className:`mt-1 flex items-center gap-1 text-xs text-fg-muted`,children:(0,P.jsx)(`span`,{className:`tabular-nums`,children:a})})]},e.templateId)})})]})}function at({c:e,localeTag:t,scheduleBadgeLabels:n,loading:a,jobsCount:o,sortedJobs:s,templateCategoryFilter:c,onTemplateCategoryFilterChange:l,onSelectTemplate:u,keepAwake:d,wakeSupported:m,onWakeUnsupportedClick:h,onKeepAwakeToggle:ee,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:v,onToggle:y,onEdit:te,onAddJob:b,onRunNow:x,onDelete:S}){return(0,P.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[(0,P.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:e.tabMyTasks}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[(0,P.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),(0,P.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:e.wakeBanner})]}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[(0,P.jsx)(`span`,{className:`text-sm text-fg`,children:e.keepAwake}),(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:!m,title:m?void 0:e.wakeLockUnavailable,className:f(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,d?`justify-end bg-accent`:`justify-start bg-surface-hover`,!m&&`cursor-not-allowed opacity-50`),onClick:()=>{m?ee():h()},children:(0,P.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]})]}),a&&o===0?(0,P.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):o===0?(0,P.jsxs)(`div`,{className:`flex flex-col gap-6 rounded-2xl bg-surface-base px-4 py-8 dark:bg-surface-hover/25 sm:px-6 sm:py-10`,children:[(0,P.jsx)(`div`,{className:`w-full max-w-6xl`,children:(0,P.jsx)(H,{cron:e,localeTag:t,scheduleBadgeLabels:n,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u})}),(0,P.jsx)(`div`,{className:`flex justify-center`,children:(0,P.jsx)(p,{type:`button`,variant:`primary`,onClick:b,children:e.emptyStateCta})})]}):(0,P.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:s.map(r=>(0,P.jsx)(B,{job:r,c:e,localeTag:t,scheduleBadgeLabels:n,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:e=>void v(e),onToggle:(e,t)=>void y(e,t),onEdit:te,onRunNow:x,onDelete:S},r.id))})]})}function ot({open:e,onOpenChange:t,c:n,localeTag:r,scheduleBadgeLabels:i,categoryFilter:a,onCategoryFilterChange:o,onSelectTemplate:s}){return(0,P.jsx)(h,{open:e,onOpenChange:t,children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,P.jsxs)(de,{className:`xopc-dialog-content-pane pointer-events-auto relative flex max-h-[min(90vh,840px)] w-full max-w-lg flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none sm:max-w-2xl dark:border-edge`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end border-b border-edge px-4 py-3`,children:[(0,P.jsx)(v,{className:`sr-only`,children:n.fromTemplate}),(0,P.jsx)(g,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,P.jsx)(ve,{className:`size-5`,strokeWidth:1.75})})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,P.jsx)(H,{cron:n,localeTag:r,scheduleBadgeLabels:i,categoryFilter:a,onCategoryFilterChange:o,onSelectTemplate:s})})]})})]})})}function U(){let e=a(e=>e.language),t=le(e),n=t.cron,r=t.chat,i=!!ge(e=>e.token),o=b(e=>e.resolved)===`dark`,s=e===`zh`?`zh-CN`:`en-US`,[c,l]=(0,N.useState)([]),[u,f]=(0,N.useState)(`myTasks`),[p,m]=(0,N.useState)(`created_desc`),[h,g]=(0,N.useState)(`day`),[_,v]=(0,N.useState)(``),[y,te]=(0,N.useState)(``),[x,S]=(0,N.useState)(!1),ne=(0,N.useRef)(null),C=(0,N.useRef)(`none`),ie=(0,N.useRef)(x),oe=typeof navigator<`u`&&`wakeLock`in navigator,se=oe||d(),[ce,ue]=(0,N.useState)([]),[w,de]=(0,N.useState)([]),[fe,T]=(0,N.useState)(``),[pe,me]=(0,N.useState)([]),[he,ve]=(0,N.useState)([]),[E,ye]=(0,N.useState)(!1),[be,Ce]=(0,N.useState)(null),[je,O]=(0,N.useState)(null),[k,Le]=(0,N.useState)([]),[Re,ze]=(0,N.useState)(!1),[A,j]=(0,N.useState)(!1),[M,Be]=(0,N.useState)(`add`),[Ve,Ge]=(0,N.useState)(null),[F,I]=(0,N.useState)(``),[L,R]=(0,N.useState)(We),[z,B]=(0,N.useState)(`local`),[rt,V]=(0,N.useState)(``),[H,U]=(0,N.useState)(``),[st,ct]=(0,N.useState)(`edit`),[lt,ut]=(0,N.useState)(0),[W,dt]=(0,N.useState)(`main`),[ft,G]=(0,N.useState)(``),[pt,K]=(0,N.useState)(!1),[mt,q]=(0,N.useState)(``),[ht,gt]=(0,N.useState)(!1),[_t,J]=(0,N.useState)(``),[vt,yt]=(0,N.useState)(!1),bt=(0,N.useRef)(!1),[xt,St]=(0,N.useState)(!1),[Ct,wt]=(0,N.useState)(null),[Tt,Et]=(0,N.useState)([]),[Dt,Ot]=(0,N.useState)(!1),[kt,Y]=(0,N.useState)(!1),[At,X]=(0,N.useState)(null),[jt,Mt]=(0,N.useState)(null),[Nt,Pt]=(0,N.useState)(!1),[Ft,It]=(0,N.useState)(`all`),Lt=(0,N.useRef)(null),Rt=(0,N.useCallback)(e=>{Lt.current=e,window.setTimeout(()=>{Lt.current===e&&(Lt.current=null)},400)},[]),Z=(0,N.useCallback)(()=>fe||(w.length>0?w[0].id:``),[fe,w]),zt=typeof window<`u`&&!!window.electronAPI?.file?.openDirectory,Bt=(0,N.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.file?.openDirectory:void 0;return e?e():null},[]),Vt=(0,N.useCallback)(async e=>{let t=e.trim();t&&(Ye(t),q(t))},[]),Ht=(0,N.useMemo)(()=>{let e=new Set(he.map(e=>e.id)),t=[...he],n=ft.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[he,ft]),Ut=z!==`local`&&(W===`main`||W===`isolated`&&!pt),Wt=W===`main`||W===`isolated`&&!pt,Gt=!!F.trim()&&!!L.trim()&&!!H.trim()&&(!Ut||!!rt.trim()),Kt=(0,N.useCallback)(async()=>{ze(!0);try{Le(await Me(400))}catch{}finally{ze(!1)}},[]),Q=(0,N.useCallback)(async()=>{ye(!0),O(null);try{l(await Ne())}catch(e){O(e instanceof Error?e.message:n.failedToLoadJobs)}finally{ye(!1)}},[n.failedToLoadJobs]),$=(0,N.useCallback)(async()=>{try{let[e,t,n,r,i]=await Promise.all([Pe(),D(),we(),_e(),ae().catch(()=>null)]);ue(e),de(t),T(n.model||``),Ce(r.payload?.config??null),i&&ve(i.items)}catch{}},[]);(0,N.useEffect)(()=>{i&&(Q(),$())},[i,Q,$]),(0,N.useEffect)(()=>{if(!i)return;let e=()=>{_e().then(e=>{Ce(e.payload?.config??null)})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[i]),(0,N.useEffect)(()=>{!i||u!==`history`||Kt()},[i,u,Kt]);let qt=(0,N.useCallback)(async()=>{if(C.current===`electron`){try{await window.electronAPI?.cron?.setDisplaySleepPrevented?.(!1)}catch{}C.current=`none`;return}try{await ne.current?.release()}catch{}ne.current=null,C.current=`none`},[]),Jt=(0,N.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.cron?.setDisplaySleepPrevented:void 0;if(e)try{await e(!0),C.current=`electron`;return}catch{O(n.wakeLockUnavailable),S(!1);return}if(oe)try{let e=await navigator.wakeLock.request(`screen`);ne.current=e,C.current=`navigator`,e.addEventListener(`release`,()=>{ne.current=null,C.current=`none`})}catch{O(n.wakeLockUnavailable),S(!1)}},[n.wakeLockUnavailable,oe]);ie.current=x,(0,N.useEffect)(()=>{if(!x){qt();return}Jt();let e=()=>{document.visibilityState===`visible`&&ie.current&&Jt()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),qt()}},[x,Jt,qt]),(0,N.useEffect)(()=>{if(!A||M!==`add`||bt.current)return;let e=Z();e&&J(e)},[A,M,Z]),(0,N.useEffect)(()=>{!A||M!==`add`||new Set([`local`,...ce.map(e=>e.name)]).has(z)||B(`local`)},[ce,z,M,A]),(0,N.useEffect)(()=>{if(z===`local`){me([]);return}let e=!1;return Te(z).then(t=>{e||me(t)}),()=>{e=!0}},[z,A]);let Yt=(0,N.useCallback)(e=>{if(bt.current=!1,j(!0),Be(e?`edit`:`add`),Ge(e?.id??null),e){I(e.name||``),R(e.schedule&&String(e.schedule).trim()||`*/5 * * * *`);let t=Se(e);U(t??``),dt(e.sessionTarget||`main`),G((e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``),q((e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``);let n=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;J(e.model?.trim()||n||Z());let r=e.delivery?.channel===`local`,i=(e.sessionTarget||`main`)===`isolated`&&!r&&(!e.delivery?.to||e.delivery.mode===`none`);if(K(i),r)B(`local`),V(``);else if(e.delivery&&e.delivery.mode!==`none`&&e.delivery.to)B(e.delivery.channel||`telegram`),V(e.delivery.to||``);else if(i)B(`telegram`),V(``);else{let e=t.split(`:`);e.length>=3&&[`telegram`,`cli`,`gateway`,`local`].includes(e[0])?(B(e[0]),V(e[1]),U(e.slice(2).join(`:`))):(B(`telegram`),V(``))}}else I(``),R(We),B(`local`),V(``),U(``),dt(`main`),G(``),q(``),K(!1),J(Z());ct(`edit`),ut(e=>e+1)},[Z]),Xt=(0,N.useCallback)(e=>{ct(e),e===`edit`&&ut(e=>e+1)},[]),Zt=(0,N.useCallback)(e=>{let n=it(e),r=n?nt(t.cron,e):void 0;!n||!r||(bt.current=!1,Be(`add`),Ge(null),I(r.title),R(n.defaultSchedule),U(r.prompt),dt(n.defaultSessionTarget),B(`local`),V(``),K(!1),G(``),q(``),J(Z()),ct(`edit`),ut(e=>e+1),Pt(!1),j(!0))},[Z,t.cron]),Qt=(0,N.useCallback)(()=>{j(!1),Be(`add`),Ge(null),I(``),R(We),B(`local`),V(``),U(``),dt(`main`),G(``),q(``),gt(!1),K(!1),J(``),ct(`edit`),bt.current=!1},[]),$t=async()=>{if(!F.trim()){O(n.nameRequired);return}if(!L.trim()||!H.trim()){O(n.scheduleRequired);return}if(Ut&&!rt.trim()){O(n.chatIdRequired);return}yt(!0),O(null);try{let e=H.trim(),t;t=W===`isolated`&&pt?{mode:`none`}:z===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:z,to:rt.trim()};let n=W===`isolated`?{kind:`agentTurn`,message:e,..._t.trim()?{model:_t.trim()}:{}}:{kind:`systemEvent`,text:e},r=_t.trim(),i=ft.trim().toLowerCase(),a=W===`main`?null:i||null,o=mt.trim(),s={name:F.trim(),schedule:L.trim(),sessionTarget:W,model:W===`isolated`&&r?r:void 0,delivery:t,payload:n,...M===`edit`?{agentId:a,workingDirectory:W===`isolated`&&o||null}:{...W===`isolated`&&i?{agentId:i}:{},...W===`isolated`&&o?{workingDirectory:o}:{}}};if(M===`edit`&&Ve)await xe(Ve,s);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=s;await Oe(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}Qt(),await Q(),await $()}catch(e){O(e instanceof Error?e.message:M===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{yt(!1)}},en=async e=>{St(!0),wt(e),Ot(!0),Et([]);try{let t=await Ie(e.id);t&&(wt(t),Et(await ke(e.id,20)))}catch{}finally{Ot(!1)}},tn=async(e,t)=>{try{await Ee(e.id,t),await Q(),await $()}catch(e){O(e instanceof Error?e.message:n.failedToToggleJob)}},nn=async()=>{if(!jt||!At)return;let e=jt,t=At;Y(!1),Mt(null),X(null);try{t===`run`?await De(e):(await Ae(e),Ct?.id===e&&(St(!1),wt(null))),await Q(),await $(),await Kt()}catch(e){O(e instanceof Error?e.message:n.actionFailed)}};(0,N.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(A?Qt():xt&&(St(!1),wt(null)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A,xt,Qt]);let rn=(0,N.useMemo)(()=>({running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled}),[n.execStatusCancelled,n.execStatusFailed,n.execStatusRunning,n.execStatusSuccess]),an=(0,N.useMemo)(()=>c.filter(e=>!Fe(e)),[c]),on=(0,N.useMemo)(()=>c.filter(e=>Fe(e)),[c]),sn=(0,N.useCallback)(e=>{let t=[...e];return t.sort((e,t)=>{let n=new Date(e.created_at).getTime(),r=new Date(t.created_at).getTime();return p===`created_desc`?r-n:n-r}),t},[p]),cn=(0,N.useMemo)(()=>sn(an),[sn,an]),ln=(0,N.useMemo)(()=>sn(on),[sn,on]),un=(0,N.useMemo)(()=>He(be),[be]),dn=(0,N.useMemo)(()=>{let e=new Date,t=h===`day`?Ke(e):h===`week`?qe(e):Je(e);return k.filter(e=>!(new Date(e.startedAt)<t||_&&e.jobId!==_||y&&e.status!==y))},[k,h,_,y]),fn=n.scheduleBadge,pn=(0,N.useCallback)(()=>{Q(),$(),Kt()},[Q,$,Kt]),mn=re(e=>e.setPageHeader),hn=re(e=>e.clearPageHeader),{pathname:gn}=ee(),_n=gn.startsWith(`/settings/`),vn=(0,N.useCallback)((e,t,n)=>{dt(e),e===`main`?(K(!1),G(``),q(``)):e===`isolated`&&!n&&J(t())},[]),yn=(0,N.useCallback)(()=>{Te(z).then(me)},[z]),bn=(0,N.useMemo)(()=>(0,P.jsx)($e,{c:n,loading:E,runHistoryLoading:Re,onRefresh:pn,onOpenTemplatePicker:()=>{It(`all`),Pt(!0)},onAddJob:()=>Yt()}),[n,E,Yt,pn,Re]);return(0,N.useLayoutEffect)(()=>!i||_n?(hn(),()=>hn()):(mn({startExtra:null,main:null,end:bn}),()=>hn()),[hn,bn,i,_n,mn]),i?(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,P.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[je?(0,P.jsx)(`div`,{className:`rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,role:`alert`,children:je}):null,(0,P.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),(0,P.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:n.subtitle})]})}),_n?(0,P.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:bn}):null,(0,P.jsx)(Qe,{c:n,mainTab:u,onMainTabChange:f,jobSort:p,onJobSortChange:m,historyRange:h,onHistoryRangeChange:g,historyJobFilter:_,onHistoryJobFilterChange:v,historyStatusFilter:y,onHistoryStatusFilterChange:te,jobs:c}),u===`myTasks`?(0,P.jsx)(at,{c:n,localeTag:s,scheduleBadgeLabels:fn,loading:E,jobsCount:an.length,sortedJobs:cn,templateCategoryFilter:Ft,onTemplateCategoryFilterChange:It,onSelectTemplate:Zt,keepAwake:x,wakeSupported:se,onWakeUnsupportedClick:()=>O(n.wakeLockUnavailable),onKeepAwakeToggle:()=>S(e=>!e),absorbCardClickJobIdRef:Lt,scheduleAbsorbNextMenuCardClick:Rt,onOpenDetail:e=>void en(e),onToggle:(e,t)=>void tn(e,t),onEdit:e=>Yt(e),onAddJob:()=>Yt(),onRunNow:e=>{X(`run`),Mt(e.id),Y(!0)},onDelete:e=>{X(`delete`),Mt(e.id),Y(!0)}}):u===`systemTasks`?(0,P.jsx)(tt,{c:n,language:e,localeTag:s,scheduleBadgeLabels:fn,loading:E,sortedSystemJobs:ln,heartbeat:un,keepAwake:x,wakeSupported:se,onWakeUnsupportedClick:()=>O(n.wakeLockUnavailable),onKeepAwakeToggle:()=>S(e=>!e),absorbCardClickJobIdRef:Lt,scheduleAbsorbNextMenuCardClick:Rt,onOpenDetail:e=>void en(e),onToggle:(e,t)=>void tn(e,t),onEdit:e=>Yt(e),onRunNow:e=>{X(`run`),Mt(e.id),Y(!0)},onDelete:e=>{X(`delete`),Mt(e.id),Y(!0)}}):(0,P.jsx)(et,{c:n,runHistoryLoading:Re,runHistory:k,filteredRunHistory:dn,jobs:c,onRefreshHistory:()=>void Kt(),onOpenJobDetail:e=>void en(e),statusLabels:rn})]}),(0,P.jsx)(Ze,{open:A,onRequestClose:Qt,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:o,channels:ce,sessionChatIds:pe,cronAgentSelectOptions:Ht,hasElectronFolderPicker:zt,openNativeFolderPicker:Bt,applyWorkingDirectory:Vt,wdModalOpen:ht,onWdModalOpenChange:gt,defaultModelResolver:Z,formMode:M,formJobId:Ve,formName:F,onFormNameChange:I,formSchedule:L,onFormScheduleChange:R,formSubmitting:vt,formSessionTarget:W,onFormSessionTargetChange:vn,formAgentLocalOnly:pt,onFormAgentLocalOnlyChange:K,formModel:_t,onFormModelUserChange:e=>{bt.current=!0,J(e)},formAgentId:ft,onFormAgentIdChange:G,formWorkingDirectory:mt,onFormWorkingDirectoryChange:q,formChannel:z,onFormChannelChange:e=>{B(e),e===`local`&&K(!1),V(``)},formChatId:rt,onFormChatIdChange:V,formMessage:H,onFormMessageChange:U,formMessageMdMode:st,onSetMessageMdMode:Xt,messageEditorNonce:lt,needsDeliveryChat:Ut,showChannelPicker:Wt,canSubmit:Gt,onSubmit:()=>void $t(),onRefreshRecipients:yn}),(0,P.jsx)(ot,{open:Nt,onOpenChange:e=>{Pt(e),e&&It(`all`)},c:n,localeTag:s,scheduleBadgeLabels:fn,categoryFilter:Ft,onCategoryFilterChange:It,onSelectTemplate:Zt}),(0,P.jsx)(Xe,{open:xt,onDismiss:()=>{St(!1),wt(null)},detailJob:Ct,detailLoading:Dt,detailHistory:Tt,c:n,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:rn}),(0,P.jsx)(Ue,{open:kt,onOpenChange:Y,action:At,c:n,onDismiss:()=>{Y(!1),Mt(null),X(null)},onConfirm:nn})]}):(0,P.jsx)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-16 text-center text-sm text-fg-muted sm:px-8`,children:n.needToken})}export{U as CronPage};
2
- //# sourceMappingURL=cron-page-CcRCqnzx.js.map
1
+ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{i as t,t as n}from"./vendor-react-DbimaAId.js";import{Ar as r,Br as i,Cn as a,Dn as o,Dt as s,Ei as c,En as l,Et as u,In as d,Ln as f,Mn as p,Mt as m,Nt as h,Oi as ee,Ot as g,Pr as _,Pt as v,Q as y,Qn as te,Sn as b,T as x,X as S,Xr as ne,Z as C,_n as re,a as ie,bt as ae,ei as oe,hr as se,i as ce,jn as le,jt as ue,kn as w,kt as de,mi as fe,oi as T,pr as pe,qr as me,r as he,vn as ge,xt as _e,zn as ve}from"./index-DvMI6Vqn.js";import{C as E,S as ye,T as be,_ as xe,a as Se,b as Ce,c as we,d as D,f as Te,g as Ee,h as De,i as Oe,l as ke,m as Ae,n as je,o as Me,p as Ne,s as Pe,t as Fe,u as Ie,v as O,w as k,x as Le,y as Re}from"./cron-dreaming-jobs-D5kvbjSY.js";import{a as ze,i as A,n as j,r as M,t as Be}from"./dist-CEmPWsYK.js";import{s as Ve,t as He}from"./heartbeat-config-api-DnmmSrTx.js";var N=e(t(),1),P=n();function Ue({open:e,onOpenChange:t,action:n,c:r,onDismiss:i,onConfirm:a}){return(0,P.jsx)(h,{open:e,onOpenChange:t,children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,P.jsxs)(de,{className:`xopc-dialog-content-pane pointer-events-auto relative w-full max-w-md rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[(0,P.jsx)(v,{className:`text-base font-semibold text-fg`,children:n===`delete`?r.delete:r.runNow}),(0,P.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n===`delete`?r.confirmDelete:r.confirmRun}),(0,P.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,onClick:i,children:r.cancel}),(0,P.jsx)(p,{type:`button`,variant:`primary`,className:n===`delete`?`bg-red-600 hover:bg-red-700`:void 0,onClick:()=>void a(),children:n===`delete`?r.delete:r.runNow})]})]})})]})})}var We=`*/5 * * * *`,Ge=`xopc.recentWorkspaceDirs.v1`;function Ke(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function qe(e){let t=Ke(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function Je(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}function F(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function Ye(e){let t=e.trim();if(t)try{let e=localStorage.getItem(Ge),n=e?JSON.parse(e):[],r=[t,...(Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.trim().length>0):[]).filter(e=>e!==t)].slice(0,10);localStorage.setItem(Ge,JSON.stringify(r))}catch{}}function I(e){return f(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,l,e&&`cursor-not-allowed opacity-60`)}function L(){return f(w,o)}var R=f(w,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),z=f(w,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function Xe({open:e,onDismiss:t,detailJob:n,detailLoading:i,detailHistory:a,c:o,chatWorkingDirNotSet:s,statusLabels:c}){return(0,P.jsx)(h,{open:e,onOpenChange:e=>{e||t()},children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,P.jsxs)(de,{className:f(`xopc-drawer-right fixed right-0 top-0 z-[60] flex h-full w-full max-w-lg flex-col border-l border-edge bg-surface-panel shadow-popover outline-none`,`dark:border-edge`),"aria-describedby":void 0,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,P.jsx)(v,{className:`min-w-0 truncate text-base font-semibold text-fg`,children:n?.name?.trim()||n?.id||`—`}),(0,P.jsx)(g,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":o.close,children:(0,P.jsx)(ve,{className:`size-5`,strokeWidth:1.75})})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:i?(0,P.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):n?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.scheduleLabel}),(0,P.jsx)(`dd`,{className:`mt-1 font-mono text-fg`,children:(0,P.jsx)(`code`,{children:n.schedule})})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.messageLabel}),(0,P.jsx)(`dd`,{className:`mt-1 min-w-0 break-words text-fg`,children:(0,P.jsx)(C,{content:Se(n),compact:!0,className:`text-sm`})})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.mode}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.sessionTarget===`isolated`?o.modeAgentOption:o.modeDirectOption})]}),n.sessionTarget===`isolated`?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.agentProfile}),(0,P.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:n.agentId?.trim()?n.agentId.trim():o.agentProfileDefault})]}):null,n.sessionTarget===`isolated`?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.workingDirectoryLabel}),(0,P.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:n.workingDirectory?.trim()?n.workingDirectory.trim():s})]}):null,n.delivery?.channel===`local`||n.sessionTarget===`isolated`&&!n.delivery?.to?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.deliveryTarget}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.delivery?.channel===`local`?o.deliveryTargetLocalChannel:o.deliveryLocalOnly})]}):n.delivery?.to?(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.deliveryTarget}),(0,P.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,P.jsx)(`code`,{className:`text-xs`,children:n.delivery?.channel??``}),` → `,Re(n,o.channelLocal)]})]}):null,(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.status}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.enabled?o.enabled:o.disabled})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:o.nextRun}),(0,P.jsx)(`dd`,{className:`mt-1 text-fg`,children:n.next_run?Le(n.next_run,o.timeLabels):`—`})]})]}),(0,P.jsx)(`h3`,{className:`mt-6 text-sm font-semibold text-fg`,children:o.detailRunHistory}),a.length===0?(0,P.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:o.noRunsYet}):(0,P.jsx)(`div`,{className:`mt-2 overflow-x-auto`,children:(0,P.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.colStarted}),(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.status}),(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.colDuration}),(0,P.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:o.colDetail}),(0,P.jsx)(`th`,{className:`py-1.5 font-medium`,children:o.colChat})]})}),(0,P.jsx)(`tbody`,{children:a.map(e=>(0,P.jsxs)(`tr`,{className:`border-b border-edge/60`,children:[(0,P.jsx)(`td`,{className:`whitespace-nowrap py-1.5 pr-2 text-fg`,children:(0,P.jsx)(`time`,{dateTime:e.startedAt,children:k(e.startedAt)})}),(0,P.jsx)(`td`,{className:`py-1.5 pr-2`,children:(0,P.jsx)(`span`,{className:f(`inline-flex rounded px-1.5 py-0.5 font-medium`,e.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,e.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`),children:O(e.status,c)})}),(0,P.jsx)(`td`,{className:`py-1.5 pr-2 text-fg-muted`,children:Ce(e.duration)}),(0,P.jsx)(`td`,{className:`max-w-[8rem] truncate py-1.5 pr-2 text-fg-muted`,title:e.summary||e.error||``,children:be(e.summary||e.error,120)}),(0,P.jsx)(`td`,{className:`whitespace-nowrap py-1.5`,children:e.sessionKey?.trim()?(0,P.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:o.openChatTitle,"aria-label":o.openChatTitle,onClick:()=>F(e.sessionKey),children:o.openChat}):(0,P.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]}):null})]})]})})}function Ze(e){let{open:t,onRequestClose:n,c:r,chatM:i,agentsMessages:a,isDark:o,channels:s,sessionChatIds:c,cronAgentSelectOptions:l,hasElectronFolderPicker:u,openNativeFolderPicker:d,applyWorkingDirectory:ee,wdModalOpen:_,onWdModalOpenChange:b,defaultModelResolver:re,formMode:ae,formJobId:oe,formName:se,onFormNameChange:le,formSchedule:w,onFormScheduleChange:fe,formSubmitting:T,formSessionTarget:ge,onFormSessionTargetChange:_e,formAgentLocalOnly:E,onFormAgentLocalOnlyChange:be,formModel:xe,onFormModelUserChange:Se,formAgentId:Ce,onFormAgentIdChange:we,formWorkingDirectory:D,onFormWorkingDirectoryChange:Te,formChannel:Ee,onFormChannelChange:De,formChatId:Oe,onFormChatIdChange:ke,formMessage:Ae,onFormMessageChange:je,formMessageMdMode:Me,onSetMessageMdMode:Ne,messageEditorNonce:Pe,needsDeliveryChat:Fe,showChannelPicker:Ie,canSubmit:O,onSubmit:k,onRefreshRecipients:Le}=e;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(h,{open:t,onOpenChange:e=>!e&&n(),children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,P.jsxs)(de,{className:`xopc-dialog-content-pane pointer-events-auto relative flex max-h-[min(90vh,800px)] w-full max-w-md flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none sm:max-w-lg lg:max-w-xl dark:border-edge`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,P.jsx)(v,{className:`text-base font-semibold text-fg`,children:ae===`edit`?r.editJob:r.addJob}),(0,P.jsx)(g,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":r.close,children:(0,P.jsx)(ve,{className:`size-5`,strokeWidth:1.75})})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.name}),(0,P.jsx)(`input`,{type:`text`,className:I(),value:se,onChange:e=>le(e.target.value),placeholder:r.namePlaceholder})]}),(0,P.jsx)(Ve,{value:w,onChange:fe,disabled:T,labels:r.schedulePicker}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.mode}),(0,P.jsxs)(`select`,{className:L(),value:ge,onChange:e=>{let t=e.target.value;_e(t,re,xe.trim())},children:[(0,P.jsx)(`option`,{value:`main`,children:r.modeDirectOption}),(0,P.jsx)(`option`,{value:`isolated`,children:r.modeAgentOption})]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:ge===`main`?r.modeDirect:r.modeAgent})]}),ge===`isolated`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.model}),(0,P.jsx)(ie,{value:xe,placeholder:i.modelPlaceholder,searchPlaceholder:i.modelSearchPlaceholder,noMatches:i.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:Se})]}),(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.agentProfile}),(0,P.jsxs)(`select`,{className:L(),value:Ce,disabled:T,onChange:e=>we(e.target.value),children:[(0,P.jsx)(`option`,{value:``,children:r.agentProfileDefault}),l.map(e=>(0,P.jsx)(`option`,{value:e.id,children:`${e.id} — ${x(e,a)}`},e.id))]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.agentProfileHint})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.workingDirectoryLabel}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsxs)(`button`,{type:`button`,disabled:T,className:f(`inline-flex min-h-8 max-w-[min(16rem,48vw)] min-w-0 shrink-0 items-center gap-1 rounded-lg px-2 py-1 text-xs`,`border border-edge-subtle/80 bg-surface-hover/40 dark:border-edge-subtle`,S.transition,S.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,T&&`cursor-not-allowed opacity-60`),title:D.trim()?`${D.trim()}\n${i.workingDirectory.chooseFolder}`:`${r.workingDirectoryHint}\n${i.workingDirectory.selectWorkingDirectory}`,onClick:e=>{e.stopPropagation(),!T&&(u?(async()=>{let e=await d();e&&ee(e)})():b(!0))},children:[(0,P.jsx)(me,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:D.trim()?he(D.trim()):i.workingDirectory.notSet})]}),D.trim()?(0,P.jsx)(`button`,{type:`button`,disabled:T,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:()=>Te(``),children:r.workingDirectoryReset}):null]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.workingDirectoryHint})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-hover/45 px-3 py-2 dark:bg-surface-hover/30`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:f(`ui-checkbox`,`mt-0.5`),checked:E,onChange:e=>be(e.target.checked)}),(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.agentLocalOnly}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.agentLocalOnlyHint})]})]})]}):null,Ie?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.channel}),(0,P.jsxs)(`select`,{className:L(),value:Ee,onChange:e=>{let t=e.target.value;De(t)},children:[(0,P.jsx)(`option`,{value:`local`,children:r.channelLocal}),s.map(e=>(0,P.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name))]})]}),Fe?(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.recipient}),(0,P.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:r.refreshRecipientHint,onClick:()=>void Le(),children:[(0,P.jsx)(pe,{className:`size-3.5`,strokeWidth:1.75}),r.refreshList]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,P.jsx)(`input`,{type:`text`,className:f(I(),`min-w-0 w-full sm:flex-1`),value:Oe,onChange:e=>ke(e.target.value),placeholder:r.recipientPlaceholder}),(0,P.jsxs)(`select`,{className:R,value:Oe,onChange:e=>{let t=e.target.value;t&&ke(t)},children:[(0,P.jsx)(`option`,{value:``,children:r.selectRecipient}),c.length>0?c.map(e=>(0,P.jsx)(`option`,{value:e.chatId,children:ye(e,r.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,P.jsx)(`option`,{value:``,disabled:!0,children:r.noRecentChatsOption})]})]}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.length>0?r.enterManuallyOrSelect:r.noRecentChats})]}):null]}):null,(0,P.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:r.message}),(0,P.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[(0,P.jsxs)(`button`,{type:`button`,className:f(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Me===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>Ne(`edit`),children:[(0,P.jsx)(te,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),r.messageEdit]}),(0,P.jsxs)(`button`,{type:`button`,className:f(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Me===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>Ne(`preview`),children:[(0,P.jsx)(ne,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),r.messagePreview]})]})]}),(0,P.jsx)(`div`,{className:f(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,T&&`pointer-events-none opacity-60`),children:Me===`edit`?(0,P.jsx)(y,{initialContent:Ae,onChange:je,isDark:o,className:`h-[min(18rem,40vh)] min-h-[12rem]`},`cron-msg-${oe??`new`}-${Pe}`):(0,P.jsx)(`div`,{className:`h-[min(18rem,40vh)] min-h-[12rem] max-h-[min(24rem,50vh)] overflow-y-auto px-3 py-2`,children:Ae.trim()?(0,P.jsx)(C,{content:Ae,compact:!0,className:`text-sm`}):(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.messagePlaceholder})})}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.messageMarkdownHint})]})]})}),(0,P.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[(0,P.jsx)(p,{type:`button`,variant:`secondary`,onClick:n,children:r.cancel}),(0,P.jsx)(p,{type:`button`,variant:`primary`,disabled:T||!O,onClick:k,children:T?r.loading:ae===`edit`?r.save:r.create})]})]})})]})}),u?null:(0,P.jsx)(ce,{open:_,onOpenChange:b,initialAbsolutePath:D.trim()||void 0,onConfirm:async e=>{await ee(e),b(!1)},wd:i.workingDirectory})]})}function Qe({c:e,mainTab:t,onMainTabChange:n,jobSort:r,onJobSortChange:i,historyRange:a,onHistoryRangeChange:o,historyJobFilter:c,onHistoryJobFilterChange:l,historyStatusFilter:d,onHistoryStatusFilterChange:p,jobs:m}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge-subtle`,children:[(0,P.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":e.title,children:[(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`myTasks`,className:f(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,t===`myTasks`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>n(`myTasks`),children:e.tabMyTasks}),(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`systemTasks`,className:f(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,t===`systemTasks`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>n(`systemTasks`),children:e.tabSystemTasks}),(0,P.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":t===`history`,className:f(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,t===`history`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>n(`history`),children:e.tabRunHistory})]}),(0,P.jsxs)(`div`,{className:f(`flex min-w-0 items-center gap-2`,t===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`),children:[t===`myTasks`||t===`systemTasks`?(0,P.jsxs)(`select`,{className:z,value:r,onChange:e=>i(e.target.value),"aria-label":e.sortCreatedDesc,children:[(0,P.jsx)(`option`,{value:`created_desc`,children:e.sortCreatedDesc}),(0,P.jsx)(`option`,{value:`created_asc`,children:e.sortCreatedAsc})]}):null,t===`history`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:f(s,`shrink-0`),role:`group`,"aria-label":e.runHistoryTitle,children:[`day`,`week`,`month`].map(t=>(0,P.jsx)(`button`,{type:`button`,className:f(u,`px-2.5 py-1`,a===t&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,a===t&&`text-fg`),onClick:()=>o(t),children:t===`day`?e.historyRangeDay:t===`week`?e.historyRangeWeek:e.historyRangeMonth},t))}),(0,P.jsxs)(`select`,{className:z,value:c,onChange:e=>l(e.target.value),"aria-label":e.filterAllTasks,children:[(0,P.jsx)(`option`,{value:``,children:e.filterAllTasks}),m.map(e=>(0,P.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))]}),(0,P.jsxs)(`select`,{className:z,value:d,onChange:e=>p(e.target.value),"aria-label":e.filterAllStatuses,children:[(0,P.jsx)(`option`,{value:``,children:e.filterAllStatuses}),(0,P.jsx)(`option`,{value:`success`,children:e.execStatusSuccess}),(0,P.jsx)(`option`,{value:`failed`,children:e.execStatusFailed}),(0,P.jsx)(`option`,{value:`cancelled`,children:e.execStatusCancelled}),(0,P.jsx)(`option`,{value:`running`,children:e.execStatusRunning})]})]}):null]})]})}function $e({c:e,loading:t,runHistoryLoading:n,onRefresh:r,onOpenTemplatePicker:i,onAddJob:a}){let o=t||n;return(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:o,title:e.refresh,"aria-label":e.refresh,onClick:()=>void r(),children:(0,P.jsx)(pe,{className:f(`size-4`,o&&`animate-spin`),strokeWidth:1.75})}),(0,P.jsxs)(p,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:i,children:[(0,P.jsx)(_,{className:`size-4`,strokeWidth:1.75}),e.fromTemplate]}),(0,P.jsxs)(p,{type:`button`,variant:`primary`,className:`gap-2`,onClick:a,children:[(0,P.jsx)(se,{className:`size-4`,strokeWidth:1.75}),e.addJob]})]})}function et({c:e,runHistoryLoading:t,runHistory:n,filteredRunHistory:i,jobs:a,onRefreshHistory:o,onOpenJobDetail:s,statusLabels:c}){return(0,P.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:e.tabRunHistory}),(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.runHistoryHint})]}),(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:t,title:e.refresh,"aria-label":e.refresh,onClick:()=>void o(),children:(0,P.jsx)(pe,{className:f(`size-4`,t&&`animate-spin`),strokeWidth:1.75})})]}),t&&n.length===0?(0,P.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):i.length===0?(0,P.jsxs)(`div`,{className:`flex flex-col items-center rounded-2xl border border-dashed border-edge-subtle px-6 py-16 text-center dark:border-edge-subtle`,children:[(0,P.jsx)(T,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,P.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n.length===0?e.emptyHistoryTitle:e.noRunsYet}),(0,P.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:n.length===0?e.emptyHistoryHint:e.runHistoryHint})]}):(0,P.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,P.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colStarted}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colJob}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.status}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colDuration}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colDetail}),(0,P.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:e.colChat})]})}),(0,P.jsx)(`tbody`,{children:i.map(t=>(0,P.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,P.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,P.jsx)(`time`,{dateTime:t.startedAt,children:k(t.startedAt)})}),(0,P.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:a.some(e=>e.id===t.jobId)?(0,P.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let e=a.find(e=>e.id===t.jobId);e&&s(e)},children:t.jobName||t.jobId}):(0,P.jsx)(`span`,{className:`text-fg-muted`,children:t.jobName||t.jobId})}),(0,P.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,P.jsx)(`span`,{className:f(`inline-flex rounded-md px-2 py-0.5 text-xs font-medium`,t.status===`success`&&`bg-emerald-500/15 text-emerald-800 dark:text-emerald-300`,t.status===`failed`&&`bg-red-500/15 text-red-800 dark:text-red-300`,t.status===`running`&&`bg-accent/15 text-accent`,t.status===`cancelled`&&`bg-surface-hover text-fg-muted`),children:O(t.status,c)})}),(0,P.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:Ce(t.duration)}),(0,P.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:t.summary||t.error||``,children:be(t.summary||t.error,96)}),(0,P.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:t.sessionKey?.trim()?(0,P.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:e.openChatTitle,"aria-label":e.openChatTitle,onClick:()=>F(t.sessionKey),children:e.openChat}):(0,P.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},t.id))})]})})]})}function B({job:e,c:t,localeTag:n,scheduleBadgeLabels:r,absorbCardClickJobIdRef:i,scheduleAbsorbNextMenuCardClick:a,onOpenDetail:o,onToggle:s,onEdit:c,onRunNow:l,onDelete:u}){return(0,P.jsxs)(`article`,{role:`button`,tabIndex:0,className:f(`flex cursor-pointer flex-col rounded-xl border border-edge-subtle bg-surface-base text-left transition-colors duration-150 ease-out dark:border-edge-subtle`,`hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:()=>{if(i.current===e.id){i.current=null;return}o(e)},onKeyDown:t=>{if(t.key===`Enter`||t.key===` `){if(t.preventDefault(),i.current===e.id){i.current=null;return}o(e)}},children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,className:f(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,e.enabled?`justify-end bg-accent`:`justify-start bg-surface-hover`),onClick:t=>{t.stopPropagation(),s(e,!e.enabled)},children:(0,P.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}),(0,P.jsxs)(A,{children:[(0,P.jsx)(ze,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 w-8 shrink-0 p-0`,"aria-label":t.jobCardMenuAria,onClick:e=>e.stopPropagation(),children:(0,P.jsx)(oe,{className:`size-4`,strokeWidth:1.75})})}),(0,P.jsx)(M,{children:(0,P.jsxs)(Be,{className:`z-50 min-w-[10rem] rounded-xl border border-edge-subtle bg-surface-panel p-1 shadow-elevated dark:border-edge-subtle`,sideOffset:4,align:`end`,onCloseAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(j,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{a(e.id),c(e)},children:t.edit}),(0,P.jsx)(j,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{a(e.id),l(e)},children:t.runNow}),(0,P.jsx)(j,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-red-600 outline-none data-highlighted:bg-red-500/10 dark:text-red-400`,onSelect:()=>{a(e.id),u(e)},children:t.delete})]})})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[(0,P.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:e.name||e.id}),(0,P.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:Se(e),children:(0,P.jsx)(C,{content:Se(e),compact:!0})})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 border-t border-edge-subtle/90 px-4 py-2.5 text-xs text-fg-muted dark:border-edge-subtle`,children:[(0,P.jsx)(T,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:E(e,n,r)})]})]})}function tt({c:e,language:t,localeTag:n,scheduleBadgeLabels:a,loading:o,sortedSystemJobs:s,heartbeat:l,keepAwake:u,wakeSupported:d,onWakeUnsupportedClick:m,onKeepAwakeToggle:h,absorbCardClickJobIdRef:ee,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:te,onDelete:b}){let x=je(l.intervalMs,n,le(t).heartbeatSettings.intervalPresets);return(0,P.jsxs)(`section`,{"aria-labelledby":`cron-system-tasks-panel`,className:`flex flex-col gap-4`,children:[(0,P.jsx)(`h2`,{id:`cron-system-tasks-panel`,className:`sr-only`,children:e.tabSystemTasks}),(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.systemTasksIntro}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[(0,P.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),(0,P.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:e.wakeBanner})]}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[(0,P.jsx)(`span`,{className:`text-sm text-fg`,children:e.keepAwake}),(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":u,disabled:!d,title:d?void 0:e.wakeLockUnavailable,className:f(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,u?`justify-end bg-accent`:`justify-start bg-surface-hover`,!d&&`cursor-not-allowed opacity-50`),onClick:()=>{d?h():m()},children:(0,P.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-4 dark:bg-surface-hover/20`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1 sm:flex-row sm:items-start sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.systemHeartbeatTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.systemHeartbeatHint})]}),(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,P.jsxs)(c,{to:`/settings/heartbeat`,children:[e.systemHeartbeatSettingsLink,(0,P.jsx)(fe,{className:`size-3.5 opacity-70`,"aria-hidden":!0})]})})]}),(0,P.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:e.systemHeartbeatStatus}),(0,P.jsx)(`dd`,{className:`text-fg`,children:l.enabled?e.enabled:e.disabled})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:e.systemHeartbeatInterval}),(0,P.jsx)(`dd`,{className:`text-fg`,children:e.systemHeartbeatEvery.replace(/\{\{value\}\}/g,x)})]})]})]}),(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`mb-2 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.systemDreamingTitle}),(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`shrink-0 gap-1 self-start px-2 py-1.5 text-xs`,asChild:!0,children:(0,P.jsxs)(c,{to:`/settings/dreams`,children:[e.systemDreamingSettingsLink,(0,P.jsx)(fe,{className:`size-3.5 opacity-70`,"aria-hidden":!0})]})})]}),(0,P.jsx)(`p`,{className:`mb-3 text-xs text-fg-muted`,children:e.systemDreamingHint}),o&&s.length===0?(0,P.jsx)(`div`,{className:`flex justify-center py-12`,"aria-busy":`true`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):s.length===0?(0,P.jsx)(`p`,{className:`rounded-lg border border-edge-subtle bg-surface-hover/30 px-3 py-4 text-sm text-fg-muted dark:border-edge-subtle`,children:e.systemDreamingEmpty}):(0,P.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:s.map(t=>(0,P.jsx)(B,{job:t,c:e,localeTag:n,scheduleBadgeLabels:a,absorbCardClickJobIdRef:ee,scheduleAbsorbNextMenuCardClick:g,onOpenDetail:_,onToggle:v,onEdit:y,onRunNow:te,onDelete:b},t.id))})]})]})}function nt(e,t){let n=e.templates;if(!n||typeof n!=`object`)return;let r=n[t];if(!r||typeof r!=`object`)return;let i=r.title?.trim(),a=r.prompt?.trim();if(!(!i||!a))return{title:i,description:(r.description??``).trim(),prompt:a}}var rt=[`daily`,`monitoring`,`reports`,`automation`],V=[{templateId:`morning_briefing`,category:`daily`,defaultSchedule:`0 7 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`standup_prep`,category:`daily`,defaultSchedule:`0 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`end_of_day_wrap_up`,category:`daily`,defaultSchedule:`0 18 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`inbox_triage`,category:`daily`,defaultSchedule:`30 8 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`competitor_watch`,category:`monitoring`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`trending_topics_monitor`,category:`monitoring`,defaultSchedule:`0 10 * * 1-5`,defaultSessionTarget:`isolated`},{templateId:`tech_radar_stack`,category:`monitoring`,defaultSchedule:`0 11 * * 3`,defaultSessionTarget:`isolated`},{templateId:`dependency_check_audit`,category:`monitoring`,defaultSchedule:`0 9 * * 0`,defaultSessionTarget:`isolated`},{templateId:`weekly_review`,category:`reports`,defaultSchedule:`0 17 * * 5`,defaultSessionTarget:`isolated`},{templateId:`code_quality_report`,category:`reports`,defaultSchedule:`0 14 * * 1`,defaultSessionTarget:`isolated`},{templateId:`git_activity_summary`,category:`reports`,defaultSchedule:`0 9 * * 1`,defaultSessionTarget:`isolated`},{templateId:`user_feedback_digest`,category:`reports`,defaultSchedule:`0 16 * * 5`,defaultSessionTarget:`isolated`},{templateId:`stale_todo_or_issue_sweep`,category:`automation`,defaultSchedule:`0 10 * * 2`,defaultSessionTarget:`isolated`},{templateId:`release_notes_or_changelog_draft`,category:`automation`,defaultSchedule:`0 10 * * 4`,defaultSessionTarget:`isolated`},{templateId:`workspace_cleanup_suggestions`,category:`automation`,defaultSchedule:`30 18 * * 5`,defaultSessionTarget:`isolated`},{templateId:`smoke_or_ci_health_reminder`,category:`automation`,defaultSchedule:`0 8 * * 1`,defaultSessionTarget:`isolated`}];function it(e){return V.find(t=>t.templateId===e)}function H(e){let{cron:t,localeTag:n,scheduleBadgeLabels:r,categoryFilter:i,onCategoryFilterChange:a,onSelectTemplate:o}=e,s=i===`all`?[...V]:V.filter(e=>e.category===i);return(0,P.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.fromTemplate,children:[(0,P.jsx)(p,{type:`button`,variant:i===`all`?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>a(`all`),children:t.templateFilterAll}),rt.map(e=>(0,P.jsx)(p,{type:`button`,variant:i===e?`secondary`:`ghost`,className:`h-8 rounded-full px-3 py-1.5 text-xs`,onClick:()=>a(e),children:t.templateCategories[e]},e))]}),s.length===0?(0,P.jsx)(`p`,{className:`text-center text-sm text-fg-muted`,children:t.templatesEmptyHint}):(0,P.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:s.map(e=>{let i=nt(t,e.templateId);if(!i)return null;let a=E({schedule:e.defaultSchedule,timezone:void 0,next_run:void 0},n,r);return(0,P.jsxs)(`button`,{type:`button`,className:f(`flex flex-col gap-1.5 rounded-xl border border-edge-subtle bg-surface-base p-4 text-left transition-colors`,`hover:border-accent/40 hover:bg-surface-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`),onClick:()=>o(e.templateId),"aria-label":`${t.templateCategories[e.category]} — ${i.title}`,children:[(0,P.jsx)(`span`,{className:`font-semibold text-fg`,children:i.title}),(0,P.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:i.description}),(0,P.jsx)(`span`,{className:`mt-1 flex items-center gap-1 text-xs text-fg-muted`,children:(0,P.jsx)(`span`,{className:`tabular-nums`,children:a})})]},e.templateId)})})]})}function at({c:e,localeTag:t,scheduleBadgeLabels:n,loading:a,jobsCount:o,sortedJobs:s,templateCategoryFilter:c,onTemplateCategoryFilterChange:l,onSelectTemplate:u,keepAwake:d,wakeSupported:m,onWakeUnsupportedClick:h,onKeepAwakeToggle:ee,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:v,onToggle:y,onEdit:te,onAddJob:b,onRunNow:x,onDelete:S}){return(0,P.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[(0,P.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:e.tabMyTasks}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent/5 px-4 py-3 dark:border-accent/30 dark:bg-accent/10 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[(0,P.jsx)(i,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),(0,P.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:e.wakeBanner})]}),(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[(0,P.jsx)(`span`,{className:`text-sm text-fg`,children:e.keepAwake}),(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":d,disabled:!m,title:m?void 0:e.wakeLockUnavailable,className:f(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,d?`justify-end bg-accent`:`justify-start bg-surface-hover`,!m&&`cursor-not-allowed opacity-50`),onClick:()=>{m?ee():h()},children:(0,P.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]})]}),a&&o===0?(0,P.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,P.jsx)(r,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):o===0?(0,P.jsxs)(`div`,{className:`flex flex-col gap-6 rounded-2xl bg-surface-base px-4 py-8 dark:bg-surface-hover/25 sm:px-6 sm:py-10`,children:[(0,P.jsx)(`div`,{className:`w-full max-w-6xl`,children:(0,P.jsx)(H,{cron:e,localeTag:t,scheduleBadgeLabels:n,categoryFilter:c,onCategoryFilterChange:l,onSelectTemplate:u})}),(0,P.jsx)(`div`,{className:`flex justify-center`,children:(0,P.jsx)(p,{type:`button`,variant:`primary`,onClick:b,children:e.emptyStateCta})})]}):(0,P.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:s.map(r=>(0,P.jsx)(B,{job:r,c:e,localeTag:t,scheduleBadgeLabels:n,absorbCardClickJobIdRef:g,scheduleAbsorbNextMenuCardClick:_,onOpenDetail:e=>void v(e),onToggle:(e,t)=>void y(e,t),onEdit:te,onRunNow:x,onDelete:S},r.id))})]})}function ot({open:e,onOpenChange:t,c:n,localeTag:r,scheduleBadgeLabels:i,categoryFilter:a,onCategoryFilterChange:o,onSelectTemplate:s}){return(0,P.jsx)(h,{open:e,onOpenChange:t,children:(0,P.jsxs)(m,{children:[(0,P.jsx)(ue,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),(0,P.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,P.jsxs)(de,{className:`xopc-dialog-content-pane pointer-events-auto relative flex max-h-[min(90vh,840px)] w-full max-w-lg flex-col rounded-xl border border-edge bg-surface-panel shadow-popover outline-none sm:max-w-2xl dark:border-edge`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end border-b border-edge px-4 py-3`,children:[(0,P.jsx)(v,{className:`sr-only`,children:n.fromTemplate}),(0,P.jsx)(g,{asChild:!0,children:(0,P.jsx)(p,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,P.jsx)(ve,{className:`size-5`,strokeWidth:1.75})})})]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,P.jsx)(H,{cron:n,localeTag:r,scheduleBadgeLabels:i,categoryFilter:a,onCategoryFilterChange:o,onSelectTemplate:s})})]})})]})})}function U(){let e=a(e=>e.language),t=le(e),n=t.cron,r=t.chat,i=!!ge(e=>e.token),o=b(e=>e.resolved)===`dark`,s=e===`zh`?`zh-CN`:`en-US`,[c,l]=(0,N.useState)([]),[u,f]=(0,N.useState)(`myTasks`),[p,m]=(0,N.useState)(`created_desc`),[h,g]=(0,N.useState)(`day`),[_,v]=(0,N.useState)(``),[y,te]=(0,N.useState)(``),[x,S]=(0,N.useState)(!1),ne=(0,N.useRef)(null),C=(0,N.useRef)(`none`),ie=(0,N.useRef)(x),oe=typeof navigator<`u`&&`wakeLock`in navigator,se=oe||d(),[ce,ue]=(0,N.useState)([]),[w,de]=(0,N.useState)([]),[fe,T]=(0,N.useState)(``),[pe,me]=(0,N.useState)([]),[he,ve]=(0,N.useState)([]),[E,ye]=(0,N.useState)(!1),[be,Ce]=(0,N.useState)(null),[je,O]=(0,N.useState)(null),[k,Le]=(0,N.useState)([]),[Re,ze]=(0,N.useState)(!1),[A,j]=(0,N.useState)(!1),[M,Be]=(0,N.useState)(`add`),[Ve,Ge]=(0,N.useState)(null),[F,I]=(0,N.useState)(``),[L,R]=(0,N.useState)(We),[z,B]=(0,N.useState)(`local`),[rt,V]=(0,N.useState)(``),[H,U]=(0,N.useState)(``),[st,ct]=(0,N.useState)(`edit`),[lt,ut]=(0,N.useState)(0),[W,dt]=(0,N.useState)(`main`),[ft,G]=(0,N.useState)(``),[pt,K]=(0,N.useState)(!1),[mt,q]=(0,N.useState)(``),[ht,gt]=(0,N.useState)(!1),[_t,J]=(0,N.useState)(``),[vt,yt]=(0,N.useState)(!1),bt=(0,N.useRef)(!1),[xt,St]=(0,N.useState)(!1),[Ct,wt]=(0,N.useState)(null),[Tt,Et]=(0,N.useState)([]),[Dt,Ot]=(0,N.useState)(!1),[kt,Y]=(0,N.useState)(!1),[At,X]=(0,N.useState)(null),[jt,Mt]=(0,N.useState)(null),[Nt,Pt]=(0,N.useState)(!1),[Ft,It]=(0,N.useState)(`all`),Lt=(0,N.useRef)(null),Rt=(0,N.useCallback)(e=>{Lt.current=e,window.setTimeout(()=>{Lt.current===e&&(Lt.current=null)},400)},[]),Z=(0,N.useCallback)(()=>fe||(w.length>0?w[0].id:``),[fe,w]),zt=typeof window<`u`&&!!window.electronAPI?.file?.openDirectory,Bt=(0,N.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.file?.openDirectory:void 0;return e?e():null},[]),Vt=(0,N.useCallback)(async e=>{let t=e.trim();t&&(Ye(t),q(t))},[]),Ht=(0,N.useMemo)(()=>{let e=new Set(he.map(e=>e.id)),t=[...he],n=ft.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[he,ft]),Ut=z!==`local`&&(W===`main`||W===`isolated`&&!pt),Wt=W===`main`||W===`isolated`&&!pt,Gt=!!F.trim()&&!!L.trim()&&!!H.trim()&&(!Ut||!!rt.trim()),Kt=(0,N.useCallback)(async()=>{ze(!0);try{Le(await Me(400))}catch{}finally{ze(!1)}},[]),Q=(0,N.useCallback)(async()=>{ye(!0),O(null);try{l(await Ne())}catch(e){O(e instanceof Error?e.message:n.failedToLoadJobs)}finally{ye(!1)}},[n.failedToLoadJobs]),$=(0,N.useCallback)(async()=>{try{let[e,t,n,r,i]=await Promise.all([Pe(),D(),we(),_e(),ae().catch(()=>null)]);ue(e),de(t),T(n.model||``),Ce(r.payload?.config??null),i&&ve(i.items)}catch{}},[]);(0,N.useEffect)(()=>{i&&(Q(),$())},[i,Q,$]),(0,N.useEffect)(()=>{if(!i)return;let e=()=>{_e().then(e=>{Ce(e.payload?.config??null)})};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[i]),(0,N.useEffect)(()=>{!i||u!==`history`||Kt()},[i,u,Kt]);let qt=(0,N.useCallback)(async()=>{if(C.current===`electron`){try{await window.electronAPI?.cron?.setDisplaySleepPrevented?.(!1)}catch{}C.current=`none`;return}try{await ne.current?.release()}catch{}ne.current=null,C.current=`none`},[]),Jt=(0,N.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.cron?.setDisplaySleepPrevented:void 0;if(e)try{await e(!0),C.current=`electron`;return}catch{O(n.wakeLockUnavailable),S(!1);return}if(oe)try{let e=await navigator.wakeLock.request(`screen`);ne.current=e,C.current=`navigator`,e.addEventListener(`release`,()=>{ne.current=null,C.current=`none`})}catch{O(n.wakeLockUnavailable),S(!1)}},[n.wakeLockUnavailable,oe]);ie.current=x,(0,N.useEffect)(()=>{if(!x){qt();return}Jt();let e=()=>{document.visibilityState===`visible`&&ie.current&&Jt()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),qt()}},[x,Jt,qt]),(0,N.useEffect)(()=>{if(!A||M!==`add`||bt.current)return;let e=Z();e&&J(e)},[A,M,Z]),(0,N.useEffect)(()=>{!A||M!==`add`||new Set([`local`,...ce.map(e=>e.name)]).has(z)||B(`local`)},[ce,z,M,A]),(0,N.useEffect)(()=>{if(z===`local`){me([]);return}let e=!1;return Te(z).then(t=>{e||me(t)}),()=>{e=!0}},[z,A]);let Yt=(0,N.useCallback)(e=>{if(bt.current=!1,j(!0),Be(e?`edit`:`add`),Ge(e?.id??null),e){I(e.name||``),R(e.schedule&&String(e.schedule).trim()||`*/5 * * * *`);let t=Se(e);U(t??``),dt(e.sessionTarget||`main`),G((e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``),q((e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``);let n=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;J(e.model?.trim()||n||Z());let r=e.delivery?.channel===`local`,i=(e.sessionTarget||`main`)===`isolated`&&!r&&(!e.delivery?.to||e.delivery.mode===`none`);if(K(i),r)B(`local`),V(``);else if(e.delivery&&e.delivery.mode!==`none`&&e.delivery.to)B(e.delivery.channel||`telegram`),V(e.delivery.to||``);else if(i)B(`telegram`),V(``);else{let e=t.split(`:`);e.length>=3&&[`telegram`,`cli`,`gateway`,`local`].includes(e[0])?(B(e[0]),V(e[1]),U(e.slice(2).join(`:`))):(B(`telegram`),V(``))}}else I(``),R(We),B(`local`),V(``),U(``),dt(`main`),G(``),q(``),K(!1),J(Z());ct(`edit`),ut(e=>e+1)},[Z]),Xt=(0,N.useCallback)(e=>{ct(e),e===`edit`&&ut(e=>e+1)},[]),Zt=(0,N.useCallback)(e=>{let n=it(e),r=n?nt(t.cron,e):void 0;!n||!r||(bt.current=!1,Be(`add`),Ge(null),I(r.title),R(n.defaultSchedule),U(r.prompt),dt(n.defaultSessionTarget),B(`local`),V(``),K(!1),G(``),q(``),J(Z()),ct(`edit`),ut(e=>e+1),Pt(!1),j(!0))},[Z,t.cron]),Qt=(0,N.useCallback)(()=>{j(!1),Be(`add`),Ge(null),I(``),R(We),B(`local`),V(``),U(``),dt(`main`),G(``),q(``),gt(!1),K(!1),J(``),ct(`edit`),bt.current=!1},[]),$t=async()=>{if(!F.trim()){O(n.nameRequired);return}if(!L.trim()||!H.trim()){O(n.scheduleRequired);return}if(Ut&&!rt.trim()){O(n.chatIdRequired);return}yt(!0),O(null);try{let e=H.trim(),t;t=W===`isolated`&&pt?{mode:`none`}:z===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:z,to:rt.trim()};let n=W===`isolated`?{kind:`agentTurn`,message:e,..._t.trim()?{model:_t.trim()}:{}}:{kind:`systemEvent`,text:e},r=_t.trim(),i=ft.trim().toLowerCase(),a=W===`main`?null:i||null,o=mt.trim(),s={name:F.trim(),schedule:L.trim(),sessionTarget:W,model:W===`isolated`&&r?r:void 0,delivery:t,payload:n,...M===`edit`?{agentId:a,workingDirectory:W===`isolated`&&o||null}:{...W===`isolated`&&i?{agentId:i}:{},...W===`isolated`&&o?{workingDirectory:o}:{}}};if(M===`edit`&&Ve)await xe(Ve,s);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=s;await Oe(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}Qt(),await Q(),await $()}catch(e){O(e instanceof Error?e.message:M===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{yt(!1)}},en=async e=>{St(!0),wt(e),Ot(!0),Et([]);try{let t=await Ie(e.id);t&&(wt(t),Et(await ke(e.id,20)))}catch{}finally{Ot(!1)}},tn=async(e,t)=>{try{await Ee(e.id,t),await Q(),await $()}catch(e){O(e instanceof Error?e.message:n.failedToToggleJob)}},nn=async()=>{if(!jt||!At)return;let e=jt,t=At;Y(!1),Mt(null),X(null);try{t===`run`?await De(e):(await Ae(e),Ct?.id===e&&(St(!1),wt(null))),await Q(),await $(),await Kt()}catch(e){O(e instanceof Error?e.message:n.actionFailed)}};(0,N.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(A?Qt():xt&&(St(!1),wt(null)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[A,xt,Qt]);let rn=(0,N.useMemo)(()=>({running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled}),[n.execStatusCancelled,n.execStatusFailed,n.execStatusRunning,n.execStatusSuccess]),an=(0,N.useMemo)(()=>c.filter(e=>!Fe(e)),[c]),on=(0,N.useMemo)(()=>c.filter(e=>Fe(e)),[c]),sn=(0,N.useCallback)(e=>{let t=[...e];return t.sort((e,t)=>{let n=new Date(e.created_at).getTime(),r=new Date(t.created_at).getTime();return p===`created_desc`?r-n:n-r}),t},[p]),cn=(0,N.useMemo)(()=>sn(an),[sn,an]),ln=(0,N.useMemo)(()=>sn(on),[sn,on]),un=(0,N.useMemo)(()=>He(be),[be]),dn=(0,N.useMemo)(()=>{let e=new Date,t=h===`day`?Ke(e):h===`week`?qe(e):Je(e);return k.filter(e=>!(new Date(e.startedAt)<t||_&&e.jobId!==_||y&&e.status!==y))},[k,h,_,y]),fn=n.scheduleBadge,pn=(0,N.useCallback)(()=>{Q(),$(),Kt()},[Q,$,Kt]),mn=re(e=>e.setPageHeader),hn=re(e=>e.clearPageHeader),{pathname:gn}=ee(),_n=gn.startsWith(`/settings/`),vn=(0,N.useCallback)((e,t,n)=>{dt(e),e===`main`?(K(!1),G(``),q(``)):e===`isolated`&&!n&&J(t())},[]),yn=(0,N.useCallback)(()=>{Te(z).then(me)},[z]),bn=(0,N.useMemo)(()=>(0,P.jsx)($e,{c:n,loading:E,runHistoryLoading:Re,onRefresh:pn,onOpenTemplatePicker:()=>{It(`all`),Pt(!0)},onAddJob:()=>Yt()}),[n,E,Yt,pn,Re]);return(0,N.useLayoutEffect)(()=>!i||_n?(hn(),()=>hn()):(mn({startExtra:null,main:null,end:bn}),()=>hn()),[hn,bn,i,_n,mn]),i?(0,P.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,P.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[je?(0,P.jsx)(`div`,{className:`rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,role:`alert`,children:je}):null,(0,P.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),(0,P.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:n.subtitle})]})}),_n?(0,P.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:bn}):null,(0,P.jsx)(Qe,{c:n,mainTab:u,onMainTabChange:f,jobSort:p,onJobSortChange:m,historyRange:h,onHistoryRangeChange:g,historyJobFilter:_,onHistoryJobFilterChange:v,historyStatusFilter:y,onHistoryStatusFilterChange:te,jobs:c}),u===`myTasks`?(0,P.jsx)(at,{c:n,localeTag:s,scheduleBadgeLabels:fn,loading:E,jobsCount:an.length,sortedJobs:cn,templateCategoryFilter:Ft,onTemplateCategoryFilterChange:It,onSelectTemplate:Zt,keepAwake:x,wakeSupported:se,onWakeUnsupportedClick:()=>O(n.wakeLockUnavailable),onKeepAwakeToggle:()=>S(e=>!e),absorbCardClickJobIdRef:Lt,scheduleAbsorbNextMenuCardClick:Rt,onOpenDetail:e=>void en(e),onToggle:(e,t)=>void tn(e,t),onEdit:e=>Yt(e),onAddJob:()=>Yt(),onRunNow:e=>{X(`run`),Mt(e.id),Y(!0)},onDelete:e=>{X(`delete`),Mt(e.id),Y(!0)}}):u===`systemTasks`?(0,P.jsx)(tt,{c:n,language:e,localeTag:s,scheduleBadgeLabels:fn,loading:E,sortedSystemJobs:ln,heartbeat:un,keepAwake:x,wakeSupported:se,onWakeUnsupportedClick:()=>O(n.wakeLockUnavailable),onKeepAwakeToggle:()=>S(e=>!e),absorbCardClickJobIdRef:Lt,scheduleAbsorbNextMenuCardClick:Rt,onOpenDetail:e=>void en(e),onToggle:(e,t)=>void tn(e,t),onEdit:e=>Yt(e),onRunNow:e=>{X(`run`),Mt(e.id),Y(!0)},onDelete:e=>{X(`delete`),Mt(e.id),Y(!0)}}):(0,P.jsx)(et,{c:n,runHistoryLoading:Re,runHistory:k,filteredRunHistory:dn,jobs:c,onRefreshHistory:()=>void Kt(),onOpenJobDetail:e=>void en(e),statusLabels:rn})]}),(0,P.jsx)(Ze,{open:A,onRequestClose:Qt,c:n,chatM:r,agentsMessages:t.agentsSettings,isDark:o,channels:ce,sessionChatIds:pe,cronAgentSelectOptions:Ht,hasElectronFolderPicker:zt,openNativeFolderPicker:Bt,applyWorkingDirectory:Vt,wdModalOpen:ht,onWdModalOpenChange:gt,defaultModelResolver:Z,formMode:M,formJobId:Ve,formName:F,onFormNameChange:I,formSchedule:L,onFormScheduleChange:R,formSubmitting:vt,formSessionTarget:W,onFormSessionTargetChange:vn,formAgentLocalOnly:pt,onFormAgentLocalOnlyChange:K,formModel:_t,onFormModelUserChange:e=>{bt.current=!0,J(e)},formAgentId:ft,onFormAgentIdChange:G,formWorkingDirectory:mt,onFormWorkingDirectoryChange:q,formChannel:z,onFormChannelChange:e=>{B(e),e===`local`&&K(!1),V(``)},formChatId:rt,onFormChatIdChange:V,formMessage:H,onFormMessageChange:U,formMessageMdMode:st,onSetMessageMdMode:Xt,messageEditorNonce:lt,needsDeliveryChat:Ut,showChannelPicker:Wt,canSubmit:Gt,onSubmit:()=>void $t(),onRefreshRecipients:yn}),(0,P.jsx)(ot,{open:Nt,onOpenChange:e=>{Pt(e),e&&It(`all`)},c:n,localeTag:s,scheduleBadgeLabels:fn,categoryFilter:Ft,onCategoryFilterChange:It,onSelectTemplate:Zt}),(0,P.jsx)(Xe,{open:xt,onDismiss:()=>{St(!1),wt(null)},detailJob:Ct,detailLoading:Dt,detailHistory:Tt,c:n,chatWorkingDirNotSet:r.workingDirectory.notSet,statusLabels:rn}),(0,P.jsx)(Ue,{open:kt,onOpenChange:Y,action:At,c:n,onDismiss:()=>{Y(!1),Mt(null),X(null)},onConfirm:nn})]}):(0,P.jsx)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-16 text-center text-sm text-fg-muted sm:px-8`,children:n.needToken})}export{U as CronPage};
2
+ //# sourceMappingURL=cron-page-4hk422N-.js.map