@xopcai/xopc 0.0.17 → 0.0.19

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 (32) hide show
  1. package/dist/extensions/telegram/xopc.extension.json +1 -1
  2. package/dist/gateway/static/root/assets/{agents-DouPaDd1.js → agents-ByiiWRbv.js} +2 -2
  3. package/dist/gateway/static/root/assets/{agents-DouPaDd1.js.map → agents-ByiiWRbv.js.map} +1 -1
  4. package/dist/gateway/static/root/assets/{apps-page-NiD-_oC4.js → apps-page-BpR0gguZ.js} +2 -2
  5. package/dist/gateway/static/root/assets/{apps-page-NiD-_oC4.js.map → apps-page-BpR0gguZ.js.map} +1 -1
  6. package/dist/gateway/static/root/assets/{channels-settings-BdNb4uD6.js → channels-settings-h3eQwIPi.js} +2 -2
  7. package/dist/gateway/static/root/assets/{channels-settings-BdNb4uD6.js.map → channels-settings-h3eQwIPi.js.map} +1 -1
  8. package/dist/gateway/static/root/assets/{cron-page-VjRx7Jtc.js → cron-page-D6wtd-hq.js} +2 -2
  9. package/dist/gateway/static/root/assets/{cron-page-VjRx7Jtc.js.map → cron-page-D6wtd-hq.js.map} +1 -1
  10. package/dist/gateway/static/root/assets/{cron-utils-CMkZdWey.js → cron-utils-o-QI_XCC.js} +2 -2
  11. package/dist/gateway/static/root/assets/{cron-utils-CMkZdWey.js.map → cron-utils-o-QI_XCC.js.map} +1 -1
  12. package/dist/gateway/static/root/assets/{dist-D-p_Xi_b.js → dist-D2Td6E_v.js} +2 -2
  13. package/dist/gateway/static/root/assets/{dist-D-p_Xi_b.js.map → dist-D2Td6E_v.js.map} +1 -1
  14. package/dist/gateway/static/root/assets/{extension-debug-page-B5jGnQgG.js → extension-debug-page-BIni4Qq4.js} +2 -2
  15. package/dist/gateway/static/root/assets/{extension-debug-page-B5jGnQgG.js.map → extension-debug-page-BIni4Qq4.js.map} +1 -1
  16. package/dist/gateway/static/root/assets/{extension-page-CSA88lpx.js → extension-page-BRLScNkx.js} +2 -2
  17. package/dist/gateway/static/root/assets/{extension-page-CSA88lpx.js.map → extension-page-BRLScNkx.js.map} +1 -1
  18. package/dist/gateway/static/root/assets/{extension-settings-page-C9HfcH28.js → extension-settings-page-DjiK9Igx.js} +2 -2
  19. package/dist/gateway/static/root/assets/{extension-settings-page-C9HfcH28.js.map → extension-settings-page-DjiK9Igx.js.map} +1 -1
  20. package/dist/gateway/static/root/assets/{index-C5pFj5w6.js → index-KGmhufWu.js} +53 -53
  21. package/dist/gateway/static/root/assets/{index-C5pFj5w6.js.map → index-KGmhufWu.js.map} +1 -1
  22. package/dist/gateway/static/root/assets/{logs-page-CrJ87O5K.js → logs-page-C76F4Y0H.js} +2 -2
  23. package/dist/gateway/static/root/assets/{logs-page-CrJ87O5K.js.map → logs-page-C76F4Y0H.js.map} +1 -1
  24. package/dist/gateway/static/root/assets/{sessions-page-DJfnuATX.js → sessions-page-9jwUqGtS.js} +2 -2
  25. package/dist/gateway/static/root/assets/{sessions-page-DJfnuATX.js.map → sessions-page-9jwUqGtS.js.map} +1 -1
  26. package/dist/gateway/static/root/assets/{settings-page-CBcPUTF-.js → settings-page-DNG3Zijx.js} +2 -2
  27. package/dist/gateway/static/root/assets/{settings-page-CBcPUTF-.js.map → settings-page-DNG3Zijx.js.map} +1 -1
  28. package/dist/gateway/static/root/assets/{skills-page-DVSS_5id.js → skills-page-BY1cLNEz.js} +2 -2
  29. package/dist/gateway/static/root/assets/{skills-page-DVSS_5id.js.map → skills-page-BY1cLNEz.js.map} +1 -1
  30. package/dist/gateway/static/root/index.html +1 -1
  31. package/dist/package.js +1 -1
  32. package/package.json +2 -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{$ as r,An as i,Bt as a,Cr as o,En as s,F as ee,Ft as c,Hn as te,I as ne,In as re,It as l,Kn as ie,Kt as u,Mt as ae,Ot as oe,Rt as d,Vt as f,Wt as p,Xn as se,a as ce,b as le,dn as m,dt as h,ft as g,i as ue,jt as de,lt as _,mn as v,nn as fe,nr as y,ot as pe,r as me,st as he,t as ge,ut as _e,x as ve,y as ye}from"./index-C5pFj5w6.js";import{C as be,S as xe,_ as Se,a as Ce,b as we,c as Te,d as Ee,f as De,g as Oe,h as ke,i as Ae,l as je,m as Me,n as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,u as ze,v as Be,x as Ve,y as He}from"./cron-utils-CMkZdWey.js";import{a as Ue,i as We,n as Ge,r as Ke,t as qe}from"./dist-D-p_Xi_b.js";var b=e(t(),1);function Je(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 x=[`daily`,`monitoring`,`reports`,`automation`],Ye=[{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 Xe(e){return Ye.find(t=>t.templateId===e)}var S=n();function Ze(e){let{cron:t,localeTag:n,scheduleBadgeLabels:r,categoryFilter:i,onCategoryFilterChange:a,onSelectTemplate:o}=e,s=i===`all`?[...Ye]:Ye.filter(e=>e.category===i);return(0,S.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.fromTemplate,children:[(0,S.jsx)(f,{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}),x.map(e=>(0,S.jsx)(f,{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,S.jsx)(`p`,{className:`text-center text-sm text-fg-muted`,children:t.templatesEmptyHint}):(0,S.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:s.map(e=>{let i=Je(t,e.templateId);if(!i)return null;let a=Pe({schedule:e.defaultSchedule,timezone:void 0,next_run:void 0},n,r);return(0,S.jsxs)(`button`,{type:`button`,className:p(`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,S.jsx)(`span`,{className:`font-semibold text-fg`,children:i.title}),(0,S.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:i.description}),(0,S.jsx)(`span`,{className:`mt-1 flex items-center gap-1 text-xs text-fg-muted`,children:(0,S.jsx)(`span`,{className:`tabular-nums`,children:a})})]},e.templateId)})})]})}var C=je(),w=p(d,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),T=p(`h-9 min-w-[6.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,c,`dark:bg-surface-panel`),Qe=p(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,c),E=p(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,c),$e=p(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,c);function et(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function D(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`).sort((e,t)=>e-t):[]}function O(e){if(e.length<2)return null;let t=e[1]-e[0];if(t<=0)return null;for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==t)return null;return t}function tt(e){let t=[];for(let n=0;n<7;n++)e[n]&&t.push(n===6?0:n+1);return t.length===0?`1`:t.sort((e,t)=>e-t).join(`,`)}function k(e){let t=[!1,!1,!1,!1,!1,!1,!1];for(let n of e){let e=n===0||n===7?6:n-1;e>=0&&e<=6&&(t[e]=!0)}return t}function nt(e){let t=e.trim(),n={mode:`custom`,intervalKind:`minutes`,onceDate:et(),intervalMinutes:5,intervalHours:2,minute:0,hour:9,weekDays:[!0,!0,!0,!0,!0,!1,!1],dayOfMonth:1,rawCron:t};if(!t)return{...n,mode:`interval`,rawCron:`*/5 * * * *`};try{let e=C.CronExpressionParser.parse(t).fields,r=D(e.minute.values),i=D(e.hour.values),a=D(e.dayOfMonth.values),o=D(e.month.values),s=D(e.dayOfWeek.values);if(r.length===60&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:1,rawCron:t};if(!e.minute.isWildcard&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&r.length>1){let e=O(r);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:e,rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&!e.hour.isWildcard&&i.length>1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=O(i);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`hours`,intervalHours:e,minute:r[0],rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&i.length===24)return{...n,mode:`hourly`,minute:r[0],rawCron:t};if(r.length===1&&i.length===1&&a.length===1&&o.length===1&&!e.dayOfMonth.isWildcard&&!e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=new Date().getFullYear(),s=o[0],ee=a[0],c=`${e}-${String(s).padStart(2,`0`)}-${String(ee).padStart(2,`0`)}`;return{...n,mode:`no_repeat`,minute:r[0],hour:i[0],onceDate:c,rawCron:t}}if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`daily`,minute:r[0],hour:i[0],rawCron:t};if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&!e.dayOfWeek.isWildcard&&s.length>0)return{...n,mode:`weekly`,minute:r[0],hour:i[0],weekDays:k(s),rawCron:t};if(r.length===1&&i.length===1&&!e.dayOfMonth.isWildcard&&a.length===1&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`monthly`,minute:r[0],hour:i[0],dayOfMonth:a[0],rawCron:t}}catch{}return n}function rt(e){let t=(e,t,n)=>Math.min(n,Math.max(t,e));switch(e.mode){case`custom`:return e.rawCron.trim()||`*/5 * * * *`;case`no_repeat`:{let n=e.onceDate.split(`-`);if(n.length===3){let r=t(parseInt(n[2],10),1,31),i=t(parseInt(n[1],10),1,12);return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${r} ${i} *`}return`0 9 1 1 *`}case`interval`:if(e.intervalKind===`hours`){let n=t(Math.round(e.intervalHours)||1,1,23);return`${t(e.minute,0,59)} */${n} * * *`}return`*/${t(Math.round(e.intervalMinutes)||5,1,59)} * * * *`;case`hourly`:return`${t(e.minute,0,59)} * * * *`;case`daily`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * *`;case`weekly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * ${tt(e.weekDays)}`;case`monthly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${t(Math.round(e.dayOfMonth)||1,1,31)} * *`;default:return`*/5 * * * *`}}function it({value:e,onChange:t,labels:n,disabled:r}){let i=(0,b.useMemo)(()=>nt(e),[e]),[a,o]=(0,b.useState)(i.mode),[s,ee]=(0,b.useState)(i.intervalKind),[c,te]=(0,b.useState)(i.onceDate),[ne,re]=(0,b.useState)(i.intervalMinutes),[l,ie]=(0,b.useState)(i.intervalHours),[u,ae]=(0,b.useState)(i.minute),[oe,d]=(0,b.useState)(i.hour),[f,se]=(0,b.useState)(i.weekDays),[ce,le]=(0,b.useState)(i.dayOfMonth),[m,h]=(0,b.useState)(i.rawCron),[g,ue]=(0,b.useState)(null),[de,_]=(0,b.useState)(null);(0,b.useEffect)(()=>{let t=nt(e);o(t.mode),ee(t.intervalKind),te(t.onceDate),re(t.intervalMinutes),ie(t.intervalHours),ae(t.minute),d(t.hour),se(t.weekDays),le(t.dayOfMonth),h(t.rawCron),ue(null),_(null)},[e]);let v=(0,b.useCallback)(e=>{t(rt({mode:a,intervalKind:s,onceDate:c,intervalMinutes:ne,intervalHours:l,minute:u,hour:oe,weekDays:f,dayOfMonth:ce,rawCron:m,...e}))},[a,s,c,ne,l,u,oe,f,ce,m,t]),fe=`${String(oe).padStart(2,`0`)}:${String(u).padStart(2,`0`)}`,y=e=>{let t=e.target.value;if(!t)return;let[n,r]=t.split(`:`).map(e=>parseInt(e,10));Number.isNaN(n)||Number.isNaN(r)||v({minute:r,hour:n})},pe=(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,S.jsxs)(`select`,{className:w,disabled:r,value:a,onChange:e=>{let t=e.target.value;o(t),v({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,S.jsx)(`option`,{value:`no_repeat`,children:n.modeNoRepeat}),(0,S.jsx)(`option`,{value:`interval`,children:n.modeInterval}),(0,S.jsx)(`option`,{value:`hourly`,children:n.modeHourly}),(0,S.jsx)(`option`,{value:`daily`,children:n.modeDaily}),(0,S.jsx)(`option`,{value:`weekly`,children:n.modeWeekly}),(0,S.jsx)(`option`,{value:`monthly`,children:n.modeMonthly}),(0,S.jsx)(`option`,{value:`custom`,children:n.modeCustom})]}),a===`no_repeat`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`input`,{type:`date`,disabled:r,className:Qe,value:c,onChange:e=>{let t=e.target.value;te(t),v({onceDate:t})},"aria-label":n.modeNoRepeat}),(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel})]}),a===`interval`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`select`,{className:p(w,`w-auto min-w-[5rem]`),disabled:r,value:s,onChange:e=>{let t=e.target.value;ee(t),ue(null),_(null),v({intervalKind:t})},"aria-label":n.modeInterval,children:[(0,S.jsx)(`option`,{value:`minutes`,children:n.intervalKindMinutes}),(0,S.jsx)(`option`,{value:`hours`,children:n.intervalKindHours})]}),s===`minutes`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:E,value:g??String(ne),onChange:e=>{let t=e.target.value;ue(t);let n=parseInt(t,10);Number.isFinite(n)&&n>=1&&n<=59&&(re(n),v({intervalMinutes:n}))},onBlur:()=>{if(g===null)return;let e=parseInt(g,10),t=!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e)));re(t),v({intervalMinutes:t}),ue(null)},"aria-label":n.intervalMinutes}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:E,value:de??String(l),onChange:e=>{let t=e.target.value;_(t);let n=parseInt(t,10);Number.isFinite(n)&&n>=1&&n<=23&&(ie(n),v({intervalHours:n}))},onBlur:()=>{if(de===null)return;let e=parseInt(de,10),t=!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e)));ie(t),v({intervalHours:t}),_(null)},"aria-label":n.intervalHours}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,S.jsx)(`select`,{className:p(w,`w-auto min-w-[4rem]`),disabled:r,value:u,onChange:e=>{let t=parseInt(e.target.value,10);ae(t),v({minute:t})},"aria-label":n.minuteAtHour,children:Array.from({length:60},(e,t)=>(0,S.jsx)(`option`,{value:t,children:String(t).padStart(2,`0`)},t))}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),a===`daily`&&(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel}),a===`weekly`&&(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel}),a===`monthly`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`select`,{className:p(w,`w-auto min-w-[4.5rem]`),disabled:r,value:ce,onChange:e=>{let t=parseInt(e.target.value,10);le(t),v({dayOfMonth:t})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))}),(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel})]}),a===`hourly`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`select`,{className:p(w,`w-auto min-w-[4rem]`),disabled:r,value:u,onChange:e=>{let t=parseInt(e.target.value,10);ae(t),v({minute:t})},"aria-label":n.minuteAtHour,children:Array.from({length:60},(e,t)=>(0,S.jsx)(`option`,{value:t,children:String(t).padStart(2,`0`)},t))}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),me=a===`weekly`?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=f[t];return(0,S.jsx)(`button`,{type:`button`,disabled:r,className:p(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...f];e[t]=!e[t],se(e),v({weekDays:e})},children:e},e)})}):null,he=a===`custom`?(0,S.jsxs)(`div`,{className:`pt-1`,children:[(0,S.jsx)(`textarea`,{disabled:r,className:$e,rows:2,spellCheck:!1,value:m,placeholder:`*/5 * * * *`,onChange:e=>{let n=e.target.value;h(n),t(n.trim()||`*/5 * * * *`)},"aria-label":n.modeCustom}),(0,S.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}),pe,me,he]})}var at=400;function ot(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function st(e){let t=ot(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function ct(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}var lt=`*/5 * * * *`,ut=`xopc.recentWorkspaceDirs.v1`,A=10;function dt(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function ft(e){let t=e.trim();if(t)try{let e=localStorage.getItem(ut),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,A);localStorage.setItem(ut,JSON.stringify(r))}catch{}}function pt(e){return p(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,c,e&&`cursor-not-allowed opacity-60`)}function mt(){return p(d,l)}var ht=p(d,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),gt=p(d,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function _t(){let e=ae(e=>e.language),t=a(e),n=t.cron,c=t.chat,l=!!oe(e=>e.token),d=de(e=>e.resolved)===`dark`,je=e===`zh`?`zh-CN`:`en-US`,[x,Ye]=(0,b.useState)([]),[C,w]=(0,b.useState)(`tasks`),[T,Qe]=(0,b.useState)(`created_desc`),[E,$e]=(0,b.useState)(`day`),[et,D]=(0,b.useState)(``),[O,tt]=(0,b.useState)(``),[k,nt]=(0,b.useState)(!1),rt=(0,b.useRef)(null),ut=(0,b.useRef)(k),A=typeof navigator<`u`&&`wakeLock`in navigator,[_t,vt]=(0,b.useState)([]),[yt,bt]=(0,b.useState)([]),[xt,St]=(0,b.useState)(``),[Ct,wt]=(0,b.useState)([]),[Tt,Et]=(0,b.useState)([]),[Dt,Ot]=(0,b.useState)(!1),[kt,j]=(0,b.useState)(null),[At,jt]=(0,b.useState)([]),[M,Mt]=(0,b.useState)(!1),[N,Nt]=(0,b.useState)(!1),[P,Pt]=(0,b.useState)(`add`),[Ft,It]=(0,b.useState)(null),[Lt,Rt]=(0,b.useState)(``),[zt,Bt]=(0,b.useState)(lt),[F,I]=(0,b.useState)(`local`),[Vt,L]=(0,b.useState)(``),[R,z]=(0,b.useState)(``),[Ht,Ut]=(0,b.useState)(`edit`),[Wt,Gt]=(0,b.useState)(0),[B,Kt]=(0,b.useState)(`main`),[qt,V]=(0,b.useState)(``),[Jt,H]=(0,b.useState)(!1),[U,W]=(0,b.useState)(``),[Yt,Xt]=(0,b.useState)(!1),[Zt,G]=(0,b.useState)(``),[K,Qt]=(0,b.useState)(!1),$t=(0,b.useRef)(!1),[en,tn]=(0,b.useState)(!1),[q,nn]=(0,b.useState)(null),[rn,an]=(0,b.useState)([]),[on,sn]=(0,b.useState)(!1),[cn,ln]=(0,b.useState)(!1),[J,un]=(0,b.useState)(null),[dn,fn]=(0,b.useState)(null),[pn,mn]=(0,b.useState)(!1),[hn,gn]=(0,b.useState)(`all`),Y=(0,b.useRef)(null),_n=(0,b.useCallback)(e=>{Y.current=e,window.setTimeout(()=>{Y.current===e&&(Y.current=null)},400)},[]),X=(0,b.useCallback)(()=>xt||(yt.length>0?yt[0].id:``),[xt,yt]),vn=typeof window<`u`&&!!window.electronAPI?.file?.openDirectory,yn=(0,b.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.file?.openDirectory:void 0;return e?e():null},[]),bn=(0,b.useCallback)(async e=>{let t=e.trim();t&&(ft(t),W(t))},[]),xn=(0,b.useMemo)(()=>{let e=new Set(Tt.map(e=>e.id)),t=[...Tt],n=qt.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[Tt,qt]),Sn=F!==`local`&&(B===`main`||B===`isolated`&&!Jt),Cn=B===`main`||B===`isolated`&&!Jt,wn=!!Lt.trim()&&!!zt.trim()&&!!R.trim()&&(!Sn||!!Vt.trim()),Z=(0,b.useCallback)(async()=>{Mt(!0);try{jt(await De(at))}catch{}finally{Mt(!1)}},[]),Q=(0,b.useCallback)(async()=>{Ot(!0),j(null);try{Ye(await He())}catch(e){j(e instanceof Error?e.message:n.failedToLoadJobs)}finally{Ot(!1)}},[n.failedToLoadJobs]),$=(0,b.useCallback)(async()=>{try{let[e,t,n,r]=await Promise.all([Fe(),Se(),Me(),ge().catch(()=>null)]);vt(e),bt(t),St(n.model||``),r&&Et(r.items)}catch{}},[]);(0,b.useEffect)(()=>{l&&(Q(),$())},[l,Q,$]),(0,b.useEffect)(()=>{!l||C!==`history`||Z()},[l,C,Z]);let Tn=(0,b.useCallback)(async()=>{try{await rt.current?.release()}catch{}rt.current=null},[]),En=(0,b.useCallback)(async()=>{if(A)try{let e=await navigator.wakeLock.request(`screen`);rt.current=e,e.addEventListener(`release`,()=>{rt.current=null})}catch{j(n.wakeLockUnavailable),nt(!1)}},[n.wakeLockUnavailable,A]);ut.current=k,(0,b.useEffect)(()=>{if(!k){Tn();return}En();let e=()=>{document.visibilityState===`visible`&&ut.current&&En()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),Tn()}},[k,En,Tn]),(0,b.useEffect)(()=>{if(!N||P!==`add`||$t.current)return;let e=X();e&&G(e)},[N,P,X]),(0,b.useEffect)(()=>{!N||P!==`add`||new Set([`local`,..._t.map(e=>e.name)]).has(F)||I(`local`)},[_t,F,P,N]),(0,b.useEffect)(()=>{if(F===`local`){wt([]);return}let e=!1;return Be(F).then(t=>{e||wt(t)}),()=>{e=!0}},[F,N]);let Dn=(0,b.useCallback)(e=>{if($t.current=!1,Nt(!0),Pt(e?`edit`:`add`),It(e?.id??null),e){Rt(e.name||``),Bt(e.schedule&&String(e.schedule).trim()||lt);let t=Ee(e);z(t??``),Kt(e.sessionTarget||`main`),V((e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``),W((e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``);let n=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;G(e.model?.trim()||n||X());let r=e.delivery?.channel===`local`,i=(e.sessionTarget||`main`)===`isolated`&&!r&&(!e.delivery?.to||e.delivery.mode===`none`);if(H(i),r)I(`local`),L(``);else if(e.delivery&&e.delivery.mode!==`none`&&e.delivery.to)I(e.delivery.channel||`telegram`),L(e.delivery.to||``);else if(i)I(`telegram`),L(``);else{let e=t.split(`:`);e.length>=3&&[`telegram`,`cli`,`gateway`,`local`].includes(e[0])?(I(e[0]),L(e[1]),z(e.slice(2).join(`:`))):(I(`telegram`),L(``))}}else Rt(``),Bt(lt),I(`local`),L(``),z(``),Kt(`main`),V(``),W(``),H(!1),G(X());Ut(`edit`),Gt(e=>e+1)},[X]),On=(0,b.useCallback)(e=>{Ut(e),e===`edit`&&Gt(e=>e+1)},[]),kn=(0,b.useCallback)(e=>{let n=Xe(e),r=n?Je(t.cron,e):void 0;!n||!r||($t.current=!1,Pt(`add`),It(null),Rt(r.title),Bt(n.defaultSchedule),z(r.prompt),Kt(n.defaultSessionTarget),I(`local`),L(``),H(!1),V(``),W(``),G(X()),Ut(`edit`),Gt(e=>e+1),mn(!1),Nt(!0))},[X,t.cron]),An=(0,b.useCallback)(()=>{Nt(!1),Pt(`add`),It(null),Rt(``),Bt(lt),I(`local`),L(``),z(``),Kt(`main`),V(``),W(``),Xt(!1),H(!1),G(``),Ut(`edit`),$t.current=!1},[]),jn=async()=>{if(!Lt.trim()){j(n.nameRequired);return}if(!zt.trim()||!R.trim()){j(n.scheduleRequired);return}if(Sn&&!Vt.trim()){j(n.chatIdRequired);return}Qt(!0),j(null);try{let e=R.trim(),t;t=B===`isolated`&&Jt?{mode:`none`}:F===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:F,to:Vt.trim()};let n=B===`isolated`?{kind:`agentTurn`,message:e,...Zt.trim()?{model:Zt.trim()}:{}}:{kind:`systemEvent`,text:e},r=Zt.trim(),i=qt.trim().toLowerCase(),a=B===`main`?null:i||null,o=U.trim(),s={name:Lt.trim(),schedule:zt.trim(),sessionTarget:B,model:B===`isolated`&&r?r:void 0,delivery:t,payload:n,...P===`edit`?{agentId:a,workingDirectory:B===`isolated`&&o||null}:{...B===`isolated`&&i?{agentId:i}:{},...B===`isolated`&&o?{workingDirectory:o}:{}}};if(P===`edit`&&Ft)await be(Ft,s);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=s;await ze(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}An(),await Q(),await $()}catch(e){j(e instanceof Error?e.message:P===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{Qt(!1)}},Mn=async e=>{tn(!0),nn(e),sn(!0),an([]);try{let t=await Oe(e.id);t&&(nn(t),an(await ke(e.id,20)))}catch{}finally{sn(!1)}},Nn=async(e,t)=>{try{await xe(e.id,t),await Q(),await $()}catch(e){j(e instanceof Error?e.message:n.failedToToggleJob)}},Pn=async()=>{if(!dn||!J)return;let e=dn,t=J;ln(!1),fn(null),un(null);try{t===`run`?await Ve(e):(await we(e),q?.id===e&&(tn(!1),nn(null))),await Q(),await $(),await Z()}catch(e){j(e instanceof Error?e.message:n.actionFailed)}};(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(N?An():en&&(tn(!1),nn(null)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[N,en,An]);let Fn={running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled},In=(0,b.useMemo)(()=>{let e=[...x];return e.sort((e,t)=>{let n=new Date(e.created_at).getTime(),r=new Date(t.created_at).getTime();return T===`created_desc`?r-n:n-r}),e},[x,T]),Ln=(0,b.useMemo)(()=>{let e=new Date,t=E===`day`?ot(e):E===`week`?st(e):ct(e);return At.filter(e=>!(new Date(e.startedAt)<t||et&&e.jobId!==et||O&&e.status!==O))},[At,E,et,O]),Rn=n.scheduleBadge,zn=(0,b.useCallback)(()=>{Q(),$(),Z()},[Q,$,Z]),Bn=r(e=>e.setPageHeader),Vn=r(e=>e.clearPageHeader),{pathname:Hn}=o(),Un=Hn.startsWith(`/settings/`),Wn=(0,b.useMemo)(()=>(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:Dt||M,title:n.refresh,"aria-label":n.refresh,onClick:()=>void zn(),children:(0,S.jsx)(m,{className:p(`size-4`,(Dt||M)&&`animate-spin`),strokeWidth:1.75})}),(0,S.jsxs)(f,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:()=>{gn(`all`),mn(!0)},children:[(0,S.jsx)(i,{className:`size-4`,strokeWidth:1.75}),n.fromTemplate]}),(0,S.jsxs)(f,{type:`button`,variant:`primary`,className:`gap-2`,onClick:()=>Dn(),children:[(0,S.jsx)(v,{className:`size-4`,strokeWidth:1.75}),n.addJob]})]}),[n.addJob,n.fromTemplate,n.refresh,Dt,Dn,zn,M]);return(0,b.useLayoutEffect)(()=>!l||Un?(Vn(),()=>Vn()):(Bn({startExtra:null,main:null,end:Wn}),()=>Vn()),[Vn,Wn,l,Un,Bn]),l?(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-surface-panel`,children:[(0,S.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[kt?(0,S.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:kt}):null,(0,S.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),(0,S.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:n.subtitle})]})}),Un?(0,S.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:Wn}):null,(0,S.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,S.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":n.title,children:[(0,S.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":C===`tasks`,className:p(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,C===`tasks`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>w(`tasks`),children:n.tabMyTasks}),(0,S.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":C===`history`,className:p(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,C===`history`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>w(`history`),children:n.tabRunHistory})]}),(0,S.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-2`,C===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`),children:C===`tasks`?(0,S.jsxs)(`select`,{className:gt,value:T,onChange:e=>Qe(e.target.value),"aria-label":n.sortCreatedDesc,children:[(0,S.jsx)(`option`,{value:`created_desc`,children:n.sortCreatedDesc}),(0,S.jsx)(`option`,{value:`created_asc`,children:n.sortCreatedAsc})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:p(ne,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,S.jsx)(`button`,{type:`button`,className:p(ee,`px-2.5 py-1`,E===e&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,E===e&&`text-fg`),onClick:()=>$e(e),children:e===`day`?n.historyRangeDay:e===`week`?n.historyRangeWeek:n.historyRangeMonth},e))}),(0,S.jsxs)(`select`,{className:gt,value:et,onChange:e=>D(e.target.value),"aria-label":n.filterAllTasks,children:[(0,S.jsx)(`option`,{value:``,children:n.filterAllTasks}),x.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))]}),(0,S.jsxs)(`select`,{className:gt,value:O,onChange:e=>tt(e.target.value),"aria-label":n.filterAllStatuses,children:[(0,S.jsx)(`option`,{value:``,children:n.filterAllStatuses}),(0,S.jsx)(`option`,{value:`success`,children:n.execStatusSuccess}),(0,S.jsx)(`option`,{value:`failed`,children:n.execStatusFailed}),(0,S.jsx)(`option`,{value:`cancelled`,children:n.execStatusCancelled}),(0,S.jsx)(`option`,{value:`running`,children:n.execStatusRunning})]})]})})]}),C===`tasks`?(0,S.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[(0,S.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),(0,S.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,S.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[(0,S.jsx)(re,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),(0,S.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[(0,S.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),(0,S.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":k,disabled:!A,title:A?void 0:n.wakeLockUnavailable,className:p(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,k?`justify-end bg-accent`:`justify-start bg-surface-hover`,!A&&`cursor-not-allowed opacity-50`),onClick:()=>{A?nt(e=>!e):j(n.wakeLockUnavailable)},children:(0,S.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]})]}),Dt&&x.length===0?(0,S.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,S.jsx)(s,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):x.length===0?(0,S.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,S.jsx)(`div`,{className:`w-full max-w-3xl`,children:(0,S.jsx)(Ze,{cron:n,localeTag:je,scheduleBadgeLabels:Rn,categoryFilter:hn,onCategoryFilterChange:gn,onSelectTemplate:kn})}),(0,S.jsx)(`div`,{className:`flex justify-center`,children:(0,S.jsx)(f,{type:`button`,variant:`primary`,onClick:()=>Dn(),children:n.emptyStateCta})})]}):(0,S.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:In.map(e=>(0,S.jsxs)(`article`,{role:`button`,tabIndex:0,className:p(`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(Y.current===e.id){Y.current=null;return}Mn(e)},onKeyDown:t=>{if(t.key===`Enter`||t.key===` `){if(t.preventDefault(),Y.current===e.id){Y.current=null;return}Mn(e)}},children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[(0,S.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,className:p(`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(),Nn(e,!e.enabled)},children:(0,S.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}),(0,S.jsxs)(We,{children:[(0,S.jsx)(Ue,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 w-8 shrink-0 p-0`,"aria-label":n.jobCardMenuAria,onClick:e=>e.stopPropagation(),children:(0,S.jsx)(se,{className:`size-4`,strokeWidth:1.75})})}),(0,S.jsx)(Ke,{children:(0,S.jsxs)(qe,{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,S.jsx)(Ge,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{_n(e.id),Dn(e)},children:n.edit}),(0,S.jsx)(Ge,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{_n(e.id),un(`run`),fn(e.id),ln(!0)},children:n.runNow}),(0,S.jsx)(Ge,{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:()=>{_n(e.id),un(`delete`),fn(e.id),ln(!0)},children:n.delete})]})})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[(0,S.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:e.name||e.id}),(0,S.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:Ee(e),children:(0,S.jsx)(le,{content:Ee(e),compact:!0})})]}),(0,S.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,S.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:Pe(e,je,Rn)})]})]},e.id))})]}):(0,S.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:n.tabRunHistory}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.runHistoryHint})]}),(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:M,title:n.refresh,"aria-label":n.refresh,onClick:()=>void Z(),children:(0,S.jsx)(m,{className:p(`size-4`,M&&`animate-spin`),strokeWidth:1.75})})]}),M&&At.length===0?(0,S.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,S.jsx)(s,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):Ln.length===0?(0,S.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,S.jsx)(y,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:At.length===0?n.emptyHistoryTitle:n.noRunsYet}),(0,S.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:At.length===0?n.emptyHistoryHint:n.runHistoryHint})]}):(0,S.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,S.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colStarted}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colJob}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.status}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDuration}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDetail}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colChat})]})}),(0,S.jsx)(`tbody`,{children:Ln.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,S.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,S.jsx)(`time`,{dateTime:e.startedAt,children:Le(e.startedAt)})}),(0,S.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:x.some(t=>t.id===e.jobId)?(0,S.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let t=x.find(t=>t.id===e.jobId);t&&Mn(t)},children:e.jobName||e.jobId}):(0,S.jsx)(`span`,{className:`text-fg-muted`,children:e.jobName||e.jobId})}),(0,S.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,S.jsx)(`span`,{className:p(`inline-flex rounded-md px-2 py-0.5 text-xs 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`,e.status===`running`&&`bg-accent/15 text-accent`,e.status===`cancelled`&&`bg-surface-hover text-fg-muted`),children:Re(e.status,Fn)})}),(0,S.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:Ie(e.duration)}),(0,S.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:e.summary||e.error||``,children:Te(e.summary||e.error,96)}),(0,S.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.sessionKey?.trim()?(0,S.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>dt(e.sessionKey),children:n.openChat}):(0,S.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]})]}),(0,S.jsx)(h,{open:N,onOpenChange:e=>!e&&An(),children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,S.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,S.jsxs)(he,{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,S.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,S.jsx)(g,{className:`text-base font-semibold text-fg`,children:P===`edit`?n.editJob:n.addJob}),(0,S.jsx)(pe,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,S.jsx)(u,{className:`size-5`,strokeWidth:1.75})})})]}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.name}),(0,S.jsx)(`input`,{type:`text`,className:pt(),value:Lt,onChange:e=>Rt(e.target.value),placeholder:n.namePlaceholder})]}),(0,S.jsx)(it,{value:zt,onChange:Bt,disabled:K,labels:n.schedulePicker}),(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.mode}),(0,S.jsxs)(`select`,{className:mt(),value:B,onChange:e=>{let t=e.target.value;Kt(t),t===`main`?(H(!1),V(``),W(``)):t===`isolated`&&!Zt.trim()&&G(X())},children:[(0,S.jsx)(`option`,{value:`main`,children:n.modeDirectOption}),(0,S.jsx)(`option`,{value:`isolated`,children:n.modeAgentOption})]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:B===`main`?n.modeDirect:n.modeAgent})]}),B===`isolated`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.model}),(0,S.jsx)(me,{value:Zt,placeholder:c.modelPlaceholder,searchPlaceholder:c.modelSearchPlaceholder,noMatches:c.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:e=>{$t.current=!0,G(e)}})]}),(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.agentProfile}),(0,S.jsxs)(`select`,{className:mt(),value:qt,disabled:K,onChange:e=>V(e.target.value),children:[(0,S.jsx)(`option`,{value:``,children:n.agentProfileDefault}),xn.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.name?`${e.id} — ${e.name}`:e.id},e.id))]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.agentProfileHint})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.workingDirectoryLabel}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:K,className:p(`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`,ye.transition,ye.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,K&&`cursor-not-allowed opacity-60`),title:U.trim()?`${U.trim()}\n${c.workingDirectory.chooseFolder}`:`${n.workingDirectoryHint}\n${c.workingDirectory.selectWorkingDirectory}`,onClick:e=>{e.stopPropagation(),!K&&(vn?(async()=>{let e=await yn();e&&bn(e)})():Xt(!0))},children:[(0,S.jsx)(te,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,S.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:U.trim()?ue(U.trim()):c.workingDirectory.notSet})]}),U.trim()?(0,S.jsx)(`button`,{type:`button`,disabled:K,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:()=>W(``),children:n.workingDirectoryReset}):null]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.workingDirectoryHint})]}),(0,S.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,S.jsx)(`input`,{type:`checkbox`,className:p(`ui-checkbox`,`mt-0.5`),checked:Jt,onChange:e=>H(e.target.checked)}),(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.agentLocalOnly}),(0,S.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.agentLocalOnlyHint})]})]})]}):null,Cn?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.channel}),(0,S.jsxs)(`select`,{className:mt(),value:F,onChange:e=>{let t=e.target.value;I(t),t===`local`&&H(!1),L(``)},children:[(0,S.jsx)(`option`,{value:`local`,children:n.channelLocal}),_t.map(e=>(0,S.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name))]})]}),Sn?(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.recipient}),(0,S.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:n.refreshRecipientHint,onClick:()=>void Be(F).then(wt),children:[(0,S.jsx)(m,{className:`size-3.5`,strokeWidth:1.75}),n.refreshList]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,S.jsx)(`input`,{type:`text`,className:p(pt(),`min-w-0 w-full sm:flex-1`),value:Vt,onChange:e=>L(e.target.value),placeholder:n.recipientPlaceholder}),(0,S.jsxs)(`select`,{className:ht,value:Vt,onChange:e=>{let t=e.target.value;t&&L(t)},children:[(0,S.jsx)(`option`,{value:``,children:n.selectRecipient}),Ct.length>0?Ct.map(e=>(0,S.jsx)(`option`,{value:e.chatId,children:Ce(e,n.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,S.jsx)(`option`,{value:``,disabled:!0,children:n.noRecentChatsOption})]})]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Ct.length>0?n.enterManuallyOrSelect:n.noRecentChats})]}):null]}):null,(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.message}),(0,S.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[(0,S.jsxs)(`button`,{type:`button`,className:p(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ht===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>On(`edit`),children:[(0,S.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),n.messageEdit]}),(0,S.jsxs)(`button`,{type:`button`,className:p(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ht===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>On(`preview`),children:[(0,S.jsx)(ie,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),n.messagePreview]})]})]}),(0,S.jsx)(`div`,{className:p(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,K&&`pointer-events-none opacity-60`),children:Ht===`edit`?(0,S.jsx)(ve,{initialContent:R,onChange:z,isDark:d,className:`h-[min(18rem,40vh)] min-h-[12rem]`},`cron-msg-${Ft??`new`}-${Wt}`):(0,S.jsx)(`div`,{className:`h-[min(18rem,40vh)] min-h-[12rem] max-h-[min(24rem,50vh)] overflow-y-auto px-3 py-2`,children:R.trim()?(0,S.jsx)(le,{content:R,compact:!0,className:`text-sm`}):(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.messagePlaceholder})})}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.messageMarkdownHint})]})]})}),(0,S.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[(0,S.jsx)(f,{type:`button`,variant:`secondary`,onClick:An,children:n.cancel}),(0,S.jsx)(f,{type:`button`,variant:`primary`,disabled:K||!wn,onClick:()=>void jn(),children:K?n.loading:P===`edit`?n.save:n.create})]})]})})]})}),vn?null:(0,S.jsx)(ce,{open:Yt,onOpenChange:Xt,initialAbsolutePath:U.trim()||void 0,onConfirm:async e=>{await bn(e),Xt(!1)},wd:c.workingDirectory}),(0,S.jsx)(h,{open:pn,onOpenChange:e=>{mn(e),e&&gn(`all`)},children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),(0,S.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,S.jsxs)(he,{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,S.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end border-b border-edge px-4 py-3`,children:[(0,S.jsx)(g,{className:`sr-only`,children:n.fromTemplate}),(0,S.jsx)(pe,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,S.jsx)(u,{className:`size-5`,strokeWidth:1.75})})})]}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,S.jsx)(Ze,{cron:n,localeTag:je,scheduleBadgeLabels:Rn,categoryFilter:hn,onCategoryFilterChange:gn,onSelectTemplate:kn})})]})})]})}),(0,S.jsx)(h,{open:en,onOpenChange:e=>{e||(tn(!1),nn(null))},children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,S.jsxs)(he,{className:p(`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,S.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,S.jsx)(g,{className:`min-w-0 truncate text-base font-semibold text-fg`,children:q?.name?.trim()||q?.id||`—`}),(0,S.jsx)(pe,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,S.jsx)(u,{className:`size-5`,strokeWidth:1.75})})})]}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:on?(0,S.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,S.jsx)(s,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):q?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleLabel}),(0,S.jsx)(`dd`,{className:`mt-1 font-mono text-fg`,children:(0,S.jsx)(`code`,{children:q.schedule})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.messageLabel}),(0,S.jsx)(`dd`,{className:`mt-1 min-w-0 break-words text-fg`,children:(0,S.jsx)(le,{content:Ee(q),compact:!0,className:`text-sm`})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.mode}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.sessionTarget===`isolated`?n.modeAgentOption:n.modeDirectOption})]}),q.sessionTarget===`isolated`?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.agentProfile}),(0,S.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:q.agentId?.trim()?q.agentId.trim():n.agentProfileDefault})]}):null,q.sessionTarget===`isolated`?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.workingDirectoryLabel}),(0,S.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:q.workingDirectory?.trim()?q.workingDirectory.trim():c.workingDirectory.notSet})]}):null,q.delivery?.channel===`local`||q.sessionTarget===`isolated`&&!q.delivery?.to?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.deliveryTarget}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.delivery?.channel===`local`?n.deliveryTargetLocalChannel:n.deliveryLocalOnly})]}):q.delivery?.to?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.deliveryTarget}),(0,S.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,S.jsx)(`code`,{className:`text-xs`,children:q.delivery?.channel??``}),` → `,Ne(q,n.channelLocal)]})]}):null,(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.status}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.enabled?n.enabled:n.disabled})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.nextRun}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.next_run?Ae(q.next_run,n.timeLabels):`—`})]})]}),(0,S.jsx)(`h3`,{className:`mt-6 text-sm font-semibold text-fg`,children:n.detailRunHistory}),rn.length===0?(0,S.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n.noRunsYet}):(0,S.jsx)(`div`,{className:`mt-2 overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colStarted}),(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.status}),(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colDuration}),(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colDetail}),(0,S.jsx)(`th`,{className:`py-1.5 font-medium`,children:n.colChat})]})}),(0,S.jsx)(`tbody`,{children:rn.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-edge/60`,children:[(0,S.jsx)(`td`,{className:`whitespace-nowrap py-1.5 pr-2 text-fg`,children:(0,S.jsx)(`time`,{dateTime:e.startedAt,children:Le(e.startedAt)})}),(0,S.jsx)(`td`,{className:`py-1.5 pr-2`,children:(0,S.jsx)(`span`,{className:p(`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:Re(e.status,Fn)})}),(0,S.jsx)(`td`,{className:`py-1.5 pr-2 text-fg-muted`,children:Ie(e.duration)}),(0,S.jsx)(`td`,{className:`max-w-[8rem] truncate py-1.5 pr-2 text-fg-muted`,title:e.summary||e.error||``,children:Te(e.summary||e.error,120)}),(0,S.jsx)(`td`,{className:`whitespace-nowrap py-1.5`,children:e.sessionKey?.trim()?(0,S.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>dt(e.sessionKey),children:n.openChat}):(0,S.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]}):null})]})]})}),(0,S.jsx)(h,{open:cn,onOpenChange:ln,children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),(0,S.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,S.jsxs)(he,{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,S.jsx)(g,{className:`text-base font-semibold text-fg`,children:J===`delete`?n.delete:n.runNow}),(0,S.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:J===`delete`?n.confirmDelete:n.confirmRun}),(0,S.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,S.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>{ln(!1),fn(null),un(null)},children:n.cancel}),(0,S.jsx)(f,{type:`button`,variant:`primary`,className:J===`delete`?`bg-red-600 hover:bg-red-700`:void 0,onClick:()=>void Pn(),children:J===`delete`?n.delete:n.runNow})]})]})})]})})]}):(0,S.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{_t as CronPage};
2
- //# sourceMappingURL=cron-page-VjRx7Jtc.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{$ as r,An as i,Bt as a,Cr as o,En as s,F as ee,Ft as c,Hn as te,I as ne,In as re,It as l,Kn as ie,Kt as u,Mt as ae,Ot as oe,Rt as d,Vt as f,Wt as p,Xn as se,a as ce,b as le,dn as m,dt as h,ft as g,i as ue,jt as de,lt as _,mn as v,nn as fe,nr as y,ot as pe,r as me,st as he,t as ge,ut as _e,x as ve,y as ye}from"./index-KGmhufWu.js";import{C as be,S as xe,_ as Se,a as Ce,b as we,c as Te,d as Ee,f as De,g as Oe,h as ke,i as Ae,l as je,m as Me,n as Ne,o as Pe,p as Fe,r as Ie,s as Le,t as Re,u as ze,v as Be,x as Ve,y as He}from"./cron-utils-o-QI_XCC.js";import{a as Ue,i as We,n as Ge,r as Ke,t as qe}from"./dist-D2Td6E_v.js";var b=e(t(),1);function Je(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 x=[`daily`,`monitoring`,`reports`,`automation`],Ye=[{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 Xe(e){return Ye.find(t=>t.templateId===e)}var S=n();function Ze(e){let{cron:t,localeTag:n,scheduleBadgeLabels:r,categoryFilter:i,onCategoryFilterChange:a,onSelectTemplate:o}=e,s=i===`all`?[...Ye]:Ye.filter(e=>e.category===i);return(0,S.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.fromTemplate,children:[(0,S.jsx)(f,{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}),x.map(e=>(0,S.jsx)(f,{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,S.jsx)(`p`,{className:`text-center text-sm text-fg-muted`,children:t.templatesEmptyHint}):(0,S.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:s.map(e=>{let i=Je(t,e.templateId);if(!i)return null;let a=Pe({schedule:e.defaultSchedule,timezone:void 0,next_run:void 0},n,r);return(0,S.jsxs)(`button`,{type:`button`,className:p(`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,S.jsx)(`span`,{className:`font-semibold text-fg`,children:i.title}),(0,S.jsx)(`span`,{className:`line-clamp-2 text-sm text-fg-muted`,children:i.description}),(0,S.jsx)(`span`,{className:`mt-1 flex items-center gap-1 text-xs text-fg-muted`,children:(0,S.jsx)(`span`,{className:`tabular-nums`,children:a})})]},e.templateId)})})]})}var C=je(),w=p(d,`min-w-0 shrink text-xs sm:min-w-[7rem] sm:max-w-[11rem]`),T=p(`h-9 min-w-[6.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,c,`dark:bg-surface-panel`),Qe=p(`h-9 min-w-[9.5rem] shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-sm text-fg`,c),E=p(`h-9 w-14 shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1.5 text-center text-sm tabular-nums text-fg`,c),$e=p(`min-h-[2.5rem] w-full rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 font-mono text-xs text-fg`,c);function et(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function D(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`).sort((e,t)=>e-t):[]}function O(e){if(e.length<2)return null;let t=e[1]-e[0];if(t<=0)return null;for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==t)return null;return t}function tt(e){let t=[];for(let n=0;n<7;n++)e[n]&&t.push(n===6?0:n+1);return t.length===0?`1`:t.sort((e,t)=>e-t).join(`,`)}function k(e){let t=[!1,!1,!1,!1,!1,!1,!1];for(let n of e){let e=n===0||n===7?6:n-1;e>=0&&e<=6&&(t[e]=!0)}return t}function nt(e){let t=e.trim(),n={mode:`custom`,intervalKind:`minutes`,onceDate:et(),intervalMinutes:5,intervalHours:2,minute:0,hour:9,weekDays:[!0,!0,!0,!0,!0,!1,!1],dayOfMonth:1,rawCron:t};if(!t)return{...n,mode:`interval`,rawCron:`*/5 * * * *`};try{let e=C.CronExpressionParser.parse(t).fields,r=D(e.minute.values),i=D(e.hour.values),a=D(e.dayOfMonth.values),o=D(e.month.values),s=D(e.dayOfWeek.values);if(r.length===60&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:1,rawCron:t};if(!e.minute.isWildcard&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&r.length>1){let e=O(r);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:e,rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&!e.hour.isWildcard&&i.length>1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=O(i);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`hours`,intervalHours:e,minute:r[0],rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&i.length===24)return{...n,mode:`hourly`,minute:r[0],rawCron:t};if(r.length===1&&i.length===1&&a.length===1&&o.length===1&&!e.dayOfMonth.isWildcard&&!e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=new Date().getFullYear(),s=o[0],ee=a[0],c=`${e}-${String(s).padStart(2,`0`)}-${String(ee).padStart(2,`0`)}`;return{...n,mode:`no_repeat`,minute:r[0],hour:i[0],onceDate:c,rawCron:t}}if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`daily`,minute:r[0],hour:i[0],rawCron:t};if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&!e.dayOfWeek.isWildcard&&s.length>0)return{...n,mode:`weekly`,minute:r[0],hour:i[0],weekDays:k(s),rawCron:t};if(r.length===1&&i.length===1&&!e.dayOfMonth.isWildcard&&a.length===1&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`monthly`,minute:r[0],hour:i[0],dayOfMonth:a[0],rawCron:t}}catch{}return n}function rt(e){let t=(e,t,n)=>Math.min(n,Math.max(t,e));switch(e.mode){case`custom`:return e.rawCron.trim()||`*/5 * * * *`;case`no_repeat`:{let n=e.onceDate.split(`-`);if(n.length===3){let r=t(parseInt(n[2],10),1,31),i=t(parseInt(n[1],10),1,12);return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${r} ${i} *`}return`0 9 1 1 *`}case`interval`:if(e.intervalKind===`hours`){let n=t(Math.round(e.intervalHours)||1,1,23);return`${t(e.minute,0,59)} */${n} * * *`}return`*/${t(Math.round(e.intervalMinutes)||5,1,59)} * * * *`;case`hourly`:return`${t(e.minute,0,59)} * * * *`;case`daily`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * *`;case`weekly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * ${tt(e.weekDays)}`;case`monthly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${t(Math.round(e.dayOfMonth)||1,1,31)} * *`;default:return`*/5 * * * *`}}function it({value:e,onChange:t,labels:n,disabled:r}){let i=(0,b.useMemo)(()=>nt(e),[e]),[a,o]=(0,b.useState)(i.mode),[s,ee]=(0,b.useState)(i.intervalKind),[c,te]=(0,b.useState)(i.onceDate),[ne,re]=(0,b.useState)(i.intervalMinutes),[l,ie]=(0,b.useState)(i.intervalHours),[u,ae]=(0,b.useState)(i.minute),[oe,d]=(0,b.useState)(i.hour),[f,se]=(0,b.useState)(i.weekDays),[ce,le]=(0,b.useState)(i.dayOfMonth),[m,h]=(0,b.useState)(i.rawCron),[g,ue]=(0,b.useState)(null),[de,_]=(0,b.useState)(null);(0,b.useEffect)(()=>{let t=nt(e);o(t.mode),ee(t.intervalKind),te(t.onceDate),re(t.intervalMinutes),ie(t.intervalHours),ae(t.minute),d(t.hour),se(t.weekDays),le(t.dayOfMonth),h(t.rawCron),ue(null),_(null)},[e]);let v=(0,b.useCallback)(e=>{t(rt({mode:a,intervalKind:s,onceDate:c,intervalMinutes:ne,intervalHours:l,minute:u,hour:oe,weekDays:f,dayOfMonth:ce,rawCron:m,...e}))},[a,s,c,ne,l,u,oe,f,ce,m,t]),fe=`${String(oe).padStart(2,`0`)}:${String(u).padStart(2,`0`)}`,y=e=>{let t=e.target.value;if(!t)return;let[n,r]=t.split(`:`).map(e=>parseInt(e,10));Number.isNaN(n)||Number.isNaN(r)||v({minute:r,hour:n})},pe=(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-nowrap items-center gap-2 overflow-x-auto pb-0.5`,children:[(0,S.jsxs)(`select`,{className:w,disabled:r,value:a,onChange:e=>{let t=e.target.value;o(t),v({mode:t})},"aria-label":n.scheduleTimeLabel,children:[(0,S.jsx)(`option`,{value:`no_repeat`,children:n.modeNoRepeat}),(0,S.jsx)(`option`,{value:`interval`,children:n.modeInterval}),(0,S.jsx)(`option`,{value:`hourly`,children:n.modeHourly}),(0,S.jsx)(`option`,{value:`daily`,children:n.modeDaily}),(0,S.jsx)(`option`,{value:`weekly`,children:n.modeWeekly}),(0,S.jsx)(`option`,{value:`monthly`,children:n.modeMonthly}),(0,S.jsx)(`option`,{value:`custom`,children:n.modeCustom})]}),a===`no_repeat`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`input`,{type:`date`,disabled:r,className:Qe,value:c,onChange:e=>{let t=e.target.value;te(t),v({onceDate:t})},"aria-label":n.modeNoRepeat}),(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel})]}),a===`interval`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`select`,{className:p(w,`w-auto min-w-[5rem]`),disabled:r,value:s,onChange:e=>{let t=e.target.value;ee(t),ue(null),_(null),v({intervalKind:t})},"aria-label":n.modeInterval,children:[(0,S.jsx)(`option`,{value:`minutes`,children:n.intervalKindMinutes}),(0,S.jsx)(`option`,{value:`hours`,children:n.intervalKindHours})]}),s===`minutes`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`input`,{type:`number`,min:1,max:59,disabled:r,className:E,value:g??String(ne),onChange:e=>{let t=e.target.value;ue(t);let n=parseInt(t,10);Number.isFinite(n)&&n>=1&&n<=59&&(re(n),v({intervalMinutes:n}))},onBlur:()=>{if(g===null)return;let e=parseInt(g,10),t=!Number.isFinite(e)||e<1?5:Math.min(59,Math.max(1,Math.round(e)));re(t),v({intervalMinutes:t}),ue(null)},"aria-label":n.intervalMinutes}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`input`,{type:`number`,min:1,max:23,disabled:r,className:E,value:de??String(l),onChange:e=>{let t=e.target.value;_(t);let n=parseInt(t,10);Number.isFinite(n)&&n>=1&&n<=23&&(ie(n),v({intervalHours:n}))},onBlur:()=>{if(de===null)return;let e=parseInt(de,10),t=!Number.isFinite(e)||e<1?2:Math.min(23,Math.max(1,Math.round(e)));ie(t),v({intervalHours:t}),_(null)},"aria-label":n.intervalHours}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.hourUnit}),(0,S.jsx)(`select`,{className:p(w,`w-auto min-w-[4rem]`),disabled:r,value:u,onChange:e=>{let t=parseInt(e.target.value,10);ae(t),v({minute:t})},"aria-label":n.minuteAtHour,children:Array.from({length:60},(e,t)=>(0,S.jsx)(`option`,{value:t,children:String(t).padStart(2,`0`)},t))}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),a===`daily`&&(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel}),a===`weekly`&&(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel}),a===`monthly`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`select`,{className:p(w,`w-auto min-w-[4.5rem]`),disabled:r,value:ce,onChange:e=>{let t=parseInt(e.target.value,10);le(t),v({dayOfMonth:t})},"aria-label":n.dayOfMonth,children:Array.from({length:31},(e,t)=>t+1).map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))}),(0,S.jsx)(`input`,{type:`time`,step:60,disabled:r,className:T,value:fe,onChange:y,"aria-label":n.scheduleTimeLabel})]}),a===`hourly`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`select`,{className:p(w,`w-auto min-w-[4rem]`),disabled:r,value:u,onChange:e=>{let t=parseInt(e.target.value,10);ae(t),v({minute:t})},"aria-label":n.minuteAtHour,children:Array.from({length:60},(e,t)=>(0,S.jsx)(`option`,{value:t,children:String(t).padStart(2,`0`)},t))}),(0,S.jsx)(`span`,{className:`shrink-0 text-sm text-fg-muted`,children:n.minuteUnit})]})]}),me=a===`weekly`?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,role:`group`,"aria-label":n.modeWeekly,children:n.weekdays.map((e,t)=>{let n=f[t];return(0,S.jsx)(`button`,{type:`button`,disabled:r,className:p(`flex size-9 select-none items-center justify-center rounded-full border text-xs font-medium transition-colors`,n?`border-fg bg-fg text-surface-panel`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),"aria-pressed":n,onClick:()=>{let e=[...f];e[t]=!e[t],se(e),v({weekDays:e})},children:e},e)})}):null,he=a===`custom`?(0,S.jsxs)(`div`,{className:`pt-1`,children:[(0,S.jsx)(`textarea`,{disabled:r,className:$e,rows:2,spellCheck:!1,value:m,placeholder:`*/5 * * * *`,onChange:e=>{let n=e.target.value;h(n),t(n.trim()||`*/5 * * * *`)},"aria-label":n.modeCustom}),(0,S.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.customCronHint})]}):null;return(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleTimeLabel}),pe,me,he]})}var at=400;function ot(e){let t=new Date(e);return t.setHours(0,0,0,0),t}function st(e){let t=ot(e),n=t.getDay(),r=n===0?-6:1-n;return t.setDate(t.getDate()+r),t}function ct(e){return new Date(e.getFullYear(),e.getMonth(),1,0,0,0,0)}var lt=`*/5 * * * *`,ut=`xopc.recentWorkspaceDirs.v1`,A=10;function dt(e){let t=e?.trim();t&&window.dispatchEvent(new CustomEvent(`navigate-to-chat`,{detail:{sessionKey:t},bubbles:!0}))}function ft(e){let t=e.trim();if(t)try{let e=localStorage.getItem(ut),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,A);localStorage.setItem(ut,JSON.stringify(r))}catch{}}function pt(e){return p(`w-full rounded-md border border-edge bg-surface-base px-3 py-2 text-sm text-fg placeholder:text-fg-disabled`,c,e&&`cursor-not-allowed opacity-60`)}function mt(){return p(d,l)}var ht=p(d,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`),gt=p(d,`w-auto min-w-[9rem] max-w-[14rem] shrink-0 text-xs`);function _t(){let e=ae(e=>e.language),t=a(e),n=t.cron,c=t.chat,l=!!oe(e=>e.token),d=de(e=>e.resolved)===`dark`,je=e===`zh`?`zh-CN`:`en-US`,[x,Ye]=(0,b.useState)([]),[C,w]=(0,b.useState)(`tasks`),[T,Qe]=(0,b.useState)(`created_desc`),[E,$e]=(0,b.useState)(`day`),[et,D]=(0,b.useState)(``),[O,tt]=(0,b.useState)(``),[k,nt]=(0,b.useState)(!1),rt=(0,b.useRef)(null),ut=(0,b.useRef)(k),A=typeof navigator<`u`&&`wakeLock`in navigator,[_t,vt]=(0,b.useState)([]),[yt,bt]=(0,b.useState)([]),[xt,St]=(0,b.useState)(``),[Ct,wt]=(0,b.useState)([]),[Tt,Et]=(0,b.useState)([]),[Dt,Ot]=(0,b.useState)(!1),[kt,j]=(0,b.useState)(null),[At,jt]=(0,b.useState)([]),[M,Mt]=(0,b.useState)(!1),[N,Nt]=(0,b.useState)(!1),[P,Pt]=(0,b.useState)(`add`),[Ft,It]=(0,b.useState)(null),[Lt,Rt]=(0,b.useState)(``),[zt,Bt]=(0,b.useState)(lt),[F,I]=(0,b.useState)(`local`),[Vt,L]=(0,b.useState)(``),[R,z]=(0,b.useState)(``),[Ht,Ut]=(0,b.useState)(`edit`),[Wt,Gt]=(0,b.useState)(0),[B,Kt]=(0,b.useState)(`main`),[qt,V]=(0,b.useState)(``),[Jt,H]=(0,b.useState)(!1),[U,W]=(0,b.useState)(``),[Yt,Xt]=(0,b.useState)(!1),[Zt,G]=(0,b.useState)(``),[K,Qt]=(0,b.useState)(!1),$t=(0,b.useRef)(!1),[en,tn]=(0,b.useState)(!1),[q,nn]=(0,b.useState)(null),[rn,an]=(0,b.useState)([]),[on,sn]=(0,b.useState)(!1),[cn,ln]=(0,b.useState)(!1),[J,un]=(0,b.useState)(null),[dn,fn]=(0,b.useState)(null),[pn,mn]=(0,b.useState)(!1),[hn,gn]=(0,b.useState)(`all`),Y=(0,b.useRef)(null),_n=(0,b.useCallback)(e=>{Y.current=e,window.setTimeout(()=>{Y.current===e&&(Y.current=null)},400)},[]),X=(0,b.useCallback)(()=>xt||(yt.length>0?yt[0].id:``),[xt,yt]),vn=typeof window<`u`&&!!window.electronAPI?.file?.openDirectory,yn=(0,b.useCallback)(async()=>{let e=typeof window<`u`?window.electronAPI?.file?.openDirectory:void 0;return e?e():null},[]),bn=(0,b.useCallback)(async e=>{let t=e.trim();t&&(ft(t),W(t))},[]),xn=(0,b.useMemo)(()=>{let e=new Set(Tt.map(e=>e.id)),t=[...Tt],n=qt.trim().toLowerCase();return n&&!e.has(n)&&t.push({id:n}),t},[Tt,qt]),Sn=F!==`local`&&(B===`main`||B===`isolated`&&!Jt),Cn=B===`main`||B===`isolated`&&!Jt,wn=!!Lt.trim()&&!!zt.trim()&&!!R.trim()&&(!Sn||!!Vt.trim()),Z=(0,b.useCallback)(async()=>{Mt(!0);try{jt(await De(at))}catch{}finally{Mt(!1)}},[]),Q=(0,b.useCallback)(async()=>{Ot(!0),j(null);try{Ye(await He())}catch(e){j(e instanceof Error?e.message:n.failedToLoadJobs)}finally{Ot(!1)}},[n.failedToLoadJobs]),$=(0,b.useCallback)(async()=>{try{let[e,t,n,r]=await Promise.all([Fe(),Se(),Me(),ge().catch(()=>null)]);vt(e),bt(t),St(n.model||``),r&&Et(r.items)}catch{}},[]);(0,b.useEffect)(()=>{l&&(Q(),$())},[l,Q,$]),(0,b.useEffect)(()=>{!l||C!==`history`||Z()},[l,C,Z]);let Tn=(0,b.useCallback)(async()=>{try{await rt.current?.release()}catch{}rt.current=null},[]),En=(0,b.useCallback)(async()=>{if(A)try{let e=await navigator.wakeLock.request(`screen`);rt.current=e,e.addEventListener(`release`,()=>{rt.current=null})}catch{j(n.wakeLockUnavailable),nt(!1)}},[n.wakeLockUnavailable,A]);ut.current=k,(0,b.useEffect)(()=>{if(!k){Tn();return}En();let e=()=>{document.visibilityState===`visible`&&ut.current&&En()};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),Tn()}},[k,En,Tn]),(0,b.useEffect)(()=>{if(!N||P!==`add`||$t.current)return;let e=X();e&&G(e)},[N,P,X]),(0,b.useEffect)(()=>{!N||P!==`add`||new Set([`local`,..._t.map(e=>e.name)]).has(F)||I(`local`)},[_t,F,P,N]),(0,b.useEffect)(()=>{if(F===`local`){wt([]);return}let e=!1;return Be(F).then(t=>{e||wt(t)}),()=>{e=!0}},[F,N]);let Dn=(0,b.useCallback)(e=>{if($t.current=!1,Nt(!0),Pt(e?`edit`:`add`),It(e?.id??null),e){Rt(e.name||``),Bt(e.schedule&&String(e.schedule).trim()||lt);let t=Ee(e);z(t??``),Kt(e.sessionTarget||`main`),V((e.sessionTarget||`main`)===`isolated`&&e.agentId?.trim()?e.agentId.trim().toLowerCase():``),W((e.sessionTarget||`main`)===`isolated`&&e.workingDirectory?.trim()?e.workingDirectory.trim():``);let n=e.payload?.kind===`agentTurn`&&e.payload.model?.trim()?e.payload.model.trim():``;G(e.model?.trim()||n||X());let r=e.delivery?.channel===`local`,i=(e.sessionTarget||`main`)===`isolated`&&!r&&(!e.delivery?.to||e.delivery.mode===`none`);if(H(i),r)I(`local`),L(``);else if(e.delivery&&e.delivery.mode!==`none`&&e.delivery.to)I(e.delivery.channel||`telegram`),L(e.delivery.to||``);else if(i)I(`telegram`),L(``);else{let e=t.split(`:`);e.length>=3&&[`telegram`,`cli`,`gateway`,`local`].includes(e[0])?(I(e[0]),L(e[1]),z(e.slice(2).join(`:`))):(I(`telegram`),L(``))}}else Rt(``),Bt(lt),I(`local`),L(``),z(``),Kt(`main`),V(``),W(``),H(!1),G(X());Ut(`edit`),Gt(e=>e+1)},[X]),On=(0,b.useCallback)(e=>{Ut(e),e===`edit`&&Gt(e=>e+1)},[]),kn=(0,b.useCallback)(e=>{let n=Xe(e),r=n?Je(t.cron,e):void 0;!n||!r||($t.current=!1,Pt(`add`),It(null),Rt(r.title),Bt(n.defaultSchedule),z(r.prompt),Kt(n.defaultSessionTarget),I(`local`),L(``),H(!1),V(``),W(``),G(X()),Ut(`edit`),Gt(e=>e+1),mn(!1),Nt(!0))},[X,t.cron]),An=(0,b.useCallback)(()=>{Nt(!1),Pt(`add`),It(null),Rt(``),Bt(lt),I(`local`),L(``),z(``),Kt(`main`),V(``),W(``),Xt(!1),H(!1),G(``),Ut(`edit`),$t.current=!1},[]),jn=async()=>{if(!Lt.trim()){j(n.nameRequired);return}if(!zt.trim()||!R.trim()){j(n.scheduleRequired);return}if(Sn&&!Vt.trim()){j(n.chatIdRequired);return}Qt(!0),j(null);try{let e=R.trim(),t;t=B===`isolated`&&Jt?{mode:`none`}:F===`local`?{mode:`direct`,channel:`local`}:{mode:`direct`,channel:F,to:Vt.trim()};let n=B===`isolated`?{kind:`agentTurn`,message:e,...Zt.trim()?{model:Zt.trim()}:{}}:{kind:`systemEvent`,text:e},r=Zt.trim(),i=qt.trim().toLowerCase(),a=B===`main`?null:i||null,o=U.trim(),s={name:Lt.trim(),schedule:zt.trim(),sessionTarget:B,model:B===`isolated`&&r?r:void 0,delivery:t,payload:n,...P===`edit`?{agentId:a,workingDirectory:B===`isolated`&&o||null}:{...B===`isolated`&&i?{agentId:i}:{},...B===`isolated`&&o?{workingDirectory:o}:{}}};if(P===`edit`&&Ft)await be(Ft,s);else{let{schedule:e,agentId:t,workingDirectory:n,...r}=s;await ze(e,{...r,...t==null?{}:{agentId:t},...n?{workingDirectory:n}:{}})}An(),await Q(),await $()}catch(e){j(e instanceof Error?e.message:P===`edit`?n.failedToUpdateJob:n.failedToCreateJob)}finally{Qt(!1)}},Mn=async e=>{tn(!0),nn(e),sn(!0),an([]);try{let t=await Oe(e.id);t&&(nn(t),an(await ke(e.id,20)))}catch{}finally{sn(!1)}},Nn=async(e,t)=>{try{await xe(e.id,t),await Q(),await $()}catch(e){j(e instanceof Error?e.message:n.failedToToggleJob)}},Pn=async()=>{if(!dn||!J)return;let e=dn,t=J;ln(!1),fn(null),un(null);try{t===`run`?await Ve(e):(await we(e),q?.id===e&&(tn(!1),nn(null))),await Q(),await $(),await Z()}catch(e){j(e instanceof Error?e.message:n.actionFailed)}};(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(N?An():en&&(tn(!1),nn(null)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[N,en,An]);let Fn={running:n.execStatusRunning,success:n.execStatusSuccess,failed:n.execStatusFailed,cancelled:n.execStatusCancelled},In=(0,b.useMemo)(()=>{let e=[...x];return e.sort((e,t)=>{let n=new Date(e.created_at).getTime(),r=new Date(t.created_at).getTime();return T===`created_desc`?r-n:n-r}),e},[x,T]),Ln=(0,b.useMemo)(()=>{let e=new Date,t=E===`day`?ot(e):E===`week`?st(e):ct(e);return At.filter(e=>!(new Date(e.startedAt)<t||et&&e.jobId!==et||O&&e.status!==O))},[At,E,et,O]),Rn=n.scheduleBadge,zn=(0,b.useCallback)(()=>{Q(),$(),Z()},[Q,$,Z]),Bn=r(e=>e.setPageHeader),Vn=r(e=>e.clearPageHeader),{pathname:Hn}=o(),Un=Hn.startsWith(`/settings/`),Wn=(0,b.useMemo)(()=>(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:Dt||M,title:n.refresh,"aria-label":n.refresh,onClick:()=>void zn(),children:(0,S.jsx)(m,{className:p(`size-4`,(Dt||M)&&`animate-spin`),strokeWidth:1.75})}),(0,S.jsxs)(f,{type:`button`,variant:`secondary`,className:`gap-2`,onClick:()=>{gn(`all`),mn(!0)},children:[(0,S.jsx)(i,{className:`size-4`,strokeWidth:1.75}),n.fromTemplate]}),(0,S.jsxs)(f,{type:`button`,variant:`primary`,className:`gap-2`,onClick:()=>Dn(),children:[(0,S.jsx)(v,{className:`size-4`,strokeWidth:1.75}),n.addJob]})]}),[n.addJob,n.fromTemplate,n.refresh,Dt,Dn,zn,M]);return(0,b.useLayoutEffect)(()=>!l||Un?(Vn(),()=>Vn()):(Bn({startExtra:null,main:null,end:Wn}),()=>Vn()),[Vn,Wn,l,Un,Bn]),l?(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto bg-surface-panel`,children:[(0,S.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6 sm:px-8`,children:[kt?(0,S.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:kt}):null,(0,S.jsx)(`header`,{className:`flex flex-col gap-4`,children:(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight text-fg`,children:n.title}),(0,S.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:n.subtitle})]})}),Un?(0,S.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:Wn}):null,(0,S.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,S.jsxs)(`div`,{className:`flex gap-1`,role:`tablist`,"aria-label":n.title,children:[(0,S.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":C===`tasks`,className:p(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,C===`tasks`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>w(`tasks`),children:n.tabMyTasks}),(0,S.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":C===`history`,className:p(`rounded-md px-3 py-2 text-sm font-medium transition-colors`,C===`history`?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>w(`history`),children:n.tabRunHistory})]}),(0,S.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-2`,C===`history`?`flex-nowrap overflow-x-auto pb-0.5 sm:justify-end`:`flex-wrap sm:justify-end`),children:C===`tasks`?(0,S.jsxs)(`select`,{className:gt,value:T,onChange:e=>Qe(e.target.value),"aria-label":n.sortCreatedDesc,children:[(0,S.jsx)(`option`,{value:`created_desc`,children:n.sortCreatedDesc}),(0,S.jsx)(`option`,{value:`created_asc`,children:n.sortCreatedAsc})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:p(ne,`shrink-0`),role:`group`,"aria-label":n.runHistoryTitle,children:[`day`,`week`,`month`].map(e=>(0,S.jsx)(`button`,{type:`button`,className:p(ee,`px-2.5 py-1`,E===e&&`bg-surface-panel shadow-sm dark:bg-surface-panel dark:shadow-sm dark:ring-1 dark:ring-edge-strong/40`,E===e&&`text-fg`),onClick:()=>$e(e),children:e===`day`?n.historyRangeDay:e===`week`?n.historyRangeWeek:n.historyRangeMonth},e))}),(0,S.jsxs)(`select`,{className:gt,value:et,onChange:e=>D(e.target.value),"aria-label":n.filterAllTasks,children:[(0,S.jsx)(`option`,{value:``,children:n.filterAllTasks}),x.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.name||e.id},e.id))]}),(0,S.jsxs)(`select`,{className:gt,value:O,onChange:e=>tt(e.target.value),"aria-label":n.filterAllStatuses,children:[(0,S.jsx)(`option`,{value:``,children:n.filterAllStatuses}),(0,S.jsx)(`option`,{value:`success`,children:n.execStatusSuccess}),(0,S.jsx)(`option`,{value:`failed`,children:n.execStatusFailed}),(0,S.jsx)(`option`,{value:`cancelled`,children:n.execStatusCancelled}),(0,S.jsx)(`option`,{value:`running`,children:n.execStatusRunning})]})]})})]}),C===`tasks`?(0,S.jsxs)(`section`,{"aria-labelledby":`cron-tasks-panel`,className:`flex flex-col gap-4`,children:[(0,S.jsx)(`h2`,{id:`cron-tasks-panel`,className:`sr-only`,children:n.tabMyTasks}),(0,S.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,S.jsxs)(`div`,{className:`flex gap-3 text-sm text-fg`,children:[(0,S.jsx)(re,{className:`mt-0.5 size-4 shrink-0 text-accent`,strokeWidth:1.75,"aria-hidden":!0}),(0,S.jsx)(`p`,{className:`text-pretty text-fg-muted`,children:n.wakeBanner})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 sm:pl-4`,children:[(0,S.jsx)(`span`,{className:`text-sm text-fg`,children:n.keepAwake}),(0,S.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":k,disabled:!A,title:A?void 0:n.wakeLockUnavailable,className:p(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,k?`justify-end bg-accent`:`justify-start bg-surface-hover`,!A&&`cursor-not-allowed opacity-50`),onClick:()=>{A?nt(e=>!e):j(n.wakeLockUnavailable)},children:(0,S.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]})]}),Dt&&x.length===0?(0,S.jsx)(`div`,{className:`flex justify-center py-16`,"aria-busy":`true`,children:(0,S.jsx)(s,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):x.length===0?(0,S.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,S.jsx)(`div`,{className:`w-full max-w-3xl`,children:(0,S.jsx)(Ze,{cron:n,localeTag:je,scheduleBadgeLabels:Rn,categoryFilter:hn,onCategoryFilterChange:gn,onSelectTemplate:kn})}),(0,S.jsx)(`div`,{className:`flex justify-center`,children:(0,S.jsx)(f,{type:`button`,variant:`primary`,onClick:()=>Dn(),children:n.emptyStateCta})})]}):(0,S.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:In.map(e=>(0,S.jsxs)(`article`,{role:`button`,tabIndex:0,className:p(`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(Y.current===e.id){Y.current=null;return}Mn(e)},onKeyDown:t=>{if(t.key===`Enter`||t.key===` `){if(t.preventDefault(),Y.current===e.id){Y.current=null;return}Mn(e)}},children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-2 px-4 pt-3`,children:[(0,S.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,className:p(`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(),Nn(e,!e.enabled)},children:(0,S.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})}),(0,S.jsxs)(We,{children:[(0,S.jsx)(Ue,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 w-8 shrink-0 p-0`,"aria-label":n.jobCardMenuAria,onClick:e=>e.stopPropagation(),children:(0,S.jsx)(se,{className:`size-4`,strokeWidth:1.75})})}),(0,S.jsx)(Ke,{children:(0,S.jsxs)(qe,{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,S.jsx)(Ge,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{_n(e.id),Dn(e)},children:n.edit}),(0,S.jsx)(Ge,{className:`cursor-pointer select-none rounded-lg px-2 py-1.5 text-sm text-fg outline-none data-highlighted:bg-surface-hover`,onSelect:()=>{_n(e.id),un(`run`),fn(e.id),ln(!0)},children:n.runNow}),(0,S.jsx)(Ge,{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:()=>{_n(e.id),un(`delete`),fn(e.id),ln(!0)},children:n.delete})]})})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-1 flex-col gap-2 px-4 pb-3 pt-2`,children:[(0,S.jsx)(`h3`,{className:`line-clamp-2 font-semibold text-fg`,children:e.name||e.id}),(0,S.jsx)(`div`,{className:`max-h-[4.5rem] overflow-hidden text-sm text-fg-muted [&_.markdown-body]:text-sm [&_.markdown-body]:leading-snug`,title:Ee(e),children:(0,S.jsx)(le,{content:Ee(e),compact:!0})})]}),(0,S.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,S.jsx)(y,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,S.jsx)(`span`,{className:`min-w-0 truncate`,children:Pe(e,je,Rn)})]})]},e.id))})]}):(0,S.jsxs)(`section`,{"aria-labelledby":`cron-history-panel`,className:`flex flex-col gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{id:`cron-history-panel`,className:`sr-only`,children:n.tabRunHistory}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.runHistoryHint})]}),(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,disabled:M,title:n.refresh,"aria-label":n.refresh,onClick:()=>void Z(),children:(0,S.jsx)(m,{className:p(`size-4`,M&&`animate-spin`),strokeWidth:1.75})})]}),M&&At.length===0?(0,S.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,S.jsx)(s,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):Ln.length===0?(0,S.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,S.jsx)(y,{className:`mb-4 size-14 text-fg-disabled`,strokeWidth:1.1,"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:At.length===0?n.emptyHistoryTitle:n.noRunsYet}),(0,S.jsx)(`p`,{className:`mt-2 max-w-sm text-sm text-fg-muted`,children:At.length===0?n.emptyHistoryHint:n.runHistoryHint})]}):(0,S.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-edge-subtle bg-surface-base dark:border-edge-subtle`,children:(0,S.jsxs)(`table`,{className:`w-full min-w-[700px] border-collapse text-left text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-edge text-xs font-medium text-fg-muted`,children:[(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colStarted}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colJob}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.status}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDuration}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colDetail}),(0,S.jsx)(`th`,{className:`px-3 py-2.5 font-medium`,children:n.colChat})]})}),(0,S.jsx)(`tbody`,{children:Ln.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-edge/60 last:border-0`,children:[(0,S.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg`,children:(0,S.jsx)(`time`,{dateTime:e.startedAt,children:Le(e.startedAt)})}),(0,S.jsx)(`td`,{className:`max-w-[10rem] truncate px-3 py-2.5`,children:x.some(t=>t.id===e.jobId)?(0,S.jsx)(`button`,{type:`button`,className:`text-left text-accent hover:underline`,onClick:()=>{let t=x.find(t=>t.id===e.jobId);t&&Mn(t)},children:e.jobName||e.jobId}):(0,S.jsx)(`span`,{className:`text-fg-muted`,children:e.jobName||e.jobId})}),(0,S.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,S.jsx)(`span`,{className:p(`inline-flex rounded-md px-2 py-0.5 text-xs 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`,e.status===`running`&&`bg-accent/15 text-accent`,e.status===`cancelled`&&`bg-surface-hover text-fg-muted`),children:Re(e.status,Fn)})}),(0,S.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5 text-fg-muted`,children:Ie(e.duration)}),(0,S.jsx)(`td`,{className:`max-w-xs truncate px-3 py-2.5 text-fg-muted`,title:e.summary||e.error||``,children:Te(e.summary||e.error,96)}),(0,S.jsx)(`td`,{className:`whitespace-nowrap px-3 py-2.5`,children:e.sessionKey?.trim()?(0,S.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>dt(e.sessionKey),children:n.openChat}):(0,S.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]})]}),(0,S.jsx)(h,{open:N,onOpenChange:e=>!e&&An(),children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,S.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center p-4 pointer-events-none`,children:(0,S.jsxs)(he,{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,S.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,S.jsx)(g,{className:`text-base font-semibold text-fg`,children:P===`edit`?n.editJob:n.addJob}),(0,S.jsx)(pe,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,S.jsx)(u,{className:`size-5`,strokeWidth:1.75})})})]}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.name}),(0,S.jsx)(`input`,{type:`text`,className:pt(),value:Lt,onChange:e=>Rt(e.target.value),placeholder:n.namePlaceholder})]}),(0,S.jsx)(it,{value:zt,onChange:Bt,disabled:K,labels:n.schedulePicker}),(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.mode}),(0,S.jsxs)(`select`,{className:mt(),value:B,onChange:e=>{let t=e.target.value;Kt(t),t===`main`?(H(!1),V(``),W(``)):t===`isolated`&&!Zt.trim()&&G(X())},children:[(0,S.jsx)(`option`,{value:`main`,children:n.modeDirectOption}),(0,S.jsx)(`option`,{value:`isolated`,children:n.modeAgentOption})]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:B===`main`?n.modeDirect:n.modeAgent})]}),B===`isolated`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.model}),(0,S.jsx)(me,{value:Zt,placeholder:c.modelPlaceholder,searchPlaceholder:c.modelSearchPlaceholder,noMatches:c.modelNoMatches,className:`w-full max-w-none min-w-0`,popoverContentClassName:`z-[70]`,onChange:e=>{$t.current=!0,G(e)}})]}),(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.agentProfile}),(0,S.jsxs)(`select`,{className:mt(),value:qt,disabled:K,onChange:e=>V(e.target.value),children:[(0,S.jsx)(`option`,{value:``,children:n.agentProfileDefault}),xn.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.name?`${e.id} — ${e.name}`:e.id},e.id))]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.agentProfileHint})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.workingDirectoryLabel}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:K,className:p(`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`,ye.transition,ye.focusRingPanel,`cursor-pointer hover:bg-surface-hover/70 dark:hover:bg-surface-hover/50`,K&&`cursor-not-allowed opacity-60`),title:U.trim()?`${U.trim()}\n${c.workingDirectory.chooseFolder}`:`${n.workingDirectoryHint}\n${c.workingDirectory.selectWorkingDirectory}`,onClick:e=>{e.stopPropagation(),!K&&(vn?(async()=>{let e=await yn();e&&bn(e)})():Xt(!0))},children:[(0,S.jsx)(te,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,S.jsx)(`span`,{className:`min-w-0 truncate text-left font-medium text-fg`,children:U.trim()?ue(U.trim()):c.workingDirectory.notSet})]}),U.trim()?(0,S.jsx)(`button`,{type:`button`,disabled:K,className:`text-xs font-medium text-accent hover:underline disabled:opacity-50`,onClick:()=>W(``),children:n.workingDirectoryReset}):null]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.workingDirectoryHint})]}),(0,S.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,S.jsx)(`input`,{type:`checkbox`,className:p(`ui-checkbox`,`mt-0.5`),checked:Jt,onChange:e=>H(e.target.checked)}),(0,S.jsxs)(`span`,{children:[(0,S.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.agentLocalOnly}),(0,S.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n.agentLocalOnlyHint})]})]})]}):null,Cn?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.channel}),(0,S.jsxs)(`select`,{className:mt(),value:F,onChange:e=>{let t=e.target.value;I(t),t===`local`&&H(!1),L(``)},children:[(0,S.jsx)(`option`,{value:`local`,children:n.channelLocal}),_t.map(e=>(0,S.jsxs)(`option`,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:`(disabled)`]},e.name))]})]}),Sn?(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.recipient}),(0,S.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,title:n.refreshRecipientHint,onClick:()=>void Be(F).then(wt),children:[(0,S.jsx)(m,{className:`size-3.5`,strokeWidth:1.75}),n.refreshList]})]}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,S.jsx)(`input`,{type:`text`,className:p(pt(),`min-w-0 w-full sm:flex-1`),value:Vt,onChange:e=>L(e.target.value),placeholder:n.recipientPlaceholder}),(0,S.jsxs)(`select`,{className:ht,value:Vt,onChange:e=>{let t=e.target.value;t&&L(t)},children:[(0,S.jsx)(`option`,{value:``,children:n.selectRecipient}),Ct.length>0?Ct.map(e=>(0,S.jsx)(`option`,{value:e.chatId,children:Ce(e,n.lastActiveLabels)},`${e.channel}-${e.chatId}`)):(0,S.jsx)(`option`,{value:``,disabled:!0,children:n.noRecentChatsOption})]})]}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:Ct.length>0?n.enterManuallyOrSelect:n.noRecentChats})]}):null]}):null,(0,S.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n.message}),(0,S.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-base p-0.5 dark:border-edge`,children:[(0,S.jsxs)(`button`,{type:`button`,className:p(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ht===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>On(`edit`),children:[(0,S.jsx)(fe,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),n.messageEdit]}),(0,S.jsxs)(`button`,{type:`button`,className:p(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,Ht===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>On(`preview`),children:[(0,S.jsx)(ie,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),n.messagePreview]})]})]}),(0,S.jsx)(`div`,{className:p(`overflow-hidden rounded-md border border-edge bg-surface-base dark:border-edge`,K&&`pointer-events-none opacity-60`),children:Ht===`edit`?(0,S.jsx)(ve,{initialContent:R,onChange:z,isDark:d,className:`h-[min(18rem,40vh)] min-h-[12rem]`},`cron-msg-${Ft??`new`}-${Wt}`):(0,S.jsx)(`div`,{className:`h-[min(18rem,40vh)] min-h-[12rem] max-h-[min(24rem,50vh)] overflow-y-auto px-3 py-2`,children:R.trim()?(0,S.jsx)(le,{content:R,compact:!0,className:`text-sm`}):(0,S.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.messagePlaceholder})})}),(0,S.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.messageMarkdownHint})]})]})}),(0,S.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[(0,S.jsx)(f,{type:`button`,variant:`secondary`,onClick:An,children:n.cancel}),(0,S.jsx)(f,{type:`button`,variant:`primary`,disabled:K||!wn,onClick:()=>void jn(),children:K?n.loading:P===`edit`?n.save:n.create})]})]})})]})}),vn?null:(0,S.jsx)(ce,{open:Yt,onOpenChange:Xt,initialAbsolutePath:U.trim()||void 0,onConfirm:async e=>{await bn(e),Xt(!1)},wd:c.workingDirectory}),(0,S.jsx)(h,{open:pn,onOpenChange:e=>{mn(e),e&&gn(`all`)},children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[62] bg-scrim`}),(0,S.jsx)(`div`,{className:`fixed inset-0 z-[62] flex items-center justify-center p-4 pointer-events-none`,children:(0,S.jsxs)(he,{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,S.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end border-b border-edge px-4 py-3`,children:[(0,S.jsx)(g,{className:`sr-only`,children:n.fromTemplate}),(0,S.jsx)(pe,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,S.jsx)(u,{className:`size-5`,strokeWidth:1.75})})})]}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:(0,S.jsx)(Ze,{cron:n,localeTag:je,scheduleBadgeLabels:Rn,categoryFilter:hn,onCategoryFilterChange:gn,onSelectTemplate:kn})})]})})]})}),(0,S.jsx)(h,{open:en,onOpenChange:e=>{e||(tn(!1),nn(null))},children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,S.jsxs)(he,{className:p(`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,S.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,S.jsx)(g,{className:`min-w-0 truncate text-base font-semibold text-fg`,children:q?.name?.trim()||q?.id||`—`}),(0,S.jsx)(pe,{asChild:!0,children:(0,S.jsx)(f,{type:`button`,variant:`ghost`,className:`h-9 w-9 shrink-0 p-0`,"aria-label":n.close,children:(0,S.jsx)(u,{className:`size-5`,strokeWidth:1.75})})})]}),(0,S.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:on?(0,S.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,S.jsx)(s,{className:`size-8 animate-spin text-accent`,strokeWidth:1.75})}):q?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.scheduleLabel}),(0,S.jsx)(`dd`,{className:`mt-1 font-mono text-fg`,children:(0,S.jsx)(`code`,{children:q.schedule})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.messageLabel}),(0,S.jsx)(`dd`,{className:`mt-1 min-w-0 break-words text-fg`,children:(0,S.jsx)(le,{content:Ee(q),compact:!0,className:`text-sm`})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.mode}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.sessionTarget===`isolated`?n.modeAgentOption:n.modeDirectOption})]}),q.sessionTarget===`isolated`?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.agentProfile}),(0,S.jsx)(`dd`,{className:`mt-1 font-mono text-sm text-fg`,children:q.agentId?.trim()?q.agentId.trim():n.agentProfileDefault})]}):null,q.sessionTarget===`isolated`?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.workingDirectoryLabel}),(0,S.jsx)(`dd`,{className:`mt-1 break-all font-mono text-xs text-fg`,children:q.workingDirectory?.trim()?q.workingDirectory.trim():c.workingDirectory.notSet})]}):null,q.delivery?.channel===`local`||q.sessionTarget===`isolated`&&!q.delivery?.to?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.deliveryTarget}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.delivery?.channel===`local`?n.deliveryTargetLocalChannel:n.deliveryLocalOnly})]}):q.delivery?.to?(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.deliveryTarget}),(0,S.jsxs)(`dd`,{className:`mt-1 break-words text-fg`,children:[(0,S.jsx)(`code`,{className:`text-xs`,children:q.delivery?.channel??``}),` → `,Ne(q,n.channelLocal)]})]}):null,(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.status}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.enabled?n.enabled:n.disabled})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:n.nextRun}),(0,S.jsx)(`dd`,{className:`mt-1 text-fg`,children:q.next_run?Ae(q.next_run,n.timeLabels):`—`})]})]}),(0,S.jsx)(`h3`,{className:`mt-6 text-sm font-semibold text-fg`,children:n.detailRunHistory}),rn.length===0?(0,S.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n.noRunsYet}):(0,S.jsx)(`div`,{className:`mt-2 overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full border-collapse text-left text-xs`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-edge text-fg-muted`,children:[(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colStarted}),(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.status}),(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colDuration}),(0,S.jsx)(`th`,{className:`py-1.5 pr-2 font-medium`,children:n.colDetail}),(0,S.jsx)(`th`,{className:`py-1.5 font-medium`,children:n.colChat})]})}),(0,S.jsx)(`tbody`,{children:rn.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-edge/60`,children:[(0,S.jsx)(`td`,{className:`whitespace-nowrap py-1.5 pr-2 text-fg`,children:(0,S.jsx)(`time`,{dateTime:e.startedAt,children:Le(e.startedAt)})}),(0,S.jsx)(`td`,{className:`py-1.5 pr-2`,children:(0,S.jsx)(`span`,{className:p(`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:Re(e.status,Fn)})}),(0,S.jsx)(`td`,{className:`py-1.5 pr-2 text-fg-muted`,children:Ie(e.duration)}),(0,S.jsx)(`td`,{className:`max-w-[8rem] truncate py-1.5 pr-2 text-fg-muted`,title:e.summary||e.error||``,children:Te(e.summary||e.error,120)}),(0,S.jsx)(`td`,{className:`whitespace-nowrap py-1.5`,children:e.sessionKey?.trim()?(0,S.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent hover:underline`,title:n.openChatTitle,"aria-label":n.openChatTitle,onClick:()=>dt(e.sessionKey),children:n.openChat}):(0,S.jsx)(`span`,{className:`text-fg-disabled`,children:`—`})})]},e.id))})]})})]}):null})]})]})}),(0,S.jsx)(h,{open:cn,onOpenChange:ln,children:(0,S.jsxs)(_e,{children:[(0,S.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim`}),(0,S.jsx)(`div`,{className:`fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none`,children:(0,S.jsxs)(he,{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,S.jsx)(g,{className:`text-base font-semibold text-fg`,children:J===`delete`?n.delete:n.runNow}),(0,S.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:J===`delete`?n.confirmDelete:n.confirmRun}),(0,S.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,S.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>{ln(!1),fn(null),un(null)},children:n.cancel}),(0,S.jsx)(f,{type:`button`,variant:`primary`,className:J===`delete`?`bg-red-600 hover:bg-red-700`:void 0,onClick:()=>void Pn(),children:J===`delete`?n.delete:n.runNow})]})]})})]})})]}):(0,S.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{_t as CronPage};
2
+ //# sourceMappingURL=cron-page-D6wtd-hq.js.map